import{g as J}from"./Index-IwnOmiU7.js";import{s as K,g as M}from"./file-url-BM5vV6hM.js";const{SvelteComponent:P,assign:y,check_outros:F,compute_rest_props:O,create_slot:W,detach:L,element:G,empty:H,exclude_internal_props:Q,flush:B,get_all_dirty_from_scope:j,get_slot_changes:C,get_spread_update:S,group_outros:T,init:X,insert:R,listen:V,prevent_default:Y,safe_not_equal:Z,set_attributes:E,transition_in:p,transition_out:w,update_slot_base:N}=window.__gradio__svelte__internal,{createEventDispatcher:$}=window.__gradio__svelte__internal;function x(u){let e,l,n,r,a;const f=u[8].default,s=W(f,u,u[7],null);let i=[{href:u[0]},{target:l=typeof window<"u"&&window.__is_colab__?"_blank":null},{rel:"noopener noreferrer"},{download:u[1]},u[6]],t={};for(let o=0;o<i.length;o+=1)t=y(t,i[o]);return{c(){e=G("a"),s&&s.c(),E(e,t)},m(o,_){R(o,e,_),s&&s.m(e,null),n=!0,r||(a=V(e,"click",u[3].bind(null,"click")),r=!0)},p(o,_){s&&s.p&&(!n||_&128)&&N(s,f,o,o[7],n?C(f,o[7],_,null):j(o[7]),null),E(e,t=S(i,[(!n||_&1)&&{href:o[0]},{target:l},{rel:"noopener noreferrer"},(!n||_&2)&&{download:o[1]},_&64&&o[6]]))},i(o){n||(p(s,o),n=!0)},o(o){w(s,o),n=!1},d(o){o&&L(e),s&&s.d(o),r=!1,a()}}}function ee(u){let e,l,n,r;const a=[le,te],f=[];function s(i,t){return i[2]?0:1}return e=s(u),l=f[e]=a[e](u),{c(){l.c(),n=H()},m(i,t){f[e].m(i,t),R(i,n,t),r=!0},p(i,t){let o=e;e=s(i),e===o?f[e].p(i,t):(T(),w(f[o],1,1,()=>{f[o]=null}),F(),l=f[e],l?l.p(i,t):(l=f[e]=a[e](i),l.c()),p(l,1),l.m(n.parentNode,n))},i(i){r||(p(l),r=!0)},o(i){w(l),r=!1},d(i){i&&L(n),f[e].d(i)}}}function te(u){let e,l,n,r;const a=u[8].default,f=W(a,u,u[7],null);let s=[u[6],{href:u[0]}],i={};for(let t=0;t<s.length;t+=1)i=y(i,s[t]);return{c(){e=G("a"),f&&f.c(),E(e,i)},m(t,o){R(t,e,o),f&&f.m(e,null),l=!0,n||(r=V(e,"click",Y(u[5])),n=!0)},p(t,o){f&&f.p&&(!l||o&128)&&N(f,a,t,t[7],l?C(a,t[7],o,null):j(t[7]),null),E(e,i=S(s,[o&64&&t[6],(!l||o&1)&&{href:t[0]}]))},i(t){l||(p(f,t),l=!0)},o(t){w(f,t),l=!1},d(t){t&&L(e),f&&f.d(t),n=!1,r()}}}function le(u){let e;const l=u[8].default,n=W(l,u,u[7],null);return{c(){n&&n.c()},m(r,a){n&&n.m(r,a),e=!0},p(r,a){n&&n.p&&(!e||a&128)&&N(n,l,r,r[7],e?C(l,r[7],a,null):j(r[7]),null)},i(r){e||(p(n,r),e=!0)},o(r){w(n,r),e=!1},d(r){n&&n.d(r)}}}function ne(u){let e,l,n,r,a;const f=[ee,x],s=[];function i(t,o){return o&1&&(e=null),e==null&&(e=!!(t[4]&&K(t[0]))),e?0:1}return l=i(u,-1),n=s[l]=f[l](u),{c(){n.c(),r=H()},m(t,o){s[l].m(t,o),R(t,r,o),a=!0},p(t,[o]){let _=l;l=i(t,o),l===_?s[l].p(t,o):(T(),w(s[_],1,1,()=>{s[_]=null}),F(),n=s[l],n?n.p(t,o):(n=s[l]=f[l](t),n.c()),p(n,1),n.m(r.parentNode,r))},i(t){a||(p(n),a=!0)},o(t){w(n),a=!1},d(t){t&&L(r),s[l].d(t)}}}function oe(u,e,l){const n=["href","download"];let r=O(e,n),{$$slots:a={},$$scope:f}=e;var s=this&&this.__awaiter||function(c,b,h,k){function g(d){return d instanceof h?d:new h(function(v){v(d)})}return new(h||(h=Promise))(function(d,v){function A(m){try{q(k.next(m))}catch(D){v(D)}}function I(m){try{q(k.throw(m))}catch(D){v(D)}}function q(m){m.done?d(m.value):g(m.value).then(A,I)}q((k=k.apply(c,b||[])).next())})};let{href:i=void 0}=e,{download:t}=e;const o=$();let _=!1;const U=J();function z(){return s(this,void 0,void 0,function*(){if(_)return;if(o("click"),i==null)throw new Error("href is not defined.");if(U==null)throw new Error("Wasm worker proxy is not available.");const b=new URL(i,window.location.href).pathname;l(2,_=!0),U.httpRequest({method:"GET",path:b,headers:{},query_string:""}).then(h=>{if(h.status!==200)throw new Error(`Failed to get file ${b} from the Wasm worker.`);const k=new Blob([h.body],{type:M(h.headers,"content-type")}),g=URL.createObjectURL(k),d=document.createElement("a");d.href=g,d.download=t,d.click(),URL.revokeObjectURL(g)}).finally(()=>{l(2,_=!1)})})}return u.$$set=c=>{e=y(y({},e),Q(c)),l(6,r=O(e,n)),"href"in c&&l(0,i=c.href),"download"in c&&l(1,t=c.download),"$$scope"in c&&l(7,f=c.$$scope)},[i,t,_,o,U,z,r,f,a]}class fe extends P{constructor(e){super(),X(this,e,oe,ne,Z,{href:0,download:1})}get href(){return this.$$.ctx[0]}set href(e){this.$$set({href:e}),B()}get download(){return this.$$.ctx[1]}set download(e){this.$$set({download:e}),B()}}export{fe as D};
//# sourceMappingURL=DownloadLink-BA_CcWW8.js.map
