1import { i as identity, s as split_css_unit } from './Index-2cec2c56.js'; 2import { g as get_fetchable_url_or_file } from './index-5550136d.js'; 3 4/* 5Adapted from https://github.com/mattdesl 6Distributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md 7*/ 8 9/** 10 * https://svelte.dev/docs/svelte-easing 11 * @param {number} t 12 * @returns {number} 13 */ 14function cubicOut(t) { 15 const f = t - 1.0; 16 return f * f * f + 1.0; 17} 18 19/** 20 * Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions. 21 * 22 * https://svelte.dev/docs/svelte-transition#fade 23 * @param {Element} node 24 * @param {import('./public').FadeParams} [params] 25 * @returns {import('./public').TransitionConfig} 26 */ 27function fade(node, { delay = 0, duration = 400, easing = identity } = {}) { 28 const o = +getComputedStyle(node).opacity; 29 return { 30 delay, 31 duration, 32 easing, 33 css: (t) => `opacity: ${t * o}` 34 }; 35} 36 37/** 38 * Animates the x and y positions and the opacity of an element. `in` transitions animate from the provided values, passed as parameters to the element's default values. `out` transitions animate from the element's default values to the provided values. 39 * 40 * https://svelte.dev/docs/svelte-transition#fly 41 * @param {Element} node 42 * @param {import('./public').FlyParams} [params] 43 * @returns {import('./public').TransitionConfig} 44 */ 45function fly( 46 node, 47 { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {} 48) { 49 const style = getComputedStyle(node); 50 const target_opacity = +style.opacity; 51 const transform = style.transform === 'none' ? '' : style.transform; 52 const od = target_opacity * (1 - opacity); 53 const [xValue, xUnit] = split_css_unit(x); 54 const [yValue, yUnit] = split_css_unit(y); 55 return { 56 delay, 57 duration, 58 easing, 59 css: (t, u) => ` 60 transform: ${transform} translate(${(1 - t) * xValue}${xUnit}, ${(1 - t) * yValue}${yUnit}); 61 opacity: ${target_opacity - od * u}` 62 }; 63} 64 65const Block_svelte_svelte_type_style_lang = ''; 66 67/* home/runner/work/gradio/gradio/js/atoms/src/Block.svelte generated by Svelte v4.2.2 */ 68const { 69 SvelteComponent: SvelteComponent$1, 70 assign, 71 create_slot: create_slot$1, 72 detach: detach$1, 73 element: element$1, 74 get_all_dirty_from_scope: get_all_dirty_from_scope$1, 75 get_slot_changes: get_slot_changes$1, 76 get_spread_update, 77 init: init$1, 78 insert: insert$1, 79 safe_not_equal: safe_not_equal$1, 80 set_dynamic_element_data, 81 set_style: set_style$1, 82 toggle_class: toggle_class$1, 83 transition_in: transition_in$1, 84 transition_out: transition_out$1, 85 update_slot_base: update_slot_base$1 86} = window.__gradio__svelte__internal; 87function create_dynamic_element(ctx) { 88 let svelte_element; 89 let svelte_element_class_value; 90 let current; 91 const default_slot_template = /*#slots*/ ctx[17].default; 92 const default_slot = create_slot$1(default_slot_template, ctx, /*$$scope*/ ctx[16], null); 93 94 let svelte_element_levels = [ 95 { "data-testid": /*test_id*/ ctx[7] }, 96 { id: /*elem_id*/ ctx[2] }, 97 { 98 class: svelte_element_class_value = "block " + /*elem_classes*/ ctx[3].join(' ') + " svelte-90oupt" 99 } 100 ]; 101 102 let svelte_element_data = {}; 103 104 for (let i = 0; i < svelte_element_levels.length; i += 1) { 105 svelte_element_data = assign(svelte_element_data, svelte_element_levels[i]); 106 } 107 108 return { 109 c() { 110 svelte_element = element$1(/*tag*/ ctx[14]); 111 if (default_slot) default_slot.c(); 112 set_dynamic_element_data(/*tag*/ ctx[14])(svelte_element, svelte_element_data); 113 toggle_class$1(svelte_element, "hidden", /*visible*/ ctx[10] === false); 114 toggle_class$1(svelte_element, "padded", /*padding*/ ctx[6]); 115 toggle_class$1(svelte_element, "border_focus", /*border_mode*/ ctx[5] === "focus"); 116 toggle_class$1(svelte_element, "hide-container", !/*explicit_call*/ ctx[8] && !/*container*/ ctx[9]); 117 118 set_style$1(svelte_element, "height", typeof /*height*/ ctx[0] === "number" 119 ? /*height*/ ctx[0] + "px" 120 : undefined); 121 122 set_style$1(svelte_element, "width", typeof /*width*/ ctx[1] === "number" 123 ? `calc(min(${/*width*/ ctx[1]}px, 100%))` 124 : undefined); 125 126 set_style$1(svelte_element, "border-style", /*variant*/ ctx[4]); 127 set_style$1(svelte_element, "overflow", /*allow_overflow*/ ctx[11] ? "visible" : "hidden"); 128 set_style$1(svelte_element, "flex-grow", /*scale*/ ctx[12]); 129 set_style$1(svelte_element, "min-width", `calc(min(${/*min_width*/ ctx[13]}px, 100%))`); 130 set_style$1(svelte_element, "border-width", `var(--block-border-width)`); 131 }, 132 m(target, anchor) {
133 insert$1(target, svelte_element, anchor); 134 135 if (default_slot) { 136 default_slot.m(svelte_element, null); 137 } 138 139 current = true; 140 }, 141 p(ctx, dirty) { 142 if (default_slot) { 143 if (default_slot.p && (!current || dirty & /*$$scope*/ 65536)) { 144 update_slot_base$1( 145 default_slot, 146 default_slot_template, 147 ctx, 148 /*$$scope*/ ctx[16], 149 !current 150 ? get_all_dirty_from_scope$1(/*$$scope*/ ctx[16]) 151 : get_slot_changes$1(default_slot_template, /*$$scope*/ ctx[16], dirty, null), 152 null 153 ); 154 } 155 } 156 157 set_dynamic_element_data(/*tag*/ ctx[14])(svelte_element, svelte_element_data = get_spread_update(svelte_element_levels, [ 158 (!current || dirty & /*test_id*/ 128) && { "data-testid": /*test_id*/ ctx[7] }, 159 (!current || dirty & /*elem_id*/ 4) && { id: /*elem_id*/ ctx[2] }, 160 (!current || dirty & /*elem_classes*/ 8 && svelte_element_class_value !== (svelte_element_class_value = "block " + /*elem_classes*/ ctx[3].join(' ') + " svelte-90oupt")) && { class: svelte_element_class_value } 161 ])); 162 163 toggle_class$1(svelte_element, "hidden", /*visible*/ ctx[10] === false); 164 toggle_class$1(svelte_element, "padded", /*padding*/ ctx[6]); 165 toggle_class$1(svelte_element, "border_focus", /*border_mode*/ ctx[5] === "focus"); 166 toggle_class$1(svelte_element, "hide-container", !/*explicit_call*/ ctx[8] && !/*container*/ ctx[9]); 167 168 if (dirty & /*height*/ 1) { 169 set_style$1(svelte_element, "height", typeof /*height*/ ctx[0] === "number" 170 ? /*height*/ ctx[0] + "px" 171 : undefined); 172 } 173 174 if (dirty & /*width*/ 2) { 175 set_style$1(svelte_element, "width", typeof /*width*/ ctx[1] === "number" 176 ? `calc(min(${/*width*/ ctx[1]}px, 100%))` 177 : undefined); 178 } 179 180 if (dirty & /*variant*/ 16) { 181 set_style$1(svelte_element, "border-style", /*variant*/ ctx[4]); 182 } 183 184 if (dirty & /*allow_overflow*/ 2048) { 185 set_style$1(svelte_element, "overflow", /*allow_overflow*/ ctx[11] ? "visible" : "hidden"); 186 } 187 188 if (dirty & /*scale*/ 4096) { 189 set_style$1(svelte_element, "flex-grow", /*scale*/ ctx[12]); 190 } 191 192 if (dirty & /*min_width*/ 8192) { 193 set_style$1(svelte_element, "min-width", `calc(min(${/*min_width*/ ctx[13]}px, 100%))`); 194 } 195 }, 196 i(local) { 197 if (current) return; 198 transition_in$1(default_slot, local); 199 current = true; 200 }, 201 o(local) { 202 transition_out$1(default_slot, local); 203 current = false; 204 }, 205 d(detaching) { 206 if (detaching) { 207 detach$1(svelte_element); 208 } 209 210 if (default_slot) default_slot.d(detaching); 211 } 212 }; 213} 214 215function create_fragment$1(ctx) { 216 let current; 217 let svelte_element = /*tag*/ ctx[14] && create_dynamic_element(ctx); 218 219 return { 220 c() { 221 if (svelte_element) svelte_element.c(); 222 }, 223 m(target, anchor) { 224 if (svelte_element) svelte_element.m(target, anchor); 225 current = true; 226 }, 227 p(ctx, [dirty]) { 228 if (/*tag*/ ctx[14]) { 229 svelte_element.p(ctx, dirty); 230 } 231 }, 232 i(local) { 233 if (current) return; 234 transition_in$1(svelte_element, local); 235 current = true; 236 }, 237 o(local) { 238 transition_out$1(svelte_element, local); 239 current = false; 240 }, 241 d(detaching) { 242 if (svelte_element) svelte_element.d(detaching); 243 } 244 }; 245} 246 247function instance$1($$self, $$props, $$invalidate) { 248 let { $$slots: slots = {}, $$scope } = $$props; 249 let { height = undefined } = $$props; 250 let { width = undefined } = $$props; 251 let { elem_id = "" } = $$props; 252 let { elem_classes = [] } = $$props; 253 let { variant = "solid" } = $$props; 254 let { border_mode = "base" } = $$props; 255 let { padding = true } = $$props; 256 let { type = "normal" } = $$props; 257 let { test_id = undefined } = $$props; 258 let { explicit_call = false } = $$props; 259 let { container = true } = $$props; 260 let { visible = true } = $$props; 261 let { allow_overflow = true } = $$props; 262 let { scale = null } = $$props; 263 let { min_width = 0 } = $$props; 264 let tag = type === "fieldset" ? "fieldset" : "div"; 265 266 $$self.$$set = $$props => {
267 if ('height' in $$props) $$invalidate(0, height = $$props.height); 268 if ('width' in $$props) $$invalidate(1, width = $$props.width); 269 if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id); 270 if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes); 271 if ('variant' in $$props) $$invalidate(4, variant = $$props.variant); 272 if ('border_mode' in $$props) $$invalidate(5, border_mode = $$props.border_mode); 273 if ('padding' in $$props) $$invalidate(6, padding = $$props.padding); 274 if ('type' in $$props) $$invalidate(15, type = $$props.type); 275 if ('test_id' in $$props) $$invalidate(7, test_id = $$props.test_id); 276 if ('explicit_call' in $$props) $$invalidate(8, explicit_call = $$props.explicit_call); 277 if ('container' in $$props) $$invalidate(9, container = $$props.container); 278 if ('visible' in $$props) $$invalidate(10, visible = $$props.visible); 279 if ('allow_overflow' in $$props) $$invalidate(11, allow_overflow = $$props.allow_overflow); 280 if ('scale' in $$props) $$invalidate(12, scale = $$props.scale);
281 if ('min_width' in $$props) $$invalidate(13, min_width = $$props.min_width); 282 if ('$$scope' in $$props) $$invalidate(16, $$scope = $$props.$$scope); 283 }; 284 285 return [ 286 height, 287 width, 288 elem_id, 289 elem_classes, 290 variant, 291 border_mode, 292 padding, 293 test_id, 294 explicit_call, 295 container, 296 visible, 297 allow_overflow, 298 scale, 299 min_width, 300 tag, 301 type, 302 $$scope, 303 slots 304 ]; 305} 306 307class Block extends SvelteComponent$1 { 308 constructor(options) { 309 super(); 310 311 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 312 height: 0, 313 width: 1, 314 elem_id: 2, 315 elem_classes: 3, 316 variant: 4, 317 border_mode: 5, 318 padding: 6, 319 type: 15, 320 test_id: 7, 321 explicit_call: 8, 322 container: 9, 323 visible: 10, 324 allow_overflow: 11, 325 scale: 12, 326 min_width: 13 327 }); 328 } 329} 330 331const Info_svelte_svelte_type_style_lang = ''; 332 333const BlockTitle_svelte_svelte_type_style_lang = ''; 334 335const BlockLabel_svelte_svelte_type_style_lang = ''; 336 337const IconButton_svelte_svelte_type_style_lang = ''; 338 339const Empty_svelte_svelte_type_style_lang = ''; 340 341const ordered_colors = [ 342 "red", 343 "green", 344 "blue", 345 "yellow", 346 "purple", 347 "teal", 348 "orange", 349 "cyan", 350 "lime", 351 "pink" 352]; 353const color_values = [ 354 { color: "red", primary: 600, secondary: 100 }, 355 { color: "green", primary: 600, secondary: 100 }, 356 { color: "blue", primary: 600, secondary: 100 }, 357 { color: "yellow", primary: 500, secondary: 100 }, 358 { color: "purple", primary: 600, secondary: 100 }, 359 { color: "teal", primary: 600, secondary: 100 }, 360 { color: "orange", primary: 600, secondary: 100 }, 361 { color: "cyan", primary: 600, secondary: 100 }, 362 { color: "lime", primary: 500, secondary: 100 }, 363 { color: "pink", primary: 600, secondary: 100 } 364]; 365const tw_colors = { 366 inherit: "inherit", 367 current: "currentColor", 368 transparent: "transparent", 369 black: "#000", 370 white: "#fff", 371 slate: { 372 50: "#f8fafc", 373 100: "#f1f5f9", 374 200: "#e2e8f0", 375 300: "#cbd5e1", 376 400: "#94a3b8", 377 500: "#64748b", 378 600: "#475569", 379 700: "#334155", 380 800: "#1e293b", 381 900: "#0f172a", 382 950: "#020617" 383 }, 384 gray: { 385 50: "#f9fafb", 386 100: "#f3f4f6", 387 200: "#e5e7eb", 388 300: "#d1d5db", 389 400: "#9ca3af", 390 500: "#6b7280", 391 600: "#4b5563", 392 700: "#374151", 393 800: "#1f2937", 394 900: "#111827", 395 950: "#030712" 396 }, 397 zinc: { 398 50: "#fafafa", 399 100: "#f4f4f5", 400 200: "#e4e4e7", 401 300: "#d4d4d8", 402 400: "#a1a1aa", 403 500: "#71717a", 404 600: "#52525b", 405 700: "#3f3f46", 406 800: "#27272a", 407 900: "#18181b", 408 950: "#09090b" 409 }, 410 neutral: { 411 50: "#fafafa", 412 100: "#f5f5f5", 413 200: "#e5e5e5", 414 300: "#d4d4d4", 415 400: "#a3a3a3", 416 500: "#737373", 417 600: "#525252", 418 700: "#404040", 419 800: "#262626", 420 900: "#171717", 421 950: "#0a0a0a" 422 }, 423 stone: { 424 50: "#fafaf9", 425 100: "#f5f5f4", 426 200: "#e7e5e4", 427 300: "#d6d3d1", 428 400: "#a8a29e", 429 500: "#78716c", 430 600: "#57534e", 431 700: "#44403c", 432 800: "#292524", 433 900: "#1c1917", 434 950: "#0c0a09" 435 }, 436 red: { 437 50: "#fef2f2", 438 100: "#fee2e2", 439 200: "#fecaca", 440 300: "#fca5a5", 441 400: "#f87171", 442 500: "#ef4444", 443 600: "#dc2626", 444 700: "#b91c1c", 445 800: "#991b1b", 446 900: "#7f1d1d", 447 950: "#450a0a" 448 }, 449 orange: { 450 50: "#fff7ed", 451 100: "#ffedd5", 452 200: "#fed7aa", 453 300: "#fdba74", 454 400: "#fb923c", 455 500: "#f97316", 456 600: "#ea580c", 457 700: "#c2410c", 458 800: "#9a3412", 459 900: "#7c2d12", 460 950: "#431407" 461 }, 462 amber: { 463 50: "#fffbeb", 464 100: "#fef3c7", 465 200: "#fde68a", 466 300: "#fcd34d", 467 400: "#fbbf24", 468 500: "#f59e0b", 469 600: "#d97706", 470 700: "#b45309", 471 800: "#92400e", 472 900: "#78350f", 473 950: "#451a03" 474 }, 475 yellow: { 476 50: "#fefce8", 477 100: "#fef9c3", 478 200: "#fef08a", 479 300: "#fde047", 480 400: "#facc15", 481 500: "#eab308", 482 600: "#ca8a04", 483 700: "#a16207", 484 800: "#854d0e", 485 900: "#713f12", 486 950: "#422006" 487 }, 488 lime: { 489 50: "#f7fee7", 490 100: "#ecfccb", 491 200: "#d9f99d", 492 300: "#bef264", 493 400: "#a3e635", 494 500: "#84cc16", 495 600: "#65a30d", 496 700: "#4d7c0f", 497 800: "#3f6212", 498 900: "#365314", 499 950: "#1a2e05" 500 }, 501 green: { 502 50: "#f0fdf4", 503 100: "#dcfce7", 504 200: "#bbf7d0", 505 300: "#86efac", 506 400: "#4ade80", 507 500: "#22c55e", 508 600: "#16a34a", 509 700: "#15803d", 510 800: "#166534", 511 900: "#14532d", 512 950: "#052e16" 513 }, 514 emerald: {
515 50: "#ecfdf5", 516 100: "#d1fae5", 517 200: "#a7f3d0", 518 300: "#6ee7b7", 519 400: "#34d399", 520 500: "#10b981", 521 600: "#059669", 522 700: "#047857", 523 800: "#065f46", 524 900: "#064e3b", 525 950: "#022c22" 526 }, 527 teal: { 528 50: "#f0fdfa", 529 100: "#ccfbf1", 530 200: "#99f6e4", 531 300: "#5eead4", 532 400: "#2dd4bf", 533 500: "#14b8a6", 534 600: "#0d9488", 535 700: "#0f766e", 536 800: "#115e59", 537 900: "#134e4a", 538 950: "#042f2e" 539 }, 540 cyan: { 541 50: "#ecfeff", 542 100: "#cffafe", 543 200: "#a5f3fc", 544 300: "#67e8f9", 545 400: "#22d3ee", 546 500: "#06b6d4", 547 600: "#0891b2", 548 700: "#0e7490", 549 800: "#155e75", 550 900: "#164e63", 551 950: "#083344" 552 }, 553 sky: { 554 50: "#f0f9ff", 555 100: "#e0f2fe", 556 200: "#bae6fd", 557 300: "#7dd3fc", 558 400: "#38bdf8", 559 500: "#0ea5e9", 560 600: "#0284c7", 561 700: "#0369a1", 562 800: "#075985", 563 900: "#0c4a6e", 564 950: "#082f49" 565 }, 566 blue: { 567 50: "#eff6ff", 568 100: "#dbeafe", 569 200: "#bfdbfe", 570 300: "#93c5fd", 571 400: "#60a5fa", 572 500: "#3b82f6", 573 600: "#2563eb", 574 700: "#1d4ed8", 575 800: "#1e40af", 576 900: "#1e3a8a", 577 950: "#172554" 578 }, 579 indigo: { 580 50: "#eef2ff", 581 100: "#e0e7ff", 582 200: "#c7d2fe", 583 300: "#a5b4fc", 584 400: "#818cf8", 585 500: "#6366f1", 586 600: "#4f46e5", 587 700: "#4338ca", 588 800: "#3730a3", 589 900: "#312e81", 590 950: "#1e1b4b" 591 }, 592 violet: { 593 50: "#f5f3ff", 594 100: "#ede9fe", 595 200: "#ddd6fe", 596 300: "#c4b5fd", 597 400: "#a78bfa", 598 500: "#8b5cf6", 599 600: "#7c3aed", 600 700: "#6d28d9", 601 800: "#5b21b6", 602 900: "#4c1d95", 603 950: "#2e1065" 604 }, 605 purple: { 606 50: "#faf5ff", 607 100: "#f3e8ff", 608 200: "#e9d5ff", 609 300: "#d8b4fe", 610 400: "#c084fc", 611 500: "#a855f7", 612 600: "#9333ea", 613 700: "#7e22ce", 614 800: "#6b21a8", 615 900: "#581c87", 616 950: "#3b0764" 617 }, 618 fuchsia: { 619 50: "#fdf4ff", 620 100: "#fae8ff", 621 200: "#f5d0fe", 622 300: "#f0abfc", 623 400: "#e879f9", 624 500: "#d946ef", 625 600: "#c026d3", 626 700: "#a21caf", 627 800: "#86198f", 628 900: "#701a75", 629 950: "#4a044e" 630 }, 631 pink: { 632 50: "#fdf2f8", 633 100: "#fce7f3", 634 200: "#fbcfe8", 635 300: "#f9a8d4", 636 400: "#f472b6", 637 500: "#ec4899", 638 600: "#db2777", 639 700: "#be185d", 640 800: "#9d174d", 641 900: "#831843", 642 950: "#500724" 643 }, 644 rose: { 645 50: "#fff1f2", 646 100: "#ffe4e6", 647 200: "#fecdd3", 648 300: "#fda4af", 649 400: "#fb7185", 650 500: "#f43f5e", 651 600: "#e11d48", 652 700: "#be123c", 653 800: "#9f1239", 654 900: "#881337", 655 950: "#4c0519" 656 } 657}; 658const colors = color_values.reduce( 659 (acc, { color, primary, secondary }) => ({ 660 ...acc, 661 [color]: { 662 primary: tw_colors[color][primary], 663 secondary: tw_colors[color][secondary] 664 } 665 }), 666 {} 667); 668 669const UploadText_svelte_svelte_type_style_lang = ''; 670 671const Toolbar_svelte_svelte_type_style_lang = ''; 672 673const SelectSource_svelte_svelte_type_style_lang = ''; 674 675const Button_svelte_svelte_type_style_lang = ''; 676 677/* home/runner/work/gradio/gradio/js/button/shared/Button.svelte generated by Svelte v4.2.2 */ 678const { 679 SvelteComponent, 680 append, 681 attr, 682 bubble, 683 check_outros, 684 create_slot, 685 detach, 686 element, 687 empty, 688 get_all_dirty_from_scope, 689 get_slot_changes, 690 group_outros, 691 init, 692 insert, 693 listen, 694 safe_not_equal, 695 set_style, 696 space, 697 src_url_equal, 698 toggle_class, 699 transition_in, 700 transition_out, 701 update_slot_base 702} = window.__gradio__svelte__internal; 703function create_else_block(ctx) { 704 let button; 705 let t; 706 let button_class_value; 707 let current; 708 let mounted; 709 let dispose; 710 let if_block = /*icon*/ ctx[7] && create_if_block_2(ctx); 711 const default_slot_template = /*#slots*/ ctx[15].default; 712 const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[14], null); 713 714 return { 715 c() { 716 button = element("button"); 717 if (if_block) if_block.c(); 718 t = space(); 719 if (default_slot) default_slot.c(); 720 attr(button, "class", button_class_value = "" + (/*size*/ ctx[4] + " " + /*variant*/ ctx[3] + " " + /*elem_classes*/ ctx[1].join(' ') + " svelte-cmf5ev")); 721 attr(button, "id", /*elem_id*/ ctx[0]); 722 button.disabled = /*disabled*/ ctx[8]; 723 toggle_class(button, "hidden", !/*visible*/ ctx[2]); 724 set_style(button, "flex-grow", /*scale*/ ctx[9]); 725 set_style(button, "width", /*scale*/ ctx[9] === 0 ? "fit-content" : null); 726 727 set_style(button, "min-width", typeof /*min_width*/ ctx[10] === "number" 728 ? `calc(min(${/*min_width*/ ctx[10]}px, 100%))` 729 : null); 730 }, 731 m(target, anchor) { 732 insert(target, button, anchor); 733 if (if_block) if_block.m(button, null); 734 append(button, t); 735 736 if (default_slot) { 737 default_slot.m(button, null); 738 } 739 740 current = true; 741 742 if (!mounted) { 743 dispose = listen(button, "click", /*click_handler*/ ctx[16]); 744 mounted = true; 745 } 746 }, 747 p(ctx, dirty) { 748 if (/*icon*/ ctx[7]) { 749 if (if_block) { 750 if_block.p(ctx, dirty); 751 } else { 752 if_block = create_if_block_2(ctx); 753 if_block.c(); 754 if_block.m(button, t); 755 } 756 } else if (if_block) { 757 if_block.d(1); 758 if_block = null; 759 } 760 761 if (default_slot) { 762 if (default_slot.p && (!current || dirty & /*$$scope*/ 16384)) { 763 update_slot_base( 764 default_slot, 765 default_slot_template, 766 ctx, 767 /*$$scope*/ ctx[14], 768 !current 769 ? get_all_dirty_from_scope(/*$$scope*/ ctx[14]) 770 : get_slot_changes(default_slot_template, /*$$scope*/ ctx[14], dirty, null), 771 null 772 ); 773 } 774 } 775 776 if (!current || dirty & /*size, variant, elem_classes*/ 26 && button_class_value !== (button_class_value = "" + (/*size*/ ctx[4] + " " + /*variant*/ ctx[3] + " " + /*elem_classes*/ ctx[1].join(' ') + " svelte-cmf5ev"))) { 777 attr(button, "class", button_class_value); 778 } 779 780 if (!current || dirty & /*elem_id*/ 1) { 781 attr(button, "id", /*elem_id*/ ctx[0]); 782 } 783 784 if (!current || dirty & /*disabled*/ 256) { 785 button.disabled = /*disabled*/ ctx[8]; 786 } 787 788 if (!current || dirty & /*size, variant, elem_classes, visible*/ 30) { 789 toggle_class(button, "hidden", !/*visible*/ ctx[2]); 790 } 791
792 if (dirty & /*scale*/ 512) { 793 set_style(button, "flex-grow", /*scale*/ ctx[9]); 794 } 795 796 if (dirty & /*scale*/ 512) { 797 set_style(button, "width", /*scale*/ ctx[9] === 0 ? "fit-content" : null); 798 } 799 800 if (dirty & /*min_width*/ 1024) { 801 set_style(button, "min-width", typeof /*min_width*/ ctx[10] === "number" 802 ? `calc(min(${/*min_width*/ ctx[10]}px, 100%))` 803 : null); 804 } 805 }, 806 i(local) { 807 if (current) return; 808 transition_in(default_slot, local); 809 current = true; 810 }, 811 o(local) { 812 transition_out(default_slot, local); 813 current = false; 814 }, 815 d(detaching) { 816 if (detaching) { 817 detach(button); 818 } 819 820 if (if_block) if_block.d(); 821 if (default_slot) default_slot.d(detaching); 822 mounted = false; 823 dispose(); 824 } 825 }; 826} 827 828// (18:0) {#if link && link.length > 0} 829function create_if_block(ctx) { 830 let a; 831 let t; 832 let a_class_value; 833 let current; 834 let if_block = /*icon*/ ctx[7] && create_if_block_1(ctx); 835 const default_slot_template = /*#slots*/ ctx[15].default; 836 const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[14], null); 837 838 return { 839 c() { 840 a = element("a"); 841 if (if_block) if_block.c(); 842 t = space(); 843 if (default_slot) default_slot.c(); 844 attr(a, "href", /*link*/ ctx[6]); 845 attr(a, "rel", "noopener noreferrer"); 846 attr(a, "aria-disabled", /*disabled*/ ctx[8]); 847 attr(a, "class", a_class_value = "" + (/*size*/ ctx[4] + " " + /*variant*/ ctx[3] + " " + /*elem_classes*/ ctx[1].join(' ') + " svelte-cmf5ev")); 848 attr(a, "id", /*elem_id*/ ctx[0]); 849 toggle_class(a, "hidden", !/*visible*/ ctx[2]); 850 toggle_class(a, "disabled", /*disabled*/ ctx[8]); 851 set_style(a, "flex-grow", /*scale*/ ctx[9]); 852 set_style(a, "pointer-events", /*disabled*/ ctx[8] ? "none" : null); 853 set_style(a, "width", /*scale*/ ctx[9] === 0 ? "fit-content" : null); 854 855 set_style(a, "min-width", typeof /*min_width*/ ctx[10] === "number" 856 ? `calc(min(${/*min_width*/ ctx[10]}px, 100%))` 857 : null); 858 }, 859 m(target, anchor) { 860 insert(target, a, anchor); 861 if (if_block) if_block.m(a, null); 862 append(a, t); 863 864 if (default_slot) { 865 default_slot.m(a, null); 866 } 867 868 current = true; 869 }, 870 p(ctx, dirty) { 871 if (/*icon*/ ctx[7]) { 872 if (if_block) { 873 if_block.p(ctx, dirty); 874 } else { 875 if_block = create_if_block_1(ctx); 876 if_block.c(); 877 if_block.m(a, t); 878 } 879 } else if (if_block) { 880 if_block.d(1); 881 if_block = null; 882 } 883 884 if (default_slot) { 885 if (default_slot.p && (!current || dirty & /*$$scope*/ 16384)) { 886 update_slot_base( 887 default_slot, 888 default_slot_template, 889 ctx, 890 /*$$scope*/ ctx[14], 891 !current 892 ? get_all_dirty_from_scope(/*$$scope*/ ctx[14]) 893 : get_slot_changes(default_slot_template, /*$$scope*/ ctx[14], dirty, null), 894 null 895 ); 896 } 897 } 898 899 if (!current || dirty & /*link*/ 64) { 900 attr(a, "href", /*link*/ ctx[6]); 901 } 902 903 if (!current || dirty & /*disabled*/ 256) { 904 attr(a, "aria-disabled", /*disabled*/ ctx[8]); 905 } 906 907 if (!current || dirty & /*size, variant, elem_classes*/ 26 && a_class_value !== (a_class_value = "" + (/*size*/ ctx[4] + " " + /*variant*/ ctx[3] + " " + /*elem_classes*/ ctx[1].join(' ') + " svelte-cmf5ev"))) { 908 attr(a, "class", a_class_value); 909 } 910 911 if (!current || dirty & /*elem_id*/ 1) { 912 attr(a, "id", /*elem_id*/ ctx[0]); 913 } 914 915 if (!current || dirty & /*size, variant, elem_classes, visible*/ 30) { 916 toggle_class(a, "hidden", !/*visible*/ ctx[2]); 917 } 918 919 if (!current || dirty & /*size, variant, elem_classes, disabled*/ 282) { 920 toggle_class(a, "disabled", /*disabled*/ ctx[8]); 921 } 922 923 if (dirty & /*scale*/ 512) { 924 set_style(a, "flex-grow", /*scale*/ ctx[9]); 925 } 926 927 if (dirty & /*disabled*/ 256) { 928 set_style(a, "pointer-events", /*disabled*/ ctx[8] ? "none" : null); 929 } 930 931 if (dirty & /*scale*/ 512) { 932 set_style(a, "width", /*scale*/ ctx[9] === 0 ? "fit-content" : null); 933 } 934 935 if (dirty & /*min_width*/ 1024) { 936 set_style(a, "min-width", typeof /*min_width*/ ctx[10] === "number" 937 ? `calc(min(${/*min_width*/ ctx[10]}px, 100%))` 938 : null); 939 } 940 }, 941 i(local) { 942 if (current) return; 943 transition_in(default_slot, local); 944 current = true; 945 }, 946 o(local) { 947 transition_out(default_slot, local); 948 current = false;
949 }, 950 d(detaching) { 951 if (detaching) { 952 detach(a); 953 } 954 955 if (if_block) if_block.d(); 956 if (default_slot) default_slot.d(detaching); 957 } 958 }; 959} 960 961// (52:2) {#if icon} 962function create_if_block_2(ctx) { 963 let img; 964 let img_src_value; 965 let img_alt_value; 966 967 return { 968 c() { 969 img = element("img"); 970 attr(img, "class", "button-icon svelte-cmf5ev"); 971 if (!src_url_equal(img.src, img_src_value = /*icon_path*/ ctx[11])) attr(img, "src", img_src_value); 972 attr(img, "alt", img_alt_value = `${/*value*/ ctx[5]} icon`); 973 }, 974 m(target, anchor) { 975 insert(target, img, anchor); 976 }, 977 p(ctx, dirty) { 978 if (dirty & /*icon_path*/ 2048 && !src_url_equal(img.src, img_src_value = /*icon_path*/ ctx[11])) { 979 attr(img, "src", img_src_value); 980 } 981 982 if (dirty & /*value*/ 32 && img_alt_value !== (img_alt_value = `${/*value*/ ctx[5]} icon`)) { 983 attr(img, "alt", img_alt_value); 984 } 985 }, 986 d(detaching) { 987 if (detaching) { 988 detach(img); 989 } 990 } 991 }; 992} 993 994// (34:2) {#if icon} 995function create_if_block_1(ctx) { 996 let img; 997 let img_src_value; 998 let img_alt_value; 999 1000 return { 1001 c() { 1002 img = element("img"); 1003 attr(img, "class", "button-icon svelte-cmf5ev"); 1004 if (!src_url_equal(img.src, img_src_value = /*icon_path*/ ctx[11])) attr(img, "src", img_src_value); 1005 attr(img, "alt", img_alt_value = `${/*value*/ ctx[5]} icon`); 1006 }, 1007 m(target, anchor) { 1008 insert(target, img, anchor); 1009 }, 1010 p(ctx, dirty) { 1011 if (dirty & /*icon_path*/ 2048 && !src_url_equal(img.src, img_src_value = /*icon_path*/ ctx[11])) { 1012 attr(img, "src", img_src_value); 1013 } 1014 1015 if (dirty & /*value*/ 32 && img_alt_value !== (img_alt_value = `${/*value*/ ctx[5]} icon`)) { 1016 attr(img, "alt", img_alt_value); 1017 } 1018 }, 1019 d(detaching) { 1020 if (detaching) { 1021 detach(img); 1022 } 1023 } 1024 }; 1025} 1026 1027function create_fragment(ctx) { 1028 let current_block_type_index; 1029 let if_block; 1030 let if_block_anchor; 1031 let current; 1032 const if_block_creators = [create_if_block, create_else_block]; 1033 const if_blocks = []; 1034 1035 function select_block_type(ctx, dirty) { 1036 if (/*link*/ ctx[6] && /*link*/ ctx[6].length > 0) return 0; 1037 return 1; 1038 } 1039 1040 current_block_type_index = select_block_type(ctx); 1041 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1042 1043 return { 1044 c() { 1045 if_block.c(); 1046 if_block_anchor = empty(); 1047 }, 1048 m(target, anchor) { 1049 if_blocks[current_block_type_index].m(target, anchor); 1050 insert(target, if_block_anchor, anchor); 1051 current = true; 1052 }, 1053 p(ctx, [dirty]) { 1054 let previous_block_index = current_block_type_index; 1055 current_block_type_index = select_block_type(ctx); 1056 1057 if (current_block_type_index === previous_block_index) { 1058 if_blocks[current_block_type_index].p(ctx, dirty); 1059 } else { 1060 group_outros(); 1061 1062 transition_out(if_blocks[previous_block_index], 1, 1, () => { 1063 if_blocks[previous_block_index] = null; 1064 }); 1065 1066 check_outros(); 1067 if_block = if_blocks[current_block_type_index]; 1068 1069 if (!if_block) { 1070 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1071 if_block.c(); 1072 } else { 1073 if_block.p(ctx, dirty); 1074 } 1075 1076 transition_in(if_block, 1); 1077 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1078 } 1079 }, 1080 i(local) { 1081 if (current) return; 1082 transition_in(if_block); 1083 current = true; 1084 }, 1085 o(local) { 1086 transition_out(if_block); 1087 current = false; 1088 }, 1089 d(detaching) { 1090 if (detaching) { 1091 detach(if_block_anchor); 1092 } 1093 1094 if_blocks[current_block_type_index].d(detaching); 1095 } 1096 }; 1097} 1098 1099function instance($$self, $$props, $$invalidate) { 1100 let icon_path; 1101 let { $$slots: slots = {}, $$scope } = $$props; 1102 let { elem_id = "" } = $$props; 1103 let { elem_classes = [] } = $$props; 1104 let { visible = true } = $$props; 1105 let { variant = "secondary" } = $$props; 1106 let { size = "lg" } = $$props; 1107 let { value = null } = $$props; 1108 let { link = null } = $$props; 1109 let { icon = null } = $$props; 1110 let { disabled = false } = $$props; 1111 let { scale = null } = $$props; 1112 let { min_width = undefined } = $$props; 1113 let { root = "" } = $$props; 1114 let { proxy_url = null } = $$props; 1115 1116 function click_handler(event) { 1117 bubble.call(this, $$self, event); 1118 } 1119 1120 $$self.$$set = $$props => {
1121 if ('elem_id' in $$props) $$invalidate(0, elem_id = $$props.elem_id); 1122 if ('elem_classes' in $$props) $$invalidate(1, elem_classes = $$props.elem_classes); 1123 if ('visible' in $$props) $$invalidate(2, visible = $$props.visible); 1124 if ('variant' in $$props) $$invalidate(3, variant = $$props.variant); 1125 if ('size' in $$props) $$invalidate(4, size = $$props.size); 1126 if ('value' in $$props) $$invalidate(5, value = $$props.value); 1127 if ('link' in $$props) $$invalidate(6, link = $$props.link); 1128 if ('icon' in $$props) $$invalidate(7, icon = $$props.icon); 1129 if ('disabled' in $$props) $$invalidate(8, disabled = $$props.disabled); 1130 if ('scale' in $$props) $$invalidate(9, scale = $$props.scale); 1131 if ('min_width' in $$props) $$invalidate(10, min_width = $$props.min_width); 1132 if ('root' in $$props) $$invalidate(12, root = $$props.root); 1133 if ('proxy_url' in $$props) $$invalidate(13, proxy_url = $$props.proxy_url); 1134 if ('$$scope' in $$props) $$invalidate(14, $$scope = $$props.$$scope); 1135 }; 1136 1137 $$self.$$.update = () => { 1138 if ($$self.$$.dirty & /*icon, root, proxy_url*/ 12416) { 1139 $$invalidate(11, icon_path = get_fetchable_url_or_file(icon, root, proxy_url)); 1140 } 1141 }; 1142 1143 return [ 1144 elem_id, 1145 elem_classes, 1146 visible, 1147 variant, 1148 size, 1149 value, 1150 link, 1151 icon, 1152 disabled, 1153 scale, 1154 min_width, 1155 icon_path, 1156 root, 1157 proxy_url, 1158 $$scope, 1159 slots, 1160 click_handler 1161 ]; 1162} 1163 1164class Button extends SvelteComponent { 1165 constructor(options) { 1166 super(); 1167 1168 init(this, options, instance, create_fragment, safe_not_equal, { 1169 elem_id: 0, 1170 elem_classes: 1, 1171 visible: 2, 1172 variant: 3, 1173 size: 4, 1174 value: 5, 1175 link: 6, 1176 icon: 7, 1177 disabled: 8, 1178 scale: 9, 1179 min_width: 10, 1180 root: 12, 1181 proxy_url: 13 1182 }); 1183 } 1184} 1185 1186export { Block as B, Button as a, fly as b, colors as c, cubicOut as d, fade as f, ordered_colors as o }; 1187//# sourceMappingURL=Button-05bf7cea.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.