@runmedev/react-components 0.1.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6542,9 +6542,9 @@ Open Dashboard to configure it`)},k=function(){var ae;const de=(0,U.getContext)(
|
|
|
6542
6542
|
`},"./src/client/utils.ts":(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getContext=o,e.setContext=a,e.closeOutput=d,e.formatDate=i,e.formatDateWithTimeAgo=n;const s=t("./src/utils/messaging.ts"),c=t("./src/constants.ts");let u;function o(){if(!u)throw new Error("Renderer context not defined");return u}function a(l){u=l}function d({id:l,outputType:h}){const m=o();m.postMessage&&(0,s.postClientMessage)(m,c.ClientMessages.closeCellOutput,{id:l,outputType:h})}function i(l){return l.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}function n(l){const h=new Date().getTime()-l.getTime(),m=Math.floor(h/1e3)*-1,p=new Intl.RelativeTimeFormat("en",{numeric:"auto"});return Math.abs(m)<60?p.format(Math.round(m),"second"):Math.abs(m)<3600?p.format(Math.round(m/60),"minute"):Math.abs(m)<86400?p.format(Math.round(m/3600),"hour"):p.format(Math.round(m/86400),"day")}},"./src/constants.ts":(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RUNME_FRONTMATTER_PARSED=e.PLATFORM_USER_SIGNED_IN=e.GITHUB_USER_SIGNED_IN=e.SAVE_CELL_LOGIN_CONSENT_STORAGE_KEY=e.CELL_CREATION_DATE_STORAGE_KEY=e.EXECUTION_CELL_STORAGE_KEY=e.FOCUS_CELL_STORAGE_KEY=e.CATEGORY_SEPARATOR=e.WebViews=e.TELEMETRY_EVENTS=e.EXTENSION_NAME=e.SUPPORTED_FILE_EXTENSIONS=e.LANGUAGE_PREFIXES=e.NOTEBOOK_ENV_VAR_MODE=e.NOTEBOOK_AUTHOR_MODE_ON=e.NOTEBOOK_RUN_WITH_PROMPTS=e.NOTEBOOK_PREVIEW_OUTPUTS=e.NOTEBOOK_MODE=e.NOTEBOOK_OUTPUTS_MASKED=e.NOTEBOOK_LIFECYCLE_ID=e.NOTEBOOK_AUTOSAVE_ON=e.NOTEBOOK_HAS_CATEGORIES=e.NOTEBOOK_AVAILABLE_CATEGORIES=e.NotebookMode=e.AuthenticationProviders=e.RENDERERS=e.DEFAULT_PROMPT_ENV=e.SERVER_PORT=e.SERVER_ADDRESS=e.DEFAULT_LANGUAGEID=e.VSCODE_LANGUAGEID_MAP=e.LANGUAGES=e.LANGID_AND_EXTENSIONS=e.LANG_IDS_WITH_DESTINATION=e.ClientMessages=e.OutputType=void 0;var t;(function(i){i.vercel="stateful.runme/vercel-stdout",i.deno="stateful.runme/deno-stdout",i.outputItems="stateful.runme/output-items",i.annotations="stateful.runme/annotations",i.terminal="stateful.runme/terminal",i.error="stateful.runme/error",i.github="stateful.runme/github-stdout",i.stdout="application/vnd.code.notebook.stdout",i.gcp="stateful.runme/gcp",i.aws="stateful.runme/aws",i.daggerCall="stateful.runme/dagger",i.daggerShell="stateful.runme/dagger"})(t||(e.OutputType=t={}));var s;(function(i){i.infoMessage="common:infoMessage",i.errorMessage="common:errorMessage",i.closeCellOutput="common:closeCellOutput",i.displayPrompt="common:displayPrompt",i.onPrompt="common:onPrompt",i.setState="common:setState",i.getState="common:getState",i.onGetState="common:onGetState",i.onCategoryChange="common:onCategoryChange",i.platformApiRequest="common:platformApiRequest",i.platformApiResponse="common:platformApiResponse",i.optionsMessage="common:optionsMessage",i.optionsModal="common:optionsModal",i.openExternalLink="common:openExternalLink",i.onOptionsMessage="common:onOptionsMessage",i.copyTextToClipboard="common:copyTextToClipboard",i.onCopyTextToClipboard="common:onCopyTextToClipboard",i.onProgramClose="common:onProgramClose",i.denoUpdate="deno:deploymentUpdate",i.denoPromote="deno:promoteDeployment",i.vercelProd="vercel:promotePreview",i.mutateAnnotations="annotations:mutate",i.terminalStdout="terminal:stdout",i.terminalStderr="terminal:stderr",i.terminalStdin="terminal:stdin",i.terminalResize="terminal:resize",i.terminalFocus="terminal:focus",i.terminalOpen="terminal:open",i.openLink="terminal:openLink",i.activeThemeChanged="theme:changed",i.githubWorkflowDispatch="github:workflowDispatch",i.githubWorkflowDeploy="github:workflowDeploy",i.githubWorkflowStatusUpdate="github:workflowStatusUpdate",i.tangleEvent="tangle:event",i.gcpResourceStatusChanged="gcp:resourceStatusChanged",i.gcpClusterCheckStatus="gcp:clusterCheckStatus",i.gcpClusterDetails="gcp:clusterDetails",i.gcpClusterDetailsNewCell="gcp:clusterDetailsNewCell",i.gcpClusterDetailsResponse="gcp:clusterDetailsResponse",i.gcpVMInstanceAction="gcp:gceVMInstanceAction",i.awsEC2Instances="aws:ec2Instances",i.awsEC2InstanceAction="aws:ec2InstanceAction",i.awsEKSClusterAction="aws:eksClusterAction",i.onAuthorModeChange="common:onAuthorModeChange",i.gistCell="gist:cell",i.gcpCloudRunAction="gcp:cloudRunAction",i.gcpLoadServices="gcp:loadServices",i.gcpServicesLoaded="gcp:servicesLoaded",i.daggerSyncState="dagger:syncState",i.daggerCliAction="dagger:cliAction",i.featuresUpdateAction="features:updateAction",i.featuresRequest="features:request",i.featuresResponse="features:response"})(s||(e.ClientMessages=s={})),e.LANG_IDS_WITH_DESTINATION=[["Assembly","asm","sh"],["Batchfile","bat","sh"],["C","c",void 0],["C#","cs",void 0],["C++","cpp",void 0],["Cpp","cpp",void 0],["Clojure","clj",void 0],["CMake","cmake","sh"],["COBOL","cbl","null"],["CoffeeScript","coffee","html"],["CSS","css",void 0],["CSV","csv",void 0],["Dart","dart",void 0],["DM","dm",void 0],["Dockerfile","dockerfile","sh"],["Elixir","ex",void 0],["Erlang","erl",void 0],["Fortran","f90",void 0],["Go","go",void 0],["Groovy","groovy",void 0],["Haskell","hs",void 0],["HTML","html",void 0],["INI","ini",void 0],["Java","java",void 0],["JavaScript","js",void 0],["JSON","json",void 0],["JSONC","jsonc",void 0],["Julia","jl",void 0],["Kotlin","kt",void 0],["Lisp","lisp",void 0],["Lua","lua",void 0],["Log","log",void 0],["Makefile","makefile","sh"],["Markdown","md",void 0],["Matlab","matlab",void 0],["Objective-C","mm",void 0],["OCaml","ml",void 0],["Pascal","pas",void 0],["Perl","pm",void 0],["PHP","php",void 0],["PowerShell","ps1",void 0],["Prolog","prolog",void 0],["Python","py",void 0],["R","r",void 0],["Ruby","rb",void 0],["Rust","rs",void 0],["Scala","scala",void 0],["Shell","sh","sh"],["SQL","sql",void 0],["Swift","swift",void 0],["TeX","tex",void 0],["TOML","toml",void 0],["TypeScript","ts",void 0],["Verilog","v",void 0],["Visual Basic","vba",void 0],["XML","xml",void 0],["YAML","yaml",void 0]],e.LANGID_AND_EXTENSIONS=e.LANG_IDS_WITH_DESTINATION.reduce((i,[n,l])=>!n||!l?i:i.set(n.toLocaleLowerCase(),l),new Map),e.LANGUAGES=new Map(e.LANG_IDS_WITH_DESTINATION.map(([,i,n])=>[i,n])),e.VSCODE_LANGUAGEID_MAP={console:"sh",shell:"sh",shellscript:"sh",javascriptreact:"jsx",typescriptreact:"tsx"},e.DEFAULT_LANGUAGEID="shellscript",e.SERVER_ADDRESS="localhost",e.SERVER_PORT=7863,e.DEFAULT_PROMPT_ENV=!0;var c;(function(i){i.VercelOutput="vercel-output",i.DenoOutput="deno-output",i.ShellOutput="shell-output",i.ShellOutputItems="shell-output-items",i.EditAnnotations="edit-annotations",i.TerminalView="terminal-view",i.GitHubWorkflowViewer="github-workflow-viewer",i.GCPView="gcp-view",i.AWSView="aws-view",i.DaggerCli="dagger-cli"})(c||(e.RENDERERS=c={}));var u;(function(i){i.GitHub="github",i.Stateful="stateful"})(u||(e.AuthenticationProviders=u={}));var o;(function(i){i.Execution="execution",i.SessionOutputs="sessionOutputs"})(o||(e.NotebookMode=o={})),e.NOTEBOOK_AVAILABLE_CATEGORIES="notebookAvailableCategories",e.NOTEBOOK_HAS_CATEGORIES="notebookHasCategories",e.NOTEBOOK_AUTOSAVE_ON="notebookAutoSaveOn",e.NOTEBOOK_LIFECYCLE_ID="notebookLifecycleId",e.NOTEBOOK_OUTPUTS_MASKED="notebookOutputsMasked",e.NOTEBOOK_MODE="notebookMode",e.NOTEBOOK_PREVIEW_OUTPUTS="notebookPreviewRunmeOutputs",e.NOTEBOOK_RUN_WITH_PROMPTS="notebookRunWithPrompts",e.NOTEBOOK_AUTHOR_MODE_ON="notebookAuthorModeOn",e.NOTEBOOK_ENV_VAR_MODE="notebookEnvVarMode",e.LANGUAGE_PREFIXES={abap:"ABAP",asc:"Public Key",ash:"AGS Script",ampl:"AMPL",mod:"XML",g4:"ANTLR",apib:"API Blueprint",apl:"APL",dyalog:"APL",asp:"ASP",asax:"ASP",ascx:"ASP",ashx:"ASP",asmx:"ASP",aspx:"ASP",axd:"ASP",dats:"ATS",hats:"ATS",sats:"ATS",as:"ActionScript",adb:"Ada",ada:"Ada",ads:"Ada",agda:"Agda",als:"Alloy",apacheconf:"ApacheConf",vhost:"Nginx",cls:"Visual Basic",applescript:"AppleScript",scpt:"AppleScript",arc:"Arc",ino:"Arduino",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aj:"AspectJ",asm:"Assembly",a51:"Assembly",inc:"SourcePawn",nasm:"Assembly",aug:"Augeas",ahk:"AutoHotkey",ahkl:"AutoHotkey",au3:"AutoIt",awk:"Awk",auk:"Awk",gawk:"Awk",mawk:"Awk",nawk:"Awk",bat:"Batchfile",cmd:"Batchfile",befunge:"Befunge",bison:"Bison",bb:"BlitzBasic",decls:"BlitzBasic",bmx:"BlitzMax",bsv:"Bluespec",boo:"Boo",b:"Limbo",bf:"HyPhy",brs:"Brightscript",bro:"Bro",c:"C",cats:"C",h:"Objective-C",idc:"C",w:"C",cs:"Smalltalk",cake:"CoffeeScript",cshtml:"C#",csx:"C#",cpp:"C++","c++":"C++",cc:"C++",cp:"Component Pascal",cxx:"C++","h++":"C++",hh:"Hack",hpp:"C++",hxx:"C++",inl:"C++",ipp:"C++",tcc:"C++",tpp:"C++","c-objdump":"C-ObjDump",chs:"C2hs Haskell",clp:"CLIPS",cmake:"CMake","cmake.in":"CMake",cob:"COBOL",cbl:"COBOL",ccp:"COBOL",cobol:"COBOL",cpy:"COBOL",css:"CSS",csv:"CSV",capnp:"Cap'n Proto",mss:"CartoCSS",ceylon:"Ceylon",chpl:"Chapel",ch:"xBase",ck:"ChucK",cirru:"Cirru",clw:"Clarion",icl:"Clean",dcl:"Clean",click:"Click",clj:"Clojure",boot:"Clojure",cl2:"Clojure",cljc:"Clojure",cljs:"Clojure","cljs.hl":"Clojure",cljscm:"Clojure",cljx:"Clojure",hic:"Clojure",coffee:"CoffeeScript",_coffee:"CoffeeScript",cjsx:"CoffeeScript",cson:"CoffeeScript",iced:"CoffeeScript",cfm:"ColdFusion",cfml:"ColdFusion",cfc:"ColdFusion CFC",lisp:"NewLisp",asd:"Common Lisp",cl:"OpenCL",l:"PicoLisp",lsp:"NewLisp",ny:"Common Lisp",podsl:"Common Lisp",sexp:"Common Lisp",cps:"Component Pascal",coq:"Coq",v:"Verilog",cppobjdump:"Cpp-ObjDump","c++-objdump":"Cpp-ObjDump","c++objdump":"Cpp-ObjDump","cpp-objdump":"Cpp-ObjDump","cxx-objdump":"Cpp-ObjDump",creole:"Creole",cr:"Crystal",feature:"Cucumber",cu:"Cuda",cuh:"Cuda",cy:"Cycript",pyx:"Cython",pxd:"Cython",pxi:"Cython",d:"Makefile",di:"D","d-objdump":"D-ObjDump",com:"DIGITAL Command Language",dm:"DM",zone:"DNS Zone",arpa:"DNS Zone",darcspatch:"Darcs Patch",dpatch:"Darcs Patch",dart:"Dart",diff:"Diff",patch:"Diff",dockerfile:"Dockerfile",djs:"Dogescript",dylan:"Dylan",dyl:"Dylan",intr:"Dylan",lid:"Dylan",E:"E",ecl:"ECLiPSe",eclxml:"ECL",sch:"KiCad",brd:"KiCad",epj:"Ecere Projects",e:"Eiffel",ex:"Elixir",exs:"Elixir",elm:"Elm",el:"Emacs Lisp",emacs:"Emacs Lisp","emacs.desktop":"Emacs Lisp",em:"EmberScript",emberscript:"EmberScript",erl:"Erlang",es:"JavaScript",escript:"Erlang",hrl:"Erlang",xrl:"Erlang",yrl:"Erlang",fs:"GLSL",fsi:"F#",fsx:"F#",fx:"HLSL",flux:"FLUX",f90:"FORTRAN",f:"Forth",f03:"FORTRAN",f08:"FORTRAN",f77:"FORTRAN",f95:"FORTRAN",for:"Forth",fpp:"FORTRAN",factor:"Factor",fy:"Fancy",fancypack:"Fancy",fan:"Fantom","eam.fs":"Formatted",fth:"Forth","4th":"Forth",forth:"Forth",fr:"Text",frt:"Forth",ftl:"FreeMarker",g:"GAP",gco:"G-code",gcode:"G-code",gms:"GAMS",gap:"GAP",gd:"GDScript",gi:"GAP",tst:"Scilab",s:"GAS",ms:"MAXScript",glsl:"GLSL",fp:"GLSL",frag:"JavaScript",frg:"GLSL",fsh:"GLSL",fshader:"GLSL",geo:"GLSL",geom:"GLSL",glslv:"GLSL",gshader:"GLSL",shader:"GLSL",vert:"GLSL",vrx:"GLSL",vsh:"GLSL",vshader:"GLSL",gml:"XML",kid:"Genshi",ebuild:"Gentoo Ebuild",eclass:"Gentoo Eclass",po:"Gettext Catalog",pot:"Gettext Catalog",glf:"Glyph",gp:"Gnuplot",gnu:"Gnuplot",gnuplot:"Gnuplot",plot:"Gnuplot",plt:"Gnuplot",go:"Go",golo:"Golo",gs:"JavaScript",gst:"Gosu",gsx:"Gosu",vark:"Gosu",grace:"Grace",gradle:"Gradle",gf:"Grammatical Framework",graphql:"GraphQL",dot:"Graphviz (DOT)",gv:"Graphviz (DOT)",man:"Groff","1in":"Groff","1m":"Groff","1x":"Groff","3in":"Groff","3m":"Groff","3qt":"Groff","3x":"Groff",me:"Groff",n:"Nemerle",rno:"Groff",roff:"Groff",groovy:"Groovy",grt:"Groovy",gtpl:"Groovy",gvy:"Groovy",gsp:"Groovy Server Pages",hcl:"HCL",tf:"HCL",hlsl:"HLSL",fxh:"HLSL",hlsli:"HLSL",html:"HTML",htm:"HTML","html.hl":"HTML",st:"Smalltalk",xht:"HTML",xhtml:"HTML",mustache:"HTML+Django",jinja:"HTML+Django",eex:"HTML+EEX",erb:"HTML+ERB","erb.deface":"HTML+ERB",phtml:"HTML+PHP",http:"HTTP",php:"PHP",haml:"Haml","haml.deface":"Haml",handlebars:"Handlebars",hbs:"Handlebars",hb:"Harbour",hs:"Haskell",hsc:"Haskell",hx:"Haxe",hxsl:"Haxe",hy:"Hy",pro:"QMake",dlm:"IDL",ipf:"IGOR Pro",ini:"INI",cfg:"INI",prefs:"INI",properties:"INI",irclog:"IRC log",weechatlog:"IRC log",idr:"Idris",lidr:"Idris",ni:"Inform 7",i7x:"Inform 7",iss:"Inno Setup",io:"Io",ik:"Ioke",thy:"Isabelle",ijs:"J",flex:"JFlex",jflex:"JFlex",json:"JSON",geojson:"JSON",lock:"JSON",topojson:"JSON",json5:"JSON5",jsonld:"JSONLD",jq:"JSONiq",jsx:"JSX",jade:"Jade",j:"Objective-J",java:"Java",jsp:"Java Server Pages",js:"JavaScript",_js:"JavaScript",bones:"JavaScript",es6:"JavaScript",jake:"JavaScript",jsb:"JavaScript",jscad:"JavaScript",jsfl:"JavaScript",jsm:"JavaScript",jss:"JavaScript",njs:"JavaScript",pac:"JavaScript",sjs:"JavaScript",ssjs:"JavaScript","sublime-build":"JavaScript","sublime-commands":"JavaScript","sublime-completions":"JavaScript","sublime-keymap":"JavaScript","sublime-macro":"JavaScript","sublime-menu":"JavaScript","sublime-mousemap":"JavaScript","sublime-project":"JavaScript","sublime-settings":"JavaScript","sublime-theme":"JavaScript","sublime-workspace":"JavaScript",sublime_metrics:"JavaScript",sublime_session:"JavaScript",xsjs:"JavaScript",xsjslib:"JavaScript",jl:"Julia",ipynb:"Jupyter Notebook",krl:"KRL",kicad_pcb:"KiCad",kit:"Kit",kt:"Kotlin",ktm:"Kotlin",kts:"Kotlin",lfe:"LFE",ll:"LLVM",lol:"LOLCODE",lsl:"LSL",lslp:"LSL",lvproj:"LabVIEW",lasso:"Lasso",las:"Lasso",lasso8:"Lasso",lasso9:"Lasso",ldml:"Lasso",latte:"Latte",lean:"Lean",hlean:"Lean",less:"Less",lex:"Lex",ly:"LilyPond",ily:"LilyPond",m:"Objective-C",ld:"Linker Script",lds:"Linker Script",liquid:"Liquid",lagda:"Literate Agda",litcoffee:"Literate CoffeeScript",lhs:"Literate Haskell",ls:"LoomScript",_ls:"LiveScript",xm:"Logos",x:"Logos",xi:"Logos",lgt:"Logtalk",logtalk:"Logtalk",lookml:"LookML",lua:"Lua",fcgi:"Shell",nse:"Lua",pd_lua:"Lua",rbxs:"Lua",wlua:"Lua",mumps:"M",m4:"M4Sugar",mcr:"MAXScript",mtml:"MTML",muf:"MUF",mak:"Makefile",mk:"Makefile",mkfile:"Makefile",mako:"Mako",mao:"Mako",md:"Markdown",markdown:"Markdown",mkd:"Markdown",mkdn:"Markdown",mkdown:"Markdown",ron:"Markdown",mask:"Mask",mathematica:"Mathematica",cdf:"Mathematica",ma:"Mathematica",mt:"Mathematica",nb:"Text",nbp:"Mathematica",wl:"Mathematica",wlt:"Mathematica",matlab:"Matlab",maxpat:"Max",maxhelp:"Max",maxproj:"Max",mxt:"Max",pat:"Max",mediawiki:"MediaWiki",wiki:"MediaWiki",moo:"Moocode",metal:"Metal",minid:"MiniD",druby:"Mirah",duby:"Mirah",mir:"Mirah",mirah:"Mirah",mo:"Modelica",mms:"Module Management System",mmk:"Module Management System",monkey:"Monkey",moon:"MoonScript",myt:"Myghty",ncl:"Text",nl:"NewLisp",nsi:"NSIS",nsh:"NSIS",axs:"NetLinx",axi:"NetLinx","axs.erb":"NetLinx+ERB","axi.erb":"NetLinx+ERB",nlogo:"NetLogo",nginxconf:"Nginx",nim:"Nimrod",nimrod:"Nimrod",ninja:"Ninja",nit:"Nit",nix:"Nix",nu:"Nu",numpy:"NumPy",numpyw:"NumPy",numsc:"NumPy",ml:"OCaml",eliom:"OCaml",eliomi:"OCaml",ml4:"OCaml",mli:"OCaml",mll:"OCaml",mly:"OCaml",objdump:"ObjDump",mm:"XML",sj:"Objective-J",omgrofl:"Omgrofl",opa:"Opa",opal:"Opal",opencl:"OpenCL",p:"OpenEdge ABL",scad:"OpenSCAD",org:"Org",ox:"Ox",oxh:"Ox",oxo:"Ox",oxygene:"Oxygene",oz:"Oz",pwn:"PAWN",aw:"PHP",ctp:"PHP",php3:"PHP",php4:"PHP",php5:"PHP",phps:"PHP",phpt:"PHP",pls:"PLSQL",pck:"PLSQL",pkb:"PLSQL",pks:"PLSQL",plb:"PLSQL",plsql:"PLSQL",sql:"SQLPL",pov:"POV-Ray SDL",pan:"Pan",psc:"Papyrus",parrot:"Parrot",pasm:"Parrot Assembly",pir:"Parrot Internal Representation",pas:"Pascal",dfm:"Pascal",dpr:"Pascal",lpr:"Pascal",pp:"Puppet",pl:"Prolog",al:"Perl",cgi:"Shell",perl:"Perl",ph:"Perl",plx:"Perl",pm:"Perl6",pod:"Pod",psgi:"Perl",t:"Turing","6pl":"Perl6","6pm":"Perl6",nqp:"Perl6",p6:"Perl6",p6l:"Perl6",p6m:"Perl6",pl6:"Perl6",pm6:"Perl6",pkl:"Pickle",pig:"PigLatin",pike:"Pike",pmod:"Pike",pogo:"PogoScript",pony:"Pony",ps:"PostScript",eps:"PostScript",ps1:"PowerShell",psd1:"PowerShell",psm1:"PowerShell",pde:"Processing",prolog:"Prolog",yap:"Prolog",spin:"Propeller Spin",proto:"Protocol Buffer",pub:"Public Key",pd:"Pure Data",pb:"PureBasic",pbi:"PureBasic",purs:"PureScript",py:"Python",bzl:"Python",gyp:"Python",lmi:"Python",pyde:"Python",pyp:"Python",pyt:"Python",pyw:"Python",rpy:"Ren'Py",tac:"Python",wsgi:"Python",xpy:"Python",pytb:"Python traceback",qml:"QML",qbs:"QML",pri:"QMake",r:"Rebol",rd:"R",rsx:"R",raml:"RAML",rdoc:"RDoc",rbbas:"REALbasic",rbfrm:"REALbasic",rbmnu:"REALbasic",rbres:"REALbasic",rbtbar:"REALbasic",rbuistate:"REALbasic",rhtml:"RHTML",rmd:"RMarkdown",rkt:"Racket",rktd:"Racket",rktl:"Racket",scrbl:"Racket",rl:"Ragel in Ruby Host",raw:"Raw token data",reb:"Rebol",r2:"Rebol",r3:"Rebol",rebol:"Rebol",red:"Red",reds:"Red",cw:"Redcode",rs:"Rust",rsh:"RenderScript",robot:"RobotFramework",rg:"Rouge",rb:"Ruby",builder:"Ruby",gemspec:"Ruby",god:"Ruby",irbrc:"Ruby",jbuilder:"Ruby",mspec:"Ruby",pluginspec:"XML",podspec:"Ruby",rabl:"Ruby",rake:"Ruby",rbuild:"Ruby",rbw:"Ruby",rbx:"Ruby",ru:"Ruby",ruby:"Ruby",thor:"Ruby",watchr:"Ruby","rs.in":"Rust",sas:"SAS",scss:"SCSS",smt2:"SMT",smt:"SMT",sparql:"SPARQL",rq:"SPARQL",sqf:"SQF",hqf:"SQF",cql:"SQL",ddl:"SQL",prc:"SQL",tab:"SQL",udf:"SQL",viw:"SQL",db2:"SQLPL",ston:"STON",svg:"SVG",sage:"Sage",sagews:"Sage",sls:"Scheme",sass:"Sass",scala:"Scala",sbt:"Scala",sc:"SuperCollider",scaml:"Scaml",scm:"Scheme",sld:"Scheme",sps:"Scheme",ss:"Scheme",sci:"Scilab",sce:"Scilab",self:"Self",sh:"Shell",bash:"Shell",bats:"Shell",command:"Shell",ksh:"Shell","sh.in":"Shell",tmux:"Shell",tool:"Shell",zsh:"Shell","sh-session":"ShellSession",shen:"Shen",sl:"Slash",slim:"Slim",smali:"Smali",tpl:"Smarty",sp:"SourcePawn",sma:"SourcePawn",nut:"Squirrel",stan:"Stan",ML:"Standard ML",fun:"Standard ML",sig:"Standard ML",sml:"Standard ML",do:"Stata",ado:"Stata",doh:"Stata",ihlp:"Stata",mata:"Stata",matah:"Stata",sthlp:"Stata",styl:"Stylus",scd:"SuperCollider",swift:"Swift",sv:"SystemVerilog",svh:"SystemVerilog",vh:"SystemVerilog",toml:"TOML",txl:"TXL",tcl:"Tcl",adp:"Tcl",tm:"Tcl",tcsh:"Tcsh",csh:"Tcsh",tex:"TeX",aux:"TeX",bbx:"TeX",bib:"TeX",cbx:"TeX",dtx:"TeX",ins:"TeX",lbx:"TeX",ltx:"TeX",mkii:"TeX",mkiv:"TeX",mkvi:"TeX",sty:"TeX",toc:"TeX",tea:"Tea",txt:"Text",no:"Text",textile:"Textile",thrift:"Thrift",tu:"Turing",ttl:"Turtle",twig:"Twig",ts:"typescript",tsx:"typescriptreact",upc:"Unified Parallel C",anim:"Unity3D Asset",asset:"Unity3D Asset",mat:"Unity3D Asset",meta:"Unity3D Asset",prefab:"Unity3D Asset",unity:"Unity3D Asset",uno:"Uno",uc:"UnrealScript",ur:"UrWeb",urs:"UrWeb",vcl:"VCL",vhdl:"VHDL",vhd:"VHDL",vhf:"VHDL",vhi:"VHDL",vho:"VHDL",vhs:"VHDL",vht:"VHDL",vhw:"VHDL",vala:"Vala",vapi:"Vala",veo:"Verilog",vim:"VimL",vb:"Visual Basic",bas:"Visual Basic",frm:"Visual Basic",frx:"Visual Basic",vba:"Visual Basic",vbhtml:"Visual Basic",vbs:"Visual Basic",volt:"Volt",vue:"Vue",owl:"Web Ontology Language",webidl:"WebIDL",x10:"X10",xc:"XC",xml:"XML",ant:"XML",axml:"XML",ccxml:"XML",clixml:"XML",cproject:"XML",csl:"XML",csproj:"XML",ct:"XML",dita:"XML",ditamap:"XML",ditaval:"XML","dll.config":"XML",dotsettings:"XML",filters:"XML",fsproj:"XML",fxml:"XML",glade:"XML",grxml:"XML",iml:"XML",ivy:"XML",jelly:"XML",jsproj:"XML",kml:"XML",launch:"XML",mdpolicy:"XML",mxml:"XML",nproj:"XML",nuspec:"XML",odd:"XML",osm:"XML",plist:"XML",props:"XML",ps1xml:"XML",psc1:"XML",pt:"XML",rdf:"XML",rss:"XML",scxml:"XML",srdf:"XML",storyboard:"XML",stTheme:"XML","sublime-snippet":"XML",targets:"XML",tmCommand:"XML",tml:"XML",tmLanguage:"XML",tmPreferences:"XML",tmSnippet:"XML",tmTheme:"XML",ui:"XML",urdf:"XML",ux:"XML",vbproj:"XML",vcxproj:"XML",vssettings:"XML",vxml:"XML",wsdl:"XML",wsf:"XML",wxi:"XML",wxl:"XML",wxs:"XML",x3d:"XML",xacro:"XML",xaml:"XML",xib:"XML",xlf:"XML",xliff:"XML",xmi:"XML","xml.dist":"XML",xproj:"XML",xsd:"XML",xul:"XML",zcml:"XML","xsp-config":"XPages","xsp.metadata":"XPages",xpl:"XProc",xproc:"XProc",xquery:"XQuery",xq:"XQuery",xql:"XQuery",xqm:"XQuery",xqy:"XQuery",xs:"XS",xslt:"XSLT",xsl:"XSLT",xojo_code:"Xojo",xojo_menu:"Xojo",xojo_report:"Xojo",xojo_script:"Xojo",xojo_toolbar:"Xojo",xojo_window:"Xojo",xtend:"Xtend",yml:"YAML",reek:"YAML",rviz:"YAML","sublime-syntax":"YAML",syntax:"YAML",yaml:"YAML","yaml-tmlanguage":"YAML",yang:"YANG",y:"Yacc",yacc:"Yacc",yy:"Yacc",zep:"Zephir",zimpl:"Zimpl",zmpl:"Zimpl",zpl:"Zimpl",desktop:"desktop","desktop.in":"desktop",ec:"eC",eh:"eC",edn:"edn",fish:"fish",mu:"mupad",nc:"nesC",ooc:"ooc",rst:"reStructuredText",rest:"reStructuredText","rest.txt":"reStructuredText","rst.txt":"reStructuredText",wisp:"wisp",prg:"xBase",prw:"xBase"},e.SUPPORTED_FILE_EXTENSIONS=["sh","bash","ksh","zsh","fish","bat","cmd","pwsh",...Object.keys(e.LANGUAGE_PREFIXES)],e.EXTENSION_NAME="stateful.runme";var a;(function(i){i.RecommendExtension="runme.recommendExtension",i.NotebookGist="runme.notebookGist",i.CellGist="runme.cellGist",i.ShellWarning="extension.shellWarning",i.OpenWorkspace="cloud.OpenWorkspace"})(a||(e.TELEMETRY_EVENTS=a={}));var d;(function(i){i.RunmeCloud="runme.cloud",i.RunmeChat="runme.chat",i.RunmeSearch="runme.search",i.NotebookEnvStore="runme.notebook.envStore"})(d||(e.WebViews=d={})),e.CATEGORY_SEPARATOR=",",e.FOCUS_CELL_STORAGE_KEY="focusCell",e.EXECUTION_CELL_STORAGE_KEY="executionCell",e.CELL_CREATION_DATE_STORAGE_KEY="cellCreationDate",e.SAVE_CELL_LOGIN_CONSENT_STORAGE_KEY="loginConsent",e.GITHUB_USER_SIGNED_IN="userSignedIn",e.PLATFORM_USER_SIGNED_IN="platformUserSignedIn",e.RUNME_FRONTMATTER_PARSED="runme.dev/frontmatterParsed"},"./src/extension/grpc/runner/v1.ts":function(r,e,t){var s=this&&this.__createBinding||(Object.create?function(u,o,a,d){d===void 0&&(d=a);var i=Object.getOwnPropertyDescriptor(o,a);(!i||("get"in i?!o.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(u,d,i)}:function(u,o,a,d){d===void 0&&(d=a),u[d]=o[a]}),c=this&&this.__exportStar||function(u,o){for(var a in u)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&s(o,u,a)};Object.defineProperty(e,"__esModule",{value:!0}),c(t("./node_modules/@buf/stateful_runme.community_timostamm-protobuf-ts/runme/runner/v1/runner_pb.js"),e)},"./src/extension/resolvers/awsResolver.ts":(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AWSResolver=e.AWSSupportedView=void 0;var t;(function(c){c.EC2Instances="ec2Instances",c.EC2InstanceDetails="ec2InstanceDetails",c.EKSClusters="eksClusters"})(t||(e.AWSSupportedView=t={}));class s{constructor(u){var o;this.cellText=u,this.supportedFeatures=new Map,this.supportedFeatures.set("/ec2/details",{view:t.EC2InstanceDetails,data:{urlRegex:/ec2\/home[?]?region=[^#]+#InstanceDetails:instanceId=([^\s&]+)/,region:"",instanceId:""}}),this.supportedFeatures.set("/ec2/home",{view:t.EC2Instances,data:{region:""}}),this.supportedFeatures.set("/eks/home",{view:t.EKSClusters,data:{region:""}});const a=this.cellText;if(a.includes("console.aws.amazon.com")){const d=new URL(a);let i=null;for(const[n,l]of this.supportedFeatures)if((o=l.data.urlRegex)!=null&&o.test(a)||n===d.pathname){i=l;break}if(i){if(i.data.urlRegex&&i.data){if(i.view===t.EC2InstanceDetails){const l=/instanceId=([^&]+)/.exec(d.toString());l&&(i.data.instanceId=l[0].split("=")[1]);const h=/region=([^&]+)/.exec(d.toString());h&&(i.data.region=h[1].split("#")[0])}const n=i.data.urlRegex.exec(d.pathname);if(n){const[,...l]=n;Object.keys(i.data).forEach((h,m)=>{i.data[h]=l[m]})}}if(i.view===t.EKSClusters){const n=/clusters\/([^&]+)/.exec(d.toString());if(n){const[,l]=n;i.data.cluster=l}}i.data.region=d.searchParams.get("region"),this.resolvedFeature={...i}}}}match(){return!!this.resolvedFeature}get(){return this.resolvedFeature}dispose(){this.supportedFeatures.clear()}}e.AWSResolver=s},"./src/extension/resolvers/gcpResolver.ts":(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GCPResolver=e.GCPSupportedView=void 0;var t;(function(c){c.CLUSTERS="clusters",c.CLUSTER="cluster",c.VM_INSTANCES="vm_instances",c.VM_INSTANCE="vm_instance",c.CLOUD_RUN_SERVICES="cloud_run_services",c.CLOUD_RUN_REVISIONS="cloud_run_revisions"})(t||(e.GCPSupportedView=t={}));class s{constructor(u){var o;this.cellText=u,this.supportedFeatures=new Map,this.supportedFeatures.set("/kubernetes/list/overview",{view:t.CLUSTERS,data:{project:""}}),this.supportedFeatures.set("/kubernetes/clusters/details",{view:t.CLUSTER,data:{location:"",cluster:"",urlRegex:/kubernetes\/clusters\/details\/([^/]+)\/([^/]+)\/details/,project:""}}),this.supportedFeatures.set("/compute/instances",{view:t.VM_INSTANCES,data:{urlRegex:/compute\/instances[?]project=.+/,project:""}}),this.supportedFeatures.set("/compute/instancesDetail",{view:t.VM_INSTANCE,data:{urlRegex:/compute\/instancesDetail\/zones\/([^/]+)\/instances\/([^/]+)(\?project=(.+))?/,location:"",instance:"",project:""}}),this.supportedFeatures.set("/run",{view:t.CLOUD_RUN_SERVICES,data:{urlRegex:/run[?]project=.+/,project:""}}),this.supportedFeatures.set("/revisions",{view:t.CLOUD_RUN_REVISIONS,data:{urlRegex:/^\/run\/detail\/([^/]+)\/([^/]+)\/revisions$/,region:"",service:""}});const a=this.cellText;if(a.startsWith("https://console.cloud.google.com")){const d=new URL(a);let i=null;for(const[n,l]of this.supportedFeatures)if((o=l.data.urlRegex)!=null&&o.test(d.pathname)||n===d.pathname){i=l;break}if(i){if(i.data.urlRegex&&i.data){const n=i.data.urlRegex.exec(d.pathname);if(n){const[,...l]=n;Object.keys(i.data).filter(h=>h!=="urlRegex").forEach((h,m)=>{i.data[h]=l[m]})}}i.data.project=d.searchParams.get("project"),this.resolvedFeature={...i}}}}match(){return!!this.resolvedFeature}get(){return this.resolvedFeature}dispose(){this.supportedFeatures.clear()}}e.GCPResolver=s},"./src/features.ts":(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES_CONTEXT_STATE_KEY=void 0;const s=t("./node_modules/rxjs/dist/cjs/index.js"),c=t("./node_modules/semver/index.js");e.FEATURES_CONTEXT_STATE_KEY="features";function u(g){var _;return((_=g==null?void 0:g.runme)==null?void 0:_.features)||{}}function o(g,_,w=new Map){const y=u(g),x=new s.BehaviorSubject({features:y,context:_});return m(x,_,w),x}function a(g,_){return _!==void 0?_===!0:g===!0}function d(g,_){return!g||g==="All"||_===g}function i(g,_){return!g||!_?!0:(0,c.satisfies)(_,g)}function n(g,_){return g?!!_:!0}function l(g,_){return g?_?g[_]===!0:!1:!0}function h(g,_,w,y=new Map){const{os:x,vsCodeVersion:S,runmeVersion:C,extensionVersion:k,githubAuthRequired:I,statefulAuthRequired:j,enabledForExtensions:T}=_.conditions;return!(!a(_.enabled,y.get(g))||!d(x,w==null?void 0:w.os)||!i(S,w==null?void 0:w.vsCodeVersion)||!i(C,w==null?void 0:w.runmeVersion)||!i(k,w==null?void 0:w.extensionVersion)||!n(I,w==null?void 0:w.githubAuth)||!n(j,w==null?void 0:w.statefulAuth)||!l(T,w==null?void 0:w.extensionId))}function m(g,_,w=new Map){const y=g.getValue(),x=Object.entries(y.features).reduce((S,[C,k])=>({...S,[C]:{...k,on:h(C,k,_,w)}}),{});return g.next({features:x,context:_}),g}function p(g,_,w,y){var x;if(!g)return;const S=g.getValue(),C={...S.context||{},[_]:w};C[_]!==((x=S==null?void 0:S.context)==null?void 0:x[_])&&m(g,C,y)}function f(g){return g?JSON.stringify(g.getValue()):""}function v(g){const{features:_,context:w}=JSON.parse(g),y=new s.BehaviorSubject({features:_,context:w});return y.next({features:_,context:y.getValue().context}),y}function b(g,_){if(!_)return!1;const w=_.getValue().features[g];return(w==null?void 0:w.on)??!1}e.default={loadState:o,updateState:m,updateContext:p,getSnapshot:f,loadSnapshot:v,isOn:b}},"./src/schema.ts":(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CellAnnotationsSchema=e.SafeNotebookAnnotationsSchema=e.SafeCellAnnotationsSchema=e.AnnotationSchema=void 0;const s=t("./node_modules/zod/dist/cjs/index.js"),c=t("./src/extension/grpc/runner/v1.ts"),u=(d,i)=>d.trim().replaceAll(/[ ]{2,}/g,"").replaceAll(i,""),o=d=>s.z.preprocess(i=>(typeof i=="string"&&(i=u(i,",")),typeof i=="boolean"?i:typeof i=="string"&&i.toLowerCase()==="false"?!1:typeof i=="string"&&i.toLowerCase()==="true"?!0:d),s.z.boolean()),a=(d,i="expected a boolean value")=>s.z.preprocess(n=>n?(typeof n=="string"&&(n=u(n,",")),typeof n=="string"&&n.toLowerCase()==="false"?!1:typeof n=="string"&&n.toLowerCase()==="true"?!0:n):d,s.z.boolean({invalid_type_error:i}));e.AnnotationSchema={"runme.dev/id":s.z.string().optional(),"runme.dev/name":s.z.string().optional(),"runme.dev/nameGenerated":a(!0).optional(),"runme.dev/fenced":a(!0).optional(),id:s.z.string().optional(),background:a(!1),interactive:a(!0),closeTerminalOnSuccess:a(!0),openTerminalOnError:a(!0),promptEnv:s.z.preprocess(d=>{if(typeof d=="string"&&(d=u(d,",")),typeof d=="boolean"&&!d)return c.ResolveProgramRequest_Mode.SKIP_ALL;if(typeof d=="boolean"&&d)return c.ResolveProgramRequest_Mode.UNSPECIFIED;if(typeof d=="string"&&["false","no","never"].includes(d.toLowerCase()))return c.ResolveProgramRequest_Mode.SKIP_ALL;if(typeof d=="string"&&["true","yes","always"].includes(d.toLowerCase()))return c.ResolveProgramRequest_Mode.PROMPT_ALL;if(typeof d=="string"&&["","auto"].includes(d.toLowerCase()))return c.ResolveProgramRequest_Mode.UNSPECIFIED;if(typeof d=="string"&&d){const i=Number(d);if(Number.isFinite(i))return i}},s.z.nativeEnum(c.ResolveProgramRequest_Mode).default(c.ResolveProgramRequest_Mode.UNSPECIFIED)),excludeFromRunAll:a(!1),terminalRows:s.z.preprocess(d=>{if(typeof d=="string"&&d){const i=Number(d);if(Number.isFinite(i))return i}if(typeof d=="number"&&Number.isFinite(d))return d},s.z.number().int().positive().optional()),name:s.z.preprocess(d=>typeof d=="string"?u(d,","):d,s.z.string().default("")),mimeType:s.z.string().optional().refine(d=>{if(d){const[i,n,...l]=d.split("/");if(!i||!n||l.length)return!1}return!0},"mime type specification invalid format"),interpreter:s.z.string().optional().default(""),cwd:s.z.string().optional().default(""),category:s.z.string().default("")},e.SafeCellAnnotationsSchema=s.z.object({...e.AnnotationSchema,background:o(!1),interactive:o(!0),closeTerminalOnSuccess:o(!0),openTerminalOnError:o(!0)}),e.SafeNotebookAnnotationsSchema=s.z.object({id:s.z.string(),version:s.z.string()}),e.CellAnnotationsSchema=s.z.object({...e.AnnotationSchema})},"./src/types.ts":(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FeatureName=e.ExtensionName=e.EnvVarMode=e.NotebookAutoSaveSetting=e.APIMethod=e.GCPCloudRunActionType=e.AWSActionType=e.InstanceStatusType=e.GceActionType=e.Serializer=void 0,t("./src/constants.ts");var s;(function(m){(function(p){p[p.UNSPECIFIED=0]="UNSPECIFIED",p[p.ALL=1]="ALL",p[p.DOCUMENT=2]="DOCUMENT",p[p.CELL=3]="CELL"})(m.LifecycleIdentity||(m.LifecycleIdentity={}))})(s||(e.Serializer=s={}));var c;(function(m){m.StopVMInstance="stopVmInstance",m.StartVMInstance="startVmInstance",m.SuspendVMInstance="suspendVmInstance",m.ConnectViaSSH="connectViaSsh"})(c||(e.GceActionType=c={}));var u;(function(m){m.Stopping="STOPPING",m.Suspending="SUSPENDING",m.Staging="STAGING",m.Repairing="REPAIRING",m.Provisioning="PROVISIONING",m.Suspended="SUSPENDED",m.Terminated="TERMINATED",m.Running="RUNNING"})(u||(e.InstanceStatusType=u={}));var o;(function(m){m.ConnectViaSSH="connectViaSsh",m.EC2InstanceDetails="aws:ec2InstanceDetails",m.EKSClusterDetails="aws:eksClusterDetails"})(o||(e.AWSActionType=o={}));var a;(function(m){m.DescribeYAML="describeYAML",m.DownloadYAML="downloadYAML",m.ViewRevisions="viewRevisions"})(a||(e.GCPCloudRunActionType=a={}));var d;(function(m){m.CreateCellExecution="createCellExecution",m.UpdateCellExecution="updateCellExecution",m.CreateEscalation="createEscalation",m.TrackRunmeEvent="trackRunmeEvent"})(d||(e.APIMethod=d={}));var i;(function(m){m.Yes="yes",m.No="no"})(i||(e.NotebookAutoSaveSetting=i={}));var n;(function(m){m.Docs="docs",m.Shell="shell"})(n||(e.EnvVarMode=n={}));var l;(function(m){m.StatefulRunme="stateful.runme",m.StatefulPlatform="stateful.platform"})(l||(e.ExtensionName=l={}));var h;(function(m){m.Gist="Gist",m.Share="Share",m.Escalate="Escalate",m.ForceLogin="ForceLogin",m.SignedIn="SignedIn",m.RequireStatefulAuth="RequireStatefulAuth",m.CopySelectionToClipboard="CopySelectionToClipboard",m.NewTreeProvider="NewTreeProvider",m.OpenTerminalOnStartup="OpenTerminalOnStartup",m.HostedPlayground="HostedPlayground",m.RecommendExtension="RecommendExtension",m.ReporterAPI="ReporterAPI",m.RemoteNotebooks="RemoteNotebooks",m.AIProgress="AIProgress"})(h||(e.FeatureName=h={}))},"./src/utils/ansi.ts":(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stripANSI=t;function t(s){return s.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"")}},"./src/utils/messaging.ts":(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.postClientMessage=t,e.onClientMessage=s;async function t(c,u,o){var a;const d={type:u,output:o};return await((a=c.postMessage)==null?void 0:a.call(c,d))}function s(c,u){var o;return((o=c.onDidReceiveMessage)==null?void 0:o.call(c,u))??{dispose:()=>{}}}}},bl={};function Pt(r){var e=bl[r];if(e!==void 0)return e.exports;var t=bl[r]={exports:{}};return W0[r].call(t.exports,t,t.exports,Pt),t.exports}Pt.d=(r,e)=>{for(var t in e)Pt.o(e,t)&&!Pt.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})};Pt.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e);Pt.r=r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var ks={};(()=>{var r=ks;/*!*****************************!*\
|
|
6543
6543
|
!*** ./src/client/index.ts ***!
|
|
6544
6544
|
\*****************************/Object.defineProperty(r,"__esModule",{value:!0}),r.ClientMessages=r.setContext=r.activate=void 0;const e=Pt("./src/constants.ts");Object.defineProperty(r,"ClientMessages",{enumerable:!0,get:function(){return e.ClientMessages}});const t=Pt("./src/client/utils.ts");Object.defineProperty(r,"setContext",{enumerable:!0,get:function(){return t.setContext}}),Pt("./src/client/components/index.ts");const s=c=>((0,t.setContext)(c),{renderOutputItem(u,o){var a,d,i;const n=u.json();switch(n.type){case e.OutputType.vercel:if(n.output.error){l(n.output.error);break}const h=document.createElement(e.RENDERERS.VercelOutput);h.setAttribute("content",JSON.stringify(n.output)),o.appendChild(h);break;case e.OutputType.daggerCall:if(!((a=n.output)!=null&&a.cellId))return;const m=document.createElement(e.RENDERERS.DaggerCli);m.setAttribute("cellId",n.output.cellId);const p={...n.output,cli:{status:"active"}};m.setAttribute("state",JSON.stringify(p)),o.appendChild(m);break;case e.OutputType.deno:if((d=n.output)!=null&&d.error){l(n.output.error);break}const f=n.output||{},v=document.createElement(e.RENDERERS.DenoOutput);v.setAttribute("state",JSON.stringify(f)),o.appendChild(v);break;case e.OutputType.outputItems:const b=decodeURIComponent(escape(window.atob(n.output.content))),g=document.createElement(e.RENDERERS.ShellOutput);g.innerHTML=b,o.appendChild(g);const _=document.createElement(e.RENDERERS.ShellOutputItems);_.setAttribute("id",n.output.id),_.setAttribute("content",b),o.appendChild(_);break;case e.OutputType.annotations:const w=document.createElement(e.RENDERERS.EditAnnotations);w.setAttribute("annotations",JSON.stringify(n.output.annotations??[])),w.setAttribute("validationErrors",JSON.stringify(n.output.validationErrors??[])),w.setAttribute("settings",JSON.stringify(n.output.settings)),o.appendChild(w);break;case e.OutputType.terminal:const y=document.createElement(e.RENDERERS.TerminalView);y.setAttribute("id",n.output["runme.dev/id"]),y.setAttribute("fontFamily",n.output.fontFamily),typeof n.output.fontSize=="number"&&y.setAttribute("fontSize",n.output.fontSize.toString()),n.output.cursorStyle&&y.setAttribute("cursorStyle",n.output.cursorStyle),typeof n.output.cursorBlink=="boolean"&&y.setAttribute("cursorBlink",n.output.cursorBlink?"true":"false"),typeof n.output.cursorWidth=="number"&&y.setAttribute("cursorWidth",n.output.cursorWidth.toString()),typeof n.output.smoothScrollDuration=="number"&&y.setAttribute("smoothScrollDuration",n.output.smoothScrollDuration.toString()),typeof n.output.scrollback=="number"&&y.setAttribute("scrollback",n.output.scrollback.toString()),n.output.initialRows!==void 0&&y.setAttribute("initialRows",n.output.initialRows.toString()),n.output.content!==void 0&&y.setAttribute("initialContent",n.output.content),n.output.isAutoSaveEnabled&&y.setAttribute("isAutoSaveEnabled",n.output.isAutoSaveEnabled.toString()),n.output.isPlatformAuthEnabled&&y.setAttribute("isPlatformAuthEnabled",n.output.isPlatformAuthEnabled.toString()),n.output.isDaggerOutput&&y.setAttribute("isDaggerOutput",n.output.isDaggerOutput.toString()),o.appendChild(y);break;case e.OutputType.error:l(n.output);break;case e.OutputType.github:const x=document.createElement(e.RENDERERS.GitHubWorkflowViewer);(i=n.output)!=null&&i.content&&x.setAttribute("state",JSON.stringify(n.output)),o.appendChild(x);break;case e.OutputType.gcp:const S=document.createElement(e.RENDERERS.GCPView);n.output&&S.setAttribute("state",JSON.stringify(n.output)),o.appendChild(S);break;case e.OutputType.aws:const C=document.createElement(e.RENDERERS.AWSView);n.output&&C.setAttribute("state",JSON.stringify(n.output)),o.appendChild(C);break;default:o.innerHTML="No renderer found!"}function l(h){o.innerHTML=`⚠️ ${h}`}},disposeOutputItem(){}});r.activate=s})();const os=ks.ClientMessages;ks.__esModule;ks.activate;const H0=ks.setContext,G0=5e3,Z0=1e3,Ps=4e3,gl=1e3;var tu=(r=>(r.CONTINUOUS="CONTINUOUS",r.INITIAL="INITIAL",r))(tu||{});class ru{constructor({knownID:e,runID:t,sequence:s},{runnerEndpoint:c,authorization:u,autoReconnect:o}){Ze(this,"callback"),Ze(this,"queue",new xt),Ze(this,"subscriptions",[]),Ze(this,"reconnect",new xt),Ze(this,"client",new it),Ze(this,"_latencies",new xt),Ze(this,"_latenciesConnectable",yr(this._latencies.asObservable().pipe(w0((a,d)=>{if(d.latency<0){const i=a.get(d.streamID);i&&a.set(d.streamID,{...i,readyState:d.readyState})}else a.set(d.streamID,d);return a},new Map)))),Ze(this,"_errors",new xt),Ze(this,"_errorsConnectable",yr(this._errors.asObservable())),Ze(this,"_stdout",new xt),Ze(this,"_stderr",new xt),Ze(this,"_exitCode",new xt),Ze(this,"_pid",new xt),Ze(this,"_mimeType",new xt),Ze(this,"_stdoutConnectable",yr(this._stdout.asObservable())),Ze(this,"_stderrConnectable",yr(this._stderr.asObservable())),Ze(this,"_exitCodeConnectable",yr(this._exitCode.asObservable())),Ze(this,"_pidConnectable",yr(this._pid.asObservable())),Ze(this,"_mimeTypeConnectable",yr(this._mimeType.asObservable())),Ze(this,"knownID"),Ze(this,"runID"),Ze(this,"sequence"),Ze(this,"runnerEndpoint"),Ze(this,"authorization"),Ze(this,"autoReconnect"),this.knownID=e,this.runID=t,this.sequence=s,this.runnerEndpoint=c,this.authorization=u,this.autoReconnect=o,this._latenciesConnectable.connect(),this._errorsConnectable.connect(),this._stdoutConnectable.connect(),this._stderrConnectable.connect(),this._exitCodeConnectable.connect(),this._pidConnectable.connect(),this._mimeTypeConnectable.connect(),this.client=this.reconnect.pipe(pl(gl,mn,{leading:!0,trailing:!0}),hl(a=>this.useSocketClient(a.streamID).pipe(hl(d=>this.useHeartbeat(d,a))))).pipe(S0()),this.subscriptions.push(this.monitor()),this.subscriptions.push(this.process())}get latencies(){return this._latenciesConnectable}get errors(){return this._errorsConnectable}get stdout(){return this._stdoutConnectable}get stderr(){return this._stderrConnectable}get exitCode(){return this._exitCodeConnectable}get pid(){return this._pidConnectable}get mimeType(){return this._mimeTypeConnectable}monitor(){return h0(Z0).pipe(Ft(()=>this.autoReconnect),Un(this.reconnect),Ft(([,e])=>e.heartbeat==="CONTINUOUS"),Un(this.latencies),wt(([,e])=>Array.from(e.values()).filter(t=>t.readyState===WebSocket.OPEN&&t.latency>=Ps)),Ft(e=>e.length>0),pl(gl)).subscribe({next:e=>{console.log(new Date,"Triggering reconnect",e),this.connect()},complete:()=>{console.log("Monitor complete")},error:e=>{console.error("Error in monitor",e)}})}process(){const e=this.client.pipe(Ft(c=>(c==null?void 0:c.readyState)===WebSocket.OPEN),ul(1)),t=this.queue.pipe(g0(()=>e),Ft(c=>c.length>0),wt(c=>c.sort((u,o)=>{const a=d=>{var i;return!!((i=d.payload.value)!=null&&i.config)};return a(o)?1:a(u)?-1:0}))),s=this.queue.pipe(x0(e));return f0(t.pipe(gs(c=>c)),s).pipe(Un(this.client),Ls(([,c])=>c.readyState===WebSocket.OPEN),wt(([c,u])=>yl({req:c,authorization:this.authorization,socket:u,knownID:this.knownID,runID:this.runID}))).subscribe({error:c=>{this._errors.next(c)}})}useSocketClient(e){return new it(t=>{const s=new URL(this.runnerEndpoint);s.searchParams.set("id",e),s.searchParams.set("runID",this.runID);const c=new WebSocket(s.toString()),u=i=>{if(console.log(new Date,`WebSocket transport ${e} closed`,i),i.code===1005){t.complete();return}if(this.autoReconnect){this.connect();return}},o=i=>{console.log(new Date,`WebSocket transport ${e} error`,i),this.autoReconnect||t.error(i)},a=i=>{var n,l;if(typeof i.data!="string"){console.warn("Unexpected WebSocket message type:",typeof i.data);return}let h;try{h=_l(i.data),console.log("Received WebsocketResponse:",h)}catch(f){console.error("Failed to parse WebsocketResponse:",f)}const m=h.status;if(m&&m.code!==F0.OK){t.error(m);return}if(h.pong)return;const p=h.payload.value;if(p.stdoutData&&p.stdoutData.length>0&&((n=this.callback)==null||n.call(this,{type:os.terminalStdout,output:{"runme.dev/id":this.knownID,data:p.stdoutData}}),this._stdout.next(p.stdoutData)),p.stderrData&&p.stderrData.length>0&&((l=this.callback)==null||l.call(this,{type:os.terminalStderr,output:{"runme.dev/id":this.knownID,data:p.stderrData}}),this._stderr.next(p.stderrData)),p.exitCode!==void 0&&(this._exitCode.next(p.exitCode),t.complete()),p.pid!==void 0&&this._pid.next(p.pid),p.mimeType){const f=p.mimeType.split(";")[0];this._mimeType.next(f)}},d=()=>{console.log(new Date,`✅ Connected WebSocket for block ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),t.next(c)};return c.addEventListener("close",u),c.addEventListener("error",o),c.addEventListener("message",a),c.addEventListener("open",d),()=>{console.log(new Date,`☑️ Cleanly disconnected WebSocket for block ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),c.removeEventListener("close",u),c.removeEventListener("error",o),c.removeEventListener("message",a),c.removeEventListener("open",d),c.close()}})}setCallback(e){this.callback=e}sendExecuteRequest(e){this.queue.next(vt(ii,{payload:{value:e,case:"executeRequest"}}))}useHeartbeat(e,{streamID:t,heartbeat:s}){return new it(c=>{const u=ni(e,"message").pipe(Ls(()=>e.readyState===WebSocket.OPEN),wt(d=>_l(d.data)),wt(d=>d.pong),Ft(d=>d!==void 0),wt(d=>({receivedAt:BigInt(Date.now()),pong:d}))),o=(s==="INITIAL"?is(0):is(0,G0)).pipe(Ls(()=>e.readyState===WebSocket.OPEN),wt(()=>{const d={timestamp:BigInt(Date.now())};return vt(ii,{ping:d})}),fl(d=>{yl({req:d,authorization:this.authorization,socket:e})}),wt(d=>d.ping)).pipe(Ft(d=>(d==null?void 0:d.timestamp)!==void 0),gs(d=>v0(u.pipe(Ft(i=>i.pong.timestamp===d.timestamp),ul(1),wt(i=>{const n=d.timestamp,l=i.receivedAt;return Number(l-n)})),is(Ps).pipe(wt(()=>{throw new Error(`Pong not received within ${Ps}ms for stream ${t}`)}))).pipe(Xd(i=>(this._latencies.next({streamID:t,latency:Ps,readyState:e.readyState,updatedAt:BigInt(Date.now())}),console.log(new Date,"Ping deadline exceeded",i.message),Jb(null))))),y0(()=>{this._latencies.next({streamID:t,latency:-1,readyState:e.readyState,updatedAt:BigInt(Date.now())})}),fl(d=>{d!==null&&this._latencies.next({streamID:t,latency:d,readyState:e.readyState,updatedAt:BigInt(Date.now())})})),a=[];return a.push(o.subscribe({error:d=>{console.error("Unexpected error sending heartbeat",d)}})),c.next(e),()=>{a.forEach(d=>d.unsubscribe())}})}connect(e="CONTINUOUS"){const t=z0(),s=this.latencies.pipe(wt(c=>{const u=c.get(t);return u===void 0?null:u}),Ls(c=>(c==null?void 0:c.readyState)===WebSocket.OPEN));return this.reconnect.next({streamID:t,heartbeat:e}),s}close(){this.reconnect.complete(),this.queue.complete(),this._latencies.complete(),this.subscriptions.forEach(e=>e.unsubscribe())}}function _l(r){const e=JSON.parse(r);return ib(V0,e)}function yl({req:r,authorization:e,socket:t,knownID:s,runID:c}){s&&(r.knownId=s),c&&(r.runId=c);const{bearerToken:u}=e;u&&r&&(r.authorization=`Bearer ${u}`),t.send(JSON.stringify(Yv(ii,r)))}function z0(){return M0().replace(/-/g,"")}function su(){return`run_${R0()}`}function K0({blockID:r,runID:e,sequence:t,commands:s,runner:c,settings:u={},onStdout:o,onStderr:a,onExitCode:d,onPid:i,onMimeType:n}){var l;const{rows:h=20,className:m,fontSize:p=12,fontFamily:f="monospace",takeFocus:v=!0,scrollToFit:b=!0}=u,g=ye.useMemo(()=>{if(!(!r||!e||!c.endpoint))return console.log("Creating stream",r,e,c.endpoint),new ru({knownID:r,runID:e,sequence:t},{runnerEndpoint:c.endpoint,authorization:c.authorization,autoReconnect:c.reconnect})},[r,e,t,c]);ye.useEffect(()=>{const S=g==null?void 0:g.connect().subscribe(C=>console.log(`Heartbeat latency for streamID ${C==null?void 0:C.streamID} (${(C==null?void 0:C.readyState)===1?"open":"closed"}): ${C==null?void 0:C.latency}ms`));return()=>{S==null||S.unsubscribe(),g==null||g.close()}},[g]);let _=vt(el,{rows:34,cols:100,x:0,y:0});const w=ye.useMemo(()=>vt($n,{sessionStrategy:Vv.MOST_RECENT,storeStdoutInEnv:!0,config:{languageId:"sh",background:!1,fileExtension:"",env:[`RUNME_ID=${r}`,"RUNME_RUNNER=v2","TERM=xterm-256color"],source:{case:"commands",value:{items:s}},interactive:!0,mode:Av.INLINE,runId:e,knownId:r},winsize:_}),[r,s,_]),y=ye.useMemo(()=>{var S;return{output:{"runme.dev/id":(S=w.config)==null?void 0:S.knownId,fontFamily:f||"monospace",fontSize:p||12,cursorStyle:"block",cursorBlink:!0,cursorWidth:1,takeFocus:v,scrollToFit:b,smoothScrollDuration:0,scrollback:4e3,initialRows:h,content:"",isAutoSaveEnabled:!1,isPlatformAuthEnabled:!1}}},[f,p,v,h,(l=w.config)==null?void 0:l.knownId,b]),x=new TextEncoder;return H0({postMessage:S=>{if(S.type===os.terminalOpen||S.type===os.terminalResize){const C=Number(S.output.terminalDimensions.columns),k=Number(S.output.terminalDimensions.rows);if(Number.isFinite(C)&&Number.isFinite(k)){if(_.cols===C&&_.rows===k)return;_=vt(el,{cols:C,rows:k,x:0,y:0});const I=vt($n,{winsize:_});g==null||g.sendExecuteRequest(I)}}if(S.type===os.terminalStdin){const C=x.encode(S.output.input),k=vt($n,{inputData:C});g==null||g.sendExecuteRequest(k)}},onDidReceiveMessage:S=>{g==null||g.setCallback(S)}}),ye.useEffect(()=>{const S=g==null?void 0:g.stdout.subscribe(C=>{o==null||o(C)});return()=>S==null?void 0:S.unsubscribe()},[g,o]),ye.useEffect(()=>{const S=g==null?void 0:g.stderr.subscribe(C=>{a==null||a(C)});return()=>S==null?void 0:S.unsubscribe()},[g,a]),ye.useEffect(()=>{const S=g==null?void 0:g.exitCode.subscribe(C=>{d==null||d(C),g==null||g.close()});return()=>S==null?void 0:S.unsubscribe()},[g,d]),ye.useEffect(()=>{const S=g==null?void 0:g.pid.subscribe(C=>{i==null||i(C)});return()=>S==null?void 0:S.unsubscribe()},[g,i]),ye.useEffect(()=>{const S=g==null?void 0:g.mimeType.subscribe(C=>{n==null||n(C)});return()=>S==null?void 0:S.unsubscribe()},[g,n]),ye.useEffect(()=>{!g||!w||(console.log("useEffect invoked - Commands changed:",JSON.stringify(w.config.source.value)),g==null||g.sendExecuteRequest(w))},[w,g]),q.jsx("div",{className:m,ref:S=>{if(!S||S.hasChildNodes())return;const C=document.createElement("terminal-view");C.setAttribute("buttons","false"),C.setAttribute("id",y.output["runme.dev/id"]),C.setAttribute("fontFamily",y.output.fontFamily),typeof y.output.fontSize=="number"&&C.setAttribute("fontSize",y.output.fontSize.toString()),y.output.cursorStyle&&C.setAttribute("cursorStyle",y.output.cursorStyle),typeof y.output.cursorBlink=="boolean"&&C.setAttribute("cursorBlink",y.output.cursorBlink?"true":"false"),typeof y.output.cursorWidth=="number"&&C.setAttribute("cursorWidth",y.output.cursorWidth.toString()),typeof y.output.takeFocus=="boolean"&&C.setAttribute("takeFocus",y.output.takeFocus?"true":"false"),typeof y.output.smoothScrollDuration=="number"&&C.setAttribute("smoothScrollDuration",y.output.smoothScrollDuration.toString()),typeof y.output.scrollback=="number"&&C.setAttribute("scrollback",y.output.scrollback.toString()),y.output.initialRows!==void 0&&C.setAttribute("initialRows",y.output.initialRows.toString()),y.output.content!==void 0&&C.setAttribute("initialContent",y.output.content),y.output.isAutoSaveEnabled&&C.setAttribute("isAutoSaveEnabled",y.output.isAutoSaveEnabled.toString()),y.output.isPlatformAuthEnabled&&C.setAttribute("isPlatformAuthEnabled",y.output.isPlatformAuthEnabled.toString()),S.appendChild(C);const k=document.createElement("div");k.setAttribute("className","h-1"),S.appendChild(k),setTimeout(()=>{b&&!Y0(k)&&k.scrollIntoView({behavior:"smooth"})},0)}})}function Y0(r){const e=r.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}const nu=ye.createContext(void 0),Et=()=>{const r=ye.useContext(nu);if(!r)throw new Error("useSettings must be used within a SettingsProvider");return r},iu=({children:r,requireAuth:e,webApp:t})=>{const[s,c]=ye.useState(null),u=ye.useMemo(()=>{const n=window.location.hostname==="localhost",l=window.location.protocol==="http:",h=window.location.port==="4173"||window.location.port==="5173",m=n&&l&&h;let p=new URL(window.location.href);t!=null&&t.runner&&(p=new URL(t.runner));const f={requireAuth:!1,agentEndpoint:m?"http://localhost:8080":window.location.origin,webApp:{runner:m?"ws://localhost:8080/ws":`${p.protocol==="https:"?"wss:":"ws:"}//${p.host}/ws`,reconnect:(t==null?void 0:t.reconnect)??!0,invertedOrder:(t==null?void 0:t.invertedOrder)??!1}};return e!==void 0&&(f.requireAuth=e),f},[e,t]),[o,a]=ye.useState(()=>{const n=localStorage.getItem("cloudAssistantSettings"),l=n?JSON.parse(n):{};return l&&l.webApp&&l.webApp.reconnect!==void 0&&(l.webApp.reconnect=u.webApp.reconnect),n?{...u,...l}:u});ye.useEffect(()=>{localStorage.setItem("cloudAssistantSettings",JSON.stringify(o))},[o]);const d=ye.useCallback(async()=>{if(!o.webApp.runner)return;c(null);const n=new ru({knownID:`check_${um()}`,runID:su(),sequence:0},{runnerEndpoint:o.webApp.runner,authorization:{bearerToken:nn()},autoReconnect:!1}),l=[];return l.push(n.errors.subscribe({next:h=>c(h)})),l.push(n.connect(tu.INITIAL).subscribe(h=>{h!==null&&(console.log(`Initial heartbeat latency for streamID ${h.streamID} (${h.readyState===1?"open":"closed"}): ${h.latency}ms`),n.close())})),()=>{l.forEach(h=>h.unsubscribe())}},[o.webApp.runner]);ye.useEffect(()=>{d()},[d]);const i=n=>{a(l=>({...l,...n,webApp:{...l.webApp,...n.webApp}}))};return q.jsx(nu.Provider,{value:{checkRunnerAuth:d,defaultSettings:u,runnerError:s,settings:o,updateSettings:i},children:r})},ou=ye.createContext(void 0),au=()=>{const r=ye.useContext(ou);if(!r)throw new Error("useClient must be used within a ClientProvider");return r},lu=({children:r})=>{const[e,t]=ye.useState(),{settings:s}=Et();return ye.useEffect(()=>{t(J0(s.agentEndpoint))},[s.agentEndpoint]),q.jsx(ou.Provider,{value:{client:e,setClient:t},children:r})},X0=r=>{const e=Ge.from(r);e.code===Be.Unauthenticated&&(window.location.href=`/login?error=${encodeURIComponent(e.name)}&error_description=${encodeURIComponent(e.message)}`)};function J0(r){console.log(`initializing the client: baseURL ${r}`);const e=sm({baseUrl:r,interceptors:[t=>s=>{const c=nn();return c&&s.header.set("Authorization",`Bearer ${c}`),t(s).catch(u=>{throw X0(u),u})}]});return Lp(yp,e)}const cu=ye.createContext(void 0),$t=()=>{const r=ye.useContext(cu);if(!r)throw new Error("useBlock must be used within a BlockProvider");return r},du=({children:r})=>{const{settings:e}=Et(),[t,s]=ye.useState(0),[c,u]=ye.useState(!1),[o,a]=ye.useState(!1),[d,i]=ye.useState(),n=()=>{s(j=>j+1)},{client:l}=au(),[h,m]=ye.useState({blocks:{},positions:[]}),p=ye.useMemo(()=>e.webApp.invertedOrder,[e.webApp.invertedOrder]);ye.useEffect(()=>{m(j=>({...j,positions:[...j.positions].reverse()}))},[p]);const f=ye.useMemo(()=>h.positions.map(j=>h.blocks[j]).filter(j=>!!j&&(j.kind===Tt.MARKUP||j.kind===Tt.CODE)),[h.blocks,h.positions]),v=ye.useMemo(()=>h.positions.map(j=>h.blocks[j]).filter(j=>!!j&&j.kind===Tt.CODE),[h.blocks,h.positions]),b=ye.useMemo(()=>h.positions.map(j=>h.blocks[j]).filter(j=>!!j&&j.kind===Tt.FILE_SEARCH_RESULTS),[h.blocks,h.positions]),g=()=>({chat:f,actions:v,files:b}),_=j=>{const T=Rh(ss,j);return T.outputs=j.outputs.map(L=>at(pp,{items:L.items.map($=>at(mp,$)),kind:L.kind})),T},w=async j=>{const T=Cp(),L=at(vp,{blocks:j,previousResponseId:d});L.openaiAccessToken=T.accessToken,T.accessToken||console.error("No access token found");try{const $=l.generate(L);for await(const V of $){for(const X of V.blocks)a(!1),S(X);i(V.responseId)}}catch($){console.log($)}finally{a(!1),u(!1)}},y=async j=>{if(!j.trim())return;const T=at(ss,{id:`user_${Jo()}`,role:Dt.USER,kind:Tt.MARKUP,contents:j});S(T),u(!0),a(!0),await w([T])},x=async j=>{j.outputs.length!==0&&(console.log("sending output block",j.id,"previousResponseId",d),u(!0),a(!0),await w([j]))},S=j=>{m(T=>{if(!T.blocks[j.id]){const L=p?[j.id,...T.positions]:[...T.positions,j.id];return{blocks:{...T.blocks,[j.id]:j},positions:L}}return{...T,blocks:{...T.blocks,[j.id]:j}}})},C=()=>{m({blocks:{},positions:[]}),s(0),i(void 0)},k=()=>{const j=at(ss,{id:`code_${Jo()}`,role:Dt.USER,kind:Tt.CODE,contents:""});S(j)},I=j=>{if(v.find(L=>L.id===j.id)){const L=new CustomEvent("runCodeBlock",{detail:{blockId:j.id}});window.dispatchEvent(L)}};return q.jsx(cu.Provider,{value:{useColumns:g,sequence:t,incrementSequence:n,sendOutputBlock:x,createOutputBlock:_,sendUserBlock:y,addCodeBlock:k,isInputDisabled:c,isTyping:o,runCodeBlock:I,resetSession:C},children:r})},q0=at(ss,{kind:Tt.MARKUP,role:Dt.ASSISTANT,contents:"..."}),Q0=ye.memo(({id:r,value:e,fontSize:t=14,fontFamily:s="monospace",onChange:c,onEnter:u})=>{const o=ye.useRef(u),a=ye.useRef(null),d=ye.useRef(null),[i,n]=ye.useState("140px"),[l,h]=ye.useState(!1),m=ye.useRef(0),p=ye.useRef(0);ye.useEffect(()=>{o.current=u},[u]),ye.useEffect(()=>{const b=_=>{if(!l)return;const w=_.clientY-m.current,y=Math.max(100,p.current+w);n(`${y}px`),a.current&&a.current.layout()},g=()=>{h(!1),document.body.style.cursor="default"};return l&&(document.addEventListener("mousemove",b),document.addEventListener("mouseup",g)),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",g)}},[l]);const f=(b,g)=>{a.current=b,g!=null&&g.editor&&(g.editor.setTheme("vs-dark"),b&&(b.onKeyDown(_=>{_.ctrlKey&&_.keyCode===3&&o.current()}),e===""&&b.focus()))},v=b=>{var g;h(!0),m.current=b.clientY,p.current=((g=d.current)==null?void 0:g.clientHeight)||140,document.body.style.cursor="ns-resize",b.preventDefault()};return q.jsxs("div",{className:"pb-1 w-full",ref:d,children:[q.jsx("div",{className:"rounded-md overflow-hidden",children:q.jsx(sh,{height:i,width:"100%",defaultLanguage:"shellscript",value:e,options:{scrollbar:{alwaysConsumeMouseWheel:!1},minimap:{enabled:!1},theme:"vs-dark",wordWrap:"wordWrapColumn",fontSize:t,fontFamily:s,lineHeight:20},onChange:b=>b&&(c==null?void 0:c(b)),onMount:f,className:"rounded-lg",wrapperProps:{className:"rounded-lg"}},r)}),q.jsx("div",{className:"h-2 w-full cursor-ns-resize",onMouseDown:v})]})},(r,e)=>r.value===e.value),eg=()=>q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M3.24182 2.32181C3.3919 2.23132 3.5784 2.22601 3.73338 2.30781L12.7334 7.05781C12.8974 7.14436 13 7.31457 13 7.5C13 7.68543 12.8974 7.85564 12.7334 7.94219L3.73338 12.6922C3.5784 12.774 3.3919 12.7687 3.24182 12.6782C3.09175 12.5877 3 12.4252 3 12.25V2.75C3 2.57476 3.09175 2.4123 3.24182 2.32181ZM4 3.57925V11.4207L11.4338 7.5L4 3.57925Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",stroke:"currentColor",strokeWidth:"0.5"})}),tg=()=>q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M7.5 1.5C4.5 1.5 2 4 2 7C2 8.9 3 10.5 4.5 11.5L4 12.5C2 11.5 1 9.2 1 7C1 3.5 4 0.5 7.5 0.5C11 0.5 14 3.5 14 7C14 9.2 13 11.5 11 12.5L10.5 11.5C12 10.5 13 8.9 13 7C13 4 10.5 1.5 7.5 1.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),rg=()=>q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:"#22c55e",fillRule:"evenodd",clipRule:"evenodd",stroke:"#22c55e",strokeWidth:"1"})}),sg=({exitCode:r})=>q.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[q.jsx("circle",{cx:"12",cy:"12",r:"20",fill:"#ef4444",fillOpacity:"0.3"}),q.jsx("text",{x:"50%",y:"50%",dominantBaseline:"middle",textAnchor:"middle",fill:"#ef4444",fontSize:"10",fontWeight:"bold",children:r})]});function ng(){return q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M7.5 0.75C7.91421 0.75 8.25 1.08579 8.25 1.5V7.25H14C14.4142 7.25 14.75 7.58579 14.75 8C14.75 8.41421 14.4142 8.75 14 8.75H8.25V14.5C8.25 14.9142 7.91421 15.25 7.5 15.25C7.08579 15.25 6.75 14.9142 6.75 14.5V8.75H1C0.585786 8.75 0.25 8.41421 0.25 8C0.25 7.58579 0.585786 7.25 1 7.25H6.75V1.5C6.75 1.08579 7.08579 0.75 7.5 0.75Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",strokeWidth:"0.5"})})}function ig(){return q.jsx("svg",{width:"28",height:"28",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.3",fillRule:"evenodd",clipRule:"evenodd"})})}const wl=14,Sl="monospace";function og({pid:r,exitCode:e,onClick:t}){return q.jsxs(Ee.Button,{variant:"soft",onClick:t,children:[e===null&&r===null&&q.jsx(eg,{}),e===null&&r!==null&&q.jsx("div",{className:"animate-spin",children:q.jsx(tg,{})}),e!==null&&e===0&&q.jsx(rg,{}),e!==null&&e>0&&q.jsx(sg,{exitCode:e})]})}const ag=ye.memo(({blockID:r,runID:e,sequence:t,value:s,settings:c={},onStdout:u,onStderr:o,onExitCode:a,onPid:d,onMimeType:i})=>{const{webApp:n}=Et().settings;return s!=""&&e!=""&&q.jsx(K0,{blockID:r,runID:e,sequence:t,commands:s.split(`
|
|
6545
|
-
`),runner:{endpoint:n.runner,reconnect:n.reconnect,authorization:{bearerToken:nn()}},settings:c,onPid:d,onStdout:u,onStderr:o,onExitCode:a,onMimeType:i})},(r,e)=>r.blockID===e.blockID&&JSON.stringify(r.value)===JSON.stringify(e.value)&&r.runID===e.runID);function lg({block:r}){const{settings:e}=Et(),t=e.webApp.invertedOrder,{createOutputBlock:s,sendOutputBlock:c,incrementSequence:u,sequence:o}=$t(),[a,d]=ye.useState(r.contents),[i,n]=ye.useState(!1),[l,h]=ye.useState({value:"",runID:""}),[m,p]=ye.useState(null),[f,v]=ye.useState(null),[b,g]=ye.useState(null),[_,w]=ye.useState(""),[y,x]=ye.useState(""),[S,C]=ye.useState(""),[k,I]=ye.useState(null),j=ye.useCallback(($=!1)=>{w(""),x(""),p(null),v(null),n($),u(),h({value:a,runID:su()})},[a,u]);ye.useEffect(()=>{const $=V=>{V.detail.blockId===r.id&&j()};return window.addEventListener("runCodeBlock",$),()=>{window.removeEventListener("runCodeBlock",$)}},[r.id,j]);const T=ye.useMemo(()=>m===null||f===null||l.runID===""||!Number.isFinite(m)||!Number.isInteger(f)?null:s({...r,outputs:[{$typeName:"BlockOutput",kind:qo.STDOUT,items:[{$typeName:"BlockOutputItem",mime:b||"text/plain",textData:_}]},{$typeName:"BlockOutput",kind:qo.STDERR,items:[{$typeName:"BlockOutputItem",mime:b||"text/plain",textData:y}]}]}),[r,s,_,y,b,m,f,l.runID]);ye.useEffect(()=>{!T||S===l.runID||(C(l.runID),c(T))},[c,T,l.runID,S]),ye.useEffect(()=>{S!==l.runID&&I(o)},[o,l.runID,S]),ye.useEffect(()=>{d(r.contents)},[r.contents]);const L=ye.useMemo(()=>k?k.toString():" ",[k]);return q.jsx("div",{children:q.jsx(Ee.Box,{className:"w-full p-2",children:q.jsxs("div",{className:"flex justify-between items-top",children:[q.jsxs("div",{className:"flex flex-col items-center",children:[q.jsx(og,{pid:m,exitCode:f,onClick:()=>{j(!0)}}),q.jsxs(Ee.Text,{size:"2",className:"mt-1 p-2 font-bold text-gray-400 font-mono",children:["[",L,"]"]})]}),q.jsxs(Ee.Card,{className:"whitespace-nowrap overflow-hidden flex-1 ml-2",children:[q.jsx(Q0,{id:r.id,value:a,fontSize:wl,fontFamily:Sl,onChange:$=>{p(null),v(null),d($)},onEnter:()=>j()},r.id),q.jsx(ag,{runID:l.runID,blockID:r.id,sequence:k||0,value:l.value,settings:{takeFocus:i,scrollToFit:!t,className:"rounded-md overflow-hidden",rows:14,fontSize:wl,fontFamily:Sl},onStdout:$=>w(V=>V+new TextDecoder().decode($)),onStderr:$=>x(V=>V+new TextDecoder().decode($)),onPid:p,onExitCode:v,onMimeType:g},l.runID)]})]})})})}function oi(){const{useColumns:r,addCodeBlock:e}=$t(),{settings:t}=Et(),{actions:s}=r(),c=ye.useRef(null);return ye.useEffect(()=>{var u;t.webApp.invertedOrder||(u=c.current)==null||u.scrollIntoView({behavior:"smooth"})},[s,t.webApp.invertedOrder]),q.jsxs("div",{className:"flex flex-col h-full",children:[q.jsxs("div",{className:"flex items-center mb-2",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"pr-2",children:"Actions"}),q.jsx(Ee.Button,{variant:"ghost",size:"1",className:"cursor-pointer",onClick:e,children:q.jsx(ng,{})})]}),q.jsxs(Ee.ScrollArea,{type:"auto",scrollbars:"vertical",className:"flex-1 p-2",children:[s.map(u=>q.jsx(lg,{block:u},u.id)),q.jsx("div",{ref:c})]})]})}const uu=({role:r,children:e})=>{const t=r===Dt.USER?"self-end":"self-start",s=r===Dt.USER?"indigo":"gray";return q.jsx(Ee.Callout.Root,{highContrast:!0,color:s,className:`${t} max-w-[80%] break-words m-1`,children:q.jsx(Ee.Callout.Text,{children:e})})},cg=({block:r})=>q.jsx(uu,{role:Dt.USER,children:r.contents}),dg=({block:r})=>q.jsx(uu,{role:Dt.ASSISTANT,children:q.jsx(nh,{components:{code:({children:e,...t})=>q.jsx("pre",{className:"whitespace-pre-wrap",children:q.jsx("code",{...t,children:String(e).replace(/\n$/,"")})})},children:r.contents})}),ug=ye.memo(({block:r,isRecentCodeBlock:e,onClick:t})=>{const{runCodeBlock:s}=$t(),{settings:c}=Et(),u=r.contents.split(/&&|;|\n|\\n/)[0],o=()=>{t?t():s(r)},a=c.webApp.invertedOrder?"justify-end":"justify-start",d=q.jsx("span",{className:"text-xs text-gray-400 p-2",children:"Press CTRL+ENTER to run"});return q.jsxs("div",{className:`flex ${a} items-center h-full`,children:[e&&c.webApp.invertedOrder&&d,q.jsxs("div",{className:"flex items-center m-1 p-2 bg-[#1e1e1e] rounded-md max-w-[80%] cursor-pointer",onClick:o,children:[q.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#d4d4d4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:q.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#d4d4d4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-1",children:[q.jsx("polyline",{points:"4 17 10 11 4 5"}),q.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),q.jsx("span",{className:"text-sm text-[#d4d4d4] italic truncate max-w-2/3",children:u})]}),e&&!c.webApp.invertedOrder&&d]})},(r,e)=>r.block.id===e.block.id&&JSON.stringify(r.block.contents)===JSON.stringify(e.block.contents)&&r.isRecentCodeBlock===e.isRecentCodeBlock),xl=({block:r,isRecentCodeBlock:e})=>{if(r.kind===Tt.CODE)return q.jsx(ug,{block:r,isRecentCodeBlock:e},r.id);switch(r.role){case Dt.USER:return q.jsx(cg,{block:r});case Dt.ASSISTANT:return q.jsx(dg,{block:r});default:return null}},Cl=()=>{const{useColumns:r,isTyping:e}=$t(),{settings:t}=Et(),{chat:s}=r(),c=ye.useRef(null);ye.useEffect(()=>{var d;t.webApp.invertedOrder||(d=c.current)==null||d.scrollIntoView({behavior:"smooth"})},[s,t.webApp.invertedOrder]);const u=t.webApp.invertedOrder?0:s.length-1,a=q.jsx("div",{className:"flex justify-start items-center h-full",children:q.jsx(xl,{block:q0})});return q.jsxs("div",{className:"overflow-y-clip p-1 flex flex-col whitespace-pre-wrap",children:[e&&t.webApp.invertedOrder&&a,s.map((d,i)=>q.jsx(xl,{block:d,isRecentCodeBlock:d.kind===Tt.CODE&&i===u&&!e},i)),e&&!t.webApp.invertedOrder&&a,q.jsx("div",{ref:c})]})},jl=()=>{const{sendUserBlock:r,isInputDisabled:e}=$t(),[t,s]=ye.useState(""),c=ye.useRef(null);ye.useEffect(()=>{var a;(a=c.current)==null||a.focus()},[]);const u=a=>{a.preventDefault(),t.trim()&&(r(t),s(""))},o=a=>{if(a.key==="Enter"&&!a.shiftKey){a.preventDefault();const d=a.currentTarget.form;d&&d.requestSubmit()}};return q.jsx("form",{onSubmit:u,className:"flex w-full",children:q.jsxs(Ee.Flex,{className:"w-full flex flex-nowrap items-start gap-4 m-2",children:[q.jsx(Ee.TextArea,{name:"userInput",value:t,onChange:a=>s(a.target.value),onKeyDown:o,placeholder:"Enter your question",size:"3",className:"flex-grow min-w-0",ref:c,rows:2,style:{resize:"vertical"}}),q.jsx(Ee.Button,{type:"submit",disabled:e,children:q.jsx(ig,{})})]})})};function ai(){const{useColumns:r,runCodeBlock:e}=$t(),{settings:t}=Et(),{chat:s}=r(),c=ye.useRef(null);ye.useEffect(()=>{const o=d=>{if(d.ctrlKey&&d.key==="Enter"){const i=t.webApp.invertedOrder?s[0]:s[s.length-1];(i==null?void 0:i.kind)===Tt.CODE&&e(i)}},a=c.current;if(a)return a.addEventListener("keydown",o),()=>a.removeEventListener("keydown",o)},[s,e,t.webApp.invertedOrder]);const u=t.webApp.invertedOrder?"flex-col":"flex-col-reverse";return q.jsxs("div",{ref:c,className:"flex flex-col h-full",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"mb-2",children:"How can I help you?"}),q.jsx(Ee.ScrollArea,{type:"auto",scrollbars:"vertical",className:"flex-1 p-4",children:q.jsx("div",{className:`flex ${u} h-full w-full`,children:t.webApp.invertedOrder?q.jsxs(q.Fragment,{children:[q.jsx(jl,{}),q.jsx(Cl,{})]}):q.jsxs(q.Fragment,{children:[q.jsx(jl,{}),q.jsx(Cl,{})]})})})]})}const hu=()=>{const{useColumns:r}=$t(),{files:e}=r(),t=ye.useRef(null),s=()=>{var o;(o=t.current)==null||o.scrollIntoView({behavior:"smooth"})},c=ye.useMemo(()=>{let o=at(ss,{});return e.length>0&&(o=e[e.length-1]),o},[e]);ye.useEffect(()=>{s()},[c]);const u=c.fileSearchResults.length>0;return q.jsxs("div",{className:"flex flex-col h-full",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"mb-2",children:"Files"}),q.jsx(Ee.ScrollArea,{type:"auto",scrollbars:"vertical",className:"flex-1 pt-4",children:u?q.jsxs("div",{className:"grow",children:[c.fileSearchResults.map(o=>q.jsx("div",{className:"mb-2",children:q.jsx(Ee.Box,{p:"2",style:{borderRadius:"6px",border:"1px solid var(--gray-5)"},children:q.jsx(Ee.Text,{size:"2",weight:"medium",children:q.jsx(Ee.Link,{href:o.Link,target:"_blank",className:"text-blue-500 hover:underline",children:o.FileName})})})},o.FileID)),q.jsx("div",{ref:t,className:"h-1"})]}):q.jsxs("div",{children:[q.jsx("div",{children:"No search results yet"}),q.jsx("div",{ref:t,className:"h-1"})]})})]})},hg=Ht("ChVnb29nbGUvcnBjL2NvZGUucHJvdG8SCmdvb2dsZS5ycGMqtwIKBENvZGUSBgoCT0sQABINCglDQU5DRUxMRUQQARILCgdVTktOT1dOEAISFAoQSU5WQUxJRF9BUkdVTUVOVBADEhUKEURFQURMSU5FX0VYQ0VFREVEEAQSDQoJTk9UX0ZPVU5EEAUSEgoOQUxSRUFEWV9FWElTVFMQBhIVChFQRVJNSVNTSU9OX0RFTklFRBAHEhMKD1VOQVVUSEVOVElDQVRFRBAQEhYKElJFU09VUkNFX0VYSEFVU1RFRBAIEhcKE0ZBSUxFRF9QUkVDT05ESVRJT04QCRILCgdBQk9SVEVEEAoSEAoMT1VUX09GX1JBTkdFEAsSEQoNVU5JTVBMRU1FTlRFRBAMEgwKCElOVEVSTkFMEA0SDwoLVU5BVkFJTEFCTEUQDhINCglEQVRBX0xPU1MQD0JYCg5jb20uZ29vZ2xlLnJwY0IJQ29kZVByb3RvUAFaM2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvcnBjL2NvZGU7Y29kZaICA1JQQ2IGcHJvdG8z"),fg=ff(hg,0),li=qs(fg);function fu(){const{runnerError:r}=Et(),[e]=Ct.useSearchParams(),t=ye.useMemo(()=>r&&!(r instanceof Error)?li[r.code]??r.code:e.get("error"),[r,e]),s=ye.useMemo(()=>r&&!(r instanceof Error)?r.message:e.get("error_description"),[r,e]),c=()=>{window.location.href="/oidc/login"};return q.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[t&&q.jsxs(Ee.Callout.Root,{color:"red",children:[q.jsxs(Ee.Callout.Text,{className:"font-bold",children:["Error: ",t]}),s&&q.jsx(Ee.Callout.Text,{children:s})]}),q.jsx(Ee.Button,{size:"4",onClick:c,className:"cursor-pointer",children:"Login"})]})}const pu=()=>q.jsxs(Ee.Container,{size:"3",style:{padding:"2rem",textAlign:"center"},children:[q.jsx(Ee.Heading,{size:"8",mb:"4",children:"404"}),q.jsx(Ee.Text,{size:"5",color:"gray",children:"Page not found"}),q.jsx(Ee.Text,{as:"p",mt:"4",children:"The page you're looking for doesn't exist or has been moved."}),q.jsxs(Ee.Text,{as:"p",mt:"4",children:["Click"," ",q.jsx(Ee.Link,{href:"/",underline:"always",children:"here"})," ","to go back home."]})]});function mu(){const r=Ct.useNavigate(),{settings:e,updateSettings:t,runnerError:s,defaultSettings:c}=Et(),[u,o]=ye.useState(!1),[a,d]=ye.useState(e.agentEndpoint),[i,n]=ye.useState(e.webApp.runner),[l,h]=ye.useState(e.webApp.invertedOrder),m=()=>{t({agentEndpoint:a,webApp:{runner:i,reconnect:e.webApp.reconnect,invertedOrder:l}}),o(!0)};ye.useEffect(()=>{u&&(o(!1),s&&r("/"))},[s,u,r]);const p=()=>{d(c.agentEndpoint),n(c.webApp.runner),h(c.webApp.invertedOrder)},f=ye.useMemo(()=>{if(s instanceof Error)return s.message},[s]),v=a!==e.agentEndpoint||i!==e.webApp.runner||l!==e.webApp.invertedOrder;return q.jsxs(Ee.Box,{className:"w-full mx-auto",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"mb-2",children:"Settings"}),q.jsxs(Ee.Box,{className:"mt-4",children:[q.jsxs(Ee.Flex,{direction:"column",gap:"4",children:[q.jsxs(Ee.Flex,{direction:"column",gap:"2",children:[q.jsx(Ee.Text,{size:"3",weight:"bold",children:"Agent Endpoint Configuration"}),q.jsx(Ee.Text,{size:"2",color:"gray",children:"Configure the endpoint URL for the AI agent. Changes will take effect after saving."}),q.jsx(Ee.TextArea,{size:"3",placeholder:"Enter AI endpoint URL",value:a,onChange:b=>d(b.target.value)})]}),q.jsxs(Ee.Flex,{direction:"column",gap:"2",children:[q.jsx(Ee.Text,{size:"3",weight:"bold",children:"Runner Endpoint Configuration"}),q.jsx(Ee.Text,{size:"2",color:"gray",children:"Configure the WebSocket endpoint URL for the runner. Changes will take effect after saving."}),s&&q.jsx(Ee.Callout.Root,{color:"red",children:q.jsxs(Ee.Callout.Text,{className:"font-bold",children:["Runner error",f?": "+f:""]})}),q.jsx(Ee.TextArea,{size:"3",placeholder:"Enter Runner WebSocket endpoint URL",value:i,onChange:b=>n(b.target.value)}),q.jsx(Ee.Text,{size:"2",color:"gray",children:"Revert will reset endpoints to the default values, including protocol http(s), based on the current page."})]}),q.jsxs(Ee.Flex,{direction:"column",gap:"2",children:[q.jsx(Ee.Text,{size:"3",weight:"bold",children:"User Experience Mode"}),q.jsx(Ee.Text,{as:"label",size:"2",children:q.jsxs(Ee.Flex,{gap:"2",children:["Document Mode",q.jsx(Ee.Switch,{checked:l,onCheckedChange:h}),"Console Mode"]})})]})]}),q.jsxs(Ee.Flex,{gap:"3",justify:"end",mt:"4",children:[q.jsx(Ee.Button,{size:"2",variant:"soft",onClick:()=>r("/"),children:"Back"}),q.jsx(Ee.Button,{size:"2",variant:"soft",onClick:p,children:"Revert"}),q.jsx(Ee.Button,{size:"2",onClick:m,disabled:!v,children:"Save"})]})]})]})}class ts extends Error{}ts.prototype.name="InvalidTokenError";function pg(r){return decodeURIComponent(atob(r).replace(/(.)/g,(e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function mg(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return pg(e)}catch{return atob(e)}}function vg(r,e){if(typeof r!="string")throw new ts("Invalid token specified: must be a string");e||(e={});const t=e.header===!0?0:1,s=r.split(".")[t];if(typeof s!="string")throw new ts(`Invalid token specified: missing part #${t+1}`);let c;try{c=mg(s)}catch(u){throw new ts(`Invalid token specified: invalid base64 for part #${t+1} (${u.message})`)}try{return JSON.parse(c)}catch(u){throw new ts(`Invalid token specified: invalid json for part #${t+1} (${u.message})`)}}function bg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Wn={exports:{}},Hn={exports:{}},El;function gg(){return El||(El=1,function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,s){return t<<s|t>>>32-s},rotr:function(t,s){return t<<32-s|t>>>s},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var s=0;s<t.length;s++)t[s]=e.endian(t[s]);return t},randomBytes:function(t){for(var s=[];t>0;t--)s.push(Math.floor(Math.random()*256));return s},bytesToWords:function(t){for(var s=[],c=0,u=0;c<t.length;c++,u+=8)s[u>>>5]|=t[c]<<24-u%32;return s},wordsToBytes:function(t){for(var s=[],c=0;c<t.length*32;c+=8)s.push(t[c>>>5]>>>24-c%32&255);return s},bytesToHex:function(t){for(var s=[],c=0;c<t.length;c++)s.push((t[c]>>>4).toString(16)),s.push((t[c]&15).toString(16));return s.join("")},hexToBytes:function(t){for(var s=[],c=0;c<t.length;c+=2)s.push(parseInt(t.substr(c,2),16));return s},bytesToBase64:function(t){for(var s=[],c=0;c<t.length;c+=3)for(var u=t[c]<<16|t[c+1]<<8|t[c+2],o=0;o<4;o++)c*8+o*6<=t.length*8?s.push(r.charAt(u>>>6*(3-o)&63)):s.push("=");return s.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var s=[],c=0,u=0;c<t.length;u=++c%4)u!=0&&s.push((r.indexOf(t.charAt(c-1))&Math.pow(2,-2*u+8)-1)<<u*2|r.indexOf(t.charAt(c))>>>6-u*2);return s}};Hn.exports=e}()),Hn.exports}var Gn,kl;function Il(){if(kl)return Gn;kl=1;var r={utf8:{stringToBytes:function(e){return r.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(r.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],s=0;s<e.length;s++)t.push(e.charCodeAt(s)&255);return t},bytesToString:function(e){for(var t=[],s=0;s<e.length;s++)t.push(String.fromCharCode(e[s]));return t.join("")}}};return Gn=r,Gn}/*!
|
|
6545
|
+
`),runner:{endpoint:n.runner,reconnect:n.reconnect,authorization:{bearerToken:nn()}},settings:c,onPid:d,onStdout:u,onStderr:o,onExitCode:a,onMimeType:i})},(r,e)=>r.blockID===e.blockID&&JSON.stringify(r.value)===JSON.stringify(e.value)&&r.runID===e.runID);function lg({block:r}){const{settings:e}=Et(),t=e.webApp.invertedOrder,{createOutputBlock:s,sendOutputBlock:c,incrementSequence:u,sequence:o}=$t(),[a,d]=ye.useState(r.contents),[i,n]=ye.useState(!1),[l,h]=ye.useState({value:"",runID:""}),[m,p]=ye.useState(null),[f,v]=ye.useState(null),[b,g]=ye.useState(null),[_,w]=ye.useState(""),[y,x]=ye.useState(""),[S,C]=ye.useState(""),[k,I]=ye.useState(null),j=ye.useCallback(($=!1)=>{w(""),x(""),p(null),v(null),n($),u(),h({value:a,runID:su()})},[a,u]);ye.useEffect(()=>{const $=V=>{V.detail.blockId===r.id&&j()};return window.addEventListener("runCodeBlock",$),()=>{window.removeEventListener("runCodeBlock",$)}},[r.id,j]);const T=ye.useMemo(()=>m===null||f===null||l.runID===""||!Number.isFinite(m)||!Number.isInteger(f)?null:s({...r,outputs:[{$typeName:"BlockOutput",kind:qo.STDOUT,items:[{$typeName:"BlockOutputItem",mime:b||"text/plain",textData:_}]},{$typeName:"BlockOutput",kind:qo.STDERR,items:[{$typeName:"BlockOutputItem",mime:b||"text/plain",textData:y}]}]}),[r,s,_,y,b,m,f,l.runID]);ye.useEffect(()=>{!T||S===l.runID||(C(l.runID),c(T))},[c,T,l.runID,S]),ye.useEffect(()=>{S!==l.runID&&I(o)},[o,l.runID,S]),ye.useEffect(()=>{d(r.contents)},[r.contents]);const L=ye.useMemo(()=>k?k.toString():" ",[k]);return q.jsx("div",{children:q.jsx(Ee.Box,{className:"w-full p-2",children:q.jsxs("div",{className:"flex justify-between items-top",children:[q.jsxs("div",{className:"flex flex-col items-center",children:[q.jsx(og,{pid:m,exitCode:f,onClick:()=>{j(!0)}}),q.jsxs(Ee.Text,{size:"2",className:"mt-1 p-2 font-bold text-gray-400 font-mono",children:["[",L,"]"]})]}),q.jsxs(Ee.Card,{className:"whitespace-nowrap overflow-hidden flex-1 ml-2",children:[q.jsx(Q0,{id:r.id,value:a,fontSize:wl,fontFamily:Sl,onChange:$=>{p(null),v(null),d($)},onEnter:()=>j()},r.id),q.jsx(ag,{runID:l.runID,blockID:r.id,sequence:k||0,value:l.value,settings:{takeFocus:i,scrollToFit:!t,className:"rounded-md overflow-hidden",rows:14,fontSize:wl,fontFamily:Sl},onStdout:$=>w(V=>V+new TextDecoder().decode($)),onStderr:$=>x(V=>V+new TextDecoder().decode($)),onPid:p,onExitCode:v,onMimeType:g},l.runID)]})]})})})}function oi(){const{useColumns:r,addCodeBlock:e}=$t(),{settings:t}=Et(),{actions:s}=r(),c=ye.useRef(null);return ye.useEffect(()=>{var u;t.webApp.invertedOrder||(u=c.current)==null||u.scrollIntoView({behavior:"smooth"})},[s,t.webApp.invertedOrder]),q.jsxs("div",{className:"flex flex-col h-full",children:[q.jsxs("div",{className:"flex items-center mb-2",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"pr-2",children:"Actions"}),q.jsx(Ee.Button,{variant:"ghost",size:"1",className:"cursor-pointer",onClick:e,children:q.jsx(ng,{})})]}),q.jsxs(Ee.ScrollArea,{type:"auto",scrollbars:"vertical",className:"flex-1 p-2",children:[s.map(u=>q.jsx(lg,{block:u},u.id)),q.jsx("div",{ref:c})]})]})}const uu=({role:r,children:e})=>{const t=r===Dt.USER?"self-end":"self-start",s=r===Dt.USER?"indigo":"gray";return q.jsx(Ee.Callout.Root,{highContrast:!0,color:s,className:`${t} max-w-[80%] break-words m-1`,children:q.jsx(Ee.Callout.Text,{children:e})})},cg=({block:r})=>q.jsx(uu,{role:Dt.USER,children:r.contents}),dg=({block:r})=>q.jsx(uu,{role:Dt.ASSISTANT,children:q.jsx(nh,{components:{code:({children:e,...t})=>q.jsx("pre",{className:"whitespace-pre-wrap",children:q.jsx("code",{...t,children:String(e).replace(/\n$/,"")})})},children:r.contents})}),ug=ye.memo(({block:r,isRecentCodeBlock:e,onClick:t})=>{var i,n;const{runCodeBlock:s}=$t(),{settings:c}=Et(),u=((n=(i=r.contents)==null?void 0:i.split(/&&|;|\n|\\n/)[0])==null?void 0:n.substring(0,50))||"",o=()=>{t?t():s(r)},a=c.webApp.invertedOrder?"justify-end":"justify-start",d=q.jsx("span",{className:"text-xs text-gray-400 p-2",children:"Press CTRL+ENTER to run"});return q.jsxs("div",{className:`flex ${a} items-center h-full`,children:[e&&c.webApp.invertedOrder&&d,q.jsxs("div",{className:"flex items-center m-1 p-2 bg-[#1e1e1e] rounded-md max-w-[60%] cursor-pointer",onClick:o,children:[q.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#d4d4d4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:q.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#d4d4d4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-1",children:[q.jsx("polyline",{points:"4 17 10 11 4 5"}),q.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),q.jsx("span",{className:"text-sm text-[#d4d4d4] italic truncate max-w-4/5",children:u})]}),e&&!c.webApp.invertedOrder&&d]})},(r,e)=>r.block.id===e.block.id&&JSON.stringify(r.block.contents)===JSON.stringify(e.block.contents)&&r.isRecentCodeBlock===e.isRecentCodeBlock),xl=({block:r,isRecentCodeBlock:e})=>{if(r.kind===Tt.CODE)return q.jsx(ug,{block:r,isRecentCodeBlock:e},r.id);switch(r.role){case Dt.USER:return q.jsx(cg,{block:r});case Dt.ASSISTANT:return q.jsx(dg,{block:r});default:return null}},Cl=()=>{const{useColumns:r,isTyping:e}=$t(),{settings:t}=Et(),{chat:s}=r(),c=ye.useRef(null);ye.useEffect(()=>{var d;t.webApp.invertedOrder||(d=c.current)==null||d.scrollIntoView({behavior:"smooth"})},[s,t.webApp.invertedOrder]);const u=t.webApp.invertedOrder?0:s.length-1,a=q.jsx("div",{className:"flex justify-start items-center h-full",children:q.jsx(xl,{block:q0})});return q.jsxs("div",{className:"overflow-y-clip p-1 flex flex-col whitespace-pre-wrap",children:[e&&t.webApp.invertedOrder&&a,s.map((d,i)=>q.jsx(xl,{block:d,isRecentCodeBlock:d.kind===Tt.CODE&&i===u&&!e},i)),e&&!t.webApp.invertedOrder&&a,q.jsx("div",{ref:c})]})},jl=()=>{const{sendUserBlock:r,isInputDisabled:e}=$t(),[t,s]=ye.useState(""),c=ye.useRef(null);ye.useEffect(()=>{var a;(a=c.current)==null||a.focus()},[]);const u=a=>{a.preventDefault(),t.trim()&&(r(t),s(""))},o=a=>{if(a.key==="Enter"&&!a.shiftKey){a.preventDefault();const d=a.currentTarget.form;d&&d.requestSubmit()}};return q.jsx("form",{onSubmit:u,className:"flex w-full",children:q.jsxs(Ee.Flex,{className:"w-full flex flex-nowrap items-start gap-4 m-2",children:[q.jsx(Ee.TextArea,{name:"userInput",value:t,onChange:a=>s(a.target.value),onKeyDown:o,placeholder:"Enter your question",size:"3",className:"flex-grow min-w-0",ref:c,rows:2,style:{resize:"vertical"}}),q.jsx(Ee.Button,{type:"submit",disabled:e,children:q.jsx(ig,{})})]})})};function ai(){const{useColumns:r,runCodeBlock:e}=$t(),{settings:t}=Et(),{chat:s}=r(),c=ye.useRef(null);ye.useEffect(()=>{const o=d=>{if(d.ctrlKey&&d.key==="Enter"){const i=t.webApp.invertedOrder?s[0]:s[s.length-1];(i==null?void 0:i.kind)===Tt.CODE&&e(i)}},a=c.current;if(a)return a.addEventListener("keydown",o),()=>a.removeEventListener("keydown",o)},[s,e,t.webApp.invertedOrder]);const u=t.webApp.invertedOrder?"flex-col":"flex-col-reverse";return q.jsxs("div",{ref:c,className:"flex flex-col h-full",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"mb-2",children:"How can I help you?"}),q.jsx(Ee.ScrollArea,{type:"auto",scrollbars:"vertical",className:"flex-1 p-4",children:q.jsx("div",{className:`flex ${u} h-full w-full`,children:t.webApp.invertedOrder?q.jsxs(q.Fragment,{children:[q.jsx(jl,{}),q.jsx(Cl,{})]}):q.jsxs(q.Fragment,{children:[q.jsx(jl,{}),q.jsx(Cl,{})]})})})]})}const hu=()=>{const{useColumns:r}=$t(),{files:e}=r(),t=ye.useRef(null),s=()=>{var o;(o=t.current)==null||o.scrollIntoView({behavior:"smooth"})},c=ye.useMemo(()=>{let o=at(ss,{});return e.length>0&&(o=e[e.length-1]),o},[e]);ye.useEffect(()=>{s()},[c]);const u=c.fileSearchResults.length>0;return q.jsxs("div",{className:"flex flex-col h-full",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"mb-2",children:"Files"}),q.jsx(Ee.ScrollArea,{type:"auto",scrollbars:"vertical",className:"flex-1 pt-4",children:u?q.jsxs("div",{className:"grow",children:[c.fileSearchResults.map(o=>q.jsx("div",{className:"mb-2",children:q.jsx(Ee.Box,{p:"2",style:{borderRadius:"6px",border:"1px solid var(--gray-5)"},children:q.jsx(Ee.Text,{size:"2",weight:"medium",children:q.jsx(Ee.Link,{href:o.Link,target:"_blank",className:"text-blue-500 hover:underline",children:o.FileName})})})},o.FileID)),q.jsx("div",{ref:t,className:"h-1"})]}):q.jsxs("div",{children:[q.jsx("div",{children:"No search results yet"}),q.jsx("div",{ref:t,className:"h-1"})]})})]})},hg=Ht("ChVnb29nbGUvcnBjL2NvZGUucHJvdG8SCmdvb2dsZS5ycGMqtwIKBENvZGUSBgoCT0sQABINCglDQU5DRUxMRUQQARILCgdVTktOT1dOEAISFAoQSU5WQUxJRF9BUkdVTUVOVBADEhUKEURFQURMSU5FX0VYQ0VFREVEEAQSDQoJTk9UX0ZPVU5EEAUSEgoOQUxSRUFEWV9FWElTVFMQBhIVChFQRVJNSVNTSU9OX0RFTklFRBAHEhMKD1VOQVVUSEVOVElDQVRFRBAQEhYKElJFU09VUkNFX0VYSEFVU1RFRBAIEhcKE0ZBSUxFRF9QUkVDT05ESVRJT04QCRILCgdBQk9SVEVEEAoSEAoMT1VUX09GX1JBTkdFEAsSEQoNVU5JTVBMRU1FTlRFRBAMEgwKCElOVEVSTkFMEA0SDwoLVU5BVkFJTEFCTEUQDhINCglEQVRBX0xPU1MQD0JYCg5jb20uZ29vZ2xlLnJwY0IJQ29kZVByb3RvUAFaM2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvcnBjL2NvZGU7Y29kZaICA1JQQ2IGcHJvdG8z"),fg=ff(hg,0),li=qs(fg);function fu(){const{runnerError:r}=Et(),[e]=Ct.useSearchParams(),t=ye.useMemo(()=>r&&!(r instanceof Error)?li[r.code]??r.code:e.get("error"),[r,e]),s=ye.useMemo(()=>r&&!(r instanceof Error)?r.message:e.get("error_description"),[r,e]),c=()=>{window.location.href="/oidc/login"};return q.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[t&&q.jsxs(Ee.Callout.Root,{color:"red",children:[q.jsxs(Ee.Callout.Text,{className:"font-bold",children:["Error: ",t]}),s&&q.jsx(Ee.Callout.Text,{children:s})]}),q.jsx(Ee.Button,{size:"4",onClick:c,className:"cursor-pointer",children:"Login"})]})}const pu=()=>q.jsxs(Ee.Container,{size:"3",style:{padding:"2rem",textAlign:"center"},children:[q.jsx(Ee.Heading,{size:"8",mb:"4",children:"404"}),q.jsx(Ee.Text,{size:"5",color:"gray",children:"Page not found"}),q.jsx(Ee.Text,{as:"p",mt:"4",children:"The page you're looking for doesn't exist or has been moved."}),q.jsxs(Ee.Text,{as:"p",mt:"4",children:["Click"," ",q.jsx(Ee.Link,{href:"/",underline:"always",children:"here"})," ","to go back home."]})]});function mu(){const r=Ct.useNavigate(),{settings:e,updateSettings:t,runnerError:s,defaultSettings:c}=Et(),[u,o]=ye.useState(!1),[a,d]=ye.useState(e.agentEndpoint),[i,n]=ye.useState(e.webApp.runner),[l,h]=ye.useState(e.webApp.invertedOrder),m=()=>{t({agentEndpoint:a,webApp:{runner:i,reconnect:e.webApp.reconnect,invertedOrder:l}}),o(!0)};ye.useEffect(()=>{u&&(o(!1),s&&r("/"))},[s,u,r]);const p=()=>{d(c.agentEndpoint),n(c.webApp.runner),h(c.webApp.invertedOrder)},f=ye.useMemo(()=>{if(s instanceof Error)return s.message},[s]),v=a!==e.agentEndpoint||i!==e.webApp.runner||l!==e.webApp.invertedOrder;return q.jsxs(Ee.Box,{className:"w-full mx-auto",children:[q.jsx(Ee.Text,{size:"5",weight:"bold",className:"mb-2",children:"Settings"}),q.jsxs(Ee.Box,{className:"mt-4",children:[q.jsxs(Ee.Flex,{direction:"column",gap:"4",children:[q.jsxs(Ee.Flex,{direction:"column",gap:"2",children:[q.jsx(Ee.Text,{size:"3",weight:"bold",children:"Agent Endpoint Configuration"}),q.jsx(Ee.Text,{size:"2",color:"gray",children:"Configure the endpoint URL for the AI agent. Changes will take effect after saving."}),q.jsx(Ee.TextArea,{size:"3",placeholder:"Enter AI endpoint URL",value:a,onChange:b=>d(b.target.value)})]}),q.jsxs(Ee.Flex,{direction:"column",gap:"2",children:[q.jsx(Ee.Text,{size:"3",weight:"bold",children:"Runner Endpoint Configuration"}),q.jsx(Ee.Text,{size:"2",color:"gray",children:"Configure the WebSocket endpoint URL for the runner. Changes will take effect after saving."}),s&&q.jsx(Ee.Callout.Root,{color:"red",children:q.jsxs(Ee.Callout.Text,{className:"font-bold",children:["Runner error",f?": "+f:""]})}),q.jsx(Ee.TextArea,{size:"3",placeholder:"Enter Runner WebSocket endpoint URL",value:i,onChange:b=>n(b.target.value)}),q.jsx(Ee.Text,{size:"2",color:"gray",children:"Revert will reset endpoints to the default values, including protocol http(s), based on the current page."})]}),q.jsxs(Ee.Flex,{direction:"column",gap:"2",children:[q.jsx(Ee.Text,{size:"3",weight:"bold",children:"User Experience Mode"}),q.jsx(Ee.Text,{as:"label",size:"2",children:q.jsxs(Ee.Flex,{gap:"2",children:["Document Mode",q.jsx(Ee.Switch,{checked:l,onCheckedChange:h}),"Console Mode"]})})]})]}),q.jsxs(Ee.Flex,{gap:"3",justify:"end",mt:"4",children:[q.jsx(Ee.Button,{size:"2",variant:"soft",onClick:()=>r("/"),children:"Back"}),q.jsx(Ee.Button,{size:"2",variant:"soft",onClick:p,children:"Revert"}),q.jsx(Ee.Button,{size:"2",onClick:m,disabled:!v,children:"Save"})]})]})]})}class ts extends Error{}ts.prototype.name="InvalidTokenError";function pg(r){return decodeURIComponent(atob(r).replace(/(.)/g,(e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function mg(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return pg(e)}catch{return atob(e)}}function vg(r,e){if(typeof r!="string")throw new ts("Invalid token specified: must be a string");e||(e={});const t=e.header===!0?0:1,s=r.split(".")[t];if(typeof s!="string")throw new ts(`Invalid token specified: missing part #${t+1}`);let c;try{c=mg(s)}catch(u){throw new ts(`Invalid token specified: invalid base64 for part #${t+1} (${u.message})`)}try{return JSON.parse(c)}catch(u){throw new ts(`Invalid token specified: invalid json for part #${t+1} (${u.message})`)}}function bg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Wn={exports:{}},Hn={exports:{}},El;function gg(){return El||(El=1,function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,s){return t<<s|t>>>32-s},rotr:function(t,s){return t<<32-s|t>>>s},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var s=0;s<t.length;s++)t[s]=e.endian(t[s]);return t},randomBytes:function(t){for(var s=[];t>0;t--)s.push(Math.floor(Math.random()*256));return s},bytesToWords:function(t){for(var s=[],c=0,u=0;c<t.length;c++,u+=8)s[u>>>5]|=t[c]<<24-u%32;return s},wordsToBytes:function(t){for(var s=[],c=0;c<t.length*32;c+=8)s.push(t[c>>>5]>>>24-c%32&255);return s},bytesToHex:function(t){for(var s=[],c=0;c<t.length;c++)s.push((t[c]>>>4).toString(16)),s.push((t[c]&15).toString(16));return s.join("")},hexToBytes:function(t){for(var s=[],c=0;c<t.length;c+=2)s.push(parseInt(t.substr(c,2),16));return s},bytesToBase64:function(t){for(var s=[],c=0;c<t.length;c+=3)for(var u=t[c]<<16|t[c+1]<<8|t[c+2],o=0;o<4;o++)c*8+o*6<=t.length*8?s.push(r.charAt(u>>>6*(3-o)&63)):s.push("=");return s.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var s=[],c=0,u=0;c<t.length;u=++c%4)u!=0&&s.push((r.indexOf(t.charAt(c-1))&Math.pow(2,-2*u+8)-1)<<u*2|r.indexOf(t.charAt(c))>>>6-u*2);return s}};Hn.exports=e}()),Hn.exports}var Gn,kl;function Il(){if(kl)return Gn;kl=1;var r={utf8:{stringToBytes:function(e){return r.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(r.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],s=0;s<e.length;s++)t.push(e.charCodeAt(s)&255);return t},bytesToString:function(e){for(var t=[],s=0;s<e.length;s++)t.push(String.fromCharCode(e[s]));return t.join("")}}};return Gn=r,Gn}/*!
|
|
6546
6546
|
* Determine if an object is a Buffer
|
|
6547
6547
|
*
|
|
6548
6548
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6549
6549
|
* @license MIT
|
|
6550
|
-
*/var Zn,Tl;function _g(){if(Tl)return Zn;Tl=1,Zn=function(t){return t!=null&&(r(t)||e(t)||!!t._isBuffer)};function r(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function e(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&r(t.slice(0,0))}return Zn}var Ol;function yg(){return Ol||(Ol=1,function(){var r=gg(),e=Il().utf8,t=_g(),s=Il().bin,c=function(u,o){u.constructor==String?o&&o.encoding==="binary"?u=s.stringToBytes(u):u=e.stringToBytes(u):t(u)?u=Array.prototype.slice.call(u,0):!Array.isArray(u)&&u.constructor!==Uint8Array&&(u=u.toString());for(var a=r.bytesToWords(u),d=u.length*8,i=1732584193,n=-271733879,l=-1732584194,h=271733878,m=0;m<a.length;m++)a[m]=(a[m]<<8|a[m]>>>24)&16711935|(a[m]<<24|a[m]>>>8)&4278255360;a[d>>>5]|=128<<d%32,a[(d+64>>>9<<4)+14]=d;for(var p=c._ff,f=c._gg,v=c._hh,b=c._ii,m=0;m<a.length;m+=16){var g=i,_=n,w=l,y=h;i=p(i,n,l,h,a[m+0],7,-680876936),h=p(h,i,n,l,a[m+1],12,-389564586),l=p(l,h,i,n,a[m+2],17,606105819),n=p(n,l,h,i,a[m+3],22,-1044525330),i=p(i,n,l,h,a[m+4],7,-176418897),h=p(h,i,n,l,a[m+5],12,1200080426),l=p(l,h,i,n,a[m+6],17,-1473231341),n=p(n,l,h,i,a[m+7],22,-45705983),i=p(i,n,l,h,a[m+8],7,1770035416),h=p(h,i,n,l,a[m+9],12,-1958414417),l=p(l,h,i,n,a[m+10],17,-42063),n=p(n,l,h,i,a[m+11],22,-1990404162),i=p(i,n,l,h,a[m+12],7,1804603682),h=p(h,i,n,l,a[m+13],12,-40341101),l=p(l,h,i,n,a[m+14],17,-1502002290),n=p(n,l,h,i,a[m+15],22,1236535329),i=f(i,n,l,h,a[m+1],5,-165796510),h=f(h,i,n,l,a[m+6],9,-1069501632),l=f(l,h,i,n,a[m+11],14,643717713),n=f(n,l,h,i,a[m+0],20,-373897302),i=f(i,n,l,h,a[m+5],5,-701558691),h=f(h,i,n,l,a[m+10],9,38016083),l=f(l,h,i,n,a[m+15],14,-660478335),n=f(n,l,h,i,a[m+4],20,-405537848),i=f(i,n,l,h,a[m+9],5,568446438),h=f(h,i,n,l,a[m+14],9,-1019803690),l=f(l,h,i,n,a[m+3],14,-187363961),n=f(n,l,h,i,a[m+8],20,1163531501),i=f(i,n,l,h,a[m+13],5,-1444681467),h=f(h,i,n,l,a[m+2],9,-51403784),l=f(l,h,i,n,a[m+7],14,1735328473),n=f(n,l,h,i,a[m+12],20,-1926607734),i=v(i,n,l,h,a[m+5],4,-378558),h=v(h,i,n,l,a[m+8],11,-2022574463),l=v(l,h,i,n,a[m+11],16,1839030562),n=v(n,l,h,i,a[m+14],23,-35309556),i=v(i,n,l,h,a[m+1],4,-1530992060),h=v(h,i,n,l,a[m+4],11,1272893353),l=v(l,h,i,n,a[m+7],16,-155497632),n=v(n,l,h,i,a[m+10],23,-1094730640),i=v(i,n,l,h,a[m+13],4,681279174),h=v(h,i,n,l,a[m+0],11,-358537222),l=v(l,h,i,n,a[m+3],16,-722521979),n=v(n,l,h,i,a[m+6],23,76029189),i=v(i,n,l,h,a[m+9],4,-640364487),h=v(h,i,n,l,a[m+12],11,-421815835),l=v(l,h,i,n,a[m+15],16,530742520),n=v(n,l,h,i,a[m+2],23,-995338651),i=b(i,n,l,h,a[m+0],6,-198630844),h=b(h,i,n,l,a[m+7],10,1126891415),l=b(l,h,i,n,a[m+14],15,-1416354905),n=b(n,l,h,i,a[m+5],21,-57434055),i=b(i,n,l,h,a[m+12],6,1700485571),h=b(h,i,n,l,a[m+3],10,-1894986606),l=b(l,h,i,n,a[m+10],15,-1051523),n=b(n,l,h,i,a[m+1],21,-2054922799),i=b(i,n,l,h,a[m+8],6,1873313359),h=b(h,i,n,l,a[m+15],10,-30611744),l=b(l,h,i,n,a[m+6],15,-1560198380),n=b(n,l,h,i,a[m+13],21,1309151649),i=b(i,n,l,h,a[m+4],6,-145523070),h=b(h,i,n,l,a[m+11],10,-1120210379),l=b(l,h,i,n,a[m+2],15,718787259),n=b(n,l,h,i,a[m+9],21,-343485551),i=i+g>>>0,n=n+_>>>0,l=l+w>>>0,h=h+y>>>0}return r.endian([i,n,l,h])};c._ff=function(u,o,a,d,i,n,l){var h=u+(o&a|~o&d)+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._gg=function(u,o,a,d,i,n,l){var h=u+(o&d|a&~d)+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._hh=function(u,o,a,d,i,n,l){var h=u+(o^a^d)+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._ii=function(u,o,a,d,i,n,l){var h=u+(a^(o|~d))+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._blocksize=16,c._digestsize=16,Wn.exports=function(u,o){if(u==null)throw new Error("Illegal argument "+u);var a=r.wordsToBytes(c(u,o));return o&&o.asBytes?a:o&&o.asString?s.bytesToString(a):r.bytesToHex(a)}}()),Wn.exports}var wg=yg();const Sg=bg(wg);function Al(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function xg(...r){return e=>{let t=!1;const s=r.map(c=>{const u=Al(c,e);return!t&&typeof u=="function"&&(t=!0),u});if(t)return()=>{for(let c=0;c<s.length;c++){const u=s[c];typeof u=="function"?u():Al(r[c],null)}}}}var vu=Ue.forwardRef((r,e)=>{const{children:t,...s}=r,c=Ue.Children.toArray(t),u=c.find(jg);if(u){const o=u.props.children,a=c.map(d=>d===u?Ue.Children.count(o)>1?Ue.Children.only(null):Ue.isValidElement(o)?o.props.children:null:d);return q.jsx(ci,{...s,ref:e,children:Ue.isValidElement(o)?Ue.cloneElement(o,void 0,a):null})}return q.jsx(ci,{...s,ref:e,children:t})});vu.displayName="Slot";var ci=Ue.forwardRef((r,e)=>{const{children:t,...s}=r;if(Ue.isValidElement(t)){const c=kg(t),u=Eg(s,t.props);return t.type!==Ue.Fragment&&(u.ref=e?xg(e,c):c),Ue.cloneElement(t,u)}return Ue.Children.count(t)>1?Ue.Children.only(null):null});ci.displayName="SlotClone";var Cg=({children:r})=>q.jsx(q.Fragment,{children:r});function jg(r){return Ue.isValidElement(r)&&r.type===Cg}function Eg(r,e){const t={...e};for(const s in e){const c=r[s],u=e[s];/^on[A-Z]/.test(s)?c&&u?t[s]=(...a)=>{u(...a),c(...a)}:c&&(t[s]=c):s==="style"?t[s]={...c,...u}:s==="className"&&(t[s]=[c,u].filter(Boolean).join(" "))}return{...r,...t}}function kg(r){var s,c;let e=(s=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:s.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var Ig=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],oo=Ig.reduce((r,e)=>{const t=Ue.forwardRef((s,c)=>{const{asChild:u,...o}=s,a=u?vu:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),q.jsx(a,{...o,ref:c})});return t.displayName=`Primitive.${e}`,{...r,[e]:t}},{});function Tg(r,e=[]){let t=[];function s(u,o){const a=Ue.createContext(o),d=t.length;t=[...t,o];const i=l=>{var b;const{scope:h,children:m,...p}=l,f=((b=h==null?void 0:h[r])==null?void 0:b[d])||a,v=Ue.useMemo(()=>p,Object.values(p));return q.jsx(f.Provider,{value:v,children:m})};i.displayName=u+"Provider";function n(l,h){var f;const m=((f=h==null?void 0:h[r])==null?void 0:f[d])||a,p=Ue.useContext(m);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${l}\` must be used within \`${u}\``)}return[i,n]}const c=()=>{const u=t.map(o=>Ue.createContext(o));return function(a){const d=(a==null?void 0:a[r])||u;return Ue.useMemo(()=>({[`__scope${r}`]:{...a,[r]:d}}),[a,d])}};return c.scopeName=r,[s,Og(c,...e)]}function Og(...r){const e=r[0];if(r.length===1)return e;const t=()=>{const s=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const o=s.reduce((a,{useScope:d,scopeName:i})=>{const l=d(u)[`__scope${i}`];return{...a,...l}},{});return Ue.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function Ag(r){const e=Ue.useRef(r);return Ue.useEffect(()=>{e.current=r}),Ue.useMemo(()=>(...t)=>{var s;return(s=e.current)==null?void 0:s.call(e,...t)},[])}var bu=globalThis!=null&&globalThis.document?Ue.useLayoutEffect:()=>{},ao="Avatar",[Rg,Vg]=Tg(ao),[Ng,gu]=Rg(ao),_u=Ue.forwardRef((r,e)=>{const{__scopeAvatar:t,...s}=r,[c,u]=Ue.useState("idle");return q.jsx(Ng,{scope:t,imageLoadingStatus:c,onImageLoadingStatusChange:u,children:q.jsx(oo.span,{...s,ref:e})})});_u.displayName=ao;var yu="AvatarImage",wu=Ue.forwardRef((r,e)=>{const{__scopeAvatar:t,src:s,onLoadingStatusChange:c=()=>{},...u}=r,o=gu(yu,t),a=Lg(s,u.referrerPolicy),d=Ag(i=>{c(i),o.onImageLoadingStatusChange(i)});return bu(()=>{a!=="idle"&&d(a)},[a,d]),a==="loaded"?q.jsx(oo.img,{...u,ref:e,src:s}):null});wu.displayName=yu;var Su="AvatarFallback",xu=Ue.forwardRef((r,e)=>{const{__scopeAvatar:t,delayMs:s,...c}=r,u=gu(Su,t),[o,a]=Ue.useState(s===void 0);return Ue.useEffect(()=>{if(s!==void 0){const d=window.setTimeout(()=>a(!0),s);return()=>window.clearTimeout(d)}},[s]),o&&u.imageLoadingStatus!=="loaded"?q.jsx(oo.span,{...c,ref:e}):null});xu.displayName=Su;function Lg(r,e){const[t,s]=Ue.useState("idle");return bu(()=>{if(!r){s("error");return}let c=!0;const u=new window.Image,o=a=>()=>{c&&s(a)};return s("loading"),u.onload=o("loaded"),u.onerror=o("error"),u.src=r,e&&(u.referrerPolicy=e),()=>{c=!1}},[r,e]),t}var Pg=_u,Dg=wu,Mg=xu;const $g=(r=24)=>{const e=nn()||"unauthenticated";try{const s=vg(e).sub||"unauthenticated";return`https://www.gravatar.com/avatar/${Sg(s.trim().toLowerCase())}?s=${r}&d=identicon`}catch{return"unauthenticated"}},Bg=()=>q.jsxs(Is.Root,{children:[q.jsx(Is.Trigger,{asChild:!0,children:q.jsx("span",{children:q.jsxs(Pg,{className:"inline-flex size-[24px] select-none items-center justify-center overflow-hidden rounded-full bg-blackA1 align-middle cursor-pointer",children:[q.jsx(Dg,{className:"size-full rounded-[inherit] object-cover",src:$g()}),q.jsx(Mg,{className:"leading-1 flex size-full items-center justify-center bg-white text-[15px] font-medium text-violet11",delayMs:600,children:q.jsx(oh.PersonIcon,{})})]})})}),q.jsx(Is.Content,{sideOffset:8,className:"z-50 min-w-[120px] rounded-md bg-white p-2 shadow-lg border border-gray-200",children:q.jsx(Is.Item,{asChild:!0,children:q.jsx("a",{href:"/oidc/logout",className:"block w-full px-3 py-2 text-md text-gray-700 hover:bg-gray-100 rounded cursor-pointer",children:"Logout"})})})]}),Cu=()=>{const{resetSession:r}=$t();return q.jsxs(q.Fragment,{children:[q.jsx(Ct.Link,{to:"/",onClick:r,children:q.jsxs(Ee.Flex,{className:"cursor-pointer",gap:"1",align:"center",children:[q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M7.5 0.875C7.77614 0.875 8 1.09886 8 1.375V7.5H14.125C14.4011 7.5 14.625 7.72386 14.625 8C14.625 8.27614 14.4011 8.5 14.125 8.5H8V14.625C8 14.9011 7.77614 15.125 7.5 15.125C7.22386 15.125 7 14.9011 7 14.625V8.5H0.875C0.598858 8.5 0.375 8.27614 0.375 8C0.375 7.72386 0.598858 7.5 0.875 7.5H7V1.375C7 1.09886 7.22386 0.875 7.5 0.875Z",fill:"currentColor"})}),q.jsx(Ee.Text,{children:"New Session"})]})}),q.jsx(Ct.Link,{to:"/settings",children:q.jsxs(Ee.Flex,{className:"cursor-pointer",gap:"1",align:"center",children:[q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M7.07095 0.650238C6.67391 0.650238 6.32977 0.925096 6.24198 1.31231L6.0039 2.36247C5.6249 2.47269 5.26335 2.62363 4.92436 2.81013L4.01335 2.23585C3.67748 2.02413 3.23978 2.07312 2.95903 2.35386L2.35294 2.95996C2.0722 3.2407 2.0232 3.6784 2.23493 4.01427L2.80942 4.92561C2.62307 5.2645 2.47227 5.62594 2.36216 6.00481L1.31209 6.24287C0.924883 6.33065 0.650024 6.6748 0.650024 7.07183V7.92897C0.650024 8.32601 0.924883 8.67015 1.31209 8.75794L2.36228 8.99603C2.47246 9.375 2.62335 9.73652 2.80979 10.0755L2.2354 10.9867C2.02367 11.3225 2.07267 11.7602 2.35341 12.041L2.95951 12.6471C3.24025 12.9278 3.67795 12.9768 4.01382 12.7651L4.92506 12.1907C5.26384 12.377 5.62516 12.5278 6.0039 12.6379L6.24198 13.6881C6.32977 14.0753 6.67391 14.3502 7.07095 14.3502H7.92809C8.32512 14.3502 8.66927 14.0753 8.75705 13.6881L8.99505 12.6383C9.37411 12.5282 9.73573 12.3773 10.0748 12.1909L10.986 12.7653C11.3218 12.977 11.7595 12.928 12.0403 12.6473L12.6464 12.0412C12.9271 11.7604 12.9761 11.3227 12.7644 10.9869L12.1902 10.076C12.3768 9.73688 12.5278 9.37515 12.638 8.99596L13.6879 8.75794C14.0751 8.67015 14.35 8.32601 14.35 7.92897V7.07183C14.35 6.6748 14.0751 6.33065 13.6879 6.24287L12.6381 6.00488C12.528 5.62578 12.3771 5.26414 12.1906 4.92507L12.7648 4.01407C12.9766 3.6782 12.9276 3.2405 12.6468 2.95975L12.0407 2.35366C11.76 2.07292 11.3223 2.02392 10.9864 2.23565L10.0755 2.80989C9.73622 2.62328 9.37437 2.47229 8.99505 2.36209L8.75705 1.31231C8.66927 0.925096 8.32512 0.650238 7.92809 0.650238H7.07095ZM4.92053 3.81251C5.44724 3.44339 6.05665 3.18424 6.71543 3.06839L7.07095 1.50024H7.92809L8.28355 3.06816C8.94267 3.18387 9.5524 3.44302 10.0794 3.81224L11.4397 2.9547L12.0458 3.56079L11.1887 4.92117C11.558 5.44798 11.8173 6.0575 11.9332 6.71638L13.5 7.07183V7.92897L11.9334 8.28444C11.8176 8.94342 11.5585 9.55301 11.1892 10.0798L12.0459 11.4394L11.4398 12.0455L10.0797 11.1889C9.55252 11.5583 8.94242 11.8176 8.28355 11.9334L7.92809 13.5002H7.07095L6.71543 11.9332C6.0569 11.8174 5.44772 11.5582 4.92116 11.189L3.56055 12.0455L2.95445 11.4394L3.81107 10.0794C3.4418 9.55266 3.18265 8.94307 3.06681 8.28395L1.50002 7.92897V7.07183L3.06697 6.71632C3.18305 6.05684 3.44247 5.44693 3.81203 4.91979L2.95424 3.56079L3.56034 2.9547L4.92053 3.81251ZM9.02496 7.50008C9.02496 8.34226 8.34223 9.02499 7.50005 9.02499C6.65786 9.02499 5.97513 8.34226 5.97513 7.50008C5.97513 6.65789 6.65786 5.97516 7.50005 5.97516C8.34223 5.97516 9.02496 6.65789 9.02496 7.50008ZM9.97496 7.50008C9.97496 8.86866 8.86863 9.97499 7.50005 9.97499C6.13146 9.97499 5.02513 8.86866 5.02513 7.50008C5.02513 6.13149 6.13146 5.02516 7.50005 5.02516C8.86863 5.02516 9.97496 6.13149 9.97496 7.50008Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),q.jsx(Ee.Text,{children:"Settings"})]})}),q.jsx(Bg,{})]})};function Nr({branding:r,left:e,middle:t,right:s}){return q.jsxs(Ee.Box,{className:"w-screen h-[95vh] max-w-[95%] mx-auto flex flex-col",children:[q.jsx(Ee.Box,{className:"w-full p-3 mb-1 border-b",children:q.jsxs(Ee.Flex,{align:"center",justify:"between",children:[q.jsx(Ct.Link,{to:"/",children:q.jsxs(Ee.Flex,{align:"center",gap:"2",children:[q.jsx("img",{src:r.logo,className:"h-6 w-6"}),q.jsx(Ee.Text,{size:"5",weight:"bold",className:"text-black",children:r.name})]})}),q.jsx(Ee.Flex,{gap:"4",children:q.jsx(Cu,{})})]})}),q.jsxs(Ee.Flex,{className:"w-full h-[95%] flex-1 gap-2",children:[q.jsx(Ee.Box,{className:"flex-2 flex flex-col h-full p-2 border-r border-gray-400",children:e??q.jsx("div",{})}),q.jsx(Ee.Box,{className:"flex-3 flex flex-col h-full p-2 border-r border-gray-400",children:t??q.jsx("div",{})}),q.jsx(Ee.Box,{className:"flex-1 flex flex-col h-full p-2",children:s??q.jsx("div",{})})]})]})}function Fg({branding:r}){const{settings:e,runnerError:t}=Et();return ye.useEffect(()=>{if(!t)return;const s="/settings",c=window.location.pathname;if(c===s||c==="/login"||c==="/oidc/login")return;const u=e.requireAuth?"/oidc/login":"/login";if(!(t instanceof Error)&&!(t instanceof Event)){const a=t.code===li.UNAUTHENTICATED||t.code===li.PERMISSION_DENIED?u:s;window.location.href=a;return}window.location.href=s},[t,e.requireAuth]),q.jsx(Ct.BrowserRouter,{children:q.jsxs(Ct.Routes,{children:[q.jsx(Ct.Route,{path:"/",element:q.jsx(Nr,{branding:r,left:q.jsx(ai,{}),middle:q.jsx(oi,{}),right:q.jsx(hu,{})})}),q.jsx(Ct.Route,{path:"/settings",element:q.jsx(Nr,{branding:r,left:q.jsx(ai,{}),middle:q.jsx(oi,{}),right:q.jsx(mu,{})})}),q.jsx(Ct.Route,{path:"/oidc/*",element:q.jsx(Nr,{branding:r,middle:q.jsx("div",{children:"OIDC routes are exclusively handled by the server."})})}),q.jsx(Ct.Route,{path:"/login",element:q.jsx(Nr,{branding:r,left:q.jsx(fu,{})})}),q.jsx(Ct.Route,{path:"*",element:q.jsx(Nr,{branding:r,left:q.jsx(pu,{})})})]})})}function Ug({branding:r,initialState:e={}}){return q.jsxs(q.Fragment,{children:[q.jsx("title",{children:r.name}),q.jsx("meta",{name:"description",content:"An AI Assistant For Your Cloud"}),q.jsx("link",{rel:"icon",href:r.logo}),q.jsx(Ee.Theme,{accentColor:"gray",scaling:"100%",radius:"small",children:q.jsx(iu,{requireAuth:e==null?void 0:e.requireAuth,webApp:e==null?void 0:e.webApp,children:q.jsx(lu,{children:q.jsx(du,{children:q.jsx(Fg,{branding:r})})})})})]})}exports.Actions=oi;exports.AgentClientProvider=lu;exports.App=Ug;exports.BlockProvider=du;exports.Chat=ai;exports.FilesViewer=hu;exports.Layout=Nr;exports.Login=fu;exports.NotFound=pu;exports.Settings=mu;exports.SettingsProvider=iu;exports.TopNavigation=Cu;exports.useBlock=$t;exports.useClient=au;exports.useSettings=Et;
|
|
6550
|
+
*/var Zn,Tl;function _g(){if(Tl)return Zn;Tl=1,Zn=function(t){return t!=null&&(r(t)||e(t)||!!t._isBuffer)};function r(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function e(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&r(t.slice(0,0))}return Zn}var Ol;function yg(){return Ol||(Ol=1,function(){var r=gg(),e=Il().utf8,t=_g(),s=Il().bin,c=function(u,o){u.constructor==String?o&&o.encoding==="binary"?u=s.stringToBytes(u):u=e.stringToBytes(u):t(u)?u=Array.prototype.slice.call(u,0):!Array.isArray(u)&&u.constructor!==Uint8Array&&(u=u.toString());for(var a=r.bytesToWords(u),d=u.length*8,i=1732584193,n=-271733879,l=-1732584194,h=271733878,m=0;m<a.length;m++)a[m]=(a[m]<<8|a[m]>>>24)&16711935|(a[m]<<24|a[m]>>>8)&4278255360;a[d>>>5]|=128<<d%32,a[(d+64>>>9<<4)+14]=d;for(var p=c._ff,f=c._gg,v=c._hh,b=c._ii,m=0;m<a.length;m+=16){var g=i,_=n,w=l,y=h;i=p(i,n,l,h,a[m+0],7,-680876936),h=p(h,i,n,l,a[m+1],12,-389564586),l=p(l,h,i,n,a[m+2],17,606105819),n=p(n,l,h,i,a[m+3],22,-1044525330),i=p(i,n,l,h,a[m+4],7,-176418897),h=p(h,i,n,l,a[m+5],12,1200080426),l=p(l,h,i,n,a[m+6],17,-1473231341),n=p(n,l,h,i,a[m+7],22,-45705983),i=p(i,n,l,h,a[m+8],7,1770035416),h=p(h,i,n,l,a[m+9],12,-1958414417),l=p(l,h,i,n,a[m+10],17,-42063),n=p(n,l,h,i,a[m+11],22,-1990404162),i=p(i,n,l,h,a[m+12],7,1804603682),h=p(h,i,n,l,a[m+13],12,-40341101),l=p(l,h,i,n,a[m+14],17,-1502002290),n=p(n,l,h,i,a[m+15],22,1236535329),i=f(i,n,l,h,a[m+1],5,-165796510),h=f(h,i,n,l,a[m+6],9,-1069501632),l=f(l,h,i,n,a[m+11],14,643717713),n=f(n,l,h,i,a[m+0],20,-373897302),i=f(i,n,l,h,a[m+5],5,-701558691),h=f(h,i,n,l,a[m+10],9,38016083),l=f(l,h,i,n,a[m+15],14,-660478335),n=f(n,l,h,i,a[m+4],20,-405537848),i=f(i,n,l,h,a[m+9],5,568446438),h=f(h,i,n,l,a[m+14],9,-1019803690),l=f(l,h,i,n,a[m+3],14,-187363961),n=f(n,l,h,i,a[m+8],20,1163531501),i=f(i,n,l,h,a[m+13],5,-1444681467),h=f(h,i,n,l,a[m+2],9,-51403784),l=f(l,h,i,n,a[m+7],14,1735328473),n=f(n,l,h,i,a[m+12],20,-1926607734),i=v(i,n,l,h,a[m+5],4,-378558),h=v(h,i,n,l,a[m+8],11,-2022574463),l=v(l,h,i,n,a[m+11],16,1839030562),n=v(n,l,h,i,a[m+14],23,-35309556),i=v(i,n,l,h,a[m+1],4,-1530992060),h=v(h,i,n,l,a[m+4],11,1272893353),l=v(l,h,i,n,a[m+7],16,-155497632),n=v(n,l,h,i,a[m+10],23,-1094730640),i=v(i,n,l,h,a[m+13],4,681279174),h=v(h,i,n,l,a[m+0],11,-358537222),l=v(l,h,i,n,a[m+3],16,-722521979),n=v(n,l,h,i,a[m+6],23,76029189),i=v(i,n,l,h,a[m+9],4,-640364487),h=v(h,i,n,l,a[m+12],11,-421815835),l=v(l,h,i,n,a[m+15],16,530742520),n=v(n,l,h,i,a[m+2],23,-995338651),i=b(i,n,l,h,a[m+0],6,-198630844),h=b(h,i,n,l,a[m+7],10,1126891415),l=b(l,h,i,n,a[m+14],15,-1416354905),n=b(n,l,h,i,a[m+5],21,-57434055),i=b(i,n,l,h,a[m+12],6,1700485571),h=b(h,i,n,l,a[m+3],10,-1894986606),l=b(l,h,i,n,a[m+10],15,-1051523),n=b(n,l,h,i,a[m+1],21,-2054922799),i=b(i,n,l,h,a[m+8],6,1873313359),h=b(h,i,n,l,a[m+15],10,-30611744),l=b(l,h,i,n,a[m+6],15,-1560198380),n=b(n,l,h,i,a[m+13],21,1309151649),i=b(i,n,l,h,a[m+4],6,-145523070),h=b(h,i,n,l,a[m+11],10,-1120210379),l=b(l,h,i,n,a[m+2],15,718787259),n=b(n,l,h,i,a[m+9],21,-343485551),i=i+g>>>0,n=n+_>>>0,l=l+w>>>0,h=h+y>>>0}return r.endian([i,n,l,h])};c._ff=function(u,o,a,d,i,n,l){var h=u+(o&a|~o&d)+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._gg=function(u,o,a,d,i,n,l){var h=u+(o&d|a&~d)+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._hh=function(u,o,a,d,i,n,l){var h=u+(o^a^d)+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._ii=function(u,o,a,d,i,n,l){var h=u+(a^(o|~d))+(i>>>0)+l;return(h<<n|h>>>32-n)+o},c._blocksize=16,c._digestsize=16,Wn.exports=function(u,o){if(u==null)throw new Error("Illegal argument "+u);var a=r.wordsToBytes(c(u,o));return o&&o.asBytes?a:o&&o.asString?s.bytesToString(a):r.bytesToHex(a)}}()),Wn.exports}var wg=yg();const Sg=bg(wg);function Al(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function xg(...r){return e=>{let t=!1;const s=r.map(c=>{const u=Al(c,e);return!t&&typeof u=="function"&&(t=!0),u});if(t)return()=>{for(let c=0;c<s.length;c++){const u=s[c];typeof u=="function"?u():Al(r[c],null)}}}}var vu=Ue.forwardRef((r,e)=>{const{children:t,...s}=r,c=Ue.Children.toArray(t),u=c.find(jg);if(u){const o=u.props.children,a=c.map(d=>d===u?Ue.Children.count(o)>1?Ue.Children.only(null):Ue.isValidElement(o)?o.props.children:null:d);return q.jsx(ci,{...s,ref:e,children:Ue.isValidElement(o)?Ue.cloneElement(o,void 0,a):null})}return q.jsx(ci,{...s,ref:e,children:t})});vu.displayName="Slot";var ci=Ue.forwardRef((r,e)=>{const{children:t,...s}=r;if(Ue.isValidElement(t)){const c=kg(t),u=Eg(s,t.props);return t.type!==Ue.Fragment&&(u.ref=e?xg(e,c):c),Ue.cloneElement(t,u)}return Ue.Children.count(t)>1?Ue.Children.only(null):null});ci.displayName="SlotClone";var Cg=({children:r})=>q.jsx(q.Fragment,{children:r});function jg(r){return Ue.isValidElement(r)&&r.type===Cg}function Eg(r,e){const t={...e};for(const s in e){const c=r[s],u=e[s];/^on[A-Z]/.test(s)?c&&u?t[s]=(...a)=>{u(...a),c(...a)}:c&&(t[s]=c):s==="style"?t[s]={...c,...u}:s==="className"&&(t[s]=[c,u].filter(Boolean).join(" "))}return{...r,...t}}function kg(r){var s,c;let e=(s=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:s.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var Ig=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],oo=Ig.reduce((r,e)=>{const t=Ue.forwardRef((s,c)=>{const{asChild:u,...o}=s,a=u?vu:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),q.jsx(a,{...o,ref:c})});return t.displayName=`Primitive.${e}`,{...r,[e]:t}},{});function Tg(r,e=[]){let t=[];function s(u,o){const a=Ue.createContext(o),d=t.length;t=[...t,o];const i=l=>{var b;const{scope:h,children:m,...p}=l,f=((b=h==null?void 0:h[r])==null?void 0:b[d])||a,v=Ue.useMemo(()=>p,Object.values(p));return q.jsx(f.Provider,{value:v,children:m})};i.displayName=u+"Provider";function n(l,h){var f;const m=((f=h==null?void 0:h[r])==null?void 0:f[d])||a,p=Ue.useContext(m);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${l}\` must be used within \`${u}\``)}return[i,n]}const c=()=>{const u=t.map(o=>Ue.createContext(o));return function(a){const d=(a==null?void 0:a[r])||u;return Ue.useMemo(()=>({[`__scope${r}`]:{...a,[r]:d}}),[a,d])}};return c.scopeName=r,[s,Og(c,...e)]}function Og(...r){const e=r[0];if(r.length===1)return e;const t=()=>{const s=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const o=s.reduce((a,{useScope:d,scopeName:i})=>{const l=d(u)[`__scope${i}`];return{...a,...l}},{});return Ue.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function Ag(r){const e=Ue.useRef(r);return Ue.useEffect(()=>{e.current=r}),Ue.useMemo(()=>(...t)=>{var s;return(s=e.current)==null?void 0:s.call(e,...t)},[])}var bu=globalThis!=null&&globalThis.document?Ue.useLayoutEffect:()=>{},ao="Avatar",[Rg,Vg]=Tg(ao),[Ng,gu]=Rg(ao),_u=Ue.forwardRef((r,e)=>{const{__scopeAvatar:t,...s}=r,[c,u]=Ue.useState("idle");return q.jsx(Ng,{scope:t,imageLoadingStatus:c,onImageLoadingStatusChange:u,children:q.jsx(oo.span,{...s,ref:e})})});_u.displayName=ao;var yu="AvatarImage",wu=Ue.forwardRef((r,e)=>{const{__scopeAvatar:t,src:s,onLoadingStatusChange:c=()=>{},...u}=r,o=gu(yu,t),a=Lg(s,u.referrerPolicy),d=Ag(i=>{c(i),o.onImageLoadingStatusChange(i)});return bu(()=>{a!=="idle"&&d(a)},[a,d]),a==="loaded"?q.jsx(oo.img,{...u,ref:e,src:s}):null});wu.displayName=yu;var Su="AvatarFallback",xu=Ue.forwardRef((r,e)=>{const{__scopeAvatar:t,delayMs:s,...c}=r,u=gu(Su,t),[o,a]=Ue.useState(s===void 0);return Ue.useEffect(()=>{if(s!==void 0){const d=window.setTimeout(()=>a(!0),s);return()=>window.clearTimeout(d)}},[s]),o&&u.imageLoadingStatus!=="loaded"?q.jsx(oo.span,{...c,ref:e}):null});xu.displayName=Su;function Lg(r,e){const[t,s]=Ue.useState("idle");return bu(()=>{if(!r){s("error");return}let c=!0;const u=new window.Image,o=a=>()=>{c&&s(a)};return s("loading"),u.onload=o("loaded"),u.onerror=o("error"),u.src=r,e&&(u.referrerPolicy=e),()=>{c=!1}},[r,e]),t}var Pg=_u,Dg=wu,Mg=xu;const $g=(r=24)=>{const e=nn()||"unauthenticated";try{const s=vg(e).sub||"unauthenticated";return`https://www.gravatar.com/avatar/${Sg(s.trim().toLowerCase())}?s=${r}&d=identicon`}catch{return"unauthenticated"}},Bg=()=>q.jsxs(Is.Root,{children:[q.jsx(Is.Trigger,{asChild:!0,children:q.jsx("span",{children:q.jsxs(Pg,{className:"inline-flex size-[24px] select-none items-center justify-center overflow-hidden rounded-full bg-blackA1 align-middle cursor-pointer",children:[q.jsx(Dg,{className:"size-full rounded-[inherit] object-cover",src:$g()}),q.jsx(Mg,{className:"leading-1 flex size-full items-center justify-center bg-white text-[15px] font-medium text-violet11",delayMs:600,children:q.jsx(oh.PersonIcon,{})})]})})}),q.jsx(Is.Content,{sideOffset:8,className:"z-50 min-w-[120px] rounded-md bg-white p-2 shadow-lg border border-gray-200",children:q.jsx(Is.Item,{asChild:!0,children:q.jsx("a",{href:"/oidc/logout",className:"block w-full px-3 py-2 text-md text-gray-700 hover:bg-gray-100 rounded cursor-pointer",children:"Logout"})})})]}),Cu=()=>{const{resetSession:r}=$t();return q.jsxs(q.Fragment,{children:[q.jsx(Ct.Link,{to:"/",onClick:r,children:q.jsxs(Ee.Flex,{className:"cursor-pointer",gap:"1",align:"center",children:[q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M7.5 0.875C7.77614 0.875 8 1.09886 8 1.375V7.5H14.125C14.4011 7.5 14.625 7.72386 14.625 8C14.625 8.27614 14.4011 8.5 14.125 8.5H8V14.625C8 14.9011 7.77614 15.125 7.5 15.125C7.22386 15.125 7 14.9011 7 14.625V8.5H0.875C0.598858 8.5 0.375 8.27614 0.375 8C0.375 7.72386 0.598858 7.5 0.875 7.5H7V1.375C7 1.09886 7.22386 0.875 7.5 0.875Z",fill:"currentColor"})}),q.jsx(Ee.Text,{children:"New Session"})]})}),q.jsx(Ct.Link,{to:"/settings",children:q.jsxs(Ee.Flex,{className:"cursor-pointer",gap:"1",align:"center",children:[q.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:q.jsx("path",{d:"M7.07095 0.650238C6.67391 0.650238 6.32977 0.925096 6.24198 1.31231L6.0039 2.36247C5.6249 2.47269 5.26335 2.62363 4.92436 2.81013L4.01335 2.23585C3.67748 2.02413 3.23978 2.07312 2.95903 2.35386L2.35294 2.95996C2.0722 3.2407 2.0232 3.6784 2.23493 4.01427L2.80942 4.92561C2.62307 5.2645 2.47227 5.62594 2.36216 6.00481L1.31209 6.24287C0.924883 6.33065 0.650024 6.6748 0.650024 7.07183V7.92897C0.650024 8.32601 0.924883 8.67015 1.31209 8.75794L2.36228 8.99603C2.47246 9.375 2.62335 9.73652 2.80979 10.0755L2.2354 10.9867C2.02367 11.3225 2.07267 11.7602 2.35341 12.041L2.95951 12.6471C3.24025 12.9278 3.67795 12.9768 4.01382 12.7651L4.92506 12.1907C5.26384 12.377 5.62516 12.5278 6.0039 12.6379L6.24198 13.6881C6.32977 14.0753 6.67391 14.3502 7.07095 14.3502H7.92809C8.32512 14.3502 8.66927 14.0753 8.75705 13.6881L8.99505 12.6383C9.37411 12.5282 9.73573 12.3773 10.0748 12.1909L10.986 12.7653C11.3218 12.977 11.7595 12.928 12.0403 12.6473L12.6464 12.0412C12.9271 11.7604 12.9761 11.3227 12.7644 10.9869L12.1902 10.076C12.3768 9.73688 12.5278 9.37515 12.638 8.99596L13.6879 8.75794C14.0751 8.67015 14.35 8.32601 14.35 7.92897V7.07183C14.35 6.6748 14.0751 6.33065 13.6879 6.24287L12.6381 6.00488C12.528 5.62578 12.3771 5.26414 12.1906 4.92507L12.7648 4.01407C12.9766 3.6782 12.9276 3.2405 12.6468 2.95975L12.0407 2.35366C11.76 2.07292 11.3223 2.02392 10.9864 2.23565L10.0755 2.80989C9.73622 2.62328 9.37437 2.47229 8.99505 2.36209L8.75705 1.31231C8.66927 0.925096 8.32512 0.650238 7.92809 0.650238H7.07095ZM4.92053 3.81251C5.44724 3.44339 6.05665 3.18424 6.71543 3.06839L7.07095 1.50024H7.92809L8.28355 3.06816C8.94267 3.18387 9.5524 3.44302 10.0794 3.81224L11.4397 2.9547L12.0458 3.56079L11.1887 4.92117C11.558 5.44798 11.8173 6.0575 11.9332 6.71638L13.5 7.07183V7.92897L11.9334 8.28444C11.8176 8.94342 11.5585 9.55301 11.1892 10.0798L12.0459 11.4394L11.4398 12.0455L10.0797 11.1889C9.55252 11.5583 8.94242 11.8176 8.28355 11.9334L7.92809 13.5002H7.07095L6.71543 11.9332C6.0569 11.8174 5.44772 11.5582 4.92116 11.189L3.56055 12.0455L2.95445 11.4394L3.81107 10.0794C3.4418 9.55266 3.18265 8.94307 3.06681 8.28395L1.50002 7.92897V7.07183L3.06697 6.71632C3.18305 6.05684 3.44247 5.44693 3.81203 4.91979L2.95424 3.56079L3.56034 2.9547L4.92053 3.81251ZM9.02496 7.50008C9.02496 8.34226 8.34223 9.02499 7.50005 9.02499C6.65786 9.02499 5.97513 8.34226 5.97513 7.50008C5.97513 6.65789 6.65786 5.97516 7.50005 5.97516C8.34223 5.97516 9.02496 6.65789 9.02496 7.50008ZM9.97496 7.50008C9.97496 8.86866 8.86863 9.97499 7.50005 9.97499C6.13146 9.97499 5.02513 8.86866 5.02513 7.50008C5.02513 6.13149 6.13146 5.02516 7.50005 5.02516C8.86863 5.02516 9.97496 6.13149 9.97496 7.50008Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),q.jsx(Ee.Text,{children:"Settings"})]})}),q.jsx(Bg,{})]})};function Nr({branding:r,left:e,middle:t,right:s}){return q.jsxs(Ee.Box,{className:"w-screen h-[95vh] max-w-[95%] mx-auto flex flex-col",children:[q.jsx(Ee.Box,{className:"w-full p-3 mb-1 border-b",children:q.jsxs(Ee.Flex,{align:"center",justify:"between",children:[q.jsx(Ct.Link,{to:"/",children:q.jsxs(Ee.Flex,{align:"center",gap:"2",children:[q.jsx("img",{src:r.logo,className:"h-6 w-6"}),q.jsx(Ee.Text,{size:"5",weight:"bold",className:"text-black",children:r.name})]})}),q.jsx(Ee.Flex,{gap:"4",children:q.jsx(Cu,{})})]})}),q.jsxs(Ee.Flex,{className:"w-full h-[95%] flex-1 gap-2",children:[q.jsx(Ee.Box,{className:"flex-none w-[33.33%] flex flex-col h-full p-2 border-r border-gray-400",children:e??q.jsx("div",{})}),q.jsx(Ee.Box,{className:"flex-none w-[50.00%] flex flex-col h-full p-2 border-r border-gray-400",children:t??q.jsx("div",{})}),q.jsx(Ee.Box,{className:"flex-none w-[16.67%] flex flex-col h-full p-2",children:s??q.jsx("div",{})})]})]})}function Fg({branding:r}){const{settings:e,runnerError:t}=Et();return ye.useEffect(()=>{if(!t)return;const s="/settings",c=window.location.pathname;if(c===s||c==="/login"||c==="/oidc/login")return;const u=e.requireAuth?"/oidc/login":"/login";if(!(t instanceof Error)&&!(t instanceof Event)){const a=t.code===li.UNAUTHENTICATED||t.code===li.PERMISSION_DENIED?u:s;window.location.href=a;return}window.location.href=s},[t,e.requireAuth]),q.jsx(Ct.BrowserRouter,{children:q.jsxs(Ct.Routes,{children:[q.jsx(Ct.Route,{path:"/",element:q.jsx(Nr,{branding:r,left:q.jsx(ai,{}),middle:q.jsx(oi,{}),right:q.jsx(hu,{})})}),q.jsx(Ct.Route,{path:"/settings",element:q.jsx(Nr,{branding:r,left:q.jsx(ai,{}),middle:q.jsx(oi,{}),right:q.jsx(mu,{})})}),q.jsx(Ct.Route,{path:"/oidc/*",element:q.jsx(Nr,{branding:r,middle:q.jsx("div",{children:"OIDC routes are exclusively handled by the server."})})}),q.jsx(Ct.Route,{path:"/login",element:q.jsx(Nr,{branding:r,left:q.jsx(fu,{})})}),q.jsx(Ct.Route,{path:"*",element:q.jsx(Nr,{branding:r,left:q.jsx(pu,{})})})]})})}function Ug({branding:r,initialState:e={}}){return q.jsxs(q.Fragment,{children:[q.jsx("title",{children:r.name}),q.jsx("meta",{name:"description",content:"An AI Assistant For Your Cloud"}),q.jsx("link",{rel:"icon",href:r.logo}),q.jsx(Ee.Theme,{accentColor:"gray",scaling:"100%",radius:"small",children:q.jsx(iu,{requireAuth:e==null?void 0:e.requireAuth,webApp:e==null?void 0:e.webApp,children:q.jsx(lu,{children:q.jsx(du,{children:q.jsx(Fg,{branding:r})})})})})]})}exports.Actions=oi;exports.AgentClientProvider=lu;exports.App=Ug;exports.BlockProvider=du;exports.Chat=ai;exports.FilesViewer=hu;exports.Layout=Nr;exports.Login=fu;exports.NotFound=pu;exports.Settings=mu;exports.SettingsProvider=iu;exports.TopNavigation=Cu;exports.useBlock=$t;exports.useClient=au;exports.useSettings=Et;
|