1import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, t as text, a as space, b as attr, f as insert, g as append, h as set_data, n as detach, c as create_component, m as mount_component, j as transition_in, k as transition_out, o as destroy_component, B as destroy_each, v as svg_element, d as toggle_class, L as src_url_equal, a1 as afterUpdate, H as binding_callbacks, A as empty, R as get_spread_update, T as get_spread_object, C as group_outros, D as check_outros, P as assign } from './index.aa663a61.js'; 2import { B as BlockTitle } from './BlockTitle.de098ff3.js'; 3 4const getSaliencyColor = (value) => { 5 var color = null; 6 if (value < 0) { 7 color = [52, 152, 219]; 8 } else { 9 color = [231, 76, 60]; 10 } 11 return colorToString(interpolate(Math.abs(value), [255, 255, 255], color)); 12}; 13const interpolate = (val, rgb1, rgb2) => { 14 if (val > 1) { 15 val = 1; 16 } 17 val = Math.sqrt(val); 18 var rgb = [0, 0, 0]; 19 var i; 20 for (i = 0; i < 3; i++) { 21 rgb[i] = Math.round(rgb1[i] * (1 - val) + rgb2[i] * val); 22 } 23 return rgb; 24}; 25const colorToString = (rgb) => { 26 return "rgb(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + ")"; 27}; 28const getObjectFitSize = (contains, containerWidth, containerHeight, width, height) => { 29 var doRatio = width / height; 30 var cRatio = containerWidth / containerHeight; 31 var targetWidth = 0; 32 var targetHeight = 0; 33 var test = contains ? doRatio > cRatio : doRatio < cRatio; 34 if (test) { 35 targetWidth = containerWidth; 36 targetHeight = targetWidth / doRatio; 37 } else { 38 targetHeight = containerHeight; 39 targetWidth = targetHeight * doRatio; 40 } 41 return { 42 width: targetWidth, 43 height: targetHeight, 44 x: (containerWidth - targetWidth) / 2, 45 y: (containerHeight - targetHeight) / 2 46 }; 47}; 48 49var Number_svelte_svelte_type_style_lang = ''; 50 51/* src/components/Interpretation/InterpretationComponents/Number.svelte generated by Svelte v3.49.0 */ 52 53function get_each_context$6(ctx, list, i) { 54 const child_ctx = ctx.slice(); 55 child_ctx[2] = list[i]; 56 return child_ctx; 57} 58 59// (8:1) <BlockTitle> 60function create_default_slot$8(ctx) { 61 let t; 62 63 return { 64 c() { 65 t = text(/*label*/ ctx[1]); 66 }, 67 m(target, anchor) { 68 insert(target, t, anchor); 69 }, 70 p(ctx, dirty) { 71 if (dirty & /*label*/ 2) set_data(t, /*label*/ ctx[1]); 72 }, 73 d(detaching) { 74 if (detaching) detach(t); 75 } 76 }; 77} 78 79// (10:2) {#each interpretation as interpret_value} 80function create_each_block$6(ctx) { 81 let div; 82 let t0_value = /*interpret_value*/ ctx[2][0] + ""; 83 let t0; 84 let t1; 85 let div_style_value; 86 87 return { 88 c() { 89 div = element("div"); 90 t0 = text(t0_value); 91 t1 = space(); 92 attr(div, "class", "flex-1"); 93 attr(div, "style", div_style_value = "background-color: " + getSaliencyColor(/*interpret_value*/ ctx[2][1])); 94 }, 95 m(target, anchor) { 96 insert(target, div, anchor); 97 append(div, t0); 98 append(div, t1); 99 }, 100 p(ctx, dirty) { 101 if (dirty & /*interpretation*/ 1 && t0_value !== (t0_value = /*interpret_value*/ ctx[2][0] + "")) set_data(t0, t0_value); 102 103 if (dirty & /*interpretation*/ 1 && div_style_value !== (div_style_value = "background-color: " + getSaliencyColor(/*interpret_value*/ ctx[2][1]))) { 104 attr(div, "style", div_style_value); 105 } 106 }, 107 d(detaching) { 108 if (detaching) detach(div); 109 } 110 }; 111} 112 113function create_fragment$9(ctx) { 114 let div1; 115 let blocktitle; 116 let t; 117 let div0; 118 let current; 119 120 blocktitle = new BlockTitle({ 121 props: { 122 $$slots: { default: [create_default_slot$8] }, 123 $$scope: { ctx } 124 } 125 }); 126 127 let each_value = /*interpretation*/ ctx[0]; 128 let each_blocks = []; 129 130 for (let i = 0; i < each_value.length; i += 1) { 131 each_blocks[i] = create_each_block$6(get_each_context$6(ctx, each_value, i)); 132 } 133 134 return { 135 c() { 136 div1 = element("div"); 137 create_component(blocktitle.$$.fragment); 138 t = space(); 139 div0 = element("div"); 140 141 for (let i = 0; i < each_blocks.length; i += 1) { 142 each_blocks[i].c(); 143 } 144 145 attr(div0, "class", "interpret_range flex"); 146 attr(div1, "class", "input-number"); 147 }, 148 m(target, anchor) { 149 insert(target, div1, anchor);
150 mount_component(blocktitle, div1, null); 151 append(div1, t); 152 append(div1, div0); 153 154 for (let i = 0; i < each_blocks.length; i += 1) { 155 each_blocks[i].m(div0, null); 156 } 157 158 current = true; 159 }, 160 p(ctx, [dirty]) { 161 const blocktitle_changes = {}; 162 163 if (dirty & /*$$scope, label*/ 34) { 164 blocktitle_changes.$$scope = { dirty, ctx }; 165 } 166 167 blocktitle.$set(blocktitle_changes); 168 169 if (dirty & /*getSaliencyColor, interpretation*/ 1) { 170 each_value = /*interpretation*/ ctx[0]; 171 let i; 172 173 for (i = 0; i < each_value.length; i += 1) { 174 const child_ctx = get_each_context$6(ctx, each_value, i); 175 176 if (each_blocks[i]) { 177 each_blocks[i].p(child_ctx, dirty); 178 } else { 179 each_blocks[i] = create_each_block$6(child_ctx); 180 each_blocks[i].c(); 181 each_blocks[i].m(div0, null); 182 } 183 } 184 185 for (; i < each_blocks.length; i += 1) { 186 each_blocks[i].d(1); 187 } 188 189 each_blocks.length = each_value.length; 190 } 191 }, 192 i(local) { 193 if (current) return; 194 transition_in(blocktitle.$$.fragment, local); 195 current = true; 196 }, 197 o(local) { 198 transition_out(blocktitle.$$.fragment, local); 199 current = false; 200 }, 201 d(detaching) { 202 if (detaching) detach(div1); 203 destroy_component(blocktitle); 204 destroy_each(each_blocks, detaching); 205 } 206 }; 207} 208 209function instance$9($$self, $$props, $$invalidate) { 210 let { interpretation } = $$props; 211 let { label = "" } = $$props; 212 213 $$self.$$set = $$props => {
214 if ('interpretation' in $$props) $$invalidate(0, interpretation = $$props.interpretation); 215 if ('label' in $$props) $$invalidate(1, label = $$props.label); 216 }; 217 218 return [interpretation, label]; 219} 220 221class Number extends SvelteComponent { 222 constructor(options) { 223 super(); 224 init(this, options, instance$9, create_fragment$9, safe_not_equal, { interpretation: 0, label: 1 }); 225 } 226} 227 228var Dropdown_svelte_svelte_type_style_lang = ''; 229 230/* src/components/Interpretation/InterpretationComponents/Dropdown.svelte generated by Svelte v3.49.0 */ 231 232function get_each_context$5(ctx, list, i) { 233 const child_ctx = ctx.slice(); 234 child_ctx[3] = list[i]; 235 child_ctx[5] = i; 236 return child_ctx; 237} 238 239// (9:1) <BlockTitle> 240function create_default_slot$7(ctx) { 241 let t; 242 243 return { 244 c() { 245 t = text(/*label*/ ctx[2]); 246 }, 247 m(target, anchor) { 248 insert(target, t, anchor); 249 }, 250 p(ctx, dirty) { 251 if (dirty & /*label*/ 4) set_data(t, /*label*/ ctx[2]); 252 }, 253 d(detaching) { 254 if (detaching) detach(t); 255 } 256 }; 257} 258 259// (11:2) {#each choices as choice, i} 260function create_each_block$5(ctx) { 261 let li; 262 let t0_value = /*choice*/ ctx[3] + ""; 263 let t0; 264 let t1; 265 let li_style_value; 266 267 return { 268 c() { 269 li = element("li"); 270 t0 = text(t0_value); 271 t1 = space(); 272 attr(li, "class", "dropdown-item first:rounded-t transition last:rounded-b py-2 px-3 block whitespace-nowrap cursor-pointer"); 273 attr(li, "style", li_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[0][/*i*/ ctx[5]])); 274 }, 275 m(target, anchor) { 276 insert(target, li, anchor); 277 append(li, t0); 278 append(li, t1); 279 }, 280 p(ctx, dirty) { 281 if (dirty & /*choices*/ 2 && t0_value !== (t0_value = /*choice*/ ctx[3] + "")) set_data(t0, t0_value); 282 283 if (dirty & /*interpretation*/ 1 && li_style_value !== (li_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[0][/*i*/ ctx[5]]))) { 284 attr(li, "style", li_style_value); 285 } 286 }, 287 d(detaching) { 288 if (detaching) detach(li); 289 } 290 }; 291} 292 293function create_fragment$8(ctx) { 294 let div; 295 let blocktitle; 296 let t; 297 let ul; 298 let current; 299 300 blocktitle = new BlockTitle({ 301 props: { 302 $$slots: { default: [create_default_slot$7] }, 303 $$scope: { ctx } 304 } 305 }); 306 307 let each_value = /*choices*/ ctx[1]; 308 let each_blocks = []; 309 310 for (let i = 0; i < each_value.length; i += 1) { 311 each_blocks[i] = create_each_block$5(get_each_context$5(ctx, each_value, i)); 312 } 313 314 return { 315 c() { 316 div = element("div"); 317 create_component(blocktitle.$$.fragment); 318 t = space(); 319 ul = element("ul"); 320 321 for (let i = 0; i < each_blocks.length; i += 1) { 322 each_blocks[i].c(); 323 } 324 325 attr(ul, "class", "dropdown-menu"); 326 attr(div, "class", "input-dropdown"); 327 }, 328 m(target, anchor) { 329 insert(target, div, anchor); 330 mount_component(blocktitle, div, null); 331 append(div, t); 332 append(div, ul); 333 334 for (let i = 0; i < each_blocks.length; i += 1) { 335 each_blocks[i].m(ul, null); 336 } 337 338 current = true; 339 }, 340 p(ctx, [dirty]) { 341 const blocktitle_changes = {}; 342 343 if (dirty & /*$$scope, label*/ 68) { 344 blocktitle_changes.$$scope = { dirty, ctx }; 345 } 346 347 blocktitle.$set(blocktitle_changes); 348 349 if (dirty & /*getSaliencyColor, interpretation, choices*/ 3) { 350 each_value = /*choices*/ ctx[1]; 351 let i; 352 353 for (i = 0; i < each_value.length; i += 1) { 354 const child_ctx = get_each_context$5(ctx, each_value, i); 355 356 if (each_blocks[i]) { 357 each_blocks[i].p(child_ctx, dirty); 358 } else { 359 each_blocks[i] = create_each_block$5(child_ctx); 360 each_blocks[i].c(); 361 each_blocks[i].m(ul, null); 362 } 363 } 364 365 for (; i < each_blocks.length; i += 1) { 366 each_blocks[i].d(1); 367 } 368 369 each_blocks.length = each_value.length; 370 } 371 }, 372 i(local) { 373 if (current) return; 374 transition_in(blocktitle.$$.fragment, local); 375 current = true; 376 }, 377 o(local) { 378 transition_out(blocktitle.$$.fragment, local); 379 current = false; 380 }, 381 d(detaching) { 382 if (detaching) detach(div); 383 destroy_component(blocktitle); 384 destroy_each(each_blocks, detaching); 385 } 386 }; 387} 388 389function instance$8($$self, $$props, $$invalidate) { 390 let { interpretation } = $$props; 391 let { choices } = $$props; 392 let { label = "" } = $$props; 393 394 $$self.$$set = $$props => {
395 if ('interpretation' in $$props) $$invalidate(0, interpretation = $$props.interpretation); 396 if ('choices' in $$props) $$invalidate(1, choices = $$props.choices); 397 if ('label' in $$props) $$invalidate(2, label = $$props.label); 398 }; 399 400 return [interpretation, choices, label]; 401} 402 403class Dropdown extends SvelteComponent { 404 constructor(options) { 405 super(); 406 init(this, options, instance$8, create_fragment$8, safe_not_equal, { interpretation: 0, choices: 1, label: 2 }); 407 } 408} 409 410var Checkbox_svelte_svelte_type_style_lang = ''; 411 412/* src/components/Interpretation/InterpretationComponents/Checkbox.svelte generated by Svelte v3.49.0 */ 413 414function create_default_slot$6(ctx) { 415 let t; 416 417 return { 418 c() { 419 t = text(/*label*/ ctx[0]); 420 }, 421 m(target, anchor) { 422 insert(target, t, anchor); 423 }, 424 p(ctx, dirty) { 425 if (dirty & /*label*/ 1) set_data(t, /*label*/ ctx[0]); 426 }, 427 d(detaching) { 428 if (detaching) detach(t); 429 } 430 }; 431} 432 433function create_fragment$7(ctx) { 434 let div2; 435 let blocktitle; 436 let t0; 437 let button; 438 let div0; 439 let div0_style_value; 440 let t1; 441 let div1; 442 let svg; 443 let line0; 444 let line1; 445 let div1_style_value; 446 let current; 447 448 blocktitle = new BlockTitle({ 449 props: { 450 $$slots: { default: [create_default_slot$6] }, 451 $$scope: { ctx } 452 } 453 }); 454 455 return { 456 c() { 457 div2 = element("div"); 458 create_component(blocktitle.$$.fragment); 459 t0 = space(); 460 button = element("button"); 461 div0 = element("div"); 462 t1 = space(); 463 div1 = element("div"); 464 svg = svg_element("svg"); 465 line0 = svg_element("line"); 466 line1 = svg_element("line"); 467 attr(div0, "class", "checkbox w-4 h-4 bg-white flex items-center justify-center border border-gray-400 box-border"); 468 attr(div0, "style", div0_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[2][0])); 469 attr(line0, "x1", "-7.5"); 470 attr(line0, "y1", "0"); 471 attr(line0, "x2", "-2.5"); 472 attr(line0, "y2", "5"); 473 attr(line0, "stroke", "black"); 474 attr(line0, "stroke-width", "4"); 475 attr(line0, "stroke-linecap", "round"); 476 attr(line1, "x1", "-2.5"); 477 attr(line1, "y1", "5"); 478 attr(line1, "x2", "7.5"); 479 attr(line1, "y2", "-7.5"); 480 attr(line1, "stroke", "black"); 481 attr(line1, "stroke-width", "4"); 482 attr(line1, "stroke-linecap", "round"); 483 attr(svg, "class", "check h-3 w-4 svelte-r8ethh"); 484 attr(svg, "viewBox", "-10 -10 20 20"); 485 attr(div1, "class", "checkbox w-4 h-4 bg-white flex items-center justify-center border border-gray-400 box-border"); 486 attr(div1, "style", div1_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[2][1])); 487 attr(button, "class", "checkbox-item py-2 px-3 rounded cursor-pointer flex gap-1 svelte-r8ethh"); 488 toggle_class(button, "selected", /*original*/ ctx[1]); 489 attr(div2, "class", "input-checkbox inline-block svelte-r8ethh"); 490 }, 491 m(target, anchor) { 492 insert(target, div2, anchor); 493 mount_component(blocktitle, div2, null); 494 append(div2, t0); 495 append(div2, button); 496 append(button, div0); 497 append(button, t1); 498 append(button, div1); 499 append(div1, svg); 500 append(svg, line0); 501 append(svg, line1); 502 current = true; 503 }, 504 p(ctx, [dirty]) { 505 const blocktitle_changes = {}; 506 507 if (dirty & /*$$scope, label*/ 9) { 508 blocktitle_changes.$$scope = { dirty, ctx }; 509 } 510 511 blocktitle.$set(blocktitle_changes); 512 513 if (!current || dirty & /*interpretation*/ 4 && div0_style_value !== (div0_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[2][0]))) { 514 attr(div0, "style", div0_style_value); 515 } 516 517 if (!current || dirty & /*interpretation*/ 4 && div1_style_value !== (div1_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[2][1]))) { 518 attr(div1, "style", div1_style_value); 519 } 520 521 if (dirty & /*original*/ 2) { 522 toggle_class(button, "selected", /*original*/ ctx[1]); 523 } 524 }, 525 i(local) { 526 if (current) return; 527 transition_in(blocktitle.$$.fragment, local); 528 current = true; 529 }, 530 o(local) { 531 transition_out(blocktitle.$$.fragment, local); 532 current = false; 533 }, 534 d(detaching) { 535 if (detaching) detach(div2); 536 destroy_component(blocktitle); 537 } 538 }; 539} 540
541function instance$7($$self, $$props, $$invalidate) { 542 let { label = "" } = $$props; 543 let { original } = $$props; 544 let { interpretation } = $$props; 545 546 $$self.$$set = $$props => { 547 if ('label' in $$props) $$invalidate(0, label = $$props.label); 548 if ('original' in $$props) $$invalidate(1, original = $$props.original); 549 if ('interpretation' in $$props) $$invalidate(2, interpretation = $$props.interpretation); 550 }; 551 552 return [label, original, interpretation]; 553} 554 555class Checkbox extends SvelteComponent { 556 constructor(options) { 557 super(); 558 init(this, options, instance$7, create_fragment$7, safe_not_equal, { label: 0, original: 1, interpretation: 2 }); 559 } 560} 561 562var CheckboxGroup_svelte_svelte_type_style_lang = ''; 563 564/* src/components/Interpretation/InterpretationComponents/CheckboxGroup.svelte generated by Svelte v3.49.0 */ 565 566function get_each_context$4(ctx, list, i) { 567 const child_ctx = ctx.slice(); 568 child_ctx[4] = list[i]; 569 child_ctx[6] = i; 570 return child_ctx; 571} 572 573// (10:1) <BlockTitle> 574function create_default_slot$5(ctx) { 575 let t; 576 577 return { 578 c() { 579 t = text(/*label*/ ctx[3]); 580 }, 581 m(target, anchor) { 582 insert(target, t, anchor); 583 }, 584 p(ctx, dirty) { 585 if (dirty & /*label*/ 8) set_data(t, /*label*/ ctx[3]); 586 }, 587 d(detaching) { 588 if (detaching) detach(t); 589 } 590 }; 591} 592 593// (11:1) {#each choices as choice, i} 594function create_each_block$4(ctx) { 595 let button; 596 let div0; 597 let div0_style_value; 598 let t0; 599 let div1; 600 let svg; 601 let line0; 602 let line1; 603 let div1_style_value; 604 let t1; 605 let t2_value = /*choice*/ ctx[4] + ""; 606 let t2; 607 let t3; 608 609 return { 610 c() { 611 button = element("button"); 612 div0 = element("div"); 613 t0 = space(); 614 div1 = element("div"); 615 svg = svg_element("svg"); 616 line0 = svg_element("line"); 617 line1 = svg_element("line"); 618 t1 = space(); 619 t2 = text(t2_value); 620 t3 = space(); 621 attr(div0, "class", "checkbox w-4 h-4 bg-white flex items-center justify-center border border-gray-400 box-border svelte-h5sk3f"); 622 attr(div0, "style", div0_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[1][/*i*/ ctx[6]][0])); 623 attr(line0, "x1", "-7.5"); 624 attr(line0, "y1", "0"); 625 attr(line0, "x2", "-2.5"); 626 attr(line0, "y2", "5"); 627 attr(line0, "stroke", "black"); 628 attr(line0, "stroke-width", "4"); 629 attr(line0, "stroke-linecap", "round"); 630 attr(line1, "x1", "-2.5"); 631 attr(line1, "y1", "5"); 632 attr(line1, "x2", "7.5"); 633 attr(line1, "y2", "-7.5"); 634 attr(line1, "stroke", "black"); 635 attr(line1, "stroke-width", "4"); 636 attr(line1, "stroke-linecap", "round"); 637 attr(svg, "class", "check h-3 w-4 svelte-h5sk3f"); 638 attr(svg, "viewBox", "-10 -10 20 20"); 639 attr(div1, "class", "checkbox w-4 h-4 bg-white flex items-center justify-center border border-gray-400 box-border svelte-h5sk3f"); 640 attr(div1, "style", div1_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[1][/*i*/ ctx[6]][1])); 641 attr(button, "class", "checkbox-item py-2 px-3 font-semibold rounded cursor-pointer flex items-center gap-1 svelte-h5sk3f"); 642 toggle_class(button, "selected", /*original*/ ctx[0].includes(/*choice*/ ctx[4])); 643 }, 644 m(target, anchor) { 645 insert(target, button, anchor); 646 append(button, div0); 647 append(button, t0); 648 append(button, div1); 649 append(div1, svg); 650 append(svg, line0); 651 append(svg, line1); 652 append(button, t1); 653 append(button, t2); 654 append(button, t3); 655 }, 656 p(ctx, dirty) { 657 if (dirty & /*interpretation*/ 2 && div0_style_value !== (div0_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[1][/*i*/ ctx[6]][0]))) { 658 attr(div0, "style", div0_style_value); 659 } 660 661 if (dirty & /*interpretation*/ 2 && div1_style_value !== (div1_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[1][/*i*/ ctx[6]][1]))) { 662 attr(div1, "style", div1_style_value); 663 } 664 665 if (dirty & /*choices*/ 4 && t2_value !== (t2_value = /*choice*/ ctx[4] + "")) set_data(t2, t2_value); 666 667 if (dirty & /*original, choices*/ 5) { 668 toggle_class(button, "selected", /*original*/ ctx[0].includes(/*choice*/ ctx[4])); 669 } 670 }, 671 d(detaching) { 672 if (detaching) detach(button); 673 } 674 }; 675} 676 677function create_fragment$6(ctx) { 678 let div; 679 let blocktitle; 680 let t; 681 let current; 682 683 blocktitle = new BlockTitle({ 684 props: { 685 $$slots: { default: [create_default_slot$5] }, 686 $$scope: { ctx } 687 } 688 }); 689 690 let each_value = /*choices*/ ctx[2]; 691 let each_blocks = []; 692 693 for (let i = 0; i < each_value.length; i += 1) { 694 each_blocks[i] = create_each_block$4(get_each_context$4(ctx, each_value, i)); 695 } 696 697 return { 698 c() { 699 div = element("div"); 700 create_component(blocktitle.$$.fragment); 701 t = space(); 702 703 for (let i = 0; i < each_blocks.length; i += 1) { 704 each_blocks[i].c(); 705 } 706 707 attr(div, "class", "input-checkbox-group flex flex-wrap gap-2 svelte-h5sk3f"); 708 }, 709 m(target, anchor) { 710 insert(target, div, anchor);
711 mount_component(blocktitle, div, null); 712 append(div, t); 713 714 for (let i = 0; i < each_blocks.length; i += 1) { 715 each_blocks[i].m(div, null); 716 } 717 718 current = true; 719 }, 720 p(ctx, [dirty]) { 721 const blocktitle_changes = {}; 722 723 if (dirty & /*$$scope, label*/ 136) { 724 blocktitle_changes.$$scope = { dirty, ctx }; 725 } 726 727 blocktitle.$set(blocktitle_changes); 728 729 if (dirty & /*original, choices, getSaliencyColor, interpretation*/ 7) { 730 each_value = /*choices*/ ctx[2]; 731 let i; 732 733 for (i = 0; i < each_value.length; i += 1) { 734 const child_ctx = get_each_context$4(ctx, each_value, i); 735 736 if (each_blocks[i]) { 737 each_blocks[i].p(child_ctx, dirty); 738 } else { 739 each_blocks[i] = create_each_block$4(child_ctx); 740 each_blocks[i].c(); 741 each_blocks[i].m(div, null); 742 } 743 } 744 745 for (; i < each_blocks.length; i += 1) { 746 each_blocks[i].d(1); 747 } 748 749 each_blocks.length = each_value.length; 750 } 751 }, 752 i(local) { 753 if (current) return; 754 transition_in(blocktitle.$$.fragment, local); 755 current = true; 756 }, 757 o(local) { 758 transition_out(blocktitle.$$.fragment, local); 759 current = false; 760 }, 761 d(detaching) { 762 if (detaching) detach(div); 763 destroy_component(blocktitle); 764 destroy_each(each_blocks, detaching); 765 } 766 }; 767} 768 769function instance$6($$self, $$props, $$invalidate) { 770 let { original } = $$props; 771 let { interpretation } = $$props; 772 let { choices } = $$props; 773 let { label = "" } = $$props; 774 775 $$self.$$set = $$props => {
776 if ('original' in $$props) $$invalidate(0, original = $$props.original); 777 if ('interpretation' in $$props) $$invalidate(1, interpretation = $$props.interpretation); 778 if ('choices' in $$props) $$invalidate(2, choices = $$props.choices); 779 if ('label' in $$props) $$invalidate(3, label = $$props.label); 780 }; 781 782 return [original, interpretation, choices, label]; 783} 784 785class CheckboxGroup extends SvelteComponent { 786 constructor(options) { 787 super(); 788 789 init(this, options, instance$6, create_fragment$6, safe_not_equal, { 790 original: 0, 791 interpretation: 1, 792 choices: 2, 793 label: 3 794 }); 795 } 796} 797 798var Slider_svelte_svelte_type_style_lang = ''; 799 800/* src/components/Interpretation/InterpretationComponents/Slider.svelte generated by Svelte v3.49.0 */ 801 802function get_each_context$3(ctx, list, i) { 803 const child_ctx = ctx.slice(); 804 child_ctx[6] = list[i]; 805 return child_ctx; 806} 807 808// (12:1) <BlockTitle> 809function create_default_slot$4(ctx) { 810 let t; 811 812 return { 813 c() { 814 t = text(/*label*/ ctx[5]); 815 }, 816 m(target, anchor) { 817 insert(target, t, anchor); 818 }, 819 p(ctx, dirty) { 820 if (dirty & /*label*/ 32) set_data(t, /*label*/ ctx[5]); 821 }, 822 d(detaching) { 823 if (detaching) detach(t); 824 } 825 }; 826} 827 828// (22:2) {#each interpretation as interpret_value} 829function create_each_block$3(ctx) { 830 let div; 831 let div_style_value; 832 833 return { 834 c() { 835 div = element("div"); 836 attr(div, "class", "flex-1 h-4"); 837 attr(div, "style", div_style_value = "background-color: " + getSaliencyColor(/*interpret_value*/ ctx[6])); 838 }, 839 m(target, anchor) { 840 insert(target, div, anchor); 841 }, 842 p(ctx, dirty) { 843 if (dirty & /*interpretation*/ 2 && div_style_value !== (div_style_value = "background-color: " + getSaliencyColor(/*interpret_value*/ ctx[6]))) { 844 attr(div, "style", div_style_value); 845 } 846 }, 847 d(detaching) { 848 if (detaching) detach(div); 849 } 850 }; 851} 852 853function create_fragment$5(ctx) { 854 let div2; 855 let blocktitle; 856 let t0; 857 let input; 858 let t1; 859 let div0; 860 let t2; 861 let div1; 862 let t3; 863 let current; 864 865 blocktitle = new BlockTitle({ 866 props: { 867 $$slots: { default: [create_default_slot$4] }, 868 $$scope: { ctx } 869 } 870 }); 871 872 let each_value = /*interpretation*/ ctx[1]; 873 let each_blocks = []; 874 875 for (let i = 0; i < each_value.length; i += 1) { 876 each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i)); 877 } 878 879 return { 880 c() { 881 div2 = element("div"); 882 create_component(blocktitle.$$.fragment); 883 t0 = space(); 884 input = element("input"); 885 t1 = space(); 886 div0 = element("div"); 887 888 for (let i = 0; i < each_blocks.length; i += 1) { 889 each_blocks[i].c(); 890 } 891 892 t2 = space(); 893 div1 = element("div"); 894 t3 = text(/*original*/ ctx[0]); 895 attr(input, "type", "range"); 896 attr(input, "class", "range w-full appearance-none transition rounded h-4 bg-blue-400 svelte-3aijhr"); 897 input.disabled = true; 898 attr(input, "min", /*minimum*/ ctx[2]); 899 attr(input, "max", /*maximum*/ ctx[3]); 900 attr(input, "step", /*step*/ ctx[4]); 901 attr(div0, "class", "interpret_range flex"); 902 attr(div1, "class", "original inline-block mx-auto mt-1 px-2 py-0.5 rounded"); 903 attr(div2, "class", "input-slider text-center svelte-3aijhr"); 904 }, 905 m(target, anchor) { 906 insert(target, div2, anchor); 907 mount_component(blocktitle, div2, null); 908 append(div2, t0); 909 append(div2, input); 910 append(div2, t1); 911 append(div2, div0); 912 913 for (let i = 0; i < each_blocks.length; i += 1) { 914 each_blocks[i].m(div0, null); 915 } 916 917 append(div2, t2); 918 append(div2, div1); 919 append(div1, t3); 920 current = true; 921 }, 922 p(ctx, [dirty]) { 923 const blocktitle_changes = {}; 924 925 if (dirty & /*$$scope, label*/ 544) { 926 blocktitle_changes.$$scope = { dirty, ctx }; 927 } 928 929 blocktitle.$set(blocktitle_changes); 930 931 if (!current || dirty & /*minimum*/ 4) { 932 attr(input, "min", /*minimum*/ ctx[2]); 933 } 934 935 if (!current || dirty & /*maximum*/ 8) { 936 attr(input, "max", /*maximum*/ ctx[3]); 937 } 938 939 if (!current || dirty & /*step*/ 16) { 940 attr(input, "step", /*step*/ ctx[4]); 941 } 942 943 if (dirty & /*getSaliencyColor, interpretation*/ 2) { 944 each_value = /*interpretation*/ ctx[1]; 945 let i; 946 947 for (i = 0; i < each_value.length; i += 1) { 948 const child_ctx = get_each_context$3(ctx, each_value, i); 949 950 if (each_blocks[i]) { 951 each_blocks[i].p(child_ctx, dirty); 952 } else { 953 each_blocks[i] = create_each_block$3(child_ctx); 954 each_blocks[i].c(); 955 each_blocks[i].m(div0, null); 956 } 957 } 958 959 for (; i < each_blocks.length; i += 1) { 960 each_blocks[i].d(1); 961 } 962 963 each_blocks.length = each_value.length; 964 } 965 966 if (!current || dirty & /*original*/ 1) set_data(t3, /*original*/ ctx[0]); 967 }, 968 i(local) { 969 if (current) return; 970 transition_in(blocktitle.$$.fragment, local); 971 current = true; 972 }, 973 o(local) { 974 transition_out(blocktitle.$$.fragment, local); 975 current = false;
976 }, 977 d(detaching) { 978 if (detaching) detach(div2); 979 destroy_component(blocktitle); 980 destroy_each(each_blocks, detaching); 981 } 982 }; 983} 984 985function instance$5($$self, $$props, $$invalidate) { 986 let { original } = $$props; 987 let { interpretation } = $$props; 988 let { minimum } = $$props; 989 let { maximum } = $$props; 990 let { step } = $$props; 991 let { label = "" } = $$props; 992 993 $$self.$$set = $$props => { 994 if ('original' in $$props) $$invalidate(0, original = $$props.original); 995 if ('interpretation' in $$props) $$invalidate(1, interpretation = $$props.interpretation); 996 if ('minimum' in $$props) $$invalidate(2, minimum = $$props.minimum); 997 if ('maximum' in $$props) $$invalidate(3, maximum = $$props.maximum); 998 if ('step' in $$props) $$invalidate(4, step = $$props.step); 999 if ('label' in $$props) $$invalidate(5, label = $$props.label); 1000 }; 1001 1002 return [original, interpretation, minimum, maximum, step, label]; 1003} 1004 1005class Slider extends SvelteComponent { 1006 constructor(options) { 1007 super(); 1008 1009 init(this, options, instance$5, create_fragment$5, safe_not_equal, { 1010 original: 0, 1011 interpretation: 1, 1012 minimum: 2, 1013 maximum: 3, 1014 step: 4, 1015 label: 5 1016 }); 1017 } 1018} 1019 1020var Radio_svelte_svelte_type_style_lang = ''; 1021 1022/* src/components/Interpretation/InterpretationComponents/Radio.svelte generated by Svelte v3.49.0 */ 1023 1024function get_each_context$2(ctx, list, i) { 1025 const child_ctx = ctx.slice(); 1026 child_ctx[4] = list[i]; 1027 child_ctx[6] = i; 1028 return child_ctx; 1029} 1030 1031// (10:1) <BlockTitle> 1032function create_default_slot$3(ctx) { 1033 let t; 1034 1035 return { 1036 c() { 1037 t = text(/*label*/ ctx[3]); 1038 }, 1039 m(target, anchor) { 1040 insert(target, t, anchor); 1041 }, 1042 p(ctx, dirty) { 1043 if (dirty & /*label*/ 8) set_data(t, /*label*/ ctx[3]); 1044 }, 1045 d(detaching) { 1046 if (detaching) detach(t); 1047 } 1048 }; 1049} 1050 1051// (11:1) {#each choices as choice, i} 1052function create_each_block$2(ctx) { 1053 let button; 1054 let div; 1055 let div_style_value; 1056 let t0; 1057 let t1_value = /*choice*/ ctx[4] + ""; 1058 let t1; 1059 let t2; 1060 1061 return { 1062 c() { 1063 button = element("button"); 1064 div = element("div"); 1065 t0 = space(); 1066 t1 = text(t1_value); 1067 t2 = space(); 1068 attr(div, "class", "radio-circle w-4 h-4 rounded-full box-border svelte-145r163"); 1069 attr(div, "style", div_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[1][/*i*/ ctx[6]])); 1070 attr(button, "class", "radio-item py-2 px-3 font-semibold rounded cursor-pointer flex items-center gap-2 svelte-145r163"); 1071 toggle_class(button, "selected", /*original*/ ctx[0] === /*choice*/ ctx[4]); 1072 }, 1073 m(target, anchor) { 1074 insert(target, button, anchor); 1075 append(button, div); 1076 append(button, t0); 1077 append(button, t1); 1078 append(button, t2); 1079 }, 1080 p(ctx, dirty) { 1081 if (dirty & /*interpretation*/ 2 && div_style_value !== (div_style_value = "background-color: " + getSaliencyColor(/*interpretation*/ ctx[1][/*i*/ ctx[6]]))) { 1082 attr(div, "style", div_style_value); 1083 } 1084 1085 if (dirty & /*choices*/ 4 && t1_value !== (t1_value = /*choice*/ ctx[4] + "")) set_data(t1, t1_value); 1086 1087 if (dirty & /*original, choices*/ 5) { 1088 toggle_class(button, "selected", /*original*/ ctx[0] === /*choice*/ ctx[4]); 1089 } 1090 }, 1091 d(detaching) { 1092 if (detaching) detach(button); 1093 } 1094 }; 1095} 1096 1097function create_fragment$4(ctx) { 1098 let div; 1099 let blocktitle; 1100 let t; 1101 let current; 1102 1103 blocktitle = new BlockTitle({ 1104 props: { 1105 $$slots: { default: [create_default_slot$3] }, 1106 $$scope: { ctx } 1107 } 1108 }); 1109 1110 let each_value = /*choices*/ ctx[2]; 1111 let each_blocks = []; 1112 1113 for (let i = 0; i < each_value.length; i += 1) { 1114 each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); 1115 } 1116 1117 return { 1118 c() { 1119 div = element("div"); 1120 create_component(blocktitle.$$.fragment); 1121 t = space(); 1122 1123 for (let i = 0; i < each_blocks.length; i += 1) { 1124 each_blocks[i].c(); 1125 } 1126 1127 attr(div, "class", "input-radio flex flex-wrap gap-2 svelte-145r163"); 1128 }, 1129 m(target, anchor) { 1130 insert(target, div, anchor); 1131 mount_component(blocktitle, div, null); 1132 append(div, t); 1133 1134 for (let i = 0; i < each_blocks.length; i += 1) { 1135 each_blocks[i].m(div, null); 1136 } 1137 1138 current = true; 1139 }, 1140 p(ctx, [dirty]) { 1141 const blocktitle_changes = {}; 1142
1143 if (dirty & /*$$scope, label*/ 136) { 1144 blocktitle_changes.$$scope = { dirty, ctx }; 1145 } 1146 1147 blocktitle.$set(blocktitle_changes); 1148 1149 if (dirty & /*original, choices, getSaliencyColor, interpretation*/ 7) { 1150 each_value = /*choices*/ ctx[2]; 1151 let i; 1152 1153 for (i = 0; i < each_value.length; i += 1) { 1154 const child_ctx = get_each_context$2(ctx, each_value, i); 1155 1156 if (each_blocks[i]) { 1157 each_blocks[i].p(child_ctx, dirty); 1158 } else { 1159 each_blocks[i] = create_each_block$2(child_ctx); 1160 each_blocks[i].c(); 1161 each_blocks[i].m(div, null); 1162 } 1163 } 1164 1165 for (; i < each_blocks.length; i += 1) { 1166 each_blocks[i].d(1); 1167 } 1168 1169 each_blocks.length = each_value.length; 1170 } 1171 }, 1172 i(local) { 1173 if (current) return; 1174 transition_in(blocktitle.$$.fragment, local); 1175 current = true; 1176 }, 1177 o(local) { 1178 transition_out(blocktitle.$$.fragment, local); 1179 current = false; 1180 }, 1181 d(detaching) { 1182 if (detaching) detach(div); 1183 destroy_component(blocktitle); 1184 destroy_each(each_blocks, detaching); 1185 } 1186 }; 1187} 1188 1189function instance$4($$self, $$props, $$invalidate) { 1190 let { original } = $$props; 1191 let { interpretation } = $$props; 1192 let { choices } = $$props; 1193 let { label = "" } = $$props; 1194 1195 $$self.$$set = $$props => {
1196 if ('original' in $$props) $$invalidate(0, original = $$props.original); 1197 if ('interpretation' in $$props) $$invalidate(1, interpretation = $$props.interpretation); 1198 if ('choices' in $$props) $$invalidate(2, choices = $$props.choices); 1199 if ('label' in $$props) $$invalidate(3, label = $$props.label); 1200 }; 1201 1202 return [original, interpretation, choices, label]; 1203} 1204 1205class Radio extends SvelteComponent { 1206 constructor(options) { 1207 super(); 1208 1209 init(this, options, instance$4, create_fragment$4, safe_not_equal, { 1210 original: 0, 1211 interpretation: 1, 1212 choices: 2, 1213 label: 3 1214 }); 1215 } 1216} 1217 1218/* src/components/Interpretation/InterpretationComponents/Image.svelte generated by Svelte v3.49.0 */ 1219 1220function create_default_slot$2(ctx) { 1221 let t; 1222 1223 return { 1224 c() { 1225 t = text(/*label*/ ctx[1]); 1226 }, 1227 m(target, anchor) { 1228 insert(target, t, anchor); 1229 }, 1230 p(ctx, dirty) { 1231 if (dirty & /*label*/ 2) set_data(t, /*label*/ ctx[1]); 1232 }, 1233 d(detaching) { 1234 if (detaching) detach(t); 1235 } 1236 }; 1237} 1238 1239function create_fragment$3(ctx) { 1240 let div2; 1241 let blocktitle; 1242 let t0; 1243 let div1; 1244 let div0; 1245 let canvas; 1246 let t1; 1247 let img; 1248 let img_src_value; 1249 let current; 1250 1251 blocktitle = new BlockTitle({ 1252 props: { 1253 $$slots: { default: [create_default_slot$2] }, 1254 $$scope: { ctx } 1255 } 1256 }); 1257 1258 return { 1259 c() { 1260 div2 = element("div"); 1261 create_component(blocktitle.$$.fragment); 1262 t0 = space(); 1263 div1 = element("div"); 1264 div0 = element("div"); 1265 canvas = element("canvas"); 1266 t1 = space(); 1267 img = element("img"); 1268 attr(div0, "class", "interpretation w-full h-full absolute top-0 left-0 flex justify-center items-center opacity-90 hover:opacity-20 transition"); 1269 attr(img, "class", "w-full h-full object-contain"); 1270 if (!src_url_equal(img.src, img_src_value = /*original*/ ctx[0])) attr(img, "src", img_src_value); 1271 attr(div1, "class", "image-preview w-full h-60 flex justify-center items-center bg-gray-200 dark:bg-gray-600 relative"); 1272 attr(div2, "class", "input-image"); 1273 }, 1274 m(target, anchor) { 1275 insert(target, div2, anchor); 1276 mount_component(blocktitle, div2, null); 1277 append(div2, t0); 1278 append(div2, div1); 1279 append(div1, div0); 1280 append(div0, canvas); 1281 /*canvas_binding*/ ctx[6](canvas); 1282 append(div1, t1); 1283 append(div1, img); 1284 /*img_binding*/ ctx[7](img); 1285 current = true; 1286 }, 1287 p(ctx, [dirty]) { 1288 const blocktitle_changes = {}; 1289 1290 if (dirty & /*$$scope, label*/ 514) { 1291 blocktitle_changes.$$scope = { dirty, ctx }; 1292 } 1293 1294 blocktitle.$set(blocktitle_changes); 1295 1296 if (!current || dirty & /*original*/ 1 && !src_url_equal(img.src, img_src_value = /*original*/ ctx[0])) { 1297 attr(img, "src", img_src_value); 1298 } 1299 }, 1300 i(local) { 1301 if (current) return; 1302 transition_in(blocktitle.$$.fragment, local); 1303 current = true; 1304 }, 1305 o(local) { 1306 transition_out(blocktitle.$$.fragment, local); 1307 current = false; 1308 }, 1309 d(detaching) { 1310 if (detaching) detach(div2); 1311 destroy_component(blocktitle); 1312 /*canvas_binding*/ ctx[6](null); 1313 /*img_binding*/ ctx[7](null); 1314 } 1315 }; 1316} 1317 1318function instance$3($$self, $$props, $$invalidate) { 1319 let { original } = $$props; 1320 let { interpretation } = $$props; 1321 let { shape } = $$props; 1322 let { label = "" } = $$props; 1323 let saliency_layer; 1324 let image; 1325 1326 const paintSaliency = (data, ctx, width, height) => { 1327 var cell_width = width / data[0].length; 1328 var cell_height = height / data.length; 1329 var r = 0; 1330 1331 data.forEach(function (row) { 1332 var c = 0; 1333 1334 row.forEach(function (cell) { 1335 ctx.fillStyle = getSaliencyColor(cell); 1336 ctx.fillRect(c * cell_width, r * cell_height, cell_width, cell_height); 1337 c++; 1338 }); 1339 1340 r++; 1341 }); 1342 }; 1343 1344 afterUpdate(() => { 1345 let size = getObjectFitSize(true, image.width, image.height, image.naturalWidth, image.naturalHeight); 1346 1347 if (shape) { 1348 size = getObjectFitSize(true, size.width, size.height, shape[0], shape[1]); 1349 } 1350 1351 let width = size.width; 1352 let height = size.height; 1353 saliency_layer.setAttribute("height", `${height}`); 1354 saliency_layer.setAttribute("width", `${width}`); 1355 paintSaliency(interpretation, saliency_layer.getContext("2d"), width, height); 1356 }); 1357 1358 function canvas_binding($$value) { 1359 binding_callbacks[$$value ? 'unshift' : 'push'](() => { 1360 saliency_layer = $$value;
1361 $$invalidate(2, saliency_layer); 1362 }); 1363 } 1364 1365 function img_binding($$value) { 1366 binding_callbacks[$$value ? 'unshift' : 'push'](() => { 1367 image = $$value; 1368 $$invalidate(3, image); 1369 }); 1370 } 1371 1372 $$self.$$set = $$props => { 1373 if ('original' in $$props) $$invalidate(0, original = $$props.original); 1374 if ('interpretation' in $$props) $$invalidate(4, interpretation = $$props.interpretation); 1375 if ('shape' in $$props) $$invalidate(5, shape = $$props.shape); 1376 if ('label' in $$props) $$invalidate(1, label = $$props.label); 1377 }; 1378 1379 return [ 1380 original, 1381 label, 1382 saliency_layer, 1383 image, 1384 interpretation, 1385 shape, 1386 canvas_binding, 1387 img_binding 1388 ]; 1389} 1390 1391class Image extends SvelteComponent { 1392 constructor(options) { 1393 super(); 1394 1395 init(this, options, instance$3, create_fragment$3, safe_not_equal, { 1396 original: 0, 1397 interpretation: 4, 1398 shape: 5, 1399 label: 1 1400 }); 1401 } 1402} 1403 1404/* src/components/Interpretation/InterpretationComponents/Audio.svelte generated by Svelte v3.49.0 */ 1405 1406function get_each_context$1(ctx, list, i) { 1407 const child_ctx = ctx.slice(); 1408 child_ctx[2] = list[i]; 1409 return child_ctx; 1410} 1411 1412// (8:1) <BlockTitle> 1413function create_default_slot$1(ctx) { 1414 let t; 1415 1416 return { 1417 c() { 1418 t = text(/*label*/ ctx[1]); 1419 }, 1420 m(target, anchor) { 1421 insert(target, t, anchor); 1422 }, 1423 p(ctx, dirty) { 1424 if (dirty & /*label*/ 2) set_data(t, /*label*/ ctx[1]); 1425 }, 1426 d(detaching) { 1427 if (detaching) detach(t); 1428 } 1429 }; 1430} 1431 1432// (10:2) {#each interpretation as interpret_value} 1433function create_each_block$1(ctx) { 1434 let div; 1435 let div_style_value; 1436 1437 return { 1438 c() { 1439 div = element("div"); 1440 attr(div, "class", "flex-1 h-4"); 1441 attr(div, "style", div_style_value = "background-color: " + getSaliencyColor(/*interpret_value*/ ctx[2])); 1442 }, 1443 m(target, anchor) { 1444 insert(target, div, anchor); 1445 }, 1446 p(ctx, dirty) { 1447 if (dirty & /*interpretation*/ 1 && div_style_value !== (div_style_value = "background-color: " + getSaliencyColor(/*interpret_value*/ ctx[2]))) { 1448 attr(div, "style", div_style_value); 1449 } 1450 }, 1451 d(detaching) { 1452 if (detaching) detach(div); 1453 } 1454 }; 1455} 1456 1457function create_fragment$2(ctx) { 1458 let div1; 1459 let blocktitle; 1460 let t; 1461 let div0; 1462 let current; 1463 1464 blocktitle = new BlockTitle({ 1465 props: { 1466 $$slots: { default: [create_default_slot$1] }, 1467 $$scope: { ctx } 1468 } 1469 }); 1470 1471 let each_value = /*interpretation*/ ctx[0]; 1472 let each_blocks = []; 1473 1474 for (let i = 0; i < each_value.length; i += 1) { 1475 each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); 1476 } 1477 1478 return { 1479 c() { 1480 div1 = element("div"); 1481 create_component(blocktitle.$$.fragment); 1482 t = space(); 1483 div0 = element("div"); 1484 1485 for (let i = 0; i < each_blocks.length; i += 1) { 1486 each_blocks[i].c(); 1487 } 1488 1489 attr(div0, "class", "interpret_range flex"); 1490 attr(div1, "class", "input-audio"); 1491 }, 1492 m(target, anchor) { 1493 insert(target, div1, anchor); 1494 mount_component(blocktitle, div1, null); 1495 append(div1, t); 1496 append(div1, div0); 1497 1498 for (let i = 0; i < each_blocks.length; i += 1) { 1499 each_blocks[i].m(div0, null); 1500 } 1501 1502 current = true; 1503 }, 1504 p(ctx, [dirty]) { 1505 const blocktitle_changes = {}; 1506 1507 if (dirty & /*$$scope, label*/ 34) { 1508 blocktitle_changes.$$scope = { dirty, ctx }; 1509 } 1510 1511 blocktitle.$set(blocktitle_changes); 1512 1513 if (dirty & /*getSaliencyColor, interpretation*/ 1) { 1514 each_value = /*interpretation*/ ctx[0]; 1515 let i; 1516 1517 for (i = 0; i < each_value.length; i += 1) { 1518 const child_ctx = get_each_context$1(ctx, each_value, i); 1519 1520 if (each_blocks[i]) { 1521 each_blocks[i].p(child_ctx, dirty); 1522 } else { 1523 each_blocks[i] = create_each_block$1(child_ctx); 1524 each_blocks[i].c(); 1525 each_blocks[i].m(div0, null); 1526 } 1527 } 1528 1529 for (; i < each_blocks.length; i += 1) { 1530 each_blocks[i].d(1); 1531 } 1532 1533 each_blocks.length = each_value.length; 1534 } 1535 }, 1536 i(local) { 1537 if (current) return; 1538 transition_in(blocktitle.$$.fragment, local); 1539 current = true; 1540 }, 1541 o(local) { 1542 transition_out(blocktitle.$$.fragment, local); 1543 current = false; 1544 }, 1545 d(detaching) { 1546 if (detaching) detach(div1); 1547 destroy_component(blocktitle); 1548 destroy_each(each_blocks, detaching); 1549 } 1550 }; 1551} 1552
1553function instance$2($$self, $$props, $$invalidate) { 1554 let { interpretation } = $$props; 1555 let { label = "" } = $$props; 1556 1557 $$self.$$set = $$props => { 1558 if ('interpretation' in $$props) $$invalidate(0, interpretation = $$props.interpretation); 1559 if ('label' in $$props) $$invalidate(1, label = $$props.label); 1560 }; 1561 1562 return [interpretation, label]; 1563} 1564 1565class Audio extends SvelteComponent { 1566 constructor(options) { 1567 super(); 1568 init(this, options, instance$2, create_fragment$2, safe_not_equal, { interpretation: 0, label: 1 }); 1569 } 1570} 1571 1572/* src/components/Interpretation/InterpretationComponents/Textbox.svelte generated by Svelte v3.49.0 */ 1573 1574function get_each_context(ctx, list, i) { 1575 const child_ctx = ctx.slice(); 1576 child_ctx[2] = list[i][0]; 1577 child_ctx[3] = list[i][1]; 1578 return child_ctx; 1579} 1580 1581// (8:1) <BlockTitle> 1582function create_default_slot(ctx) { 1583 let t; 1584 1585 return { 1586 c() { 1587 t = text(/*label*/ ctx[0]); 1588 }, 1589 m(target, anchor) { 1590 insert(target, t, anchor); 1591 }, 1592 p(ctx, dirty) { 1593 if (dirty & /*label*/ 1) set_data(t, /*label*/ ctx[0]); 1594 }, 1595 d(detaching) { 1596 if (detaching) detach(t); 1597 } 1598 }; 1599} 1600 1601// (9:1) {#each interpretation as [text, saliency]} 1602function create_each_block(ctx) { 1603 let span; 1604 let t0_value = /*text*/ ctx[2] + ""; 1605 let t0; 1606 let t1; 1607 let span_style_value; 1608 1609 return { 1610 c() { 1611 span = element("span"); 1612 t0 = text(t0_value); 1613 t1 = space(); 1614 attr(span, "class", "textspan p-1 bg-opacity-20 dark:bg-opacity-80"); 1615 attr(span, "style", span_style_value = "background-color: " + getSaliencyColor(/*saliency*/ ctx[3])); 1616 }, 1617 m(target, anchor) { 1618 insert(target, span, anchor); 1619 append(span, t0); 1620 append(span, t1); 1621 }, 1622 p(ctx, dirty) { 1623 if (dirty & /*interpretation*/ 2 && t0_value !== (t0_value = /*text*/ ctx[2] + "")) set_data(t0, t0_value); 1624 1625 if (dirty & /*interpretation*/ 2 && span_style_value !== (span_style_value = "background-color: " + getSaliencyColor(/*saliency*/ ctx[3]))) { 1626 attr(span, "style", span_style_value); 1627 } 1628 }, 1629 d(detaching) { 1630 if (detaching) detach(span); 1631 } 1632 }; 1633} 1634 1635function create_fragment$1(ctx) { 1636 let div; 1637 let blocktitle; 1638 let t; 1639 let current; 1640 1641 blocktitle = new BlockTitle({ 1642 props: { 1643 $$slots: { default: [create_default_slot] }, 1644 $$scope: { ctx } 1645 } 1646 }); 1647 1648 let each_value = /*interpretation*/ ctx[1]; 1649 let each_blocks = []; 1650 1651 for (let i = 0; i < each_value.length; i += 1) { 1652 each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); 1653 } 1654 1655 return { 1656 c() { 1657 div = element("div"); 1658 create_component(blocktitle.$$.fragment); 1659 t = space(); 1660 1661 for (let i = 0; i < each_blocks.length; i += 1) { 1662 each_blocks[i].c(); 1663 } 1664 1665 attr(div, "class", "input-text w-full rounded box-border p-2 break-word"); 1666 }, 1667 m(target, anchor) { 1668 insert(target, div, anchor); 1669 mount_component(blocktitle, div, null); 1670 append(div, t); 1671 1672 for (let i = 0; i < each_blocks.length; i += 1) { 1673 each_blocks[i].m(div, null); 1674 } 1675 1676 current = true; 1677 }, 1678 p(ctx, [dirty]) { 1679 const blocktitle_changes = {}; 1680 1681 if (dirty & /*$$scope, label*/ 65) { 1682 blocktitle_changes.$$scope = { dirty, ctx }; 1683 } 1684 1685 blocktitle.$set(blocktitle_changes); 1686 1687 if (dirty & /*getSaliencyColor, interpretation*/ 2) { 1688 each_value = /*interpretation*/ ctx[1]; 1689 let i; 1690 1691 for (i = 0; i < each_value.length; i += 1) { 1692 const child_ctx = get_each_context(ctx, each_value, i); 1693 1694 if (each_blocks[i]) { 1695 each_blocks[i].p(child_ctx, dirty); 1696 } else { 1697 each_blocks[i] = create_each_block(child_ctx); 1698 each_blocks[i].c(); 1699 each_blocks[i].m(div, null); 1700 } 1701 } 1702 1703 for (; i < each_blocks.length; i += 1) { 1704 each_blocks[i].d(1); 1705 } 1706 1707 each_blocks.length = each_value.length; 1708 } 1709 }, 1710 i(local) { 1711 if (current) return; 1712 transition_in(blocktitle.$$.fragment, local); 1713 current = true; 1714 }, 1715 o(local) { 1716 transition_out(blocktitle.$$.fragment, local); 1717 current = false; 1718 }, 1719 d(detaching) { 1720 if (detaching) detach(div); 1721 destroy_component(blocktitle); 1722 destroy_each(each_blocks, detaching); 1723 } 1724 }; 1725} 1726 1727function instance$1($$self, $$props, $$invalidate) { 1728 let { label = "" } = $$props; 1729 let { interpretation } = $$props; 1730 1731 $$self.$$set = $$props => {
1732 if ('label' in $$props) $$invalidate(0, label = $$props.label); 1733 if ('interpretation' in $$props) $$invalidate(1, interpretation = $$props.interpretation); 1734 }; 1735 1736 return [label, interpretation]; 1737} 1738 1739class Textbox extends SvelteComponent { 1740 constructor(options) { 1741 super(); 1742 init(this, options, instance$1, create_fragment$1, safe_not_equal, { label: 0, interpretation: 1 }); 1743 } 1744} 1745 1746const component_map = { 1747 audio: Audio, 1748 dropdown: Dropdown, 1749 checkbox: Checkbox, 1750 checkboxgroup: CheckboxGroup, 1751 number: Number, 1752 slider: Slider, 1753 radio: Radio, 1754 image: Image, 1755 textbox: Textbox 1756}; 1757 1758/* src/components/Interpretation/Interpretation.svelte generated by Svelte v3.49.0 */ 1759 1760function create_if_block(ctx) { 1761 let switch_instance; 1762 let switch_instance_anchor; 1763 let current; 1764 1765 const switch_instance_spread_levels = [ 1766 /*component_props*/ ctx[0], 1767 { original: /*value*/ ctx[1].original }, 1768 { 1769 interpretation: /*value*/ ctx[1].interpretation 1770 } 1771 ]; 1772 1773 var switch_value = /*_component*/ ctx[2]; 1774 1775 function switch_props(ctx) { 1776 let switch_instance_props = {}; 1777 1778 for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { 1779 switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); 1780 } 1781 1782 return { props: switch_instance_props }; 1783 } 1784 1785 if (switch_value) { 1786 switch_instance = new switch_value(switch_props()); 1787 } 1788 1789 return { 1790 c() { 1791 if (switch_instance) create_component(switch_instance.$$.fragment); 1792 switch_instance_anchor = empty(); 1793 }, 1794 m(target, anchor) { 1795 if (switch_instance) { 1796 mount_component(switch_instance, target, anchor); 1797 } 1798 1799 insert(target, switch_instance_anchor, anchor); 1800 current = true; 1801 }, 1802 p(ctx, dirty) { 1803 const switch_instance_changes = (dirty & /*component_props, value*/ 3) 1804 ? get_spread_update(switch_instance_spread_levels, [ 1805 dirty & /*component_props*/ 1 && get_spread_object(/*component_props*/ ctx[0]), 1806 dirty & /*value*/ 2 && { original: /*value*/ ctx[1].original }, 1807 dirty & /*value*/ 2 && { 1808 interpretation: /*value*/ ctx[1].interpretation 1809 } 1810 ]) 1811 : {}; 1812 1813 if (switch_value !== (switch_value = /*_component*/ ctx[2])) { 1814 if (switch_instance) { 1815 group_outros(); 1816 const old_component = switch_instance; 1817 1818 transition_out(old_component.$$.fragment, 1, 0, () => { 1819 destroy_component(old_component, 1); 1820 }); 1821 1822 check_outros(); 1823 } 1824 1825 if (switch_value) { 1826 switch_instance = new switch_value(switch_props()); 1827 create_component(switch_instance.$$.fragment); 1828 transition_in(switch_instance.$$.fragment, 1); 1829 mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); 1830 } else { 1831 switch_instance = null; 1832 } 1833 } else if (switch_value) { 1834 switch_instance.$set(switch_instance_changes); 1835 } 1836 }, 1837 i(local) { 1838 if (current) return; 1839 if (switch_instance) transition_in(switch_instance.$$.fragment, local); 1840 current = true; 1841 }, 1842 o(local) { 1843 if (switch_instance) transition_out(switch_instance.$$.fragment, local); 1844 current = false; 1845 }, 1846 d(detaching) { 1847 if (detaching) detach(switch_instance_anchor); 1848 if (switch_instance) destroy_component(switch_instance, detaching); 1849 } 1850 }; 1851} 1852 1853function create_fragment(ctx) { 1854 let if_block_anchor; 1855 let current; 1856 let if_block = /*value*/ ctx[1] && create_if_block(ctx); 1857 1858 return { 1859 c() { 1860 if (if_block) if_block.c(); 1861 if_block_anchor = empty(); 1862 }, 1863 m(target, anchor) { 1864 if (if_block) if_block.m(target, anchor); 1865 insert(target, if_block_anchor, anchor); 1866 current = true; 1867 }, 1868 p(ctx, [dirty]) { 1869 if (/*value*/ ctx[1]) { 1870 if (if_block) { 1871 if_block.p(ctx, dirty); 1872 1873 if (dirty & /*value*/ 2) { 1874 transition_in(if_block, 1); 1875 } 1876 } else { 1877 if_block = create_if_block(ctx); 1878 if_block.c(); 1879 transition_in(if_block, 1); 1880 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1881 } 1882 } else if (if_block) { 1883 group_outros(); 1884 1885 transition_out(if_block, 1, 1, () => { 1886 if_block = null; 1887 }); 1888 1889 check_outros(); 1890 } 1891 }, 1892 i(local) { 1893 if (current) return; 1894 transition_in(if_block); 1895 current = true; 1896 }, 1897 o(local) { 1898 transition_out(if_block); 1899 current = false;
1900 }, 1901 d(detaching) { 1902 if (if_block) if_block.d(detaching); 1903 if (detaching) detach(if_block_anchor); 1904 } 1905 }; 1906} 1907 1908function instance($$self, $$props, $$invalidate) { 1909 let _component; 1910 let { component } = $$props; 1911 let { component_props } = $$props; 1912 let { value } = $$props; 1913 1914 $$self.$$set = $$props => { 1915 if ('component' in $$props) $$invalidate(3, component = $$props.component); 1916 if ('component_props' in $$props) $$invalidate(0, component_props = $$props.component_props); 1917 if ('value' in $$props) $$invalidate(1, value = $$props.value); 1918 }; 1919 1920 $$self.$$.update = () => { 1921 if ($$self.$$.dirty & /*component*/ 8) { 1922 $$invalidate(2, _component = component_map[component]); 1923 } 1924 }; 1925 1926 return [component_props, value, _component, component]; 1927} 1928 1929class Interpretation extends SvelteComponent { 1930 constructor(options) { 1931 super(); 1932 1933 init(this, options, instance, create_fragment, safe_not_equal, { 1934 component: 3, 1935 component_props: 0, 1936 value: 1 1937 }); 1938 } 1939} 1940 1941var Interpretation$1 = Interpretation; 1942 1943const modes = ["dynamic"]; 1944 1945export { Interpretation$1 as Component, modes };
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.