text: 'use strict';
  
  var index = require('./index-eb65fe33.js');
  var index$1 = require('./index-a6b4e1c5.js');
  require('./index-9f24c7af.js');
  require('yootils');
  require('./Repl-546ad7c5.js');
  var app$1 = require('./app-861e9ad0.js');
  require('do-not-zip');
  
  /* src\routes\repl\[id]\_components\AppControls\UserMenu.svelte generated by Svelte v3.12.0 */
  
  const css = {
  	code: ".user.svelte-1741g67{position:relative;display:inline-block;padding:0em 1.2rem 0 1.6rem;height:0.8em;line-height:1;z-index:99}.user.svelte-1741g67::after{position:absolute;content:'';width:100%;height:3.2rem;left:0;top:0}span.svelte-1741g67{line-height:1;display:none;font-family:var(--font);font-size:1.6rem;opacity:0.7}.user.svelte-1741g67:hover span.svelte-1741g67{opacity:1}img.svelte-1741g67{position:absolute;top:-0.05em;right:0;width:2.1rem;height:2.1rem;border:1px solid rgba(255,255,255,0.3);border-radius:0.2rem}.menu.svelte-1741g67{position:absolute;width:calc(100% + 1.6rem);min-width:10em;top:3rem;right:-1.6rem;background-color:var(--second);padding:0.8rem 1.6rem;z-index:99;text-align:left;border-radius:0.4rem;display:flex;flex-direction:column}.menu.svelte-1741g67 button.svelte-1741g67,.menu.svelte-1741g67 a.svelte-1741g67{background-color:transparent;font-family:var(--font);font-size:1.6rem;opacity:0.7;padding:0.4rem 0;text-decoration:none;text-align:left;border:none;color:inherit}.menu.svelte-1741g67 button.svelte-1741g67:hover,.menu.svelte-1741g67 a.svelte-1741g67:hover{opacity:1;color:inherit}@media(min-width: 600px){.user.svelte-1741g67{padding:0em 3.2rem 0 1.6rem}img.svelte-1741g67{width:2.4rem;height:2.4rem}span.svelte-1741g67{display:inline-block}}",
  	map: "{\"version\":3,\"file\":\"UserMenu.svelte\",\"sources\":[\"UserMenu.svelte\"],\"sourcesContent\":[\"<script>\\r\\n\\timport { getContext } from 'svelte';\\r\\n\\timport { stores } from '@sapper/app';\\r\\n\\tconst { session } = stores();\\r\\n\\r\\n\\tconst { logout } = getContext('app');\\r\\n\\r\\n\\tlet showMenu = false;\\r\\n\\tlet name;\\r\\n\\r\\n\\t$: name = $session.user.name || $session.user.username;\\r\\n</script>\\r\\n\\r\\n<div class=\\\"user\\\" on:mouseenter=\\\"{() => showMenu = true}\\\" on:mouseleave=\\\"{() => showMenu = false}\\\">\\r\\n\\t<span>{name}</span>\\r\\n\\t<img alt=\\\"{name} avatar\\\" src=\\\"{$session.user.avatar}\\\">\\r\\n\\r\\n\\t{#if showMenu}\\r\\n\\t\\t<div class=\\\"menu\\\">\\r\\n\\t\\t\\t<a href=\\\"apps\\\">Your saved apps</a>\\r\\n\\t\\t\\t<button on:click={logout}>Log out</button>\\r\\n\\t\\t</div>\\r\\n\\t{/if}\\r\\n</div>\\r\\n\\r\\n<style>\\r\\n\\t.user {\\r\\n\\t\\tposition: relative;\\r\\n\\t\\tdisplay: inline-block;\\r\\n\\t\\tpadding: 0em 1.2rem 0 1.6rem;\\r\\n\\t\\theight: 0.8em;\\r\\n\\t\\tline-height: 1;\\r\\n\\t\\tz-index: 99;\\r\\n\\t}\\r\\n\\r\\n\\t.user::after {\\r\\n\\t\\t/* embiggen hit zone, so log out menu doesn't disappear */\\r\\n\\t\\tposition: absolute;\\r\\n\\t\\tcontent: '';\\r\\n\\t\\twidth: 100%;\\r\\n\\t\\theight: 3.2rem;\\r\\n\\t\\tleft: 0;\\r\\n\\t\\ttop: 0;\\r\\n\\t}\\r\\n\\r\\n\\tspan {\\r\\n\\t\\t/* position: relative; padding: 0 2em 0 0; */\\r\\n\\t\\tline-height: 1;\\r\\n\\t\\tdisplay: none;\\r\\n\\t\\tfont-family: var(--font);\\r\\n\\t\\tfont-size: 1.6rem;\\r\\n\\t\\topacity: 0.7;\\r\\n\\t}\\r\\n\\r\\n\\t.user:hover span {\\r\\n\\t\\topacity: 1;\\r\\n\\t}\\r\\n\\r\\n\\timg {\\r\\n\\t\\tposition: absolute;\\r\\n\\t\\ttop: -0.05em;\\r\\n\\t\\tright: 0;\\r\\n\\t\\twidth: 2.1rem;\\r\\n\\t\\theight: 2.1rem;\\r\\n\\t\\tborder: 1px solid rgba(255,255,255,0.3);\\r\\n\\t\\tborder-radius: 0.2rem;\\r\\n\\t}\\r\\n\\r\\n\\t.menu {\\r\\n\\t\\tposition: absolute;\\r\\n\\t\\twidth: calc(100% + 1.6rem);\\r\\n\\t\\tmin-width: 10em;\\r\\n\\t\\ttop: 3rem;\\r\\n\\t\\tright: -1.6rem;\\r\\n\\t\\tbackground-color: var(--second);\\r\\n\\t\\tpadding: 0.8rem 1.6rem;\\r\\n\\t\\tz-index: 99;\\r\\n\\t\\ttext-align: left;\\r\\n\\t\\tborder-radius: 0.4rem;\\r\\n\\t\\tdisplay: flex;\\r\\n\\t\\tflex-direction: column;\\r\\n\\t}\\r\\n\\r\\n\\t.menu button, .menu a {\\r\\n\\t\\tbackground-color: transparent;\\r\\n\\t\\tfont-family: var(--font);\\r\\n\\t\\tfont-size: 1.6rem;\\r\\n\\t\\topacity: 0.7;\\r\\n\\t\\tpadding: 0.4rem 0;\\r\\n\\t\\ttext-decoration: none;\\r\\n\\t\\ttext-align: left;\\r\\n\\t\\tborder: none;\\r\\n\\t\\tcolor: inherit;\\r\\n\\t}\\r\\n\\r\\n\\t.menu button:hover, .menu a:hover {\\r\\n\\t\\topacity: 1;\\r\\n\\t\\tcolor: inherit;\\r\\n\\t}\\r\\n\\r\\n\\t@media (min-width: 600px) {\\r\\n\\t\\t.user {\\r\\n\\t\\t\\tpadding: 0em 3.2rem 0 1.6rem;\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\timg {\\r\\n\\t\\t\\twidth: 2.4rem;\\r\\n\\t\\t\\theight: 2.4rem;\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\tspan {\\r\\n\\t\\t\\tdisplay: inline-block;\\r\\n\\t\\t}\\r\\n\\t}\\r\\n</style>\\r\\n\"],\"names\":[],\"mappings\":\"AA0BC,KAAK,eAAC,CAAC,AACN,QAAQ,CAAE,QAAQ,CAClB,OAAO,CAAE,YAAY,CACrB,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CAAC,qBAAM,CAAE,oBAAK,CAAC,CAAC,eAAC,CAAC,AACtB,gBAAgB,CAAE,WAAW,CAC7B,WAAW,CAAE,IAAI,MAAM,CAAC,CACxB,SAAS,CAAE,MAAM,CACjB,OAAO,CAAE,GAAG,CACZ,OAAO,CAAE,MAAM,CAAC,CAAC,CACjB,eAAe,CAAE,IAAI,CACrB,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,OAAO,AACf,CAAC,AAED,oBAAK,CAAC,qBAAM,MAAM,CAAE,oBAAK,CAAC,gBAAC,MAAM,AAAC,CAAC,AAClC,OAAO,CAAE,CAAC,CACV,KAAK,CAAE,OAAO,AACf,CAAC,AAED,MAAM,AAAC,YAAY,KAAK,CAAC,AAAC,CAAC,AAC1B,KAAK,eAAC,CAAC,AACN,OAAO,CAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,AAC7B,CAAC,AAED,GAAG,eAAC,CAAC,AACJ,KAAK,CAAE,MAAM,CACb,MAAM,CAAE,MAAM,AACf,CAAC,AAED,IAAI,eAAC,CAAC,AACL,OAAO,CAAE,YAAY,AACtB,CAAC,AACF,CAAC\"}"
  };
  
  const UserMenu = index.create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
  	let $session;
  
  	
  	const { session } = app$1.stores$1(); $session = index.get_store_value(session);
  
  	const { logout } = index.getContext('app');
  	let name;
  
  	$$result.css.add(css);
  
  	$session = index.get_store_value(session);
  
  	name = $session.user.name || $session.user.username;
  
  	return `<div class="user svelte-1741g67">
  		<span class="svelte-1741g67">${index.escape(name)}</span>
  		<img alt="${index.escape(name)} avatar"${index.add_attribute("src", $session.user.avatar, 0)} class="svelte-1741g67">
  
  		${  `` }
  	</div>`;
  });
  
  const isMac = typeof navigator !== 'undefined' && navigator.platform === 'MacIntel';
  
  /* src\routes\repl\[id]\_components\AppControls\index.svelte generated by Svelte v3.12.0 */
  
  const css$1 = {
  	code: ".app-controls.svelte-1ez15pl{position:absolute;top:0;left:0;width:100%;height:var(--app-controls-h);display:flex;align-items:center;justify-content:space-between;padding:.6rem var(--side-nav);background-color:var(--second);color:white}.icon.svelte-1ez15pl{position:relative;top:-0.1rem;display:inline-block;padding:0.2em;opacity:.7;transition:opacity .3s;font-family:var(--font);font-size:1.6rem;color:white;line-height:1;margin:0 0 0 0.2em}.icon.svelte-1ez15pl:hover{opacity:1 }.icon.svelte-1ez15pl:disabled{opacity:.3 }.icon[title^='fullscreen'].svelte-1ez15pl{display:none }input.svelte-1ez15pl{background:transparent;border:none;color:currentColor;font-family:var(--font);font-size:1.6rem;opacity:0.7;outline:none;flex:1}input.svelte-1ez15pl:focus{opacity:1}button.svelte-1ez15pl span.svelte-1ez15pl{display:none}@media(min-width: 600px){.icon[title^='fullscreen'].svelte-1ez15pl{display:inline }button.svelte-1ez15pl span.svelte-1ez15pl{display:inline-block}}",
  	map: "{\"version\":3,\"file\":\"index.svelte\",\"sources\":[\"index.svelte\"],\"sourcesContent\":[\"<script>\\r\\n\\timport { createEventDispatcher, getContext } from 'svelte';\\r\\n\\timport { stores } from '@sapper/app';\\r\\n\\timport UserMenu from './UserMenu.svelte';\\r\\n\\timport { Icon } from '@sveltejs/site-kit';\\r\\n\\timport * as doNotZip from 'do-not-zip';\\r\\n\\timport downloadBlob from '../../../_utils/downloadBlob.js';\\r\\n\\timport { enter } from '../../../../../utils/events.js';\\r\\n\\timport { isMac } from '../../../../../utils/compat.js';\\r\\n\\r\\n\\tconst dispatch = createEventDispatcher();\\r\\n\\tconst { session } = stores();\\r\\n\\tconst { login } = getContext('app');\\r\\n\\r\\n\\texport let repl;\\r\\n\\texport let gist;\\r\\n\\texport let name;\\r\\n\\texport let zen_mode;\\r\\n\\texport let bundle;\\r\\n\\r\\n\\tlet saving = false;\\r\\n\\tlet downloading = false;\\r\\n\\tlet justSaved = false;\\r\\n\\tlet justForked = false;\\r\\n\\r\\n\\tfunction wait(ms) {\\r\\n\\t\\treturn new Promise(f => setTimeout(f, ms));\\r\\n\\t}\\r\\n\\r\\n\\t$: canSave = $session.user && gist && gist.owner === $session.user.uid;\\r\\n\\r\\n\\tfunction handleKeydown(event) {\\r\\n\\t\\tif (event.which === 83 && (isMac ? event.metaKey : event.ctrlKey)) {\\r\\n\\t\\t\\tevent.preventDefault();\\r\\n\\t\\t\\tsave();\\r\\n\\t\\t}\\r\\n\\t}\\r\\n\\r\\n\\tasync function fork(intentWasSave) {\\r\\n\\t\\tsaving = true;\\r\\n\\r\\n\\t\\tconst { components } = repl.toJSON();\\r\\n\\r\\n\\t\\ttry {\\r\\n\\t\\t\\tconst r = await fetch(`repl/create.json`, {\\r\\n\\t\\t\\t\\tmethod: 'POST',\\r\\n\\t\\t\\t\\tcredentials: 'include',\\r\\n\\t\\t\\t\\tbody: JSON.stringify({\\r\\n\\t\\t\\t\\t\\tname,\\r\\n\\t\\t\\t\\t\\tfiles: components.map(component => ({\\r\\n\\t\\t\\t\\t\\t\\tname: `${component.name}.${component.type}`,\\r\\n\\t\\t\\t\\t\\t\\tsource: component.source\\r\\n\\t\\t\\t\\t\\t}))\\r\\n\\t\\t\\t\\t})\\r\\n\\t\\t\\t});\\r\\n\\r\\n\\t\\t\\tif (r.status < 200 || r.status >= 300) {\\r\\n\\t\\t\\t\\tconst { error } = await r.json();\\r\\n\\t\\t\\t\\tthrow new Error(`Received an HTTP ${r.status} response: ${error}`);\\r\\n\\t\\t\\t}\\r\\n\\r\\n\\t\\t\\tconst gist = await r.json();\\r\\n\\t\\t\\tdispatch('forked', { gist });\\r\\n\\r\\n\\t\\t\\tif (intentWasSave) {\\r\\n\\t\\t\\t\\tjustSaved = true;\\r\\n\\t\\t\\t\\tawait wait(600);\\r\\n\\t\\t\\t\\tjustSaved = false;\\r\\n\\t\\t\\t} else {\\r\\n\\t\\t\\t\\tjustForked = true;\\r\\n\\t\\t\\t\\tawait wait(600);\\r\\n\\t\\t\\t\\tjustForked = false;\\r\\n\\t\\t\\t}\\r\\n\\t\\t} catch (err) {\\r\\n\\t\\t\\tif (navigator.onLine) {\\r\\n\\t\\t\\t\\talert(err.message);\\r\\n\\t\\t\\t} else {\\r\\n\\t\\t\\t\\talert(`It looks like you're offline! Find the internet and try again`);\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\tsaving = false;\\r\\n\\t}\\r\\n\\r\\n\\tasync function save() {\\r\\n\\t\\tif (saving) return;\\r\\n\\r\\n\\t\\tif (!canSave) {\\r\\n\\t\\t\\tfork(true);\\r\\n\\t\\t\\treturn;\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\tsaving = true;\\r\\n\\r\\n\\t\\ttry {\\r\\n\\t\\t\\t// Send all files back to API\\r\\n\\t\\t\\t// ~> Any missing files are considered deleted!\\r\\n\\t\\t\\tconst { components } = repl.toJSON();\\r\\n\\r\\n\\t\\t\\tconst r = await fetch(`repl/${gist.uid}.json`, {\\r\\n\\t\\t\\t\\tmethod: 'PATCH',\\r\\n\\t\\t\\t\\tcredentials: 'include',\\r\\n\\t\\t\\t\\tbody: JSON.stringify({\\r\\n\\t\\t\\t\\t\\tname,\\r\\n\\t\\t\\t\\t\\tfiles: components.map(component => ({\\r\\n\\t\\t\\t\\t\\t\\tname: `${component.name}.${component.type}`,\\r\\n\\t\\t\\t\\t\\t\\tsource: component.source\\r\\n\\t\\t\\t\\t\\t}))\\r\\n\\t\\t\\t\\t})\\r\\n\\t\\t\\t});\\r\\n\\r\\n\\t\\t\\tif (r.status < 200 || r.status >= 300) {\\r\\n\\t\\t\\t\\tconst { error } = await r.json();\\r\\n\\t\\t\\t\\tthrow new Error(`Received an HTTP ${r.status} response: ${error}`);\\r\\n\\t\\t\\t}\\r\\n\\r\\n\\t\\t\\tawait r.json();\\r\\n\\r\\n\\t\\t\\tjustSaved = true;\\r\\n\\t\\t\\tawait wait(600);\\r\\n\\t\\t\\tjustSaved = false;\\r\\n\\t\\t} catch (err) {\\r\\n\\t\\t\\tif (navigator.onLine) {\\r\\n\\t\\t\\t\\talert(err.message);\\r\\n\\t\\t\\t} else {\\r\\n\\t\\t\\t\\talert(`It looks like you're offline! Find the internet and try again`);\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\tsaving = false;\\r\\n\\t}\\r\\n\\r\\n\\tasync function download() {\\r\\n\\t\\tdownloading = true;\\r\\n\\r\\n\\t\\tconst { components, imports } = repl.toJSON();\\r\\n\\r\\n\\t\\tconst files = await (await fetch('/svelte-app.json')).json();\\r\\n\\r\\n\\t\\tif (imports.length > 0) {\\r\\n\\t\\t\\tconst idx = files.findIndex(({ path }) => path === 'package.json');\\r\\n\\t\\t\\tconst pkg = JSON.parse(files[idx].data);\\r\\n\\t\\t\\tconst { devDependencies } = pkg;\\r\\n\\t\\t\\timports.forEach(mod => {\\r\\n\\t\\t\\t\\tconst match = /^(@[^/]+\\\\/)?[^@/]+/.exec(mod);\\r\\n\\t\\t\\t\\tdevDependencies[match[0]] = 'latest';\\r\\n\\t\\t\\t});\\r\\n\\t\\t\\tpkg.devDependencies = devDependencies;\\r\\n\\t\\t\\tfiles[idx].data = JSON.stringify(pkg, null, '  ');\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\tfiles.push(...components.map(component => ({ path: `src/${component.name}.${component.type}`, data: component.source })));\\r\\n\\t\\tfiles.push({\\r\\n\\t\\t\\tpath: `src/main.js`, data: `import App from './App.svelte';\\r\\n\\r\\nvar app = new App({\\r\\n\\ttarget: document.body\\r\\n});\\r\\n\\r\\nexport default app;` });\\r\\n\\r\\n\\t\\tdownloadBlob(doNotZip.toBlob(files), 'svelte-app.zip');\\r\\n\\r\\n\\t\\tdownloading = false;\\r\\n\\t}\\r\\n</script>\\r\\n\\r\\n<svelte:window on:keydown={handleKeydown} />\\r\\n\\r\\n<div class=\\\"app-controls\\\">\\r\\n\\t<input\\r\\n\\t\\tbind:value={name}\\r\\n\\t\\ton:focus=\\\"{e => e.target.select()}\\\"\\r\\n\\t\\tuse:enter=\\\"{e => e.target.blur()}\\\"\\r\\n\\t>\\r\\n\\r\\n\\t<div style=\\\"text-align: right; margin-right:.4rem\\\">\\r\\n\\t\\t<button class=\\\"icon\\\" on:click=\\\"{() => zen_mode = !zen_mode}\\\" title=\\\"fullscreen editor\\\">\\r\\n\\t\\t\\t{#if zen_mode}\\r\\n\\t\\t\\t\\t<Icon name=\\\"close\\\" />\\r\\n\\t\\t\\t{:else}\\r\\n\\t\\t\\t\\t<Icon name=\\\"maximize\\\" />\\r\\n\\t\\t\\t{/if}\\r\\n\\t\\t</button>\\r\\n\\r\\n\\t\\t<button class=\\\"icon\\\" disabled={downloading} on:click={download} title=\\\"download zip file\\\">\\r\\n\\t\\t\\t<Icon name=\\\"download\\\" />\\r\\n\\t\\t</button>\\r\\n\\r\\n\\t\\t<button class=\\\"icon\\\" disabled=\\\"{saving || !$session.user}\\\" on:click={() => fork(false)} title=\\\"fork\\\">\\r\\n\\t\\t\\t{#if justForked}\\r\\n\\t\\t\\t\\t<Icon name=\\\"check\\\" />\\r\\n\\t\\t\\t{:else}\\r\\n\\t\\t\\t\\t<Icon name=\\\"git-branch\\\" />\\r\\n\\t\\t\\t{/if}\\r\\n\\t\\t</button>\\r\\n\\r\\n\\t\\t<button class=\\\"icon\\\" disabled=\\\"{saving || !$session.user}\\\" on:click={save} title=\\\"save\\\">\\r\\n\\t\\t\\t{#if justSaved}\\r\\n\\t\\t\\t\\t<Icon name=\\\"check\\\" />\\r\\n\\t\\t\\t{:else}\\r\\n\\t\\t\\t\\t<Icon name=\\\"save\\\" />\\r\\n\\t\\t\\t{/if}\\r\\n\\t\\t</button>\\r\\n\\r\\n\\t\\t{#if $session.user}\\r\\n\\t\\t\\t<UserMenu/>\\r\\n\\t\\t{:else}\\r\\n\\t\\t\\t<button class=\\\"icon\\\" on:click|preventDefault={login}>\\r\\n\\t\\t\\t\\t<Icon name=\\\"log-in\\\" />\\r\\n\\t\\t\\t\\t<span>&nbsp;Log in to save</span>\\r\\n\\t\\t\\t</button>\\r\\n\\t\\t{/if}\\r\\n\\t</div>\\r\\n</div>\\r\\n\\r\\n<style>\\r\\n\\t.app-controls {\\r\\n\\t\\tposition: absolute;\\r\\n\\t\\ttop: 0;\\r\\n\\t\\tleft: 0;\\r\\n\\t\\twidth: 100%;\\r\\n\\t\\theight: var(--app-controls-h);\\r\\n\\t\\tdisplay: flex;\\r\\n\\t\\talign-items: center;\\r\\n\\t\\tjustify-content: space-between;\\r\\n\\t\\tpadding: .6rem var(--side-nav);\\r\\n\\t\\tbackground-color: var(--second);\\r\\n\\t\\tcolor: white;\\r\\n\\t}\\r\\n\\r\\n\\t.icon {\\r\\n\\t\\tposition: relative;\\r\\n\\t\\ttop: -0.1rem;\\r\\n\\t\\tdisplay: inline-block;\\r\\n\\t\\tpadding: 0.2em;\\r\\n\\t\\topacity: .7;\\r\\n\\t\\ttransition: opacity .3s;\\r\\n\\t\\tfont-family: var(--font);\\r\\n\\t\\tfont-size: 1.6rem;\\r\\n\\t\\tcolor: white;\\r\\n\\t\\t/* width: 1.6em;\\r\\n\\t\\theight: 1.6em; */\\r\\n\\t\\tline-height: 1;\\r\\n\\t\\tmargin: 0 0 0 0.2em;\\r\\n\\t}\\r\\n\\r\\n\\t.icon:hover    { opacity: 1 }\\r\\n\\t.icon:disabled { opacity: .3 }\\r\\n\\r\\n\\t.icon[title^='fullscreen'] { display: none }\\r\\n\\r\\n\\tinput {\\r\\n\\t\\tbackground: transparent;\\r\\n\\t\\tborder: none;\\r\\n\\t\\tcolor: currentColor;\\r\\n\\t\\tfont-family: var(--font);\\r\\n\\t\\tfont-size: 1.6rem;\\r\\n\\t\\topacity: 0.7;\\r\\n\\t\\toutline: none;\\r\\n\\t\\tflex: 1;\\r\\n\\t}\\r\\n\\r\\n\\tinput:focus {\\r\\n\\t\\topacity: 1;\\r\\n\\t}\\r\\n\\r\\n\\tbutton span {\\r\\n\\t\\tdisplay: none;\\r\\n\\t}\\r\\n\\r\\n\\t@media (min-width: 600px) {\\r\\n\\t\\t.icon[title^='full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AAM,CACjB,OAAO,CAAE,GAAG,CACZ,OAAO,CAAE,IAAI,CACb,IAAI,CAAE,CAAC,AACR,CAAC,AAED,oBAAK,MAAM,AAAC,CAAC,AACZ,OAAO,CAAE,CAAC,AACX,CAAC,AAED,qBAAM,CAAC,IAAI,eAAC,CAAC,AACZ,OAAO,CAAE,IAAI,AACd,CAAC,AAED,MAAM,AAAC,YAAY,KAAK,CAAC,AAAC,CAAC,AAC1B,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,eAAC,CAAC,AAAC,OAAO,CAAE,MAAM,CAAC,CAAC,AAE9C,qBAAM,CAAC,IAAI,eAAC,CAAC,AACZ,OAAO,CAAE,YAAY,AACtB,CAAC,AACF,CAAC\"}"
  };
  
  const Index = index.create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
  	let $session;
  	const { session } = app$1.stores$1(); $session = index.get_store_value(session);
  	const { login } = index.getContext('app');
  
  	let { repl, gist, name, zen_mode, bundle } = $$props;
  
  	let saving = false;
  	let downloading = false;
  	let justSaved = false;
  	let justForked = false;
  
  	if ($$props.repl === void 0 && $$bindings.repl && repl !== void 0) $$bindings.repl(repl);
  	if ($$props.gist === void 0 && $$bindings.gist && gist !== void 0) $$bindings.gist(gist);
  	if ($$props.name === void 0 && $$bindings.name && name !== void 0) $$bindings.name(name);
  	if ($$props.zen_mode === void 0 && $$bindings.zen_mode && zen_mode !== void 0) $$bindings.zen_mode(zen_mode);
  	if ($$props.bundle === void 0 && $$bindings.bundle && bundle !== void 0) $$bindings.bundle(bundle);
  
  	$$result.css.add(css$1);
  
  	$session = index.get_store_value(session);
  
  	let canSave = $session.user && gist && gist.owner === $session.user.uid;
  
  	return `
  
  	<div class="app-controls svelte-1ez15pl">
  		<input class="svelte-1ez15pl"${index.add_attribute("value", name, 1)}>
  
  		<div style="text-align: right; margin-right:.4rem">
  			<button class="icon svelte-1ez15pl" title="fullscreen editor">
  				${ zen_mode ? `${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "close" }, {}, {})}` : `${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "maximize" }, {}, {})}` }
  			</button>
  
  			<button class="icon svelte-1ez15pl"${downloading ? " disabled" : "" } title="download zip file">
  				${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "download" }, {}, {})}
  			</button>
  
  			<button class="icon svelte-1ez15pl"${saving || !$session.user ? " disabled" : "" } title="fork">
  				${ justForked ? `${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "check" }, {}, {})}` : `${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "git-branch" }, {}, {})}` }
  			</button>
  
  			<button class="icon svelte-1ez15pl"${saving || !$session.user ? " disabled" : "" } title="save">
  				${ justSaved ? `${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "check" }, {}, {})}` : `${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "save" }, {}, {})}` }
  			</button>
  
  			${ $session.user ? `${index.validate_component(UserMenu, 'UserMenu').$$render($$result, {}, {}, {})}` : `<button class="icon svelte-1ez15pl">
  					${index.validate_component(index$1.Icon, 'Icon').$$render($$result, { name: "log-in" }, {}, {})}
  					<span class="svelte-1ez15pl"> Log in to save</span>
  				</button>` }
  		</div>
  	</div>`;
  });
  
  /* src\routes\repl\[id]\index.svelte generated by Svelte v3.12.0 */
  
  const css$2 = {
  	code: ".repl-outer.svelte-1jnlh7l{position:relative;height:calc(100vh - var(--nav-h));--app-controls-h:5.6rem;--pane-controls-h:4.2rem;overflow:hidden;background-color:var(--back);padding:var(--app-controls-h) 0 0 0;box-sizing:border-box}.viewport.svelte-1jnlh7l{width:100%;height:100%}.mobile.svelte-1jnlh7l .viewport.svelte-1jnlh7l{width:200%;height:calc(100% - 42px);transition:transform 0.3s}.mobile.svelte-1jnlh7l .offset.svelte-1jnlh7l{transform:translate(-50%, 0)}.viewport.svelte-1jnlh7l .tab-content,.viewport.svelte-1jnlh7l .tab-content.visible{pointer-events:all;opacity:1}.viewport.svelte-1jnlh7l .tab-content{visibility:hidden}.viewport.svelte-1jnlh7l .tab-content.visible{visibility:visible}.zen-mode.svelte-1jnlh7l{position:fixed;width:100%;height:100%;top:0;z-index:111}.pane.svelte-1jnlh7l{width:100%;height:100% }.loading.svelte-1jnlh7l{text-align:center;color:var(--second);font-weight:400;margin:2em 0 0 0;opacity:0;animation:svelte-1jnlh7l-fade-in .4s;animation-delay:.2s;animation-fill-mode:both}@keyframes svelte-1jnlh7l-fade-in{0%{opacity:0 }100%{opacity:1 }}.input.svelte-1jnlh7l{padding:2.4em 0 0 0}",
  	map: "{\"version\":3,\"file\":\"index.svelte\",\"sources\":[\"index.svelte\"],\"sourcesContent\":[\"<script context=\\\"module\\\">\\r\\n\\texport function preload({ params, query }) {\\r\\n\\t\\treturn {\\r\\n\\t\\t\\tversion: query.version || '3',\\r\\n\\t\\t\\tid: params.id\\r\\n\\t\\t};\\r\\n\\t}\\r\\n</script>\\r\\n\\r\\n<script>\\r\\n\\timport Repl from '@sveltejs/svelte-repl';\\r\\n\\timport { onMount } from 'svelte';\\r\\n\\timport { goto, stores } from '@sapper/app';\\r\\n\\timport InputOutputToggle from '../../../components/Repl/InputOutputToggle.svelte';\\r\\n\\timport AppControls from './_components/AppControls/index.svelte';\\r\\n\\r\\n\\texport let version;\\r\\n\\texport let id;\\r\\n\\r\\n\\tconst { session } = stores();\\r\\n\\r\\n\\tlet repl;\\r\\n\\tlet gist;\\r\\n\\tlet name = 'Loading...';\\r\\n\\tlet zen_mode = false;\\r\\n\\tlet is_relaxed_gist = false;\\r\\n\\tlet width = false ? window.innerWidth : 1000;\\r\\n\\tlet checked = false;\\r\\n\\r\\n\\tfunction update_query_string(version) {\\r\\n\\t\\tconst params = [];\\r\\n\\r\\n\\t\\tif (version !== 'latest') params.push(`version=${version}`);\\r\\n\\r\\n\\t\\tconst url = params.length > 0\\r\\n\\t\\t\\t? `repl/${id}?${params.join('&')}`\\r\\n\\t\\t\\t: `repl/${id}`;\\r\\n\\r\\n\\t\\thistory.replaceState({}, 'x', url);\\r\\n\\t}\\r\\n\\r\\n\\t$: if (typeof history !== 'undefined') update_query_string(version);\\r\\n\\r\\n\\tfunction fetch_gist(id) {\\r\\n\\t\\tif (gist && gist.uid === id) {\\r\\n\\t\\t\\t// if the id changed because we just forked, don't refetch\\r\\n\\t\\t\\treturn;\\r\\n\\t\\t}\\r\\n\\r\\n\\t\\t// TODO handle `relaxed` logic\\r\\n\\t\\tfetch(`repl/${id}.json`).then(r => {\\r\\n\\t\\t\\tif (r.ok) {\\r\\n\\t\\t\\t\\tr.json().then(data => {\\r\\n\\t\\t\\t\\t\\tgist = data;\\r\\n\\t\\t\\t\\t\\tname = data.name;\\r\\n\\r\\n\\t\\t\\t\\t\\tis_relaxed_gist = data.relaxed;\\r\\n\\r\\n\\t\\t\\t\\t\\tconst components = data.files.map(file => {\\r\\n\\t\\t\\t\\t\\t\\tlet [name, type] = file.name.split('.');\\r\\n\\t\\t\\t\\t\\t\\tif (type === 'html') type = 'svelte'; // TODO do this on the server\\r\\n\\t\\t\\t\\t\\t\\treturn { name, type, source: file.source };\\r\\n\\t\\t\\t\\t\\t});\\r\\n\\r\\n\\t\\t\\t\\t\\tcomponents.sort((a, b) => {\\r\\n\\t\\t\\t\\t\\t\\tif (a.name === 'App' && a.type === 'svelte') return -1;\\r\\n\\t\\t\\t\\t\\t\\tif (b.name === 'App' && b.type === 'svelte') return 1;\\r\\n\\r\\n\\t\\t\\t\\t\\t\\tif (a.type !== b.type) return a.type === 'svelte' ? -1 : 1;\\r\\n\\r\\n\\t\\t\\t\\t\\t\\treturn a.name < b.name ? -1 : 1;\\r\\n\\t\\t\\t\\t\\t});\\r\\n\\r\\n\\t\\t\\t\\t\\trepl.set({ components });\\r\\n\\t\\t\\t\\t});\\r\\n\\t\\t\\t} else {\\r\\n\\t\\t\\t\\tconsole.warn('TODO: 404 Gist');\\r\\n\\t\\t\\t}\\r\\n\\t\\t});\\r\\n\\t}\\r\\n\\r\\n\\t$: if (false) fetch_gist(id);\\r\\n\\r\\n\\tonMount(() => {\\r\\n\\t\\tif (version !== 'local') {\\r\\n\\t\\t\\tfetch(`https://unpkg.com/svelte@${version || '3'}/package.json`)\\r\\n\\t\\t\\t\\t.then(r => r.json())\\r\\n\\t\\t\\t\\t.then(pkg => {\\r\\n\\t\\t\\t\\t\\tversion = pkg.version;\\r\\n\\t\\t\\t\\t});\\r\\n\\t\\t}\\r\\n\\t});\\r\\n\\r\\n\\tfunction handle_fork(event) {\\r\\n\\t\\tconsole.log('> handle_fork', event);\\r\\n\\t\\tgist = event.detail.gist;\\r\\n\\t\\tgoto(`/repl/${gist.uid}?version=${version}`);\\r\\n\\t}\\r\\n\\r\\n\\t$: svelteUrl = false && version === 'local' ?\\r\\n\\t\\t`${location.origin}/repl/local` :\\r\\n\\t\\t`https://unpkg.com/svelte@${version}`;\\r\\n\\r\\n\\tconst rollupUrl = `https://unpkg.com/rollup@1/dist/rollup.browser.js`;\\r\\n\\r\\n\\t// needed for context API example\\r\\n\\tconst mapbox_setup = `window.MAPBOX_ACCESS_TOKEN = process.env.MAPBOX_ACCESS_TOKEN;`;\\r\\n\\r\\n\\t$: mobile = width < 540;\\r\\n\\r\\n\\t$: relaxed = is_relaxed_gist || ($session.user && gist && $session.user.uid === gist.owner);\\r\\n</script>\\r\\n\\r\\n<style>\\r\\n\\t.repl-outer {\\r\\n\\t\\tposition: relative;\\r\\n\\t\\theight: calc(100vh - var(--nav-h));\\r\\n\\t\\t--app-controls-h: 5.6rem;\\r\\n\\t\\t--pane-controls-h: 4.2rem;\\r\\n\\t\\toverflow: hidden;\\r\\n\\t\\tbackground-color: var(--back);\\r\\n\\t\\tpadding: var(--app-controls-h) 0 0 0;\\r\\n\\t\\t/* margin: 0 calc(var(--side-nav) * -1); */\\r\\n\\t\\tbox-sizing: border-box;\\r\\n\\t}\\r\\n\\r\\n\\t.viewport {\\r\\n\\t\\twidth: 100%;\\r\\n\\t\\theight: 100%;\\r\\n\\t}\\r\\n\\r\\n\\t.mobile .viewport {\\r\\n\\t\\twidth: 200%;\\r\\n\\t\\theight: calc(100% - 42px);\\r\\n\\t\\ttransition: transform 0.3s;\\r\\n\\t}\\r\\n\\r\\n\\t.mobile .offset {\\r\\n\\t\\ttransform: translate(-50%, 0);\\r\\n\\t}\\r\\n\\r\\n\\t/* temp fix for #2499 and #2550 while waiting for a fix for https://github.com/sveltejs/svelte-repl/issues/8 */\\r\\n\\r\\n\\t.viewport :global(.tab-content),\\r\\n\\t.viewport :global(.tab-content.visible) {\\r\\n\\t\\tpointer-events: all;\\r\\n\\t\\topacity: 1;\\r\\n\\t}\\r\\n\\t.viewport :global(.tab-content) {\\r\\n\\t\\tvisibility: hidden;\\r\\n\\t}\\r\\n\\t.viewport :global(.tab-content.visible) {\\r\\n\\t\\tvisibility: visible;\\r\\n\\t}\\r\\n\\r\\n\\t.zen-mode {\\r\\n\\t\\tposition: fixed;\\r\\n\\t\\twidth: 100%;\\r\\n\\t\\theight: 100%;\\r\\n\\t\\ttop: 0;\\r\\n\\t\\tz-index: 111;\\r\\n\\t}\\r\\n\\r\\n\\t.pane { width: 100%; height: 100% }\\r\\n\\r\\n\\t.loading {\\r\\n\\t\\ttext-align: center;\\r\\n\\t\\tcolor: var(--second);\\r\\n\\t\\tfont-weight: 400;\\r\\n\\t\\tmargin: 2em 0 0 0;\\r\\n\\t\\topacity: 0;\\r\\n\\t\\tanimation: fade-in .4s;\\r\\n\\t\\tanimation-delay: .2s;\\r\\n\\t\\tanimation-fill-mode: both;\\r\\n\\t}\\r\\n\\r\\n\\t@keyframes fade-in {\\r\\n\\t\\t0%   { opacity: 0 }\\r\\n\\t\\t100% { opacity: 1 }\\r\\n\\t}\\r\\n\\r\\n\\t.input {\\r\\n\\t\\tpadding: 2.4em 0 0 0;\\r\\n\\t}\\r\\n</style>\\r\\n\\r\\n<svelte:head>\\r\\n\\t<title>{name} • REPL • Svelte</title>\\r\\n\\r\\n\\t<meta name=\\\"twitter:title\\\" content=\\\"Svelte REPL\\\">\\r\\n\\t<meta name=\\\"twitter:description\\\" content=\\\"Cybernetically enhanced web apps\\\">\\r\\n\\t<meta name=\\\"Description\\\" content=\\\"Interactive Svelte playground\\\">\\r\\n</svelte:head>\\r\\n\\r\\n<svelte:window bind:innerWidth={width}/>\\r\\n\\r\\n<div class=\\\"repl-outer {zen_mode ? 'zen-mode' : ''}\\\" class:mobile>\\r\\n\\t<AppControls\\r\\n\\t\\t{gist}\\r\\n\\t\\t{repl}\\r\\n\\t\\tbind:name\\r\\n\\t\\tbind:zen_mode\\r\\n\\t\\ton:forked={handle_fork}\\r\\n\\t/>\\r\\n\\r\\n\\t{#if false}\\r\\n\\t\\t<div class=\\\"viewport\\\" class:offset={checked}>\\r\\n\\t\\t\\t<Repl\\r\\n\\t\\t\\t\\tbind:this={repl}\\r\\n\\t\\t\\t\\tworkersUrl=\\\"workers\\\"\\r\\n\\t\\t\\t\\t{svelteUrl}\\r\\n\\t\\t\\t\\t{rollupUrl}\\r\\n\\t\\t\\t\\t{relaxed}\\r\\n\\t\\t\\t\\tfixed={mobile}\\r\\n\\t\\t\\t\\tinjectedJS={mapbox_setup}\\r\\n\\t\\t\\t/>\\r\\n\\t\\t</div>\\r\\n\\r\\n\\t\\t{#if mobile}\\r\\n\\t\\t\\t<InputOutputToggle bind:checked/>\\r\\n\\t\\t{/if}\\r\\n\\t{/if}\\r\\n</div>\\r\\n\"],\"names\":[],\"mappings\":\"AAkHC,WAAW,eAAC,CAAC,AACZ,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAClC,gBAAgB,CAAE,MAAM,CACxB,iBAAiB,CAAE,MAAM,CACzB,QAAQ,CAAE,MAAM,CAChB,gBAAgB,CAAE,IAAI,MAAM,CAAC,CAC7B,OAAO,CAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAEpC,UAAU,CAAE,UAAU,AACv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AAG,CAAC,AAAC,OAAO,CAAE,CAAC,CAAC,CAAC,AACnB,IAAI,AAAC,CAAC,AAAC,OAAO,CAAE,CAAC,CAAC,CAAC,AACpB,CAAC,AAED,MAAM,eAAC,CAAC,AACP,OAAO,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,AACrB,CAAC\"}"
  };
  
  function preload({ params, query }) {
  	return {
  		version: query.version || '3',
  		id: params.id
  	};
  }
  
  const Index$1 = index.create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
  	let $session;
  
  	
  
  	let { version, id } = $$props;
  
  	const { session } = app$1.stores$1(); $session = index.get_store_value(session);
  
  	let repl;
  	let gist;
  	let name = 'Loading...';
  	let zen_mode = false;
  	let is_relaxed_gist = false;
  
  	function update_query_string(version) {
  		const params = [];
  
  		if (version !== 'latest') params.push(`version=${version}`);
  
  		const url = params.length > 0
  			? `repl/${id}?${params.join('&')}`
  			: `repl/${id}`;
  
  		history.replaceState({}, 'x', url);
  	}
  
  	index.onMount(() => {
  		if (version !== 'local') {
  			fetch(`https://unpkg.com/svelte@${version || '3'}/package.json`)
  				.then(r => r.json())
  				.then(pkg => {
  					version = pkg.version;
  				});
  		}
  	});
  
  	if ($$props.version === void 0 && $$bindings.version && version !== void 0) $$bindings.version(version);
  	if ($$props.id === void 0 && $$bindings.id && id !== void 0) $$bindings.id(id);
  
  	$$result.css.add(css$2);
  
  	let $$settled;
  	let $$rendered;
  
  	do {
  		$$settled = true;
  
  		$session = index.get_store_value(session);
  
  		if (typeof history !== 'undefined') update_query_string(version);
  		let relaxed = is_relaxed_gist || ($session.user && gist && $session.user.uid === gist.owner);
  
  		$$rendered = `${($$result.head += `<title>${index.escape(name)} • REPL • Svelte</title><meta name="twitter:title" content="Svelte REPL"><meta name="twitter:description" content="Cybernetically enhanced web apps"><meta name="Description" content="Interactive Svelte playground">`, "")}
  
  
  
  		<div class="${[`repl-outer ${index.escape(zen_mode ? 'zen-mode' : '')} svelte-1jnlh7l`,  ""].join(' ').trim() }">
  			${index.validate_component(Index, 'AppControls').$$render($$result, {
  			gist: gist,
  			repl: repl,
  			name: name,
  			zen_mode: zen_mode
  		}, {
  			name: $$value => { name = $$value; $$settled = false; },
  			zen_mode: $$value => { zen_mode = $$value; $$settled = false; }
  		}, {})}
  
  			${  `` }
  		</div>`;
  	} while (!$$settled);
  
  	return $$rendered;
  });
  
  exports.default = Index$1;
  exports.preload = preload;
  