"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12141],{77292:(e,t,n)=>{n.r(t),n.d(t,{ANGULAR_TEMPLATE:()=>eV,ASTRO_TEMPLATE:()=>eF,BackwardIcon:()=>q,CleanIcon:()=>K,CloseIcon:()=>er,CodeEditor:()=>tP,ConsoleIcon:()=>eo,DependenciesProgress:()=>nc,DirectoryIconClosed:()=>et,DirectoryIconOpen:()=>ee,ErrorOverlay:()=>t0,ExportIcon:()=>Q,FADE_ANIMATION_DURATION:()=>tU,FileIcon:()=>en,FileTabs:()=>tg,ForwardIcon:()=>G,LoadingOverlay:()=>ni,Navigator:()=>ny,OpenInCodeSandboxButton:()=>t8,REACT_TEMPLATE:()=>eW,REACT_TYPESCRIPT_TEMPLATE:()=>eZ,RefreshIcon:()=>X,RestartIcon:()=>Z,RoundedButton:()=>tx,RunButton:()=>ty,RunIcon:()=>Y,SANDBOX_TEMPLATES:()=>e1,SANDPACK_THEMES:()=>ea,SOLID_TEMPLATE:()=>eY,SVELTE_TEMPLATE:()=>eq,Sandpack:()=>rT,SandpackCodeEditor:()=>tH,SandpackCodeViewer:()=>tB,SandpackConsole:()=>rF,SandpackConsumer:()=>tt,SandpackFileExplorer:()=>nh,SandpackLayout:()=>tJ,SandpackPreview:()=>nC,SandpackProvider:()=>te,SandpackReactContext:()=>e9,SandpackStack:()=>tw,SandpackTests:()=>rp,SandpackThemeConsumer:()=>eL,SandpackThemeContext:()=>eO,SandpackThemeProvider:()=>eM,SandpackTranspiledCode:()=>nS,SignInIcon:()=>V,SignOutIcon:()=>W,TEST_TYPESCRIPT_TEMPLATE:()=>eG,UnstyledOpenInCodeSandboxButton:()=>t7,VANILLA_TEMPLATE:()=>eX,VANILLA_TYPESCRIPT_TEMPLATE:()=>eK,VUE_TEMPLATE:()=>eQ,defaultDark:()=>es,defaultLight:()=>ei,getSandpackCssText:()=>eg,layoutClassName:()=>tz,stackClassName:()=>tj,tabButton:()=>th,useActiveCode:()=>tr,useClassNames:()=>eS,useErrorMessage:()=>t_,useLoadingOverlayState:()=>tV,useSandpack:()=>tn,useSandpackClient:()=>tY,useSandpackConsole:()=>rA,useSandpackNavigation:()=>tW,useSandpackPreviewProgress:()=>tX,useSandpackShell:()=>tq,useSandpackShellStdout:()=>tK,useSandpackTheme:()=>t$,useTranspiledCode:()=>tZ});var r,o,i,s,a,c,l,d,u,p,f,m,v,h,g,x,b=n(67841),y=n(79477),j=n(47042),w=n(72642),$=n(42420),C=n(40650),k=n(98663),S=n(97127),N=n(52054),E=n(89501),O=n(87359),M=n(97244),L=n(50955),A=n(66534),F=n(93608),T=n(48603),R=n(73062),I=n(89839),D=n(46443),P=n(11585),H=function(){return(H=Object.assign||function(e){for(var t,n=1,r=arguments.length;nt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function z(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function J(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Hello {data}\n\n'},".env":{code:'ASTRO_TELEMETRY_DISABLED="1"'},"/package.json":{code:JSON.stringify({dependencies:{astro:"^1.6.12","esbuild-wasm":"^0.15.16"},scripts:{dev:"astro dev",start:"astro dev",build:"astro build",preview:"astro preview",astro:"astro"}})}},main:"/src/pages/index.astro",environment:"node"},eT={files:H(H({},eA),{"/pages/_app.js":{code:"import '../styles.css'\n\nexport default function MyApp({ Component, pageProps }) {\n return \n}"},"/pages/index.js":{code:'export default function Home({ data }) {\n return (\n
\n

Hello {data}

\n
\n );\n}\n \nexport function getServerSideProps() {\n return {\n props: { data: "world" },\n }\n}\n'},"/next.config.js":{code:"/** @type {import('next').NextConfig} */\nconst nextConfig = {\n reactStrictMode: true,\n swcMinify: true,\n}\n\nmodule.exports = nextConfig\n"},"/package.json":{code:JSON.stringify({name:"my-app",version:"0.1.0",private:!0,scripts:{dev:"NEXT_TELEMETRY_DISABLED=1 next dev",build:"next build",start:"next start",lint:"next lint"},dependencies:{next:"12.1.6",react:"18.2.0","react-dom":"18.2.0","@next/swc-wasm-nodejs":"12.1.6"}})}}),main:"/pages/index.js",environment:"node"},eR={files:{"/index.js":{code:"const http = require('http');\n\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\nconst server = http.createServer((req, res) => {\n res.statusCode = 200;\n res.setHeader('Content-Type', 'text/html');\n res.end('Hello world');\n});\n\nserver.listen(port, hostname, () => {\n console.log(`Server running at http://${hostname}:${port}/`);\n});"},"/package.json":{code:JSON.stringify({dependencies:{},scripts:{start:"node index.js"},main:"index.js"})}},main:"/index.js",environment:"node"},eI={files:H(H({},eA),{"/index.js":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n

Hello world

\n`;\n'},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},devDependencies:{vite:"4.1.4","esbuild-wasm":"0.17.12"}})}}),main:"/index.js",environment:"node"},eD={files:H(H({},eA),{"/App.jsx":{code:'export default function App() {\n const data = "world"\n\n return

Hello {data}

\n}\n'},"/index.jsx":{code:'import { render } from "preact";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = document.getElementById("root");\nrender(, root);\n'},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},dependencies:{preact:"^10.16.0"},devDependencies:{"@preact/preset-vite":"^2.5.0",vite:"4.1.4","esbuild-wasm":"0.17.12"}})},"/vite.config.js":{code:"import { defineConfig } from \"vite\";\nimport preact from '@preact/preset-vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [preact()],\n});\n"}}),main:"/App.jsx",environment:"node"},eP={files:H(H({},eA),{"/App.tsx":{code:'export default function App() {\n const data: string = "world"\n\n return

Hello {data}

\n}\n'},"/index.tsx":{code:'import { render } from "preact";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = document.getElementById("root") as HTMLElement;\nrender(, root);\n'},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"ESNext",useDefineForClassFields:!0,lib:["DOM","DOM.Iterable","ESNext"],allowJs:!1,skipLibCheck:!0,esModuleInterop:!1,allowSyntheticDefaultImports:!0,strict:!0,forceConsistentCasingInFileNames:!0,module:"ESNext",moduleResolution:"Node",resolveJsonModule:!0,isolatedModules:!0,noEmit:!0,jsx:"react-jsx",jsxImportSource:"preact"},include:["src"],references:[{path:"./tsconfig.node.json"}]},null,2)},"/tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node",allowSyntheticDefaultImports:!0},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{preact:"^10.16.0"},devDependencies:{"@preact/preset-vite":"^2.5.0",typescript:"^4.9.5",vite:"4.1.4","esbuild-wasm":"^0.17.12"}},null,2)},"/vite-env.d.ts":{code:'/// '},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport preact from '@preact/preset-vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [preact()],\n})\n"}}),main:"/App.tsx",environment:"node"},eH={files:H(H({},eA),{"/App.jsx":{code:'export default function App() {\n const data = "world"\n\n return

Hello {data}

\n}\n'},"/index.jsx":{code:'import { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = createRoot(document.getElementById("root"));\nroot.render(\n \n \n \n);'},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},dependencies:{react:"^18.2.0","react-dom":"^18.2.0"},devDependencies:{"@vitejs/plugin-react":"3.1.0",vite:"4.1.4","esbuild-wasm":"0.17.12"}})},"/vite.config.js":{code:'import { defineConfig } from "vite";\nimport react from "@vitejs/plugin-react";\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react()],\n});\n'}}),main:"/App.jsx",environment:"node"},eB={files:H(H({},eA),{"/App.tsx":{code:'export default function App() {\n const data: string = "world"\n\n return

Hello {data}

\n}\n'},"/index.tsx":{code:'import { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\nimport React from "react";\n\nconst root = createRoot(document.getElementById("root") as HTMLElement);\nroot.render(\n \n \n \n);\n'},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"ESNext",useDefineForClassFields:!0,lib:["DOM","DOM.Iterable","ESNext"],allowJs:!1,skipLibCheck:!0,esModuleInterop:!1,allowSyntheticDefaultImports:!0,strict:!0,forceConsistentCasingInFileNames:!0,module:"ESNext",moduleResolution:"Node",resolveJsonModule:!0,isolatedModules:!0,noEmit:!0,jsx:"react-jsx"},include:["src"],references:[{path:"./tsconfig.node.json"}]},null,2)},"/tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node",allowSyntheticDefaultImports:!0},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{react:"^18.2.0","react-dom":"^18.2.0"},devDependencies:{"@types/react":"^18.0.28","@types/react-dom":"^18.0.11","@vitejs/plugin-react":"^3.1.0",typescript:"^4.9.5",vite:"4.1.4","esbuild-wasm":"^0.17.12"}},null,2)},"/vite-env.d.ts":{code:'/// '},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [react()],\n})\n"}}),main:"/App.tsx",environment:"node"},ez={files:{"/src/styles.css":eA["/styles.css"],"/src/App.svelte":{code:'\n\n

Hello {data}

\n\n'},"/src/main.js":{code:"import App from './App.svelte'\nimport \"./styles.css\"\n\nconst app = new App({\n target: document.getElementById('app'),\n})\n\nexport default app"},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/vite.config.js":{code:"import { defineConfig } from 'vite'\nimport { svelte } from '@sveltejs/vite-plugin-svelte'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [svelte()],\n})"},"/package.json":{code:JSON.stringify({type:"module",scripts:{dev:"vite"},devDependencies:{"@sveltejs/vite-plugin-svelte":"^2.0.2",svelte:"^3.55.1",vite:"4.0.4","esbuild-wasm":"^0.17.12"}})}},main:"/src/App.svelte",environment:"node"},eJ={files:{"/src/styles.css":eA["/styles.css"],"/src/App.svelte":{code:'\n\n

Hello {data}

\n\n'},"/src/main.ts":{code:"import App from './App.svelte'\nimport \"./styles.css\"\n\nconst app = new App({\n target: document.getElementById('app'),\n})\n\nexport default app"},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/vite-env.d.ts":{code:'/// \n/// '},"svelte.config.js":{code:"import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'\n\nexport default {\n // Consult https://svelte.dev/docs#compile-time-svelte-preprocess\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n}\n"},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport { svelte } from '@sveltejs/vite-plugin-svelte'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [svelte()],\n})"},"tsconfig.json":{code:JSON.stringify({extends:"@tsconfig/svelte/tsconfig.json",compilerOptions:{target:"ESNext",useDefineForClassFields:!0,module:"ESNext",resolveJsonModule:!0,allowJs:!0,checkJs:!0,isolatedModules:!0},include:["src/**/*.d.ts","src/**/*.ts","src/**/*.js","src/**/*.svelte"],references:[{path:"./tsconfig.node.json"}]},null,2)},"tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node"},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({type:"module",scripts:{dev:"vite"},devDependencies:{"@sveltejs/vite-plugin-svelte":"^2.0.2","@tsconfig/svelte":"^3.0.0",svelte:"^3.55.1","svelte-check":"^2.10.3",tslib:"^2.5.0",vite:"4.1.4","esbuild-wasm":"^0.17.12"}},null,2)}},main:"/src/App.svelte",environment:"node"},e_={files:{"/src/styles.css":eA["/styles.css"],"/src/App.vue":{code:'\n\n\n\n'},"/src/main.js":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\"\n \ncreateApp(App).mount('#app') \n"},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/vite.config.js":{code:"import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [vue()]\n})\n"},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"vite build",preview:"vite preview"},dependencies:{vue:"^3.2.45"},devDependencies:{"@vitejs/plugin-vue":"3.2.0",vite:"4.1.4","esbuild-wasm":"0.17.12"}})}},main:"/src/App.vue",environment:"node"},eU={files:{"/src/styles.css":eA["/styles.css"],"/src/App.vue":{code:'\n\n\n\n'},"/src/main.ts":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\"\n\ncreateApp(App).mount('#app')\n"},"/index.html":{code:'\n\n \n \n \n Vite App\n \n \n
\n \n \n\n'},"/vite-env.d.ts":{code:'/// '},"/vite.config.ts":{code:"import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n plugins: [vue()]\n})\n"},"tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"ESNext",useDefineForClassFields:!0,module:"ESNext",moduleResolution:"Node",strict:!0,jsx:"preserve",resolveJsonModule:!0,isolatedModules:!0,esModuleInterop:!0,lib:["ESNext","DOM"],skipLibCheck:!0,noEmit:!0},include:["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"],references:[{path:"./tsconfig.node.json"}]},null,2)},"tsconfig.node.json":{code:JSON.stringify({compilerOptions:{composite:!0,module:"ESNext",moduleResolution:"Node",allowSyntheticDefaultImports:!0},include:["vite.config.ts"]},null,2)},"/package.json":{code:JSON.stringify({scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{vue:"^3.2.47"},devDependencies:{"@vitejs/plugin-vue":"^4.0.0",vite:"4.1.4","vue-tsc":"^1.2.0",typescript:"^4.9.5","esbuild-wasm":"^0.17.12"}},null,2)}},main:"/src/App.vue",environment:"node"},eV={files:{"/src/app/app.component.css":eA["/styles.css"],"/src/app/app.component.html":{code:"
\n

{{ helloWorld }}

\n
\n"},"/src/app/app.component.ts":{code:'import { Component } from "@angular/core";\n\n@Component({\n selector: "app-root",\n templateUrl: "./app.component.html",\n styleUrls: ["./app.component.css"]\n})\nexport class AppComponent {\n helloWorld = "Hello world";\n} \n'},"/src/app/app.module.ts":{code:'import { BrowserModule } from "@angular/platform-browser";\nimport { NgModule } from "@angular/core";\n \nimport { AppComponent } from "./app.component";\n \n@NgModule({\n declarations: [AppComponent],\n imports: [BrowserModule],\n providers: [],\n bootstrap: [AppComponent]\n})\nexport class AppModule {} \n'},"/src/index.html":{code:'\n\n \n\n \n Angular\n \n \n \n \n\n \n\n \n\n \n\n'},"/src/main.ts":{code:'import { enableProdMode } from "@angular/core";\nimport { platformBrowserDynamic } from "@angular/platform-browser-dynamic";\n \nimport { AppModule } from "./app/app.module"; \n\nplatformBrowserDynamic()\n .bootstrapModule(AppModule)\n .catch(err => console.log(err));\n \n'},"/src/polyfills.ts":{code:'import "core-js/proposals/reflect-metadata"; \n import "zone.js/dist/zone";\n'},"/package.json":{code:JSON.stringify({dependencies:{"@angular/core":"^11.2.0","@angular/platform-browser":"^11.2.0","@angular/platform-browser-dynamic":"^11.2.0","@angular/common":"^11.2.0","@angular/compiler":"^11.2.0","zone.js":"0.11.3","core-js":"3.8.3",rxjs:"6.6.3"},main:"/src/main.ts"})}},main:"/src/app/app.component.ts",environment:"angular-cli"},eW={files:H(H({},eA),{"/App.js":{code:"export default function App() {\n return

Hello world

\n}\n"},"/index.js":{code:'import React, { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = createRoot(document.getElementById("root"));\nroot.render(\n \n \n \n);'},"/public/index.html":{code:'\n\n \n \n \n Document\n \n \n
\n \n'},"/package.json":{code:JSON.stringify({dependencies:{react:"^18.0.0","react-dom":"^18.0.0","react-scripts":"^5.0.0"},main:"/index.js"})}}),main:"/App.js",environment:"create-react-app"},eZ={files:H(H({},eA),{"tsconfig.json":{code:'{\n "include": [\n "./**/*"\n ],\n "compilerOptions": {\n "strict": true,\n "esModuleInterop": true,\n "lib": [ "dom", "es2015" ],\n "jsx": "react-jsx"\n }\n}'},"/App.tsx":{code:"export default function App(): JSX.Element {\n return

Hello world

\n}\n"},"/index.tsx":{code:'import React, { StrictMode } from "react";\nimport { createRoot } from "react-dom/client";\nimport "./styles.css";\n\nimport App from "./App";\n\nconst root = createRoot(document.getElementById("root"));\nroot.render(\n \n \n \n);'},"/public/index.html":{code:'\n\n \n \n \n Document\n \n \n
\n \n'},"/package.json":{code:JSON.stringify({dependencies:{react:"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},devDependencies:{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0",typescript:"^4.0.0"},main:"/index.tsx"})}}),main:"/App.tsx",environment:"create-react-app"},eY={files:H(H({},eA),{"/App.tsx":{code:'import { Component } from "solid-js";\n\nconst App: Component = () => {\n return

Hello world

\n};\n\nexport default App;'},"/index.tsx":{code:'import { render } from "solid-js/web";\nimport App from "./App";\n\nimport "./styles.css";\n\nrender(() => , document.getElementById("app"));'},"/index.html":{code:'\n\n Parcel Sandbox\n \n\n\n
\n \n\n'},"/package.json":{code:JSON.stringify({dependencies:{"solid-js":"1.3.15"},main:"/index.tsx"})}}),main:"/App.tsx",environment:"solid"},eq={files:H(H({},eA),{"/App.svelte":{code:"\n\n\n\n
\n

Hello {name}

\n
"},"/index.js":{code:'import App from "./App.svelte";\nimport "./styles.css";\n\nconst app = new App({\n target: document.body\n});\n\nexport default app;\n '},"/public/index.html":{code:'\n\n \n \n \n\n Svelte app\n\n \n \n\n \n \n \n'},"/package.json":{code:JSON.stringify({dependencies:{svelte:"^3.0.0"},main:"/index.js"})}}),main:"/App.svelte",environment:"svelte"},eG={files:{"tsconfig.json":{code:'{\n "include": [\n "./**/*"\n ],\n "compilerOptions": {\n "strict": true,\n "esModuleInterop": true,\n "lib": [ "dom", "es2015" ],\n "jsx": "react-jsx"\n }\n}'},"/add.ts":{code:"export const add = (a: number, b: number): number => a + b;"},"/add.test.ts":{code:"import { add } from './add';\n\ndescribe('add', () => {\n test('Commutative Law of Addition', () => {\n expect(add(1, 2)).toBe(add(2, 1));\n });\n});"},"package.json":{code:JSON.stringify({dependencies:{},devDependencies:{typescript:"^4.0.0"},main:"/add.ts"})}},main:"/add.test.ts",environment:"parcel",mode:"tests"},eX={files:H(H({},eA),{"/index.js":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n

Hello world

\n`;\n'},"/index.html":{code:'\n\n\n\n Parcel Sandbox\n \n\n\n\n
\n\n \n\n\n'},"/package.json":{code:JSON.stringify({dependencies:{},main:"/index.js"})}}),main:"/index.js",environment:"parcel"},eK={files:H(H({},eA),{"tsconfig.json":{code:'{\n "compilerOptions": {\n "strict": true,\n "module": "commonjs",\n "jsx": "preserve",\n "esModuleInterop": true,\n "sourceMap": true,\n "allowJs": true,\n "lib": [\n "es6",\n "dom"\n ],\n "rootDir": "src",\n "moduleResolution": "node"\n }\n}'},"/index.ts":{code:'import "./styles.css";\n\ndocument.getElementById("app").innerHTML = `\n

Hello world

\n`;\n'},"/index.html":{code:'\n\n\n\n Parcel Sandbox\n \n\n\n\n
\n\n \n\n\n'},"/package.json":{code:JSON.stringify({dependencies:{},devDependencies:{typescript:"^4.0.0"},main:"/index.ts"})}}),main:"/index.ts",environment:"parcel"},eQ={files:{"/src/styles.css":eA["/styles.css"],"/src/App.vue":{code:"\n\n"},"/src/main.js":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\";\n\ncreateApp(App).mount('#app')\n"},"/public/index.html":{code:'\n\n \n \n \n \n codesandbox\n \n \n \n
\n \n \n\n'},"/package.json":{code:JSON.stringify({name:"vue3",version:"0.1.0",private:!0,main:"/src/main.js",scripts:{serve:"vue-cli-service serve",build:"vue-cli-service build"},dependencies:{"core-js":"^3.26.1",vue:"^3.2.45"},devDependencies:{"@vue/cli-plugin-babel":"^5.0.8","@vue/cli-service":"^5.0.8"}})}},main:"/src/App.vue",environment:"vue-cli"},e0={files:{"/src/styles.css":eA["/styles.css"],"/src/App.vue":{code:"\n\n"},"/src/main.ts":{code:"import { createApp } from 'vue'\nimport App from './App.vue'\nimport \"./styles.css\";\n\ncreateApp(App).mount('#app')\n"},"/src/shims-vue.d.ts":'/* eslint-disable */\ndeclare module "*.vue" {\n import type { DefineComponent } from "vue";\n const component: DefineComponent<{}, {}, any>;\n export default component;\n}',"/public/index.html":{code:'\n\n \n \n \n \n codesandbox\n \n \n \n
\n \n \n\n'},"/package.json":{code:JSON.stringify({name:"vue3-ts",version:"0.1.0",private:!0,main:"/src/main.ts",scripts:{serve:"vue-cli-service serve",build:"vue-cli-service build"},dependencies:{"core-js":"^3.26.1",vue:"^3.2.45"},devDependencies:{"@vue/cli-plugin-babel":"^5.0.8","@vue/cli-plugin-typescript":"^5.0.8","@vue/cli-service":"^5.0.8",typescript:"^4.9.3"}})},"/tsconfig.json":{code:JSON.stringify({compilerOptions:{target:"esnext",module:"esnext",strict:!0,jsx:"preserve",moduleResolution:"node",experimentalDecorators:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0,useDefineForClassFields:!0,sourceMap:!1,baseUrl:".",types:["webpack-env"],paths:{"@/*":["src/*"]},lib:["esnext","dom","dom.iterable","scripthost"]},include:["src/**/*.ts","src/**/*.tsx","src/**/*.vue","tests/**/*.ts","tests/**/*.tsx"],exclude:["node_modules"]})}},main:"/src/App.vue",environment:"vue-cli"},e1={static:{files:H(H({},eA),{"/index.html":{code:'\n\n\n\n Parcel Sandbox\n \n \n\n\n\n

Hello world

\n\n\n'},"/package.json":{code:JSON.stringify({dependencies:{},main:"/index.html"})}}),main:"/index.html",environment:"static"},angular:eV,react:eW,"react-ts":eZ,solid:eY,svelte:eq,"test-ts":eG,"vanilla-ts":eK,vanilla:eX,vue:eQ,"vue-ts":e0,node:eR,nextjs:eT,vite:eI,"vite-react":eH,"vite-react-ts":eB,"vite-preact":eD,"vite-preact-ts":eP,"vite-vue":e_,"vite-vue-ts":eU,"vite-svelte":ez,"vite-svelte-ts":eJ,astro:eF},e3=function(e){var t,n,r,o,i,s,a=(0,$.f)(e.files),c=e6({template:e.template,customSetup:e.customSetup,files:a}),l=(0,$.f)(null!==(n=null===(t=e.options)||void 0===t?void 0:t.visibleFiles)&&void 0!==n?n:[]),d=(null===(r=e.options)||void 0===r?void 0:r.activeFile)?e2(null===(o=e.options)||void 0===o?void 0:o.activeFile,c.files):void 0;0===l.length&&a&&Object.keys(a).forEach(function(e){var t=a[e];if("string"==typeof t){l.push(e);return}!d&&t.active&&(d=e,!0===t.hidden&&l.push(e)),t.hidden||l.push(e)}),0===l.length&&(l=[c.main]),c.entry&&!c.files[c.entry]&&(c.entry=e2(c.entry,c.files)),!d&&c.main&&(d=c.main),d&&c.files[d]||(d=l[0]),l.includes(d)||l.push(d);var u=(0,$.d)(c.files,null!==(i=c.dependencies)&&void 0!==i?i:{},null!==(s=c.devDependencies)&&void 0!==s?s:{},c.entry);return{visibleFiles:l.filter(function(e){return u[e]}),activeFile:d,files:u,environment:c.environment,shouldUpdatePreview:!0}},e2=function(e,t){var n=(0,$.f)(t),r=(0,$.f)(e);if(r in n)return r;if(!e)return null;for(var o=null,i=0,s=[".js",".jsx",".ts",".tsx"];!o&&i0?"running":"idle";p(function(e){return H(H({},e),{status:o})})},F=function(e){"start"===e.type?p(function(e){return H(H({},e),{error:null})}):"state"===e.type?p(function(t){return H(H({},t),{bundlerState:e.state})}):("done"!==e.type||e.compilatonError)&&"connected"!==e.type?"action"===e.type&&"show-error"===e.action?(x.current&&clearTimeout(x.current),p(function(t){return H(H({},t),{error:(0,$.e)(e)})})):"action"===e.type&&"notification"===e.action&&"error"===e.notificationType&&p(function(t){return H(H({},t),{error:{message:e.title}})}):(x.current&&clearTimeout(x.current),p(function(e){return H(H({},e),{error:null})}))},T=null!==(r=null==i?void 0:i.recompileMode)&&void 0!==r?r:"delayed",R=null!==(o=null==i?void 0:i.recompileDelay)&&void 0!==o?o:200;return(0,y.useEffect)(function(){if("running"===u.status&&t.shouldUpdatePreview){if(S.current!==t.environment&&(S.current=t.environment,Object.entries(g.current).forEach(function(e){var t=e[0];L(e[1].iframe,t)})),"immediate"===T&&Object.values(g.current).forEach(function(e){"done"===e.status&&e.updateSandbox({files:t.files,template:t.environment})}),"delayed"===T){if("undefined"==typeof window)return;window.clearTimeout(k.current),k.current=window.setTimeout(function(){Object.values(g.current).forEach(function(e){"done"===e.status&&e.updateSandbox({files:t.files,template:t.environment})})},R)}return function(){window.clearTimeout(k.current)}}},[t.files,t.environment,t.shouldUpdatePreview,R,T,L,u.status]),(0,y.useEffect)(function(){l!==u.initMode&&(p(function(e){return H(H({},e),{initMode:l})}),M())},[l,M,u.initMode]),(0,y.useEffect)(function(){return function(){"function"==typeof j.current&&j.current(),x.current&&clearTimeout(x.current),k.current&&clearTimeout(k.current),m.current&&m.current.disconnect()}},[]),[u,{clients:g.current,initializeSandpackIframe:M,runSandpack:O,registerBundler:L,unregisterBundler:A,registerReactDevTools:function(e){p(function(t){return H(H({},t),{reactDevTools:e})})},addListener:function(e,t){if(t){if(g.current[t]){var n=g.current[t].listen(e);return n}var r=ep();w.current[t]=w.current[t]||{},b.current[t]=b.current[t]||{},w.current[t][r]=e;var n=function(){w.current[t][r]?delete w.current[t][r]:b.current[t][r]&&(b.current[t][r](),delete b.current[t][r])};return n}var o=ep();w.current.global[o]=e;var i=Object.values(g.current).map(function(t){return t.listen(e)}),n=function(){i.forEach(function(e){return e()}),delete w.current.global[o],Object.values(b.current).forEach(function(e){var t;null===(t=null==e?void 0:e[o])||void 0===t||t.call(e)})};return n},dispatchMessage:function(e,t){if("running"!==u.status){console.warn("[sandpack-react]: dispatch cannot be called while in idle mode");return}t?g.current[t].dispatch(e):Object.values(g.current).forEach(function(t){t.dispatch(e)})},lazyAnchorRef:v,unsubscribeClientListenersRef:b,queuedListenersRef:w}]},e8=function(e){var t=e3(e),n=(0,y.useState)(t),r=n[0],o=n[1],i=(0,y.useRef)(!1);(0,y.useEffect)(function(){i.current?o(e3(e)):i.current=!0},[e.files,e.customSetup,e.template]);var s=function(e,t,n){void 0===n&&(n=!0),o(function(r){var o,i=r.files;return"string"==typeof e&&"string"==typeof t?i=H(H({},i),((o={})[e]={code:t},o)):"object"==typeof e&&(i=H(H({},i),e5(e))),H(H({},r),{files:(0,$.f)(i),shouldUpdatePreview:n})})};return[H(H({},r),{visibleFilesFromProps:t.visibleFiles}),{openFile:function(e){o(function(t){var n=t.visibleFiles,r=B(t,["visibleFiles"]),o=n.includes(e)?n:_(_([],n,!0),[e],!1);return H(H({},r),{activeFile:e,visibleFiles:o})})},resetFile:function(e){o(function(n){var r;return H(H({},n),{files:H(H({},n.files),((r={})[e]=t.files[e],r))})})},resetAllFiles:function(){o(function(e){return H(H({},e),{files:t.files})})},setActiveFile:function(e){r.files[e]&&o(function(t){return H(H({},t),{activeFile:e})})},updateCurrentFile:function(e,t){void 0===t&&(t=!0),s(r.activeFile,e,t)},updateFile:s,addFile:s,closeFile:function(e){1!==r.visibleFiles.length&&o(function(t){var n=t.visibleFiles,r=t.activeFile,o=B(t,["visibleFiles","activeFile"]),i=n.indexOf(e),s=n.filter(function(t){return t!==e});return H(H({},o),{activeFile:e===r?0===i?n[1]:n[i-1]:r,visibleFiles:s})})},deleteFile:function(e,t){void 0===t&&(t=!0),o(function(n){var r=n.visibleFiles,o=n.files,i=n.activeFile,s=B(n,["visibleFiles","files","activeFile"]),a=H({},o);delete a[e];var c=r.filter(function(t){return t!==e});if(0===c.length){var l=Object.keys(o)[Object.keys(o).length-1];return H(H({},s),{visibleFiles:[l],activeFile:l,files:a,shouldUpdatePreview:t})}return H(H({},s),{visibleFiles:c,activeFile:e===i?c[c.length-1]:i,files:a,shouldUpdatePreview:t})})}}]},e9=y.createContext(null),te=function(e){var t,n,r=e.children,o=e.options,i=e.style,s=e.className,a=e.theme,c=e8(e),l=c[0],d=c[1],u=e7(e,l),p=u[0],f=u[1],m=f.dispatchMessage,v=f.addListener,h=B(f,["dispatchMessage","addListener"]),g=e4(e,l.files);return y.useEffect(function(){h.initializeSandpackIframe()},[]),(0,b.jsx)(e9.Provider,{value:H(H(H(H(H(H({},l),p),g),d),h),{autoReload:null===(n=null===(t=e.options)||void 0===t?void 0:t.autoReload)||void 0===n||n,listen:v,dispatch:m}),children:(0,b.jsx)(ek,{classes:null==o?void 0:o.classes,children:(0,b.jsx)(eM,{className:s,style:i,theme:a,children:r})})})},tt=e9.Consumer;function tn(){var e=y.useContext(e9);if(null===e)throw Error('[sandpack-react]: "useSandpack" must be wrapped by a "SandpackProvider"');var t=e.dispatch,n=e.listen,r=B(e,["dispatch","listen"]);return{sandpack:H({},r),dispatch:t,listen:n}}var tr=function(){var e,t,n,r=tn().sandpack;return{code:null===(e=r.files[r.activeFile])||void 0===e?void 0:e.code,readOnly:null!==(n=null===(t=r.files[r.activeFile])||void 0===t?void 0:t.readOnly)&&void 0!==n&&n,updateCode:r.updateCurrentFile}},to=eh({svg:{margin:"auto"}}),ti=eh(((i={appearance:"none",outline:"none",display:"flex",alignItems:"center",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",transition:"color $default, background $default",cursor:"pointer",color:"$colors$clickable",border:0,textDecoration:"none","&:disabled":{color:"$colors$disabled"},"&:hover:not(:disabled,[data-active='true'])":{color:"$colors$hover"},'&[data-active="true"]':{color:"$colors$accent"},svg:{minWidth:"$space$4",width:"$space$4",height:"$space$4"}})["&.".concat(to)]={padding:"$space$1",height:"$space$7",display:"flex"},i["&.".concat(to,"&:not(:has(span))")]={width:"$space$7"},i["&.".concat(to,"&:has(svg + span)")]={paddingRight:"$space$3",paddingLeft:"$space$2",gap:"$space$1"},i)),ts=eh({backgroundColor:"$colors$surface2",borderRadius:"99999px",border:"1px solid $colors$surface3",'&[data-active="true"]':{color:"$colors$surface1",background:"$colors$accent"},"&:hover:not(:disabled,[data-active='true'])":{backgroundColor:"$colors$surface3"}}),ta=eh({padding:0}),tc=ex({"0%":{opacity:0},"100%":{opacity:1}}),tl=eh({position:"absolute",bottom:"0",left:"0",right:"0",top:"0",margin:"0",overflow:"auto",height:"100%",zIndex:"$top"}),td=eh(((s={whiteSpace:"pre-wrap",padding:"$space$10",backgroundColor:"$colors$surface1",display:"flex",gap:"$space$2",flexDirection:"column"})[".".concat(ti)]={width:"auto",gap:"$space$2",padding:"0 $space$3 0 $space$2",marginTop:"$space$1"},s.variants={solidBg:{true:{backgroundColor:"$colors$errorSurface"}}},s)),tu=eh(((a={padding:"$space$10",backgroundColor:"$colors$surface1"})[".".concat(ti)]={marginTop:"$space$6",width:"auto",gap:"$space$2",padding:"0 $space$3 0 $space$2"},a)),tp=eh({animation:"".concat(tc," 150ms ease"),color:"$colors$error",display:"flex",flexDirection:"column",gap:"$space$3",variants:{errorCode:{true:{fontFamily:"$font$mono"}}},a:{color:"inherit"},p:{margin:0}}),tf=eh({borderBottom:"1px solid $colors$surface2",background:"$colors$surface1"}),tm=eh({padding:"0 $space$2",overflow:"auto",display:"flex",flexWrap:"nowrap",alignItems:"stretch",minHeight:"40px",marginBottom:"-1px"}),tv=eh({padding:"0 $space$1 0 $space$1",borderRadius:"$border$radius",marginLeft:"$space$1",width:"$space$5",visibility:"hidden",svg:{width:"$space$3",height:"$space$3",display:"block",position:"relative",top:1}}),th=eh(((c={padding:"0 $space$2",height:"$layout$headerHeight",whiteSpace:"nowrap","&:focus":{outline:"none"}})["&:hover > .".concat(tv)]={visibility:"unset"},c)),tg=function(e){var t=e.closableTabs,n=e.className,r=B(e,["closableTabs","className"]),o=tn().sandpack,i=eS(),s=o.activeFile,a=o.visibleFiles,c=o.setActiveFile,l=function(e){e.stopPropagation();var t=e.target.closest("[data-active]"),n=null==t?void 0:t.getAttribute("title");n&&o.closeFile(n)},d=function(e){var t=ec(e),n=a.reduce(function(n,r){return r===e||ec(r)===t&&n.push(r),n},[]);return 0===n.length?t:el(e,n)};return(0,b.jsx)("div",H({className:i("tabs",[tf,n]),translate:"no"},r,{children:(0,b.jsx)("div",{"aria-label":"Select active file",className:i("tabs-scrollable-container",[tm]),role:"tablist",children:a.map(function(e){return(0,b.jsxs)("button",{"aria-selected":e===s,className:i("tab-button",[ti,th]),"data-active":e===s,onClick:function(){return c(e)},role:"tab",title:e,type:"button",children:[d(e),t&&a.length>1&&(0,b.jsx)("span",{className:i("close-button",[tv]),onClick:l,children:(0,b.jsx)(er,{})})]},e)})})}))},tx=function(e){var t=e.onClick,n=e.className,r=e.children,o=eS();return(0,b.jsx)("button",{className:o("button",[o("icon-standalone"),ti,to,ts,n]),onClick:t,type:"button",children:r})},tb=eh({position:"absolute",bottom:"$space$2",right:"$space$2",paddingRight:"$space$3"}),ty=function(e){e.className;var t=e.onClick,n=B(e,["className","onClick"]),r=tn().sandpack;return(0,b.jsxs)(tx,H({className:tb.toString(),onClick:function(e){r.runSandpack(),null==t||t(e)}},n,{children:[(0,b.jsx)(Y,{}),(0,b.jsx)("span",{children:"Run"})]}))},tj=eh(((l={display:"flex",flexDirection:"column",width:"100%",position:"relative",backgroundColor:"$colors$surface1",gap:1})["&:has(.".concat("sp","-stack)")]={backgroundColor:"$colors$surface2"},l)),tw=function(e){var t=e.className,n=B(e,["className"]),r=eS();return(0,b.jsx)("div",H({className:r("stack",[tj,t])},n))},t$=function(){var e=y.useContext(eO);return{theme:e.theme,themeId:e.id,themeMode:e.mode}},tC=function(e,t){if(e.length!==t.length)return!1;for(var n=!0,r=0;rs){var n=o.slice(s,e);a.push(t?(0,y.createElement)("span",{children:n,className:t,key:"".concat(e).concat(s)}):n),s=e}};return(0,T.bW)(i,n,function(e,t,n){c(e,""),c(t,n)}),sr.length||n>r.length})?E.jT.cursor(r.length):e.state.selection,n={from:0,to:e.state.doc.length,insert:r};e.dispatch({changes:n,selection:t})}},[r]),y.useEffect(function(){if(d){var e=K(function(e){var t=P.current;"success"===e.type?null==t||t.dispatch({annotations:[new E.q6("remove-errors",!0)]}):"action"===e.type&&"show-error"===e.action&&e.path===o&&e.line&&(null==t||t.dispatch({annotations:[new E.q6("show-error",e.line)]}))});return function(){return e()}}},[K,d]);var el=function(){var e=4;return c&&(e+=6),h||(e+=1),"var(--".concat("sp","-space-").concat(e,")")};return h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{ref:D,className:G("cm",[G(m),G(er),tR,tF]),translate:"no",children:(0,b.jsx)("code",{className:G("pre-placeholder",[tA]),style:{marginLeft:el()},children:es})}),h&&(void 0===g||g)&&(0,b.jsx)("span",H({className:G("read-only",[tI])},{},{children:"Read-only"}))]}):(0,b.jsx)("div",{ref:D,"aria-autocomplete":"list","aria-label":o?"Code Editor for ".concat(ec(o)):"Code Editor","aria-multiline":"true",className:G("cm",[G(m),G(er),tR,tF]),onKeyDown:function(e){"Enter"===e.key&&P.current&&(e.preventDefault(),P.current.contentDOM.focus())},role:"textbox",tabIndex:0,translate:"no",suppressHydrationWarning:!0,children:(0,b.jsx)("pre",{className:G("pre-placeholder",[tA]),style:{marginLeft:el()},children:es})})}),tH=(0,y.forwardRef)(function(e,t){var n=e.showTabs,r=e.showLineNumbers,o=e.showInlineErrors,i=e.showRunButton,s=e.wrapContent,a=e.closableTabs,c=e.initMode,l=e.extensions,d=e.extensionsKeymap,u=e.readOnly,p=e.showReadOnly,f=e.additionalLanguages,m=e.className,v=B(e,["showTabs","showLineNumbers","showInlineErrors","showRunButton","wrapContent","closableTabs","initMode","extensions","extensionsKeymap","readOnly","showReadOnly","additionalLanguages","className"]),h=tn().sandpack,g=tr(),x=g.code,y=g.updateCode,j=g.readOnly,w=h.activeFile,$=h.status,C=h.editorState,k=null!=n?n:h.visibleFiles.length>1,S=eS(),N=function(e,t){void 0===t&&(t=!0),y(e,t)};return(0,b.jsxs)(tw,H({className:S("editor",[m])},v,{children:[k&&(0,b.jsx)(tg,{closableTabs:void 0!==a&&a}),(0,b.jsxs)("div",{className:S("code-editor",[tT]),children:[(0,b.jsx)(tP,{ref:t,additionalLanguages:f,code:x,editorState:C,extensions:l,extensionsKeymap:d,filePath:w,initMode:c||h.initMode,onCodeUpdate:function(e){var t;return N(e,null===(t=h.autoReload)||void 0===t||t)},readOnly:u||j,showInlineErrors:void 0!==o&&o,showLineNumbers:void 0!==r&&r,showReadOnly:p,wrapContent:void 0!==s&&s},w),(void 0===i||i)&&(!h.autoReload||"idle"===$)?(0,b.jsx)(ty,{}):null]})]}))}),tB=y.forwardRef(function(e,t){var n=e.showTabs,r=e.showLineNumbers,o=e.decorators,i=e.code,s=e.initMode,a=e.wrapContent,c=e.additionalLanguages,l=B(e,["showTabs","showLineNumbers","decorators","code","initMode","wrapContent","additionalLanguages"]),d=tn().sandpack,u=tr().code,p=eS(),f=null!=n?n:d.visibleFiles.length>1;return(0,b.jsxs)(tw,H({className:p("editor-viewer")},l,{children:[f?(0,b.jsx)(tg,{}):null,(0,b.jsx)("div",{className:p("code-editor",[tT]),children:(0,b.jsx)(tP,{ref:t,additionalLanguages:c,code:null!=i?i:u,decorators:o,filePath:d.activeFile,initMode:s||d.initMode,showLineNumbers:r,showReadOnly:!1,wrapContent:a,readOnly:!0})}),"idle"===d.status?(0,b.jsx)(ty,{}):null]}))}),tz=eh(((p={border:"1px solid $colors$surface2",display:"flex",flexWrap:"wrap",alignItems:"stretch",borderRadius:"$border$radius",overflow:"hidden",position:"relative",backgroundColor:"$colors$surface2",gap:1})["> .".concat(tj)]={flexGrow:1,flexShrink:1,flexBasis:"0",height:"$layout$height",overflow:"hidden","@media print":{height:"auto",display:"block"},"@media screen and (max-width: 768px)":((f={})["&:not(.".concat("sp","-preview, .").concat("sp","-editor, .").concat("sp","-preset-column)")]={height:"calc($layout$height / 2)"},f.minWidth="100%;",f)},p["> .".concat("sp","-file-explorer")]={flex:.2,minWidth:200,"@media screen and (max-width: 768px)":{flex:1}},p)),tJ=y.forwardRef(function(e,t){var n=e.children,r=e.className,o=B(e,["children","className"]),i=tn().sandpack,s=eS(),a=tO(i.lazyAnchorRef,t);return(0,b.jsx)("div",H({ref:a,className:s("layout",[tz,r])},o,{children:n}))}),t_=function(){var e,t=tn().sandpack.error;return null!==(e=null==t?void 0:t.message)&&void 0!==e?e:null},tU=200,tV=function(e,t){var n=tn(),r=n.sandpack,o=n.listen,i=y.useState("LOADING"),s=i[0],a=i[1];return(y.useEffect(function(){var t=o(function(e){"start"===e.type&&!0===e.firstLoad&&a("LOADING"),"done"===e.type&&a(function(e){return"LOADING"===e?"PRE_FADING":"HIDDEN"})},e);return function(){t()}},[e,"idle"===r.status]),y.useEffect(function(){var e;return"PRE_FADING"!==s||t?"FADING"===s&&(e=setTimeout(function(){return a("HIDDEN")},tU)):a("FADING"),function(){clearTimeout(e)}},[s,t]),"timeout"===r.status)?"TIMEOUT":"running"!==r.status?"HIDDEN":s},tW=function(e){var t=tn().dispatch;return{refresh:function(){return t({type:"refresh"},e)},back:function(){return t({type:"urlback"},e)},forward:function(){return t({type:"urlforward"},e)}}},tZ=function(){var e=tn().sandpack;return"running"!==e.status?null:function(e){var t,n,r=e.activeFile,o=e.bundlerState;if(null==o)return null;var i=o.transpiledModules[r+":"];return null!==(n=null===(t=null==i?void 0:i.source)||void 0===t?void 0:t.compiledCode)&&void 0!==n?n:null}(e)},tY=function(e){var t=tn(),n=t.sandpack,r=t.listen,o=t.dispatch,i=y.useRef(null),s=y.useRef(ep());return y.useEffect(function(){var t=i.current,r=s.current;return null!==t&&n.registerBundler(t,r,e),function(){return n.unregisterBundler(r)}},[]),{sandpack:n,getClient:function(){return n.clients[s.current]||null},clientId:s.current,iframe:i,listen:function(e){return r(e,s.current)},dispatch:function(e){return o(e,s.current)}}},tq=function(e){var t=tn().dispatch;return{restart:function(){return t({type:"shell/restart"},e)},openPreview:function(){return t({type:"shell/openPreview"},e)}}},tG=function(e,t){var n;switch(e.state){case"downloading_manifest":return"[1/3] Downloading manifest";case"downloaded_module":return"[2/3] Downloaded ".concat(e.name," (").concat(t-e.totalPending,"/").concat(t,")");case"starting_command":return"[3/3] Starting command";case"command_running":return'[3/3] Running "'.concat(null===(n=e.command)||void 0===n?void 0:n.trim(),'"')}},tX=function(e){var t=y.useState(!1),n=t[0],r=t[1],o=y.useState(),i=o[0],s=o[1],a=y.useState(null),c=a[0],l=a[1],d=null==e?void 0:e.timeout,u=null==e?void 0:e.clientId,p=tn().listen;return y.useEffect(function(){var e,t=p(function(t){"start"===t.type&&t.firstLoad&&r(!1),d&&(e=setTimeout(function(){l(null)},d)),"shell/progress"!==t.type||n||(i||"downloaded_module"!==t.data.state||s(t.data.totalPending),void 0!==i&&l(tG(t.data,i))),"done"===t.type&&!1===t.compilatonError&&(l(null),r(!0),clearTimeout(e))},u);return function(){e&&clearTimeout(e),t()}},[u,n,i,d]),c},tK=function(e){var t=e.clientId,n=e.maxMessageCount,r=void 0===n?800:n;e.resetOnPreviewRestart;var o=y.useState([]),i=o[0],s=o[1],a=tn().listen;return y.useEffect(function(){return a(function(e){"start"===e.type?s([]):"stdout"===e.type&&e.payload.data&&e.payload.data.trim()&&s(function(t){for(var n=_(_([],t,!0),[{data:e.payload.data,id:ep()}],!1);n.length>r;)n.shift();return n})},t)},[r,t]),{logs:i,reset:function(){return s([])}}},tQ=function(e){var t=e.replace("[sandpack-client]: ","");if(/process.exit/.test(t)){var n=t.match(/process.exit\((\d+)\)/);return n?0===Number(n[1])?"Server is not running, would you like to start it again?":"Server has crashed with status code ".concat(n[1],", would you like to restart the server?"):t}return t},t0=function(e){var t=e.children,n=e.className,r=B(e,["children","className"]),o=t_(),i=tq().restart,s=eS(),a=tn().sandpack,c=a.runSandpack,l=a.teamId,d=tn().dispatch;if(!o&&!t)return null;var u=null==o?void 0:o.startsWith("[sandpack-client]");return(null==o?void 0:o.includes("NPM_REGISTRY_UNAUTHENTICATED_REQUEST"))?(0,b.jsxs)("div",H({className:s("overlay",[s("error"),tl,tu,n])},e,{children:[(0,b.jsx)("p",{className:s("error-message",[tp]),children:(0,b.jsx)("strong",{children:"Unable to fetch required dependency."})}),(0,b.jsx)("div",{className:s("error-message",[tp]),children:(0,b.jsxs)("p",{children:["Authentication required. Please sign in to your account (make sure to allow pop-ups to this page) and try again. If the issue persists, contact"," ",(0,b.jsx)("a",{href:"mailto:hello@codesandbox.io?subject=Sandpack Timeout Error",children:"support"})," ","for further assistance."]})}),(0,b.jsx)("div",{children:(0,b.jsxs)("button",{className:s("button",[ti,to,ts]),onClick:function(){l&&d({type:"sign-in",teamId:l})},children:[(0,b.jsx)(V,{}),(0,b.jsx)("span",{children:"Sign in"})]})})]})):u&&o?(0,b.jsx)("div",H({className:s("overlay",[s("error"),tl,tu,n])},r,{children:(0,b.jsxs)("div",{className:s("error-message",[tp]),children:[(0,b.jsx)("p",{className:s("error-title",[eh({fontWeight:"bold"})]),children:"Couldn't connect to server"}),(0,b.jsx)("p",{children:tQ(o)}),(0,b.jsx)("div",{children:(0,b.jsxs)("button",{className:s("button",[s("icon-standalone"),ti,to,ts]),onClick:function(){i(),c()},title:"Restart script",type:"button",children:[(0,b.jsx)(Z,{})," ",(0,b.jsx)("span",{children:"Restart"})]})})]})})):(0,b.jsxs)("div",H({className:s("overlay",[s("error"),tl,td({solidBg:!0}),n]),translate:"no"},r,{children:[(0,b.jsx)("p",{className:s("error-message",[tp]),children:(0,b.jsx)("strong",{children:"Something went wrong"})}),(0,b.jsx)("p",{className:s("error-message",[tp({errorCode:!0})]),children:o||t})]}))};function t1(e,t,n,r){var o,i,s=t?null:function(e){var t={};switch(e.bg&&(t.backgroundColor="rgb(".concat(e.bg,")")),e.fg&&(t.color="rgb(".concat(e.fg,")")),e.decoration){case"bold":t.fontWeight="bold";break;case"dim":t.opacity="0.5";break;case"italic":t.fontStyle="italic";break;case"hidden":t.visibility="hidden";break;case"strikethrough":t.textDecoration="line-through";break;case"underline":t.textDecoration="underline";break;case"blink":t.textDecoration="blink"}return t}(n),a=t?(o="",(n.bg&&(o+="".concat(n.bg,"-bg ")),n.fg&&(o+="".concat(n.fg,"-fg ")),n.decoration&&(o+="ansi-".concat(n.decoration," ")),""===o)?null:o=o.substring(0,o.length-1)):null;if(!e)return y.createElement("span",{style:s,key:r,className:a},n.content);for(var c=[],l=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,d=0;null!==(i=l.exec(n.content));){var u=i[1],p=i[2],f=i.index+u.length;f>d&&c.push(n.content.substring(d,f));var m=p.startsWith("www.")?"http://".concat(p):p;c.push(y.createElement("a",{key:d,href:m,target:"_blank"},"".concat(p))),d=l.lastIndex}return d1500)?(0,b.jsxs)("button",H({onClick:function(){var e;return null===(e=a.current)||void 0===e?void 0:e.submit()},title:"Open in CodeSandbox",type:"button"},i,{children:[(0,b.jsxs)("form",{ref:a,action:t5,method:"POST",style:{visibility:"hidden"},target:"_blank",children:[(0,b.jsx)("input",{name:"environment",type:"hidden",value:"node"===s.environment?"server":s.environment}),Array.from(l,function(e){var t=e[0],n=e[1];return(0,b.jsx)("input",{name:t,type:"hidden",value:n},t)})]}),o]})):(0,b.jsx)("a",H({href:"".concat(t5,"?").concat(null==l?void 0:l.toString(),"&environment=").concat("node"===s.environment?"server":s.environment),rel:"noreferrer noopener",target:"_blank",title:"Open in CodeSandbox"},i,{children:o}))},t8=function(){var e=eS();return(0,b.jsxs)(t7,{className:e("button",[e("icon-standalone"),ti,to,ts]),children:[(0,b.jsx)(Q,{}),(0,b.jsx)("span",{children:"Open Sandbox"})]})},t9=eh({transform:"translate(-4px, 9px) scale(0.13, 0.13)","*":{position:"absolute",width:"96px",height:"96px"}}),ne=eh(((m={position:"absolute",right:"$space$2",bottom:"$space$2",zIndex:"$top",width:"32px",height:"32px",borderRadius:"$border$radius"})[".".concat(t9)]={display:"flex"},m[".sp-button.".concat(ti)]={display:"none"},m["&:hover .sp-button.".concat(ti)]={display:"flex"},m["&:hover .sp-button.".concat(ti," > span")]={display:"none"},m["&:hover .".concat(t9)]={display:"none"},m)),nt=ex({"0%":{transform:"rotateX(-25.5deg) rotateY(45deg)"},"100%":{transform:"rotateX(-25.5deg) rotateY(405deg)"}}),nn=eh({animation:"".concat(nt," 1s linear infinite"),animationFillMode:"forwards",transformStyle:"preserve-3d",transform:"rotateX(-25.5deg) rotateY(45deg)","*":{border:"10px solid $colors$clickable",borderRadius:"8px",background:"$colors$surface1"},".top":{transform:"rotateX(90deg) translateZ(44px)",transformOrigin:"50% 50%"},".bottom":{transform:"rotateX(-90deg) translateZ(44px)",transformOrigin:"50% 50%"},".front":{transform:"rotateY(0deg) translateZ(44px)",transformOrigin:"50% 50%"},".back":{transform:"rotateY(-180deg) translateZ(44px)",transformOrigin:"50% 50%"},".left":{transform:"rotateY(-90deg) translateZ(44px)",transformOrigin:"50% 50%"},".right":{transform:"rotateY(90deg) translateZ(44px)",transformOrigin:"50% 50%"}}),nr=function(e){var t=e.className,n=e.showOpenInCodeSandbox,r=B(e,["className","showOpenInCodeSandbox"]),o=eS();return(0,b.jsxs)("div",H({className:o("cube-wrapper",[ne,t]),title:"Open in CodeSandbox"},r,{children:[n&&(0,b.jsx)(t8,{}),(0,b.jsx)("div",{className:o("cube",[t9]),children:(0,b.jsxs)("div",{className:o("sides",[nn]),children:[(0,b.jsx)("div",{className:"top"}),(0,b.jsx)("div",{className:"right"}),(0,b.jsx)("div",{className:"bottom"}),(0,b.jsx)("div",{className:"left"}),(0,b.jsx)("div",{className:"front"}),(0,b.jsx)("div",{className:"back"})]})})]}))},no=eh({backgroundColor:"$colors$surface1"}),ni=function(e){var t=e.clientId,n=e.loading,r=e.className,o=e.style,i=e.showOpenInCodeSandbox,s=B(e,["clientId","loading","className","style","showOpenInCodeSandbox"]),a=eS(),c=tn().sandpack,l=c.runSandpack,d=c.environment,u=y.useState(!1),p=u[0],f=u[1],m=tV(t,n),v=tX({clientId:t}),h=tK({clientId:t}).logs;return(y.useEffect(function(){var e;return(null==v?void 0:v.includes("Running"))&&(e=setTimeout(function(){f(!0)},3e3)),function(){e&&clearTimeout(e)}},[v]),"HIDDEN"===m)?null:"TIMEOUT"===m?(0,b.jsx)("div",H({className:a("overlay",[a("error"),tl,td,tu,r])},s,{children:(0,b.jsxs)("div",{className:a("error-message",[tp]),children:[(0,b.jsx)("p",{className:a("error-title",[eh({fontWeight:"bold"})]),children:"Couldn't connect to server"}),(0,b.jsx)("div",{className:a("error-message",[tp]),children:(0,b.jsxs)("p",{children:["This means sandpack cannot connect to the runtime or your network is having some issues. Please check the network tab in your browser and try again. If the problem persists, report it via"," ",(0,b.jsx)("a",{href:"mailto:hello@codesandbox.io?subject=Sandpack Timeout Error",children:"email"})," ","or submit an issue on"," ",(0,b.jsx)("a",{href:"https://github.com/codesandbox/sandpack/issues",rel:"noreferrer noopener",target:"_blank",children:"GitHub."})]})}),(0,b.jsxs)("p",{className:a("error-message",[tp({errorCode:!0})]),children:["ENV: ",d,(0,b.jsx)("br",{}),"ERROR: TIME_OUT"]}),(0,b.jsx)("div",{children:(0,b.jsxs)("button",{className:a("button",[a("icon-standalone"),ti,to,ts]),onClick:l,title:"Restart script",type:"button",children:[(0,b.jsx)(Z,{})," ",(0,b.jsx)("span",{children:"Try again"})]})})]})})):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",H({className:a("overlay",[a("loading"),tl,no,r]),style:H(H({},o),{opacity:"LOADING"===m||"PRE_FADING"===m?1:0,transition:"opacity ".concat(tU,"ms ease-out")})},s,{children:[p&&(0,b.jsx)("div",{className:ns.toString(),children:(0,b.jsx)(t2,{data:h})}),(0,b.jsx)(nr,{showOpenInCodeSandbox:i})]})),v&&(0,b.jsx)("div",{className:na.toString(),children:(0,b.jsx)("p",{children:v})})]})},ns=eh({position:"absolute",left:0,right:0,bottom:"$space$8",overflow:"auto",opacity:.5,overflowX:"hidden"}),na=eh({position:"absolute",left:"$space$5",bottom:"$space$4",zIndex:"$top",color:"$colors$clickable",animation:"".concat(tc," 150ms ease"),fontFamily:"$font$mono",fontSize:".8em",width:"75%",p:{whiteSpace:"nowrap",margin:0,textOverflow:"ellipsis",overflow:"hidden"}}),nc=function(e){var t=tX({timeout:3e3,clientId:e.clientId});return t?(0,b.jsx)("div",{className:nl.toString(),children:(0,b.jsx)("p",{children:t})}):null},nl=eh({position:"absolute",left:"$space$5",bottom:"$space$4",zIndex:"$top",color:"$colors$clickable",animation:"".concat(tc," 150ms ease"),fontFamily:"$font$mono",fontSize:".8em",width:"75%",p:{whiteSpace:"nowrap",margin:0,textOverflow:"ellipsis",overflow:"hidden"}}),nd=eh({borderRadius:"0",width:"100%",padding:0,marginBottom:"$space$2",span:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},svg:{marginRight:"$space$1"}}),nu=function(e){var t=e.selectFile,n=e.path,r=e.active,o=e.onClick,i=e.depth,s=e.isDirOpen,a=eS(),c=n.split("/").filter(Boolean).pop();return(0,b.jsxs)("button",{className:a("button",[a("explorer"),ti,nd]),"data-active":r,onClick:function(e){t&&t(n),null==o||o(e)},style:{paddingLeft:18*i+"px"},title:c,type:"button",children:[t?(0,b.jsx)(en,{}):s?(0,b.jsx)(ee,{}):(0,b.jsx)(et,{}),(0,b.jsx)("span",{children:c})]})},np=function(e){var t=e.prefixedPath,n=e.files,r=e.selectFile,o=e.activeFile,i=e.depth,s=e.autoHiddenFiles,a=e.visibleFiles,c=e.initialCollapsedFolder,l=y.useState(!(null==c?void 0:c.includes(t))),d=l[0],u=l[1];return(0,b.jsxs)("div",{children:[(0,b.jsx)(nu,{depth:i,isDirOpen:d,onClick:function(){return u(function(e){return!e})},path:t+"/"}),d&&(0,b.jsx)(nm,{activeFile:o,autoHiddenFiles:s,depth:i+1,files:n,initialCollapsedFolder:c,prefixedPath:t,selectFile:r,visibleFiles:a})]},t)},nf=function(e){var t=e.autoHiddenFiles,n=e.visibleFiles,r=e.files,o=e.prefixedPath,i=n.length>0,s=t&&!i,a=t&&!!i,c=Object.keys(r).filter(function(e){var t,i=e.startsWith(o);return a?i&&n.includes(e):s?i&&!(null===(t=r[e])||void 0===t?void 0:t.hidden):i}).map(function(e){return e.substring(o.length)}),l=new Set(c.filter(function(e){return e.includes("/")}).map(function(e){return"".concat(o).concat(e.split("/")[0],"/")})),d=c.filter(function(e){return!e.includes("/")}).map(function(e){return"".concat(o).concat(e)});return{directories:Array.from(l),modules:d}},nm=function(e){var t=e.depth,n=void 0===t?0:t,r=e.activeFile,o=e.selectFile,i=e.prefixedPath,s=e.files,a=e.autoHiddenFiles,c=e.visibleFiles,l=e.initialCollapsedFolder,d=nf({visibleFiles:c,autoHiddenFiles:a,prefixedPath:i,files:s}),u=d.directories,p=d.modules;return(0,b.jsxs)("div",{children:[u.map(function(e){return(0,b.jsx)(np,{activeFile:r,autoHiddenFiles:a,depth:n,files:s,initialCollapsedFolder:l,prefixedPath:e,selectFile:o,visibleFiles:c},e)}),p.map(function(e){return(0,b.jsx)(nu,{active:r===e,depth:n,path:e,selectFile:o},e)})]})},nv=eh({padding:"$space$3",overflow:"auto",height:"100%"}),nh=function(e){var t=e.className,n=e.autoHiddenFiles,r=e.initialCollapsedFolder,o=B(e,["className","autoHiddenFiles","initialCollapsedFolder"]),i=tn(),s=i.sandpack,a=s.status,c=s.updateFile,l=s.deleteFile,d=s.activeFile,u=s.files,p=s.openFile,f=s.visibleFilesFromProps,m=i.listen,v=eS();y.useEffect(function(){if("running"===a)return m(function(e){"fs/change"===e.type&&c(e.path,e.content,!1),"fs/remove"===e.type&&l(e.path,!1)})},[a]);var h=Object.keys(u).sort().reduce(function(e,t){return e[t]=u[t],e},{});return(0,b.jsx)("div",H({className:v("file-explorer",[tj,t])},o,{children:(0,b.jsx)("div",{className:v("file-explorer-list",[nv]),children:(0,b.jsx)(nm,{activeFile:d,autoHiddenFiles:void 0!==n&&n,files:h,initialCollapsedFolder:void 0===r?[]:r,prefixedPath:"/",selectFile:p,visibleFiles:f})})}))},ng=function(e){var t=e.match(/(https?:\/\/.*?)\//);return t&&t[1]?[t[1],e.replace(t[1],"")]:[e,"/"]},nx=eh({display:"flex",alignItems:"center",height:"$layout$headerHeight",borderBottom:"1px solid $colors$surface2",padding:"$space$3 $space$2",background:"$colors$surface1"}),nb=eh({backgroundColor:"$colors$surface2",color:"$colors$clickable",padding:"$space$1 $space$3",borderRadius:"99999px",border:"1px solid $colors$surface2",height:"24px",lineHeight:"24px",fontSize:"inherit",outline:"none",flex:1,marginLeft:"$space$4",width:"0",transition:"background $transitions$default","&:hover":{backgroundColor:"$colors$surface3"},"&:focus":{backgroundColor:"$surface1",border:"1px solid $colors$accent",color:"$colors$base"}}),ny=function(e){var t,n=e.clientId,r=e.onURLChange,o=e.className,i=e.startRoute,s=B(e,["clientId","onURLChange","className","startRoute"]),a=y.useState(""),c=a[0],l=a[1],d=tn(),u=d.sandpack,p=d.dispatch,f=d.listen,m=y.useState(null!==(t=null!=i?i:u.startRoute)&&void 0!==t?t:"/"),v=m[0],h=m[1],g=y.useState(!1),x=g[0],j=g[1],w=y.useState(!1),$=w[0],C=w[1],k=eS();y.useEffect(function(){var e=f(function(e){if("urlchange"===e.type){var t=e.url,n=e.back,r=e.forward,o=ng(t),i=o[0],s=o[1];l(i),h(s),j(n),C(r)}},n);return function(){return e()}},[]);var S=k("button",[k("icon"),ti,ta,eh({minWidth:"$space$6",justifyContent:"center"})]);return(0,b.jsxs)("div",H({className:k("navigator",[nx,o])},s,{children:[(0,b.jsx)("button",{"aria-label":"Go back one page",className:S,disabled:!x,onClick:function(){p({type:"urlback"})},type:"button",children:(0,b.jsx)(q,{})}),(0,b.jsx)("button",{"aria-label":"Go forward one page",className:S,disabled:!$,onClick:function(){p({type:"urlforward"})},type:"button",children:(0,b.jsx)(G,{})}),(0,b.jsx)("button",{"aria-label":"Refresh page",className:S,onClick:function(){p({type:"refresh"})},type:"button",children:(0,b.jsx)(X,{})}),(0,b.jsx)("input",{"aria-label":"Current Sandpack URL",className:k("input",[nb]),name:"Current Sandpack URL",onChange:function(e){h(e.target.value.startsWith("/")?e.target.value:"/".concat(e.target.value))},onKeyDown:function(e){"Enter"===e.code&&(e.preventDefault(),e.stopPropagation(),"function"==typeof r&&r(c+e.currentTarget.value))},type:"text",value:v})]}))},nj=eh(((v={flex:1,display:"flex",flexDirection:"column",background:"white",overflow:"auto",position:"relative"})[".".concat("sp","-bridge-frame")]={border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},v)),nw=eh({border:"0",outline:"0",width:"100%",height:"100%",minHeight:"160px",maxHeight:"2000px",flex:1}),n$=eh({display:"flex",position:"absolute",bottom:"$space$2",right:"$space$2",zIndex:"$overlay",gap:"$space$2"}),nC=y.forwardRef(function(e,t){var n=e.showNavigator,r=void 0!==n&&n,o=e.showRefreshButton,i=e.showOpenInCodeSandbox,s=void 0===i||i,a=e.showSandpackErrorOverlay;e.showOpenNewtab;var c=e.showRestartButton,l=e.actionsChildren,d=void 0===l?(0,b.jsx)(b.Fragment,{}):l,u=e.children,p=e.className,f=e.startRoute,m=void 0===f?"/":f,v=B(e,["showNavigator","showRefreshButton","showOpenInCodeSandbox","showSandpackErrorOverlay","showOpenNewtab","showRestartButton","actionsChildren","children","className","startRoute"]),h=tY({startRoute:m}),g=h.sandpack,x=h.listen,j=h.iframe,w=h.getClient,$=h.clientId,C=h.dispatch,k=y.useState(null),S=k[0],N=k[1],E=g.status,O=tW($).refresh,M=tq($).restart,L=eS();return y.useEffect(function(){return x(function(e){"resize"===e.type&&N(e.height)})},[]),y.useImperativeHandle(t,function(){return{clientId:$,getClient:w}},[w,$]),(0,b.jsxs)(tw,H({className:L("preview",[p])},v,{children:[r&&(0,b.jsx)(ny,{clientId:$,onURLChange:function(e){j.current&&(j.current.src=e)},startRoute:m}),(0,b.jsxs)("div",{className:L("preview-container",[nj]),children:[(0,b.jsx)("iframe",{ref:j,className:L("preview-iframe",[nw]),style:{height:S||void 0},title:"Sandpack Preview"}),(0,b.jsxs)("div",{className:L("preview-actions",[n$]),children:[d,(void 0===c||c)&&"node"===g.environment&&(0,b.jsx)(tx,{onClick:M,children:(0,b.jsx)(Z,{})}),!r&&(void 0===o||o)&&"running"===E&&(0,b.jsx)(tx,{onClick:O,children:(0,b.jsx)(X,{})}),g.teamId&&(0,b.jsx)("button",{className:L("button",[L("icon-standalone"),ti,to,ts]),onClick:function(){return C({type:"sign-out"})},title:"Sign out",type:"button",children:(0,b.jsx)(W,{})}),s&&(0,b.jsx)(t8,{})]}),(0,b.jsx)(ni,{clientId:$,showOpenInCodeSandbox:s}),(void 0===a||a)&&(0,b.jsx)(t0,{}),u]})]}))}),nk=eh(((h={display:"flex",flexDirection:"column",width:"100%",position:"relative",overflow:"auto",minHeight:"160px",flex:1})[".".concat("sp","-stack")]={height:"100%"},h)),nS=function(e){var t=e.className,n=B(e,["className"]),r=tn().sandpack,o=tZ(),i=eS(),s=y.useRef(null);return y.useEffect(function(){var e=s.current;return e&&r.registerBundler(e,"hidden"),function(){r.unregisterBundler("hidden")}},[]),(0,b.jsxs)("div",H({className:i("transpiled-code",[tj,nk,t])},n,{children:[(0,b.jsx)(tB,H({code:null!=o?o:"",initMode:r.initMode},n)),(0,b.jsx)("iframe",{ref:s,style:{display:"none"},title:"transpiled sandpack code"}),(0,b.jsx)(t0,{}),(0,b.jsx)(ni,{clientId:"hidden",showOpenInCodeSandbox:!1})]}))},nN=eh({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"}),nE=eh({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"}),nO=function(e){var t=e.status,n=e.suiteOnly,r=e.setSuiteOnly,o=e.setVerbose,i=e.verbose,s=e.watchMode,a=e.setWatchMode,c=e.showSuitesOnly,l=e.showWatchButton,d=e.showVerboseButton,u=e.hideTestsAndSupressLogs,p=eS(),f=p("test-header-button",[ti,ts,eh({padding:"$space$1 $space$3"})]);return(0,b.jsxs)("div",{className:p("test-header",[nN,nE]),children:[(0,b.jsx)("div",{className:p("test-header-wrapper",[nE]),children:(0,b.jsxs)("p",{className:p("test-header-title",[eh({lineHeight:1,margin:0,color:"$colors$base",fontSize:"$font$size",display:"flex",alignItems:"center",gap:"$space$2"})]),children:[(0,b.jsx)(eo,{}),"Tests"]})}),(0,b.jsxs)("div",{className:p("test-header-actions",[nE]),children:[c&&(0,b.jsx)("button",{className:f,"data-active":n,disabled:"initialising"===t,onClick:r,type:"button",children:"Suite only"}),d&&(0,b.jsx)("button",{className:f,"data-active":i,disabled:"initialising"===t||u,onClick:o,type:"button",children:"Verbose"}),l&&(0,b.jsx)("button",{className:f,"data-active":s,disabled:"initialising"===t,onClick:a,type:"button",children:"Watch"})]})]})},nM=function(e){var t=e.onClick;return(0,b.jsx)(tx,{onClick:t,title:"Run tests",children:(0,b.jsx)(Y,{})})},nL=eh({variants:{status:{pass:{color:"var(--test-pass)"},fail:{color:"var(--test-fail)"},skip:{color:"var(--test-skip)"},title:{color:"var(--test-title)"}}}}),nA=nL({status:"pass"}),nF=nL({status:"fail"}),nT=nL({status:"skip"}),nR=nL({status:"title"}),nI=eh({variants:{status:{pass:{background:"var(--test-pass)",color:"$colors$surface1"},fail:{background:"var(--test-fail)",color:"$colors$surface1"},run:{background:"var(--test-run)",color:"$colors$surface1"}}}}),nD=nI({status:"run"}),nP=nI({status:"pass"}),nH=nI({status:"fail"}),nB=eh({marginLeft:"$space$4"}),nz=eh({marginBottom:"$space$2",color:"$colors$clickable"}),nJ=eh({marginBottom:"$space$2",color:"$colors$hover"}),n_=eh({marginLeft:"$space$2"}),nU=eh({marginRight:"$space$2"}),nV=function(e){var t=e.tests;e.style;var n=eS();return(0,b.jsx)("div",{className:n("test",[nB]),children:t.map(function(e){return(0,b.jsxs)("div",{className:n("test-result",[nz]),children:["pass"===e.status&&(0,b.jsx)("span",{className:n("test-pass-text",[nA,nU]),children:"✓"}),"fail"===e.status&&(0,b.jsx)("span",{className:n("test-fail-text",[nF,nU]),children:"✕"}),"idle"===e.status&&(0,b.jsx)("span",{className:n("test-idle-text",[nT,nU]),children:"○"}),(0,b.jsx)("span",{className:n("test-name-text",[nJ]),children:e.name}),void 0!==e.duration&&(0,b.jsxs)("span",{className:n("test-duration-text",[n_]),children:["(",e.duration," ms)"]})]},e.name)})})},nW=function(e){var t,n,r;return(t=Object.values(null!==(n=e.tests)&&void 0!==n?n:{})).concat.apply(t,Object.values(null!==(r=e.describes)&&void 0!==r?r:{}).map(nW))},nZ=function(e){return nW(e).reduce(function(e,t){return{pass:"pass"===t.status?e.pass+1:e.pass,fail:"fail"===t.status?e.fail+1:e.fail,skip:"idle"===t.status||"running"===t.status?e.skip+1:e.skip,total:e.total+1}},{pass:0,fail:0,skip:0,total:0})},nY=function(e){var t,n;return 0===Object.values(null!==(t=e.describes)&&void 0!==t?t:{}).length&&0===Object.values(null!==(n=e.tests)&&void 0!==n?n:{}).length},nq=function(e){var t=e.length-1;return[e.slice(0,t),e[t]]},nG=function(e,t){return e.map(t).reduce(function(e,t){return e.concat(t)},[])},nX=function(e,t){return function(n){return(0,P.default)(n,e,t)}},nK=eh({color:"$colors$hover",marginBottom:"$space$2"}),nQ=eh({marginLeft:"$space$4"}),n0=function(e){var t=e.describes,n=eS();return(0,b.jsx)(b.Fragment,{children:t.map(function(e){if(nY(e))return null;var t,r,o=Object.values(null!==(t=e.tests)&&void 0!==t?t:{}),i=Object.values(null!==(r=e.describes)&&void 0!==r?r:{});return(0,b.jsxs)("div",{className:n("test-describe",[nQ]),children:[(0,b.jsx)("div",{className:n("test-name",[nK]),children:e.name}),(0,b.jsx)(nV,{tests:o}),(0,b.jsx)(n0,{describes:i})]},e.name)})})},n1=eh({color:"$colors$hover",fontSize:"$font$size",padding:"$space$2",whiteSpace:"pre-wrap"}),n3=function(e){var t=e.error,n=e.path,r=eS();return(0,b.jsx)("div",{className:r("test-error",[n1]),dangerouslySetInnerHTML:{__html:n6(t,n)}})},n2=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},n6=function(e,t){var n="";if(n=e.matcherResult?"".concat(n2(e.message).replace(/(expected)/m,'$1')).replace(/(received)/m,'$1')).replace(/(Difference:)/m,"$1").replace(/(Expected:)(.*)/m,'$1$2')).replace(/(Received:)(.*)/m,'$1$2')).replace(/^(-.*)/gm,'$1')).replace(/^(\+.*)/gm,'$1')),""):n2(e.message),e.mappedErrors&&e.mappedErrors[0]&&e.mappedErrors[0].fileName.endsWith(t)&&e.mappedErrors[0]._originalScriptCode){var r=e.mappedErrors[0]._originalScriptCode||[],o=Math.max.apply(Math,r.map(function(e){return(e.lineNumber+"").length}))+2,i=Array.from({length:o}).map(function(){return" "});n+="

",r.filter(function(e){return e.content.trim()}).forEach(function(e){var t=(e.lineNumber+"").length,r=_([],i,!0);r.length-=t,e.highlight&&(r.length-=2);var s=e.content.indexOf(".to"),a=Array.from({length:i.length+s-(o-1)},function(){return" "}),c=n2(e.content).replace(/(describe|test|it)(\()('|"|`)(.*)('|"|`)/m,'$1$2$3$4$5')).replace(/(expect\()(.*)(\)\..*)(to[\w\d]*)(\()(.*)(\))/m,'$1$2$3$4$5$6$7'));n+="
")+(e.highlight?'> '):"")+r.join("")+n2(""+e.lineNumber)+" | "+c+"
"+(e.highlight?"
"+i.join("")+" | "+a.join("")+'^')+"
":"")}),n+="
"}return n.replace(/(?:\r\n|\r|\n)/g,"
")},n5=eh({display:"flex",flexDirection:"row",alignItems:"center",marginBottom:"$space$2"}),n4=eh({marginBottom:"$space$2"}),n7=eh({fontWeight:"bold"}),n8=eh({borderRadius:"calc($border$radius / 2)"}),n9=eh({padding:"$space$1 $space$2",fontFamily:"$font$mono",textTransform:"uppercase",marginRight:"$space$2"}),re=eh({fontFamily:"$font$mono",cursor:"pointer",display:"inline-block"}),rt=eh({color:"$colors$clickable",textDecorationStyle:"dotted",textDecorationLine:"underline"}),rn=eh({color:"$colors$hover",fontWeight:"bold",textDecorationStyle:"dotted",textDecorationLine:"underline"}),rr=function(e){var t=e.specs,n=e.openSpec,r=e.status,o=e.verbose,i=e.hideTestsAndSupressLogs,s=eS();return(0,b.jsx)(b.Fragment,{children:t.map(function(e){if(e.error)return(0,b.jsxs)("div",{className:s("test-spec",[n4]),children:[(0,b.jsx)(ro,{className:s("test-spec-error",[n8,nH]),children:"Error"}),(0,b.jsx)(ri,{onClick:function(){return n(e.name)},path:e.name}),(0,b.jsx)(n3,{error:e.error,path:e.name})]},e.name);if(nY(e))return null;var t=Object.values(e.tests),a=Object.values(e.describes),c=nZ(e);return(0,b.jsxs)("div",{className:s("test-spec-name",[n4]),children:[(0,b.jsxs)("div",{className:s("test-spec-name-container",[n5]),children:["complete"===r?c.fail>0?(0,b.jsx)(ro,{className:s("test-spec-complete",[n8,nH]),children:"Fail"}):(0,b.jsx)(ro,{className:s("test-spec-pass",[n8,nP]),children:"Pass"}):(0,b.jsx)(ro,{className:s("test-spec-run",[n8,nD]),children:"Run"}),(0,b.jsx)(ri,{onClick:function(){i||n(e.name)},path:e.name})]}),o&&!i&&(0,b.jsx)(nV,{tests:t}),o&&!i&&(0,b.jsx)(n0,{describes:a}),!i&&nW(e).filter(function(e){return"fail"===e.status}).map(function(e){return(0,b.jsxs)("div",{className:s("test-spec-error",[n4]),children:[(0,b.jsxs)("div",{className:s("test-spec-error-text",[n7,nF]),children:["● ",e.blocks.join(" › ")," › ",e.name]}),e.errors.map(function(t){return(0,b.jsx)(n3,{error:t,path:e.path},"failing-".concat(e.name,"-error"))})]},"failing-".concat(e.name))})]},e.name)})})},ro=function(e){var t=e.children,n=e.className,r=eS();return(0,b.jsx)("span",{className:r("test-spec-label",[n9,n]),children:t})},ri=function(e){var t=e.onClick,n=e.path.split("/"),r=n.slice(0,n.length-1).join("/")+"/",o=n[n.length-1],i=eS();return(0,b.jsxs)("button",{className:i("test-filename",[ti,re]),onClick:t,type:"button",children:[(0,b.jsx)("span",{className:i("test-filename-base",[rt]),children:r}),(0,b.jsx)("span",{className:i("test-filename-file",[rn]),children:o})]})},rs=eh({marginBottom:"$space$2"}),ra=eh({fontWeight:"bold",color:"$colors$hover",whiteSpace:"pre-wrap"}),rc=eh({fontWeight:"bold",color:"$colors$clickable"}),rl=function(e){var t=e.suites,n=e.tests,r=e.duration,o="Test suites: ",i=function(e){var t=Array.from({length:o.length-e.length},function(){return" "}).join("");return e+t},s=eS();return(0,b.jsxs)("div",{className:s("test-summary",[rc]),children:[(0,b.jsxs)("div",{className:s("test-summary",[rs]),children:[(0,b.jsx)("span",{className:s("test-summary-suites-label",[ra]),children:o}),t.fail>0&&(0,b.jsxs)("span",{className:s("test-summary-suites-fail",[nF]),children:[t.fail," failed,"," "]}),t.pass>0&&(0,b.jsxs)("span",{className:s("test-summary-suites-pass",[nA]),children:[t.pass," passed,"," "]}),(0,b.jsxs)("span",{children:[t.total," total"]})]}),(0,b.jsxs)("div",{className:s("test-summary",[rs]),children:[(0,b.jsx)("span",{className:s("test-summary-label",[ra]),children:i("Tests:")}),n.fail>0&&(0,b.jsxs)("span",{className:s("test-summary-fail",[nF]),children:[n.fail," failed,"," "]}),n.skip>0&&(0,b.jsxs)("span",{className:s("test-summary-skip",[nT]),children:[n.skip," skipped,"," "]}),n.pass>0&&(0,b.jsxs)("span",{className:s("test-summary-pass",[nA]),children:[n.pass," passed,"," "]}),(0,b.jsxs)("span",{children:[n.total," total"]})]}),(0,b.jsxs)("div",{className:s("test-summary-curation",[ra]),children:[i("Time:"),r/1e3,"s"]})]})},rd=eh({display:"flex",position:"absolute",bottom:"$space$2",right:"$space$2",zIndex:"$overlay","> *":{marginLeft:"$space$2"}}),ru={specs:{},status:"initialising",verbose:!1,watchMode:!0,suiteOnly:!1,specsCount:0},rp=function(e){var t,n=e.verbose,r=e.watchMode,o=e.style,i=e.className,s=e.onComplete,a=e.actionsChildren,c=e.showVerboseButton,l=e.showWatchButton,d=e.hideTestsAndSupressLogs,u=void 0!==d&&d,p=B(e,["verbose","watchMode","style","className","onComplete","actionsChildren","showVerboseButton","showWatchButton","hideTestsAndSupressLogs"]),f=t$(),m=tY(),v=m.getClient,h=m.iframe,g=m.listen,x=m.sandpack,j=y.useState(H(H({},ru),{verbose:void 0!==n&&n,watchMode:void 0===r||r})),w=j[0],$=j[1],C=y.useCallback(function(){$(function(e){return H(H({},e),{status:"running",specs:{}})});var e=v();e&&e.dispatch({type:"run-all-tests"})},[v]),k=y.useCallback(function(){$(function(e){return H(H({},e),{status:"running",specs:{}})});var e=v();e&&e.dispatch({type:"run-tests",path:x.activeFile})},[v,x.activeFile]),S=/.*\.(test|spec)\.[tj]sx?$/,N=null!==x.activeFile.match(S);y.useEffect(function(){var e=[],t="";return g(function(n){if(!w.suiteOnly||(!("path"in n)||n.path===x.activeFile)&&(!("test"in n)||!("path"in n.test)||n.test.path===x.activeFile)){if("action"===n.type&&"clear-errors"===n.action&&"jest"===n.source){t=n.path;return}if("test"===n.type){if("initialize_tests"===n.event)return(e=[],t="",w.watchMode)?C():$(function(e){return H(H({},e),{status:"idle",specs:{}})});if("test_count"===n.event)return $(function(e){return H(H({},e),{specsCount:n.count})});if("total_test_start"===n.event)return e=[],$(function(e){return H(H({},e),{status:"running"})});if("total_test_end"===n.event)return $(function(e){return void 0!==s&&s(e.specs),H(H({},e),{status:"complete"})});if("add_file"===n.event)return $(nX(["specs",n.path],{describes:{},tests:{},name:n.path}));if("remove_file"===n.event)return $(function(e){var t=Object.entries(e.specs).reduce(function(e,t){var r,o=t[0],i=t[1];return o===n.path?e:H(H({},e),((r={})[o]=i,r))},{});return H(H({},e),{specs:t})});if("file_error"===n.event)return $(nX(["specs",n.path,"error"],n.error));if("describe_start"===n.event){e.push(n.blockName);var r=nq(e),o=r[0],i=r[1],a=t;if(void 0===i)return;return $(nX(_(_(["specs",a,"describes"],nG(o,function(e){return[e,"describes"]}),!0),[i],!1),{name:n.blockName,tests:{},describes:{}}))}if("describe_end"===n.event){e.pop();return}if("add_test"===n.event){var c=nq(e),o=c[0],i=c[1],l={status:"idle",errors:[],name:n.testName,blocks:_([],e,!0),path:n.path};return void 0===i?$(nX(["specs",n.path,"tests",n.testName],l)):$(nX(_(_(["specs",n.path,"describes"],nG(o,function(e){return[e,"describes"]}),!0),[i,"tests",n.testName],!1),l))}if("test_start"===n.event){var d=n.test,u=nq(d.blocks),o=u[0],i=u[1],p={status:"running",name:d.name,blocks:d.blocks,path:d.path,errors:[]};return void 0===i?$(nX(["specs",d.path,"tests",d.name],p)):$(nX(_(_(["specs",d.path,"describes"],nG(o,function(e){return[e,"describes"]}),!0),[i,"tests",d.name],!1),p))}if("test_end"===n.event){var f=n.test,m=nq(f.blocks),o=m[0],i=m[1],v={status:f.status,errors:f.errors,duration:f.duration,name:f.name,blocks:f.blocks,path:f.path};return void 0===i?$(nX(["specs",f.path,"tests",f.name],v)):$(nX(_(_(["specs",f.path,"describes"],nG(o,function(e){return[e,"describes"]}),!0),[i,"tests",f.name],!1),v))}}}})},[w.suiteOnly,w.watchMode,x.activeFile]),y.useEffect(function(){return g(function(e){"done"===e.type&&w.watchMode&&(N?k():C())})},[k,C,w.watchMode,N]);var E=Object.values(w.specs),O=nG(E,nW).reduce(function(e,t){return e+(t.duration||0)},0),M=E.map(nZ).reduce(function(e,t){return{pass:e.pass+t.pass,fail:e.fail+t.fail,skip:e.skip+t.skip,total:e.total+t.total}},{pass:0,skip:0,fail:0,total:0}),L=E.filter(function(e){var t,n;return Object.values(null!==(t=e.describes)&&void 0!==t?t:{}).length>0||Object.values(null!==(n=e.tests)&&void 0!==n?n:{}).length>0}).map(nZ).reduce(function(e,t){return{pass:e.pass+(0===t.fail?1:0),fail:e.fail+(t.fail>0?1:0),total:e.total+1}},{pass:0,fail:0,total:0}),A=eS();return(0,b.jsxs)(tw,H({className:A("tests",[i]),style:H(H({},{"--test-pass":(t="dark"===f.themeMode)?"#18df16":"#15c213","--test-fail":t?"#df162b":"#c21325","--test-skip":t?"#eace2b":"#c2a813","--test-run":t?"#eace2b":"#c2a813","--test-title":t?"#3fbabe":"#256c6f"}),o)},p,{children:[(0,b.jsx)("iframe",{ref:h,style:{display:"none"},title:"Sandpack Tests"}),(0,b.jsx)(nO,{hideTestsAndSupressLogs:u,setSuiteOnly:function(){return $(function(e){return H(H({},e),{suiteOnly:!e.suiteOnly})})},setVerbose:function(){return $(function(e){return H(H({},e),{verbose:!e.verbose})})},setWatchMode:function(){$(function(e){return H(H({},e),{watchMode:!e.watchMode})})},showSuitesOnly:w.specsCount>1,showVerboseButton:void 0===c||c,showWatchButton:void 0===l||l,status:w.status,suiteOnly:w.suiteOnly,verbose:w.verbose,watchMode:w.watchMode}),"running"===w.status||"initialising"===w.status?(0,b.jsx)(nr,{showOpenInCodeSandbox:!1}):(0,b.jsxs)("div",{className:rd.toString(),children:[a,(0,b.jsx)(nM,{onClick:w.suiteOnly?k:C})]}),(0,b.jsx)("div",{className:rf.toString(),children:0===E.length&&"complete"===w.status?(0,b.jsxs)("div",{className:rm.toString(),children:[(0,b.jsx)("p",{children:"No test files found."}),(0,b.jsxs)("p",{children:["Test match:"," ",(0,b.jsx)("span",{className:nF.toString(),children:S.toString()})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(rr,{hideTestsAndSupressLogs:u,openSpec:function(e){x.setActiveFile(e)},specs:E,status:w.status,verbose:w.verbose}),"complete"===w.status&&M.total>0&&(0,b.jsx)(rl,{duration:O,suites:L,tests:M})]})})]}))},rf=eh({padding:"$space$4",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",position:"relative",fontFamily:"$font$mono"}),rm=eh({fontWeight:"bold",color:"$colors$base"}),rv=["SyntaxError: ","Error in sandbox:"],rh={id:"random",method:"clear",data:["Console was cleared"]},rg=(0,eval)("this"),rx="function"==typeof ArrayBuffer,rb="function"==typeof Map,ry="function"==typeof Set;!function(e){e[e.infinity=0]="infinity",e[e.minusInfinity=1]="minusInfinity",e[e.minusZero=2]="minusZero"}(g||(g={}));var rj={Arithmetic:function(e){return e===g.infinity?1/0:e===g.minusInfinity?-1/0:e===g.minusZero?-0:e},HTMLElement:function(e){var t=document.implementation.createHTMLDocument("sandbox");try{var n=t.createElement(e.tagName);n.innerHTML=e.innerHTML;for(var r=0,o=Object.keys(e.attributes);r2)return r;var o=Object.entries(e),i=Object.entries(e).reduce(function(e,r,i){var s=r[0],a=r[1],c=o.length>10?"\n ":"",l=rk(a,t,n);return 400===i?e+c+"...":i>400?e:e+"".concat(0===i?"":", ").concat(c).concat(s,": ")+l},"");return"".concat(r,"{ ").concat(i).concat(o.length>10?"\n":" ","}")},rk=function(e,t,n){var r;void 0===n&&(n=0);try{var o=rw(e);if(Array.isArray(o))return r$(o,t,n+1);switch(typeof o){case"string":return'"'.concat(o,'"').slice(0,1e4);case"number":case"function":case"symbol":return o.toString();case"boolean":return String(o);case"undefined":return"undefined";default:if(o instanceof RegExp||o instanceof Error||o instanceof Date)return o.toString();if(null===o)return String(null);if(o instanceof HTMLElement)return o.outerHTML.slice(0,1e4);if(0===Object.entries(o).length)return"{}";if("@r"in o){if(n>2)return"Unable to print information";var i=t[o["@r"]];return rk(i,t,n+1)}if((null===(r=o.constructor)||void 0===r?void 0:r.name)==="NodeList"){var s=o.length,a=Array(s).fill(null).map(function(e,n){return rk(o[n],t)});return"NodeList(".concat(o.length,")[").concat(a,"]")}return rC(o,t,n+1)}}catch(e){return"Unable to print information"}},rS=function(e){switch(e){case"warn":return"warning";case"clear":return"clear";case"error":return"error";default:return"info"}},rN=function(e){var t=e.data,n=eS();return(0,b.jsx)(b.Fragment,{children:t.map(function(e,t,r){var o=e.data,i=e.id,s=e.method;return o&&Array.isArray(o)?(0,b.jsx)(y.Fragment,{children:o.map(function(e,o){var a=r.slice(t,r.length);return(0,b.jsx)("div",{className:n("console-item",[rE({variant:rS(s)})]),children:(0,b.jsx)(tP,{code:"clear"===s?e:rk(e,a),fileType:"js",initMode:"user-visible",showReadOnly:!1,readOnly:!0,wrapContent:!0})},"".concat(i,"-").concat(o))})},i):null})})},rE=eh(((x={width:"100%",padding:"$space$3 $space$2",fontSize:".8em",position:"relative","&:not(:first-child):after":{content:"",position:"absolute",top:0,left:0,right:0,height:1,background:"$colors$surface3"},".sp-cm":{padding:0},".cm-editor":{background:"none"},".cm-content":{padding:0}})[".".concat("sp","-pre-placeholder")]={margin:"0 !important",fontSize:"1em"},x.variants={variant:{error:{color:"$colors$error",background:"$colors$errorSurface","&:not(:first-child):after":{background:"$colors$error",opacity:.07}},warning:{color:"$colors$warning",background:"$colors$warningSurface","&:not(:first-child):after":{background:"$colors$warning",opacity:.07}},clear:{fontStyle:"italic"},info:{}}},x)),rO=eh({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"}),rM=eh({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"}),rL=function(e){var t=e.currentTab,n=e.setCurrentTab,r=e.node,o=eS(),i=o("console-header-button",[ti,ts,eh({padding:"$space$1 $space$3"})]);return(0,b.jsxs)("div",{className:o("console-header",[rO,rM]),children:[(0,b.jsxs)("p",{className:o("console-header-title",[eh({lineHeight:1,margin:0,color:"$colors$base",fontSize:"$font$size",display:"flex",alignItems:"center",gap:"$space$2"})]),children:[(0,b.jsx)(eo,{}),(0,b.jsx)("span",{children:"Terminal"})]}),r&&(0,b.jsxs)("div",{className:o("console-header-actions",[rM]),children:[(0,b.jsx)("button",{className:i,"data-active":"server"===t,onClick:function(){return n("server")},type:"button",children:"Server"}),(0,b.jsx)("button",{className:i,"data-active":"client"===t,onClick:function(){return n("client")},type:"button",children:"Client"})]})]})},rA=function(e){var t=e.clientId,n=e.maxMessageCount,r=void 0===n?800:n,o=e.showSyntaxError,i=void 0!==o&&o,s=e.resetOnPreviewRestart,a=void 0!==s&&s,c=y.useState([]),l=c[0],d=c[1],u=tn().listen;return y.useEffect(function(){return u(function(e){if(a&&"start"===e.type)d([]);else if("console"===e.type&&e.codesandbox){var t=Array.isArray(e.log)?e.log:[e.log];if(t.find(function(e){return"clear"===e.method}))return d([rh]);var n=i?t:t.filter(function(e){var t,n,r;return(null!==(r=null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.filter)||void 0===n?void 0:n.call(t,function(e){return"string"!=typeof e||0===rv.filter(function(t){return e.startsWith(t)}).length}))&&void 0!==r?r:[]).length>0});if(!n)return;d(function(e){for(var t=_(_([],e,!0),n,!0).filter(function(e,t,n){return t===n.findIndex(function(t){return t.id===e.id})});t.length>r;)t.shift();return t})}},t)},[i,r,t,a]),{logs:l,reset:function(){return d([])}}},rF=y.forwardRef(function(e,t){var n,r=e.showHeader,o=e.showSyntaxError,i=e.maxMessageCount,s=e.onLogsChange,a=e.className;e.showSetupProgress;var c=e.showResetConsoleButton,l=e.showRestartButton,d=e.resetOnPreviewRestart,u=void 0!==d&&d,p=e.actionsChildren,f=void 0===p?(0,b.jsx)(b.Fragment,{}):p,m=e.standalone,v=void 0!==m&&m,h=B(e,["showHeader","showSyntaxError","maxMessageCount","onLogsChange","className","showSetupProgress","showResetConsoleButton","showRestartButton","resetOnPreviewRestart","actionsChildren","standalone"]),g=tn().sandpack.environment,x=tY(),j=x.iframe,w=x.clientId,$=tq().restart,C=y.useState("node"===g?"server":"client"),k=C[0],S=C[1],N=v?w:void 0,E=rA({maxMessageCount:i,showSyntaxError:void 0!==o&&o,resetOnPreviewRestart:u,clientId:N}),O=E.logs,M=E.reset,L=tK({maxMessageCount:i,resetOnPreviewRestart:u,clientId:N}),A=L.logs,F=L.reset,T=y.useRef(null);y.useEffect(function(){null==s||s(O),T.current&&(T.current.scrollTop=T.current.scrollHeight)},[s,O,A,k]);var R="server"===k,I="node"===g;y.useImperativeHandle(t,function(){return{reset:function(){M(),F()}}});var D=eS();return(0,b.jsxs)(tw,H({className:D("console",[eh(((n={height:"100%",background:"$surface1",iframe:{display:"none"}})[".".concat("sp","-bridge-frame")]={display:"block",border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},n)),a])},h,{children:[(void 0===r||r)&&I&&(0,b.jsx)(rL,{currentTab:k,node:I,setCurrentTab:S}),(0,b.jsx)("div",{ref:T,className:D("console-list",[eh({overflow:"auto",scrollBehavior:"smooth"})]),children:R?(0,b.jsx)(t2,{data:A}):(0,b.jsx)(rN,{data:O})}),(0,b.jsxs)("div",{className:D("console-actions",[eh({position:"absolute",bottom:"$space$2",right:"$space$2",display:"flex",gap:"$space$2"})]),children:[f,(void 0===l||l)&&R&&(0,b.jsx)(tx,{onClick:function(){$(),M(),F()},children:(0,b.jsx)(Z,{})}),(void 0===c||c)&&(0,b.jsx)(tx,{onClick:function(){"client"===k?M():F()},children:(0,b.jsx)(K,{})})]}),v&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(nc,{clientId:N}),(0,b.jsx)("iframe",{ref:j})]})]}))}),rT=function(e){var t,n,r,o,i,s,a,c,l=e.options,d=e.template,u=e.customSetup,p=e.files,f=e.theme,m=B(e,["options","template","customSetup","files","theme"]);null!=l||(l={}),null!==(t=l.resizablePanels)&&void 0!==t||(l.resizablePanels=!0),null!==(n=l.editorWidthPercentage)&&void 0!==n||(l.editorWidthPercentage=50),null!==(r=l.showConsole)&&void 0!==r||(l.showConsole=!1);var v=null!==(o=null==l?void 0:l.rtl)&&void 0!==o&&o,h={showTabs:l.showTabs,showLineNumbers:l.showLineNumbers,showInlineErrors:l.showInlineErrors,wrapContent:l.wrapContent,closableTabs:l.closableTabs,initMode:l.initMode,extensions:null===(i=l.codeEditor)||void 0===i?void 0:i.extensions,extensionsKeymap:null===(s=l.codeEditor)||void 0===s?void 0:s.extensionsKeymap,readOnly:l.readOnly,showReadOnly:l.showReadOnly,additionalLanguages:null===(a=l.codeEditor)||void 0===a?void 0:a.additionalLanguages},g={activeFile:l.activeFile,visibleFiles:l.visibleFiles,recompileMode:l.recompileMode,recompileDelay:l.recompileDelay,autorun:l.autorun,autoReload:l.autoReload,bundlerURL:l.bundlerURL,startRoute:l.startRoute,skipEval:l.skipEval,fileResolver:l.fileResolver,initMode:l.initMode,initModeObserverOptions:l.initModeObserverOptions,externalResources:l.externalResources,logLevel:l.logLevel,classes:l.classes},x=y.useState(l.showConsole),j=x[0],w=x[1],$=y.useState(0),C=$[0],k=$[1],S=l.showConsole||l.showConsoleButton,N=null!==(c=e1[d])&&void 0!==c?c:{},E=(null==l?void 0:l.layout)?null==l?void 0:l.layout:"mode"in N?N.mode:"preview",O=l.showConsoleButton?(0,b.jsx)(rI,{counter:C,onClick:function(){return w(function(e){return!e})}}):void 0,M=y.useRef(null),L=y.useState(l.editorWidthPercentage),A=L[0],F=L[1],T=y.useState(70),R=T[0],I=T[1],D=S?tw:y.Fragment,P={flexGrow:100-A,flexShrink:100-A,flexBasis:0,width:100-A+"%",gap:j?1:0,height:l.editorHeight},z=S?{flexGrow:R,flexShrink:R,flexBasis:0,overflow:"hidden"}:P,J=function(e){if(M.current){var t=M.current.parentElement;if(t){var n="horizontal"===M.current.dataset.direction,r=t.getBoundingClientRect(),o=r.left,i=r.top,s=r.height,a=r.width,c=Math.min(Math.max(n?(e.clientX-o)/a*100:(e.clientY-i)/s*100,25),75);n?F(v?100-c:c):I(c),t.querySelectorAll(".".concat("sp","-stack")).forEach(function(e){e.style.pointerEvents="none"})}}},_=function(){var e,t=null===(e=M.current)||void 0===e?void 0:e.parentElement;t&&(t.querySelectorAll(".".concat("sp","-stack")).forEach(function(e){e.style.pointerEvents=""}),M.current=null)};y.useEffect(function(){if(null==l?void 0:l.resizablePanels)return document.body.addEventListener("mousemove",J),document.body.addEventListener("mouseup",_),function(){document.body.removeEventListener("mousemove",J),document.body.removeEventListener("mouseup",_)}},[l]),y.useEffect(function(){var e;w(null!==(e=null==l?void 0:l.showConsole)&&void 0!==e&&e)},[l.showConsole]);var U=S?{className:"sp-preset-column",style:P}:{},V=eS();return(0,b.jsx)(te,H({customSetup:u,files:p,options:g,template:d,theme:f},m,{children:(0,b.jsxs)(tJ,{className:v?V("rtl-layout",[rH]):"",children:[(0,b.jsx)(tH,H({},h,{style:{height:l.editorHeight,flexGrow:A,flexShrink:A,flexBasis:0,overflow:"hidden"}})),l.resizablePanels&&(0,b.jsx)("div",{className:V("resize-handler",[rR({direction:"horizontal"})]),"data-direction":"horizontal",onMouseDown:function(e){M.current=e.target},style:{left:"calc(".concat(v?100-A:A,"% - 5px)")}}),(0,b.jsxs)(D,H({},U,{children:["preview"===E&&(0,b.jsx)(nC,{actionsChildren:O,showNavigator:l.showNavigator,showRefreshButton:l.showRefreshButton,style:z}),"tests"===E&&(0,b.jsx)(rp,{actionsChildren:O,style:z}),"console"===E&&(0,b.jsx)(rF,{actionsChildren:O,style:z,standalone:!0}),(l.showConsoleButton||j)&&(0,b.jsxs)(b.Fragment,{children:[l.resizablePanels&&j&&(0,b.jsx)("div",{className:V("resize-handler",[rR({direction:"vertical"})]),"data-direction":"vertical",onMouseDown:function(e){M.current=e.target},style:{top:"calc(".concat(R,"% - 5px)")}}),(0,b.jsx)("div",{className:V("console-wrapper",[rP]),style:{flexGrow:j?100-R:0,flexShrink:j?100-R:0,flexBasis:0},children:(0,b.jsx)(rF,{onLogsChange:function(e){return k(e.length)},showHeader:!1})})]})]}))]})}),d)},rR=eh({position:"absolute",zIndex:"$top",variants:{direction:{vertical:{right:0,left:0,height:10,cursor:"ns-resize"},horizontal:{top:0,bottom:0,width:10,cursor:"ew-resize"}}},"@media screen and (max-width: 768px)":{display:"none"}}),rI=function(e){var t=e.onClick,n=e.counter;return(0,b.jsxs)(tx,{className:rD.toString(),onClick:t,children:[(0,b.jsx)(eo,{}),n>0&&(0,b.jsx)("strong",{children:n})]})},rD=eh({position:"relative",strong:{background:"$colors$clickable",color:"$colors$surface1",minWidth:12,height:12,padding:"0 2px",borderRadius:12,fontSize:8,lineHeight:"12px",position:"absolute",top:0,right:0,fontWeight:"normal"}}),rP=eh({width:"100%",overflow:"hidden"}),rH=eh({flexDirection:"row-reverse","@media screen and (max-width: 768px)":{flexFlow:"wrap-reverse !important",flexDirection:"initial"}})}}]); //# sourceMappingURL=be27e3b5.bf28973a6a337868.js.map