UNPKG

@platformos/pos-cli

Version:
2 lines (1 loc) 6.94 kB
import{S as ae,i as oe,s as re,d as g,E as P,o as C,p as v,z as h,Q as N,b as T,I as q,c as k,J as ne,e as b,f as D,L as z,h as Q,K as U,j as $,M as A,k as V,ad as ie,v as ce,l as Z,a as H,R as O,H as F,g as B,y as x,t as K,N as ee,n as te}from"../chunks/n7YEDvJi.js";import"../chunks/IHki7fMi.js";import{p as ue}from"../chunks/DjNrOAme.js";import{l as fe}from"../chunks/twsCDidx.js";import{s as J}from"../chunks/Bp_ajb_u.js";import{t as pe}from"../chunks/x4PJc0Qf.js";import{A as me}from"../chunks/CqRAXfEk.js";import{J as _e}from"../chunks/CMNnzBs7.js";import{I as de}from"../chunks/DHO4ENnJ.js";function ge(r){let e,t,s,l,n="Copy",o,c,a,u;return t=new de({props:{icon:r[0]?"check":r[2]?"x":"copy",size:"16"}}),{c(){e=$("button"),A(t.$$.fragment),s=V(),l=$("span"),l.textContent=n,this.h()},l(i){e=b(i,"BUTTON",{title:!0,class:!0,"aria-disabled":!0});var _=D(e);z(t.$$.fragment,_),s=Q(_),l=b(_,"SPAN",{class:!0,"data-svelte-h":!0}),U(l)!=="svelte-uxc2fm"&&(l.textContent=n),_.forEach(g),this.h()},h(){h(l,"class","label"),h(e,"title","Copy message to clipboard"),h(e,"class","button compact svelte-kur7tm"),h(e,"aria-disabled",o=r[1]||r[0]||r[2]),N(e,"progressing",r[1])},m(i,_){T(i,e,_),q(t,e,null),k(e,s),k(e,l),c=!0,a||(u=ne(e,"click",r[3]),a=!0)},p(i,[_]){const w={};_&5&&(w.icon=i[0]?"check":i[2]?"x":"copy"),t.$set(w),(!c||_&7&&o!==(o=i[1]||i[0]||i[2]))&&h(e,"aria-disabled",o),(!c||_&2)&&N(e,"progressing",i[1])},i(i){c||(v(t.$$.fragment,i),c=!0)},o(i){C(t.$$.fragment,i),c=!1},d(i){i&&g(e),P(t),a=!1,u()}}}function he(r,e,t){let{text:s}=e,l=!1,n=!1,o=!1;const c=()=>{t(1,n=!0),navigator.clipboard.writeText(s.toString()).then(()=>{setTimeout(()=>{t(0,l=!0)},150),setTimeout(()=>{t(1,n=!1)},300),setTimeout(()=>{t(1,n=!0)},2300),setTimeout(()=>{t(0,l=!1)},2450),setTimeout(()=>{t(1,n=!1)},2600)}).catch(a=>{t(1,n=!1),t(2,o=!0),console.error(a)})};return r.$$set=a=>{"text"in a&&t(4,s=a.text)},[l,n,o,c,s]}class ve extends ae{constructor(e){super(),oe(this,e,he,ge,re,{text:4})}}function M(r){const e=r.slice(),t=pe(e[1].logv2.message);return e[3]=t,e}function se(r){let e,t="Message:",s,l,n;return l=new ve({props:{text:r[1].logv2.message}}),{c(){e=$("dt"),e.textContent=t,s=$("dd"),A(l.$$.fragment),this.h()},l(o){e=b(o,"DT",{"data-svelte-h":!0}),U(e)!=="svelte-j9d3r1"&&(e.textContent=t),s=b(o,"DD",{class:!0});var c=D(s);z(l.$$.fragment,c),c.forEach(g),this.h()},h(){h(s,"class","svelte-2gl9bd")},m(o,c){T(o,e,c),T(o,s,c),q(l,s,null),n=!0},p(o,c){const a={};c&2&&(a.text=o[1].logv2.message),l.$set(a)},i(o){n||(v(l.$$.fragment,o),n=!0)},o(o){C(l.$$.fragment,o),n=!1},d(o){o&&(g(e),g(s)),P(l)}}}function le(r){let e,t,s,l;const n=[$e,be],o=[];function c(a,u){return a[3]?0:1}return t=c(r),s=o[t]=n[t](r),{c(){e=$("div"),s.c(),this.h()},l(a){e=b(a,"DIV",{class:!0});var u=D(e);s.l(u),u.forEach(g),this.h()},h(){h(e,"class","code svelte-2gl9bd"),N(e,"json",r[3])},m(a,u){T(a,e,u),o[t].m(e,null),l=!0},p(a,u){let i=t;t=c(a),t===i?o[t].p(a,u):(O(),C(o[i],1,1,()=>{o[i]=null}),F(),s=o[t],s?s.p(a,u):(s=o[t]=n[t](a),s.c()),v(s,1),s.m(e,null)),(!l||u&2)&&N(e,"json",a[3])},i(a){l||(v(s),l=!0)},o(a){C(s),l=!1},d(a){a&&g(e),o[t].d()}}}function be(r){let e=r[1].logv2.message+"",t;return{c(){t=K(e)},l(s){t=B(s,e)},m(s,l){T(s,t,l)},p(s,l){l&2&&e!==(e=s[1].logv2.message+"")&&H(t,e)},i:te,o:te,d(s){s&&g(t)}}}function $e(r){let e,t;return e=new _e({props:{value:r[3],showFullLines:!0}}),{c(){A(e.$$.fragment)},l(s){z(e.$$.fragment,s)},m(s,l){q(e,s,l),t=!0},p(s,l){const n={};l&2&&(n.value=s[3]),e.$set(n)},i(s){t||(v(e.$$.fragment,s),t=!0)},o(s){C(e.$$.fragment,s),t=!1},d(s){P(e,s)}}}function ke(r){var G,W,X;let e,t,s="Time:",l,n=new Date(((G=r[1].logv2)==null?void 0:G.options_at)/1e3).toLocaleString()+"",o,c,a="URL:",u,i,_=new URL("https://"+((W=r[1].logv2)==null?void 0:W.options_data_url)).pathname+new URL("https://"+((X=r[1].logv2)==null?void 0:X.options_data_url)).search+"",w,R,I,S,L,p=r[1].logv2.message&&se(r),m=r[1].logv2.message&&le(M(r));return{c(){e=$("dl"),t=$("dt"),t.textContent=s,l=$("dd"),o=K(n),c=$("dt"),c.textContent=a,u=$("dd"),i=$("a"),w=K(_),p&&p.c(),I=V(),m&&m.c(),S=x(),this.h()},l(f){e=b(f,"DL",{class:!0});var d=D(e);t=b(d,"DT",{"data-svelte-h":!0}),U(t)!=="svelte-toke4h"&&(t.textContent=s),l=b(d,"DD",{class:!0});var y=D(l);o=B(y,n),y.forEach(g),c=b(d,"DT",{"data-svelte-h":!0}),U(c)!=="svelte-vrqyfv"&&(c.textContent=a),u=b(d,"DD",{class:!0});var E=D(u);i=b(E,"A",{href:!0,class:!0});var j=D(i);w=B(j,_),j.forEach(g),E.forEach(g),p&&p.l(d),d.forEach(g),I=Q(f),m&&m.l(f),S=x(),this.h()},h(){var f;h(l,"class","svelte-2gl9bd"),h(i,"href",R="https://"+((f=r[1].logv2)==null?void 0:f.options_data_url)),h(i,"class","svelte-2gl9bd"),h(u,"class","svelte-2gl9bd"),h(e,"class","svelte-2gl9bd")},m(f,d){T(f,e,d),k(e,t),k(e,l),k(l,o),k(e,c),k(e,u),k(u,i),k(i,w),p&&p.m(e,null),T(f,I,d),m&&m.m(f,d),T(f,S,d),L=!0},p(f,d){var y,E,j,Y;(!L||d&2)&&n!==(n=new Date(((y=f[1].logv2)==null?void 0:y.options_at)/1e3).toLocaleString()+"")&&H(o,n),(!L||d&2)&&_!==(_=new URL("https://"+((E=f[1].logv2)==null?void 0:E.options_data_url)).pathname+new URL("https://"+((j=f[1].logv2)==null?void 0:j.options_data_url)).search+"")&&H(w,_),(!L||d&2&&R!==(R="https://"+((Y=f[1].logv2)==null?void 0:Y.options_data_url)))&&h(i,"href",R),f[1].logv2.message?p?(p.p(f,d),d&2&&v(p,1)):(p=se(f),p.c(),v(p,1),p.m(e,null)):p&&(O(),C(p,1,1,()=>{p=null}),F()),f[1].logv2.message?m?(m.p(M(f),d),d&2&&v(m,1)):(m=le(M(f)),m.c(),v(m,1),m.m(S.parentNode,S)):m&&(O(),C(m,1,1,()=>{m=null}),F())},i(f){L||(v(p),v(m),L=!0)},o(f){C(p),C(m),L=!1},d(f){f&&(g(e),g(I),g(S)),p&&p.d(),m&&m.d(f)}}}function Ce(r){var c;let e,t="",s,l,n,o;return n=new me({props:{title:((c=r[1].logv2)==null?void 0:c.type)??"Loading…",closeUrl:"/logsv2?"+r[0].url.searchParams.toString(),$$slots:{default:[ke]},$$scope:{ctx:r}}}),{c(){e=$("script"),e.innerHTML=t,l=V(),A(n.$$.fragment),this.h()},l(a){const u=ce("svelte-1pgpgj4",document.head);e=b(u,"SCRIPT",{src:!0,"data-manual":!0,"data-svelte-h":!0}),U(e)!=="svelte-6mxszl"&&(e.innerHTML=t),u.forEach(g),l=Q(a),z(n.$$.fragment,a),this.h()},h(){ie(e.src,s="/prism.js")||h(e,"src",s),h(e,"data-manual","")},m(a,u){k(document.head,e),T(a,l,u),q(n,a,u),o=!0},p(a,[u]){var _;const i={};u&2&&(i.title=((_=a[1].logv2)==null?void 0:_.type)??"Loading…"),u&1&&(i.closeUrl="/logsv2?"+a[0].url.searchParams.toString()),u&18&&(i.$$scope={dirty:u,ctx:a}),n.$set(i)},i(a){o||(v(n.$$.fragment,a),o=!0)},o(a){C(n.$$.fragment,a),o=!1},d(a){a&&g(l),g(e),P(n,a)}}}function Te(r,e,t){let s,l;Z(r,ue,o=>t(0,s=o)),Z(r,J,o=>t(1,l=o));const n=async()=>{var c;const o=(c=l.logsv2.hits)==null?void 0:c.find(a=>a._timestamp==s.params.id);if(o)ee(J,l.logv2=o,l);else{const a={size:1,sql:`select * from logs where _timestamp = ${s.params.id}`};await fe.get(a).then(u=>{ee(J,l.logv2=u.hits[0],l)})}};return r.$$.update=()=>{r.$$.dirty&1&&s.params.id&&n()},[s,l]}class Ie extends ae{constructor(e){super(),oe(this,e,Te,Ce,re,{})}}export{Ie as component};