filecat
Version:
FileCat Server Manager
2 lines • 8.86 kB
JavaScript
/*! For license information please see 181.ed11230f80088fa2a5b9.js.LICENSE.txt */
;(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[91,181],{4091:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var r=n(6540),o=n(952),i=(n(2327),n(1766),n(4854),n(8),n(846),n(975),n(4286),n(766),n(1234),n(7507),n(4522)),c=n.n(i),a=n(7444),u=n(6417),l=n(8247);function f(e){return f="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},f(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=f(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==f(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,c,a=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(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 y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=(0,r.useRef)(null),n=d((0,a.L4)(u.A.user_base_info),2),i=n[0],f=(n[1],"dark"===i.user_data.theme?"cloud_editor_dark":"cloud9_day");return(0,r.useEffect)(function(){var n,r,i=o.edit(t.current,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({value:l.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:"ace/theme/".concat(f),mode:null!==(n=e.model)&&void 0!==n?n:c().getModeForPath(null!==(r=e.name)&&void 0!==r?r:"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14},e.options));return i.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}),i.container.addEventListener("wheel",function(e){e.preventDefault()}),i.focus(),i.on("change",function(t){e.on_change&&e.on_change()}),t.current=i,l.xK.set_editor_temp(i,e.editor_id),function(){l.xK.delete_editor_temp(e.editor_id),i.destroy()}},[]),r.createElement("div",{ref:t,style:{height:"100%",width:"100%"}})}o.config.set("basePath","https://gcore.jsdelivr.net/npm/ace-builds@".concat(o.version,"/src-min-noconflict/")),o.config.set("modePath","https://gcore.jsdelivr.net/npm/ace-builds@".concat(o.version,"/src-min-noconflict/")),o.config.set("themePath","https://gcore.jsdelivr.net/npm/ace-builds@".concat(o.version,"/src-min-noconflict/")),o.config.set("workerPath","https://gcore.jsdelivr.net/npm/ace-builds@".concat(o.version,"/src-min-noconflict/"))},7181:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var r=n(6540),o=n(5997),i=n(7952),c=n(7444),a=n(6417),u=n(8247),l=n(4091),f=n(4289);function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof a?r:a,l=Object.create(u.prototype);return p(l,"_invoke",function(n,r,o){var i,a,u,l=0,f=o||[],s=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,c}};function d(n,r){for(a=n,u=r,t=0;!s&&l&&!o&&t<f.length;t++){var o,i=f[t],d=p.p,y=i[2];n>3?(o=y===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,p.v=r,p.n=i[1]):d<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,a=0))}if(o||n>1)return c;throw s=!0,r}return function(o,f,y){if(l>1)throw TypeError("Generator is already running");for(s&&1===f&&d(f,y),a=f,u=y;(t=a<2?e:u)||!s;){i||(a?a<3?(a>1&&(p.n=-1),d(a,u)):p.n=u:p.v=u);try{if(l=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(s=p.n<0)?u:n.call(r,p))!==c)break}catch(t){i=e,a=1,u=t}finally{l=1}}return{value:t,done:s}}}(n,o,i),!0),l}var c={};function a(){}function u(){}function l(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=l.prototype=a.prototype=Object.create(f);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,p(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=l,p(d,"constructor",l),p(l,"constructor",u),u.displayName="GeneratorFunction",p(l,o,"GeneratorFunction"),p(d),p(d,o,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:y}})()}function p(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,t,n,r){function i(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},p(e,t,n,r)}function d(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,c,a=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(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 m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(){var e=y((0,c.L4)(a.A.editorSetting),2),t=e[0],n=e[1],p=y((0,r.useState)(!1),2),m=p[0],v=p[1],h=y((0,c.L4)(a.A.fileShellShow),2),b=h[0],g=h[1],w=y((0,c.L4)(a.A.file_shell_hidden),2),_=w[0],j=w[1];function O(){return S.apply(this,arguments)}function S(){var e;return e=s().m(function e(){return s().w(function(e){for(;;)switch(e.n){case 0:if(!t.save||!m){e.n=2;break}return e.n=1,t.save(u.xK.get_editor_value());case 1:u.xK.set_value_temp(""),v(!1);case 2:return e.a(2)}},e)}),S=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){d(i,r,o,c,a,"next",e)}function a(e){d(i,r,o,c,a,"throw",e)}c(void 0)})},S.apply(this,arguments)}var A=function(e){e.ctrlKey&&"s"===e.key&&(e.preventDefault(),t.save&&m&&O())};(0,r.useEffect)(function(){return function(){v(!1)}},[t]),(0,r.useEffect)(function(){return document.addEventListener("keydown",A),function(){document.removeEventListener("keydown",A)}},[m,t]);var P=r.createElement("div",{id:"editor-container"},r.createElement(i.A,{ignore_tags:!0,left_children:[r.createElement(o.rA,{key:1,title:"取消",icon:"close",onClick:function(){u.xK.set_value_temp(""),n({open:!1,model:"",fileName:"",save:null})}}),r.createElement("title",{key:2},t.fileName)]},t.menu_list&&t.menu_list,t.opt_shell&&r.createElement(o.rA,{icon:"terminal",title:"shell",onClick:function(){b.show?j(!_):g({show:!0,path:(0,f.GG)("file",(0,f.vX)())})}}),m&&r.createElement(o.rA,{title:"保存",icon:"save",onClick:O})),r.createElement(l.default,{name:t.fileName,model:t.model,on_change:function(){m||v(!0)}}));return t.open&&P}}}]);