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='',g,C,M,T,x,q='',K,b,L,F,U,Q,j,z,ae,V,E,N=s[5].t("Import Prompts")+"",h,B,O,G='',le,X,se,de=s[5].t("Export Prompts")+"",pe,ke,ie,Me='',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;cA(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;cye=!1)),ne.$set(Y)},i(c){if(!oe){for(let w=0;w{};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