File: /www/server/panel/BTPanel/static/js/software-legacy.js
!function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,l=[],s=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return l}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function l(r,n,i,a){var l=n&&n.prototype instanceof c?n:c,u=Object.create(l.prototype);return o(u,"_invoke",function(r,n,i){var a,o,l,c=0,u=i||[],d=!1,h={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,r){return a=t,o=0,l=e,h.n=r,s}};function m(r,n){for(o=r,l=n,t=0;!d&&c&&!i&&t<u.length;t++){var i,a=u[t],m=h.p,p=a[2];r>3?(i=p===n)&&(l=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=m&&((i=r<2&&m<a[1])?(o=0,h.v=n,h.n=a[1]):m<p&&(i=r<3||a[0]>n||n>p)&&(a[4]=r,a[5]=n,h.n=p,o=0))}if(i||r>1)return s;throw d=!0,n}return function(i,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&m(u,p),o=u,l=p;(t=o<2?e:l)||!d;){a||(o?o<3?(o>1&&(h.n=-1),m(o,l)):h.n=l:h.v=l);try{if(c=2,a){if(o||(i="next"),t=a[i]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=a.return)&&t.call(a),o<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=e}else if((t=(d=h.n<0)?l:r.call(n,h))!==s)break}catch(t){a=e,o=1,l=t}finally{c=1}}return{value:t,done:d}}}(r,i,a),!0),u}var s={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var h=[][n]?t(t([][n]())):(o(t={},n,function(){return this}),t),m=d.prototype=c.prototype=Object.create(h);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return u.prototype=d,o(m,"constructor",d),o(d,"constructor",u),u.displayName="GeneratorFunction",o(d,i,"GeneratorFunction"),o(m),o(m,i,"Generator"),o(m,n,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),(a=function(){return{w:l,m:p}})()}function o(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,r,n){function a(t,r){o(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},o(e,t,r,n)}function l(e,t,r,n,i,a,o){try{var l=e[a](o),s=l.value}catch(e){return void r(e)}l.done?t(s):Promise.resolve(s).then(n,i)}function s(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){l(a,n,i,o,s,"next",e)}function s(e){l(a,n,i,o,s,"throw",e)}o(void 0)})}}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function m(e,t,r){return t&&h(e.prototype,t),r&&h(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}System.register([],function(e,n){"use strict";return{execute:function(){var e=function(){return m(function e(){d(this,e),p(this,"defaultColors",{primary:"#20a53a",success:"#67c23a",warning:"#f2711c",danger:"#db2828",error:"#db2828",info:"#909399"}),p(this,"lightRatios",{3:.3,5:.5,7:.7,8:.8,9:.9}),p(this,"darkRatios",{2:.2}),p(this,"darkModeLightRatios",{3:.15,5:.25,7:.35,8:.45,9:.55}),p(this,"darkModeDarkRatios",{2:.3})},[{key:"hexToRgb",value:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}},{key:"rgbToHex",value:function(e,t,r){return"#".concat(((1<<24)+(e<<16)+(t<<8)+r).toString(16).slice(1))}},{key:"mixColors",value:function(e,t,r){return{r:Math.round(e.r*(1-r)+t.r*r),g:Math.round(e.g*(1-r)+t.g*r),b:Math.round(e.b*(1-r)+t.b*r)}}},{key:"generateLightColor",value:function(e,t){var r=this.hexToRgb(e);if(!r)throw new Error("Invalid color format: ".concat(e));var n=this.mixColors(r,{r:255,g:255,b:255},this.lightRatios[t]);return this.rgbToHex(n.r,n.g,n.b)}},{key:"generateDarkColor",value:function(e,t){var r=this.hexToRgb(e);if(!r)throw new Error("Invalid color format: ".concat(e));var n=this.mixColors(r,{r:0,g:0,b:0},this.darkRatios[t]);return this.rgbToHex(n.r,n.g,n.b)}},{key:"generateDarkModeLightColor",value:function(e,t){var r=this.hexToRgb(e);if(!r)throw new Error("Invalid color format: ".concat(e));var n=this.mixColors(r,{r:0,g:0,b:0},this.darkModeLightRatios[t]);return this.rgbToHex(n.r,n.g,n.b)}},{key:"generateDarkModeDarkColor",value:function(e,t){var r=this.hexToRgb(e);if(!r)throw new Error("Invalid color format: ".concat(e));var n=this.mixColors(r,{r:255,g:255,b:255},this.darkModeDarkRatios[t]);return this.rgbToHex(n.r,n.g,n.b)}},{key:"generateColorVariables",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=u(u({},this.defaultColors),t),i=u({darkMode:!1},r),a={};return Object.keys(n).forEach(function(t){var r=n[t];r&&(a["--el-color-".concat(t)]=r,i.darkMode?([3,5,7,8,9].forEach(function(n){a["--el-color-".concat(t,"-light-").concat(n)]=e.generateDarkModeLightColor(r,n)}),a["--el-color-".concat(t,"-dark-2")]=e.generateDarkModeDarkColor(r,2)):([3,5,7,8,9].forEach(function(n){a["--el-color-".concat(t,"-light-").concat(n)]=e.generateLightColor(r,n)}),a["--el-color-".concat(t,"-dark-2")]=e.generateDarkColor(r,2)))}),a}},{key:"applyColorVariables",value:function(e){}},{key:"generateAndApplyColors",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.generateColorVariables(e,t)}}])}(),n=function(){return m(function e(){d(this,e),p(this,"styleElement",null),p(this,"styleId","software-dynamic-theme-variables"),p(this,"currentVariables",{}),this.init()},[{key:"init",value:function(){this.createStyleElement()}},{key:"createStyleElement",value:function(){var e=document.getElementById(this.styleId);if(e)return this.styleElement=e,e;var t=document.createElement("style");return t.id=this.styleId,t.type="text/css",document.head.appendChild(t),this.styleElement=t,t}},{key:"registerVariables",value:function(e,t){var r={};Object.keys(e).forEach(function(n){var i=t?"--".concat(t,"-").concat(n.replace(/^--/,"")):n;r[i]=e[n]}),Object.assign(this.currentVariables,r),this.updateStyles()}},{key:"registerColorVariables",value:function(e,t){this.registerVariables(e,t)}},{key:"registerThemeVariables",value:function(e){var t={};if(e.theme&&e.theme.color&&(t["--theme-primary-color"]=e.theme.color),e.interface&&e.interface.rounded)switch(e.interface.rounded){case"none":t["--el-border-radius-small"]="0px",t["--el-border-radius-base"]="0px",t["--el-border-radius-medium"]="0px",t["--el-border-radius-large"]="0px",t["--el-border-radius-extra-large"]="0px";break;case"smaller":t["--el-border-radius-small"]="2px",t["--el-border-radius-base"]="2px",t["--el-border-radius-medium"]="2px",t["--el-border-radius-large"]="4px",t["--el-border-radius-extra-large"]="6px";break;case"small":t["--el-border-radius-small"]="2px",t["--el-border-radius-base"]="4px",t["--el-border-radius-medium"]="6px",t["--el-border-radius-large"]="8px",t["--el-border-radius-extra-large"]="16px";break;case"medium":t["--el-border-radius-small"]="4px",t["--el-border-radius-base"]="6px",t["--el-border-radius-medium"]="8px",t["--el-border-radius-large"]="12px",t["--el-border-radius-extra-large"]="20px";break;case"large":t["--el-border-radius-small"]="8px",t["--el-border-radius-base"]="12px",t["--el-border-radius-medium"]="16px",t["--el-border-radius-large"]="20px",t["--el-border-radius-extra-large"]="24px";break;default:t["--el-border-radius-small"]="4px",t["--el-border-radius-base"]="6px",t["--el-border-radius-medium"]="8px",t["--el-border-radius-large"]="12px",t["--el-border-radius-extra-large"]="16px"}this.registerVariables(t,"")}},{key:"removeVariablesByNamespace",value:function(e){var t=this,r="--".concat(e,"-");Object.keys(this.currentVariables).forEach(function(e){e.startsWith(r)&&delete t.currentVariables[e]}),this.updateStyles()}},{key:"clearAllVariables",value:function(){this.currentVariables={},this.updateStyles()}},{key:"updateStyles",value:function(){this.styleElement||this.createStyleElement();var e=this.generateCSSRules();this.styleElement&&(this.styleElement.textContent=e)}},{key:"getSystemTheme",value:function(){try{return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}},{key:"isDark",value:function(){try{var e=window.vite_public_panel_theme.theme.preset;return"auto"===e?"dark"===this.getSystemTheme():"dark"===e}catch(t){return!1}}},{key:"generateCSSRules",value:function(){var e=this,t=Object.keys(this.currentVariables).map(function(t){return" ".concat(t,": ").concat(e.currentVariables[t],";")}).join("\n");return"".concat(this.isDark()?"html.dark {":":root {","\n").concat(t,"\n}")}},{key:"getCurrentVariables",value:function(){return u({},this.currentVariables)}},{key:"getVariable",value:function(e){return this.currentVariables[e]}},{key:"hasVariable",value:function(e){return e in this.currentVariables}},{key:"destroy",value:function(){this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement),this.styleElement=null,this.currentVariables={}}}])}(),i=function(){return m(function t(){var r=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,t),p(this,"isInit",void 0),p(this,"isEnableAdaptation",void 0),p(this,"currentTheme",void 0),p(this,"colorGenerator",void 0),p(this,"styleManager",void 0),p(this,"panelTheme",void 0),p(this,"eventListenerFn",function(e){try{if(!r.isEnableAdaptation)return;var t=e.data;if("theme-change"!==(null==t?void 0:t.type))return;t.theme&&t.theme!==r.currentTheme&&r.setTheme(t.theme),t.color&&r.panelTheme&&(r.panelTheme=u(u({},r.panelTheme),{},{theme:u(u({},r.panelTheme.theme),{},{color:t.color})}),r.applyPanelThemeColors())}catch(n){}}),this.isEnableAdaptation=i.isEnableAdaptation||!1,this.colorGenerator=new e,this.styleManager=new n,this.panelTheme=window.vite_public_panel_theme||null,this.currentTheme=this.getInitialTheme(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){return r.init()}):this.init()},[{key:"init",value:function(){this.isEnableAdaptation&&(this.isInit=!0,this.applyTheme(this.currentTheme),this.setupParentThemeListener())}},{key:"mountThemeAdaptation",value:function(){this.isEnableAdaptation=!0,this.init()}},{key:"unmountThemeAdaptation",value:function(){var e=document.documentElement;window.removeEventListener("message",this.eventListenerFn),this.isEnableAdaptation=!1,e.classList.remove("dark"),e.removeAttribute("data-theme")}},{key:"setupParentThemeListener",value:function(){window.addEventListener("message",this.eventListenerFn)}},{key:"setTheme",value:function(e){this.currentTheme=e,this.applyTheme(e)}},{key:"applyTheme",value:function(e){this.applyThemeImmediate(e),this.applyPanelThemeColors()}},{key:"applyThemeImmediate",value:function(e){var t=document.documentElement;t.removeAttribute("class"),t.removeAttribute("data-theme"),"dark"===e?(t.classList.add("dark"),t.setAttribute("data-theme","dark")):t.removeAttribute("data-theme")}},{key:"applyPanelThemeColors",value:function(){var e;if(this.panelTheme){var t="dark"===this.currentTheme,r=(null===(e=this.panelTheme.theme)||void 0===e?void 0:e.color)||"#20a53a",n=this.colorGenerator.generateAndApplyColors({primary:r,success:"#67c23a",warning:"#f2711c",danger:"#db2828",error:"#db2828",info:"#909399"},{darkMode:t});this.styleManager.registerColorVariables(n,""),this.applyDarkModeSpecialStyles(r,t),this.applyInterfaceStyles()}}},{key:"applyInterfaceStyles",value:function(){this.panelTheme&&this.styleManager.registerThemeVariables(this.panelTheme)}},{key:"applyDarkModeSpecialStyles",value:function(e,t){var r="software-dark-mode-special-styles",n=document.getElementById(r);if(t&&"#F4D1B4"===e){if(!n){var i=document.createElement("style");i.id=r,i.textContent="\n\t\t\t\t\t/* 暗金色主题特定样式修正 */\n\t\t\t\t\thtml.dark {\n\t\t\t\t\t\t--el-color-primary: #F4D1B4 !important;\n\t\t\t\t\t\t--el-color-primary-light-3: #EAC2A5 !important;\n\t\t\t\t\t\t--el-color-primary-light-5: #E0B396 !important;\n\t\t\t\t\t\t--el-color-primary-light-7: #D6A487 !important;\n\t\t\t\t\t\t--el-color-primary-light-8: #CC9578 !important;\n\t\t\t\t\t\t--el-color-primary-light-9: #C28669 !important;\n\t\t\t\t\t\t--el-color-primary-dark-2: #F4D1B4 !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .tips .tips-text{\n\t\t\t\t\t\tcolor: #a9750b !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .el-button--primary {\n\t\t\t\t\t\tcolor: #1F1F1F !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .el-checkbox__input.is-checked .el-checkbox__inner::after {\n\t\t\t\t\t\tborder-color: #1F1F1F !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .el-radio-button.is-active .el-radio-button__original-radio:not(:disabled)+.el-radio-button__inner {\n\t\t\t\t\t\tcolor: #1F1F1F !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .class-item.on {\n\t\t\t\t\t\tcolor: #1F1F1F !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .message-number {\n\t\t\t\t\t\tcolor: #1F1F1F !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml.dark .el-switch.is-checked .el-switch__core .el-switch__action {\n\t\t\t\t\t\tbackground-color: #1F1F1F !important;\n\t\t\t\t\t}\n\t\t\t\t\thtml.dark .form-select-module .select-list .select-item:hover{\n\t\t\t\t\t\tbackground-color: #1F1F1F !important;\n\t\t\t\t\t}\n\t\t\t\t",document.head.appendChild(i)}}else n&&n.remove()}},{key:"getInitialTheme",value:function(){var e,t=((null===(e=this.panelTheme)||void 0===e?void 0:e.theme)||{}).preset;if(void 0!==t)return"auto"===t?this.detectSystemTheme():t;var r=localStorage.getItem("theme");return r||this.detectSystemTheme()}},{key:"detectSystemTheme",value:function(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}},{key:"getStyleManager",value:function(){return this.styleManager}},{key:"registerCustomVariables",value:function(e,t){this.styleManager.registerVariables(e,t)}},{key:"getAllVariables",value:function(){return this.styleManager.getCurrentVariables()}},{key:"getCurrentTheme",value:function(){return this.currentTheme}},{key:"getPanelTheme",value:function(){return this.panelTheme}}])}(),o=function(){return m(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;d(this,e),p(this,"loadList",[]),p(this,"pluginTimer",null),p(this,"fileList",{laydate:["static/laydate/laydate.js?v=1777008528"],echarts:["static/js/echarts.min.js?v=1777008528"],clipboard:["static/js/clipboard.min.js?v=1777008528"],qrcode:["static/js/jquery.qrcode.min.js?v=1777008528"],xterm:["static/css/xterm.css?v=1777008528","/static/js/xterm.js?v=1777008528"],jsencrypt:["static/js/jsencrypt.min.js?v=1777008528"],ace:["static/editor/ace.js?v=1777008528"]}),p(this,"triggerList",{laydate:["laydate.render"],echarts:["echarts.init"],clipboard:["ClipboardJS","bt.pub.copy_pass"],qrcode:["qrcode({"],xterm:["Term.run()","web_shell()"],jsencrypt:["JSEncrypt","rsa.encrypt_public"],ace:["ace.edit","bt.aceEditor","bt.fullScreenLog","bt.on_edit_file","bt.pub.on_edit_file","OnlineEditFile"]}),p(this,"adaptList",["webssh","openclaw"]),p(this,"getToken",function(){var e=Date.now(),t=window.vite_public_proxy_key;return{request_time:e,request_token:window.md5(String(e).concat(window.md5(t)))}}),t&&this.renderPlugin(t)},[{key:"renderPlugin",value:(o=s(a().m(function e(t){var r,n,i,o,l;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.pluginTitle,n=t.pluginName,i=t.pluginBuilt,e.p=1,!Number(i)){e.n=2;break}window.soft.set_soft_config(n),e.n=7;break;case 2:return e.n=3,this.getPluginHtml(n);case 3:return o=e.v,this.adaptList.includes(n)||o.includes("\x3c!-- AUTO DARK THEME ---\x3e")?window.software_theme_manager.mountThemeAdaptation():window.software_theme_manager.unmountThemeAdaptation(),e.n=4,this.getPluginDependence(o);case 4:return l=e.v,e.n=5,this.loadFileList(l);case 5:if("phpguard"!==n){e.n=6;break}return window.parent.postMessage("closePlugin&php守护已启动,无需设置!&success","*"),e.a(2);case 6:this.openPluginView({title:r,name:n,rhtml:o});case 7:e.n=9;break;case 8:e.p=8,e.v,window.parent.postMessage("closePlugin","*");case 9:return e.a(2)}},e,this,[[1,8]])})),function(e){return o.apply(this,arguments)})},{key:"openPluginView",value:(i=s(a().m(function e(t){var r,n,i,o,l=this;return a().w(function(e){for(;;)switch(e.n){case 0:r=t.title,n=t.name,i=t.rhtml,o=i.replace(/[\"\']javascript\/text[\"\']/,'"text/javascript"'),window.bt.open({type:1,shift:5,offset:"auto",closeBtn:2,area:r.indexOf("Node.js版本管理器")>-1?["700px","710px"]:"700px",title:'<img style="width: 24px;margin-right: 5px;margin-left: -10px;margin-top: -3px;" src="/static/img/soft_ico/ico-'.concat(n,'.png" />').concat(r),content:o,success:function(e){var t=$(window).height()||0,r=$(e).height()||0;r>=t?setTimeout(function(){$(e).css({top:"0px"})},100):($(e).find(".layui-layer-content").removeAttr("style").css({backgroundColor:"#fff"}),$(e).css({top:"".concat((t-r)/2,"px")}),$(e).find(".layui-layer-close").addClass("layui-layer-close2").removeClass("layui-layer-close1"));var n=$(window).width()||0;($(e).width()||0)>=n&&setTimeout(function(){$(e).css({left:"0px",width:"100%"})},100),window.parent.postMessage("pluginLoad","*")},end:function(){l.checkPopup()}});case 1:return e.a(2)}},e)})),function(e){return i.apply(this,arguments)})},{key:"closePluginView",value:function(){this.pluginTimer&&(clearInterval(this.pluginTimer),this.pluginTimer=null),window.parent.postMessage("closePlugin","*")}},{key:"checkPopup",value:function(){var e=this;this.pluginTimer=setInterval(function(){$(document).find(".layui-layer").length||e.closePluginView()},100)}},{key:"message",value:function(e){var t,r=e.message,n=e.type,i=e.time,a=void 0===i?2e3:i;null===(t=document.getElementById("el-message"))||void 0===t||t.remove();var o='<div id="el-message" class="el-message el-message--'.concat(n,'" style="z-index: 9999999;position:fixed">\n\t\t\t\t<div class="el-message__icon el-icon-').concat(n,'"></div>\n\t\t\t\t<div class="el-message__content">').concat(r||"","</div>\n\t\t\t</div>");window.document.body.insertAdjacentHTML("beforeend",o);var l=document.getElementById("el-message");l.style.top="calc(50% - ".concat(l.offsetHeight/2,"px)"),a&&setTimeout(function(){var e=document.getElementById("el-message");e&&e.remove()},a)}},{key:"objectToQueryString",value:function(e){return Object.keys(e).map(function(t){return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e[t]))}).join("&")}},{key:"isDev",value:function(){return!1}},{key:"ajax",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST";return new Promise(function(i,a){var o=new XMLHttpRequest,l=r.isDev();if(l&&(e="/api/".concat(e).replace("//","/")),o.open(n,e,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),l){var s=r.getToken();t=u(u({},t),s)}else o.setRequestHeader("x-http-token",window.vite_public_request_token);o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)try{var e=o.responseText;i(e)}catch(t){a(new Error("Error parsing response: ".concat(t)))}else a(new Error("Request failed with status: ".concat(o.status)))},o.onerror=function(){a(new Error("Network error"))},"POST"===n&&t?o.send(r.objectToQueryString(t)):o.send()})}},{key:"getPluginHtml",value:(n=s(a().m(function e(t){return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.ajax("/plugin?action=getConfigHtml",{name:t});case 1:return e.a(2,e.v);case 2:return e.p=2,e.v,e.a(2,"")}},e,this,[[0,2]])})),function(e){return n.apply(this,arguments)})},{key:"getPluginDependence",value:function(e){for(var n=[],i=this.triggerList,a=this.fileList,o=this.loadList,l=0,s=Object.entries(i);l<s.length;l++){var c=r(s[l],2),u=c[0];c[1].some(function(t){return e.includes(t)})&&(o.includes(u)||n.push.apply(n,t(a[u])),o.push(u))}return n}},{key:"loadScriptFile",value:function(e){return new Promise(function(t,r){var n=document.createElement("script");n.type="text/javascript",n.src=e,document.head.appendChild(n),n.onload=function(){return t(!0)},n.onerror=function(){return r()}})}},{key:"loadCssFile",value:function(e){return new Promise(function(t,r){var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,document.head.appendChild(n),n.onload=function(){return t(!0)},n.onerror=function(){return r()}})}},{key:"loadFileList",value:(e=s(a().m(function e(t){var r,n,i=this;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=[],t.forEach(function(e){e.endsWith(".css?v=1777008528")?r.push(i.loadCssFile(e)):r.push(i.loadScriptFile(e))}),e.n=1,Promise.all(r);case 1:return e.a(2,Promise.resolve(!0));case 2:return e.p=2,n=e.v,e.a(2,Promise.reject(n))}},e,null,[[0,2]])})),function(t){return e.apply(this,arguments)})}]);var e,n,i,o}();window.plugin_view=new o,window.addEventListener("message",function(e){var t=e.data;"string"==typeof t&&t.includes("pluginName")&&window.plugin_view.renderPlugin(JSON.parse(t))}),window.software_theme_manager=new i({isEnableAdaptation:!1}),window.open_ai_chat=function(e){var t,r,n;null===(t=window.top)||void 0===t||t.dispatchEvent(new CustomEvent("open-ai-chat",{detail:{message:e.message,autoSend:null!==(r=e.autoSend)&&void 0!==r&&r,windowMode:null!==(n=e.windowMode)&&void 0!==n?n:"popup",images:e.images}}))}}}})}();