shuvom's picture
Upload folder using huggingface_hub
5f5d58c
import { r as resolve_wasm_src } from './file-url-a54881a3.js';
/* home/runner/work/gradio/gradio/js/wasm/svelte/DownloadLink.svelte generated by Svelte v4.2.2 */
const {
SvelteComponent,
append,
assign,
compute_rest_props,
create_slot,
detach,
element,
empty,
exclude_internal_props,
get_all_dirty_from_scope,
get_slot_changes,
get_spread_update,
handle_promise,
init,
insert,
listen,
noop,
safe_not_equal,
set_attributes,
set_data,
set_style,
text,
transition_in,
transition_out,
update_await_block_branch,
update_slot_base
} = window.__gradio__svelte__internal;
const { createEventDispatcher } = window.__gradio__svelte__internal;
function create_catch_block(ctx) {
let p;
let t_value = /*error*/ ctx[7].message + "";
let t;
return {
c() {
p = element("p");
t = text(t_value);
set_style(p, "color", "red");
},
m(target, anchor) {
insert(target, p, anchor);
append(p, t);
},
p(ctx, dirty) {
if (dirty & /*href*/ 1 && t_value !== (t_value = /*error*/ ctx[7].message + "")) set_data(t, t_value);
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(p);
}
}
};
}
// (8:50) <a href={resolved_href}
function create_then_block(ctx) {
let a;
let a_href_value;
let a_target_value;
let current;
let mounted;
let dispose;
const default_slot_template = /*#slots*/ ctx[5].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[4], null);
let a_levels = [
{
href: a_href_value = /*resolved_href*/ ctx[6]
},
{
target: a_target_value = window.__is_colab__ ? "_blank" : null
},
{ rel: "noopener noreferrer" },
{ download: /*download*/ ctx[1] },
/*$$restProps*/ ctx[3]
];
let a_data = {};
for (let i = 0; i < a_levels.length; i += 1) {
a_data = assign(a_data, a_levels[i]);
}
return {
c() {
a = element("a");
if (default_slot) default_slot.c();
set_attributes(a, a_data);
},
m(target, anchor) {
insert(target, a, anchor);
if (default_slot) {
default_slot.m(a, null);
}
current = true;
if (!mounted) {
dispose = listen(a, "click", /*dispatch*/ ctx[2].bind(null, "click"));
mounted = true;
}
},
p(ctx, dirty) {
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/ 16)) {
update_slot_base(
default_slot,
default_slot_template,
ctx,
/*$$scope*/ ctx[4],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[4])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[4], dirty, null),
null
);
}
}
set_attributes(a, a_data = get_spread_update(a_levels, [
(!current || dirty & /*href*/ 1 && a_href_value !== (a_href_value = /*resolved_href*/ ctx[6])) && { href: a_href_value },
{ target: a_target_value },
{ rel: "noopener noreferrer" },
(!current || dirty & /*download*/ 2) && { download: /*download*/ ctx[1] },
dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]
]));
},
i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(a);
}
if (default_slot) default_slot.d(detaching);
mounted = false;
dispose();
}
};
}
// (1:0) <script lang="ts">import { createEventDispatcher }
function create_pending_block(ctx) {
return {
c: noop,
m: noop,
p: noop,
i: noop,
o: noop,
d: noop
};
}
function create_fragment(ctx) {
let await_block_anchor;
let promise;
let current;
let info = {
ctx,
current: null,
token: null,
hasCatch: true,
pending: create_pending_block,
then: create_then_block,
catch: create_catch_block,
value: 6,
error: 7,
blocks: [,,,]
};
handle_promise(promise = resolve_wasm_src(/*href*/ ctx[0]), info);
return {
c() {
await_block_anchor = empty();
info.block.c();
},
m(target, anchor) {
insert(target, await_block_anchor, anchor);
info.block.m(target, info.anchor = anchor);
info.mount = () => await_block_anchor.parentNode;
info.anchor = await_block_anchor;
current = true;
},
p(new_ctx, [dirty]) {
ctx = new_ctx;
info.ctx = ctx;
if (dirty & /*href*/ 1 && promise !== (promise = resolve_wasm_src(/*href*/ ctx[0])) && handle_promise(promise, info)) ; else {
update_await_block_branch(info, ctx, dirty);
}
},
i(local) {
if (current) return;
transition_in(info.block);
current = true;
},
o(local) {
for (let i = 0; i < 3; i += 1) {
const block = info.blocks[i];
transition_out(block);
}
current = false;
},
d(detaching) {
if (detaching) {
detach(await_block_anchor);
}
info.block.d(detaching);
info.token = null;
info = null;
}
};
}
function instance($$self, $$props, $$invalidate) {
const omit_props_names = ["href","download"];
let $$restProps = compute_rest_props($$props, omit_props_names);
let { $$slots: slots = {}, $$scope } = $$props;
let { href = undefined } = $$props;
let { download } = $$props;
const dispatch = createEventDispatcher();
$$self.$$set = $$new_props => {
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
if ('href' in $$new_props) $$invalidate(0, href = $$new_props.href);
if ('download' in $$new_props) $$invalidate(1, download = $$new_props.download);
if ('$$scope' in $$new_props) $$invalidate(4, $$scope = $$new_props.$$scope);
};
return [href, download, dispatch, $$restProps, $$scope, slots];
}
class DownloadLink extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { href: 0, download: 1 });
}
}
export { DownloadLink as D };
//# sourceMappingURL=DownloadLink-6272d37b.js.map