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