vue-web-terminal
Version:
A beautiful web-side command line window plugin (native simulation). 一个漂亮的网页命令行插件(原生模拟)
1,226 lines • 217 kB
JavaScript
!function(){"use strict";try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode('.t-window::-webkit-scrollbar,.t-code::-webkit-scrollbar,.t-text-editor::-webkit-scrollbar,.t-vue-codemirror .vue-codemirror .CodeMirror .CodeMirror-hscrollbar::-webkit-scrollbar,.t-window pre::-webkit-scrollbar,.t-cmd-tips-items::-webkit-scrollbar,.t-cmd-help::-webkit-scrollbar{width:8px;height:8px}.t-window::-webkit-scrollbar-button,.t-code::-webkit-scrollbar-button,.t-text-editor::-webkit-scrollbar-button,.t-vue-codemirror .vue-codemirror .CodeMirror .CodeMirror-hscrollbar::-webkit-scrollbar-button,.t-window pre::-webkit-scrollbar-button,.t-cmd-tips-items::-webkit-scrollbar-button,.t-cmd-help::-webkit-scrollbar-button{width:0;height:0;display:none}.t-window::-webkit-scrollbar-thumb,.t-code::-webkit-scrollbar-thumb,.t-text-editor::-webkit-scrollbar-thumb,.t-vue-codemirror .vue-codemirror .CodeMirror .CodeMirror-hscrollbar::-webkit-scrollbar-thumb,.t-window pre::-webkit-scrollbar-thumb,.t-cmd-tips-items::-webkit-scrollbar-thumb,.t-cmd-help::-webkit-scrollbar-thumb{border-radius:6px;border-style:dashed;border-color:transparent;border-width:2px;background-color:#9da5b766;background-clip:padding-box}.t-window::-webkit-scrollbar-thumb:hover,.t-code::-webkit-scrollbar-thumb:hover,.t-text-editor::-webkit-scrollbar-thumb:hover,.t-vue-codemirror .vue-codemirror .CodeMirror .CodeMirror-hscrollbar::-webkit-scrollbar-thumb:hover,.t-window pre::-webkit-scrollbar-thumb:hover,.t-cmd-tips-items::-webkit-scrollbar-thumb:hover,.t-cmd-help::-webkit-scrollbar-thumb:hover{background:#9da5b7b3;cursor:pointer}.t-window::-webkit-scrollbar-track,.t-code::-webkit-scrollbar-track,.t-text-editor::-webkit-scrollbar-track,.t-vue-codemirror .vue-codemirror .CodeMirror .CodeMirror-hscrollbar::-webkit-scrollbar-track,.t-window pre::-webkit-scrollbar-track,.t-cmd-tips-items::-webkit-scrollbar-track,.t-cmd-help::-webkit-scrollbar-track{border-radius:6px}.t-ansi-1{font-weight:700}.t-ansi-2{font-weight:200}.t-ansi-3{font-style:oblique}.t-ansi-4{text-decoration:underline}@keyframes t-blink{0%{opacity:1}50%{opacity:1}50.01%{opacity:0}to{opacity:0}}.t-ansi-5,.t-ansi-6{animation:t-blink 1s linear infinite;-webkit-animation:t-blink 1s linear infinite;-moz-animation:t-blink 1s linear infinite;-ms-animation:t-blink 1s linear infinite;-o-animation:t-blink 1s linear infinite}.t-ansi-7{background-color:#fff;color:#1c1d21}.t-ansi-8{visibility:hidden}.t-ansi-9{text-decoration:line-through}.t-ansi-21,.t-ansi-22{font-weight:unset}.t-ansi-23{font-style:unset}.t-ansi-24,.t-ansi-29{text-decoration:none}.t-ansi-25,.t-ansi-26{animation:none;-webkit-animation:none;-moz-animation:none;-ms-animation:none;-o-animation:none}.t-ansi-27{background-color:inherit;color:inherit}.t-ansi-28{visibility:unset}.t-ansi-30{color:#000}.t-ansi-31{color:#f10606}.t-ansi-32{color:#14cb14}.t-ansi-33{color:#ff0}.t-ansi-34{color:#3993d4}.t-ansi-35{color:#bd12bd}.t-ansi-36{color:#0eb4b4}.t-ansi-37{color:#fff}.t-ansi-90{color:#585859}.t-ansi-91{color:#ef353a}.t-ansi-92{color:#4ec215}.t-ansi-93{color:#e3bd01}.t-ansi-94{color:#1faffe}.t-ansi-95{color:#eb7dec}.t-ansi-96{color:#00e3e4}.t-ansi-97{color:#fdfdfe}.t-ansi-40{background-color:#000}.t-ansi-41{background-color:#f10606}.t-ansi-42{background-color:#14cb14}.t-ansi-43{background-color:#ff0}.t-ansi-44{background-color:#3993d4}.t-ansi-45{background-color:#bd12bd}.t-ansi-46{background-color:#0eb4b4}.t-ansi-47{background-color:#fff}.t-ansi-100{background-color:#585859}.t-ansi-101{background-color:#ef353a}.t-ansi-102{background-color:#4ec215}.t-ansi-103{background-color:#e3bd01}.t-ansi-104{background-color:#1faffe}.t-ansi-105{background-color:#eb7dec}.t-ansi-106{background-color:#00e3e4}.t-ansi-107{background-color:#fdfdfe}.t-ansi-line{min-height:var(--t-font-height)}.t-ansi-char{min-width:7px;min-height:var(--t-font-height);font-size:inherit;display:inline;height:100%;vertical-align:top;font-weight:700;word-break:break-all;white-space:pre-wrap}:root{--t-font-height: 19px;--t-font-size: 16px;--t-cmd-tips-border-radius: 5px}.t-log-box,.t-cmd-line{margin-block-start:0;margin-block-end:0;margin-inline-start:0;margin-inline-end:0}.t-log-box{display:block;position:relative;line-height:var(--t-font-height)}.t-container{position:relative;margin:0;padding:0;border-radius:15px;background-color:var(--t-main-background-color);box-shadow:var(--t-window-box-shadow);-moz-box-shadow:var(--t-window-box-shadow);-webkit-box-shadow:var(--t-window-box-shadow);-o-box-shadow:var(--t-window-box-shadow)}.t-header-container{position:relative;z-index:2;top:0;right:0;left:0}.t-header{text-align:center;padding:2px;background-color:var(--t-header-background-color)}.t-header-title{font-size:calc(var(--t-font-size) + 2px);font-weight:700;margin:5px;height:var(--t-font-height);line-height:var(--t-font-height);letter-spacing:1px;color:var(--t-header-font-color);display:inline-block;cursor:pointer;text-shadow:0 0 20px #41454a}.t-header ul.t-shell-dots{position:absolute;top:5px;left:8px;padding-left:0;margin:0}.t-header ul.t-shell-dots li{display:inline-block;width:16px;height:16px;border-radius:10px;margin-left:6px;margin-top:4px;line-height:16px;cursor:pointer}.shell-dot-item{position:relative}.t-header ul .t-shell-dots-red{background-color:#f14444}.t-header ul .t-shell-dots-yellow{background-color:#f7db60}.t-header ul .t-shell-dots-green{background-color:#23bd65}.t-shell-dot{opacity:0;transition:opacity .2s ease;-moz-transition:opacity .2s ease;-ms-transition:opacity .2s ease;-webkit-transition:opacity .2s ease;-o-transition:opacity .2s ease;margin-bottom:0;position:absolute;left:50%;margin-left:-5px;top:50%;margin-top:-5px}.t-shell-dots:hover .t-shell-dot{opacity:1}.t-shell-pin-icon{filter:drop-shadow(5px 30px 5px rgba(26,58,70,.8));-ms-filter:drop-shadow(5px 30px 5px rgba(26,58,70,.8));-webkit-filter:drop-shadow(5px 30px 5px rgba(26,58,70,.8))}.t-window,.t-ask-input,.t-window p,.t-window div,.t-crude-font{font-size:var(--t-font-size);font-family:Monaco,Lucida Console,monospace}.t-window{position:absolute;top:0;left:0;right:0;overflow:auto;z-index:1;max-height:none;min-height:140px;padding:0 0 0 20px;font-weight:400;cursor:text;background-color:var(--t-main-background-color);color:var(--t-main-font-color)}.t-window p{overflow-wrap:break-word;word-break:break-all}.t-window p .cmd{line-height:24px}@keyframes cursor-flash{0%,to{opacity:0}50%{opacity:1}}.t-window .t-cursor{position:absolute}.t-window .t-cursor-blink{animation:cursor-flash 1s infinite;-webkit-animation:cursor-flash 1s infinite;-o-animation:cursor-flash 1s infinite;-moz-animation:cursor-flash 1s infinite}.t-window .t-cursor-block{background-color:var(--t-cursor-color)}.t-window .t-cursor-underline:before{display:block;position:absolute;background-color:var(--t-cursor-color);width:100%;height:3px;z-index:100;bottom:0;left:0;content:" "}.t-window .t-cursor-bar:before{display:block;position:absolute;background-color:var(--t-cursor-color);width:2px;height:100%;z-index:100;top:0;left:0;content:" "}.t-window .t-cursor-none{display:none}.t-a{color:var(--t-link-color)}.t-a:hover{color:var(--t-link-hover-color)}.t-ask-input{border:none;max-width:300px;background:none;outline:none;padding:0;display:inline-block;color:var(--t-main-font-color)}.t-ask-input:focus,.t-ask-input:focus-visible{border:none;outline:none}.t-cmd-input{position:relative;border:none;width:1px;height:0;opacity:0;cursor:text;padding:1px 2px;-webkit-writing-mode:horizontal-tb!important;text-rendering:auto;letter-spacing:normal;word-spacing:normal;text-transform:none;text-indent:0;text-shadow:none;display:inline-block;text-align:start;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;-webkit-rtl-ordering:logical;border-image:initial;word-wrap:break-word;margin:0;background-color:var(--t-main-background-color)}.t-content-normal .success,.t-content-normal .error,.t-content-normal .warning,.t-content-normal .info,.t-content-normal .system{padding:0 3px;color:var(--t-tag-font-color)}.t-content-normal .success{background-color:#27ae60}.t-content-normal .error{background-color:#c0392b}.t-content-normal .warning{background-color:#f39c12}.t-content-normal .info{background-color:#2980b9}.t-content-normal .system{background-color:#8697a2}.t-crude-font{font-weight:600}.t-flag{opacity:0}.t-last-line{font-size:0;word-spacing:0;letter-spacing:0;position:relative;margin-bottom:15px;line-height:var(--t-font-height)}@media screen and (max-width: 768px){.t-window{padding:0 0 0 15px}}.t-cmd-line{font-size:0;line-height:var(--t-font-height)}.t-cmd-line-content{font-size:var(--t-font-size);word-break:break-all;white-space:break-spaces}.t-cmd-key{font-weight:700;color:var(--t-cmd-key-color)}.t-cmd-arg{color:var(--t-cmd-arg-color)}.t-cmd-splitter{color:var(--t-cmd-splitter-color)}.t-help-list{margin:0;list-style:none;padding-left:0;display:inline-grid;display:-moz-inline-grid;display:-ms-inline-grid}.t-help-list li{margin:3px 0}.t-cmd-help{position:absolute;top:15px;right:12px;z-index:99;max-width:50%;padding:5px;overflow:auto;max-height:calc(100% - 60px);background-color:var(--t-cmd-help-background-color);color:var(--t-main-font-color);box-shadow:var(--t-cmd-help-box-shadow)}.t-cmd-help code{font-size:var(--t-font-size);border:none;padding:2px 5px;background-color:var(--t-cmd-help-code-background-color)!important}.t-cmd-help-eg{float:left;width:30px;display:flex;font-size:var(--t-font-size);line-height:var(--t-font-height)}.t-cmd-help-example{float:left;width:calc(100% - 30px);display:flex}.t-cmd-help-des{margin-bottom:10px}.t-cmd-help-des-item{font-size:var(--t-font-size)}.t-pre-numbering{margin-top:0;position:absolute;top:0;left:-30px;width:30px;text-align:center;padding:1em 0}.t-pre-numbering li{list-style:none;font-size:1em}.t-window pre{position:relative;margin:0;overflow:auto}.t-example-ul{padding:0 0 0 10px;margin:0;list-style:none}.t-table{max-width:100%;overflow:auto;padding:0;margin:0}.t-border-dashed{border-collapse:collapse;border:var(--t-table-border)}.t-table thead{font-weight:600}.t-table,.t-table tr,.t-table td,.t-table tbody,.t-table thead{margin:0;padding:15px}.t-code-inline{color:var(--t-code-inline-font-color);font-weight:600}.t-code{position:relative;max-height:500px;overflow:auto}.t-vue-codemirror div,.t-vue-highlight div{font-size:var(--t-font-size)}.t-code .t-vue-codemirror .vue-codemirror .CodeMirror{height:unset;border:none}.t-text-editor-container{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1}.t-text-editor{width:calc(100% - 10px);height:calc(100% - 35px);overflow:auto;resize:none;margin:0;padding:0 5px;border:none;font-size:var(--t-font-size);color:var(--t-main-font-color);background-color:var(--t-main-background-color)}.t-text-editor:focus-visible,.t-text-editor:focus{outline:none;outline-offset:unset}.t-text-editor-floor{position:absolute;height:35px;width:100%;bottom:0;left:0;background-color:var(--t-text-editor-floor-background-color)}.t-text-editor-floor-btn{border:none;outline:none;margin-top:10px;cursor:pointer;background-color:#0000}.t-close-btn{color:var(--t-text-editor-floor-close-btn-color)}.t-save-btn{color:var(--t-text-editor-floor-save-btn-color)}.t-text-editor-floor-btn:hover{color:var(--t-text-editor-floor-btn-hover-color)}.t-disable-select{user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-selece:none}.t-point{width:var(--t-font-height);height:var(--t-font-height);background-color:#0000;position:absolute;z-index:100}.t-point-lt{left:calc(0px - var(--t-font-height) / 2);top:calc(0px - var(--t-font-height) / 2);cursor:nwse-resize}.t-point-rt{left:calc(100% - var(--t-font-height) / 2);top:calc(0px - var(--t-font-height) / 2);cursor:nesw-resize}.t-point-lb{left:calc(0px - var(--t-font-height) / 2);top:calc(100% - var(--t-font-height) / 2);cursor:nesw-resize}.t-point-rb{left:calc(100% - var(--t-font-height) / 2);top:calc(100% - var(--t-font-height) / 2);cursor:nwse-resize}.t-code-default{background-color:var(--t-code-default-background-color)}.t-log-box-hover-script:hover{background-color:var(--t-log-box-hover-script-background-color)}.t-log-box-folded:hover{background-color:var(--t-log-box-folded-hover-background-color)}.t-log-box-folded{height:var(--t-font-height);overflow-y:clip;background-color:var(--t-log-box-folded-background-color);cursor:pointer}.t-log-fold-icon{position:absolute;width:10px;height:10px;left:-17px;top:4px;border:1px solid var(--t-log-fold-icon-border-color);text-align:center;line-height:9px;background-color:var(--t-log-fold-icon-background-color);color:var(--t-log-fold-icon-color);cursor:pointer;-webkit-user-select:none;user-select:none;z-index:100}.t-log-fold-icon-active{background-color:var(--t-log-fold-icon-active-background-color);color:var(--t-log-fold-icon-active-color)}.t-log-fold-line{position:absolute;height:calc(100% - 10px);width:1px;background-color:var(--t-log-fold-line-color);left:-12px;top:10px}.t-cmd-tips{--t-cmd-tips-box-shadow: 5px 5px 15px 0 rgba(0, 0, 0, .3);position:absolute;display:block;z-index:100;background-color:var(--t-cmd-tips-background-color);border-radius:var(--t-cmd-tips-border-radius);color:var(--t-cmd-tips-font-color);-ms-overflow-y:auto;cursor:context-menu;font-weight:400;box-shadow:var(--t-cmd-tips-box-shadow);-moz-box-shadow:var(--t-cmd-tips-box-shadow);-webkit-box-shadow:var(--t-cmd-tips-box-shadow);-o-box-shadow:var(--t-cmd-tips-box-shadow);font-family:system-ui}.t-cmd-tips-items{display:block;min-width:280px;max-width:500px;max-height:200px;overflow-y:auto;padding:5px}.t-cmd-tips-footer{display:block;width:100%;padding:5px 0;text-indent:6px;line-height:var(--t-font-height);background-color:var(--t-cmd-tips-footer-background-color);color:var(--t-cmd-tips-footer-font-color);font-size:12px;border-bottom-left-radius:var(--t-cmd-tips-border-radius);-webkit-border-bottom-left-radius:var(--t-cmd-tips-border-radius);border-bottom-right-radius:var(--t-cmd-tips-border-radius);-webkit-border-bottom-right-radius:var(--t-cmd-tips-border-radius)}.t-cmd-tips-item{display:block;padding:5px 8px;text-overflow:ellipsis;overflow:hidden;text-wrap:nowrap;color:var(--t-cmd-tips-des-font-color);border-radius:5px}.t-cmd-tips-item-first{border-top-left-radius:var(--t-cmd-tips-border-radius);-webkit-border-top-left-radius:var(--t-cmd-tips-border-radius);border-top-right-radius:var(--t-cmd-tips-border-radius);-webkit-border-top-right-radius:var(--t-cmd-tips-border-radius)}.t-cmd-tips-item-active{background-color:var(--t-cmd-tips-active-background-color)}.t-cmd-tips-content{font-weight:700;color:var(--t-cmd-tips-content-font-color);cursor:context-menu;-webkit-user-select:none;user-select:none}.t-cmd-tips-des{color:var(--t-cmd-tips-des-font-color);margin-left:8px;cursor:context-menu;-webkit-user-select:none;user-select:none}.t-json-container .jv-container.jv-light{border:none;background-color:var(--t-json-background-color);color:var(--t-main-font-color)}.t-json-container .jv-container .jv-code,.t-json-container .jv-container .jv-code.open{padding-bottom:0;overflow:hidden}.t-json-container .jv-container{display:inline-block;min-width:300px}.t-json-container .jv-container.jv-light .jv-item.jv-array,.t-json-container .jv-container.jv-light .jv-item.jv-object{color:var(--t-json-value-obj-color)}.t-json-container .jv-container.jv-light .jv-key{color:var(--t-main-font-color)}.t-json-container .jv-container.jv-light .jv-item.jv-boolean{color:var(--t-json-value-bool-color)}.t-json-container .jv-container.jv-light .jv-item.jv-number{color:var(--t-json-value-number-color)}.t-json-container .jv-container.jv-light .jv-ellipsis{color:var(--t-main-font-color);background-color:var(--t-json-ellipsis-background-color)}.t-json-container .jv-container .jv-more:after{background:var(--t-json-more-background-webkit);background:var(--t-json-more-background)}.t-json-deep-selector{margin-top:8px;width:75px;position:absolute;margin-left:-150px;font-size:var(--t-font-size);border-radius:2px;cursor:pointer;border:1px solid var(--t-json-deep-selector-border-color)}.t-json-deep-selector:focus,.t-json-deep-selector:focus-visible{outline:none}.t-window div::selection,.t-window a::selection,.t-window span::selection,.t-window li::selection,.t-window p::selection,.t-window code::selection,.t-window td::selection,.t-window th::selection,.t-window br::selection{color:var(--t-selection-font-color);background-color:var(--t-selection-background-color)}.jv-node{position:relative}.jv-node:after{content:","}.jv-node:last-of-type:after{content:""}.jv-node.toggle{margin-left:13px!important}.jv-node .jv-node{margin-left:25px}.jv-container{box-sizing:border-box;position:relative}.jv-container.boxed{border:1px solid #eee;border-radius:6px}.jv-container.boxed:hover{box-shadow:0 2px 7px #00000026;border-color:transparent;position:relative}.jv-container.jv-light{background:#fff;white-space:nowrap;color:#525252;font-size:14px;font-family:Consolas,Menlo,Courier,monospace}.jv-container.jv-light .jv-ellipsis{color:#999;background-color:#eee;display:inline-block;line-height:.9;font-size:.9em;padding:0 4px 2px;margin:0 4px;border-radius:3px;vertical-align:2px;cursor:pointer;-webkit-user-select:none;user-select:none}.jv-container.jv-light .jv-button{color:#49b3ff}.jv-container.jv-light .jv-key{color:#111;margin-right:4px}.jv-container.jv-light .jv-item.jv-array{color:#111}.jv-container.jv-light .jv-item.jv-boolean{color:#fc1e70}.jv-container.jv-light .jv-item.jv-function{color:#067bca}.jv-container.jv-light .jv-item.jv-number{color:#fc1e70}.jv-container.jv-light .jv-item.jv-object{color:#111}.jv-container.jv-light .jv-item.jv-undefined{color:#e08331}.jv-container.jv-light .jv-item.jv-string{color:#42b983;word-break:break-word;white-space:normal}.jv-container.jv-light .jv-item.jv-string .jv-link{color:#0366d6}.jv-container.jv-light .jv-code .jv-toggle:before{padding:0 2px;border-radius:2px}.jv-container.jv-light .jv-code .jv-toggle:hover:before{background:#eee}.jv-container .jv-code{overflow:hidden;padding:30px 20px}.jv-container .jv-code.boxed{max-height:300px}.jv-container .jv-code.open{max-height:none!important;overflow:visible;overflow-x:auto;padding-bottom:45px}.jv-container .jv-toggle{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE2IiB3aWR0aD0iOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjNjY2IiBkPSJNMCAwbDggOC04IDh6Ii8+PC9zdmc+);background-repeat:no-repeat;background-size:contain;background-position:50%;cursor:pointer;width:10px;height:10px;margin-right:2px;display:inline-block;-webkit-transition:-webkit-transform .1s;transition:-webkit-transform .1s;transition:transform .1s;transition:transform .1s,-webkit-transform .1s}.jv-container .jv-toggle.open{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.jv-container .jv-more{position:absolute;z-index:1;bottom:0;left:0;right:0;height:40px;width:100%;text-align:center;cursor:pointer}.jv-container .jv-more .jv-toggle{position:relative;top:40%;z-index:2;color:#888;-webkit-transition:all .1s;transition:all .1s;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.jv-container .jv-more .jv-toggle.open{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.jv-container .jv-more:after{content:"";width:100%;height:100%;position:absolute;bottom:0;left:0;z-index:1;background:-webkit-linear-gradient(top,transparent 20%,hsla(0,0%,90.2%,.3));background:linear-gradient(180deg,transparent 20%,hsla(0,0%,90.2%,.3));-webkit-transition:all .1s;transition:all .1s}.jv-container .jv-more:hover .jv-toggle{top:50%;color:#111}.jv-container .jv-more:hover:after{background:-webkit-linear-gradient(top,transparent 20%,hsla(0,0%,90.2%,.3));background:linear-gradient(180deg,transparent 20%,hsla(0,0%,90.2%,.3))}.jv-container .jv-button{position:relative;cursor:pointer;display:inline-block;padding:5px;z-index:5}.jv-container .jv-button.copied{opacity:.4;cursor:default}.jv-container .jv-tooltip{position:absolute}.jv-container .jv-tooltip.right{right:15px}.jv-container .jv-tooltip.left{left:15px}.jv-container .j-icon{font-size:12px}.t-header-pin[data-v-4fdc9a5b]{display:inline-block;position:absolute;z-index:100;right:13px;top:7px;cursor:pointer}.t-editor[data-v-f962e199]{width:100%;height:100%}')),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
import * as vue from "vue";
import { ref, defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, pushScopeId, popScopeId, unref, normalizeClass, reactive, createBlock, withDirectives, Fragment, renderList, vModelSelect, normalizeStyle, createTextVNode, computed, onMounted, onUnmounted, watch, nextTick, renderSlot, createVNode, withKeys, vModelDynamic, vShow, withModifiers, vModelText } from "vue";
class TerminalCallback {
constructor() {
__publicField(this, "onFinishListener");
}
finish() {
if (this.onFinishListener != null) {
this.onFinishListener();
}
}
onFinish(callback) {
this.onFinishListener = callback;
}
}
class TerminalAsk extends TerminalCallback {
constructor() {
super(...arguments);
__publicField(this, "handler");
}
ask(options) {
if (this.handler != null) {
this.handler(options);
}
}
onAsk(callback) {
this.handler = callback;
}
}
class TerminalFlash extends TerminalCallback {
constructor() {
super(...arguments);
__publicField(this, "handler");
}
flush(msg) {
if (this.handler != null) {
this.handler(msg);
}
}
onFlush(callback) {
this.handler = callback;
}
}
class TerminalApi {
constructor(data2) {
__publicField(this, "data");
this.data = data2;
}
post(name = "terminal", event, options) {
let listener = this.data.pool[name];
if (listener != null) {
return listener(event, options);
}
}
pushMessage(name, message) {
this.post(name, "pushMessage", message);
}
appendMessage(name, message) {
this.post(name, "appendMessage", message);
}
fullscreen(name) {
this.post(name, "fullscreen");
}
isFullscreen(name) {
return this.post(name, "isFullscreen");
}
dragging(name, position) {
this.post(name, "dragging", position);
}
/**
* Simulate trigger execution instructions
*
* @param name name of terminal
* @param command content of the command
* @return { boolean } Trigger success
*/
execute(name, command) {
return this.post(name, "execute", command);
}
focus(name, enforce) {
this.post(name, "focus", enforce);
}
elementInfo(name) {
return this.post(name, "elementInfo");
}
textEditorOpen(name, setting) {
this.post(name, "textEditorOpen", setting);
}
textEditorClose(name, closeCallbackParams) {
return this.post(name, "textEditorClose", closeCallbackParams);
}
clearLog(name, clearHistory) {
this.post(name, "clearLog", clearHistory);
}
getCommand(name) {
return this.post(name, "getCommand");
}
setCommand(name, newCommand) {
this.post(name, "setCommand", newCommand);
}
switchAllFoldState(name, foldStat) {
return this.post(name, "switchAllFoldState", foldStat);
}
jumpToBottom(name, enforce) {
this.post(name, "jumpToBottom", enforce);
}
getOutputs(name) {
return this.post(name, "getOutputs");
}
}
function _html(str) {
return String(str).replace(/&(?!\w+;)/g, "&").replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\n/g, "<br>").replace(/\t/g, " ");
}
function _isEmpty(value) {
return value === void 0 || value === null || typeof value === "string" && value.trim().length === 0 || typeof value === "object" && Object.keys(value).length === 0;
}
function _nonEmpty(value) {
return !_isEmpty(value);
}
function _screenType(width = document.body.clientWidth) {
let result = {};
if (width < 600) {
result.xs = true;
} else if (width >= 600 && width < 960) {
result.sm = true;
} else if (width >= 960 && width < 1264) {
result.md = true;
} else if (width >= 1264 && width < 1904) {
result.lg = true;
} else {
result.xl = true;
}
return result;
}
function _isSafari() {
return /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
}
function _getByteLen(val) {
if (val.match(/[\n\r]/)) {
return 0;
}
let len = 0;
for (let i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null)
len += 2;
else len += 1;
}
return len;
}
function _eventOn(dom, eventName, handler) {
dom && dom.addEventListener && dom.addEventListener(eventName, handler);
}
function _eventOff(dom, eventName, handler) {
dom && dom.removeEventListener && dom.removeEventListener(eventName, handler);
}
function _getClipboardText() {
if (navigator && navigator.clipboard) {
return navigator.clipboard.readText();
} else {
return new Promise((resolve, reject) => {
try {
let pasteTarget = document.createElement("div");
pasteTarget.contentEditable = "true";
let actElem = document.activeElement.appendChild(pasteTarget).parentNode;
pasteTarget.focus();
document.execCommand("paste");
let paste = pasteTarget.innerText;
actElem.removeChild(pasteTarget);
resolve(paste);
} catch (e) {
reject(e);
}
});
}
}
function _copyTextToClipboard(text) {
if (!text) {
return;
}
text = text.replace(/nbsp;/g, " ");
if (navigator && navigator.clipboard) {
return navigator.clipboard.writeText(text);
} else {
let textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.position = "absolute";
textArea.style.opacity = "0";
textArea.style.left = "-999999px";
textArea.style.top = "-999999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
document.execCommand("copy");
textArea.remove();
return Promise.resolve();
}
}
function _pointInRect(point, rect) {
const { x, y } = point;
const dx = rect.x, dy = rect.y, width = rect.width, height = rect.height;
return x >= dx && x <= dx + width && y >= dy && y <= dy + height;
}
function _getSelection() {
if (window.getSelection) {
return window.getSelection();
} else {
return document.getSelection();
}
}
function _parseToJson(obj) {
if (typeof obj === "object" && obj) {
return obj;
} else if (typeof obj === "string") {
try {
return JSON.parse(obj);
} catch (e) {
return obj;
}
}
}
function _openUrl(url, pushMessage) {
let match = /^((http|https):\/\/)?(([A-Za-z0-9]+-[A-Za-z0-9]+|[A-Za-z0-9]+)\.)+([A-Za-z]+)[/?:]?.*$/;
if (match.test(url)) {
if (!url.startsWith("http") && !url.startsWith("https")) {
window.open(`http://${url}`);
} else {
window.open(url);
}
} else {
pushMessage({
class: "error",
type: "normal",
content: "Invalid website url"
});
}
}
function _defaultMergedCommandFormatter(cmd) {
let split = cmd.replace(/\xA0/g, " ").split(" ");
let formatted = "";
let isCmdKey = true;
for (let i = 0; i < split.length; i++) {
let char = _html(split[i]);
if (isCmdKey) {
formatted += `<span class='t-cmd-key'>${char}</span>`;
isCmdKey = false;
} else if (char.startsWith("-")) {
formatted += `<span class="t-cmd-arg">${char}</span>`;
} else if (char === "\r") {
if (i < split.length - 1 && split[i + 1] === "\n") {
formatted += `<br/>`;
i++;
} else {
formatted += `<br/>`;
}
} else if (char === "\n") {
formatted += `<br/>`;
} else if (char.length > 0) {
if (char === "|") {
isCmdKey = true;
formatted += `<span>${char}</span>`;
} else {
formatted += "<span>";
let startNewCmdKey = false;
const charArr = [...char];
charArr.forEach((ch, index) => {
if (ch === ",") {
formatted += `<span class="t-cmd-splitter">${ch}</span>`;
} else if (ch === "|") {
formatted += ch;
isCmdKey = true;
if (index < char.length - 1) {
formatted += `<span class='t-cmd-key'>`;
startNewCmdKey = true;
}
} else {
formatted += ch;
}
if (index == charArr.length - 1 && ch != "|") {
isCmdKey = false;
}
});
formatted += "</span>";
if (startNewCmdKey) {
formatted += "</span>";
}
}
}
if (i < split.length - 1) {
formatted += "<span> </span>";
}
}
return formatted;
}
function _isParentDom(target, parent, clazz = null) {
while (target) {
if (target === parent) {
return true;
}
if (clazz && target.classList.contains(clazz)) {
break;
}
target = target.parentElement;
}
return false;
}
function _isPhone() {
let info = navigator.userAgent;
if (info) {
return /mobile/i.test(info);
}
let screen = _screenType();
return screen.xs || screen.sm;
}
function _isPad() {
let info = navigator.userAgent;
if (info) {
return /pad/i.test(info);
}
return _screenType().sm;
}
function _debounce(fn, delay = 200) {
let timer = null;
return function() {
let _this = this;
let args = arguments;
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(function() {
fn.apply(_this, args);
}, delay);
};
}
function _parsePixelFromValue(value, parentPixel, defaultValue) {
let pixel;
if (value) {
if (typeof value === "string") {
if (value.endsWith("%")) {
pixel = parentPixel * (parseFloat(value) / 100);
} else if (value.endsWith("px")) {
pixel = parseFloat(value);
} else {
pixel = parseFloat(value);
}
} else if (typeof value === "number") {
pixel = value;
} else {
pixel = defaultValue;
}
} else {
pixel = defaultValue;
}
return pixel;
}
function _hash(str) {
let hash = 5381;
for (let i = 0; i < str.length; i++) {
hash = hash * 33 ^ str.charCodeAt(i);
}
hash = hash >>> 0;
return hash.toString(16);
}
const data = {
pool: {},
configuration: {
maxStoredCommandCountPerInstance: 100,
storeName: "terminal",
themes: {}
}
};
function register(name, listener) {
if (data.pool[name]) {
throw Error(`Unable to register an existing terminal: ${name}`);
}
data.pool[name] = listener;
}
function unregister(name) {
delete data.pool[name];
}
function rename(newName, oldName, listener) {
unregister(oldName);
register(newName, listener);
}
function configTheme(theme, css) {
let res = css.match(/^.*\{(.*)}\s*$/s);
if (!res || res.length != 2) {
throw new Error(`Incorrect theme style format, correct format example:
:root {
--t-main-background-color: #191b24;
--t-main-font-color: #fff;
...
}
`);
}
let themes = data.configuration.themes;
if (!themes) {
data.configuration.themes = themes = {};
}
themes[theme] = css;
}
function configStoreName(name) {
if (_isEmpty(name)) {
throw new Error("The terminal storage name is invalid: " + name);
}
data.configuration.storeName = name;
console.debug("Configured storeName", name);
}
function configMaxStoredCommandCountPerInstance(count) {
if (count <= 1) {
throw new Error("The value of 'maxStoredLogCountPerInstance' must be a valid positive number: " + count);
}
data.configuration.maxStoredCommandCountPerInstance = count;
console.debug("Configured maxStoredCommandCountPerInstance", count);
}
function getConfiguration() {
return data.configuration;
}
const api = new TerminalApi(data);
const DEFAULT_COMMANDS = [
{
key: "help",
title: "Help",
group: "local",
usage: "help [pattern]",
description: "Show command document.",
example: [
{
des: "Get all commands.",
cmd: "help"
},
{
des: "Get help documentation for exact match commands.",
cmd: "help refresh"
},
{
des: "Get help documentation for fuzzy matching commands.",
cmd: "help *e*"
},
{
des: "Get help documentation for specified group, match key must start with ':'.",
cmd: "help :groupA"
}
]
},
{
key: "clear",
title: "Clear screen or history logs",
group: "local",
usage: "clear [history]",
description: "Clear screen or history.",
example: [
{
cmd: "clear",
des: "Clear all records on the current screen."
},
{
cmd: "clear history",
des: "Clear command history"
}
]
},
{
key: "open",
title: "Open page",
group: "local",
usage: "open <url>",
description: "Open a specified page.",
example: [
{
cmd: "open blog.beifengtz.com"
}
]
}
];
const WINDOW_STYLE = {
PADDING_LEFT: 10,
PADDING_LEFT_FOLD: 20,
PADDING_RIGHT: 10,
PADDING_TOP: 0,
PADDING_BOTTOM: 0
};
const c0 = "rgb(0,0,0)";
const c1 = "rgb(128,0,0)";
const c2 = "rgb(0,128,0)";
const c3 = "rgb(128,128,0)";
const c4 = "rgb(0,0,128)";
const c5 = "rgb(128,0,128)";
const c6 = "rgb(0,128,128)";
const c7 = "rgb(192,192,192)";
const c8 = "rgb(128,128,128)";
const c9 = "rgb(255,0,0)";
const c10 = "rgb(0,255,0)";
const c11 = "rgb(255,255,0)";
const c12 = "rgb(0,0,255)";
const c13 = "rgb(255,0,255)";
const c14 = "rgb(0,255,255)";
const c15 = "rgb(255,255,255)";
const c16 = "rgb(0,0,0)";
const c17 = "rgb(0,0,95)";
const c18 = "rgb(0,0,135)";
const c19 = "rgb(0,0,175)";
const c20 = "rgb(0,0,215)";
const c21 = "rgb(0,0,255)";
const c22 = "rgb(0,95,0)";
const c23 = "rgb(0,95,95)";
const c24 = "rgb(0,95,135)";
const c25 = "rgb(0,95,175)";
const c26 = "rgb(0,95,215)";
const c27 = "rgb(0,95,255)";
const c28 = "rgb(0,135,0)";
const c29 = "rgb(0,135,95)";
const c30 = "rgb(0,135,135)";
const c31 = "rgb(0,135,175)";
const c32 = "rgb(0,135,215)";
const c33 = "rgb(0,135,255)";
const c34 = "rgb(0,175,0)";
const c35 = "rgb(0,175,95)";
const c36 = "rgb(0,175,135)";
const c37 = "rgb(0,175,175)";
const c38 = "rgb(0,175,215)";
const c39 = "rgb(0,175,255)";
const c40 = "rgb(0,215,0)";
const c41 = "rgb(0,215,95)";
const c42 = "rgb(0,215,135)";
const c43 = "rgb(0,215,175)";
const c44 = "rgb(0,215,215)";
const c45 = "rgb(0,215,255)";
const c46 = "rgb(0,255,0)";
const c47 = "rgb(0,255,95)";
const c48 = "rgb(0,255,135)";
const c49 = "rgb(0,255,175)";
const c50 = "rgb(0,255,215)";
const c51 = "rgb(0,255,255)";
const c52 = "rgb(95,0,0)";
const c53 = "rgb(95,0,95)";
const c54 = "rgb(95,0,135)";
const c55 = "rgb(95,0,175)";
const c56 = "rgb(95,0,215)";
const c57 = "rgb(95,0,255)";
const c58 = "rgb(95,95,0)";
const c59 = "rgb(95,95,95)";
const c60 = "rgb(95,95,135)";
const c61 = "rgb(95,95,175)";
const c62 = "rgb(95,95,215)";
const c63 = "rgb(95,95,255)";
const c64 = "rgb(95,135,0)";
const c65 = "rgb(95,135,95)";
const c66 = "rgb(95,135,135)";
const c67 = "rgb(95,135,175)";
const c68 = "rgb(95,135,215)";
const c69 = "rgb(95,135,255)";
const c70 = "rgb(95,175,0)";
const c71 = "rgb(95,175,95)";
const c72 = "rgb(95,175,135)";
const c73 = "rgb(95,175,175)";
const c74 = "rgb(95,175,215)";
const c75 = "rgb(95,175,255)";
const c76 = "rgb(95,215,0)";
const c77 = "rgb(95,215,95)";
const c78 = "rgb(95,215,135)";
const c79 = "rgb(95,215,175)";
const c80 = "rgb(95,215,215)";
const c81 = "rgb(95,215,255)";
const c82 = "rgb(95,255,0)";
const c83 = "rgb(95,255,95)";
const c84 = "rgb(95,255,135)";
const c85 = "rgb(95,255,175)";
const c86 = "rgb(95,255,215)";
const c87 = "rgb(95,255,255)";
const c88 = "rgb(135,0,0)";
const c89 = "rgb(135,0,95)";
const c90 = "rgb(135,0,135)";
const c91 = "rgb(135,0,175)";
const c92 = "rgb(135,0,215)";
const c93 = "rgb(135,0,255)";
const c94 = "rgb(135,95,0)";
const c95 = "rgb(135,95,95)";
const c96 = "rgb(135,95,135)";
const c97 = "rgb(135,95,175)";
const c98 = "rgb(135,95,215)";
const c99 = "rgb(135,95,255)";
const c100 = "rgb(135,135,0)";
const c101 = "rgb(135,135,95)";
const c102 = "rgb(135,135,135)";
const c103 = "rgb(135,135,175)";
const c104 = "rgb(135,135,215)";
const c105 = "rgb(135,135,255)";
const c106 = "rgb(135,175,0)";
const c107 = "rgb(135,175,95)";
const c108 = "rgb(135,175,135)";
const c109 = "rgb(135,175,175)";
const c110 = "rgb(135,175,215)";
const c111 = "rgb(135,175,255)";
const c112 = "rgb(135,215,0)";
const c113 = "rgb(135,215,95)";
const c114 = "rgb(135,215,135)";
const c115 = "rgb(135,215,175)";
const c116 = "rgb(135,215,215)";
const c117 = "rgb(135,215,255)";
const c118 = "rgb(135,255,0)";
const c119 = "rgb(135,255,95)";
const c120 = "rgb(135,255,135)";
const c121 = "rgb(135,255,175)";
const c122 = "rgb(135,255,215)";
const c123 = "rgb(135,255,255)";
const c124 = "rgb(175,0,0)";
const c125 = "rgb(175,0,95)";
const c126 = "rgb(175,0,135)";
const c127 = "rgb(175,0,175)";
const c128 = "rgb(175,0,215)";
const c129 = "rgb(175,0,255)";
const c130 = "rgb(175,95,0)";
const c131 = "rgb(175,95,95)";
const c132 = "rgb(175,95,135)";
const c133 = "rgb(175,95,175)";
const c134 = "rgb(175,95,215)";
const c135 = "rgb(175,95,255)";
const c136 = "rgb(175,135,0)";
const c137 = "rgb(175,135,95)";
const c138 = "rgb(175,135,135)";
const c139 = "rgb(175,135,175)";
const c140 = "rgb(175,135,215)";
const c141 = "rgb(175,135,255)";
const c142 = "rgb(175,175,0)";
const c143 = "rgb(175,175,95)";
const c144 = "rgb(175,175,135)";
const c145 = "rgb(175,175,175)";
const c146 = "rgb(175,175,215)";
const c147 = "rgb(175,175,255)";
const c148 = "rgb(175,215,0)";
const c149 = "rgb(175,215,95)";
const c150 = "rgb(175,215,135)";
const c151 = "rgb(175,215,175)";
const c152 = "rgb(175,215,215)";
const c153 = "rgb(175,215,255)";
const c154 = "rgb(175,255,0)";
const c155 = "rgb(175,255,95)";
const c156 = "rgb(175,255,135)";
const c157 = "rgb(175,255,175)";
const c158 = "rgb(175,255,215)";
const c159 = "rgb(175,255,255)";
const c160 = "rgb(215,0,0)";
const c161 = "rgb(215,0,95)";
const c162 = "rgb(215,0,135)";
const c163 = "rgb(215,0,175)";
const c164 = "rgb(215,0,215)";
const c165 = "rgb(215,0,255)";
const c166 = "rgb(215,95,0)";
const c167 = "rgb(215,95,95)";
const c168 = "rgb(215,95,135)";
const c169 = "rgb(215,95,175)";
const c170 = "rgb(215,95,215)";
const c171 = "rgb(215,95,255)";
const c172 = "rgb(215,135,0)";
const c173 = "rgb(215,135,95)";
const c174 = "rgb(215,135,135)";
const c175 = "rgb(215,135,175)";
const c176 = "rgb(215,135,215)";
const c177 = "rgb(215,135,255)";
const c178 = "rgb(215,175,0)";
const c179 = "rgb(215,175,95)";
const c180 = "rgb(215,175,135)";
const c181 = "rgb(215,175,175)";
const c182 = "rgb(215,175,215)";
const c183 = "rgb(215,175,255)";
const c184 = "rgb(215,215,0)";
const c185 = "rgb(215,215,95)";
const c186 = "rgb(215,215,135)";
const c187 = "rgb(215,215,175)";
const c188 = "rgb(215,215,215)";
const c189 = "rgb(215,215,255)";
const c190 = "rgb(215,255,0)";
const c191 = "rgb(215,255,95)";
const c192 = "rgb(215,255,135)";
const c193 = "rgb(215,255,175)";
const c194 = "rgb(215,255,215)";
const c195 = "rgb(215,255,255)";
const c196 = "rgb(255,0,0)";
const c197 = "rgb(255,0,95)";
const c198 = "rgb(255,0,135)";
const c199 = "rgb(255,0,175)";
const c200 = "rgb(255,0,215)";
const c201 = "rgb(255,0,255)";
const c202 = "rgb(255,95,0)";
const c203 = "rgb(255,95,95)";
const c204 = "rgb(255,95,135)";
const c205 = "rgb(255,95,175)";
const c206 = "rgb(255,95,215)";
const c207 = "rgb(255,95,255)";
const c208 = "rgb(255,135,0)";
const c209 = "rgb(255,135,95)";
const c210 = "rgb(255,135,135)";
const c211 = "rgb(255,135,175)";
const c212 = "rgb(255,135,215)";
const c213 = "rgb(255,135,255)";
const c214 = "rgb(255,175,0)";
const c215 = "rgb(255,175,95)";
const c216 = "rgb(255,175,135)";
const c217 = "rgb(255,175,175)";
const c218 = "rgb(255,175,215)";
const c219 = "rgb(255,175,255)";
const c220 = "rgb(255,215,0)";
const c221 = "rgb(255,215,95)";
const c222 = "rgb(255,215,135)";
const c223 = "rgb(255,215,175)";
const c224 = "rgb(255,215,215)";
const c225 = "rgb(255,215,255)";
const c226 = "rgb(255,255,0)";
const c227 = "rgb(255,255,95)";
const c228 = "rgb(255,255,135)";
const c229 = "rgb(255,255,175)";
const c230 = "rgb(255,255,215)";
const c231 = "rgb(255,255,255)";
const c232 = "rgb(8,8,8)";
const c233 = "rgb(18,18,18)";
const c234 = "rgb(28,28,28)";
const c235 = "rgb(38,38,38)";
const c236 = "rgb(48,48,48)";
const c237 = "rgb(58,58,58)";
const c238 = "rgb(68,68,68)";
const c239 = "rgb(78,78,78)";
const c240 = "rgb(88,88,88)";
const c241 = "rgb(98,98,98)";
const c242 = "rgb(108,108,108)";
const c243 = "rgb(118,118,118)";
const c244 = "rgb(128,128,128)";
const c245 = "rgb(138,138,138)";
const c246 = "rgb(148,148,148)";
const c247 = "rgb(158,158,158)";
const c248 = "rgb(168,168,168)";
const c249 = "rgb(178,178,178)";
const c250 = "rgb(188,188,188)";
const c251 = "rgb(198,198,198)";
const c252 = "rgb(208,208,208)";
const c253 = "rgb(218,218,218)";
const c254 = "rgb(228,228,228)";
const c255 = "rgb(238,238,238)";
const ansi256colors = {
c0,
c1,
c2,
c3,
c4,
c5,
c6,
c7,
c8,
c9,
c10,
c11,
c12,
c13,
c14,
c15,
c16,
c17,
c18,
c19,
c20,
c21,
c22,
c23,
c24,
c25,
c26,
c27,
c28,
c29,
c30,
c31,
c32,
c33,
c34,
c35,
c36,
c37,
c38,
c39,
c40,
c41,
c42,
c43,
c44,
c45,
c46,
c47,
c48,
c49,
c50,
c51,
c52,
c53,
c54,
c55,
c56,
c57,
c58,
c59,
c60,
c61,
c62,
c63,
c64,
c65,
c66,
c67,
c68,
c69,
c70,
c71,
c72,
c73,
c74,
c75,
c76,
c77,
c78,
c79,
c80,
c81,
c82,
c83,
c84,
c85,
c86,
c87,
c88,
c89,
c90,
c91,
c92,
c93,
c94,
c95,
c96,
c97,
c98,
c99,
c100,
c101,
c102,
c103,
c104,
c105,
c106,
c107,
c108,
c109,
c110,
c111,
c112,
c113,
c114,
c115,
c116,
c117,
c118,
c119,
c120,
c121,
c122,
c123,
c124,
c125,
c126,
c127,
c128,
c129,
c130,
c131,
c132,
c133,
c134,
c135,
c136,
c137,
c138,
c139,
c140,
c141,
c142,
c143,
c144,
c145,
c146,
c147,
c148,
c149,
c150,
c151,
c152,
c153,
c154,
c155,
c156,
c157,
c158,
c159,
c160,
c161,
c162,
c163,
c164,
c165,
c166,
c167,
c168,
c169,
c170,
c171,
c172,
c173,
c174,
c175,
c176,
c177,
c178,
c179,
c180,
c181,
c182,
c183,
c184,
c185,
c186,
c187,
c188,
c189,
c190,
c191,
c192,
c193,
c194,
c195,
c196,
c197,
c198,
c199,
c200,
c201,
c202,
c203,
c204,
c205,
c206,
c207,
c208,
c209,
c210,
c211,
c212,
c213,
c214,
c215,
c216,
c217,
c218,
c219,
c220,
c221,
c222,
c223,
c224,
c225,
c226,
c227,
c228,
c229,
c230,
c231,
c232,
c233,
c234,
c235,
c236,
c237,
c238,
c239,
c240,
c241,
c242,
c243,
c244,
c245,
c246,
c247,
c248,
c249,
c250,
c251,
c252,
c253,
c254,
c255
};
const ANSI_NUL = "\0";
const ANSI_BEL = "\x07";
const ANSI_ESC = "\x1B";
const ANSI_CSI = ANSI_ESC + "[";
const ANSI_OSC = ANSI_ESC + "]";
const ANSI_PM = ANSI_ESC + "^";
const ANSI_DECPAM = ANSI_ESC + "=";
const ANSI_DECPNM = ANSI_ESC + ">";
function _parseANSI(str, os = "windows") {
let lines = [""];
let data2 = {
attachStyle: "",
styleFlag: []
};
let lastChar = {
dom: null,
attachStyle: ""
};
function getLastCharDomStr() {
if (!lastChar.dom) {
return "";
}
let container = document.createElement("div");
container.appendChild(lastChar.dom);
let domStr = container.innerHTML;
container = null;
return domStr;
}
function updateLastChar(clazz, style, innerText) {
let dom = document.createElement("span");
dom.className = clazz;
dom.setAttribute("style", style);
dom.innerText = innerText;
lastChar.dom = dom;
lastChar.attachStyle = style;
}
function checkDirtyChar() {
if (lastChar.dom) {
lines[lines.length - 1] = lines[lines.length - 1] + getLastCharDomStr();
lastChar.dom = null;
lastChar.attachStyle = "";
}
}
function newLine() {
checkDirtyChar();
lines[lines.length - 1] = '<div class="t-ansi-line">' + lines[lines.length - 1] + "</div>";
lines.push("");
}
function fillChar(char) {
try {
let arr2 = char.split("");
for (let c of arr2) {
let clazz = "t-ansi-char";
if (data2.styleFlag.length > 0) {
data2.styleFlag.forEach((o) => clazz += " t-ansi-" + parseInt(String(o)));
}
let charStr = null;
if (lastChar.dom) {
if (clazz === lastChar.dom.className && data2.attachStyle === lastChar.attachStyle) {
lastChar.dom.innerText += c;
} else {
charStr = getLastCharDomStr();
updateLastChar(clazz, data2.attachStyle, c);
}
} else {
updateLastChar(clazz, data2.attachStyle, c);
}
if (charStr) {
lines[lines.length - 1] = lines[lines.length - 1] + charStr;
}
}
} catch (e) {
console.error("Can not fill char: " + char.toString(), e);
}
}
let arr = Array.from(str);
for (let i = 0; i < arr.length; i++) {
let c = arr[i];
if (c === ANSI_NUL) {
continue;
}
if (c === ANSI_ESC) {
let flag = str.substring(i, i + 2);
let y = i;
if (flag === ANSI_CSI) {
const endFlagReg = /[@ABCDEFGHIJKLMPSTXZ`"bcdfghilmnpqrstwxz]/;
let controlType;
y = i + 1;
while (y < arr.length - 1) {
let char = arr[++y];
if (endFlagReg.test(char.toString())) {
if (char === "`" && y + 1 < arr.length) {
let next = arr[y + 1];
if (/[wz{|]/.test(next.toString())) {
controlType = char + next;
y++;
break;
}
} else if (char === '"' && y + 1 < arr.length) {
let next = arr[y + 1];
if (/[pq]/.test(next.toString())) {
controlType = char + next;
y++;
break;
}
} else if (char === "&" && y + 1 < arr.length) {
let next = arr[y + 1];
if (next === "w") {
controlType = char + next;
y++;
break;
}
}
controlType = char;
break;
}
}
let cs = str.substring(i, y + 1);
if (controlType === "m") {
let value = cs.substring(2, cs.length - 1);
if (value.length === 0) {
value = "0";
}
data2.styleFlag = [];
for (let ps of value.split(";")) {
let m = parseInt(ps);
if (m === 0) {
data2.attachStyle = "";
data2.styleFlag = [];
} else {
data2.styleFlag.push(m);
}
}
if (data2.styleFlag.length === 3) {
if (data2.styleFlag[0] === 38 && data2.styleFlag[1] === 5) {
data2.attachStyle += `color:${ansi256colors["c" + data2.styleFlag[2]]};`;
data2.styleFlag = [];
} else if (data2.styleFlag[0] === 48 && data2.styleFlag[1] === 5) {
data2.attachStyle += `background-color:${ansi256colors["c" + data2.styleFlag[2]]};`;
data2.styleFlag = [];
} else {
data2.attachStyle = "";
}
}
}
} else if (flag === ANSI_OSC) {
let p = i + 1;
while (p <= arr.length) {
p++;
if (arr[p] === ANSI_BEL) {
y = p;
break;
} else if (arr[p] === ANSI_ESC && arr[p] === "\\") {
y = p + 1;
break;
}
}
} else if (flag === ANSI_PM) {
let p = i + 1;
while (p < arr.length) {
++p;
if (arr[p] === "\\") {
break;
}
}
y = p;
} else if (flag === ANSI_DECPAM) {
y = i + 1;
} else if (flag === ANSI_DECPNM) {
y = i + 1;
} else {
y = i + 2;
}
i = y;
continue;
} else if (c === "\r") {
if (os === "windows") {
if (i + 1 < arr.length && arr[i + 1] === "\n") {
newLine();
i++;
} else {
newLine();
}
} else if (os === "mac") {
newLine();
}
continue;
} else if (c === "\n") {
newLine();
continue;
} else if (c === "\b") {
continue;
} else if (c === " ") {
fillChar(" ".repeat(4));
continue;
} else if (c >= "\0" && c <= "") {
continue;
}
fillChar(c);
}
checkDirtyChar();
return lines.join("");
}
const store = ref();
class TerminalStore {
constructor(key, maxStoredCommandCountPerInstance) {
__publicField(this, "storageKey");
__publicField(this, "maxStoredCommandCountPerInstance");
__publicField(this, "dataMap");
this.storageKey = key;
this.maxStoredCommandCountPerInstance = maxStoredCommandCountPerInstance;
let dataMapStr = window.localStorage.getItem(this.storageKey);
if (dataMapStr) {
this.dataMap = JSON.parse(dataMapStr);
} else {
this.dataMap = {};
}
}
push(name, cmd) {
let data2 = this.getData(name);
if (data2.cmdLog == null) {
data2.cmdLog = [];
}
if (data2.cmdLog.length === 0 || data2.cmdLog[data2.cmdLog.length - 1] !== cmd) {
data2.cmdLog.push(cmd);
console.log(data2.cmdLog.length, this.maxStoredCommandCountPerInstance);
if (data2.cmdLog.length