Spaces:
Runtime error
Runtime error
| function noop() { | |
| } | |
| function run(fn) { | |
| return fn(); | |
| } | |
| function blank_object() { | |
| return /* @__PURE__ */ Object.create(null); | |
| } | |
| function run_all(fns) { | |
| fns.forEach(run); | |
| } | |
| function is_function(thing) { | |
| return typeof thing === "function"; | |
| } | |
| function safe_not_equal(a, b) { | |
| return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function"); | |
| } | |
| function is_empty(obj) { | |
| return Object.keys(obj).length === 0; | |
| } | |
| function append(target, node) { | |
| target.appendChild(node); | |
| } | |
| function append_styles(target, style_sheet_id, styles) { | |
| const append_styles_to = get_root_for_style(target); | |
| if (!append_styles_to.getElementById(style_sheet_id)) { | |
| const style = element("style"); | |
| style.id = style_sheet_id; | |
| style.textContent = styles; | |
| append_stylesheet(append_styles_to, style); | |
| } | |
| } | |
| function get_root_for_style(node) { | |
| if (!node) | |
| return document; | |
| const root = node.getRootNode ? node.getRootNode() : node.ownerDocument; | |
| if (root && root.host) { | |
| return root; | |
| } | |
| return node.ownerDocument; | |
| } | |
| function append_stylesheet(node, style) { | |
| append(node.head || node, style); | |
| return style.sheet; | |
| } | |
| function insert(target, node, anchor) { | |
| target.insertBefore(node, anchor || null); | |
| } | |
| function detach(node) { | |
| if (node.parentNode) { | |
| node.parentNode.removeChild(node); | |
| } | |
| } | |
| function destroy_each(iterations, detaching) { | |
| for (let i = 0; i < iterations.length; i += 1) { | |
| if (iterations[i]) | |
| iterations[i].d(detaching); | |
| } | |
| } | |
| function element(name) { | |
| return document.createElement(name); | |
| } | |
| function text(data) { | |
| return document.createTextNode(data); | |
| } | |
| function space() { | |
| return text(" "); | |
| } | |
| function empty() { | |
| return text(""); | |
| } | |
| function listen(node, event, handler, options) { | |
| node.addEventListener(event, handler, options); | |
| return () => node.removeEventListener(event, handler, options); | |
| } | |
| function attr(node, attribute, value) { | |
| if (value == null) | |
| node.removeAttribute(attribute); | |
| else if (node.getAttribute(attribute) !== value) | |
| node.setAttribute(attribute, value); | |
| } | |
| function children(element2) { | |
| return Array.from(element2.childNodes); | |
| } | |
| function set_data(text2, data) { | |
| data = "" + data; | |
| if (text2.data === data) | |
| return; | |
| text2.data = data; | |
| } | |
| function toggle_class(element2, name, toggle) { | |
| element2.classList[toggle ? "add" : "remove"](name); | |
| } | |
| let current_component; | |
| function set_current_component(component) { | |
| current_component = component; | |
| } | |
| const dirty_components = []; | |
| const binding_callbacks = []; | |
| let render_callbacks = []; | |
| const flush_callbacks = []; | |
| const resolved_promise = /* @__PURE__ */ Promise.resolve(); | |
| let update_scheduled = false; | |
| function schedule_update() { | |
| if (!update_scheduled) { | |
| update_scheduled = true; | |
| resolved_promise.then(flush); | |
| } | |
| } | |
| function add_render_callback(fn) { | |
| render_callbacks.push(fn); | |
| } | |
| const seen_callbacks = /* @__PURE__ */ new Set(); | |
| let flushidx = 0; | |
| function flush() { | |
| if (flushidx !== 0) { | |
| return; | |
| } | |
| const saved_component = current_component; | |
| do { | |
| try { | |
| while (flushidx < dirty_components.length) { | |
| const component = dirty_components[flushidx]; | |
| flushidx++; | |
| set_current_component(component); | |
| update(component.$$); | |
| } | |
| } catch (e) { | |
| dirty_components.length = 0; | |
| flushidx = 0; | |
| throw e; | |
| } | |
| set_current_component(null); | |
| dirty_components.length = 0; | |
| flushidx = 0; | |
| while (binding_callbacks.length) | |
| binding_callbacks.pop()(); | |
| for (let i = 0; i < render_callbacks.length; i += 1) { | |
| const callback = render_callbacks[i]; | |
| if (!seen_callbacks.has(callback)) { | |
| seen_callbacks.add(callback); | |
| callback(); | |
| } | |
| } | |
| render_callbacks.length = 0; | |
| } while (dirty_components.length); | |
| while (flush_callbacks.length) { | |
| flush_callbacks.pop()(); | |
| } | |
| update_scheduled = false; | |
| seen_callbacks.clear(); | |
| set_current_component(saved_component); | |
| } | |
| function update($$) { | |
| if ($$.fragment !== null) { | |
| $$.update(); | |
| run_all($$.before_update); | |
| const dirty = $$.dirty; | |
| $$.dirty = [-1]; | |
| $$.fragment && $$.fragment.p($$.ctx, dirty); | |
| $$.after_update.forEach(add_render_callback); | |
| } | |
| } | |
| function flush_render_callbacks(fns) { | |
| const filtered = []; | |
| const targets = []; | |
| render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)); | |
| targets.forEach((c) => c()); | |
| render_callbacks = filtered; | |
| } | |
| const outroing = /* @__PURE__ */ new Set(); | |
| let outros; | |
| function group_outros() { | |
| outros = { | |
| r: 0, | |
| c: [], | |
| p: outros | |
| // parent group | |
| }; | |
| } | |
| function check_outros() { | |
| if (!outros.r) { | |
| run_all(outros.c); | |
| } | |
| outros = outros.p; | |
| } | |
| function transition_in(block, local) { | |
| if (block && block.i) { | |
| outroing.delete(block); | |
| block.i(local); | |
| } | |
| } | |
| function transition_out(block, local, detach2, callback) { | |
| if (block && block.o) { | |
| if (outroing.has(block)) | |
| return; | |
| outroing.add(block); | |
| outros.c.push(() => { | |
| outroing.delete(block); | |
| if (callback) { | |
| if (detach2) | |
| block.d(1); | |
| callback(); | |
| } | |
| }); | |
| block.o(local); | |
| } else if (callback) { | |
| callback(); | |
| } | |
| } | |
| function create_component(block) { | |
| block && block.c(); | |
| } | |
| function mount_component(component, target, anchor, customElement) { | |
| const { fragment, after_update } = component.$$; | |
| fragment && fragment.m(target, anchor); | |
| if (!customElement) { | |
| add_render_callback(() => { | |
| const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); | |
| if (component.$$.on_destroy) { | |
| component.$$.on_destroy.push(...new_on_destroy); | |
| } else { | |
| run_all(new_on_destroy); | |
| } | |
| component.$$.on_mount = []; | |
| }); | |
| } | |
| after_update.forEach(add_render_callback); | |
| } | |
| function destroy_component(component, detaching) { | |
| const $$ = component.$$; | |
| if ($$.fragment !== null) { | |
| flush_render_callbacks($$.after_update); | |
| run_all($$.on_destroy); | |
| $$.fragment && $$.fragment.d(detaching); | |
| $$.on_destroy = $$.fragment = null; | |
| $$.ctx = []; | |
| } | |
| } | |
| function make_dirty(component, i) { | |
| if (component.$$.dirty[0] === -1) { | |
| dirty_components.push(component); | |
| schedule_update(); | |
| component.$$.dirty.fill(0); | |
| } | |
| component.$$.dirty[i / 31 | 0] |= 1 << i % 31; | |
| } | |
| function init(component, options, instance2, create_fragment2, not_equal, props, append_styles2, dirty = [-1]) { | |
| const parent_component = current_component; | |
| set_current_component(component); | |
| const $$ = component.$$ = { | |
| fragment: null, | |
| ctx: [], | |
| // state | |
| props, | |
| update: noop, | |
| not_equal, | |
| bound: blank_object(), | |
| // lifecycle | |
| on_mount: [], | |
| on_destroy: [], | |
| on_disconnect: [], | |
| before_update: [], | |
| after_update: [], | |
| context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), | |
| // everything else | |
| callbacks: blank_object(), | |
| dirty, | |
| skip_bound: false, | |
| root: options.target || parent_component.$$.root | |
| }; | |
| append_styles2 && append_styles2($$.root); | |
| let ready = false; | |
| $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => { | |
| const value = rest.length ? rest[0] : ret; | |
| if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { | |
| if (!$$.skip_bound && $$.bound[i]) | |
| $$.bound[i](value); | |
| if (ready) | |
| make_dirty(component, i); | |
| } | |
| return ret; | |
| }) : []; | |
| $$.update(); | |
| ready = true; | |
| run_all($$.before_update); | |
| $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false; | |
| if (options.target) { | |
| if (options.hydrate) { | |
| const nodes = children(options.target); | |
| $$.fragment && $$.fragment.l(nodes); | |
| nodes.forEach(detach); | |
| } else { | |
| $$.fragment && $$.fragment.c(); | |
| } | |
| if (options.intro) | |
| transition_in(component.$$.fragment); | |
| mount_component(component, options.target, options.anchor, options.customElement); | |
| flush(); | |
| } | |
| set_current_component(parent_component); | |
| } | |
| class SvelteComponent { | |
| $destroy() { | |
| destroy_component(this, 1); | |
| this.$destroy = noop; | |
| } | |
| $on(type, callback) { | |
| if (!is_function(callback)) { | |
| return noop; | |
| } | |
| const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); | |
| callbacks.push(callback); | |
| return () => { | |
| const index = callbacks.indexOf(callback); | |
| if (index !== -1) | |
| callbacks.splice(index, 1); | |
| }; | |
| } | |
| $set($$props) { | |
| if (this.$$set && !is_empty($$props)) { | |
| this.$$.skip_bound = true; | |
| this.$$set($$props); | |
| this.$$.skip_bound = false; | |
| } | |
| } | |
| } | |
| function add_css(target) { | |
| append_styles(target, "svelte-6z96o6", ".svelte-6z96o6:where(._jsonList){list-style:none;margin:0;padding:0;padding-left:var(--jsonPaddingLeft, 1rem);border-left:var(--jsonBorderLeft, 1px dotted)}.svelte-6z96o6:where(._jsonBkt){color:var(--jsonBracketColor, currentcolor)}.svelte-6z96o6:where(._jsonBkt):not(.empty):hover{cursor:pointer;background:var(--jsonBracketHoverBackground, #e5e7eb)}.svelte-6z96o6:where(._jsonSep){color:var(--jsonSeparatorColor, currentcolor)}.svelte-6z96o6:where(._jsonKey){color:var(--jsonKeyColor, currentcolor)}.svelte-6z96o6:where(._jsonVal){color:var(--jsonValColor, #9ca3af)}:where(._jsonVal).string.svelte-6z96o6{color:var(--jsonValStringColor, #059669)}:where(._jsonVal).number.svelte-6z96o6{color:var(--jsonValNumberColor, #d97706)}:where(._jsonVal).boolean.svelte-6z96o6{color:var(--jsonValBooleanColor, #2563eb)}"); | |
| } | |
| function get_each_context(ctx, list, i) { | |
| const child_ctx = ctx.slice(); | |
| child_ctx[10] = list[i]; | |
| child_ctx[12] = i; | |
| return child_ctx; | |
| } | |
| function create_else_block(ctx) { | |
| let span0; | |
| let t0_value = ( | |
| /*brackets*/ | |
| ctx[6][0] + "" | |
| ); | |
| let t0; | |
| let t1; | |
| let ul; | |
| let t2; | |
| let span1; | |
| let t3_value = ( | |
| /*brackets*/ | |
| ctx[6][1] + "" | |
| ); | |
| let t3; | |
| let if_block_anchor; | |
| let current; | |
| let mounted; | |
| let dispose; | |
| let each_value = ( | |
| /*items*/ | |
| ctx[5] | |
| ); | |
| let each_blocks = []; | |
| for (let i = 0; i < each_value.length; i += 1) { | |
| each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); | |
| } | |
| const out = (i) => transition_out(each_blocks[i], 1, 1, () => { | |
| each_blocks[i] = null; | |
| }); | |
| let if_block = !/*_last*/ | |
| ctx[3] && create_if_block_4(); | |
| return { | |
| c() { | |
| span0 = element("span"); | |
| t0 = text(t0_value); | |
| t1 = space(); | |
| ul = element("ul"); | |
| for (let i = 0; i < each_blocks.length; i += 1) { | |
| each_blocks[i].c(); | |
| } | |
| t2 = space(); | |
| span1 = element("span"); | |
| t3 = text(t3_value); | |
| if (if_block) | |
| if_block.c(); | |
| if_block_anchor = empty(); | |
| attr(span0, "class", "_jsonBkt svelte-6z96o6"); | |
| attr(span0, "role", "button"); | |
| attr(span0, "tabindex", "0"); | |
| toggle_class( | |
| span0, | |
| "isArray", | |
| /*isArray*/ | |
| ctx[4] | |
| ); | |
| attr(ul, "class", "_jsonList svelte-6z96o6"); | |
| attr(span1, "class", "_jsonBkt svelte-6z96o6"); | |
| attr(span1, "role", "button"); | |
| attr(span1, "tabindex", "0"); | |
| toggle_class( | |
| span1, | |
| "isArray", | |
| /*isArray*/ | |
| ctx[4] | |
| ); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span0, anchor); | |
| append(span0, t0); | |
| insert(target, t1, anchor); | |
| insert(target, ul, anchor); | |
| for (let i = 0; i < each_blocks.length; i += 1) { | |
| if (each_blocks[i]) { | |
| each_blocks[i].m(ul, null); | |
| } | |
| } | |
| insert(target, t2, anchor); | |
| insert(target, span1, anchor); | |
| append(span1, t3); | |
| if (if_block) | |
| if_block.m(target, anchor); | |
| insert(target, if_block_anchor, anchor); | |
| current = true; | |
| if (!mounted) { | |
| dispose = [ | |
| listen( | |
| span0, | |
| "click", | |
| /*clicked*/ | |
| ctx[8] | |
| ), | |
| listen( | |
| span0, | |
| "keydown", | |
| /*pressed*/ | |
| ctx[9] | |
| ), | |
| listen( | |
| span1, | |
| "click", | |
| /*clicked*/ | |
| ctx[8] | |
| ), | |
| listen( | |
| span1, | |
| "keydown", | |
| /*pressed*/ | |
| ctx[9] | |
| ) | |
| ]; | |
| mounted = true; | |
| } | |
| }, | |
| p(ctx2, dirty) { | |
| if ((!current || dirty & /*brackets*/ | |
| 64) && t0_value !== (t0_value = /*brackets*/ | |
| ctx2[6][0] + "")) | |
| set_data(t0, t0_value); | |
| if (!current || dirty & /*isArray*/ | |
| 16) { | |
| toggle_class( | |
| span0, | |
| "isArray", | |
| /*isArray*/ | |
| ctx2[4] | |
| ); | |
| } | |
| if (dirty & /*json, items, depth, _cur, getType, format, isArray*/ | |
| 55) { | |
| each_value = /*items*/ | |
| ctx2[5]; | |
| let i; | |
| for (i = 0; i < each_value.length; i += 1) { | |
| const child_ctx = get_each_context(ctx2, each_value, i); | |
| if (each_blocks[i]) { | |
| each_blocks[i].p(child_ctx, dirty); | |
| transition_in(each_blocks[i], 1); | |
| } else { | |
| each_blocks[i] = create_each_block(child_ctx); | |
| each_blocks[i].c(); | |
| transition_in(each_blocks[i], 1); | |
| each_blocks[i].m(ul, null); | |
| } | |
| } | |
| group_outros(); | |
| for (i = each_value.length; i < each_blocks.length; i += 1) { | |
| out(i); | |
| } | |
| check_outros(); | |
| } | |
| if ((!current || dirty & /*brackets*/ | |
| 64) && t3_value !== (t3_value = /*brackets*/ | |
| ctx2[6][1] + "")) | |
| set_data(t3, t3_value); | |
| if (!current || dirty & /*isArray*/ | |
| 16) { | |
| toggle_class( | |
| span1, | |
| "isArray", | |
| /*isArray*/ | |
| ctx2[4] | |
| ); | |
| } | |
| if (!/*_last*/ | |
| ctx2[3]) { | |
| if (if_block) | |
| ; | |
| else { | |
| if_block = create_if_block_4(); | |
| if_block.c(); | |
| if_block.m(if_block_anchor.parentNode, if_block_anchor); | |
| } | |
| } else if (if_block) { | |
| if_block.d(1); | |
| if_block = null; | |
| } | |
| }, | |
| i(local) { | |
| if (current) | |
| return; | |
| for (let i = 0; i < each_value.length; i += 1) { | |
| transition_in(each_blocks[i]); | |
| } | |
| current = true; | |
| }, | |
| o(local) { | |
| each_blocks = each_blocks.filter(Boolean); | |
| for (let i = 0; i < each_blocks.length; i += 1) { | |
| transition_out(each_blocks[i]); | |
| } | |
| current = false; | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span0); | |
| if (detaching) | |
| detach(t1); | |
| if (detaching) | |
| detach(ul); | |
| destroy_each(each_blocks, detaching); | |
| if (detaching) | |
| detach(t2); | |
| if (detaching) | |
| detach(span1); | |
| if (if_block) | |
| if_block.d(detaching); | |
| if (detaching) | |
| detach(if_block_anchor); | |
| mounted = false; | |
| run_all(dispose); | |
| } | |
| }; | |
| } | |
| function create_if_block_2(ctx) { | |
| let span; | |
| let t0_value = ( | |
| /*brackets*/ | |
| ctx[6][0] + "" | |
| ); | |
| let t0; | |
| let t1; | |
| let t2_value = ( | |
| /*brackets*/ | |
| ctx[6][1] + "" | |
| ); | |
| let t2; | |
| let if_block_anchor; | |
| let mounted; | |
| let dispose; | |
| let if_block = !/*_last*/ | |
| ctx[3] && /*collapsed*/ | |
| ctx[7] && create_if_block_3(); | |
| return { | |
| c() { | |
| span = element("span"); | |
| t0 = text(t0_value); | |
| t1 = text("..."); | |
| t2 = text(t2_value); | |
| if (if_block) | |
| if_block.c(); | |
| if_block_anchor = empty(); | |
| attr(span, "class", "_jsonBkt svelte-6z96o6"); | |
| attr(span, "role", "button"); | |
| attr(span, "tabindex", "0"); | |
| toggle_class( | |
| span, | |
| "isArray", | |
| /*isArray*/ | |
| ctx[4] | |
| ); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| append(span, t0); | |
| append(span, t1); | |
| append(span, t2); | |
| if (if_block) | |
| if_block.m(target, anchor); | |
| insert(target, if_block_anchor, anchor); | |
| if (!mounted) { | |
| dispose = [ | |
| listen( | |
| span, | |
| "click", | |
| /*clicked*/ | |
| ctx[8] | |
| ), | |
| listen( | |
| span, | |
| "keydown", | |
| /*pressed*/ | |
| ctx[9] | |
| ) | |
| ]; | |
| mounted = true; | |
| } | |
| }, | |
| p(ctx2, dirty) { | |
| if (dirty & /*brackets*/ | |
| 64 && t0_value !== (t0_value = /*brackets*/ | |
| ctx2[6][0] + "")) | |
| set_data(t0, t0_value); | |
| if (dirty & /*brackets*/ | |
| 64 && t2_value !== (t2_value = /*brackets*/ | |
| ctx2[6][1] + "")) | |
| set_data(t2, t2_value); | |
| if (dirty & /*isArray*/ | |
| 16) { | |
| toggle_class( | |
| span, | |
| "isArray", | |
| /*isArray*/ | |
| ctx2[4] | |
| ); | |
| } | |
| if (!/*_last*/ | |
| ctx2[3] && /*collapsed*/ | |
| ctx2[7]) { | |
| if (if_block) | |
| ; | |
| else { | |
| if_block = create_if_block_3(); | |
| if_block.c(); | |
| if_block.m(if_block_anchor.parentNode, if_block_anchor); | |
| } | |
| } else if (if_block) { | |
| if_block.d(1); | |
| if_block = null; | |
| } | |
| }, | |
| i: noop, | |
| o: noop, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| if (if_block) | |
| if_block.d(detaching); | |
| if (detaching) | |
| detach(if_block_anchor); | |
| mounted = false; | |
| run_all(dispose); | |
| } | |
| }; | |
| } | |
| function create_if_block(ctx) { | |
| let span; | |
| let t0_value = ( | |
| /*brackets*/ | |
| ctx[6][0] + "" | |
| ); | |
| let t0; | |
| let t1_value = ( | |
| /*brackets*/ | |
| ctx[6][1] + "" | |
| ); | |
| let t1; | |
| let if_block_anchor; | |
| let if_block = !/*_last*/ | |
| ctx[3] && create_if_block_1(); | |
| return { | |
| c() { | |
| span = element("span"); | |
| t0 = text(t0_value); | |
| t1 = text(t1_value); | |
| if (if_block) | |
| if_block.c(); | |
| if_block_anchor = empty(); | |
| attr(span, "class", "_jsonBkt empty svelte-6z96o6"); | |
| toggle_class( | |
| span, | |
| "isArray", | |
| /*isArray*/ | |
| ctx[4] | |
| ); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| append(span, t0); | |
| append(span, t1); | |
| if (if_block) | |
| if_block.m(target, anchor); | |
| insert(target, if_block_anchor, anchor); | |
| }, | |
| p(ctx2, dirty) { | |
| if (dirty & /*brackets*/ | |
| 64 && t0_value !== (t0_value = /*brackets*/ | |
| ctx2[6][0] + "")) | |
| set_data(t0, t0_value); | |
| if (dirty & /*brackets*/ | |
| 64 && t1_value !== (t1_value = /*brackets*/ | |
| ctx2[6][1] + "")) | |
| set_data(t1, t1_value); | |
| if (dirty & /*isArray*/ | |
| 16) { | |
| toggle_class( | |
| span, | |
| "isArray", | |
| /*isArray*/ | |
| ctx2[4] | |
| ); | |
| } | |
| if (!/*_last*/ | |
| ctx2[3]) { | |
| if (if_block) | |
| ; | |
| else { | |
| if_block = create_if_block_1(); | |
| if_block.c(); | |
| if_block.m(if_block_anchor.parentNode, if_block_anchor); | |
| } | |
| } else if (if_block) { | |
| if_block.d(1); | |
| if_block = null; | |
| } | |
| }, | |
| i: noop, | |
| o: noop, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| if (if_block) | |
| if_block.d(detaching); | |
| if (detaching) | |
| detach(if_block_anchor); | |
| } | |
| }; | |
| } | |
| function create_if_block_7(ctx) { | |
| let span0; | |
| let t0; | |
| let t1_value = ( | |
| /*i*/ | |
| ctx[10] + "" | |
| ); | |
| let t1; | |
| let t2; | |
| let span1; | |
| return { | |
| c() { | |
| span0 = element("span"); | |
| t0 = text('"'); | |
| t1 = text(t1_value); | |
| t2 = text('"'); | |
| span1 = element("span"); | |
| span1.textContent = ":"; | |
| attr(span0, "class", "_jsonKey svelte-6z96o6"); | |
| attr(span1, "class", "_jsonSep svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span0, anchor); | |
| append(span0, t0); | |
| append(span0, t1); | |
| append(span0, t2); | |
| insert(target, span1, anchor); | |
| }, | |
| p(ctx2, dirty) { | |
| if (dirty & /*items*/ | |
| 32 && t1_value !== (t1_value = /*i*/ | |
| ctx2[10] + "")) | |
| set_data(t1, t1_value); | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span0); | |
| if (detaching) | |
| detach(span1); | |
| } | |
| }; | |
| } | |
| function create_else_block_1(ctx) { | |
| let span; | |
| let t_value = format( | |
| /*json*/ | |
| ctx[0][ | |
| /*i*/ | |
| ctx[10] | |
| ] | |
| ) + ""; | |
| let t; | |
| let span_class_value; | |
| let if_block_anchor; | |
| let if_block = ( | |
| /*idx*/ | |
| ctx[12] < /*items*/ | |
| ctx[5].length - 1 && create_if_block_6() | |
| ); | |
| return { | |
| c() { | |
| span = element("span"); | |
| t = text(t_value); | |
| if (if_block) | |
| if_block.c(); | |
| if_block_anchor = empty(); | |
| attr(span, "class", span_class_value = "_jsonVal " + getType( | |
| /*json*/ | |
| ctx[0][ | |
| /*i*/ | |
| ctx[10] | |
| ] | |
| ) + " svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| append(span, t); | |
| if (if_block) | |
| if_block.m(target, anchor); | |
| insert(target, if_block_anchor, anchor); | |
| }, | |
| p(ctx2, dirty) { | |
| if (dirty & /*json, items*/ | |
| 33 && t_value !== (t_value = format( | |
| /*json*/ | |
| ctx2[0][ | |
| /*i*/ | |
| ctx2[10] | |
| ] | |
| ) + "")) | |
| set_data(t, t_value); | |
| if (dirty & /*json, items*/ | |
| 33 && span_class_value !== (span_class_value = "_jsonVal " + getType( | |
| /*json*/ | |
| ctx2[0][ | |
| /*i*/ | |
| ctx2[10] | |
| ] | |
| ) + " svelte-6z96o6")) { | |
| attr(span, "class", span_class_value); | |
| } | |
| if ( | |
| /*idx*/ | |
| ctx2[12] < /*items*/ | |
| ctx2[5].length - 1 | |
| ) { | |
| if (if_block) | |
| ; | |
| else { | |
| if_block = create_if_block_6(); | |
| if_block.c(); | |
| if_block.m(if_block_anchor.parentNode, if_block_anchor); | |
| } | |
| } else if (if_block) { | |
| if_block.d(1); | |
| if_block = null; | |
| } | |
| }, | |
| i: noop, | |
| o: noop, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| if (if_block) | |
| if_block.d(detaching); | |
| if (detaching) | |
| detach(if_block_anchor); | |
| } | |
| }; | |
| } | |
| function create_if_block_5(ctx) { | |
| let jsonview; | |
| let current; | |
| jsonview = new JsonView({ | |
| props: { | |
| json: ( | |
| /*json*/ | |
| ctx[0][ | |
| /*i*/ | |
| ctx[10] | |
| ] | |
| ), | |
| depth: ( | |
| /*depth*/ | |
| ctx[1] | |
| ), | |
| _cur: ( | |
| /*_cur*/ | |
| ctx[2] + 1 | |
| ), | |
| _last: ( | |
| /*idx*/ | |
| ctx[12] === /*items*/ | |
| ctx[5].length - 1 | |
| ) | |
| } | |
| }); | |
| return { | |
| c() { | |
| create_component(jsonview.$$.fragment); | |
| }, | |
| m(target, anchor) { | |
| mount_component(jsonview, target, anchor); | |
| current = true; | |
| }, | |
| p(ctx2, dirty) { | |
| const jsonview_changes = {}; | |
| if (dirty & /*json, items*/ | |
| 33) | |
| jsonview_changes.json = /*json*/ | |
| ctx2[0][ | |
| /*i*/ | |
| ctx2[10] | |
| ]; | |
| if (dirty & /*depth*/ | |
| 2) | |
| jsonview_changes.depth = /*depth*/ | |
| ctx2[1]; | |
| if (dirty & /*_cur*/ | |
| 4) | |
| jsonview_changes._cur = /*_cur*/ | |
| ctx2[2] + 1; | |
| if (dirty & /*items*/ | |
| 32) | |
| jsonview_changes._last = /*idx*/ | |
| ctx2[12] === /*items*/ | |
| ctx2[5].length - 1; | |
| jsonview.$set(jsonview_changes); | |
| }, | |
| i(local) { | |
| if (current) | |
| return; | |
| transition_in(jsonview.$$.fragment, local); | |
| current = true; | |
| }, | |
| o(local) { | |
| transition_out(jsonview.$$.fragment, local); | |
| current = false; | |
| }, | |
| d(detaching) { | |
| destroy_component(jsonview, detaching); | |
| } | |
| }; | |
| } | |
| function create_if_block_6(ctx) { | |
| let span; | |
| return { | |
| c() { | |
| span = element("span"); | |
| span.textContent = ","; | |
| attr(span, "class", "_jsonSep svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| } | |
| }; | |
| } | |
| function create_each_block(ctx) { | |
| let li; | |
| let t0; | |
| let show_if; | |
| let current_block_type_index; | |
| let if_block1; | |
| let t1; | |
| let current; | |
| let if_block0 = !/*isArray*/ | |
| ctx[4] && create_if_block_7(ctx); | |
| const if_block_creators = [create_if_block_5, create_else_block_1]; | |
| const if_blocks = []; | |
| function select_block_type_1(ctx2, dirty) { | |
| if (dirty & /*json, items*/ | |
| 33) | |
| show_if = null; | |
| if (show_if == null) | |
| show_if = !!(getType( | |
| /*json*/ | |
| ctx2[0][ | |
| /*i*/ | |
| ctx2[10] | |
| ] | |
| ) === "object"); | |
| if (show_if) | |
| return 0; | |
| return 1; | |
| } | |
| current_block_type_index = select_block_type_1(ctx, -1); | |
| if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); | |
| return { | |
| c() { | |
| li = element("li"); | |
| if (if_block0) | |
| if_block0.c(); | |
| t0 = space(); | |
| if_block1.c(); | |
| t1 = space(); | |
| attr(li, "class", "svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, li, anchor); | |
| if (if_block0) | |
| if_block0.m(li, null); | |
| append(li, t0); | |
| if_blocks[current_block_type_index].m(li, null); | |
| append(li, t1); | |
| current = true; | |
| }, | |
| p(ctx2, dirty) { | |
| if (!/*isArray*/ | |
| ctx2[4]) { | |
| if (if_block0) { | |
| if_block0.p(ctx2, dirty); | |
| } else { | |
| if_block0 = create_if_block_7(ctx2); | |
| if_block0.c(); | |
| if_block0.m(li, t0); | |
| } | |
| } else if (if_block0) { | |
| if_block0.d(1); | |
| if_block0 = null; | |
| } | |
| let previous_block_index = current_block_type_index; | |
| current_block_type_index = select_block_type_1(ctx2, dirty); | |
| if (current_block_type_index === previous_block_index) { | |
| if_blocks[current_block_type_index].p(ctx2, dirty); | |
| } else { | |
| group_outros(); | |
| transition_out(if_blocks[previous_block_index], 1, 1, () => { | |
| if_blocks[previous_block_index] = null; | |
| }); | |
| check_outros(); | |
| if_block1 = if_blocks[current_block_type_index]; | |
| if (!if_block1) { | |
| if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); | |
| if_block1.c(); | |
| } else { | |
| if_block1.p(ctx2, dirty); | |
| } | |
| transition_in(if_block1, 1); | |
| if_block1.m(li, t1); | |
| } | |
| }, | |
| i(local) { | |
| if (current) | |
| return; | |
| transition_in(if_block1); | |
| current = true; | |
| }, | |
| o(local) { | |
| transition_out(if_block1); | |
| current = false; | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(li); | |
| if (if_block0) | |
| if_block0.d(); | |
| if_blocks[current_block_type_index].d(); | |
| } | |
| }; | |
| } | |
| function create_if_block_4(ctx) { | |
| let span; | |
| return { | |
| c() { | |
| span = element("span"); | |
| span.textContent = ","; | |
| attr(span, "class", "_jsonSep svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| } | |
| }; | |
| } | |
| function create_if_block_3(ctx) { | |
| let span; | |
| return { | |
| c() { | |
| span = element("span"); | |
| span.textContent = ","; | |
| attr(span, "class", "_jsonSep svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| } | |
| }; | |
| } | |
| function create_if_block_1(ctx) { | |
| let span; | |
| return { | |
| c() { | |
| span = element("span"); | |
| span.textContent = ","; | |
| attr(span, "class", "_jsonSep svelte-6z96o6"); | |
| }, | |
| m(target, anchor) { | |
| insert(target, span, anchor); | |
| }, | |
| d(detaching) { | |
| if (detaching) | |
| detach(span); | |
| } | |
| }; | |
| } | |
| function create_fragment(ctx) { | |
| let current_block_type_index; | |
| let if_block; | |
| let if_block_anchor; | |
| let current; | |
| const if_block_creators = [create_if_block, create_if_block_2, create_else_block]; | |
| const if_blocks = []; | |
| function select_block_type(ctx2, dirty) { | |
| if (!/*items*/ | |
| ctx2[5].length) | |
| return 0; | |
| if ( | |
| /*collapsed*/ | |
| ctx2[7] | |
| ) | |
| return 1; | |
| return 2; | |
| } | |
| current_block_type_index = select_block_type(ctx); | |
| if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); | |
| return { | |
| c() { | |
| if_block.c(); | |
| if_block_anchor = empty(); | |
| }, | |
| m(target, anchor) { | |
| if_blocks[current_block_type_index].m(target, anchor); | |
| insert(target, if_block_anchor, anchor); | |
| current = true; | |
| }, | |
| p(ctx2, [dirty]) { | |
| let previous_block_index = current_block_type_index; | |
| current_block_type_index = select_block_type(ctx2); | |
| if (current_block_type_index === previous_block_index) { | |
| if_blocks[current_block_type_index].p(ctx2, dirty); | |
| } else { | |
| group_outros(); | |
| transition_out(if_blocks[previous_block_index], 1, 1, () => { | |
| if_blocks[previous_block_index] = null; | |
| }); | |
| check_outros(); | |
| if_block = if_blocks[current_block_type_index]; | |
| if (!if_block) { | |
| if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); | |
| if_block.c(); | |
| } else { | |
| if_block.p(ctx2, dirty); | |
| } | |
| transition_in(if_block, 1); | |
| if_block.m(if_block_anchor.parentNode, if_block_anchor); | |
| } | |
| }, | |
| i(local) { | |
| if (current) | |
| return; | |
| transition_in(if_block); | |
| current = true; | |
| }, | |
| o(local) { | |
| transition_out(if_block); | |
| current = false; | |
| }, | |
| d(detaching) { | |
| if_blocks[current_block_type_index].d(detaching); | |
| if (detaching) | |
| detach(if_block_anchor); | |
| } | |
| }; | |
| } | |
| function getType(i) { | |
| if (i === null) | |
| return "null"; | |
| return typeof i; | |
| } | |
| function format(i) { | |
| const t = getType(i); | |
| if (t === "string") | |
| return `"${i}"`; | |
| if (t === "function") | |
| return "f () {...}"; | |
| if (t === "symbol") | |
| return i.toString(); | |
| return i; | |
| } | |
| function instance($$self, $$props, $$invalidate) { | |
| let { json } = $$props; | |
| let { depth = Infinity } = $$props; | |
| let { _cur = 0 } = $$props; | |
| let { _last = true } = $$props; | |
| let items; | |
| let isArray = false; | |
| let brackets = ["", ""]; | |
| let collapsed = false; | |
| function clicked() { | |
| $$invalidate(7, collapsed = !collapsed); | |
| } | |
| function pressed(e) { | |
| if (e instanceof KeyboardEvent && ["Enter", " "].includes(e.key)) | |
| clicked(); | |
| } | |
| $$self.$$set = ($$props2) => { | |
| if ("json" in $$props2) | |
| $$invalidate(0, json = $$props2.json); | |
| if ("depth" in $$props2) | |
| $$invalidate(1, depth = $$props2.depth); | |
| if ("_cur" in $$props2) | |
| $$invalidate(2, _cur = $$props2._cur); | |
| if ("_last" in $$props2) | |
| $$invalidate(3, _last = $$props2._last); | |
| }; | |
| $$self.$$.update = () => { | |
| if ($$self.$$.dirty & /*json, isArray*/ | |
| 17) { | |
| { | |
| $$invalidate(5, items = getType(json) === "object" ? Object.keys(json) : []); | |
| $$invalidate(4, isArray = Array.isArray(json)); | |
| $$invalidate(6, brackets = isArray ? ["[", "]"] : ["{", "}"]); | |
| } | |
| } | |
| if ($$self.$$.dirty & /*depth, _cur*/ | |
| 6) { | |
| $$invalidate(7, collapsed = depth < _cur); | |
| } | |
| }; | |
| return [ | |
| json, | |
| depth, | |
| _cur, | |
| _last, | |
| isArray, | |
| items, | |
| brackets, | |
| collapsed, | |
| clicked, | |
| pressed | |
| ]; | |
| } | |
| class JsonView extends SvelteComponent { | |
| constructor(options) { | |
| super(); | |
| init(this, options, instance, create_fragment, safe_not_equal, { json: 0, depth: 1, _cur: 2, _last: 3 }, add_css); | |
| } | |
| } | |
| export { | |
| JsonView | |
| }; | |