filecat 1.0.27 → 1.0.28
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.
package/build/dist/502.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 502.bundle.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[502],{2502:(t,e,r)=>{r.r(e),r.d(e,{default:()=>O});var n=r(6540),o=r(4238),i=r(4944),a=r(7444),c=r(6417),u=r(7952),l=r(5997),s=r(7022),f=r(4289),h=r(2042),p=r(3033),v=r(2389),y=r(4694);function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function g(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function m(){m=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,a=Object.create(i.prototype),c=new C(n||[]);return o(a,"_invoke",{value:T(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",v="executing",y="completed",g={};function w(){}function x(){}function b(){}var _={};l(_,a,(function(){return this}));var E=Object.getPrototypeOf,k=E&&E(E(N([])));k&&k!==r&&n.call(k,a)&&(_=k);var L=b.prototype=w.prototype=Object.create(_);function S(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==d(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,r,n){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(d(e)+" is not iterable")}return x.prototype=b,o(L,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:x,configurable:!0}),x.displayName=l(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},S(A.prototype),l(A.prototype,c,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function w(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function x(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){w(i,n,o,a,c,"next",t)}function c(t){w(i,n,o,a,c,"throw",t)}a(void 0)}))}}function b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||_(t,e)||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 _(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var k,L=300,S=!1,A=0,T=!0,j=[];function O(t){var e=b((0,a.L4)(c.A.log_viewer),2),r=e[0],d=e[1],w=(0,n.useRef)(null),_=b((0,n.useState)(0),2),E=_[0],O=_[1],I=b((0,n.useState)(100),2),C=I[0],N=I[1],G=b((0,n.useState)(!1),2),P=G[0],H=G[1],z=(0,v.Bd)().t,M=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0,i=document.createElement("div");return i.textContent=t,i.style.whiteSpace="pre-wrap",i.style.overflowWrap="break-word",i.setAttribute("position","".concat(e)),i.setAttribute("start_position","".concat(r)),n?(w.current.insertBefore(i,o),j.unshift(i)):(w.current.appendChild(i),j.push(i)),i},F=function(t){var e=(0,y.I)(j,(function(e){return e===t}));e&&w.current.removeChild(e)},Y=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t){var o=Array.isArray(t)?t:t.split("\n");if(n){for(var i,a=0;a<o.length;a++)i=M(o[a],e[a],r[a],!0,0===a?w.current.firstChild:i);if(j.length>L)for(var c=j.length-1;c>=L;)F(j[j.length-1]),c--}else{for(var u=0;u<o.length;u++)M(o[u],e[u],r[u]);if(j.length>L)for(var l=j.length-L;l>0;)F(j[0]),l--}}},D=function(){var t=x(m().mark((function t(){var e,r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return k.context="",t.next=3,i.ws.sendData(o.HK.log_viewer,k);case 3:(e=t.sent)&&(r=e.context,k=r,Y(r.context_list,r.context_position_list,r.context_start_position_list,k.back),k.context_list.length>0&&(k.back&&j.length>0?(k.context_list.length>j.length?O(Math.floor(100*parseInt(j[k.context_list.length-j.length].getAttribute("position"))/k.max_size)):O(Math.floor(100*parseInt(j[j.length-k.context_list.length].getAttribute("position"))/k.max_size)),T=!1):O(Math.floor(100*(null!==(n=k.context_position_list[k.context_position_list.length-1])&&void 0!==n?n:0)/k.max_size))),w.current.clientHeight===w.current.scrollHeight&&K(0));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),K=function(t){S||(S=!0,O(100),i.ws.addMsg(o.HK.log_viewer_watch,(function(t){var e=t.context;e&&(k=e,Y(e.context_list,e.context_position_list,e.context_start_position_list,!1),w.current.scrollTop=w.current.scrollHeight)})),k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.position=t,i.ws.sendData(o.HK.log_viewer_watch,k),H(!0))},B=function(){var t=x(m().mark((function t(){var e,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){var t=x(m().mark((function t(){var e,r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=w.current)){t.next=38;break}if(A>e.scrollTop&&S&&(S=!1,i.ws.unConnect(),H(!1)),!S){t.next=6;break}return A=e.scrollTop,t.abrupt("return");case 6:if(!(A<e.scrollTop&&j.length>0&&e.scrollTop+e.clientHeight+500>=e.scrollHeight)){t.next=22;break}if(!((r=parseInt(j[j.length-1].getAttribute("position")))>=k.max_size)){t.next=11;break}return K(r),t.abrupt("return");case 11:return k.line=20,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!1,k.position=r,t.next=20,D();case 20:t.next=37;break;case 22:if(!(A>e.scrollTop&&j.length>0&&e.scrollTop-300<=0)){t.next=37;break}if(!((n=parseInt(j[0].getAttribute("start_position")))<=0)){t.next=28;break}return T||(T=!0,(0,h.N9)("到达顶部")),A=e.scrollTop,t.abrupt("return");case 28:return k.line=10,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!0,k.position=n,t.next=37,D();case 37:A=e.scrollTop;case 38:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),w.current.addEventListener("scroll",e),n=function(t){var e=w.current;e&&(t.preventDefault(),t.deltaY>0?e.scrollTop+=20:e.scrollTop-=20)},w.current.addEventListener("wheel",n,{passive:!1}),H(!1),S=!1,A=0,j=[],(k=new s.d2).line=L,k.path="".concat((0,f.GG)("file",location.pathname)).concat(r.fileName),k.token=localStorage.getItem("token"),t.next=14,D();case 14:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),$=function(){var t=x(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return w.current&&w.current.remove(),t.next=3,i.ws.unConnect();case 3:j=[];case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();if((0,n.useEffect)((function(){r.show?B():$()}),[r]),(0,n.useEffect)((function(){return function(){$()}}),[]),r.show){var R=function(){var t=x(m().mark((function t(){var e,r,n,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(k.line=L,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],e=0,t.prev=6,!((e=parseInt(C))>100||e<0)){t.next=11;break}throw(0,h.zN)("范围在0-100"),"超过最大范围";case 11:r=g(j);try{for(r.s();!(n=r.n()).done;)o=n.value,w.current.removeChild(o)}catch(t){r.e(t)}finally{r.f()}j=[],t.next=20;break;case 16:return t.prev=16,t.t0=t.catch(6),(0,h.N9)(t.t0),t.abrupt("return");case 20:return k.back=e>=100,k.position=Math.floor(k.max_size*(e/100)),t.next=24,D();case 24:case"end":return t.stop()}}),t,null,[[6,16]])})));return function(){return t.apply(this,arguments)}}();return n.createElement("div",{id:"editor-container"},n.createElement(u.A,{ignore_tags:!0,left_children:[n.createElement(l.rA,{key:1,title:"取消",icon:"close",onClick:function(){d({show:!1})}}),n.createElement("title",{key:2},r.fileName,n.createElement("span",null,"加载完成"))]},P&&n.createElement("span",{style:{color:"var(--icon-green)",whiteSpace:"pre"}},"正在实时监听 "),n.createElement("span",null,"当前加载进度",E),n.createElement(p.$Z,{max_width:"10rem",placeholder:z("跳转进度"),icon:"percent",value:C,handleInputChange:function(t){N(t)}}),n.createElement(l.rA,{icon:"play_arrow",title:z("跳转进度"),onClick:R})),n.createElement("div",{style:{height:"100%"}},n.createElement("div",{ref:w,style:{overflowY:"auto",height:"100%"}})))}}}}]);
|
|
2
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[502],{2502:(t,e,r)=>{r.r(e),r.d(e,{default:()=>O});var n=r(6540),o=r(4238),i=r(4944),a=r(7444),c=r(6417),u=r(7952),l=r(5997),s=r(7022),f=r(4289),h=r(2042),p=r(3033),v=r(2389),y=r(4694);function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function g(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=b(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function m(){m=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof x?e:x,a=Object.create(i.prototype),c=new C(n||[]);return o(a,"_invoke",{value:T(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",v="executing",y="completed",g={};function x(){}function w(){}function _(){}var b={};l(b,a,(function(){return this}));var k=Object.getPrototypeOf,E=k&&k(k(N([])));E&&E!==r&&n.call(E,a)&&(b=E);var L=_.prototype=x.prototype=Object.create(b);function S(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==d(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,r,n){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(d(e)+" is not iterable")}return w.prototype=_,o(L,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},S(A.prototype),l(A.prototype,c,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(L),l(L,u,"Generator"),l(L,a,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function x(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function w(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){x(i,n,o,a,c,"next",t)}function c(t){x(i,n,o,a,c,"throw",t)}a(void 0)}))}}function _(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||b(t,e)||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 b(t,e){if(t){if("string"==typeof t)return k(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var E,L=300,S=!1,A=0,T=!0,j=[];function O(t){var e=_((0,a.L4)(c.A.log_viewer),2),r=e[0],d=e[1],x=(0,n.useRef)(null),b=_((0,n.useState)(0),2),k=b[0],O=b[1],I=_((0,n.useState)(100),2),C=I[0],N=I[1],G=_((0,n.useState)(!1),2),z=G[0],H=G[1],P=(0,v.Bd)().t,M=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0,i=document.createElement("div");return i.textContent=t,i.style.whiteSpace="pre-wrap",i.style.overflowWrap="break-word",i.setAttribute("position","".concat(e)),i.setAttribute("start_position","".concat(r)),n?(x.current.insertBefore(i,o),j.unshift(i)):(x.current.appendChild(i),j.push(i)),i},F=function(t){var e=(0,y.I)(j,(function(e){return e===t}));e&&x.current.removeChild(e)},Y=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t){var o=Array.isArray(t)?t:t.split("\n");if(n){for(var i,a=0;a<o.length;a++)i=M(o[a],e[a],r[a],!0,0===a?x.current.firstChild:i);if(j.length>L)for(var c=j.length-1;c>=L;)F(j[j.length-1]),c--}else{for(var u=0;u<o.length;u++)M(o[u],e[u],r[u]);if(j.length>L)for(var l=j.length-L;l>0;)F(j[0]),l--}}},D=function(){var t=w(m().mark((function t(){var e,r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E.context="",t.next=3,i.ws.sendData(o.HK.log_viewer,E);case 3:(e=t.sent)&&(r=e.context,E=r,Y(r.context_list,r.context_position_list,r.context_start_position_list,E.back),E.context_list.length>0&&(E.back&&j.length>0?(E.context_list.length>j.length?O(Math.floor(100*parseInt(j[E.context_list.length-j.length].getAttribute("position"))/E.max_size)):O(Math.floor(100*parseInt(j[j.length-E.context_list.length].getAttribute("position"))/E.max_size)),T=!1):O(Math.floor(100*(null!==(n=E.context_position_list[E.context_position_list.length-1])&&void 0!==n?n:0)/E.max_size))),x.current.clientHeight===x.current.scrollHeight&&K(E.max_size));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),K=function(t){S||(S=!0,O(100),i.ws.addMsg(o.HK.log_viewer_watch,(function(t){var e=t.context;e&&(E=e,Y(e.context_list,e.context_position_list,e.context_start_position_list,!1),x.current.scrollTop=x.current.scrollHeight)})),E.context="",E.context_list=[],E.context_position_list=[],E.context_start_position_list=[],E.position=t,i.ws.sendData(o.HK.log_viewer_watch,E),H(!0))},B=function(){var t=w(m().mark((function t(){var e,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){var t=w(m().mark((function t(){var e,r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=x.current)){t.next=38;break}if(A>e.scrollTop&&S&&(S=!1,i.ws.unConnect(),H(!1)),!S){t.next=6;break}return A=e.scrollTop,t.abrupt("return");case 6:if(!(A<e.scrollTop&&j.length>0&&e.scrollTop+e.clientHeight+500>=e.scrollHeight)){t.next=22;break}if(!((r=parseInt(j[j.length-1].getAttribute("position")))>=E.max_size)){t.next=11;break}return K(r),t.abrupt("return");case 11:return E.line=20,E.context="",E.context_list=[],E.context_position_list=[],E.context_start_position_list=[],E.back=!1,E.position=r,t.next=20,D();case 20:t.next=37;break;case 22:if(!(A>e.scrollTop&&j.length>0&&e.scrollTop-300<=0)){t.next=37;break}if(!((n=parseInt(j[0].getAttribute("start_position")))<=0)){t.next=28;break}return T||(T=!0,(0,h.N9)("到达顶部")),A=e.scrollTop,t.abrupt("return");case 28:return E.line=10,E.context="",E.context_list=[],E.context_position_list=[],E.context_start_position_list=[],E.back=!0,E.position=n,t.next=37,D();case 37:A=e.scrollTop;case 38:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),x.current.addEventListener("scroll",e),n=function(t){var e=x.current;e&&(t.preventDefault(),t.deltaY>0?e.scrollTop+=20:e.scrollTop-=20)},x.current.addEventListener("wheel",n,{passive:!1}),H(!1),S=!1,A=0,j=[],(E=new s.d2).line=L,E.path="".concat((0,f.GG)("file",location.pathname)).concat(r.fileName),E.token=localStorage.getItem("token"),t.next=14,D();case 14:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),$=function(){var t=w(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return x.current&&x.current.remove(),t.next=3,i.ws.unConnect();case 3:j=[];case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();if((0,n.useEffect)((function(){r.show?B():$()}),[r]),(0,n.useEffect)((function(){return function(){$()}}),[]),r.show){var R=function(){var t=w(m().mark((function t(){var e,r,n,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(E.line=L,E.context="",E.context_list=[],E.context_position_list=[],E.context_start_position_list=[],e=0,t.prev=6,!((e=parseInt(C))>100||e<0)){t.next=11;break}throw(0,h.zN)("范围在0-100"),"超过最大范围";case 11:r=g(j);try{for(r.s();!(n=r.n()).done;)o=n.value,x.current.removeChild(o)}catch(t){r.e(t)}finally{r.f()}j=[],t.next=20;break;case 16:return t.prev=16,t.t0=t.catch(6),(0,h.N9)(t.t0),t.abrupt("return");case 20:return E.back=e>=100,E.position=Math.floor(E.max_size*(e/100)),t.next=24,D();case 24:case"end":return t.stop()}}),t,null,[[6,16]])})));return function(){return t.apply(this,arguments)}}(),U=function(){var t=w(m().mark((function t(){var e,r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!S){t.next=2;break}return t.abrupt("return");case 2:E.line=L,E.context="",E.context_list=[],E.context_position_list=[],E.context_start_position_list=[],e=g(j);try{for(e.s();!(r=e.n()).done;)n=r.value,x.current.removeChild(n)}catch(t){e.e(t)}finally{e.f()}return j=[],E.back=!0,E.position=E.max_size,t.next=14,D();case 14:x.current.scrollTop=x.current.scrollHeight,K(E.max_size);case 16:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return n.createElement("div",{id:"editor-container"},n.createElement(u.A,{ignore_tags:!0,left_children:[n.createElement(l.rA,{key:1,title:"取消",icon:"close",onClick:function(){d({show:!1})}}),n.createElement("title",{key:2},r.fileName,n.createElement("span",null,"加载完成"))]},z&&n.createElement("span",{style:{color:"var(--icon-green)",whiteSpace:"pre"}},"正在实时监听 "),n.createElement("span",null,"当前加载进度",k),n.createElement(p.$Z,{max_width:"10rem",placeholder:P("跳转进度"),icon:"percent",value:C,handleInputChange:function(t){N(t)}}),n.createElement(l.rA,{icon:"play_arrow",title:P("跳转进度"),onClick:R}),n.createElement(l.rA,{icon:"text_rotate_vertical",title:P("滑动到文件最底部,实时输出"),onClick:U})),n.createElement("div",{style:{height:"100%"}},n.createElement("div",{ref:x,style:{overflowY:"auto",height:"100%"}})))}}}}]);
|