DuyTa's picture
Upload folder using huggingface_hub
bc20498 verified
import{s as S,l as d,i as h,d as I,p as v,j as R,q as V,n as q}from"../chunks/scheduler.DB3Sqaa-.js";import{S as U,i as T,t as p,a as f,c as N,g as O,b as $,d as y,m as W,e as B}from"../chunks/index.CidI1d1E.js";import{g as P}from"../chunks/entry.JtQ7vg2d.js";import{c as C,g as D}from"../chunks/index.DPxQAFah.js";import{T as J}from"../chunks/ToolkitEditor.Dt1ppRXF.js";import{c as k,t as M}from"../chunks/index.DPWiq6NR.js";import{e as Q,c as j}from"../chunks/index.DYGdzELC.js";import{t as w}from"../chunks/Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";function E(i){var l;let n=(l=i[2])==null?void 0:l.content,r,e,o=b(i);return{c(){o.c(),r=d()},l(s){o.l(s),r=d()},m(s,t){o.m(s,t),h(s,r,t),e=!0},p(s,t){var c;t&4&&S(n,n=(c=s[2])==null?void 0:c.content)?(O(),f(o,1,1,q),N(),o=b(s),o.c(),p(o,1),o.m(r.parentNode,r)):o.p(s,t)},i(s){e||(p(o),e=!0)},o(s){f(o),e=!1},d(s){s&&I(r),o.d(s)}}}function b(i){var e,o,l,s;let n,r;return n=new J({props:{id:((e=i[2])==null?void 0:e.id)??"",name:((o=i[2])==null?void 0:o.name)??"",meta:((l=i[2])==null?void 0:l.meta)??{description:""},content:((s=i[2])==null?void 0:s.content)??"",clone:i[1]}}),n.$on("save",i[5]),{c(){$(n.$$.fragment)},l(t){y(n.$$.fragment,t)},m(t,c){W(n,t,c),r=!0},p(t,c){var a,m,g,_;const u={};c&4&&(u.id=((a=t[2])==null?void 0:a.id)??""),c&4&&(u.name=((m=t[2])==null?void 0:m.name)??""),c&4&&(u.meta=((g=t[2])==null?void 0:g.meta)??{description:""}),c&4&&(u.content=((_=t[2])==null?void 0:_.content)??""),c&2&&(u.clone=t[1]),n.$set(u)},i(t){r||(p(n.$$.fragment,t),r=!0)},o(t){f(n.$$.fragment,t),r=!1},d(t){B(n,t)}}}function F(i){let n,r,e=i[0]&&E(i);return{c(){e&&e.c(),n=d()},l(o){e&&e.l(o),n=d()},m(o,l){e&&e.m(o,l),h(o,n,l),r=!0},p(o,[l]){o[0]?e?(e.p(o,l),l&1&&p(e,1)):(e=E(o),e.c(),p(e,1),e.m(n.parentNode,n)):e&&(O(),f(e,1,1,()=>{e=null}),N())},i(o){r||(p(e),r=!0)},o(o){f(e),r=!1},d(o){o&&I(n),e&&e.d(o)}}}function H(i,n,r){let e;const o=v("i18n");R(i,o,a=>r(6,e=a));let l=!1,s=!1,t=null;const c=async a=>{console.log(a);const m=Q(a.content);if(j((m==null?void 0:m.required_open_webui_version)??"0.0.0",k)){console.log("Version is lower than required"),w.error(e.t("Open WebUI version (v{{OPEN_WEBUI_VERSION}}) is lower than required version (v{{REQUIRED_VERSION}})",{OPEN_WEBUI_VERSION:k,REQUIRED_VERSION:(m==null?void 0:m.required_open_webui_version)??"0.0.0"}));return}await C(localStorage.token,{id:a.id,name:a.name,meta:a.meta,content:a.content}).catch(_=>(w.error(_),null))&&(w.success(e.t("Tool created successfully")),M.set(await D(localStorage.token)),await P("/workspace/tools"))};return V(()=>{window.addEventListener("message",async a=>{["https://openwebui.com","https://www.openwebui.com","http://localhost:9999"].includes(a.origin)&&(r(2,t=JSON.parse(a.data)),console.log(t))}),(window.opener??!1)&&window.opener.postMessage("loaded","*"),sessionStorage.tool&&(r(2,t=JSON.parse(sessionStorage.tool)),sessionStorage.removeItem("tool"),console.log(t),r(1,s=!0)),r(0,l=!0)}),[l,s,t,o,c,a=>{c(a.detail)}]}class x extends U{constructor(n){super(),T(this,n,H,F,S,{})}}export{x as component};
//# sourceMappingURL=23.DnIpfPcE.js.map