1234567891011 |
- import{n as C,ab as rt,X as O,a6 as N,a7 as F,a9 as M,P as st,E as T,_ as $,aa as Ce,f as u,d as Pe,Y as Se,u as l,e as Y,I as V,k as Q,w as be,b as it,Z as y,F as _e,a2 as ut}from"./vue-fae2b924.js";import{u as lt,m as ct,n as dt,o as Me}from"./global-f242879f.js";import{u as ze,s as Le,T as ft,L as pt,e as je,b4 as ke,b3 as R,b8 as Ae,a0 as vt,aV as Te,bc as se,U as Be,a6 as Oe}from"./radical-3ee02118.js";import{S as ht}from"./state-2a3c36e1.js";import{r as yt}from"./index-137e94ff.js";import{_ as ee}from"./index.vue_vue_type_script_setup_true_lang-2cbcdf03.js";import{b as te,g as U}from"./utils-f4f08b68.js";function we(s){"@babel/helpers - typeof";return we=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(s)}var mt=/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/,He={name:"JsonString",props:{jsonValue:{type:String,required:!0}},data:function(){return{expand:!0,canExtend:!1}},mounted:function(){this.$refs.itemRef.offsetHeight>this.$refs.holderRef.offsetHeight&&(this.canExtend=!0)},methods:{toggle:function(){this.expand=!this.expand}},render:function(){var e=this.jsonValue,o=mt.test(e),c;return this.expand?(c={class:{"jv-item":!0,"jv-string":!0},ref:"itemRef"},o?(e='<a href="'.concat(e,'" target="_blank" class="jv-link">').concat(e,"</a>"),c.innerHTML='"'.concat(e.toString(),'"')):c.innerText='"'.concat(e.toString(),'"')):c={class:{"jv-ellipsis":!0},onClick:this.toggle,innerText:"..."},C("span",{},[this.canExtend&&C("span",{class:{"jv-toggle":!0,open:this.expand},onClick:this.toggle}),C("span",{class:{"jv-holder-node":!0},ref:"holderRef"}),C("span",c)])}};He.__file="src/Components/types/json-string.vue";var Fe={name:"JsonUndefined",functional:!0,props:{jsonValue:{type:Object,default:null}},render:function(){return C("span",{class:{"jv-item":!0,"jv-undefined":!0},innerText:this.jsonValue===null?"null":"undefined"})}};Fe.__file="src/Components/types/json-undefined.vue";var Ie={name:"JsonNumber",functional:!0,props:{jsonValue:{type:Number,required:!0}},render:function(){var e=Number.isInteger(this.jsonValue);return C("span",{class:{"jv-item":!0,"jv-number":!0,"jv-number-integer":e,"jv-number-float":!e},innerText:this.jsonValue.toString()})}};Ie.__file="src/Components/types/json-number.vue";var Ue={name:"JsonBoolean",functional:!0,props:{jsonValue:Boolean},render:function(){return C("span",{class:{"jv-item":!0,"jv-boolean":!0},innerText:this.jsonValue.toString()})}};Ue.__file="src/Components/types/json-boolean.vue";var Je={name:"JsonObject",props:{jsonValue:{type:Object,required:!0},keyName:{type:String,default:""},depth:{type:Number,default:0},expand:Boolean,sort:Boolean,previewMode:Boolean},data:function(){return{value:{}}},computed:{ordered:function(){var e=this;if(!this.sort)return this.value;var o={};return Object.keys(this.value).sort().forEach(function(c){o[c]=e.value[c]}),o}},watch:{jsonValue:function(e){this.setValue(e)}},mounted:function(){this.setValue(this.jsonValue)},methods:{setValue:function(e){var o=this;setTimeout(function(){o.value=e},0)},toggle:function(){this.$emit("update:expand",!this.expand),this.dispatchEvent()},dispatchEvent:function(){try{this.$el.dispatchEvent(new Event("resized"))}catch{var e=document.createEvent("Event");e.initEvent("resized",!0,!1),this.$el.dispatchEvent(e)}}},render:function(){var e=[];if(!this.previewMode&&!this.keyName&&e.push(C("span",{class:{"jv-toggle":!0,open:!!this.expand},onClick:this.toggle})),e.push(C("span",{class:{"jv-item":!0,"jv-object":!0},innerText:"{"})),this.expand){for(var o in this.ordered)if(this.ordered.hasOwnProperty(o)){var c=this.ordered[o];e.push(C(Ee,{key:o,style:{display:this.expand?void 0:"none"},sort:this.sort,keyName:o,depth:this.depth+1,value:c,previewMode:this.previewMode}))}}return!this.expand&&Object.keys(this.value).length&&e.push(C("span",{style:{display:this.expand?"none":void 0},class:{"jv-ellipsis":!0},onClick:this.toggle,title:"click to reveal object content (keys: ".concat(Object.keys(this.ordered).join(", "),")"),innerText:"..."})),e.push(C("span",{class:{"jv-item":!0,"jv-object":!0},innerText:"}"})),C("span",e)}};Je.__file="src/Components/types/json-object.vue";var qe={name:"JsonArray",props:{jsonValue:{type:Array,required:!0},keyName:{type:String,default:""},depth:{type:Number,default:0},sort:Boolean,expand:Boolean,previewMode:Boolean},data:function(){return{value:[]}},watch:{jsonValue:function(e){this.setValue(e)}},mounted:function(){this.setValue(this.jsonValue)},methods:{setValue:function(e){var o=this,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;c===0&&(this.value=[]),setTimeout(function(){e.length>c&&(o.value.push(e[c]),o.setValue(e,c+1))},0)},toggle:function(){this.$emit("update:expand",!this.expand);try{this.$el.dispatchEvent(new Event("resized"))}catch{var e=document.createEvent("Event");e.initEvent("resized",!0,!1),this.$el.dispatchEvent(e)}}},render:function(){var e=this,o=[];return!this.previewMode&&!this.keyName&&o.push(C("span",{class:{"jv-toggle":!0,open:!!this.expand},onClick:this.toggle})),o.push(C("span",{class:{"jv-item":!0,"jv-array":!0},innerText:"["})),this.expand&&this.value.forEach(function(c,n){o.push(C(Ee,{key:n,style:{display:e.expand?void 0:"none"},sort:e.sort,depth:e.depth+1,value:c,previewMode:e.previewMode}))}),!this.expand&&this.value.length&&o.push(C("span",{style:{display:void 0},class:{"jv-ellipsis":!0},onClick:this.toggle,title:"click to reveal ".concat(this.value.length," hidden items"),innerText:"..."})),o.push(C("span",{class:{"jv-item":!0,"jv-array":!0},innerText:"]"})),C("span",o)}};qe.__file="src/Components/types/json-array.vue";var Ge={name:"JsonFunction",functional:!0,props:{jsonValue:{type:Function,required:!0}},render:function(){return C("span",{class:{"jv-item":!0,"jv-function":!0},attrs:{title:this.jsonValue.toString()},innerHTML:"<function>"})}};Ge.__file="src/Components/types/json-function.vue";var Ye={name:"JsonDate",inject:["timeformat"],functional:!0,props:{jsonValue:{type:Date,required:!0}},render:function(){var e=this.jsonValue,o=this.timeformat;return C("span",{class:{"jv-item":!0,"jv-string":!0},innerText:'"'.concat(o(e),'"')})}};Ye.__file="src/Components/types/json-date.vue";var gt=/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/,Ke={name:"JsonString",props:{jsonValue:{type:RegExp,required:!0}},data:function(){return{expand:!0,canExtend:!1}},mounted:function(){this.$refs.itemRef.offsetHeight>this.$refs.holderRef.offsetHeight&&(this.canExtend=!0)},methods:{toggle:function(){this.expand=!this.expand}},render:function(){var e=this.jsonValue,o=gt.test(e),c;return this.expand?(c={class:{"jv-item":!0,"jv-string":!0},ref:"itemRef"},o?(e='<a href="'.concat(e,'" target="_blank" class="jv-link">').concat(e,"</a>"),c.innerHTML="".concat(e.toString())):c.innerText="".concat(e.toString())):c={class:{"jv-ellipsis":!0},onClick:this.toggle,innerText:"..."},C("span",{},[this.canExtend&&C("span",{class:{"jv-toggle":!0,open:this.expand},onClick:this.toggle}),C("span",{class:{"jv-holder-node":!0},ref:"holderRef"}),C("span",c)])}};Ke.__file="src/Components/types/json-regexp.vue";var Ee={name:"JsonBox",inject:["expandDepth","keyClick"],props:{value:{type:[Object,Array,String,Number,Boolean,Function,Date],default:null},keyName:{type:String,default:""},sort:Boolean,depth:{type:Number,default:0},previewMode:Boolean},data:function(){return{expand:!0}},mounted:function(){this.expand=this.previewMode||!(this.depth>=this.expandDepth)},methods:{toggle:function(){this.expand=!this.expand;try{this.$el.dispatchEvent(new Event("resized"))}catch{var e=document.createEvent("Event");e.initEvent("resized",!0,!1),this.$el.dispatchEvent(e)}}},render:function(){var e=this,o=[],c;this.value===null||this.value===void 0?c=Fe:Array.isArray(this.value)?c=qe:Object.prototype.toString.call(this.value)==="[object Date]"?c=Ye:this.value.constructor===RegExp?c=Ke:we(this.value)==="object"?c=Je:typeof this.value=="number"?c=Ie:typeof this.value=="string"?c=He:typeof this.value=="boolean"?c=Ue:typeof this.value=="function"&&(c=Ge);var n=this.keyName&&this.value&&(Array.isArray(this.value)||we(this.value)==="object"&&Object.prototype.toString.call(this.value)!=="[object Date]");return!this.previewMode&&n&&o.push(C("span",{class:{"jv-toggle":!0,open:!!this.expand},onClick:this.toggle})),this.keyName&&o.push(C("span",{class:{"jv-key":!0},onClick:function(){e.keyClick(e.keyName)},innerText:"".concat(this.keyName,":")})),o.push(C(c,{class:{"jv-push":!0},jsonValue:this.value,keyName:this.keyName,sort:this.sort,depth:this.depth,expand:this.expand,previewMode:this.previewMode,"onUpdate:expand":function(m){e.expand=m}})),C("div",{class:{"jv-node":!0,"jv-key-node":!!this.keyName&&!n,toggle:!this.previewMode&&n}},o)}};Ee.__file="src/Components/json-box.vue";var xt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ze={exports:{}};(function(s,e){(function(c,n){s.exports=n()})(xt,function(){return function(){var o={686:function(f,m,t){t.d(m,{default:function(){return L}});var x=t(279),b=t.n(x),_=t(370),E=t.n(_),S=t(817),A=t.n(S);function w(h){try{return document.execCommand(h)}catch{return!1}}var D=function(d){var i=A()(d);return w("cut"),i},k=D;function P(h){var d=document.documentElement.getAttribute("dir")==="rtl",i=document.createElement("textarea");i.style.fontSize="12pt",i.style.border="0",i.style.padding="0",i.style.margin="0",i.style.position="absolute",i.style[d?"right":"left"]="-9999px";var g=window.pageYOffset||document.documentElement.scrollTop;return i.style.top="".concat(g,"px"),i.setAttribute("readonly",""),i.value=h,i}var ue=function(d){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},g="";if(typeof d=="string"){var p=P(d);i.container.appendChild(p),g=A()(p),w("copy"),p.remove()}else g=A()(d),w("copy");return g},oe=ue;function K(h){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?K=function(i){return typeof i}:K=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},K(h)}var le=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=d.action,g=i===void 0?"copy":i,p=d.container,j=d.target,z=d.text;if(g!=="copy"&&g!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(j!==void 0)if(j&&K(j)==="object"&&j.nodeType===1){if(g==="copy"&&j.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(g==="cut"&&(j.hasAttribute("readonly")||j.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(z)return oe(z,{container:p});if(j)return g==="cut"?k(j):oe(j,{container:p})},ce=le;function q(h){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?q=function(i){return typeof i}:q=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},q(h)}function ae(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")}function de(h,d){for(var i=0;i<d.length;i++){var g=d[i];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(h,g.key,g)}}function fe(h,d,i){return d&&de(h.prototype,d),i&&de(h,i),h}function re(h,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(d&&d.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),d&&I(h,d)}function I(h,d){return I=Object.setPrototypeOf||function(g,p){return g.__proto__=p,g},I(h,d)}function pe(h){var d=ye();return function(){var g=Z(h),p;if(d){var j=Z(this).constructor;p=Reflect.construct(g,arguments,j)}else p=g.apply(this,arguments);return ve(this,p)}}function ve(h,d){return d&&(q(d)==="object"||typeof d=="function")?d:he(h)}function he(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function ye(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Z(h){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},Z(h)}function W(h,d){var i="data-clipboard-".concat(h);if(d.hasAttribute(i))return d.getAttribute(i)}var me=function(h){re(i,h);var d=pe(i);function i(g,p){var j;return ae(this,i),j=d.call(this),j.resolveOptions(p),j.listenClick(g),j}return fe(i,[{key:"resolveOptions",value:function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof p.action=="function"?p.action:this.defaultAction,this.target=typeof p.target=="function"?p.target:this.defaultTarget,this.text=typeof p.text=="function"?p.text:this.defaultText,this.container=q(p.container)==="object"?p.container:document.body}},{key:"listenClick",value:function(p){var j=this;this.listener=E()(p,"click",function(z){return j.onClick(z)})}},{key:"onClick",value:function(p){var j=p.delegateTarget||p.currentTarget,z=this.action(j)||"copy",X=ce({action:z,container:this.container,target:this.target(j),text:this.text(j)});this.emit(X?"success":"error",{action:z,text:X,trigger:j,clearSelection:function(){j&&j.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(p){return W("action",p)}},{key:"defaultTarget",value:function(p){var j=W("target",p);if(j)return document.querySelector(j)}},{key:"defaultText",value:function(p){return W("text",p)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(p){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return oe(p,j)}},{key:"cut",value:function(p){return k(p)}},{key:"isSupported",value:function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],j=typeof p=="string"?[p]:p,z=!!document.queryCommandSupported;return j.forEach(function(X){z=z&&!!document.queryCommandSupported(X)}),z}}]),i}(b()),L=me},828:function(f){var m=9;if(typeof Element<"u"&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}function x(b,_){for(;b&&b.nodeType!==m;){if(typeof b.matches=="function"&&b.matches(_))return b;b=b.parentNode}}f.exports=x},438:function(f,m,t){var x=t(828);function b(S,A,w,D,k){var P=E.apply(this,arguments);return S.addEventListener(w,P,k),{destroy:function(){S.removeEventListener(w,P,k)}}}function _(S,A,w,D,k){return typeof S.addEventListener=="function"?b.apply(null,arguments):typeof w=="function"?b.bind(null,document).apply(null,arguments):(typeof S=="string"&&(S=document.querySelectorAll(S)),Array.prototype.map.call(S,function(P){return b(P,A,w,D,k)}))}function E(S,A,w,D){return function(k){k.delegateTarget=x(k.target,A),k.delegateTarget&&D.call(S,k)}}f.exports=_},879:function(f,m){m.node=function(t){return t!==void 0&&t instanceof HTMLElement&&t.nodeType===1},m.nodeList=function(t){var x=Object.prototype.toString.call(t);return t!==void 0&&(x==="[object NodeList]"||x==="[object HTMLCollection]")&&"length"in t&&(t.length===0||m.node(t[0]))},m.string=function(t){return typeof t=="string"||t instanceof String},m.fn=function(t){var x=Object.prototype.toString.call(t);return x==="[object Function]"}},370:function(f,m,t){var x=t(879),b=t(438);function _(w,D,k){if(!w&&!D&&!k)throw new Error("Missing required arguments");if(!x.string(D))throw new TypeError("Second argument must be a String");if(!x.fn(k))throw new TypeError("Third argument must be a Function");if(x.node(w))return E(w,D,k);if(x.nodeList(w))return S(w,D,k);if(x.string(w))return A(w,D,k);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function E(w,D,k){return w.addEventListener(D,k),{destroy:function(){w.removeEventListener(D,k)}}}function S(w,D,k){return Array.prototype.forEach.call(w,function(P){P.addEventListener(D,k)}),{destroy:function(){Array.prototype.forEach.call(w,function(P){P.removeEventListener(D,k)})}}}function A(w,D,k){return b(document.body,w,D,k)}f.exports=_},817:function(f){function m(t){var x;if(t.nodeName==="SELECT")t.focus(),x=t.value;else if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){var b=t.hasAttribute("readonly");b||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),b||t.removeAttribute("readonly"),x=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var _=window.getSelection(),E=document.createRange();E.selectNodeContents(t),_.removeAllRanges(),_.addRange(E),x=_.toString()}return x}f.exports=m},279:function(f){function m(){}m.prototype={on:function(t,x,b){var _=this.e||(this.e={});return(_[t]||(_[t]=[])).push({fn:x,ctx:b}),this},once:function(t,x,b){var _=this;function E(){_.off(t,E),x.apply(b,arguments)}return E._=x,this.on(t,E,b)},emit:function(t){var x=[].slice.call(arguments,1),b=((this.e||(this.e={}))[t]||[]).slice(),_=0,E=b.length;for(_;_<E;_++)b[_].fn.apply(b[_].ctx,x);return this},off:function(t,x){var b=this.e||(this.e={}),_=b[t],E=[];if(_&&x)for(var S=0,A=_.length;S<A;S++)_[S].fn!==x&&_[S].fn._!==x&&E.push(_[S]);return E.length?b[t]=E:delete b[t],this}},f.exports=m,f.exports.TinyEmitter=m}},c={};function n(f){if(c[f])return c[f].exports;var m=c[f]={exports:{}};return o[f](m,m.exports,n),m.exports}return function(){n.n=function(f){var m=f&&f.__esModule?function(){return f.default}:function(){return f};return n.d(m,{a:m}),m}}(),function(){n.d=function(f,m){for(var t in m)n.o(m,t)&&!n.o(f,t)&&Object.defineProperty(f,t,{enumerable:!0,get:m[t]})}}(),function(){n.o=function(f,m){return Object.prototype.hasOwnProperty.call(f,m)}}(),n(686)}().default})})(Ze);var _t=bt(Ze.exports),jt=function(e,o){var c=Date.now(),n;return function(){for(var f=arguments.length,m=new Array(f),t=0;t<f;t++)m[t]=arguments[t];Date.now()-c<o&&n&&clearTimeout(n),n=setTimeout(function(){e.apply(void 0,m)},o),c=Date.now()}},$e={name:"JsonViewer",components:{JsonBox:Ee},props:{value:{type:[Object,Array,String,Number,Boolean,Function],required:!0},expanded:{type:Boolean,default:!1},expandDepth:{type:Number,default:1},copyable:{type:[Boolean,Object],default:!1},sort:{type:Boolean,default:!1},boxed:{type:Boolean,default:!1},theme:{type:String,default:"light"},timeformat:{type:Function,default:function(e){return e.toLocaleString()}},previewMode:{type:Boolean,default:!1}},provide:function(){return{expandDepth:this.expandDepth,timeformat:this.timeformat,keyClick:this.keyClick}},data:function(){return{copied:!1,expandableCode:!1,expandCode:this.expanded}},emits:["onKeyClick"],computed:{jvClass:function(){return"jv-container jv-"+this.theme+(this.boxed?" boxed":"")},copyText:function(){var e=this.copyable,o=e.copyText,c=e.copiedText,n=e.timeout,f=e.align;return{copyText:o||"copy",copiedText:c||"copied!",timeout:n||2e3,align:f}}},watch:{value:function(){this.onResized()}},mounted:function(){var e=this;if(this.debounceResized=jt(this.debResized.bind(this),200),this.boxed&&this.$refs.jsonBox&&(this.onResized(),this.$refs.jsonBox.$el.addEventListener("resized",this.onResized,!0)),this.copyable){var o=new _t(this.$refs.clip,{text:function(){return JSON.stringify(e.value,null,2)}});o.on("success",function(c){e.onCopied(c)})}},methods:{onResized:function(){this.debounceResized()},debResized:function(){var e=this;this.$nextTick(function(){e.$refs.jsonBox&&(e.$refs.jsonBox.$el.clientHeight>=250?e.expandableCode=!0:e.expandableCode=!1)})},keyClick:function(e){this.$emit("onKeyClick",e)},onCopied:function(e){var o=this;this.copied||(this.copied=!0,setTimeout(function(){o.copied=!1},this.copyText.timeout),this.$emit("copied",e))},toggleExpandCode:function(){this.expandCode=!this.expandCode}}};function kt(s,e,o,c,n,f){var m=rt("json-box");return O(),N("div",{class:F(f.jvClass)},[o.copyable?(O(),N("div",{key:0,class:F("jv-tooltip ".concat(f.copyText.align||"right"))},[M("span",{ref:"clip",class:F(["jv-button",{copied:n.copied}])},[st(s.$slots,"copy",{copied:n.copied},function(){return[T($(n.copied?f.copyText.copiedText:f.copyText.copyText),1)]})],2)],2)):Ce("v-if",!0),M("div",{class:F(["jv-code",{open:n.expandCode,boxed:o.boxed}])},[u(m,{ref:"jsonBox",value:o.value,sort:o.sort,"preview-mode":o.previewMode},null,8,["value","sort","preview-mode"])],2),n.expandableCode&&o.boxed?(O(),N("div",{key:1,class:"jv-more",onClick:e[0]||(e[0]=function(){return f.toggleExpandCode&&f.toggleExpandCode.apply(f,arguments)})},[M("span",{class:F(["jv-toggle",{open:!!n.expandCode}])},null,2)])):Ce("v-if",!0)],2)}$e.render=kt;$e.__file="src/Components/json-viewer.vue";const Ve=Pe({__name:"index",props:{jsonData:{type:Object,default:()=>({})}},setup(s){const e=ze(),{getDarkMode:o}=Le(e);return(c,n)=>(O(),Se(l($e),{boxed:"",sort:"",value:s.jsonData,copyable:{copyText:"复制",copiedText:"已复制"},class:"w-full",expanded:!0,theme:l(o)},null,8,["value","theme"]))}});const Tt={class:"flex-1"},St={class:"flex items-center gap-1"},Ct={class:"flex items-center gap-4"},wt={key:0,class:"flex"},Et={key:1,class:"flex gap-4"},Rt={class:"flex-1"},$t={class:"flex justify-between items-center mb-2"},Dt={class:"flex-1"},Mt={class:"flex justify-between items-center mb-2"},At=["innerHTML"],Bt={key:1},Ot={class:"flex items-center gap-4"},Vt={key:0,class:"flex"},Nt={key:1,class:"flex gap-4"},Pt={class:"flex-1"},zt={class:"flex justify-between items-center mb-2"},Lt={class:"flex-1"},Ht={class:"flex justify-between items-center mb-2"},Ft=["innerHTML"],It={key:1},Ne=100,ne=50,Xt=Pe({__name:"detail",setup(s){const{getDarkMode:e}=Le(ze()),o=Y(()=>e.value===ft.DARK),c=pt(),n=V({}),{resume:f,pause:m}=lt(fe),t=Y(()=>decodeURIComponent(yt.currentRoute.value.query.path)),x=Q("stats"),b=Q("stats"),_=Q([]),E=Q([]);let S=null,A=null;const w=v=>{v==="realtime"&&!S?S=Me(t.value,"audio",r=>{var a,B;_.value.push({size:((B=(a=r.wrap)==null?void 0:a[0])==null?void 0:B.size)||0,timestamp:r.timestamp}),_.value.length>Ne&&_.value.shift()}):v==="stats"&&S&&(S(),S=null)},D=v=>{v==="realtime"&&!A?A=Me(t.value,"video",r=>{var a,B;E.value.push({size:((B=(a=r.wrap)==null?void 0:a[0])==null?void 0:B.size)||0,keyFrame:r.keyFrame,timestamp:r.timestamp}),E.value.length>Ne&&E.value.shift()}):v==="stats"&&A&&(A(),A=null)};be(x,v=>{w(v)}),be(b,v=>{D(v)}),it(()=>{S==null||S(),A==null||A()}),be(t,v=>{v?(fe(),f()):m()},{immediate:!0});const k=V([]),P=V([]),ue=V([]),oe=V([]),K=V([]),le=V([]),ce=V([]),q=V([]),ae=Y(()=>{var v;return(v=k.value)!=null&&v.length?k.value.reduce((r,a)=>{var H,G;const B=((H=a.audioReader)==null?void 0:H.bps)||0,J=((G=a.videoReader)==null?void 0:G.bps)||0;return r+B+J},0):0}),de=Y(()=>{var a,B;const v=((a=n.value.audioTrack)==null?void 0:a.bps)||0,r=((B=n.value.videoTrack)==null?void 0:B.bps)||0;return v+r});function fe(){t.value&&(ct(t.value).then(v=>{var r,a,B,J,H;n.value=v||{},te(P.value,je(new Date).format("HH:mm:ss"),ne),te(ue.value,((r=n.value.audioTrack)==null?void 0:r.bps)>>10||0,ne),te(oe.value,((a=n.value.audioTrack)==null?void 0:a.fps)||0,ne),te(K.value,((B=n.value.videoTrack)==null?void 0:B.bps)>>10||0,ne),te(le.value,((J=n.value.videoTrack)==null?void 0:J.fps)||0,ne),te(ce.value,((H=n.value.videoTrack)==null?void 0:H.gop)||0,ne),me()}),dt(t.value).then(v=>{k.value=v||[],te(q.value,ae.value>>10||0,ne),me()}))}const re=(v,r="YYYY-MM-DD HH:mm:ss")=>je(v).format(r),I={xAxis:{type:"category",data:P},yAxis:{type:"value",min:"dataMin",max:"dataMax"}},pe=V({}),ve=V({}),he=V({}),ye=V({}),Z=V({}),W=V({});function me(){var v,r,a,B,J,H,G,Re,ie,ge;pe.value={...I,legend:{data:[`音频码率: ${U(((v=n.value.audioTrack)==null?void 0:v.bps)||0)}`]},series:[{type:"line",smooth:!0,data:ue.value,name:`音频码率: ${U(((r=n.value.audioTrack)==null?void 0:r.bps)||0)}`}]},ve.value={...I,legend:{data:[`音频帧率: ${((a=n.value.audioTrack)==null?void 0:a.fps)||0}`]},series:[{type:"line",smooth:!0,data:oe.value,name:`音频帧率: ${((B=n.value.audioTrack)==null?void 0:B.fps)||0}`}]},he.value={...I,legend:{data:[`视频码率: ${U(((J=n.value.videoTrack)==null?void 0:J.bps)||0)}`]},series:[{type:"line",smooth:!0,data:K.value,name:`视频码率: ${U(((H=n.value.videoTrack)==null?void 0:H.bps)||0)}`}]},ye.value={...I,legend:{data:[`视频帧率: ${((G=n.value.videoTrack)==null?void 0:G.fps)||0}`]},series:[{type:"line",smooth:!0,data:le.value,name:`视频帧率: ${((Re=n.value.videoTrack)==null?void 0:Re.fps)||0}`}]},Z.value={...I,legend:{data:[`视频GOP: ${((ie=n.value.videoTrack)==null?void 0:ie.gop)||0}`]},series:[{type:"line",smooth:!0,data:ce.value,name:`视频GOP: ${((ge=n.value.videoTrack)==null?void 0:ge.gop)||0}`}]},W.value={...I,legend:{data:[`下行码率: ${U(ae.value)}`]},series:[{type:"line",smooth:!0,data:q.value,name:`下行码率: ${U(ae.value)}`}]}}const L=Q(!1),h=Q([]),d=Q([]);be(L,v=>{v&&(h.value=[..._.value],d.value=[...E.value])});const i=Y(()=>(L.value?h.value:_.value).map(r=>`${je(r.timestamp).format("HH:mm:ss.SSS")} ${U(r.size).padStart(10)}`).join(`
- `)),g=Y(()=>(L.value?d.value:E.value).map(r=>`${je(r.timestamp).format("HH:mm:ss.SSS")} ${U(r.size).padStart(10)} ${r.keyFrame?"是":"否"}`).join(`
- `)),p=Y(()=>{const v=L.value?h.value:_.value;return X(v,"audio")}),j=Y(()=>{const v=L.value?d.value:E.value;return X(v,"video")});function z(){const v=o.value?"#141414":"#f0f2f5",r=o.value?"#666":"#999";return`<svg width="100%" height="200" style="background: ${v}">
- <text x="50%" y="50%" text-anchor="middle" fill="${r}">暂无数据</text>
- </svg>`}function X(v,r){if(!(v!=null&&v.length))return z();const a=200,B=Math.max(...v.map(xe=>xe.size),1),J="100%",H=500,G=4,ie=G+1,ge=o.value?"#141414":"#f0f2f5",We=o.value?"#bb86fc":"#1890ff",Xe=o.value?"#ff7875":"#ff4d4f",Qe=Math.floor(H/ie),et=Math.max(0,v.length-Qe),tt=v.slice(et).map((xe,nt)=>{const ot=nt*ie,De=xe.size/B*a,at=r==="video"&&xe.keyFrame?Xe:We;return`<rect
- x="${ot}"
- y="${a-De}"
- width="${G}"
- height="${De}"
- fill="${at}"
- />`}).join("");return`<svg width="${J}" height="${a}" viewBox="0 0 ${H} ${a}" preserveAspectRatio="none" style="background: ${ge}">${tt}</svg>`}return(v,r)=>(O(),N("div",Tt,[u(l(Te),{bordered:!1,title:"基础信息"},{default:y(()=>[u(l(ke),{column:3},{default:y(()=>[u(l(R),{label:"流标识"},{default:y(()=>[T($(n.value.path),1)]),_:1}),u(l(R),{label:"流类型"},{default:y(()=>[T($(n.value.type),1)]),_:1}),u(l(R),{label:"所属插件"},{default:y(()=>[T($(n.value.pluginName),1)]),_:1}),u(l(R),{label:"流状态"},{default:y(()=>[u(l(ht),{state:n.value.state},null,8,["state"])]),_:1}),u(l(R),{label:"创建时间"},{default:y(()=>[r[6]||(r[6]=T(" [")),u(l(Ae),{value:re(n.value.startTime),class:"text-primary"},null,8,["value"]),T("] "+$(re(n.value.startTime)),1)]),_:1}),u(l(R),{label:"当无人订阅时自动关闭"},{default:y(()=>{var a;return[M("span",St,[T($((a=n.value)==null?void 0:a.stopOnIdle)+" ",1),u(l(vt),{icon:"ant-design:question-circle-filled",class:"cursor-pointer"})])]}),_:1}),u(l(R),{label:"总上行码率"},{default:y(()=>[T($(l(U)(de.value)+"/s"),1)]),_:1}),u(l(R),{label:"总下行码率"},{default:y(()=>[T($(l(U)(ae.value)+"/s"),1)]),_:1}),u(l(R),{label:""})]),_:1})]),_:1}),u(l(Te),{bordered:!1,title:"音频轨道",class:"mt-10px"},{extra:y(()=>[M("div",Ct,[u(l(se).Group,{value:x.value,"onUpdate:value":r[0]||(r[0]=a=>x.value=a),"button-style":"solid"},{default:y(()=>[u(l(se).Button,{value:"stats"},{default:y(()=>r[7]||(r[7]=[T("数据统计")])),_:1}),u(l(se).Button,{value:"realtime"},{default:y(()=>r[8]||(r[8]=[T("实时数据")])),_:1})]),_:1},8,["value"]),n.value.audioTrack?(O(),Se(l(Be),{key:0,type:"link",onClick:r[1]||(r[1]=a=>l(c)({name:"MonitorTrackSnapAudio",query:{streamPath:decodeURIComponent(n.value.path)}}))},{default:y(()=>r[9]||(r[9]=[T(" 查看快照 ")])),_:1})):Ce("",!0)])]),default:y(()=>[n.value.audioTrack?(O(),N("div",wt,[u(l(ke),{class:"flex-1",column:1},{default:y(()=>[u(l(R),{label:"编码格式"},{default:y(()=>[T($(n.value.audioTrack.codec),1)]),_:1}),u(l(R),{label:"采样率"},{default:y(()=>[T($(n.value.audioTrack.sampleRate),1)]),_:1}),u(l(R),{label:"声道数"},{default:y(()=>[T($(n.value.audioTrack.channels),1)]),_:1})]),_:1}),x.value==="stats"?(O(),N(_e,{key:0},[u(ee,{option:pe.value,class:"flex-1 h-200px"},null,8,["option"]),u(ee,{option:ve.value,class:"flex-1 h-200px"},null,8,["option"]),u(ee,{option:W.value,class:"flex-1 h-200px"},null,8,["option"])],64)):(O(),N("div",Et,[M("div",Rt,[M("div",$t,[M("span",{class:F(["text-sm",o.value?"text-gray-400":"text-gray-600"])},"实时数据",2),u(l(Oe),{checked:L.value,"onUpdate:checked":r[2]||(r[2]=a=>L.value=a),"checked-children":"暂停","un-checked-children":"实时",class:"ml-2"},null,8,["checked"])]),M("pre",{class:F(["text-sm h-200px overflow-auto m-0 p-2 rounded",o.value?"bg-[#141414] text-gray-300":"bg-[#f0f2f5] text-gray-700"])},$(i.value),3)]),M("div",Dt,[M("div",Mt,[M("span",{class:F(["text-sm",o.value?"text-gray-400":"text-gray-600"])},"波形图",2)]),M("div",{class:"h-200px overflow-hidden",innerHTML:p.value},null,8,At)])]))])):(O(),N("div",Bt,"暂无信息"))]),_:1}),u(l(Te),{bordered:!1,title:"视频轨道",class:"mt-10px"},{extra:y(()=>[M("div",Ot,[u(l(se).Group,{value:b.value,"onUpdate:value":r[3]||(r[3]=a=>b.value=a),"button-style":"solid"},{default:y(()=>[u(l(se).Button,{value:"stats"},{default:y(()=>r[10]||(r[10]=[T("数据统计")])),_:1}),u(l(se).Button,{value:"realtime"},{default:y(()=>r[11]||(r[11]=[T("实时数据")])),_:1})]),_:1},8,["value"]),n.value.videoTrack?(O(),Se(l(Be),{key:0,type:"link",onClick:r[4]||(r[4]=a=>l(c)({name:"MonitorTrackSnapVideo",query:{streamPath:decodeURIComponent(n.value.path)}}))},{default:y(()=>r[12]||(r[12]=[T(" 查看快照 ")])),_:1})):Ce("",!0)])]),default:y(()=>[n.value.videoTrack?(O(),N("div",Vt,[u(l(ke),{class:"flex-1",column:1},{default:y(()=>[u(l(R),{label:"编码格式"},{default:y(()=>[T($(n.value.videoTrack.codec),1)]),_:1}),u(l(R),{label:"分辨率"},{default:y(()=>[T($(n.value.videoTrack.width)+"x"+$(n.value.videoTrack.height),1)]),_:1})]),_:1}),b.value==="stats"?(O(),N(_e,{key:0},[u(ee,{option:he.value,class:"flex-1 h-200px"},null,8,["option"]),u(ee,{option:ye.value,class:"flex-1 h-200px"},null,8,["option"]),u(ee,{option:Z.value,class:"flex-1 h-200px"},null,8,["option"]),u(ee,{option:W.value,class:"flex-1 h-200px"},null,8,["option"])],64)):(O(),N("div",Nt,[M("div",Pt,[M("div",zt,[M("span",{class:F(["text-sm",o.value?"text-gray-400":"text-gray-600"])},"实时数据",2),u(l(Oe),{checked:L.value,"onUpdate:checked":r[5]||(r[5]=a=>L.value=a),"checked-children":"暂停","un-checked-children":"实时",class:"ml-2"},null,8,["checked"])]),M("pre",{class:F(["text-sm h-200px overflow-auto m-0 p-2 rounded",o.value?"bg-[#141414] text-gray-300":"bg-[#f0f2f5] text-gray-700"])},$(g.value),3)]),M("div",Lt,[M("div",Ht,[M("span",{class:F(["text-sm",o.value?"text-gray-400":"text-gray-600"])},"波形图",2)]),M("div",{class:"h-200px overflow-hidden",innerHTML:j.value},null,8,Ft)])]))])):(O(),N("div",It,"暂无信息"))]),_:1}),u(l(Te),{bordered:!1,class:"mt-10px"},{default:y(()=>[u(l(ke),{title:"订阅者信息"},{default:y(()=>[k.value.length?(O(!0),N(_e,{key:0},ut(k.value,a=>(O(),N(_e,{key:a.id},[u(l(R),{label:"ID"},{default:y(()=>[T($(a==null?void 0:a.id),1)]),_:2},1024),u(l(R),{label:"所属插件"},{default:y(()=>[T($(a==null?void 0:a.pluginName),1)]),_:2},1024),u(l(R),{label:"类型"},{default:y(()=>[T($(a==null?void 0:a.type),1)]),_:2},1024),u(l(R),{label:"开始时间"},{default:y(()=>[r[13]||(r[13]=T(" [")),u(l(Ae),{value:re(a.startTime),class:"text-primary"},null,8,["value"]),T("] "+$(re(a.startTime)),1)]),_:2},1024),u(l(R),{label:"描述",span:3},{default:y(()=>[T($((a==null?void 0:a.meta)||"--"),1)]),_:2},1024),u(l(R),{label:"同步模式"},{default:y(()=>[T($(a==null?void 0:a.syncMode),1)]),_:2},1024),u(l(R),{label:"订阅模式"},{default:y(()=>[T($(a==null?void 0:a.subMode),1)]),_:2},1024),u(l(R),{label:"缓存时间"},{default:y(()=>[T($(a==null?void 0:a.bufferTime),1)]),_:2},1024),u(l(R),{label:"音频读取",span:3},{default:y(()=>[u(Ve,{jsonData:(a==null?void 0:a.audioReader)||{}},null,8,["jsonData"])]),_:2},1024),u(l(R),{label:"视频读取",span:3},{default:y(()=>[u(Ve,{jsonData:(a==null?void 0:a.videoReader)||{}},null,8,["jsonData"])]),_:2},1024)],64))),128)):(O(),Se(l(R),{key:1},{default:y(()=>r[14]||(r[14]=[T(" 暂无信息 ")])),_:1}))]),_:1})]),_:1})]))}});export{Xt as default};
|