DuyTa's picture
Upload folder using huggingface_hub
bc20498 verified
import{s as De,B as Ie,E as Ze,p as qe,j as be,e as v,c as $,a as k,d as u,f as d,i as y,r as Xe,v as Ye,w as et,x as tt,k as H,o as D,t as ee,b as te,g as m,h as re,m as rt,A as $e,C as Le,u as me,J as lt,F as nt,y as Ue,z as je,n as Fe}from"../chunks/scheduler.DB3Sqaa-.js";import{S as Ve,i as Ce,f as Ge,b as R,d as J,m as W,t as P,a as A,e as Z,g as st,c as ot}from"../chunks/index.CidI1d1E.js";import{e as ze}from"../chunks/each.cN4tVpvB.js";import{t as Oe}from"../chunks/Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";import{f as at}from"../chunks/FileSaver.min.CimDdHIv.js";import{W as it,p as He}from"../chunks/index.DPWiq6NR.js";import{d as ct,g as Re,c as ft}from"../chunks/index.j65IixI3.js";import"../chunks/index.DQfRr7yB.js";import{g as ut}from"../chunks/entry.JtQ7vg2d.js";import{T as dt}from"../chunks/create.DJSy4-Dz.js";import{D as mt,M as we}from"../chunks/Dropdown.6Kb6OfAV.js";import{b as pt}from"../chunks/menu-trigger.Syw7IYi9.js";import{f as ht}from"../chunks/index.DMdt0oYD.js";import{S as _t,D as gt,G as vt}from"../chunks/DocumentDuplicate.B_gNfd5l.js";import"../chunks/sha256.CRlV3BEV.js";import{A as $t,E as wt}from"../chunks/EllipsisHorizontal.TEROWdDo.js";import{C as bt}from"../chunks/ConfirmDialog.BhA26OgX.js";function kt(s){let e;const n=s[8].default,t=Xe(n,s,s[15],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o&32768)&&Ye(t,n,l,l[15],e?tt(n,l[15],o,null):et(l[15]),null)},i(l){e||(P(t,l),e=!0)},o(l){A(t,l),e=!1},d(l){t&&t.d(l)}}}function yt(s){let e,n;return e=new dt({props:{content:s[6].t("More"),$$slots:{default:[kt]},$$scope:{ctx:s}}}),{c(){R(e.$$.fragment)},l(t){J(e.$$.fragment,t)},m(t,l){W(e,t,l),n=!0},p(t,l){const o={};l&64&&(o.content=t[6].t("More")),l&32768&&(o.$$scope={dirty:l,ctx:t}),e.$set(o)},i(t){n||(P(e.$$.fragment,t),n=!0)},o(t){A(e.$$.fragment,t),n=!1},d(t){Z(e,t)}}}function Et(s){let e,n,t,l=s[6].t("Share")+"",o,i;return e=new _t({}),{c(){R(e.$$.fragment),n=H(),t=v("div"),o=ee(l),this.h()},l(r){J(e.$$.fragment,r),n=D(r),t=$(r,"DIV",{class:!0});var a=k(t);o=te(a,l),a.forEach(u),this.h()},h(){d(t,"class","flex items-center")},m(r,a){W(e,r,a),y(r,n,a),y(r,t,a),m(t,o),i=!0},p(r,a){(!i||a&64)&&l!==(l=r[6].t("Share")+"")&&re(o,l)},i(r){i||(P(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){r&&(u(n),u(t)),Z(e,r)}}}function xt(s){let e,n,t,l=s[6].t("Clone")+"",o,i;return e=new gt({}),{c(){R(e.$$.fragment),n=H(),t=v("div"),o=ee(l),this.h()},l(r){J(e.$$.fragment,r),n=D(r),t=$(r,"DIV",{class:!0});var a=k(t);o=te(a,l),a.forEach(u),this.h()},h(){d(t,"class","flex items-center")},m(r,a){W(e,r,a),y(r,n,a),y(r,t,a),m(t,o),i=!0},p(r,a){(!i||a&64)&&l!==(l=r[6].t("Clone")+"")&&re(o,l)},i(r){i||(P(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){r&&(u(n),u(t)),Z(e,r)}}}function Ht(s){let e,n,t,l=s[6].t("Export")+"",o,i;return e=new $t({}),{c(){R(e.$$.fragment),n=H(),t=v("div"),o=ee(l),this.h()},l(r){J(e.$$.fragment,r),n=D(r),t=$(r,"DIV",{class:!0});var a=k(t);o=te(a,l),a.forEach(u),this.h()},h(){d(t,"class","flex items-center")},m(r,a){W(e,r,a),y(r,n,a),y(r,t,a),m(t,o),i=!0},p(r,a){(!i||a&64)&&l!==(l=r[6].t("Export")+"")&&re(o,l)},i(r){i||(P(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){r&&(u(n),u(t)),Z(e,r)}}}function Dt(s){let e,n,t,l=s[6].t("Delete")+"",o,i;return e=new vt({props:{strokeWidth:"2"}}),{c(){R(e.$$.fragment),n=H(),t=v("div"),o=ee(l),this.h()},l(r){J(e.$$.fragment,r),n=D(r),t=$(r,"DIV",{class:!0});var a=k(t);o=te(a,l),a.forEach(u),this.h()},h(){d(t,"class","flex items-center")},m(r,a){W(e,r,a),y(r,n,a),y(r,t,a),m(t,o),i=!0},p(r,a){(!i||a&64)&&l!==(l=r[6].t("Delete")+"")&&re(o,l)},i(r){i||(P(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){r&&(u(n),u(t)),Z(e,r)}}}function It(s){let e,n,t,l,o,i,r,a,p,_;return e=new we({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[Et]},$$scope:{ctx:s}}}),e.$on("click",s[9]),t=new we({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[xt]},$$scope:{ctx:s}}}),t.$on("click",s[10]),o=new we({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[Ht]},$$scope:{ctx:s}}}),o.$on("click",s[11]),p=new we({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[Dt]},$$scope:{ctx:s}}}),p.$on("click",s[12]),{c(){R(e.$$.fragment),n=H(),R(t.$$.fragment),l=H(),R(o.$$.fragment),i=H(),r=v("hr"),a=H(),R(p.$$.fragment),this.h()},l(f){J(e.$$.fragment,f),n=D(f),J(t.$$.fragment,f),l=D(f),J(o.$$.fragment,f),i=D(f),r=$(f,"HR",{class:!0}),a=D(f),J(p.$$.fragment,f),this.h()},h(){d(r,"class","border-gray-100 dark:border-gray-800 my-1")},m(f,g){W(e,f,g),y(f,n,g),W(t,f,g),y(f,l,g),W(o,f,g),y(f,i,g),y(f,r,g),y(f,a,g),W(p,f,g),_=!0},p(f,g){const C={};g&32832&&(C.$$scope={dirty:g,ctx:f}),e.$set(C);const M={};g&32832&&(M.$$scope={dirty:g,ctx:f}),t.$set(M);const T={};g&32832&&(T.$$scope={dirty:g,ctx:f}),o.$set(T);const x={};g&32832&&(x.$$scope={dirty:g,ctx:f}),p.$set(x)},i(f){_||(P(e.$$.fragment,f),P(t.$$.fragment,f),P(o.$$.fragment,f),P(p.$$.fragment,f),_=!0)},o(f){A(e.$$.fragment,f),A(t.$$.fragment,f),A(o.$$.fragment,f),A(p.$$.fragment,f),_=!1},d(f){f&&(u(n),u(l),u(i),u(r),u(a)),Z(e,f),Z(t,f),Z(o,f),Z(p,f)}}}function Vt(s){let e,n,t;return n=new pt({props:{class:"w-full max-w-[160px] rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow",sideOffset:-2,side:"bottom",align:"start",transition:ht,$$slots:{default:[It]},$$scope:{ctx:s}}}),{c(){e=v("div"),R(n.$$.fragment),this.h()},l(l){e=$(l,"DIV",{slot:!0});var o=k(e);J(n.$$.fragment,o),o.forEach(u),this.h()},h(){d(e,"slot","content")},m(l,o){y(l,e,o),W(n,e,null),t=!0},p(l,o){const i={};o&32847&&(i.$$scope={dirty:o,ctx:l}),n.$set(i)},i(l){t||(P(n.$$.fragment,l),t=!0)},o(l){A(n.$$.fragment,l),t=!1},d(l){l&&u(e),Z(n)}}}function Ct(s){let e,n,t;function l(i){s[13](i)}let o={$$slots:{content:[Vt],default:[yt]},$$scope:{ctx:s}};return s[5]!==void 0&&(o.show=s[5]),e=new mt({props:o}),Ie.push(()=>Ge(e,"show",l)),e.$on("change",s[14]),{c(){R(e.$$.fragment)},l(i){J(e.$$.fragment,i)},m(i,r){W(e,i,r),t=!0},p(i,[r]){const a={};r&32847&&(a.$$scope={dirty:r,ctx:i}),!n&&r&32&&(n=!0,a.show=i[5],Ze(()=>n=!1)),e.$set(a)},i(i){t||(P(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){Z(e,i)}}}function Mt(s,e,n){let t,{$$slots:l={},$$scope:o}=e;const i=qe("i18n");be(s,i,b=>n(6,t=b));let{shareHandler:r}=e,{cloneHandler:a}=e,{exportHandler:p}=e,{deleteHandler:_}=e,{onClose:f}=e,g=!1;const C=()=>{r()},M=()=>{a()},T=()=>{p()},x=()=>{_()};function q(b){g=b,n(5,g)}const K=b=>{b.detail===!1&&f()};return s.$$set=b=>{"shareHandler"in b&&n(0,r=b.shareHandler),"cloneHandler"in b&&n(1,a=b.cloneHandler),"exportHandler"in b&&n(2,p=b.exportHandler),"deleteHandler"in b&&n(3,_=b.deleteHandler),"onClose"in b&&n(4,f=b.onClose),"$$scope"in b&&n(15,o=b.$$scope)},[r,a,p,_,f,g,t,i,l,C,M,T,x,q,K,o]}class Tt extends Ve{constructor(e){super(),Ce(this,e,Mt,Ct,De,{shareHandler:0,cloneHandler:1,exportHandler:2,deleteHandler:3,onClose:4})}}function Je(s,e,n){const t=s.slice();return t[27]=e[n],t}function Pt(s){let e,n,t;return n=new wt({props:{className:"size-5"}}),{c(){e=v("button"),R(n.$$.fragment),this.h()},l(l){e=$(l,"BUTTON",{class:!0,type:!0});var o=k(e);J(n.$$.fragment,o),o.forEach(u),this.h()},h(){d(e,"class","self-center w-fit text-sm p-1.5 dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"),d(e,"type","button")},m(l,o){y(l,e,o),W(n,e,null),t=!0},p:Fe,i(l){t||(P(n.$$.fragment,l),t=!0)},o(l){A(n.$$.fragment,l),t=!1},d(l){l&&u(e),Z(n)}}}function We(s){let e,n,t,l,o,i=s[27].command+"",r,a,p,_=s[27].title+"",f,g,C,M,T,x,q,K,b,L,F,U;function Q(){return s[16](s[27])}function j(){return s[17](s[27])}function z(){return s[18](s[27])}function ae(){return s[19](s[27])}return L=new Tt({props:{shareHandler:Q,cloneHandler:j,exportHandler:z,deleteHandler:ae,onClose:Bt,$$slots:{default:[Pt]},$$scope:{ctx:s}}}),{c(){e=v("div"),n=v("div"),t=v("a"),l=v("div"),o=v("div"),r=ee(i),a=H(),p=v("div"),f=ee(_),C=H(),M=v("div"),T=v("a"),x=Ue("svg"),q=Ue("path"),b=H(),R(L.$$.fragment),F=H(),this.h()},l(V){e=$(V,"DIV",{class:!0});var E=k(e);n=$(E,"DIV",{class:!0});var N=k(n);t=$(N,"A",{href:!0});var h=k(t);l=$(h,"DIV",{class:!0});var B=k(l);o=$(B,"DIV",{class:!0});var O=k(o);r=te(O,i),O.forEach(u),a=D(B),p=$(B,"DIV",{class:!0});var G=k(p);f=te(G,_),G.forEach(u),B.forEach(u),h.forEach(u),N.forEach(u),C=D(E),M=$(E,"DIV",{class:!0});var le=k(M);T=$(le,"A",{class:!0,type:!0,href:!0});var X=k(T);x=je(X,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var se=k(x);q=je(se,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),k(q).forEach(u),se.forEach(u),X.forEach(u),b=D(le),J(L.$$.fragment,le),le.forEach(u),F=D(E),E.forEach(u),this.h()},h(){d(o,"class","font-semibold line-clamp-1"),d(p,"class","text-xs overflow-hidden text-ellipsis line-clamp-1"),d(l,"class","flex-1 self-center pl-5"),d(t,"href",g=`/workspace/prompts/edit?command=${encodeURIComponent(s[27].command)}`),d(n,"class","flex flex-1 space-x-4 cursor-pointer w-full"),d(q,"stroke-linecap","round"),d(q,"stroke-linejoin","round"),d(q,"d","M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"),d(x,"xmlns","http://www.w3.org/2000/svg"),d(x,"fill","none"),d(x,"viewBox","0 0 24 24"),d(x,"stroke-width","1.5"),d(x,"stroke","currentColor"),d(x,"class","w-4 h-4"),d(T,"class","self-center w-fit text-sm px-2 py-2 dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"),d(T,"type","button"),d(T,"href",K=`/workspace/prompts/edit?command=${encodeURIComponent(s[27].command)}`),d(M,"class","flex flex-row gap-0.5 self-center"),d(e,"class","flex space-x-4 cursor-pointer w-full px-3 py-2 dark:hover:bg-white/5 hover:bg-black/5 rounded-xl")},m(V,E){y(V,e,E),m(e,n),m(n,t),m(t,l),m(l,o),m(o,r),m(l,a),m(l,p),m(p,f),m(e,C),m(e,M),m(M,T),m(T,x),m(x,q),m(M,b),W(L,M,null),m(e,F),U=!0},p(V,E){s=V,(!U||E&130)&&i!==(i=s[27].command+"")&&re(r,i),(!U||E&130)&&_!==(_=s[27].title+"")&&re(f,_),(!U||E&130&&g!==(g=`/workspace/prompts/edit?command=${encodeURIComponent(s[27].command)}`))&&d(t,"href",g),(!U||E&130&&K!==(K=`/workspace/prompts/edit?command=${encodeURIComponent(s[27].command)}`))&&d(T,"href",K);const N={};E&130&&(N.shareHandler=Q),E&130&&(N.cloneHandler=j),E&130&&(N.exportHandler=z),E&154&&(N.deleteHandler=ae),E&1073741824&&(N.$$scope={dirty:E,ctx:s}),L.$set(N)},i(V){U||(P(L.$$.fragment,V),U=!0)},o(V){A(L.$$.fragment,V),U=!1},d(V){V&&u(e),Z(L)}}}function St(s){let e,n=s[5].t("This will delete")+"",t,l,o,i=s[4].command+"",r,a;return{c(){e=v("div"),t=ee(n),l=H(),o=v("span"),r=ee(i),a=ee("."),this.h()},l(p){e=$(p,"DIV",{class:!0});var _=k(e);t=te(_,n),l=D(_),o=$(_,"SPAN",{class:!0});var f=k(o);r=te(f,i),f.forEach(u),a=te(_,"."),_.forEach(u),this.h()},h(){d(o,"class","font-semibold"),d(e,"class","text-sm text-gray-500")},m(p,_){y(p,e,_),m(e,t),m(e,l),m(e,o),m(o,r),m(e,a)},p(p,_){_&32&&n!==(n=p[5].t("This will delete")+"")&&re(t,n),_&16&&i!==(i=p[4].command+"")&&re(r,i)},d(p){p&&u(e)}}}function At(s){let e,n,t,l,o=s[5].t("Prompts")+"",i,r,a,p,_,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clip-rule="evenodd"></path></svg>',g,C,M,T,x,q='<a class="px-2 py-2 rounded-xl border border-gray-200 dark:border-gray-600 dark:border-0 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 transition font-medium text-sm flex items-center space-x-1" href="/workspace/prompts/create"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path d="M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z"></path></svg></a>',K,b,L,F,U,Q,j,z,ae,V,E,N=s[5].t("Import Prompts")+"",h,B,O,G='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm4 9.5a.75.75 0 0 1-.75-.75V8.06l-.72.72a.75.75 0 0 1-1.06-1.06l2-2a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-.72-.72v2.69a.75.75 0 0 1-.75.75Z" clip-rule="evenodd"></path></svg>',le,X,se,de=s[5].t("Export Prompts")+"",pe,ke,ie,Me='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm4 3.5a.75.75 0 0 1 .75.75v2.69l.72-.72a.75.75 0 1 1 1.06 1.06l-2 2a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 0 1 1.06-1.06l.72.72V6.25A.75.75 0 0 1 8 5.5Z" clip-rule="evenodd"></path></svg>',he,ne,ye,oe,Ee,Te;document.title=e=`
`+s[5].t("Prompts")+" | "+s[6]+`
`;let ce=ze(s[7].filter(s[15])),I=[];for(let c=0;c<ce.length;c+=1)I[c]=We(Je(s,ce,c));const Ke=c=>A(I[c],1,1,()=>{I[c]=null});function Qe(c){s[25](c)}let Pe={title:s[5].t("Delete prompt?"),$$slots:{default:[St]},$$scope:{ctx:s}};return s[3]!==void 0&&(Pe.show=s[3]),ne=new bt({props:Pe}),Ie.push(()=>Ge(ne,"show",Qe)),ne.$on("confirm",s[26]),{c(){n=H(),t=v("div"),l=v("div"),i=ee(o),r=H(),a=v("div"),p=v("div"),_=v("div"),_.innerHTML=f,g=H(),C=v("input"),T=H(),x=v("div"),x.innerHTML=q,K=H(),b=v("hr"),L=H(),F=v("div");for(let c=0;c<I.length;c+=1)I[c].c();U=H(),Q=v("div"),j=v("div"),z=v("input"),ae=H(),V=v("button"),E=v("div"),h=ee(N),B=H(),O=v("div"),O.innerHTML=G,le=H(),X=v("button"),se=v("div"),pe=ee(de),ke=H(),ie=v("div"),ie.innerHTML=Me,he=H(),R(ne.$$.fragment),this.h()},l(c){rt("svelte-1bq1zi1",document.head).forEach(u),n=D(c),t=$(c,"DIV",{class:!0});var Y=k(t);l=$(Y,"DIV",{class:!0});var S=k(l);i=te(S,o),S.forEach(u),Y.forEach(u),r=D(c),a=$(c,"DIV",{class:!0});var fe=k(a);p=$(fe,"DIV",{class:!0});var _e=k(p);_=$(_e,"DIV",{class:!0,"data-svelte-h":!0}),$e(_)!=="svelte-v38fm1"&&(_.innerHTML=f),g=D(_e),C=$(_e,"INPUT",{class:!0,placeholder:!0}),_e.forEach(u),T=D(fe),x=$(fe,"DIV",{"data-svelte-h":!0}),$e(x)!=="svelte-rc8k9l"&&(x.innerHTML=q),fe.forEach(u),K=D(c),b=$(c,"HR",{class:!0}),L=D(c),F=$(c,"DIV",{class:!0});var Se=k(F);for(let xe=0;xe<I.length;xe+=1)I[xe].l(Se);Se.forEach(u),U=D(c),Q=$(c,"DIV",{class:!0});var Ae=k(Q);j=$(Ae,"DIV",{class:!0});var ue=k(j);z=$(ue,"INPUT",{id:!0,type:!0,accept:!0}),ae=D(ue),V=$(ue,"BUTTON",{class:!0});var ge=k(V);E=$(ge,"DIV",{class:!0});var Be=k(E);h=te(Be,N),Be.forEach(u),B=D(ge),O=$(ge,"DIV",{class:!0,"data-svelte-h":!0}),$e(O)!=="svelte-aqr4dt"&&(O.innerHTML=G),ge.forEach(u),le=D(ue),X=$(ue,"BUTTON",{class:!0});var ve=k(X);se=$(ve,"DIV",{class:!0});var Ne=k(se);pe=te(Ne,de),Ne.forEach(u),ke=D(ve),ie=$(ve,"DIV",{class:!0,"data-svelte-h":!0}),$e(ie)!=="svelte-1n7zye"&&(ie.innerHTML=Me),ve.forEach(u),ue.forEach(u),Ae.forEach(u),he=D(c),J(ne.$$.fragment,c),this.h()},h(){d(l,"class","text-lg font-semibold self-center"),d(t,"class","mb-3 flex justify-between items-center"),d(_,"class","self-center ml-1 mr-3"),d(C,"class","w-full text-sm pr-4 py-1 rounded-r-xl outline-none bg-transparent"),d(C,"placeholder",M=s[5].t("Search Prompts")),d(p,"class","flex flex-1"),d(a,"class","flex w-full space-x-2"),d(b,"class","dark:border-gray-850 my-2.5"),d(F,"class","my-3 mb-5"),d(z,"id","prompts-import-input"),d(z,"type","file"),d(z,"accept",".json"),z.hidden=!0,d(E,"class","self-center mr-2 font-medium line-clamp-1"),d(O,"class","self-center"),d(V,"class","flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"),d(se,"class","self-center mr-2 font-medium line-clamp-1"),d(ie,"class","self-center"),d(X,"class","flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"),d(j,"class","flex space-x-2"),d(Q,"class","flex justify-end w-full mb-3")},m(c,w){y(c,n,w),y(c,t,w),m(t,l),m(l,i),y(c,r,w),y(c,a,w),m(a,p),m(p,_),m(p,g),m(p,C),Le(C,s[1]),m(a,T),m(a,x),y(c,K,w),y(c,b,w),y(c,L,w),y(c,F,w);for(let Y=0;Y<I.length;Y+=1)I[Y]&&I[Y].m(F,null);y(c,U,w),y(c,Q,w),m(Q,j),m(j,z),s[20](z),m(j,ae),m(j,V),m(V,E),m(E,h),m(V,B),m(V,O),m(j,le),m(j,X),m(X,se),m(se,pe),m(X,ke),m(X,ie),y(c,he,w),W(ne,c,w),oe=!0,Ee||(Te=[me(C,"input",s[14]),me(z,"change",s[21]),me(z,"change",s[22]),me(V,"click",s[23]),me(X,"click",s[24])],Ee=!0)},p(c,[w]){if((!oe||w&96)&&e!==(e=`
`+c[5].t("Prompts")+" | "+c[6]+`
`)&&(document.title=e),(!oe||w&32)&&o!==(o=c[5].t("Prompts")+"")&&re(i,o),(!oe||w&32&&M!==(M=c[5].t("Search Prompts")))&&d(C,"placeholder",M),w&2&&C.value!==c[1]&&Le(C,c[1]),w&7322){ce=ze(c[7].filter(c[15]));let S;for(S=0;S<ce.length;S+=1){const fe=Je(c,ce,S);I[S]?(I[S].p(fe,w),P(I[S],1)):(I[S]=We(fe),I[S].c(),P(I[S],1),I[S].m(F,null))}for(st(),S=ce.length;S<I.length;S+=1)Ke(S);ot()}(!oe||w&32)&&N!==(N=c[5].t("Import Prompts")+"")&&re(h,N),(!oe||w&32)&&de!==(de=c[5].t("Export Prompts")+"")&&re(pe,de);const Y={};w&32&&(Y.title=c[5].t("Delete prompt?")),w&1073741872&&(Y.$$scope={dirty:w,ctx:c}),!ye&&w&8&&(ye=!0,Y.show=c[3],Ze(()=>ye=!1)),ne.$set(Y)},i(c){if(!oe){for(let w=0;w<ce.length;w+=1)P(I[w]);P(ne.$$.fragment,c),oe=!0}},o(c){I=I.filter(Boolean);for(let w=0;w<I.length;w+=1)A(I[w]);A(ne.$$.fragment,c),oe=!1},d(c){c&&(u(n),u(t),u(r),u(a),u(K),u(b),u(L),u(F),u(U),u(Q),u(he)),lt(I,c),s[20](null),Z(ne,c),Ee=!1,nt(Te)}}}const Bt=()=>{};function Nt(s,e,n){let t,l,o;be(s,it,h=>n(6,l=h)),be(s,He,h=>n(7,o=h));const{saveAs:i}=at,r=qe("i18n");be(s,r,h=>n(5,t=h));let a="",p="",_,f=!1,g=null;const C=async h=>{Oe.success(t.t("Redirecting you to OpenWebUI Community"));const B="https://openwebui.com",O=await window.open(`${B}/prompts/create`,"_blank");window.addEventListener("message",G=>{G.origin===B&&G.data==="loaded"&&O.postMessage(JSON.stringify(h),"*")},!1)},M=async h=>{sessionStorage.prompt=JSON.stringify(h),ut("/workspace/prompts/create")},T=async h=>{let B=new Blob([JSON.stringify([h])],{type:"application/json"});i(B,`prompt-export-${Date.now()}.json`)},x=async h=>{const B=h.command;await ct(localStorage.token,B),await He.set(await Re(localStorage.token))};function q(){p=this.value,n(1,p)}const K=h=>p===""||h.command.includes(p),b=h=>{C(h)},L=h=>{M(h)},F=h=>{T(h)},U=async h=>{n(4,g=h),n(3,f=!0)};function Q(h){Ie[h?"unshift":"push"](()=>{_=h,n(2,_)})}function j(){a=this.files,n(0,a)}const z=()=>{console.log(a);const h=new FileReader;h.onload=async B=>{const O=JSON.parse(B.target.result);console.log(O);for(const G of O)await ft(localStorage.token,G.command.charAt(0)==="/"?G.command.slice(1):G.command,G.title,G.content).catch(le=>(Oe.error(le),null));await He.set(await Re(localStorage.token))},h.readAsText(a[0])},ae=()=>{_.click()},V=async()=>{let h=new Blob([JSON.stringify(o)],{type:"application/json"});i(h,`prompts-export-${Date.now()}.json`)};function E(h){f=h,n(3,f)}return[a,p,_,f,g,t,l,o,i,r,C,M,T,x,q,K,b,L,F,U,Q,j,z,ae,V,E,()=>{x(g)}]}class Lt extends Ve{constructor(e){super(),Ce(this,e,Nt,At,De,{})}}function Ut(s){let e,n;return e=new Lt({}),{c(){R(e.$$.fragment)},l(t){J(e.$$.fragment,t)},m(t,l){W(e,t,l),n=!0},p:Fe,i(t){n||(P(e.$$.fragment,t),n=!0)},o(t){A(e.$$.fragment,t),n=!1},d(t){Z(e,t)}}}class lr extends Ve{constructor(e){super(),Ce(this,e,null,Ut,De,{})}}export{lr as component};
//# sourceMappingURL=19.pTVVjaf2.js.map