UNPKG

@calvin_von/proxy-plugin-monitor

Version:
1 lines 31.4 kB
(function(t){function e(e){for(var n,r,o=e[0],l=e[1],c=e[2],u=0,p=[];u<o.length;u++)r=o[u],Object.prototype.hasOwnProperty.call(i,r)&&i[r]&&p.push(i[r][0]),i[r]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(t[n]=l[n]);d&&d(e);while(p.length)p.shift()();return s.push.apply(s,c||[]),a()}function a(){for(var t,e=0;e<s.length;e++){for(var a=s[e],n=!0,o=1;o<a.length;o++){var l=a[o];0!==i[l]&&(n=!1)}n&&(s.splice(e--,1),t=r(r.s=a[0]))}return t}var n={},i={app:0},s=[];function r(e){if(n[e])return n[e].exports;var a=n[e]={i:e,l:!1,exports:{}};return t[e].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=t,r.c=n,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/";var o=window["webpackJsonp"]=window["webpackJsonp"]||[],l=o.push.bind(o);o.push=e,o=o.slice();for(var c=0;c<o.length;c++)e(o[c]);var d=l;s.push([0,"chunk-vendors"]),a()})({0:function(t,e,a){t.exports=a("56d7")},"0312":function(t,e,a){},"1dcf":function(t,e,a){"use strict";a("2aa7")},"1ef2":function(t,e,a){"use strict";a("0312")},"2a57":function(t,e,a){"use strict";a("ebba")},"2aa7":function(t,e,a){},"4b08":function(t,e,a){"use strict";a("cfe5")},"4d62":function(t,e,a){t.exports=function(){return new Worker(a.p+"26454df8cfba67574235.worker.js")}},"56d7":function(t,e,a){"use strict";a.r(e);a("cadf"),a("551c"),a("f751"),a("097d");var n=a("2b0e"),i=function(){var t=this,e=t._self._c;return e("monitor")},s=[],r=a("677e"),o=a.n(r),l=(a("a481"),a("7f7f"),function(){var t=this,e=t._self._c;return e("div",{staticClass:"monitor"},[e("div",{staticClass:"monitor-header"},[e("div",{staticClass:"flex flex-item-center flex-content-between"},[e("div",[e("h3",[t._v("Request Monitor")]),t._v("\n Proxy server running on the "),e("a",{attrs:{href:t.serverAddress}},[t._v(t._s(t.serverAddress))])]),e("status",{attrs:{status:t.ws_connected},on:{connect:t.connect}})],1),e("div",{staticClass:"request-filter flex flex-content-between"},[e("a-input",{staticClass:"textFilter",attrs:{placeholder:"Filter ( Regular Expression supported )"},model:{value:t.textFilter,callback:function(e){t.textFilter=e},expression:"textFilter"}}),e("button",{staticClass:"btn-clear",on:{click:t.clearAllData}},[t._v("Clear Requests")])],1),e("div",{staticClass:"request-filter flex"},[e("div",{staticClass:"filters flex flex-wrap"},[e("filter-tab",{attrs:{label:"Content",filters:t.TYPE_FILTERS.map((function(t){return t.name}))},on:{active:t.typeFilterChange}}),e("filter-tab",{attrs:{label:"Status",filters:t.STATUS_FILTERS,multiple:""},on:{active:t.statusFilterChange}}),e("filter-tab",{attrs:{label:"Cached",filters:t.CACHE_FILTERS.map((function(t){return t.name}))},on:{active:t.cacheFilterChange}})],1)])]),e("div",{staticClass:"monitor-content flex"},[e("a-table",{attrs:{columns:t.columns,dataSource:t.filteredData,pagination:!1,rowClassName:t.rowClassName,customRow:t.customRow,rowKey:"id",bordered:""},scopedSlots:t._u([{key:"Method",fn:function(e,a){return[t._v("\n "+t._s(a["General"]["Method"])+"\n ")]}},{key:"Name",fn:function(a,n){return e("div",{},[e("p",[t._v("\n "+t._s(a.suffix)+"\n "),"hitCache"===n.type?[e("span",{staticClass:"cell-status-hitCache"},[t._v("Hit Cache")])]:t._e()],2),e("span",{staticClass:"text-light"},[t._v(t._s(a.prefix))])])}},{key:"Status",fn:function(a){return[t.is(a,"String")?[t._v("\n "+t._s(a)+"\n ")]:e("div",[e("p",[t._v(t._s(a.code))]),e("span",{staticClass:"text-light"},[t._v(t._s(a.message))])])]}},{key:"Type",fn:function(a,n){return e("div",{},[n["Response Headers"]?[t._v("\n "+t._s(n["Response Headers"]["content-type"])+"\n ")]:[t._v("\n "+t._s((n["Request Headers"]["content-type"]||"").replace(/;\s?boundary=\S+/,""))+"\n ")]],2)}},{key:"Size",fn:function(e,a){return[a["Response Headers"]?[t._v("\n "+t._s(t._f("unitFormat")(a.data.response&&a.data.response.size||0,"size"))+"\n ")]:t._e()]}},{key:"Time",fn:function(e){return[t._v("\n "+t._s(t._f("unitFormat")(e,"time"))+"\n ")]}},{key:"Hit Cache",fn:function(e){return[t._v("\n "+t._s(t._f("whetherHitCache")(e))+"\n ")]}}])}),t.detail.id?e("div",{staticClass:"monitor-detail-wrapper"},[e("detail",{attrs:{detail:t.detail},on:{close:function(e){t.detail={}}}})],1):t._e()],1),e("div",{staticClass:"monitor-footer"},[t._v("\n "+t._s(t.filteredData.length)+" / "+t._s(t.monitorData.length)+" requests\n "),e("div",{staticClass:"divider"}),t._v("\n "+t._s(t._f("unitFormat")(t.filteredDataSize,"size"))+" / "+t._s(t._f("unitFormat")(t.allDataSize,"size"))+" transferred\n "),e("div",{staticClass:"divider"}),t._v("\n Timing "+t._s(t._f("unitFormat")(t.allDataTime,"time"))+"\n\n "),t._m(0)])])}),c=[function(){var t=this,e=t._self._c;return e("span",{staticClass:"float-right"},[e("span",[t._v("@calvin_von/proxy-plugin-monitor ")]),e("a",{attrs:{href:"https://github.com/CalvinVon/dalao-proxy/tree/master/packages/%40calvin_von/proxy-plugin-monitor"}},[t._v("Github")])])}],d=(a("8e6e"),a("456d"),a("7618")),u=(a("0d6d"),a("75fc")),p=(a("6b54"),a("ac6a"),a("3b2b"),a("bd86")),f=(a("dc5a"),a("56cd")),h=a("d225"),v=a("b0b4"),m="production",b=function(){function t(){Object(h["a"])(this,t),Object(p["a"])(this,"ws",void 0),Object(p["a"])(this,"ws_connected",void 0),Object(p["a"])(this,"eventEmitter",void 0),Object(p["a"])(this,"onMessageListeners",void 0),Object(p["a"])(this,"onCloseListeners",void 0),Object(p["a"])(this,"onOpenListeners",void 0),this.eventEmitter=new n["default"]}return Object(v["a"])(t,[{key:"connect",value:function(){var t=this;this.ws_connected="Connecting",this.ws&&this.ws.close();var e="ws://"+window.location.host+"/ws";"production"!==m&&(e="ws://localhost:40001/ws");var a=this.ws=new WebSocket(e);a.onopen=function(){t.ws_connected="Connected",t.eventEmitter.$emit("onOpen")},a.onclose=function(e){t.ws_connected="Disconnected",t.eventEmitter.$emit("onClose"),f["a"].open({key:"onclose",message:"Connection closed.",description:"The connection to the server has been disconnected, check if dalao-proxy still running",onClick:function(){f["a"].close("onclose")}})},a.onmessage=function(e){t.eventEmitter.$emit("onMessage",e.data)}}},{key:"listen",value:function(t,e,a,i){if(a&&a instanceof n["default"]){var s=a.$destroy;a.$destroy=function(){this.eventEmitter.$off(t,e),s.call(this)}}this.eventEmitter[i?"$once":"$on"](t,e)}},{key:"send",value:function(t){var e=this,a=Math.random().toString(16).substr(2)+Date.now();return t.id=a,this.ws.send(JSON.stringify(t)),new Promise((function(t){var n=function(i){var s=JSON.parse(i),r=s.type,o=s.id;"response"===r&&o===a&&(t(s),e.eventEmitter.$off("onMessage",n))};e.listen("onMessage",n)}))}}])}(),_=new b,g=function(){var t=this,e=t._self._c;return e("div",{staticClass:"connection-status"},["Connected"===t.status?[e("span",{staticClass:"label-connected"},[t._v("Connected")])]:"Connecting"===t.status?[e("a-spin",[e("a-icon",{staticStyle:{"font-size":"12px",color:"#FF9800"},attrs:{slot:"indicator",type:"loading",spin:""},slot:"indicator"})],1),e("span",{staticClass:"label-connecting"},[t._v("Connecting...")])]:"Disconnected"===t.status?[e("span",{staticClass:"label-disconnected"},[t._v("Disconnected")]),e("button",{staticClass:"connect-button",attrs:{type:"button"},on:{click:t.connect}},[t._v("Connect")])]:t._e()],2)},w=[],y={name:"monitor-status",props:{status:String},methods:{connect:function(){this.$emit("connect")}}},x=y,C=(a("1ef2"),a("2877")),O=Object(C["a"])(x,g,w,!1,null,null,null),P=O.exports,k=function(){var t=this,e=t._self._c;return e("div",{staticClass:"filter-tab",class:{multiple:t.multiple}},[e("span",{staticClass:"tab-label"},[t._v(t._s(t.label))]),t._l(t.filters,(function(a,n){return e("span",{key:a,staticClass:"tab",class:{active:t.contidition(n)},on:{click:function(e){return t.activeFilter(n)}}},[t._v(t._s(a))])}))],2)},j=[],D=(a("6c7b"),{name:"filter-tab",props:{label:String,filters:Array,multiple:Boolean},data:function(){return{index:0,activeIndexs:new Array(this.filters.length)}},watch:{filters:function(){this.activeIndexs=new Array(this.filters.length),this.activeIndexs[0]=!0}},created:function(){this.activeIndexs[0]=!0},methods:{contidition:function(t){return this.multiple?this.activeIndexs[t]:this.index===t},activeFilter:function(t){var e=this;if(this.multiple){var a=this.activeIndexs[0],n=this.activeIndexs[t];0===t?a||(this.activeIndexs=[!0].concat(new Array(this.filters.length-1).fill(!1))):n?this.activeIndexs.filter((function(t){return t})).length>1&&this.$set(this.activeIndexs,t,!n):(this.$set(this.activeIndexs,t,!n),this.activeIndexs[0]=!1),this.$emit("active",this.activeIndexs.map((function(t,a){return t?e.filters[a]:null})).filter((function(t){return t})))}else this.index=t,this.$emit("active",this.filters[t],t)}}}),F=D,R=(a("c24b"),Object(C["a"])(F,k,j,!1,null,null,null)),S=R.exports,T=(a("4917"),function(){var t=this,e=t._self._c;return e("div",{staticClass:"monitor-detail"},[e("a-tabs",{model:{value:t.activeTab,callback:function(e){t.activeTab=e},expression:"activeTab"}},[e("a-tab-pane",{key:"1",staticClass:"pane-header",attrs:{tab:"Headers"}},[e("detail-block",{attrs:{name:"General",detail:t.detail},on:{"change-tab":function(e){return t.activeTab=e}}}),e("detail-block",{attrs:{name:"Response Headers",detail:t.detail}}),e("detail-block",{attrs:{name:"Request Headers",detail:t.detail}}),t.detail["Query String Parameters"]?e("detail-block",{attrs:{name:"Query String Parameters",showParsedField:"",detail:t.detail}}):t._e(),t.detail["Request Payload"]?e("detail-block",{attrs:{name:"Request Payload",showParsedField:"",detail:t.detail}}):t._e(),t.detail["Form Data"]?e("detail-block",{attrs:{name:"Form Data",alias:"Form Data",showParsedField:"",showDownloadField:"",detail:t.detail}}):t._e()],1),e("a-tab-pane",{key:"2",staticClass:"pane-preview",attrs:{tab:"Proxy"}},[e("detail-block",{attrs:{name:"Proxy",detail:t.detail}}),t.isCached?e("detail-block",{attrs:{name:"Cache",alias:"Cache Info",detail:t.detail}}):t._e(),t.detail["Proxy Response Headers"]?e("detail-block",{attrs:{name:"Proxy Response Headers",alias:"Response Headers",detail:t.detail}}):t._e(),t.detail["Proxy Request Headers"]?e("detail-block",{attrs:{name:"Proxy Request Headers",alias:"Request Headers",detail:t.detail}}):t._e(),t.detail["Proxy Query String Parameters"]?e("detail-block",{attrs:{name:"Proxy Query String Parameters",alias:"Query String Parameters",showParsedField:"",detail:t.detail}}):t._e(),t.detail["Proxy Request Payload"]?e("detail-block",{attrs:{name:"Proxy Request Payload",alias:"Request Payload",showParsedField:"",detail:t.detail}}):t._e(),t.detail["Form Data"]?e("detail-block",{attrs:{name:"Proxy Form Data",alias:"Form Data",showParsedField:"",detail:t.detail}}):t._e(),t.detail["Proxy Response"]?e("detail-block",{attrs:{name:"Proxy Response",useRawDataViewer:"",detail:t.detail}}):t._e()],1),t.isPending||t.isResponded||t.isError||t.canPreview?e("a-tab-pane",{key:"3",staticClass:"pane-preview",attrs:{tab:"Preview"}},[t.isPending?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Preview not available")]),e("p",[t._v("Request not finished yet.")])])]:t.isResponded?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Preview not available")]),e("p",[t._v("Server responded, but not all response data received.")])])]:t.isError?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Preview not available")]),e("p",[t._v(t._s(t.detail["General"]["Method"])+" "),e("a",{attrs:{href:"http://".concat(t.isError.address,":").concat(t.isError.port)}},[t._v(t._s(t.isError.address)+":"+t._s(t.isError.port))]),t._v(" failed with code "+t._s(t.isError.code)+".")])])]:[t.detail.data.response&&t.detail.data.response.type.match(/json/)?[e("json-viewer",{attrs:{data:t.detail.data.response.data,deep:3,highlightMouseoverNode:"",showLength:""}})]:[e("code-viewer",{attrs:{data:t.detail.data.response}})]]],2):t._e(),e("a-tab-pane",{key:"4",staticClass:"pane-response",attrs:{tab:"Response"}},[t.isPending?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Response not available")]),e("p",[t._v("Request not finished yet.")])])]:t.isResponded?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Response not available")]),e("p",[t._v("Server responded, but not all response data received.")])])]:t.isError?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Response not available")]),e("p",[t._v(t._s(t.detail["General"]["Method"])+" "),e("a",{attrs:{href:"http://".concat(t.isError.address,":").concat(t.isError.port)}},[t._v(t._s(t.isError.address)+":"+t._s(t.isError.port))]),t._v(" failed with code "+t._s(t.isError.code)+".")])])]:t.is_304?[e("div",{staticClass:"not-available flex flex-center flex-column"},[e("h3",[t._v("Response is empty")]),e("p",[t._v("Response status is "+t._s(t.detail["General"]["Status Code"])+", no response message returned.")])])]:[e("raw-data-viewer",{attrs:{data:t.detail.data.response}})]],2)],1),e("div",{staticClass:"close",on:{click:function(e){return t.$emit("close")}}})],1)}),E=[],I=function(){var t=this,e=t._self._c;return e("div",{staticClass:"monitor-detail-block"},[e("h3",{staticClass:"block-title",class:{folded:t.folded},on:{click:function(e){t.folded=!t.folded}}},[t._v("\n "+t._s(t.alias||t.name)+"\n "),t.showParsedField?[e("span",{staticClass:"title-append",on:{click:function(e){return e.stopPropagation(),t.handleToggleParsed.apply(null,arguments)}}},[t._v("show "+t._s(t.toggleParsed?"raw":"parsed"))])]:t._e()],2),t.folded?t._e():e("div",{staticClass:"block-content"},[t.useRawDataViewer?[e("RawDataViewer",{attrs:{data:t.detail[t.name]}})]:[t.showParsedField&&t.toggleParsed||!t.showParsedField?t._l(Object.keys(t.targetValue||{}),(function(a){return e("p",{key:a,staticClass:"content-pair"},["rawBuffer"==a?void 0:Array.isArray(t.targetValue[a])?t._l(t.targetValue[a],(function(n){return e("p",{key:n,staticClass:"content-pair same-pair"},[e("span",{staticClass:"pair-key"},[t._v(t._s(a))]),e("code",{staticClass:"pair-value"},[t._v(t._s(n))])])})):[e("span",{staticClass:"pair-key"},[t._v(t._s(a))]),t.isCached&&"Status Code"===a?[e("a-tooltip",{attrs:{placement:"top"}},[e("code",{staticClass:"pair-value"},[t._v(t._s(t.targetValue[a]))]),e("template",{slot:"title"},[e("p",{staticClass:"cache-tooltip"},[e("span",[t._v("\n Response is cached\n ")])])])],2),e("a-button",{on:{click:function(e){return t.$emit("change-tab","2")}}},[t._v("Open in cache tab\n "),e("a-icon",{attrs:{type:"link"}})],1)]:[e("code",{staticClass:"pair-value"},[t.isCached&&a.match(/^(x-cache-)?file$/)?[e("a-tooltip",{attrs:{placement:"top"}},[e("span",{staticClass:"file-path"},[t._v(t._s(decodeURIComponent(t.targetValue[a])))]),e("a-icon",{attrs:{type:"link"},on:{click:function(e){return t.handleOpenFile(t.targetValue[a])}}}),e("template",{slot:"title"},[e("span",[t._v("Open file in editor")])])],2)]:t.showDownloadField&&t.targetValue[a].match(/^\<File: [^>]+>$/)?[e("a-tooltip",{attrs:{placement:"top"}},[t._v("\n "+t._s(t.targetValue[a])+"\n "),e("a-icon",{attrs:{type:"download"},on:{click:function(e){return t.handleDownloadFile(a)}}}),e("template",{slot:"title"},[e("span",[t._v("Download this file")])])],2)]:[t._v(t._s(t.targetValue[a]))]],2)]]],2)})):[e("pre",{staticClass:"content-raw"},[t._v(t._s(t.targetValue)),e("a-tooltip",{attrs:{placement:"top"}},[t._v("\n "),e("a-icon",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.targetValue,expression:"targetValue",arg:"copy"}],attrs:{type:"copy"}}),t._v("\n "),e("template",{slot:"title"},[t._v("\n "),e("span",[t._v("Copy it!")]),t._v("\n ")]),t._v("\n ")],2)],1)]]],2)])},M=[],L=(a("96cf"),a("3b8d")),H=(a("cd17"),a("ed3b")),z=a("b065"),$=a.n(z),V=function(){var t=this,e=t._self._c;return e("div",{staticClass:"file-path-selector"},[e("a-spin",{attrs:{spinning:t.loading}},[e("ul",[t.path?e("li",[e("div",{staticClass:"list-item folder-item",on:{click:function(e){return t.requestFileList(t.path,!0)}}},[e("a-icon",{attrs:{type:"left-circle"}}),e("span",{staticClass:"file-name"},[t._v(t._s(t.path))]),e("a-icon",{attrs:{type:"caret-right"}})],1)]):t._e(),t._l(t.list,(function(a){return e("li",{key:a.name+a.isDir},[a.isDir?e("div",{staticClass:"list-item folder-item",class:{"is-hide":/^\./.test(a.name)},on:{click:function(e){return t.requestFileList(a.name)}}},[e("a-icon",{attrs:{type:"folder",theme:"filled"}}),e("span",{staticClass:"file-name"},[t._v(t._s(a.name))]),e("a-icon",{attrs:{type:"caret-right"}})],1):e("div",{staticClass:"list-item file-item"},[e("a-icon",{attrs:{type:"file",theme:"filled"}}),e("span",{staticClass:"file-name"},[t._v(t._s(a.name))])],1)])}))],2)])],1)},q=[],A={name:"file-path-selector",data:function(){return{path:"",list:[],loading:!1}},created:function(){this.requestFileList()},methods:{requestFileList:function(){var t=Object(L["a"])(regeneratorRuntime.mark((function t(e,a){var n,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return this.loading=!0,t.next=3,_.send({type:"file-system",value:{path:this.path,isForward:a?!a:!!e||null,forwardDirname:e}});case 3:n=t.sent,i=n.value,this.loading=!1,this.path=i.path,this.list=i.list;case 8:case"end":return t.stop()}}),t,this)})));function e(e,a){return t.apply(this,arguments)}return e}()}},N=A,B=(a("e28e"),Object(C["a"])(N,V,q,!1,null,null,null)),G=B.exports,J=function(){var t=this,e=t._self._c;return e("code",{staticClass:"raw-data-viewer"},[t.data.type.match(/json/)?e("pre",{staticClass:"raw-data-json"},[t._v(t._s(t.data.rawData)),e("a-tooltip",{attrs:{placement:"top"}},[t._v("\n\t\t\t\t"),e("a-icon",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.data.rawData,expression:"data.rawData",arg:"copy"}],attrs:{type:"copy"}}),t._v("\n\t\t\t\t"),e("template",{slot:"title"},[t._v("\n\t\t\t\t\t"),e("span",[t._v("Copy it!")]),t._v("\n\t\t\t\t")]),t._v("\n\t\t\t")],2),t._v("\n\t\t")],1):e("div",{class:"raw-data-".concat(t.data.type)},[t._v(t._s(t.spittedData)),e("a-tooltip",{attrs:{placement:"top"}},[e("a-icon",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.data.rawData,expression:"data.rawData",arg:"copy"}],attrs:{type:"copy"}}),e("template",{slot:"title"},[e("span",[t._v("Copy it!")])])],2),t.data.rawData.length>t.maxLength?e("span",[t._v("\n ... "),e("span",{staticClass:"tip"},[t._v("total size "+t._s(t._f("unitFormat")(t.data.size,"size"))+" ")]),e("span",{staticClass:"tip cursor-pointer load-more",on:{click:function(e){t.maxLength+=3e3}}},[t._v("load more")])]):t._e()],1)])},U=[],Q={name:"RawDataViewer",props:{data:Object},data:function(){return{maxLength:2e3}},computed:{spittedData:function(){return this.data.rawData.substr(0,this.maxLength)}}},K=Q,W=(a("5b18"),Object(C["a"])(K,J,U,!1,null,null,null)),Y=W.exports;function X(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function Z(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?X(Object(a),!0).forEach((function(e){Object(p["a"])(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):X(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var tt={name:"FileSelectorDialog",props:Z(Z({},G.props),{},{onOk:Function}),data:function(){return{visible:!1}},render:function(t){var e=this;return t(H["a"],{props:{title:"Please select folder to save",width:"80%",visible:this.visible,wrapClassName:"file-selector-dialog",okText:"Select this folder"},on:{ok:function(){e.onOk(e.$refs.selector),e.visible=!1},cancel:function(){e.visible=!1}}},[t(G,{props:this.$props,ref:"selector"})])}},et={name:"monitor-detail-block",components:{RawDataViewer:Y},props:{detail:Object,name:String,alias:String,showParsedField:Boolean,showDownloadField:Boolean,useRawDataViewer:Boolean},data:function(){return{folded:!1,toggleParsed:!0,decodeURIComponent:decodeURIComponent.bind(window)}},computed:{targetValue:function(){if(this.showParsedField){var t=this.name+(this.toggleParsed?"[parsed]":"");return this.detail[t]}return this.detail[this.name]},isCached:function(){return"hitCache"===this.detail.type}},beforeDestroy:function(){this.mounter&&this.mounter.destroy()},methods:{handleToggleParsed:function(){this.toggleParsed=!this.toggleParsed},handleOpenFile:function(t){_.send({type:"action",action:"open-file",value:decodeURIComponent(t)})},handleDownloadFile:function(){var t=Object(L["a"])(regeneratorRuntime.mark((function t(e){var a=this;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:this.openPathSelector(function(){var t=Object(L["a"])(regeneratorRuntime.mark((function t(n){var i,s;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,_.send({type:"action",action:"download-file",value:{id:a.detail.id,field:e,savePath:n}});case 2:i=t.sent,s=i.error,s&&a.$notification.error({message:"Download file error",description:"Reason: "+s});case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 1:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}(),openPathSelector:function(t){var e={props:{onOk:function(e){var a=e.path;t&&t(a)}},data:{visible:!0}};if(this.mounter)this.mounter.set(e);else{var a=this.mounter=new $.a(tt,e);a.mount()}}}},at=et,nt=(a("4b08"),Object(C["a"])(at,I,M,!1,null,null,null)),it=nt.exports,st=function(){var t=this,e=t._self._c;return e("div",{staticClass:"code-viewer"},[t.loading||t.loadError?[e("div",{staticClass:"loading flex flex-item-center flex-content-center"},[t.loading?e("span",[t._v("Loading Preview...")]):e("div",{staticClass:"error-tip"},[e("h3",[t._v("Loading Preview Error")]),e("p",[t._v(t._s(t.loadError))])])])]:[e("code",[e("pre",{domProps:{innerHTML:t._s(t.spittedHTML)}})]),t.data.rawData.length>t.maxLength?e("span",[t._v("\n ... "),e("span",{staticClass:"tip"},[t._v("total size "+t._s(t._f("unitFormat")(t.data.size,"size"))+" ")]),e("span",{staticClass:"tip cursor-pointer load-more",on:{click:function(e){t.maxLength+=4e3}}},[t._v("load more")])]):t._e()]],2)},rt=[],ot=a("4d62"),lt=a.n(ot),ct=(a("2c43"),{name:"CodeViewer",props:{data:Object},data:function(){return{loading:!0,loadError:null,maxLength:4e3,parsedHTML:""}},computed:{spittedHTML:function(){return this.parsedHTML.substring(0,this.maxLength)}},watch:{data:function(){this.loadPreview()}},mounted:function(){this.loadPreview()},methods:{loadPreview:function(){var t=this,e=new lt.a;e.onmessage=function(e){t.loading=!1,t.parsedHTML=e.data},e.onerror=function(e){t.loading=!1,t.loadError=e.message},e.postMessage(this.data)}}}),dt=ct,ut=(a("1dcf"),Object(C["a"])(dt,st,rt,!1,null,null,null)),pt=ut.exports,ft={name:"monitor-detail",props:{detail:Object},data:function(){return{activeTab:"1"}},components:{DetailBlock:it,CodeViewer:pt,RawDataViewer:Y},computed:{isCached:function(){return!!this.detail.Cache},isPending:function(){return/pending/i.test(this.detail.status)},isResponded:function(){return/responded/i.test(this.detail.status)},isError:function(){return this.detail.data.error},is_304:function(){return 304===this.detail.status.code},canPreview:function(){return this.detail.data.response&&this.detail.data.response.type&&this.detail.data.response.type.match(/(json|javascript|html)/)}}},ht=ft,vt=(a("b8a7"),Object(C["a"])(ht,T,E,!1,null,null,null)),mt=vt.exports;function bt(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function _t(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?bt(Object(a),!0).forEach((function(e){Object(p["a"])(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):bt(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var gt=function(t){return{scopedSlots:{customRender:t}}},wt=[{name:"All"},{name:"XHR",regexp:/(x-www-form-urlencoded|form-data|json)/},{name:"JS",regexp:/(text|application)\/(x-)?(java|ecma)script/},{name:"CSS",regexp:/text\/css/},{name:"Img",regexp:/(gif|png|jpe?g|bmp|webp|x-icon|vnd\.microsoft\.icon|svg\+xml)/},{name:"Media",regexp:/(midi|mpeg|webm|ogg|(x-(pn-)?)?wave?)/},{name:"Doc",regexp:/(text\/plain|text\/html)/},{name:"Other",regexp:/(octet-stream|pkcs12|vnd\.mspowerpoint|xhtml\+xml|xml|pdf)/}],yt=["All","200","404","500"],xt=[{name:"All"},{name:"Hit",test:function(t){return"hitCache"===t.type}},{name:"Real",test:function(t){return"hitCache"!==t.type}}],Ct=[_t({title:"Method",dataIndex:"method",key:"Method",width:90},gt("Method")),_t({title:"Name",dataIndex:"name",key:"Name"},gt("Name")),_t({title:"Status",dataIndex:"status",key:"Status"},gt("Status")),_t({title:"Type",key:"Type"},gt("Type")),_t({title:"Message Size",dataIndex:"data",key:"Size"},gt("Size")),_t({title:"Time",dataIndex:"Timing",key:"Time"},gt("Time"))],Ot={name:"monitor-component",data:function(){return{wsConnector:_,serverConfig:{},textFilter:"",typeFilter:wt[0],statusFilter:[yt[0]],cacheFilter:xt[0],TYPE_FILTERS:wt,STATUS_FILTERS:yt,CACHE_FILTERS:xt,columns:Ct,detail:{},monitorData:[]}},computed:{ws:function(){return this.wsConnector.ws},ws_connected:function(){return this.wsConnector.ws_connected},config:function(){return this.serverConfig.monitor},filteredData:function(){var t=this;return this.monitorData.filter((function(e){var a=[];if(t.textFilter)try{a.push(new RegExp(t.textFilter,"i").test(e.url))}catch(s){a.push(-1!==e.url.indexOf(t.textFilter))}if("All"!==t.typeFilter.name){var n=e["Request Headers"]["content-type"]||(e["Response Headers"]||{})["content-type"];a.push(t.typeFilter.regexp.test(n))}if("All"!==t.statusFilter[0]){var i=new RegExp("(".concat(t.statusFilter.join("|"),")"));a.push(i.test(e.status.code))}return"All"!==t.cacheFilter.name&&a.push(t.cacheFilter.test(e)),a.every((function(t){return t}))}))},filteredDataSize:function(){return this.filteredData.reduce((function(t,e){return e.data.response&&e.data.response.size?t+e.data.response.size:t}),0)},allDataSize:function(){return this.monitorData.reduce((function(t,e){return e.data.response&&e.data.response.size?t+e.data.response.size:t}),0)},allDataTime:function(){return this.monitorData.reduce((function(t,e){return e.Timing?t+e.Timing:t}),0)},serverAddress:function(){var t="0.0.0.0"===this.serverConfig.host?"localhost":this.serverConfig.host;return"http://".concat(t,":").concat(this.serverConfig.port)}},components:{Status:P,FilterTab:S,Detail:mt},created:function(){this.connect(),this.startRunTimeScan()},filters:{whetherHitCache:function(t){return"hitCache"===t||""}},methods:{startRunTimeScan:function(){var t=this;setInterval((function(){t.monitorData.forEach((function(t){"string"===typeof t.status&&(t.Timing+=20)}))}),20)},is:function(t,e){return Object.prototype.toString.call(t)==="[object ".concat(e,"]")},connect:function(){_.connect(),_.listen("onMessage",this.receivingData)},receivingData:function(t){var e=JSON.parse(t);if(/(proxy|hitCache)/i.test(e.type)){var a=this.getMonitorIndexById(e.id);if(-1!==a){var n=this.monitorData[a];Object.assign(e["General"],n["General"]),Object.assign(e["Proxy"],n["Proxy"]),this.$set(this.monitorData,a,Object.assign({},n,e))}else{var i=this.config.maxRecords,s=this.monitorData.length-i;s<0&&(s=0),this.monitorData=[].concat(Object(u["a"])(this.monitorData),[e]).slice(s)}}else/config/.test(e.type)?this.serverConfig=Object.freeze(e.value):/clean/.test(e.type)&&(this.monitorData=[])},getMonitorIndexById:function(t){for(var e=-1,a=0;a<this.monitorData.length;a++){var n=this.monitorData[a];if(n.id===t){e=a;break}}return e},typeFilterChange:function(t,e){this.typeFilter=wt[e]},statusFilterChange:function(t){this.statusFilter=t},cacheFilterChange:function(t,e){this.cacheFilter=xt[e]},clearAllData:function(){this.monitorData=[],_.send({type:"action",action:"clean"})},rowClassName:function(t){var e=[];return"object"===Object(d["a"])(t.status)?/(2\d{2}|304)/.test(t.status.code+"")?500===t.status.code&&e.push("row-status-500"):e.push("row-status-unsuccess"):e.push("row-status-unfinished"),t===this.detail&&e.push("row-status-selected"),e},customRow:function(t){var e=this;return{on:{click:function(){e.detail=t}}}}}},Pt=Ot,kt=(a("2a57"),Object(C["a"])(Pt,l,c,!1,null,null,null)),jt=kt.exports,Dt={name:"app",data:function(){return{zh_CN:o.a}},components:{monitor:jt}},Ft=Dt,Rt=(a("8311"),Object(C["a"])(Ft,i,s,!1,null,null,null)),St=Rt.exports;a("c5f6");function Tt(t,e){var a={size:["B","KB","MB","GB","TB"],time:["ms","s"]}[e],n=0;while(t>=1e3){if(n===a.length)break;t/=1e3,n++}return(/\./.test(String(t))?Number(t).toFixed(2):t)+a[n]}n["default"].filter("unitFormat",Tt);a("9a33");var Et=a("f933"),It=(a("6ba6"),a("5efb")),Mt=(a("d13f"),a("ccb9e")),Lt=(a("8fb1"),a("0c63")),Ht=(a("7f6b"),a("8592")),zt=(a("c68a"),a("0020")),$t=(a("5704"),a("b558"));n["default"].use($t["a"]),n["default"].use(zt["a"]),n["default"].use(Ht["a"]),n["default"].use(Lt["a"]),n["default"].use(Mt["a"]),n["default"].use(It["a"]),n["default"].use(Et["a"]),n["default"].use(H["a"]),n["default"].prototype.$notification=f["a"],f["a"].config({placement:"bottomRight",bottom:"50px"});var Vt=a("838b"),qt=a.n(Vt);a("b83f");n["default"].component("json-viewer",qt.a);var At=a("4eb5"),Nt=a.n(At);n["default"].use(Nt.a);a("b429"),a("b20f");n["default"].config.productionTip=!1,new n["default"]({render:function(t){return t(St)}}).$mount("#app")},"5b18":function(t,e,a){"use strict";a("cc6f")},8311:function(t,e,a){"use strict";a("9490")},9490:function(t,e,a){},af2c:function(t,e,a){},b20f:function(t,e,a){},b8a7:function(t,e,a){"use strict";a("af2c")},c24b:function(t,e,a){"use strict";a("efcc")},cc6f:function(t,e,a){},cfe5:function(t,e,a){},e28e:function(t,e,a){"use strict";a("f893")},ebba:function(t,e,a){},efcc:function(t,e,a){},f893:function(t,e,a){}});