import{B as e,C as t,Ct as n,F as r,Ft as i,H as a,It as o,J as ee,K as s,L as c,Mt as te,Q as l,R as u,T as d,V as f,W as p,Z as m,_t as h,at as g,d as _,ft as v,ht as y,jt as b,mt as x,ot as S,q as C,s as w,st as T,tt as E,w as D,wt as O,yt as k}from"./BA99CCI5.js";import"./xihTtKlq.js";import"./DGo8yE5j.js";import{t as ne}from"./BB59mDRy.js";import{t as re}from"./_ZYKMtmp.js";import{n as ie,t as ae}from"./DC11RaJ72.js";import{t as oe}from"./B66v-P2b.js";import{t as se}from"./DcKM5OzB2.js";import{t as ce}from"./BBtCGbx62.js";import{n as A,r as le,t as ue}from"./DSNLgKve.js";var de=p(`<option> </option>`),fe=p(`<div class="relative"><select class="appearance-none rounded bg-neutral-100 py-0.5 pr-5 pl-1.5 font-mono text-[10px] font-medium text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500"></select> <!></div>`),pe=p(`<span> </span>`),me=p(`<div class="code-block overflow-hidden rounded-xl border border-neutral-300 dark:border-neutral-700/60 svelte-q9zb38"><div class="flex flex-wrap items-center gap-2 border-b border-neutral-200 bg-neutral-50 px-3 py-2 dark:border-neutral-700/60 dark:bg-neutral-900"><!> <!> <div class="ml-auto flex items-center gap-2"><!> <!></div></div> <div><pre class="overflow-x-auto p-3 text-xs leading-5 whitespace-pre"><code></code></pre></div></div>`);function j(p,C){te(C,!1);let j=()=>O(se,`$themeStore`,he),[he,ge]=n(),M=y(),N=y(),P=y(),F=y(),I=y(),L=y(),R=w(C,`code`,8,``),z=w(C,`language`,8,`sql`),_e=w(C,`copyable`,8,!0),B=y(!1),V=null,H=y(localStorage.getItem(`code-theme`)||`Default`);function U(e,t){return t[e]??void 0}function ve(e){h(H,e),localStorage.setItem(`code-theme`,e)}async function ye(){await ae(R())&&(h(B,!0),V&&clearTimeout(V),V=setTimeout(()=>{h(B,!1)},2e3))}g(()=>l(H),()=>{h(M,ue(l(H)))}),g(()=>(j(),l(M)),()=>{h(N,j()===`dark`?l(M).dark:l(M).light)}),g(()=>(m(R()),m(z())),()=>{h(P,le(R(),z()))}),g(()=>m(z()),()=>{h(F,z()===`sql`?`SQL`:z()===`json`?`JSON`:z())}),g(()=>m(z()),()=>{h(I,z()===`sql`?`info`:`secondary`)}),g(()=>m(z()),()=>{h(L,z()===`json`?`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200`:``)}),S(),_();var W=me(),G=v(W),K=v(G);ce(K,{get variant(){return l(I)},get customVariant(){return l(L)},size:`sm`,rounded:`md`,mono:!0,children:(e,t)=>{i();var n=s();T(()=>f(n,l(F))),a(e,n)},$$slots:{default:!0}});var q=x(K,2);r(q,C,`header`,{},null);var J=x(q,2),Y=v(J),X=e=>{var n=fe(),r=v(n);c(r,5,()=>A,u,(e,t)=>{var n=de(),r=v(n,!0);o(n);var i={};T(()=>{f(r,(l(t),E(()=>l(t).name))),i!==(i=(l(t),E(()=>l(t).name)))&&(n.value=(n.__value=(l(t),E(()=>l(t).name)))??``)}),a(e,n)}),o(r);var i;t(r);var s=x(r,2);re(s,{size:10,class:`pointer-events-none absolute top-1/2 right-1 -translate-y-1/2 text-neutral-400 dark:text-neutral-500`}),o(n),T(()=>{i!==(i=l(H))&&(r.value=(r.__value=l(H))??``,D(r,l(H)))}),ee(`change`,r,e=>ve(e.currentTarget.value)),a(e,n)};e(Y,e=>{m(A),E(()=>A.length>1)&&e(X)});var be=x(Y,2),xe=e=>{{let t=k(()=>l(B)?ne:ie),n=k(()=>l(B)?`text-green-500`:``);oe(e,{get icon(){return l(t)},get iconColor(){return l(n)},size:`xs`,variant:`secondary`,title:`Copy to clipboard`,$$events:{click:ye}})}};e(be,e=>{_e()&&e(xe)}),o(J),o(G);var Z=x(G,2),Q=v(Z),$=v(Q);c($,5,()=>l(P),u,(e,t)=>{var n=pe(),r=v(n,!0);o(n),T(e=>{d(n,e),f(r,(l(t),E(()=>l(t).text)))},[()=>(l(t),l(N),E(()=>U(l(t).type,l(N))?`color: ${U(l(t).type,l(N))}`:``))]),a(e,n)}),o($),o(Q),o(Z),o(W),T(()=>{d(Z,`background-color: ${l(N),E(()=>l(N).bg)??``}`),d(Q,`color: ${l(N),E(()=>l(N).text)??``}`)}),a(p,W),b(),ge()}C([`change`]);export{j as t};