@platformos/pos-cli
Version:
Manage your platformOS application
2 lines (1 loc) • 20.3 kB
JavaScript
import{S as Ze,i as xe,s as et,d as _,E as ie,x as Ke,o as V,p as E,F as Ne,H as oe,b as B,c as u,I as fe,J as le,z as d,v as tt,h as L,e as p,f as $,K as ne,L as ue,k as C,j as g,M as ce,l as lt,a5 as st,N as ge,a6 as nt,a7 as at,n as ve,O as Qe,R as re,C as ot,X as rt,a3 as it,a as W,Q as ae,V as ft,g as Q,t as X,y as Ee,P as ut}from"../chunks/n7YEDvJi.js";import{g as ct}from"../chunks/D0QH3NT1.js";import{e as Le}from"../chunks/DMhVG_ro.js";import"../chunks/IHki7fMi.js";import{f as dt}from"../chunks/BaKpYqK2.js";import{s as pe}from"../chunks/Bp_ajb_u.js";import{t as Xe}from"../chunks/x4PJc0Qf.js";import{J as Ge}from"../chunks/CMNnzBs7.js";import{I as ke}from"../chunks/DHO4ENnJ.js";import{A as _t}from"../chunks/CqRAXfEk.js";const ht={get:async n=>{const t=typeof window<"u"&&window.location.port!=="4173"&&window.location.port!=="5173"?`http://localhost:${parseInt(window.location.port)}/api/logs`:"http://localhost:3333/api/logs",a=n.last??null;return fetch(`${t}?lastId=`+a).then(e=>e.ok?e.json():Promise.reject(e)).then(e=>(e.logs.forEach(l=>{l.downloaded_at=Date.now()}),e)).catch(e=>({error:e}))}},{document:Ce}=ct;function Pe(n,t,a){const e=n.slice();e[23]=t[a],e[25]=t,e[26]=a;const l=e[23].message.length<262144&&Xe(e[23].message);return e[24]=l,e}function Oe(n,t,a){const e=n.slice();e[23]=t[a],e[27]=t,e[28]=a;const l=e[23].message.length<262144&&Xe(e[23].message);return e[24]=l,e}function Ue(n){let t,a,e="Clear filter",l,o,s,r,i;return o=new ke({props:{icon:"x",size:"12"}}),{c(){t=g("button"),a=g("span"),a.textContent=e,l=C(),ce(o.$$.fragment),this.h()},l(f){t=p(f,"BUTTON",{class:!0});var h=$(t);a=p(h,"SPAN",{class:!0,"data-svelte-h":!0}),ne(a)!=="svelte-1bu6mgu"&&(a.textContent=e),l=L(h),ue(o.$$.fragment,h),h.forEach(_),this.h()},h(){d(a,"class","label svelte-8fkf35"),d(t,"class","clearFilter svelte-8fkf35")},m(f,h){B(f,t,h),u(t,a),u(t,l),fe(o,t,null),s=!0,r||(i=le(t,"click",n[9]),r=!0)},p:ve,i(f){s||(E(o.$$.fragment,f),s=!0)},o(f){V(o.$$.fragment,f),s=!1},d(f){f&&_(t),ie(o),r=!1,i()}}}function Ve(n){let t,a,e=Le(n[4].logs.logs),l=[];for(let s=0;s<e.length;s+=1)l[s]=Fe(Oe(n,e,s));const o=s=>V(l[s],1,1,()=>{l[s]=null});return{c(){t=g("table");for(let s=0;s<l.length;s+=1)l[s].c();this.h()},l(s){t=p(s,"TABLE",{class:!0});var r=$(t);for(let i=0;i<l.length;i+=1)l[i].l(r);r.forEach(_),this.h()},h(){d(t,"class","svelte-8fkf35")},m(s,r){B(s,t,r);for(let i=0;i<l.length;i+=1)l[i]&&l[i].m(t,null);a=!0},p(s,r){if(r&118){e=Le(s[4].logs.logs);let i;for(i=0;i<e.length;i+=1){const f=Oe(s,e,i);l[i]?(l[i].p(f,r),E(l[i],1)):(l[i]=Fe(f),l[i].c(),E(l[i],1),l[i].m(t,null))}for(re(),i=e.length;i<l.length;i+=1)o(i);oe()}},i(s){if(!a){for(let r=0;r<e.length;r+=1)E(l[r]);a=!0}},o(s){l=l.filter(Boolean);for(let r=0;r<l.length;r+=1)V(l[r]);a=!1},d(s){s&&_(t),Qe(l,s)}}}function mt(n){let t;function a(o,s){return o[23].showFull?vt:gt}let e=a(n),l=e(n);return{c(){t=g("div"),l.c(),this.h()},l(o){t=p(o,"DIV",{class:!0});var s=$(t);l.l(s),s.forEach(_),this.h()},h(){d(t,"class","pre svelte-8fkf35")},m(o,s){B(o,t,s),l.m(t,null)},p(o,s){e===(e=a(o))&&l?l.p(o,s):(l.d(1),l=e(o),l&&(l.c(),l.m(t,null)))},i:ve,o:ve,d(o){o&&_(t),l.d()}}}function pt(n){let t,a;return t=new Ge({props:{value:n[24],showFullLines:!0}}),{c(){ce(t.$$.fragment)},l(e){ue(t.$$.fragment,e)},m(e,l){fe(t,e,l),a=!0},p(e,l){const o={};l&16&&(o.value=e[24]),t.$set(o)},i(e){a||(E(t.$$.fragment,e),a=!0)},o(e){V(t.$$.fragment,e),a=!1},d(e){ie(t,e)}}}function gt(n){let t=n[23].message.substr(0,ee)+"",a,e,l,o=n[23].message.length>ee&&Be(n);return{c(){a=X(t),e=C(),o&&o.c(),l=Ee()},l(s){a=Q(s,t),e=L(s),o&&o.l(s),l=Ee()},m(s,r){B(s,a,r),B(s,e,r),o&&o.m(s,r),B(s,l,r)},p(s,r){r&16&&t!==(t=s[23].message.substr(0,ee)+"")&&W(a,t),s[23].message.length>ee?o?o.p(s,r):(o=Be(s),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null)},d(s){s&&(_(a),_(e),_(l)),o&&o.d(s)}}}function vt(n){let t=n[23].message+"",a;return{c(){a=X(t)},l(e){a=Q(e,t)},m(e,l){B(e,a,l)},p(e,l){l&16&&t!==(t=e[23].message+"")&&W(a,t)},d(e){e&&_(a)}}}function Be(n){let t,a,e=n[23].message.length-ee+"",l,o,s,r;function i(){return n[11](n[23],n[27],n[28])}return{c(){t=g("div"),a=g("button"),l=X(e),o=X(" more characters"),this.h()},l(f){t=p(f,"DIV",{class:!0});var h=$(t);a=p(h,"BUTTON",{type:!0,class:!0});var v=$(a);l=Q(v,e),o=Q(v," more characters"),v.forEach(_),h.forEach(_),this.h()},h(){d(a,"type","button"),d(a,"class","svelte-8fkf35"),d(t,"class","longStringInfo svelte-8fkf35")},m(f,h){B(f,t,h),u(t,a),u(a,l),u(a,o),s||(r=le(a,"click",i),s=!0)},p(f,h){n=f,h&16&&e!==(e=n[23].message.length-ee+"")&&W(l,e)},d(f){f&&_(t),s=!1,r()}}}function Me(n){let t,a,e,l=n[23].data.url+"",o,s,r=n[23].data.user&&Ae(n);return{c(){t=g("ul"),a=g("li"),e=X("Page: "),o=X(l),s=C(),r&&r.c(),this.h()},l(i){t=p(i,"UL",{class:!0});var f=$(t);a=p(f,"LI",{});var h=$(a);e=Q(h,"Page: "),o=Q(h,l),h.forEach(_),s=L(f),r&&r.l(f),f.forEach(_),this.h()},h(){d(t,"class","info svelte-8fkf35")},m(i,f){B(i,t,f),u(t,a),u(a,e),u(a,o),u(t,s),r&&r.m(t,null)},p(i,f){f&16&&l!==(l=i[23].data.url+"")&&W(o,l),i[23].data.user?r?r.p(i,f):(r=Ae(i),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(i){i&&_(t),r&&r.d()}}}function Ae(n){let t,a,e,l=n[23].data.user.id+"",o,s;return{c(){t=g("li"),a=X("User ID: "),e=g("a"),o=X(l),this.h()},l(r){t=p(r,"LI",{});var i=$(t);a=Q(i,"User ID: "),e=p(i,"A",{href:!0,class:!0});var f=$(e);o=Q(f,l),f.forEach(_),i.forEach(_),this.h()},h(){d(e,"href",s="/users/"+n[23].data.user.id),d(e,"class","svelte-8fkf35")},m(r,i){B(r,t,i),u(t,a),u(t,e),u(e,o)},p(r,i){i&16&&l!==(l=r[23].data.user.id+"")&&W(o,l),i&16&&s!==(s="/users/"+r[23].data.user.id)&&d(e,"href",s)},d(r){r&&_(t)}}}function Fe(n){var Se;let t,a,e,l=new Date(n[23].created_at).toLocaleDateString(void 0,{})+"",o,s,r=new Date(n[23].created_at).toLocaleTimeString(void 0,{})+"",i,f,h,v,A=n[23].error_type+"",z,H,M,F,T,j,q,D,R,y,K,te="Copy message",Y,c,I,m,w,P="Pin this log",b,S,k,O,N,Z,de;const se=[pt,mt],x=[];function _e(J,U){return J[24]?0:1}F=_e(n),T=x[F]=se[F](n);let G=((Se=n[23].data)==null?void 0:Se.url)&&Me(n);c=new ke({props:{icon:"copy"}});function We(...J){return n[12](n[23],...J)}S=new ke({props:{icon:"pin"}});function Ye(){return n[13](n[23])}function Ie(...J){return n[14](n[23],...J)}return{c(){t=g("tr"),a=g("td"),e=g("time"),o=X(l),s=C(),i=X(r),h=C(),v=g("td"),z=X(A),H=C(),M=g("td"),T.c(),j=C(),G&&G.c(),q=C(),D=g("td"),R=g("div"),y=g("button"),K=g("span"),K.textContent=te,Y=C(),ce(c.$$.fragment),I=C(),m=g("button"),w=g("span"),w.textContent=P,b=C(),ce(S.$$.fragment),k=C(),this.h()},l(J){t=p(J,"TR",{class:!0});var U=$(t);a=p(U,"TD",{class:!0});var me=$(a);e=p(me,"TIME",{datetime:!0,class:!0});var he=$(e);o=Q(he,l),s=L(he),i=Q(he,r),he.forEach(_),me.forEach(_),h=L(U),v=p(U,"TD",{class:!0});var De=$(v);z=Q(De,A),De.forEach(_),H=L(U),M=p(U,"TD",{class:!0});var be=$(M);T.l(be),j=L(be),G&&G.l(be),be.forEach(_),q=L(U),D=p(U,"TD",{class:!0});var ye=$(D);R=p(ye,"DIV",{class:!0});var $e=$(R);y=p($e,"BUTTON",{type:!0,class:!0,title:!0});var we=$(y);K=p(we,"SPAN",{class:!0,"data-svelte-h":!0}),ne(K)!=="svelte-1qjln59"&&(K.textContent=te),Y=L(we),ue(c.$$.fragment,we),we.forEach(_),I=L($e),m=p($e,"BUTTON",{type:!0,class:!0,title:!0});var Te=$(m);w=p(Te,"SPAN",{class:!0,"data-svelte-h":!0}),ne(w)!=="svelte-yzd8i4"&&(w.textContent=P),b=L(Te),ue(S.$$.fragment,Te),Te.forEach(_),$e.forEach(_),ye.forEach(_),k=L(U),U.forEach(_),this.h()},h(){d(e,"datetime",f=n[23].created_at),d(e,"class","svelte-8fkf35"),d(a,"class","date svelte-8fkf35"),d(v,"class","logType svelte-8fkf35"),d(M,"class","message svelte-8fkf35"),d(K,"class","label"),d(y,"type","button"),d(y,"class","button svelte-8fkf35"),d(y,"title","Copy message"),d(w,"class","label"),d(m,"type","button"),d(m,"class","button svelte-8fkf35"),d(m,"title","Pin this log"),ae(m,"active",n[2].find(Ie)),d(R,"class","svelte-8fkf35"),d(D,"class","actions svelte-8fkf35"),d(t,"class","svelte-8fkf35"),ae(t,"hidden",n[1]&&n[5](n[23])||n[23].hidden),ae(t,"error",n[23].error_type.match(/error/i)),ae(t,"fresh",n[23].downloaded_at>n[4].logs.downloaded_at[0])},m(J,U){B(J,t,U),u(t,a),u(a,e),u(e,o),u(e,s),u(e,i),u(t,h),u(t,v),u(v,z),u(t,H),u(t,M),x[F].m(M,null),u(M,j),G&&G.m(M,null),u(t,q),u(t,D),u(D,R),u(R,y),u(y,K),u(y,Y),fe(c,y,null),u(R,I),u(R,m),u(m,w),u(m,b),fe(S,m,null),u(t,k),N=!0,Z||(de=[le(y,"click",We),le(m,"click",ft(Ye))],Z=!0)},p(J,U){var he;n=J,(!N||U&16)&&l!==(l=new Date(n[23].created_at).toLocaleDateString(void 0,{})+"")&&W(o,l),(!N||U&16)&&r!==(r=new Date(n[23].created_at).toLocaleTimeString(void 0,{})+"")&&W(i,r),(!N||U&16&&f!==(f=n[23].created_at))&&d(e,"datetime",f),(!N||U&16)&&A!==(A=n[23].error_type+"")&&W(z,A);let me=F;F=_e(n),F===me?x[F].p(n,U):(re(),V(x[me],1,1,()=>{x[me]=null}),oe(),T=x[F],T?T.p(n,U):(T=x[F]=se[F](n),T.c()),E(T,1),T.m(M,j)),(he=n[23].data)!=null&&he.url?G?G.p(n,U):(G=Me(n),G.c(),G.m(M,null)):G&&(G.d(1),G=null),(!N||U&20)&&ae(m,"active",n[2].find(Ie)),(!N||U&50)&&ae(t,"hidden",n[1]&&n[5](n[23])||n[23].hidden),(!N||U&16)&&ae(t,"error",n[23].error_type.match(/error/i)),(!N||U&16)&&ae(t,"fresh",n[23].downloaded_at>n[4].logs.downloaded_at[0])},i(J){N||(E(T),E(c.$$.fragment,J),E(S.$$.fragment,J),J&&(O||rt(()=>{O=it(t,dt,{duration:200}),O.start()})),N=!0)},o(J){V(T),V(c.$$.fragment,J),V(S.$$.fragment,J),N=!1},d(J){J&&_(t),x[F].d(),G&&G.d(),ie(c),ie(S),Z=!1,Ke(de)}}}function je(n){let t,a="No newer logs to show<br/>Checking every 3 seconds";return{c(){t=g("footer"),t.innerHTML=a,this.h()},l(e){t=p(e,"FOOTER",{class:!0,"data-svelte-h":!0}),ne(t)!=="svelte-akhvzo"&&(t.innerHTML=a),this.h()},h(){d(t,"class","svelte-8fkf35")},m(e,l){B(e,t,l)},d(e){e&&_(t)}}}function Re(n){let t,a;return t=new _t({props:{$$slots:{default:[Tt]},$$scope:{ctx:n}}}),{c(){ce(t.$$.fragment)},l(e){ue(t.$$.fragment,e)},m(e,l){fe(t,e,l),a=!0},p(e,l){const o={};l&536870916&&(o.$$scope={dirty:l,ctx:e}),t.$set(o)},i(e){a||(E(t.$$.fragment,e),a=!0)},o(e){V(t.$$.fragment,e),a=!1},d(e){ie(t,e)}}}function qe(n){let t,a,e=Le(n[2]),l=[];for(let s=0;s<e.length;s+=1)l[s]=He(Pe(n,e,s));const o=s=>V(l[s],1,1,()=>{l[s]=null});return{c(){t=g("ul");for(let s=0;s<l.length;s+=1)l[s].c()},l(s){t=p(s,"UL",{});var r=$(t);for(let i=0;i<l.length;i+=1)l[i].l(r);r.forEach(_)},m(s,r){B(s,t,r);for(let i=0;i<l.length;i+=1)l[i]&&l[i].m(t,null);a=!0},p(s,r){if(r&68){e=Le(s[2]);let i;for(i=0;i<e.length;i+=1){const f=Pe(s,e,i);l[i]?(l[i].p(f,r),E(l[i],1)):(l[i]=He(f),l[i].c(),E(l[i],1),l[i].m(t,null))}for(re(),i=e.length;i<l.length;i+=1)o(i);oe()}},i(s){if(!a){for(let r=0;r<e.length;r+=1)E(l[r]);a=!0}},o(s){l=l.filter(Boolean);for(let r=0;r<l.length;r+=1)V(l[r]);a=!1},d(s){s&&_(t),Qe(l,s)}}}function ze(n){let t,a=n[23].data.url+"",e;return{c(){t=g("div"),e=X(a),this.h()},l(l){t=p(l,"DIV",{class:!0});var o=$(t);e=Q(o,a),o.forEach(_),this.h()},h(){d(t,"class","url svelte-8fkf35")},m(l,o){B(l,t,o),u(t,e)},p(l,o){o&4&&a!==(a=l[23].data.url+"")&&W(e,a)},d(l){l&&_(t)}}}function kt(n){let t;function a(o,s){return o[23].showFull?wt:$t}let e=a(n),l=e(n);return{c(){t=g("div"),l.c(),this.h()},l(o){t=p(o,"DIV",{class:!0});var s=$(t);l.l(s),s.forEach(_),this.h()},h(){d(t,"class","pre svelte-8fkf35")},m(o,s){B(o,t,s),l.m(t,null)},p(o,s){e===(e=a(o))&&l?l.p(o,s):(l.d(1),l=e(o),l&&(l.c(),l.m(t,null)))},i:ve,o:ve,d(o){o&&_(t),l.d()}}}function bt(n){let t,a;return t=new Ge({props:{value:n[24],showFullLines:!0}}),{c(){ce(t.$$.fragment)},l(e){ue(t.$$.fragment,e)},m(e,l){fe(t,e,l),a=!0},p(e,l){const o={};l&4&&(o.value=e[24]),t.$set(o)},i(e){a||(E(t.$$.fragment,e),a=!0)},o(e){V(t.$$.fragment,e),a=!1},d(e){ie(t,e)}}}function $t(n){let t=n[23].message.substr(0,ee)+"",a,e,l,o=n[23].message.length>ee&&Je(n);return{c(){a=X(t),e=C(),o&&o.c(),l=Ee()},l(s){a=Q(s,t),e=L(s),o&&o.l(s),l=Ee()},m(s,r){B(s,a,r),B(s,e,r),o&&o.m(s,r),B(s,l,r)},p(s,r){r&4&&t!==(t=s[23].message.substr(0,ee)+"")&&W(a,t),s[23].message.length>ee?o?o.p(s,r):(o=Je(s),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null)},d(s){s&&(_(a),_(e),_(l)),o&&o.d(s)}}}function wt(n){let t=n[23].message+"",a;return{c(){a=X(t)},l(e){a=Q(e,t)},m(e,l){B(e,a,l)},p(e,l){l&4&&t!==(t=e[23].message+"")&&W(a,t)},d(e){e&&_(a)}}}function Je(n){let t,a=n[23].message.length-ee+"",e,l,o,s;function r(){return n[17](n[23],n[25],n[26])}return{c(){t=g("button"),e=X(a),l=X(" more characters"),this.h()},l(i){t=p(i,"BUTTON",{type:!0,class:!0});var f=$(t);e=Q(f,a),l=Q(f," more characters"),f.forEach(_),this.h()},h(){d(t,"type","button"),d(t,"class","svelte-8fkf35")},m(i,f){B(i,t,f),u(t,e),u(t,l),o||(s=le(t,"click",r),o=!0)},p(i,f){n=i,f&4&&a!==(a=n[23].message.length-ee+"")&&W(e,a)},d(i){i&&_(t),o=!1,s()}}}function He(n){var P;let t,a,e,l=new Date(n[23].created_at).toLocaleDateString(void 0,{})+"",o,s,r=new Date(n[23].created_at).toLocaleTimeString(void 0,{})+"",i,f,h,v,A,z="Remove log from pinned panel",H,M,F,T,j,q,D,R,y,K,te;M=new ke({props:{icon:"trash",size:"18"}});function Y(){return n[16](n[23])}let c=((P=n[23].data)==null?void 0:P.url)&&ze(n);const I=[bt,kt],m=[];function w(b,S){return b[24]?0:1}return q=w(n),D=m[q]=I[q](n),{c(){t=g("li"),a=g("div"),e=g("time"),o=X(l),s=C(),i=X(r),h=C(),v=g("button"),A=g("span"),A.textContent=z,H=C(),ce(M.$$.fragment),F=C(),c&&c.c(),T=C(),j=g("div"),D.c(),R=C(),this.h()},l(b){t=p(b,"LI",{class:!0});var S=$(t);a=p(S,"DIV",{class:!0});var k=$(a);e=p(k,"TIME",{class:!0,datetime:!0});var O=$(e);o=Q(O,l),s=L(O),i=Q(O,r),O.forEach(_),h=L(k),v=p(k,"BUTTON",{type:!0,title:!0,class:!0});var N=$(v);A=p(N,"SPAN",{class:!0,"data-svelte-h":!0}),ne(A)!=="svelte-flzfhp"&&(A.textContent=z),H=L(N),ue(M.$$.fragment,N),N.forEach(_),k.forEach(_),F=L(S),c&&c.l(S),T=L(S),j=p(S,"DIV",{class:!0});var Z=$(j);D.l(Z),Z.forEach(_),R=L(S),S.forEach(_),this.h()},h(){d(e,"class","date svelte-8fkf35"),d(e,"datetime",f=n[23].created_at),d(A,"class","label"),d(v,"type","button"),d(v,"title","Remove log from pinned panel"),d(v,"class","svelte-8fkf35"),d(a,"class","info svelte-8fkf35"),d(j,"class","message svelte-8fkf35"),d(t,"class","svelte-8fkf35")},m(b,S){B(b,t,S),u(t,a),u(a,e),u(e,o),u(e,s),u(e,i),u(a,h),u(a,v),u(v,A),u(v,H),fe(M,v,null),u(t,F),c&&c.m(t,null),u(t,T),u(t,j),m[q].m(j,null),u(t,R),y=!0,K||(te=le(v,"click",Y),K=!0)},p(b,S){var O;n=b,(!y||S&4)&&l!==(l=new Date(n[23].created_at).toLocaleDateString(void 0,{})+"")&&W(o,l),(!y||S&4)&&r!==(r=new Date(n[23].created_at).toLocaleTimeString(void 0,{})+"")&&W(i,r),(!y||S&4&&f!==(f=n[23].created_at))&&d(e,"datetime",f),(O=n[23].data)!=null&&O.url?c?c.p(n,S):(c=ze(n),c.c(),c.m(t,T)):c&&(c.d(1),c=null);let k=q;q=w(n),q===k?m[q].p(n,S):(re(),V(m[k],1,1,()=>{m[k]=null}),oe(),D=m[q],D?D.p(n,S):(D=m[q]=I[q](n),D.c()),E(D,1),D.m(j,null))},i(b){y||(E(M.$$.fragment,b),E(D),y=!0)},o(b){V(M.$$.fragment,b),V(D),y=!1},d(b){b&&_(t),ie(M),c&&c.d(),m[q].d(),K=!1,te()}}}function Tt(n){let t,a,e,l="Clear pinned logs",o,s,r,i,f=n[2]&&qe(n);return{c(){t=g("div"),a=g("nav"),e=g("button"),e.textContent=l,o=C(),f&&f.c(),this.h()},l(h){t=p(h,"DIV",{class:!0});var v=$(t);a=p(v,"NAV",{class:!0});var A=$(a);e=p(A,"BUTTON",{type:!0,class:!0,"data-svelte-h":!0}),ne(e)!=="svelte-eeid91"&&(e.textContent=l),A.forEach(_),o=L(v),f&&f.l(v),v.forEach(_),this.h()},h(){d(e,"type","button"),d(e,"class","button svelte-8fkf35"),d(a,"class","asideNav svelte-8fkf35"),d(t,"class","pins svelte-8fkf35")},m(h,v){B(h,t,v),u(t,a),u(a,e),u(t,o),f&&f.m(t,null),s=!0,r||(i=le(e,"click",n[15]),r=!0)},p(h,v){h[2]?f?(f.p(h,v),v&4&&E(f,1)):(f=qe(h),f.c(),E(f,1),f.m(t,null)):f&&(re(),V(f,1,1,()=>{f=null}),oe())},i(h){s||(E(f),s=!0)},o(h){V(f),s=!1},d(h){h&&_(t),f&&f.d(),r=!1,i()}}}function Et(n){var S;let t,a,e,l,o,s,r,i="Filter:",f,h,v,A,z,H,M="Clear screen",F,T,j,q="Toggle pinned logs panel",D,R,y,K,te,Y,c,I;Ce.title=t="Logs"+((S=n[4].online)!=null&&S.MPKIT_URL?": "+n[4].online.MPKIT_URL.replace("https://",""):"");let m=n[1]&&Ue(n);R=new ke({props:{icon:"pin"}});let w=n[4].logs.logs&&Ve(n),P=!n[1]&&je(),b=n[3]&&Re(n);return{c(){a=C(),e=g("div"),l=g("section"),o=g("nav"),s=g("form"),r=g("label"),r.textContent=i,f=C(),h=g("input"),v=C(),m&&m.c(),A=C(),z=g("div"),H=g("button"),H.textContent=M,F=C(),T=g("button"),j=g("span"),j.textContent=q,D=C(),ce(R.$$.fragment),y=C(),w&&w.c(),K=C(),P&&P.c(),te=C(),b&&b.c(),this.h()},l(k){tt("svelte-dfdkqr",Ce.head).forEach(_),a=L(k),e=p(k,"DIV",{class:!0});var N=$(e);l=p(N,"SECTION",{class:!0});var Z=$(l);o=p(Z,"NAV",{class:!0});var de=$(o);s=p(de,"FORM",{});var se=$(s);r=p(se,"LABEL",{for:!0,"data-svelte-h":!0}),ne(r)!=="svelte-kf6j7o"&&(r.textContent=i),f=L(se),h=p(se,"INPUT",{type:!0,id:!0,class:!0}),v=L(se),m&&m.l(se),se.forEach(_),A=L(de),z=p(de,"DIV",{class:!0});var x=$(z);H=p(x,"BUTTON",{type:!0,class:!0,"data-svelte-h":!0}),ne(H)!=="svelte-1hlqgjb"&&(H.textContent=M),F=L(x),T=p(x,"BUTTON",{type:!0,title:!0,class:!0});var _e=$(T);j=p(_e,"SPAN",{class:!0,"data-svelte-h":!0}),ne(j)!=="svelte-1o6petk"&&(j.textContent=q),D=L(_e),ue(R.$$.fragment,_e),_e.forEach(_),x.forEach(_),de.forEach(_),y=L(Z),w&&w.l(Z),K=L(Z),P&&P.l(Z),Z.forEach(_),te=L(N),b&&b.l(N),N.forEach(_),this.h()},h(){d(r,"for","filter"),d(h,"type","text"),d(h,"id","filter"),d(h,"class","svelte-8fkf35"),d(H,"type","button"),d(H,"class","button"),d(j,"class","label"),d(T,"type","button"),d(T,"title","Toggle pinned logs panel"),d(T,"class","button"),d(z,"class","svelte-8fkf35"),d(o,"class","svelte-8fkf35"),d(l,"class","logs svelte-8fkf35"),d(e,"class","container svelte-8fkf35")},m(k,O){B(k,a,O),B(k,e,O),u(e,l),u(l,o),u(o,s),u(s,r),u(s,f),u(s,h),Ne(h,n[1]),u(s,v),m&&m.m(s,null),u(o,A),u(o,z),u(z,H),u(z,F),u(z,T),u(T,j),u(T,D),fe(R,T,null),u(l,y),w&&w.m(l,null),u(l,K),P&&P.m(l,null),u(e,te),b&&b.m(e,null),n[18](e),Y=!0,c||(I=[le(h,"input",n[8]),le(H,"click",n[10]),le(T,"click",n[7])],c=!0)},p(k,[O]){var N;(!Y||O&16)&&t!==(t="Logs"+((N=k[4].online)!=null&&N.MPKIT_URL?": "+k[4].online.MPKIT_URL.replace("https://",""):""))&&(Ce.title=t),O&2&&h.value!==k[1]&&Ne(h,k[1]),k[1]?m?(m.p(k,O),O&2&&E(m,1)):(m=Ue(k),m.c(),E(m,1),m.m(s,null)):m&&(re(),V(m,1,1,()=>{m=null}),oe()),k[4].logs.logs?w?(w.p(k,O),O&16&&E(w,1)):(w=Ve(k),w.c(),E(w,1),w.m(l,K)):w&&(re(),V(w,1,1,()=>{w=null}),oe()),k[1]?P&&(P.d(1),P=null):P||(P=je(),P.c(),P.m(l,null)),k[3]?b?(b.p(k,O),O&8&&E(b,1)):(b=Re(k),b.c(),E(b,1),b.m(e,null)):b&&(re(),V(b,1,1,()=>{b=null}),oe())},i(k){Y||(E(m),E(R.$$.fragment,k),E(w),E(b),Y=!0)},o(k){V(m),V(R.$$.fragment,k),V(w),V(b),Y=!1},d(k){k&&(_(a),_(e)),m&&m.d(),ie(R),w&&w.d(),P&&P.d(),b&&b.d(),n[18](null),c=!1,Ke(I)}}}let ee=262144;function Lt(n,t,a){let e;lt(n,pe,c=>a(4,e=c));let l,o="",s=[],r,i;st(()=>(f(),A(),i=setInterval(()=>{document.visibilityState!=="hidden"&&f()},3e3),()=>clearInterval(i)));const f=async()=>{var m,w,P;const c=((w=(m=e.logs.logs)==null?void 0:m.at(-1))==null?void 0:w.id)??null,I=await ht.get({last:c});c?(P=I.logs)!=null&&P.length&&(ge(pe,e.logs.logs=[...e.logs.logs,...I.logs],e),e.logs.downloaded_at.push(Date.now()),e.logs.downloaded_at.length>2&&e.logs.downloaded_at.splice(0,1)):e.logs.logs||(ge(pe,e.logs=I,e),e.logs.downloaded_at||ge(pe,e.logs.downloaded_at=[Date.now()],e))},h=c=>c.hidden===!0||c.error_type.toLowerCase().indexOf(o)===-1&&c.message.toLowerCase().indexOf(o)===-1;let v=!1;nt(()=>{{const c=document.querySelector(".logs");c&&Math.abs(c.scrollHeight-c.scrollTop-c.clientHeight)<10&&(v=!1)}}),at(async()=>{var c;v||(await ut(),document.querySelector("footer").scrollIntoView(),(c=e.logs.logs)!=null&&c.length&&(v=!0))});const A=()=>{a(3,r=localStorage.pinnedPanel==="true"),a(2,s=localStorage.pinnedLogs?JSON.parse(localStorage.pinnedLogs):[])},z=c=>{s.find(I=>I.id===c.id)?a(2,s=s.filter(I=>I.id!==c.id)):a(2,s=[...s,c]),localStorage.pinnedLogs=JSON.stringify(s)},H=()=>{r?(a(3,r=!1),localStorage.pinnedPanel=!1):(a(3,r=!0),localStorage.pinnedPanel=!0)};function M(){o=this.value,a(1,o)}const F=()=>a(1,o=""),T=()=>e.logs.logs.forEach((c,I)=>ge(pe,e.logs.logs[I].hidden=!0,e)),j=(c,I,m)=>ge(pe,I[m].showFull=!0,e),q=(c,I)=>navigator.clipboard.writeText(c.message).then(()=>{I.target.classList.add("confirmation"),setTimeout(()=>I.target.classList.remove("confirmation"),1e3)}),D=c=>z(c),R=(c,I)=>I.id===c.id,y=()=>{localStorage.pinnedLogs=[],a(2,s=[])},K=c=>z(c),te=(c,I,m)=>a(2,I[m].showFull=!0,s);function Y(c){ot[c?"unshift":"push"](()=>{l=c,a(0,l)})}return[l,o,s,r,e,h,z,H,M,F,T,j,q,D,R,y,K,te,Y]}class Bt extends Ze{constructor(t){super(),xe(this,t,Lt,Et,et,{})}}export{Bt as component};