import{s as qe,y as We,z as Re,a as k,d as u,f as m,i as I,g as h,n as Ze,B as Ve,E as Me,p as bt,j as ze,e as v,c as $,r as St,v as Mt,w as Ct,x as Ft,k as M,o as C,S as Lt,t as K,b as Q,h as le,m as Tt,A as Le,C as dt,u as He,J as Bt,F as Nt,q as At,N as jt}from"../chunks/scheduler.DB3Sqaa-.js";import{S as Je,i as Pe,f as Ce,b as x,d as G,m as O,t as F,a as T,e as z,g as Ke,c as Qe}from"../chunks/index.CidI1d1E.js";import{e as mt}from"../chunks/each.cN4tVpvB.js";import{t as de}from"../chunks/Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";import{f as Ut}from"../chunks/FileSaver.min.CimDdHIv.js";import{W as xt,f as Ae,m as je}from"../chunks/index.DPWiq6NR.js";import{g as ht}from"../chunks/entry.JtQ7vg2d.js";import{a as tt,f as Gt,g as nt,t as Ot,h as zt,i as Wt,c as Rt}from"../chunks/index.McBTOAZM.js";import{T as Ge}from"../chunks/create.DJSy4-Dz.js";import{C as _t}from"../chunks/ConfirmDialog.BhA26OgX.js";import{g as Ue}from"../chunks/index.BS8UhGmM.js";import{D as Zt,M as xe}from"../chunks/Dropdown.6Kb6OfAV.js";import{b as qt}from"../chunks/menu-trigger.Syw7IYi9.js";import{f as Jt}from"../chunks/index.DMdt0oYD.js";import{S as Pt,D as Kt,G as kt}from"../chunks/DocumentDuplicate.B_gNfd5l.js";import{A as Qt,E as Xt}from"../chunks/EllipsisHorizontal.TEROWdDo.js";import{S as yt}from"../chunks/Switch.C2EOWhLk.js";import{M as Yt,V as en}from"../chunks/ManifestModal.C5qQKGnc.js";import{H as tn}from"../chunks/Heart.DnYgkWAI.js";function nn(l){let e,n;return{c(){e=We("svg"),n=We("path"),this.h()},l(t){e=Re(t,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var r=k(e);n=Re(r,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),k(n).forEach(u),r.forEach(u),this.h()},h(){m(n,"stroke-linecap","round"),m(n,"stroke-linejoin","round"),m(n,"d","M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418"),m(e,"xmlns","http://www.w3.org/2000/svg"),m(e,"fill","none"),m(e,"viewBox","0 0 24 24"),m(e,"stroke-width",l[1]),m(e,"stroke","currentColor"),m(e,"class",l[0])},m(t,r){I(t,e,r),h(e,n)},p(t,[r]){r&2&&m(e,"stroke-width",t[1]),r&1&&m(e,"class",t[0])},i:Ze,o:Ze,d(t){t&&u(e)}}}function ln(l,e,n){let{className:t="w-4 h-4"}=e,{strokeWidth:r="1.5"}=e;return l.$$set=o=>{"className"in o&&n(0,t=o.className),"strokeWidth"in o&&n(1,r=o.strokeWidth)},[t,r]}class sn extends Je{constructor(e){super(),Pe(this,e,ln,nn,qe,{className:0,strokeWidth:1})}}function rn(l){let e;const n=l[11].default,t=St(n,l,l[20],null);return{c(){t&&t.c()},l(r){t&&t.l(r)},m(r,o){t&&t.m(r,o),e=!0},p(r,o){t&&t.p&&(!e||o&1048576)&&Mt(t,n,r,r[20],e?Ft(n,r[20],o,null):Ct(r[20]),null)},i(r){e||(F(t,r),e=!0)},o(r){T(t,r),e=!1},d(r){t&&t.d(r)}}}function on(l){let e,n;return e=new Ge({props:{content:l[9].t("More"),$$slots:{default:[rn]},$$scope:{ctx:l}}}),{c(){x(e.$$.fragment)},l(t){G(e.$$.fragment,t)},m(t,r){O(e,t,r),n=!0},p(t,r){const o={};r&512&&(o.content=t[9].t("More")),r&1048576&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(F(e.$$.fragment,t),n=!0)},o(t){T(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}function pt(l){let e,n,t,r,o,a=l[9].t("Global")+"",s,i,p,g,H,S,y,N;t=new sn({});function w(d){l[12](d)}let f={};return l[0].is_global!==void 0&&(f.state=l[0].is_global),g=new yt({props:f}),Ve.push(()=>Ce(g,"state",w)),g.$on("change",function(){Lt(l[6])&&l[6].apply(this,arguments)}),{c(){e=v("div"),n=v("div"),x(t.$$.fragment),r=M(),o=v("div"),s=K(a),i=M(),p=v("div"),x(g.$$.fragment),S=M(),y=v("hr"),this.h()},l(d){e=$(d,"DIV",{class:!0});var V=k(e);n=$(V,"DIV",{class:!0});var D=k(n);G(t.$$.fragment,D),r=C(D),o=$(D,"DIV",{class:!0});var U=k(o);s=Q(U,a),U.forEach(u),D.forEach(u),i=C(V),p=$(V,"DIV",{});var A=k(p);G(g.$$.fragment,A),A.forEach(u),V.forEach(u),S=C(d),y=$(d,"HR",{class:!0}),this.h()},h(){m(o,"class","flex items-center"),m(n,"class","flex gap-2 items-center"),m(e,"class","flex gap-2 justify-between items-center px-3 py-2 text-sm font-medium cursor-pointerrounded-md"),m(y,"class","border-gray-100 dark:border-gray-800 my-1")},m(d,V){I(d,e,V),h(e,n),O(t,n,null),h(n,r),h(n,o),h(o,s),h(e,i),h(e,p),O(g,p,null),I(d,S,V),I(d,y,V),N=!0},p(d,V){l=d,(!N||V&512)&&a!==(a=l[9].t("Global")+"")&&le(s,a);const D={};!H&&V&1&&(H=!0,D.state=l[0].is_global,Me(()=>H=!1)),g.$set(D)},i(d){N||(F(t.$$.fragment,d),F(g.$$.fragment,d),N=!0)},o(d){T(t.$$.fragment,d),T(g.$$.fragment,d),N=!1},d(d){d&&(u(e),u(S),u(y)),z(t),z(g)}}}function an(l){let e,n,t,r,o=l[9].t("Edit")+"",a;return{c(){e=We("svg"),n=We("path"),t=M(),r=v("div"),a=K(o),this.h()},l(s){e=Re(s,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var i=k(e);n=Re(i,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),k(n).forEach(u),i.forEach(u),t=C(s),r=$(s,"DIV",{class:!0});var p=k(r);a=Q(p,o),p.forEach(u),this.h()},h(){m(n,"stroke-linecap","round"),m(n,"stroke-linejoin","round"),m(n,"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"),m(e,"xmlns","http://www.w3.org/2000/svg"),m(e,"fill","none"),m(e,"viewBox","0 0 24 24"),m(e,"stroke-width","1.5"),m(e,"stroke","currentColor"),m(e,"class","w-4 h-4"),m(r,"class","flex items-center")},m(s,i){I(s,e,i),h(e,n),I(s,t,i),I(s,r,i),h(r,a)},p(s,i){i&512&&o!==(o=s[9].t("Edit")+"")&&le(a,o)},d(s){s&&(u(e),u(t),u(r))}}}function fn(l){let e,n,t,r=l[9].t("Share")+"",o,a;return e=new Pt({}),{c(){x(e.$$.fragment),n=M(),t=v("div"),o=K(r),this.h()},l(s){G(e.$$.fragment,s),n=C(s),t=$(s,"DIV",{class:!0});var i=k(t);o=Q(i,r),i.forEach(u),this.h()},h(){m(t,"class","flex items-center")},m(s,i){O(e,s,i),I(s,n,i),I(s,t,i),h(t,o),a=!0},p(s,i){(!a||i&512)&&r!==(r=s[9].t("Share")+"")&&le(o,r)},i(s){a||(F(e.$$.fragment,s),a=!0)},o(s){T(e.$$.fragment,s),a=!1},d(s){s&&(u(n),u(t)),z(e,s)}}}function un(l){let e,n,t,r=l[9].t("Clone")+"",o,a;return e=new Kt({}),{c(){x(e.$$.fragment),n=M(),t=v("div"),o=K(r),this.h()},l(s){G(e.$$.fragment,s),n=C(s),t=$(s,"DIV",{class:!0});var i=k(t);o=Q(i,r),i.forEach(u),this.h()},h(){m(t,"class","flex items-center")},m(s,i){O(e,s,i),I(s,n,i),I(s,t,i),h(t,o),a=!0},p(s,i){(!a||i&512)&&r!==(r=s[9].t("Clone")+"")&&le(o,r)},i(s){a||(F(e.$$.fragment,s),a=!0)},o(s){T(e.$$.fragment,s),a=!1},d(s){s&&(u(n),u(t)),z(e,s)}}}function cn(l){let e,n,t,r=l[9].t("Export")+"",o,a;return e=new Qt({}),{c(){x(e.$$.fragment),n=M(),t=v("div"),o=K(r),this.h()},l(s){G(e.$$.fragment,s),n=C(s),t=$(s,"DIV",{class:!0});var i=k(t);o=Q(i,r),i.forEach(u),this.h()},h(){m(t,"class","flex items-center")},m(s,i){O(e,s,i),I(s,n,i),I(s,t,i),h(t,o),a=!0},p(s,i){(!a||i&512)&&r!==(r=s[9].t("Export")+"")&&le(o,r)},i(s){a||(F(e.$$.fragment,s),a=!0)},o(s){T(e.$$.fragment,s),a=!1},d(s){s&&(u(n),u(t)),z(e,s)}}}function dn(l){let e,n,t,r=l[9].t("Delete")+"",o,a;return e=new kt({props:{strokeWidth:"2"}}),{c(){x(e.$$.fragment),n=M(),t=v("div"),o=K(r),this.h()},l(s){G(e.$$.fragment,s),n=C(s),t=$(s,"DIV",{class:!0});var i=k(t);o=Q(i,r),i.forEach(u),this.h()},h(){m(t,"class","flex items-center")},m(s,i){O(e,s,i),I(s,n,i),I(s,t,i),h(t,o),a=!0},p(s,i){(!a||i&512)&&r!==(r=s[9].t("Delete")+"")&&le(o,r)},i(s){a||(F(e.$$.fragment,s),a=!0)},o(s){T(e.$$.fragment,s),a=!1},d(s){s&&(u(n),u(t)),z(e,s)}}}function mn(l){let e=["filter","action"].includes(l[0].type),n,t,r,o,a,s,i,p,g,H,S,y,N,w=e&&pt(l);return t=new xe({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:[an]},$$scope:{ctx:l}}}),t.$on("click",l[13]),o=new xe({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:[fn]},$$scope:{ctx:l}}}),o.$on("click",l[14]),s=new xe({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:[un]},$$scope:{ctx:l}}}),s.$on("click",l[15]),p=new xe({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:[cn]},$$scope:{ctx:l}}}),p.$on("click",l[16]),y=new xe({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:[dn]},$$scope:{ctx:l}}}),y.$on("click",l[17]),{c(){w&&w.c(),n=M(),x(t.$$.fragment),r=M(),x(o.$$.fragment),a=M(),x(s.$$.fragment),i=M(),x(p.$$.fragment),g=M(),H=v("hr"),S=M(),x(y.$$.fragment),this.h()},l(f){w&&w.l(f),n=C(f),G(t.$$.fragment,f),r=C(f),G(o.$$.fragment,f),a=C(f),G(s.$$.fragment,f),i=C(f),G(p.$$.fragment,f),g=C(f),H=$(f,"HR",{class:!0}),S=C(f),G(y.$$.fragment,f),this.h()},h(){m(H,"class","border-gray-100 dark:border-gray-800 my-1")},m(f,d){w&&w.m(f,d),I(f,n,d),O(t,f,d),I(f,r,d),O(o,f,d),I(f,a,d),O(s,f,d),I(f,i,d),O(p,f,d),I(f,g,d),I(f,H,d),I(f,S,d),O(y,f,d),N=!0},p(f,d){d&1&&(e=["filter","action"].includes(f[0].type)),e?w?(w.p(f,d),d&1&&F(w,1)):(w=pt(f),w.c(),F(w,1),w.m(n.parentNode,n)):w&&(Ke(),T(w,1,1,()=>{w=null}),Qe());const V={};d&1049088&&(V.$$scope={dirty:d,ctx:f}),t.$set(V);const D={};d&1049088&&(D.$$scope={dirty:d,ctx:f}),o.$set(D);const U={};d&1049088&&(U.$$scope={dirty:d,ctx:f}),s.$set(U);const A={};d&1049088&&(A.$$scope={dirty:d,ctx:f}),p.$set(A);const q={};d&1049088&&(q.$$scope={dirty:d,ctx:f}),y.$set(q)},i(f){N||(F(w),F(t.$$.fragment,f),F(o.$$.fragment,f),F(s.$$.fragment,f),F(p.$$.fragment,f),F(y.$$.fragment,f),N=!0)},o(f){T(w),T(t.$$.fragment,f),T(o.$$.fragment,f),T(s.$$.fragment,f),T(p.$$.fragment,f),T(y.$$.fragment,f),N=!1},d(f){f&&(u(n),u(r),u(a),u(i),u(g),u(H),u(S)),w&&w.d(f),z(t,f),z(o,f),z(s,f),z(p,f),z(y,f)}}}function hn(l){let e,n,t;return n=new qt({props:{class:"w-full max-w-[180px] 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:Jt,$$slots:{default:[mn]},$$scope:{ctx:l}}}),{c(){e=v("div"),x(n.$$.fragment),this.h()},l(r){e=$(r,"DIV",{slot:!0});var o=k(e);G(n.$$.fragment,o),o.forEach(u),this.h()},h(){m(e,"slot","content")},m(r,o){I(r,e,o),O(n,e,null),t=!0},p(r,o){const a={};o&1049215&&(a.$$scope={dirty:o,ctx:r}),n.$set(a)},i(r){t||(F(n.$$.fragment,r),t=!0)},o(r){T(n.$$.fragment,r),t=!1},d(r){r&&u(e),z(n)}}}function _n(l){let e,n,t;function r(a){l[18](a)}let o={$$slots:{content:[hn],default:[on]},$$scope:{ctx:l}};return l[8]!==void 0&&(o.show=l[8]),e=new Zt({props:o}),Ve.push(()=>Ce(e,"show",r)),e.$on("change",l[19]),{c(){x(e.$$.fragment)},l(a){G(e.$$.fragment,a)},m(a,s){O(e,a,s),t=!0},p(a,[s]){const i={};s&1049215&&(i.$$scope={dirty:s,ctx:a}),!n&&s&256&&(n=!0,i.show=a[8],Me(()=>n=!1)),e.$set(i)},i(a){t||(F(e.$$.fragment,a),t=!0)},o(a){T(e.$$.fragment,a),t=!1},d(a){z(e,a)}}}function pn(l,e,n){let t,{$$slots:r={},$$scope:o}=e;const a=bt("i18n");ze(l,a,E=>n(9,t=E));let{func:s}=e,{editHandler:i}=e,{shareHandler:p}=e,{cloneHandler:g}=e,{exportHandler:H}=e,{deleteHandler:S}=e,{toggleGlobalHandler:y}=e,{onClose:N}=e,w=!1;function f(E){l.$$.not_equal(s.is_global,E)&&(s.is_global=E,n(0,s))}const d=()=>{i()},V=()=>{p()},D=()=>{g()},U=()=>{H()},A=()=>{S()};function q(E){w=E,n(8,w)}const ee=E=>{E.detail===!1&&N()};return l.$$set=E=>{"func"in E&&n(0,s=E.func),"editHandler"in E&&n(1,i=E.editHandler),"shareHandler"in E&&n(2,p=E.shareHandler),"cloneHandler"in E&&n(3,g=E.cloneHandler),"exportHandler"in E&&n(4,H=E.exportHandler),"deleteHandler"in E&&n(5,S=E.deleteHandler),"toggleGlobalHandler"in E&&n(6,y=E.toggleGlobalHandler),"onClose"in E&&n(7,N=E.onClose),"$$scope"in E&&n(20,o=E.$$scope)},[s,i,p,g,H,S,y,N,w,t,a,r,f,d,V,D,U,A,q,ee,o]}class gn extends Je{constructor(e){super(),Pe(this,e,pn,_n,qe,{func:0,editHandler:1,shareHandler:2,cloneHandler:3,exportHandler:4,deleteHandler:5,toggleGlobalHandler:6,onClose:7})}}function gt(l,e,n){const t=l.slice();return t[44]=e[n],t[45]=e,t[46]=n,t}function vt(l){var o,a,s;let e,n,t=(((s=(a=(o=l[44])==null?void 0:o.meta)==null?void 0:a.manifest)==null?void 0:s.version)??"")+"",r;return{c(){e=v("div"),n=K("v"),r=K(t),this.h()},l(i){e=$(i,"DIV",{class:!0});var p=k(e);n=Q(p,"v"),r=Q(p,t),p.forEach(u),this.h()},h(){m(e,"class","text-xs font-bold px-1 rounded line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200")},m(i,p){I(i,e,p),h(e,n),h(e,r)},p(i,p){var g,H,S;p[0]&2064&&t!==(t=(((S=(H=(g=i[44])==null?void 0:g.meta)==null?void 0:H.manifest)==null?void 0:S.version)??"")+"")&&le(r,t)},d(i){i&&u(e)}}}function vn(l){var y,N,w;let e,n,t,r,o,a=(((w=(N=(y=l[44])==null?void 0:y.meta)==null?void 0:N.manifest)==null?void 0:w.funding_url)??!1)&&$t(l);n=new Ge({props:{content:l[9].t("Valves"),$$slots:{default:[bn]},$$scope:{ctx:l}}});function s(){return l[24](l[44])}function i(){return l[25](l[44])}function p(){return l[26](l[44])}function g(){return l[27](l[44])}function H(){return l[28](l[44])}function S(){return l[29](l[44])}return r=new gn({props:{func:l[44],editHandler:s,shareHandler:i,cloneHandler:p,exportHandler:g,deleteHandler:H,toggleGlobalHandler:S,onClose:Vn,$$slots:{default:[kn]},$$scope:{ctx:l}}}),{c(){a&&a.c(),e=M(),x(n.$$.fragment),t=M(),x(r.$$.fragment)},l(f){a&&a.l(f),e=C(f),G(n.$$.fragment,f),t=C(f),G(r.$$.fragment,f)},m(f,d){a&&a.m(f,d),I(f,e,d),O(n,f,d),I(f,t,d),O(r,f,d),o=!0},p(f,d){var U,A,q;l=f,((q=(A=(U=l[44])==null?void 0:U.meta)==null?void 0:A.manifest)==null?void 0:q.funding_url)??!1?a?(a.p(l,d),d[0]&2064&&F(a,1)):(a=$t(l),a.c(),F(a,1),a.m(e.parentNode,e)):a&&(Ke(),T(a,1,1,()=>{a=null}),Qe());const V={};d[0]&512&&(V.content=l[9].t("Valves")),d[0]&2256|d[1]&65536&&(V.$$scope={dirty:d,ctx:l}),n.$set(V);const D={};d[0]&2064&&(D.func=l[44]),d[0]&2064&&(D.editHandler=s),d[0]&2064&&(D.shareHandler=i),d[0]&2064&&(D.cloneHandler=p),d[0]&2064&&(D.exportHandler=g),d[0]&2448&&(D.deleteHandler=H),d[0]&2064&&(D.toggleGlobalHandler=S),d[1]&65536&&(D.$$scope={dirty:d,ctx:l}),r.$set(D)},i(f){o||(F(a),F(n.$$.fragment,f),F(r.$$.fragment,f),o=!0)},o(f){T(a),T(n.$$.fragment,f),T(r.$$.fragment,f),o=!1},d(f){f&&(u(e),u(t)),a&&a.d(f),z(n,f),z(r,f)}}}function $n(l){let e,n;return e=new Ge({props:{content:l[9].t("Delete"),$$slots:{default:[yn]},$$scope:{ctx:l}}}),{c(){x(e.$$.fragment)},l(t){G(e.$$.fragment,t)},m(t,r){O(e,t,r),n=!0},p(t,r){const o={};r[0]&512&&(o.content=t[9].t("Delete")),r[0]&2064|r[1]&65536&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(F(e.$$.fragment,t),n=!0)},o(t){T(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}function $t(l){let e,n;return e=new Ge({props:{content:l[9].t("Support"),$$slots:{default:[wn]},$$scope:{ctx:l}}}),{c(){x(e.$$.fragment)},l(t){G(e.$$.fragment,t)},m(t,r){O(e,t,r),n=!0},p(t,r){const o={};r[0]&512&&(o.content=t[9].t("Support")),r[0]&2224|r[1]&65536&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(F(e.$$.fragment,t),n=!0)},o(t){T(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}function wn(l){let e,n,t,r,o;n=new tn({});function a(){return l[22](l[44])}return{c(){e=v("button"),x(n.$$.fragment),this.h()},l(s){e=$(s,"BUTTON",{class:!0,type:!0});var i=k(e);G(n.$$.fragment,i),i.forEach(u),this.h()},h(){m(e,"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"),m(e,"type","button")},m(s,i){I(s,e,i),O(n,e,null),t=!0,r||(o=He(e,"click",a),r=!0)},p(s,i){l=s},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){T(n.$$.fragment,s),t=!1},d(s){s&&u(e),z(n),r=!1,o()}}}function bn(l){let e,n='',t,r;function o(){return l[23](l[44])}return{c(){e=v("button"),e.innerHTML=n,this.h()},l(a){e=$(a,"BUTTON",{class:!0,type:!0,"data-svelte-h":!0}),Le(e)!=="svelte-1d80tim"&&(e.innerHTML=n),this.h()},h(){m(e,"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"),m(e,"type","button")},m(a,s){I(a,e,s),t||(r=He(e,"click",o),t=!0)},p(a,s){l=a},d(a){a&&u(e),t=!1,r()}}}function kn(l){let e,n,t;return n=new Xt({props:{className:"size-5"}}),{c(){e=v("button"),x(n.$$.fragment),this.h()},l(r){e=$(r,"BUTTON",{class:!0,type:!0});var o=k(e);G(n.$$.fragment,o),o.forEach(u),this.h()},h(){m(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"),m(e,"type","button")},m(r,o){I(r,e,o),O(n,e,null),t=!0},p:Ze,i(r){t||(F(n.$$.fragment,r),t=!0)},o(r){T(n.$$.fragment,r),t=!1},d(r){r&&u(e),z(n)}}}function yn(l){let e,n,t,r,o;n=new kt({});function a(){return l[21](l[44])}return{c(){e=v("button"),x(n.$$.fragment),this.h()},l(s){e=$(s,"BUTTON",{class:!0,type:!0});var i=k(e);G(n.$$.fragment,i),i.forEach(u),this.h()},h(){m(e,"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"),m(e,"type","button")},m(s,i){I(s,e,i),O(n,e,null),t=!0,r||(o=He(e,"click",a),r=!0)},p(s,i){l=s},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){T(n.$$.fragment,s),t=!1},d(s){s&&u(e),z(n),r=!1,o()}}}function En(l){let e,n,t;function r(s){l[30](s,l[44])}function o(...s){return l[31](l[44],...s)}let a={};return l[44].is_active!==void 0&&(a.state=l[44].is_active),e=new yt({props:a}),Ve.push(()=>Ce(e,"state",r)),e.$on("change",o),{c(){x(e.$$.fragment)},l(s){G(e.$$.fragment,s)},m(s,i){O(e,s,i),t=!0},p(s,i){l=s;const p={};!n&&i[0]&2064&&(n=!0,p.state=l[44].is_active,Me(()=>n=!1)),e.$set(p)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){T(e.$$.fragment,s),t=!1},d(s){z(e,s)}}}function wt(l){var ve,we,Ee;let e,n,t,r,o,a,s=l[44].type+"",i,p,g,H,S=l[44].name+"",y,N,w,f,d=l[44].id+"",V,D,U,A=l[44].meta.description+"",q,ee,E,J,se,R,me,fe,ie,$e,te,P=((Ee=(we=(ve=l[44])==null?void 0:ve.meta)==null?void 0:we.manifest)==null?void 0:Ee.version)&&vt(l);const ye=[$n,vn],X=[];function ge(L,W){return L[0]?0:1}return se=ge(l),R=X[se]=ye[se](l),ie=new Ge({props:{content:l[44].is_active?l[9].t("Enabled"):l[9].t("Disabled"),$$slots:{default:[En]},$$scope:{ctx:l}}}),{c(){e=v("div"),n=v("a"),t=v("div"),r=v("div"),o=v("div"),a=v("div"),i=K(s),p=M(),P&&P.c(),g=M(),H=v("div"),y=K(S),N=M(),w=v("div"),f=v("div"),V=K(d),D=M(),U=v("div"),q=K(A),E=M(),J=v("div"),R.c(),me=M(),fe=v("div"),x(ie.$$.fragment),$e=M(),this.h()},l(L){e=$(L,"DIV",{class:!0});var W=k(e);n=$(W,"A",{class:!0,href:!0});var he=k(n);t=$(he,"DIV",{class:!0});var ne=k(t);r=$(ne,"DIV",{class:!0});var _e=k(r);o=$(_e,"DIV",{class:!0});var oe=k(o);a=$(oe,"DIV",{class:!0});var ae=k(a);i=Q(ae,s),ae.forEach(u),p=C(oe),P&&P.l(oe),g=C(oe),H=$(oe,"DIV",{class:!0});var _=k(H);y=Q(_,S),_.forEach(u),oe.forEach(u),N=C(_e),w=$(_e,"DIV",{class:!0});var B=k(w);f=$(B,"DIV",{class:!0});var j=k(f);V=Q(j,d),j.forEach(u),D=C(B),U=$(B,"DIV",{class:!0});var ue=k(U);q=Q(ue,A),ue.forEach(u),B.forEach(u),_e.forEach(u),ne.forEach(u),he.forEach(u),E=C(W),J=$(W,"DIV",{class:!0});var ce=k(J);R.l(ce),me=C(ce),fe=$(ce,"DIV",{class:!0});var re=k(fe);G(ie.$$.fragment,re),re.forEach(u),ce.forEach(u),$e=C(W),W.forEach(u),this.h()},h(){m(a,"class","text-xs font-bold px-1 rounded uppercase line-clamp-1 bg-gray-500/20 text-gray-700 dark:text-gray-200"),m(H,"class","line-clamp-1"),m(o,"class","font-semibold flex items-center gap-1.5"),m(f,"class","text-gray-500 text-xs font-medium flex-shrink-0"),m(U,"class","text-xs overflow-hidden text-ellipsis line-clamp-1"),m(w,"class","flex gap-1.5 px-1"),m(r,"class","flex-1 self-center pl-1"),m(t,"class","flex items-center text-left"),m(n,"class","flex flex-1 space-x-3.5 cursor-pointer w-full"),m(n,"href",ee=`/workspace/functions/edit?id=${encodeURIComponent(l[44].id)}`),m(fe,"class","self-center mx-1"),m(J,"class","flex flex-row gap-0.5 self-center"),m(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(L,W){I(L,e,W),h(e,n),h(n,t),h(t,r),h(r,o),h(o,a),h(a,i),h(o,p),P&&P.m(o,null),h(o,g),h(o,H),h(H,y),h(r,N),h(r,w),h(w,f),h(f,V),h(w,D),h(w,U),h(U,q),h(e,E),h(e,J),X[se].m(J,null),h(J,me),h(J,fe),O(ie,fe,null),h(e,$e),te=!0},p(L,W){var _e,oe,ae;(!te||W[0]&2064)&&s!==(s=L[44].type+"")&&le(i,s),(ae=(oe=(_e=L[44])==null?void 0:_e.meta)==null?void 0:oe.manifest)!=null&&ae.version?P?P.p(L,W):(P=vt(L),P.c(),P.m(o,g)):P&&(P.d(1),P=null),(!te||W[0]&2064)&&S!==(S=L[44].name+"")&&le(y,S),(!te||W[0]&2064)&&d!==(d=L[44].id+"")&&le(V,d),(!te||W[0]&2064)&&A!==(A=L[44].meta.description+"")&&le(q,A),(!te||W[0]&2064&&ee!==(ee=`/workspace/functions/edit?id=${encodeURIComponent(L[44].id)}`))&&m(n,"href",ee);let he=se;se=ge(L),se===he?X[se].p(L,W):(Ke(),T(X[he],1,1,()=>{X[he]=null}),Qe(),R=X[se],R?R.p(L,W):(R=X[se]=ye[se](L),R.c()),F(R,1),R.m(J,me));const ne={};W[0]&2576&&(ne.content=L[44].is_active?L[9].t("Enabled"):L[9].t("Disabled")),W[0]&2064|W[1]&65536&&(ne.$$scope={dirty:W,ctx:L}),ie.$set(ne)},i(L){te||(F(R),F(ie.$$.fragment,L),te=!0)},o(L){T(R),T(ie.$$.fragment,L),te=!1},d(L){L&&u(e),P&&P.d(),X[se].d(),z(ie)}}}function In(l){let e,n=l[9].t("This will delete")+"",t,r,o,a=l[7].name+"",s,i;return{c(){e=v("div"),t=K(n),r=M(),o=v("span"),s=K(a),i=K("."),this.h()},l(p){e=$(p,"DIV",{class:!0});var g=k(e);t=Q(g,n),r=C(g),o=$(g,"SPAN",{class:!0});var H=k(o);s=Q(H,a),H.forEach(u),i=Q(g,"."),g.forEach(u),this.h()},h(){m(o,"class","font-semibold"),m(e,"class","text-sm text-gray-500")},m(p,g){I(p,e,g),h(e,t),h(e,r),h(e,o),h(o,s),h(e,i)},p(p,g){g[0]&512&&n!==(n=p[9].t("This will delete")+"")&&le(t,n),g[0]&128&&a!==(a=p[7].name+"")&&le(s,a)},d(p){p&&u(e)}}}function Dn(l){let e,n,t,r="Please carefully review the following warnings:",o,a,s,i=l[9].t("Functions allow arbitrary code execution.")+"",p,g,H,S=l[9].t("Do not install functions from sources you do not fully trust.")+"",y,N,w,f=l[9].t("I acknowledge that I have read and I understand the implications of my action. I am aware of the risks associated with executing arbitrary code and I have verified the trustworthiness of the source.")+"",d;return{c(){e=v("div"),n=v("div"),t=v("div"),t.textContent=r,o=M(),a=v("ul"),s=v("li"),p=K(i),g=M(),H=v("li"),y=K(S),N=M(),w=v("div"),d=K(f),this.h()},l(V){e=$(V,"DIV",{class:!0});var D=k(e);n=$(D,"DIV",{class:!0});var U=k(n);t=$(U,"DIV",{"data-svelte-h":!0}),Le(t)!=="svelte-1a6manw"&&(t.textContent=r),o=C(U),a=$(U,"UL",{class:!0});var A=k(a);s=$(A,"LI",{});var q=k(s);p=Q(q,i),q.forEach(u),g=C(A),H=$(A,"LI",{});var ee=k(H);y=Q(ee,S),ee.forEach(u),A.forEach(u),U.forEach(u),N=C(D),w=$(D,"DIV",{class:!0});var E=k(w);d=Q(E,f),E.forEach(u),D.forEach(u),this.h()},h(){m(a,"class","mt-1 list-disc pl-4 text-xs"),m(n,"class","bg-yellow-500/20 text-yellow-700 dark:text-yellow-200 rounded-lg px-4 py-3"),m(w,"class","my-3"),m(e,"class","text-sm text-gray-500")},m(V,D){I(V,e,D),h(e,n),h(n,t),h(n,o),h(n,a),h(a,s),h(s,p),h(a,g),h(a,H),h(H,y),h(e,N),h(e,w),h(w,d)},p(V,D){D[0]&512&&i!==(i=V[9].t("Functions allow arbitrary code execution.")+"")&&le(p,i),D[0]&512&&S!==(S=V[9].t("Do not install functions from sources you do not fully trust.")+"")&&le(y,S),D[0]&512&&f!==(f=V[9].t("I acknowledge that I have read and I understand the implications of my action. I am aware of the risks associated with executing arbitrary code and I have verified the trustworthiness of the source.")+"")&&le(d,f)},d(V){V&&u(e)}}}function Hn(l){var it,ft,ut;let e,n,t,r,o=l[9].t("Functions")+"",a,s,i,p,g,H='',S,y,N,w,f,d='',V,D,U,A,q,ee,E,J,se,R,me,fe=l[9].t("Import Functions")+"",ie,$e,te,P='',ye,X,ge,ve=l[9].t("Export Functions")+"",we,Ee,L,W='',he,ne,_e,oe,ae,_,B,j,ue,ce,re,Xe,be,Ye,lt;document.title=e=` `+l[9].t("Functions")+" | "+l[10]+` `;let Se=mt(l[11].filter(l[20])),Z=[];for(let c=0;cT(Z[c],1,1,()=>{Z[c]=null});function It(c){l[37](c)}let st={title:l[9].t("Delete function?"),$$slots:{default:[In]},$$scope:{ctx:l}};l[8]!==void 0&&(st.show=l[8]),ne=new _t({props:st}),Ve.push(()=>Ce(ne,"show",It)),ne.$on("confirm",l[38]);function Dt(c){l[39](c)}let rt={manifest:((ft=(it=l[7])==null?void 0:it.meta)==null?void 0:ft.manifest)??{}};l[5]!==void 0&&(rt.show=l[5]),ae=new Yt({props:rt}),Ve.push(()=>Ce(ae,"show",Dt));function Ht(c){l[40](c)}let ot={type:"function",id:((ut=l[7])==null?void 0:ut.id)??null};l[6]!==void 0&&(ot.show=l[6]),j=new en({props:ot}),Ve.push(()=>Ce(j,"show",Ht)),j.$on("save",l[41]);function Vt(c){l[42](c)}let at={$$slots:{default:[Dn]},$$scope:{ctx:l}};return l[3]!==void 0&&(at.show=l[3]),re=new _t({props:at}),Ve.push(()=>Ce(re,"show",Vt)),re.$on("confirm",l[43]),{c(){n=M(),t=v("div"),r=v("div"),a=K(o),s=M(),i=v("div"),p=v("div"),g=v("div"),g.innerHTML=H,S=M(),y=v("input"),w=M(),f=v("div"),f.innerHTML=d,V=M(),D=v("hr"),U=M(),A=v("div");for(let c=0;c_e=!1)),ne.$set(pe);const Fe={};b[0]&128&&(Fe.manifest=((Be=(Te=c[7])==null?void 0:Te.meta)==null?void 0:Be.manifest)??{}),!_&&b[0]&32&&(_=!0,Fe.show=c[5],Me(()=>_=!1)),ae.$set(Fe);const Ie={};b[0]&128&&(Ie.id=((ke=c[7])==null?void 0:ke.id)??null),!ue&&b[0]&64&&(ue=!0,Ie.show=c[6],Me(()=>ue=!1)),j.$set(Ie);const De={};b[0]&512|b[1]&65536&&(De.$$scope={dirty:b,ctx:c}),!Xe&&b[0]&8&&(Xe=!0,De.show=c[3],Me(()=>Xe=!1)),re.$set(De)},i(c){if(!be){for(let b=0;b{};function Sn(l,e,n){let t,r,o;ze(l,xt,_=>n(10,r=_)),ze(l,Ae,_=>n(11,o=_));const{saveAs:a}=Ut,s=bt("i18n");ze(l,s,_=>n(9,t=_));let i=!1,p,g,H=!1,S="",y=!1,N=!1,w=null,f=!1;const d=async _=>{const B=await tt(localStorage.token,_.id).catch(re=>(de.error(re),null));de.success(t.t("Redirecting you to OpenWebUI Community"));const j="https://openwebui.com",ue=await window.open(`${j}/functions/create`,"_blank"),ce=re=>{re.origin===j&&re.data==="loaded"&&(ue.postMessage(JSON.stringify(B),"*"),window.removeEventListener("message",ce))};window.addEventListener("message",ce,!1),console.log(B)},V=async _=>{const B=await tt(localStorage.token,_.id).catch(j=>(de.error(j),null));B&&(sessionStorage.function=JSON.stringify({...B,id:`${B.id}_clone`,name:`${B.name} (Clone)`}),ht("/workspace/functions/create"))},D=async _=>{const B=await tt(localStorage.token,_.id).catch(j=>(de.error(j),null));if(B){let j=new Blob([JSON.stringify([B])],{type:"application/json"});a(j,`function-${B.id}-export-${Date.now()}.json`)}},U=async _=>{await Gt(localStorage.token,_.id).catch(j=>(de.error(j),null))&&(de.success(t.t("Function deleted successfully")),Ae.set(await nt(localStorage.token)),je.set(await Ue(localStorage.token)))},A=async _=>{await Ot(localStorage.token,_.id).catch(j=>{de.error(j)})&&(_.is_global?_.type==="filter"?de.success(t.t("Filter is now globally enabled")):de.success(t.t("Function is now globally enabled")):_.type==="filter"?de.success(t.t("Filter is now globally disabled")):de.success(t.t("Function is now globally disabled")),Ae.set(await nt(localStorage.token)),je.set(await Ue(localStorage.token)))};At(()=>{const _=ue=>{ue.key==="Shift"&&n(0,i=!0)},B=ue=>{ue.key==="Shift"&&n(0,i=!1)},j=()=>{n(0,i=!1)};return window.addEventListener("keydown",_),window.addEventListener("keyup",B),window.addEventListener("blur",j),()=>{window.removeEventListener("keydown",_),window.removeEventListener("keyup",B),window.removeEventListener("blur",j)}});function q(){S=this.value,n(4,S)}const ee=_=>S===""||_.name.toLowerCase().includes(S.toLowerCase())||_.id.toLowerCase().includes(S.toLowerCase()),E=_=>{U(_)},J=_=>{n(7,w=_),n(5,y=!0)},se=_=>{n(7,w=_),n(6,N=!0)},R=_=>{ht(`/workspace/functions/edit?id=${encodeURIComponent(_.id)}`)},me=_=>{d(_)},fe=_=>{V(_)},ie=_=>{D(_)},$e=async _=>{n(7,w=_),n(8,f=!0)},te=_=>{["filter","action"].includes(_.type)&&A(_)};function P(_,B){l.$$.not_equal(B.is_active,_)&&(B.is_active=_,Ae.set(o))}const ye=async(_,B)=>{zt(localStorage.token,_.id),je.set(await Ue(localStorage.token))};function X(_){Ve[_?"unshift":"push"](()=>{p=_,n(1,p)})}function ge(){g=this.files,n(2,g)}const ve=()=>{console.log(g),n(3,H=!0)},we=()=>{p.click()},Ee=async()=>{const _=await Wt(localStorage.token).catch(B=>(de.error(B),null));if(_){let B=new Blob([JSON.stringify(_)],{type:"application/json"});a(B,`functions-export-${Date.now()}.json`)}};function L(_){f=_,n(8,f)}const W=()=>{U(w)};function he(_){y=_,n(5,y)}function ne(_){N=_,n(6,N)}const _e=async()=>{await jt(),je.set(await Ue(localStorage.token))};function oe(_){H=_,n(3,H)}return[i,p,g,H,S,y,N,w,f,t,r,o,a,s,d,V,D,U,A,q,ee,E,J,se,R,me,fe,ie,$e,te,P,ye,X,ge,ve,we,Ee,L,W,he,ne,_e,oe,()=>{const _=new FileReader;_.onload=async B=>{const j=JSON.parse(B.target.result);console.log(j);for(const ue of j)await Rt(localStorage.token,ue).catch(ce=>(de.error(ce),null));de.success(t.t("Functions imported successfully")),Ae.set(await nt(localStorage.token)),je.set(await Ue(localStorage.token))},_.readAsText(g[0])}]}class Mn extends Je{constructor(e){super(),Pe(this,e,Sn,Hn,qe,{},null,[-1,-1])}}function Cn(l){let e,n;return e=new Mn({}),{c(){x(e.$$.fragment)},l(t){G(e.$$.fragment,t)},m(t,r){O(e,t,r),n=!0},p:Ze,i(t){n||(F(e.$$.fragment,t),n=!0)},o(t){T(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}class Qn extends Je{constructor(e){super(),Pe(this,e,null,Cn,qe,{})}}export{Qn as component}; //# sourceMappingURL=13.Co_9uU9W.js.map