https://cdn.opal.optimizely.com/opal-chat/vendor.codesandbox-sandpack-client.0c08f357f934bfee8d05.js
1try{let t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="5e8db4bc-16c5-4afe-95ad-515e6daa246c",t._sentryDebugIdIdentifier="sentry-dbid-5e8db4bc-16c5-4afe-95ad-515e6daa246c")}catch(t){}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"2cd8d095"},(self.webpackChunkOpalChat=self.webpackChunkOpalChat||[]).push([[1599],{TFe8:(t,e,r)=>{r.d(e,{S:()=>o});var n=r("D6cf"),o=function(){function t(t,e,r){void 0===r&&(r={}),this.status="idle",this.options=r,this.sandboxSetup=e,this.iframeSelector=t}return t.prototype.updateOptions=function(t){(0,n.j)(this.options,t)||(this.options=t,this.updateSandbox())},t.prototype.updateSandbox=function(t,e){throw void 0===t&&(t=this.sandboxSetup),Error("Method not implemented")},t.prototype.destroy=function(){throw Error("Method not implemented")},t.prototype.dispatch=function(t){throw Error("Method not implemented")},t.prototype.listen=function(t){throw Error("Method not implemented")},t}()},"/y3F":(t,e,r)=>{r.r(e),r.d(e,{SandpackNode:()=>u});var n=r("Qm2c"),o=r("jCcd"),i=r("TFe8"),a=r("Dnt+");function s(t,e){return(0,n._)(this,void 0,void 0,(function(){var r,o,i;return(0,n.a)(this,(function(a){return r=t.contentWindow,(0,n.n)(r,"Failed to await preview iframe: no content window found"),o=0,[2,new Promise((function(r,a){var s=function(){var c=function(){clearTimeout(i),o=20,r(),t.removeEventListener("load",c)};o>=20?a((0,n.c)("Could not able to connect to preview.")):(t.setAttribute("src",e),i=setTimeout((function(){s(),t.removeEventListener("load",c)}),9e4),o+=1,t.addEventListener("load",c))};t.addEventListener("error",(function(){return a(new Error("Iframe error"))})),t.addEventListener("abort",(function(){return a(new Error("Aborted"))})),s()}))]}))}))}r("72gZ"),r("D6cf");var c=[{code:function(t){var e=t.scope,r=window.history.__proto__,n=[],o=0,i=function(t){parent.postMessage({type:"urlchange",url:t,back:o>0,forward:o<n.length-1,channelId:e.channelId},"*")};Object.assign(window.history,{go:function(t){var e=o+t;if(e>=0&&e<=n.length-1){var a=n[o=e],s=a.url,c=a.state;r.replaceState.call(window.history,c,"",s);var u=document.location.href;i(u),window.dispatchEvent(new PopStateEvent("popstate",{state:c}))}},back:function(){window.history.go(-1)},forward:function(){window.history.go(1)},pushState:function(t,e,a){r.replaceState.call(window.history,t,e,a),function(t,e){n.splice(o+1),n.push({url:t,state:e}),o=n.length-1}(a,t),i(document.location.href)},replaceState:function(t,e,a){r.replaceState.call(window.history,t,e,a),n[o]={state:t,url:a},i(document.location.href)}}),window.addEventListener("message",(function(t){var e=t.data;"urlback"===e.type?history.back():"urlforward"===e.type?history.forward():"refresh"===e.type&&document.location.reload()}))}.toString(),id:"historyListener"},{code:"function consoleHook({ scope }) {"+a.c+"\n};",id:"consoleHook"},{code:function(t){var e,r=t.scope,n=0;function o(){var t=function(){if("undefined"==typeof window)return 0;var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.offsetHeight)}();n!==t&&window.parent.postMessage({type:"resize",height:t,codesandbox:!0,channelId:r.channelId},"*"),n=t}o(),new MutationObserver((function(){void 0===e&&(o(),e=setTimeout((function(){e=void 0}),300))})).observe(document,{attributes:!0,childList:!0,subtree:!0}),setInterval(o,300)}.toString(),id:"watchResize"}],u=function(t){function e(e,r,i){void 0===i&&(i={});var s=t.call(this,e,r,(0,n.h)((0,n.h)({},i),{bundlerURL:i.bundlerURL}))||this;return s._modulesCache=new Map,s.messageChannelId=(0,a.g)(),s._initPromise=null,s.emitter=new a.E,s.manageIframes(e),s.emulator=new o.YQ({iframe:s.emulatorIframe,runtimeUrl:s.options.bundlerURL}),s.updateSandbox(r),s}return(0,n.g)(e,t),e.prototype._init=function(t){return(0,n._)(this,void 0,void 0,(function(){return(0,n.a)(this,(function(e){switch(e.label){case 0:return[4,this.emulator.connect()];case 1:return e.sent(),[4,this.emulator.fs.init(t)];case 2:return e.sent(),[4,this.globalListeners()];case 3:return e.sent(),[2]}}))}))},e.prototype.compile=function(t){return(0,n._)(this,void 0,void 0,(function(){var e,r;return(0,n.a)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),this.status="initializing",this.dispatch({type:"start",firstLoad:!0}),this._initPromise||(this._initPromise=this._init(t)),[4,this._initPromise];case 1:return n.sent(),this.dispatch({type:"connected"}),[4,this.createShellProcessFromTask(t)];case 2:return e=n.sent().id,[4,this.createPreviewURLFromId(e)];case 3:return n.sent(),[4,this.setLocationURLIntoIFrame()];case 4:return n.sent(),this.dispatchDoneMessage(),[3,6];case 5:return r=n.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:(0,a.a)(r)}),this.dispatch({type:"done",compilatonError:!0}),[3,6];case 6:return[2]}}
1))}))},e.prototype.createShellProcessFromTask=function(t){return(0,n._)(this,void 0,void 0,(function(){var e,r,o=this;return(0,n.a)(this,(function(i){switch(i.label){case 0:return e=(0,a.r)(t["/package.json"]),this.emulatorCommand=(0,a.b)(e),this.emulatorShellProcess=this.emulator.shell.create(),[4,this.emulatorShellProcess.on("exit",(function(t){o.dispatch({type:"action",action:"notification",notificationType:"error",title:(0,n.c)("Error: process.exit(".concat(t,") called."))})}))];case 1:return i.sent(),[4,this.emulatorShellProcess.on("progress",(function(t){var e,r;if("command_running"===t.state||"starting_command"===t.state)return o.dispatch({type:"shell/progress",data:(0,n.h)((0,n.h)({},t),{command:[null===(e=o.emulatorCommand)||void 0===e?void 0:e[0],null===(r=o.emulatorCommand)||void 0===r?void 0:r[1].join(" ")].join(" ")})}),void(o.status="installing-dependencies");o.dispatch({type:"shell/progress",data:t})}))];case 2:return i.sent(),this.emulatorShellProcess.stdout.on("data",(function(t){o.dispatch({type:"stdout",payload:{data:t,type:"out"}})})),this.emulatorShellProcess.stderr.on("data",(function(t){o.dispatch({type:"stdout",payload:{data:t,type:"err"}})})),[4,(r=this.emulatorShellProcess).runCommand.apply(r,this.emulatorCommand)];case 3:return[2,i.sent()]}}))}))},e.prototype.createPreviewURLFromId=function(t){var e;return(0,n._)(this,void 0,void 0,(function(){var r;return(0,n.a)(this,(function(n){switch(n.label){case 0:return this.iframePreviewUrl=void 0,[4,this.emulator.preview.getByShellId(t)];case 1:return r=n.sent().url,this.iframePreviewUrl=r+(null!==(e=this.options.startRoute)&&void 0!==e?e:""),[2]}}))}))},e.prototype.manageIframes=function(t){var e,r,o;if("string"==typeof t){var i=document.querySelector(t);(0,n.n)(i,"The element '".concat(t,"' was not found")),this.iframe=document.createElement("iframe"),null==i||i.appendChild(this.iframe)}else this.iframe=t;r=this.iframe,o=this.options,r.style.border="0",r.style.width=o.width||"100%",r.style.height=o.height||"100%",r.style.overflow="hidden",r.allow="cross-origin-isolated",(0,n.n)(this.iframe.parentNode,"The given iframe does not have a parent."),this.emulatorIframe=document.createElement("iframe"),this.emulatorIframe.classList.add("sp-bridge-frame"),null===(e=this.iframe.parentNode)||void 0===e||e.appendChild(this.emulatorIframe)},e.prototype.setLocationURLIntoIFrame=function(){return(0,n._)(this,void 0,void 0,(function(){return(0,n.a)(this,(function(t){switch(t.label){case 0:return this.iframePreviewUrl?[4,s(this.iframe,this.iframePreviewUrl)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}
1))}))},e.prototype.dispatchDoneMessage=function(){this.status="done",this.dispatch({type:"done",compilatonError:!1}),this.iframePreviewUrl&&this.dispatch({type:"urlchange",url:this.iframePreviewUrl,back:!1,forward:!1})},e.prototype.globalListeners=function(){return(0,n._)(this,void 0,void 0,(function(){var t=this;return(0,n.a)(this,(function(e){switch(e.label){case 0:return window.addEventListener("message",(function(e){var r,n;e.data.type===o.wY&&(r=t.iframe,n=t.messageChannelId,c.forEach((function(t){var e,i=t.code,a={uid:t.id,type:o.vd,code:"exports.activate = ".concat(i),scope:{channelId:n}};null===(e=r.contentWindow)||void 0===e||e.postMessage(a,"*")}))),"urlchange"===e.data.type&&e.data.channelId===t.messageChannelId?t.dispatch({type:"urlchange",url:e.data.url,back:e.data.back,forward:e.data.forward}):e.data.channelId===t.messageChannelId&&t.dispatch(e.data)})),[4,this.emulator.fs.watch(["*"],[".next","node_modules","build","dist","vendor",".config",".vuepress"],(function(e){return(0,n._)(t,void 0,void 0,(function(){var t,r,o,i,s;return(0,n.a)(this,(function(n){switch(n.label){case 0:return e?(r="newPath"in(t=e)?t.newPath:"path"in t?t.path:"",[4,this.emulator.fs.stat(r)]):[2];case 1:if("file"!==n.sent().type)return[2,null];n.label=2;case 2:switch(n.trys.push([2,10,,11]),t.type){case"change":case"create":return[3,3];case"remove":return[3,5];case"rename":return[3,6];case"close":return[3,8]}return[3,9];case 3:return[4,this.emulator.fs.readFile(t.path,"utf8")];case 4:return o=n.sent(),this.dispatch({type:"fs/change",path:t.path,content:o}),this._modulesCache.set(t.path,(0,a.w)(o)),[3,9];case 5:return this.dispatch({type:"fs/remove",path:t.path}),this._modulesCache.delete(t.path),[3,9];case 6:return this.dispatch({type:"fs/remove",path:t.oldPath}),this._modulesCache.delete(t.oldPath),[4,this.emulator.fs.readFile(t.newPath,"utf8")];case 7:return i=n.sent(),this.dispatch({type:"fs/change",path:t.newPath,content:i}),this._modulesCache.set(t.newPath,(0,a.w)(i)),[3,9];case 8:return[3,9];case 9:return[3,11];case 10:return s=n.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:(0,a.a)(s)}),[3,11];case 11:return[2]}}
1))}))}))];case 1:return e.sent(),[2]}}))}))},e.prototype.restartShellProcess=function(){var t;return(0,n._)(this,void 0,void 0,(function(){return(0,n.a)(this,(function(e){switch(e.label){case 0:return this.emulatorShellProcess&&this.emulatorCommand?(this.dispatch({type:"start",firstLoad:!0}),this.status="initializing",[4,this.emulatorShellProcess.kill()]):[3,3];case 1:return e.sent(),null===(t=this.iframe)||void 0===t||t.removeAttribute("attr"),this.emulator.fs.rm("/node_modules/.vite",{recursive:!0,force:!0}),[4,this.compile(Object.fromEntries(this._modulesCache))];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},e.prototype.updateSandbox=function(t){var e,r=this,n=(0,a.f)(t.files);"running"!==(null===(e=this.emulatorShellProcess)||void 0===e?void 0:e.state)?(this.dispatch({codesandbox:!0,modules:n,template:t.template,type:"compile"}),Object.entries(n).forEach((function(t){var e=t[0],n=t[1];r._modulesCache.set(e,(0,a.w)(n))}))):Object.entries(n).forEach((function(t){var e=t[0],n=t[1];r._modulesCache.get(e)&&(0,a.r)(n)===(0,a.r)(r._modulesCache.get(e))||r.emulator.fs.writeFile(e,n,{recursive:!0})}))},e.prototype.dispatch=function(t){var e,r;return(0,n._)(this,void 0,void 0,(function(){return(0,n.a)(this,(function(n){switch(n.label){case 0:switch(t.type){case"compile":return[3,1];case"refresh":return[3,2];case"urlback":case"urlforward":return[3,4];case"shell/restart":return[3,5];case"shell/openPreview":return[3,6]}return[3,7];case 1:return this.compile(t.modules),[3,8];case 2:return[4,this.setLocationURLIntoIFrame()];case 3:return n.sent(),[3,8];case 4:return null===(r=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===r||r.postMessage(t,"*"),[3,8];case 5:return this.restartShellProcess(),[3,8];case 6:return window.open(this.iframePreviewUrl,"_blank"),[3,8];case 7:this.emitter.dispatch(t),n.label=8;case 8:return[2]}}
1))}))},e.prototype.listen=function(t){return this.emitter.listener(t)},e.prototype.destroy=function(){this.emulatorIframe.remove(),this.emitter.cleanup()},e}(i.S)},czUq:(t,e,r)=>{r.r(e),r.d(e,{SandpackRuntime:()=>O});for(var n=r("Qm2c"),o=r("D6cf"),i=r("TFe8"),a=r("uc13"),s=(r("72gZ"),function(){function t(t,e,r){var o=this;this.type=t,this.handleMessage=e,this.protocol=r,this._disposeMessageListener=this.protocol.channelListen((function(t){return(0,n._)(o,void 0,void 0,(function(){var e,r,o,i;return(0,n.a)(this,(function(n){switch(n.label){case 0:if(t.type!==this.getTypeId()||!t.method)return[3,4];e=t,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.handleMessage(e)];case 2:return r=n.sent(),i={type:this.getTypeId(),msgId:e.msgId,result:r},this.protocol.dispatch(i),[3,4];case 3:return o=n.sent(),i={type:this.getTypeId(),msgId:e.msgId,error:{message:o.message}},this.protocol.dispatch(i),[3,4];case 4:return[2]}}))}))}))}return t.prototype.getTypeId=function(){return"protocol-".concat(this.type)},t.prototype.dispose=function(){this._disposeMessageListener()},t}()),c=function(){function t(t,e){this.globalListeners={},this.globalListenersCount=0,this.channelListeners={},this.channelListenersCount=0,this.channelId=Math.floor(1e6*Math.random()),this.frameWindow=t.contentWindow,this.origin=e,this.globalListeners=[],this.channelListeners=[],this.eventListener=this.eventListener.bind(this),"undefined"!=typeof window&&window.addEventListener("message",this.eventListener)}return t.prototype.cleanup=function(){window.removeEventListener("message",this.eventListener),this.globalListeners={},this.channelListeners={},this.globalListenersCount=0,this.channelListenersCount=0},t.prototype.register=function(){this.frameWindow&&this.frameWindow.postMessage({type:"register-frame",origin:document.location.origin,id:this.channelId},this.origin)},t.prototype.dispatch=function(t){this.frameWindow&&this.frameWindow.postMessage((0,n.h)({$id:this.channelId,codesandbox:!0},t),this.origin)},t.prototype.globalListen=function(t){var e=this;if("function"!=typeof t)return function(){};var r=this.globalListenersCount;return this.globalListeners[r]=t,this.globalListenersCount++,function(){delete e.globalListeners[r]}},t.prototype.channelListen=function(t){var e=this;if("function"!=typeof t)return function(){};var r=this.channelListenersCount;return this.channelListeners[r]=t,this.channelListenersCount++,function(){delete e.channelListeners[r]}},t.prototype.eventListener=function(t){if(t.source===this.frameWindow){var e=t.data;e.codesandbox&&(Object.values(this.globalListeners).forEach((function(t){return t(e)})),e.$id===this.channelId&&Object.values(this.channelListeners).forEach((function(t){return t(e)})))}},t}(),u=new Map,l=0,d=Object.entries(a);l<d.length;l++){var f=d[l],p=f[0],h=f[1];if(h.extensions){var m=h.extensions;if(m.length)for(var v=0,y=m;v<y.length;v++){var g=y[v];u.set(g,p)}}}var b=u,w="$CSB_RELAY";function _(t,e){if(!t)return"static";var r=t.dependencies,o=void 0===r?{}:r,i=t.devDependencies,a=void 0===i?{}:i,s=(0,n.i)((0,n.i)([],Object.keys(o),!0),Object.keys(a),!0),c=Object.keys(e),u=["@adonisjs/framework","@adonisjs/core"];if(s.some((function(t){return u.indexOf(t)>-1})))return"adonis";var l=["nuxt","nuxt-edge","nuxt-ts","nuxt-ts-edge","nuxt3"];if(s.some((function(t){return l.indexOf(t)>-1})))return"nuxt";if(s.indexOf("next")>-1)return"next";var d=["apollo-server","apollo-server-express","apollo-server-hapi","apollo-server-koa","apollo-server-lambda","apollo-server-micro"];if(s.some((function(t){return d.indexOf(t)>-1})))return"apollo";if(s.indexOf("mdx-deck")>-1)return"mdx-deck";if(s.indexOf("gridsome")>-1)return"gridsome";if(s.indexOf("vuepress")>-1)return"vuepress";if(s.indexOf("ember-cli")>-1)return"ember";if(s.indexOf("sapper")>-1)return"sapper";if(s.indexOf("gatsby")>-1)return"gatsby";if(s.indexOf("quasar")>-1)return"quasar";if(s.indexOf("@docusaurus/core")>-1)return"docusaurus";if(s.indexOf("remix")>-1)return"remix";if(s.indexOf("astro")>-1)return"node";if(c.some((function(t){return t.endsWith(".re")})))return"reason";var f=["parcel-bundler","parcel"];if(s.some((function(t){return f.indexOf(t)>-1})))return"parcel";var p=["@dojo/core","@dojo/framework"];if(s.some((function(t){return p.indexOf(t)>-1})))return"@dojo/cli-create-app";if(s.indexOf("@nestjs/core")>-1||s.indexOf("@nestjs/common")>-1)return"nest";if(s.indexOf("react-styleguidist")>-1)return"styleguidist";if(s.indexOf("react-scripts")>-1)return"create-react-app";if(s.indexOf("react-scripts-ts")>-1)return"create-react-app-typescript";if(s.indexOf("@angular/core")>-1)return"angular-cli";if(s.indexOf("preact-cli")>-1)return"preact-cli";if(s.indexOf("@sveltech/routify")>-1||s.indexOf("@roxi/routify")>-1)return"node";if(s.indexOf("vite")>-1)return"node";if(s.indexOf("@frontity/core")>-1)return"node";if(s.indexOf("svelte")>-1)return"svelte";if(s.indexOf("vue")>-1)return"vue-cli";if(s.indexOf("cx")>-1)return"cxjs";var h=["express","koa","nodemon","ts-node","@tensorflow/tfjs-node","webpack-dev-server","snowpack"];return s.some((function(t){return h.indexOf(t)>-1}))||Object.keys(o).length>=50?"node":void 0}var S="-{{suffix}}",x="https://".concat(null==="2.19.8"?void 0:"2.19.8".replace(/\./g,"-")).c
1oncat(S,"-sandpack.codesandbox.io/"),O=function(t){function e(e,r,o){void 0===o&&(o={});var i=t.call(this,e,r,o)||this;if(i.getTranspilerContext=function(){return new Promise((function(t){var e=i.listen((function(r){"transpiler-context"===r.type&&(t(r.data),e())}));i.dispatch({type:"get-transpiler-context"})}))},i.getTranspiledFiles=function(){return new Promise((function(t){var e=i.listen((function(r){"all-modules"===r.type&&(t(r.data),e())}));i.dispatch({type:"get-modules"})}))},i.bundlerURL=i.createBundlerURL(),i.bundlerState=void 0,i.errors=[],i.status="initializing","string"==typeof e){i.selector=e;var a=document.querySelector(e);(0,n.n)(a,"The element '".concat(e,"' was not found")),i.element=a,i.iframe=document.createElement("iframe"),i.initializeElement()}else i.element=e,i.iframe=e;return i.iframe.getAttribute("sandbox")||(i.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"),i.iframe.setAttribute("allow","accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-read; clipboard-write; xr-spatial-tracking;")),i.setLocationURLIntoIFrame(),i.iframeProtocol=new c(i.iframe,i.bundlerURL),i.unsubscribeGlobalListener=i.iframeProtocol.globalListen((function(t){"initialized"===t.type&&i.iframe.contentWindow&&(i.iframeProtocol.register(),i.options.fileResolver&&(i.fileResolverProtocol=new s("fs",(function(t){return(0,n._)(i,void 0,void 0,(function(){return(0,n.a)(this,(function(e){if("isFile"===t.method)return[2,this.options.fileResolver.isFile(t.params[0])];if("readFile"===t.method)return[2,this.options.fileResolver.readFile(t.params[0])];throw new Error("Method not supported")}))}))}),i.iframeProtocol)),i.updateSandbox(i.sandboxSetup,!0))})),i.unsubscribeChannelListener=i.iframeProtocol.channelListen((function(t){switch(t.type){case"start":i.errors=[];break;case"status":i.status=t.status;break;case"action":"show-error"===t.action&&(i.errors=(0,n.i)((0,n.i)([],i.errors,!0),[(0,n.e)(t)],!1));break;case"done":i.status="done";break;case"state":i.bundlerState=t.state}})),o.experimental_enableServiceWorker&&i.serviceWorkerHandshake(),i}return(0,n.g)(e,t),e.prototype.createBundlerURL=function(){var t,e=this.options.bundlerURL||x;if(this.options.bundlerURL)return e;if(this.options.teamId&&(e=e.replace("https://","https://"+this.options.teamId+"-")+"?cache=".concat(Date.now())),this.options.experimental_enableServiceWorker){var r=[];r.push(Math.random().toString(36).slice(4)),e=e.replace(S,"-".concat(null!==(t=this.options.experimental_stableServiceWorkerId)&&void 0!==t?t:r.join("-")))}else e=e.replace(S,"");return e},e.prototype.serviceWorkerHandshake=function(){var t=this,e=new MessageChannel,r=this.iframe.contentWindow;if(!r)throw new Error("Could not get iframe contentWindow");var n=e.port1;n.onmessage=function(e){if("object"==typeof e.data&&e.data.$channel===w)switch(e.data.$type){case"preview/ready":break;case"preview/request":t.handleWorkerRequest(e.data,n)}};var o=function(){var n={$channel:w,$type:"preview/init"};r.postMessage(n,"*",[e.port2]),t.iframe.removeEventListener("load",o)};this.iframe.addEventListener("load",o)},e.prototype.handleWorkerRequest=function(t,e){return(0,n._)(this,void 0,void 0,(function(){var r,o,i,a,s,c,u,l,d,f,p;return(0,n.a)(this,(function(n){switch(n.label){case 0:r=function(){var r={$channel:w,$type:"preview/response",id:t.id,headers:{"Content-Type":"text/html; charset=utf-8"},status:404,body:"File not found"};e.postMessage(r)},n.label=1;case 1:return n.trys.push([1,4,,5]),o=new URL(t.url,this.bundlerURL).pathname,i={},a=this.getFiles(),(s=a[o])?[3,3]:[4,this.getTranspiledFiles()];case 2:if(c=n.sent(),!(s=c.find((function(t){return t.path.endsWith(o)}))))return r(),[2];n.label=3;case 3:return u=s.code,i["Content-Type"]||(h=o.split("."),l=h.length<=1?"":h[h.length-1],(d=b.get(l))&&(i["Content-Type"]=d)),f={$channel:w,$type:"preview/response",id:t.id,headers:i,status:200,body:u},e.postMessage(f),[3,5];case 4:return p=n.sent(),console.error(p),r(),[3,5];case 5:return[2]}var h}))}))},e.prototype.setLocationURLIntoIFrame=function(){var t,e=this.options.startRoute?new URL(this.options.startRoute,this.bundlerURL).toString():this.bundlerURL;null===(t=this.iframe.contentWindow)||void 0===t||t.location.replace(e),this.iframe.src=e},e.prototype.destroy=function(){this.unsubscribeChannelListener(),this.unsubscribeGlobalListener(),this.iframeProtocol.cleanup()},e.prototype.updateOptions=function(t){(0,o.j)(this.options,t)||(this.options=t,this.updateSandbox())},e.prototype.updateSandbox=function(t,e){var r,o,i,a;void 0===t&&(t=this.sandboxSetup),this.sandboxSetup=(0,n.h)((0,n.h)({},this.sandboxSetup),t);var s=this.getFiles(),c=Object.keys(s).reduce((function(t,e){var r;return(0,n.h)((0,n.h)({},t),((r={})[e]={code:s[e].code,path:e},r))}),{}),u=JSON.parse((0,n.b)(this.sandboxSetup.dependencies,this.sandboxSetup.devDependencies,this.sandboxSetup.entry));try{u=JSON.parse(s["/package.json"].code)}catch(t){console.error((0,n.c)("could not parse package.json file: "+t.message))}var l=Object.keys(s).reduce((function(t,e){var r;return(0,n.h)((0,n.h)({},t),((r={})[e]={content:s[e].code,path:e},r))}),{});this.dispatch((0,n.h)((0,n.h)({},this.options),{type:"compile",codesandbox:!0,version:3,isInitializationCompile:e,modules:c,reactDevTools:this.options.reactDevTools,externalResources:this.options.externalResources||[],hasFileResolver:Boolean(this.options.fileResolver),disableDependencyPreprocessing:this.sandboxSetup.disableDependencyPreprocessing,experimental_enableServiceWorker:this.options.experimental_enableServiceWorker,template:this.sandboxSetup.template||_(u,l),showOpenInCodeSandbox:null===(r=this.options.showOpenInCodeSandbox)||void 0===r||r,showErrorScreen:null===(o=this.options.showErrorScreen)||void 0===o||o,showLoadingScreen:null!==(i=this.options.showLoadingScreen)&&void 0!==i&&i,skipEval:this.options.skipEval||!1,clearConsoleDisabled:!this.options.clearConsoleOnFirstC
1ompile,logLevel:null!==(a=this.options.logLevel)&&void 0!==a?a:n.S.Info,customNpmRegistries:this.options.customNpmRegistries,teamId:this.options.teamId,sandboxId:this.options.sandboxId}))},e.prototype.dispatch=function(t){"refresh"===t.type&&(this.setLocationURLIntoIFrame(),this.options.experimental_enableServiceWorker&&this.serviceWorkerHandshake()),this.iframeProtocol.dispatch(t)},e.prototype.listen=function(t){return this.iframeProtocol.channelListen(t)},e.prototype.getCodeSandboxURL=function(){var t=this.getFiles(),e=Object.keys(t).reduce((function(e,r){var o;return(0,n.h)((0,n.h)({},e),((o={})[r.replace("/","")]={content:t[r].code,isBinary:!1},o))}),{});return fetch("https://codesandbox.io/api/v1/sandboxes/define?json=1",{method:"POST",body:JSON.stringify({files:e}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(t){return{sandboxId:t.sandbox_id,editorUrl:"https://codesandbox.io/s/".concat(t.sandbox_id),embedUrl:"https://codesandbox.io/embed/".concat(t.sandbox_id)}}))},e.prototype.getFiles=function(){var t=this.sandboxSetup;return void 0===t.files["/package.json"]?(0,n.d)(t.files,t.dependencies,t.devDependencies,t.entry):this.sandboxSetup.files},e.prototype.initializeElement=function(){this.iframe.style.border="0",this.iframe.style.width=this.options.width||"100%",this.iframe.style.height=this.options.height||"100%",this.iframe.style.overflow="hidden",(0,n.n)(this.element.parentNode,"The given iframe does not have a parent."),this.element.parentNode.replaceChild(this.iframe,this.element)},e}(i.S)},"Dnt+":(t,e,r)=>{r.d(e,{E:()=>a,a:()=>b,b:()=>g,c:()=>w,f:()=>y,g:()=>h,r:()=>v,w:()=>m});var n,o=r("72gZ"),i=r("Qm2c"),a=function(){function t(){this.listeners={},this.listenersCount=0,this.channelId=Math.floor(1e6*Math.random()),this.listeners=[]}return t.prototype.cleanup=function(){this.listeners={},this.listenersCount=0},t.prototype.dispatch=function(t){Object.values(this.listeners).forEach((function(e){return e(t)}))},t.prototype.listener=function(t){var e=this;if("function"!=typeof t)return function(){};var r=this.listenersCount;return this.listeners[r]=t,this.listenersCount++,function(){delete e.listeners[r]}},t}();function s(t){return/[a-zA-Z.]/.test(t)}function c(t){return/[a-zA-Z]/.test(t)}function u(t){return/[&|]/.test(t)}function l(t){return/-/.test(t)}function d(t){return c(t)&&t===t.toUpperCase()}!function(t){t.OR="OR",t.AND="AND",t.PIPE="PIPE",t.Command="Command",t.Argument="Argument",t.String="String",t.EnvVar="EnvVar"}(n||(n={}));var f=new Map([["&&",{type:n.AND}],["||",{type:n.OR}],["|",{type:n.PIPE}],["-",{type:n.Argument}]]),p=0;function h(){var t=Date.now(),e=Math.round(1e4*Math.random()),r=p+=1;return(+"".concat(t).concat(e).concat(r)).toString(16)}var m=function(t){return"string"==typeof t?(new TextEncoder).encode(t):t},v=function(t){return"string"==typeof t?t:(new TextDecoder).decode(t)},y=function(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return t[r]=m(n.code),t}),{})},g=function(t){var e={},r=["dev","start"];try{e=JSON.parse(t).scripts}catch(t){throw(0,i.c)("Could not parse package.json file: "+t.message)}(0,o.V1)(e,"Failed to start. Please provide a `start` or `dev` script on the package.json");for(var a=function(t){if(r[t]in e){var o=e[r[t]],i={},a="",p=[];return function(t){var e,r=0,o=[];function i(){for(var e="";s(t[r])&&r<t.length;)e+=t[r],r++;return{type:n.Command,value:e}}function a(){for(var e="";u(t[r])&&r<t.length;)e+=t[r],r++;return f.get(e)}function p(){for(var e="";(l(t[r])||c(t[r]))&&r<t.length;)e+=t[r],r++;return{type:n.Argument,value:e}}function h(){var e=t[r],o=t[r];for(r++;t[r]!==e&&r<t.length;)o+=t[r],r++;return o+=t[r],r++,{type:n.String,value:o}}function m(){for(var e={},o=function(){for(var n="",o="";"="!==t[r]&&r<t.length;)n+=t[r],r++;for("="===t[r]&&r++;" "!==t[r]&&r<t.length;)o+=t[r],r++;e[n]=o};d(t[r])&&r<t.length;)o(),r++;return{type:n.EnvVar,value:e}}for(;r<t.length;){var v=t[r];if(/\s/.test(v))r++;else switch(!0){case d(v):o.push(m());break;case s(v):o.push(i());break;case u(v):o.push(a());break;case l(v):o.push(p());break;case e=v,/["']/.test(e):o.push(h());break;default:throw new Error("Unknown character: ".concat(v))}}return o}
1(o).forEach((function(t){var e=""===a;t.type===n.EnvVar&&(i=t.value),t.type===n.Command&&e&&(a=t.value),(t.type===n.Argument||!e&&t.type===n.Command)&&p.push(t.value)})),{value:[a,p,{env:i}]}}},p=0;p<r.length;p++){var h=a(p);if("object"==typeof h)return h.value}throw(0,i.c)("Failed to start. Please provide a `start` or `dev` script on the package.json")},b=function(t){return"string"==typeof t?t:"object"==typeof t&&"message"in t?t.message:(0,i.c)("The server could not be reached. Make sure that the node script is running and that a port has been started.")},w='var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e={},n={};!function(t){t.__esModule=!0,t.default=["log","debug","info","warn","error","table","clear","time","timeEnd","count","assert","command","result"]}(n);var a,o={},i={};(a=i).__esModule=!0,a.default=function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};
1return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+"-"+Date.now()};var u={},s={__esModule:!0};s.update=s.state=void 0,s.update=function(t){s.state=t};var f={},c={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.initialState=void 0,r.initialState={timings:{},count:{}};var n=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};r.default=function(t,a){var o,i,u;switch(void 0===t&&(t=r.initialState),a.type){case"COUNT":var s=t.count[a.name]||0;return e(e({},t),{count:e(e({},t.count),(o={},o[a.name]=s+1,o))});case"TIME_START":return e(e({},t),{timings:e(e({},t.timings),(i={},i[a.name]={start:n()},i))});case"TIME_END":var f=t.timings[a.name],c=n(),l=c-f.start;return e(e({},t),{timings:e(e({},t.timings),(u={},u[a.name]=e(e({},f),{end:c,time:l}),u))});default:return t}}}(c),function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var n=e(c),a=s;r.default=function(t){a.update(n.default(a.state,t))}}(f);var l={__esModule:!0};l.timeEnd=l.timeStart=l.count=void 0,l.count=function(t){return{type:"COUNT",name:t}},l.timeStart=function(t){return{type:"TIME_START",name:t}},l.timeEnd=function(t){return{type:"TIME_END",name:t}};var d=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};u.__esModule=!0,u.stop=u.start=void 0;var p=s,h=d(f),m=l;u.start=function(t){h.default(m.timeStart(t))},u.stop=function(t){var r=null===p.state||void 0===p.state?void 0:p.state.timings[t];return r&&!r.end?(h.default(m.timeEnd(t)),{method:"log",data:[t+": "+p.state.timings[t].time+"ms"]}):{method:"warn",data:["Timer \'"+t+"\' does not exist"]}};var y={},v=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};y.__esModule=!0,y.increment=void 0;var _=s,b=v(f),g=l;y.increment=function(t){return b.default(g.count(t)),{method:"log",data:[t+": "+_.state.count[t]]}};var M={},T=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n};M.__esModule=!0,M.test=void 0,M.test=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return!t&&(0===r.length&&r.push("console.assert"),{method:"error",data:T(["Assertion failed:"],r)})},function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)},n=t&&t.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),a=t&&t.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),o=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)"default"!==e&&Object.prototype.hasOwnProperty.call(t,e)&&n(r,t,e);return a(r,t),r},s=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n},f=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var c=f(i),l=o(u),d=o(y),p=o(M);r.default=function(t,r,n){var a=n||c.default();switch(t){case"clear":return{method:t,id:a};case"count":return!!(o="string"==typeof r[0]?r[0]:"default")&&e(e({},d.increment(o)),{id:a});case"time":case"timeEnd":var o;return!!(o="string"==typeof r[0]?r[0]:"default")&&("time"===t?(l.start(o),!1):e(e({},l.stop(o)),{id:a}));case"assert":if(0!==r.length){var i=p.test.apply(p,s([r[0]],r.slice(1)));if(i)return e(e({},i),{id:a})}return!1;case"error":return{method:t,id:a,data:r.map((function(t){try{return t.stack||t}catch(r){return t}}))};default:return{method:t,id:a,data:r}}}}(o);var S={},O={};!function(t){var r;t.__esModule=!0,function(t){t[t.infinity=0]="infinity",t[t.minusInfinity=1]="minusInfinity",t[t.minusZero=2]="minusZero"}(r||(r={})),t.default={type:"Arithmetic",lookup:Number,shouldTransform:function(t,r){return"number"===t&&(r===1/0||r===-1/0||function(t){return 1/t==-1/0}(r))},toSerializable:function(t){return t===1/0?r.infinity:t===-1/0?r.minu
1sInfinity:r.minusZero},fromSerializable:function(t){return t===r.infinity?1/0:t===r.minusInfinity?-1/0:t===r.minusZero?-0:t}}}(O);var w={};!function(t){t.__esModule=!0,t.default={type:"Function",lookup:Function,shouldTransform:function(t,r){return"function"==typeof r},toSerializable:function(t){var r="";try{r=t.toString().substring(r.indexOf("{")+1,r.lastIndexOf("}"))}catch(t){}return{name:t.name,body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){try{var r=function(){};return"string"==typeof t.name&&Object.defineProperty(r,"name",{value:t.name,writable:!1}),"string"==typeof t.body&&Object.defineProperty(r,"body",{value:t.body,writable:!1}),"string"==typeof t.proto&&(r.constructor={name:t.proto}),r}catch(r){return t}}}}(w);var A={};!function(t){var r;function e(t){for(var r={},e=0,n=t.attributes;e<n.length;e++){var a=n[e];r[a.name]=a.value}return r}t.__esModule=!0,t.default={type:"HTMLElement",shouldTransform:function(t,r){return r&&r.children&&"string"==typeof r.innerHTML&&"string"==typeof r.tagName},toSerializable:function(t){return{tagName:t.tagName.toLowerCase(),attributes:e(t),innerHTML:t.innerHTML}},fromSerializable:function(t){try{var e=(r||(r=document.implementation.createHTMLDocument("sandbox"))).createElement(t.tagName);e.innerHTML=t.innerHTML;for(var n=0,a=Object.keys(t.attributes);n<a.length;n++){var o=a[n];try{e.setAttribute(o,t.attributes[o])}catch(t){}}return e}catch(r){return t}}}}(A);var j={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.default={type:"Map",shouldTransform:function(t,r){return r&&r.constructor&&"Map"===r.constructor.name},toSerializable:function(t){var r={};return t.forEach((function(t,e){var n="object"==typeof e?JSON.stringify(e):e;r[n]=t})),{name:"Map",body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){var r=t.body,n=e({},r);return"string"==typeof t.proto&&(n.constructor={name:t.proto}),n}}}(j);var z={};!function(t){t.__esModule=!0;var r="@t",e=/^#*@(t|r)$/,n=(0,eval)("this"),a="function"==typeof ArrayBuffer,o="function"==typeof Map,i="function"==typeof Set,u=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],s=Array.prototype.slice,f={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}},c=function(){function t(t,r){this.references=t,this.transforms=r,this.transformsMap=this._makeTransformsMap(),this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}return t._createRefMark=function(t){var r=Object.create(null);return r["@r"]=t,r},t.prototype._createCircularCandidate=function(t,r,e){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:r,key:e,refIdx:-1})},t.prototype._applyTransform=function(t,e,n,a){var o=Object.create(null),i=a.toSerializable(t);return"object"==typeof i&&this._createCircularCandidate(t,e,n),o[r]=a.type,o.data=this._handleValue((function(){return i}),e,n),o},t.prototype._handleArray=function(t){for(var r=[],e=function(e){r[e]=n._handleValue((function(){return t[e]}),r,e)},n=this,a=0;a<t.length;a++)e(a);return r},t.prototype._handlePlainObject=function(t){var r,n,a=Object.create(null),o=function(r){if(Reflect.has(t,r)){var n=e.test(r)?"#"+r:r;a[n]=i._handleValue((function(){return t[r]}),a,n)}},i=this;for(var u in t)o(u);var s=null===(n=null===(r=null==t?void 0:t.__proto__)||void 0===r?void 0:r.constructor)||void 0===n?void 0:n.name;return s&&"Object"!==s&&(a.constructor={name:s}),a},t.prototype._handleObject=function(t,r,e){return this._createCircularCandidate(t,r,e),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},t.prototype._ensureCircularReference=function(r){var e=this.circularCandidates.indexOf(r);if(e>-1){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),t._createRefMark(n.refIdx)}return null},t.prototype._handleValue=function(t,r,e){try{var n=t(),a=typeof n,o="object"===a&&null!==n;if(o){var i=this._ensureCircularReference(n);if(i)return i}var u=this._findTransform(a,n);return u?this._applyTransform(n,r,e,u):o?this._handleObject(n,r,e):n}catch(t){try{return this._handleValue((function(){return t instanceof Error?t:new Error(t)}),r,e)}catch(t){return null}}},t.prototype._makeTransformsMap=function(){if(o){var t=new Map;
1return this.transforms.forEach((function(r){r.lookup&&t.set(r.lookup,r)})),t}},t.prototype._findTransform=function(t,r){if(o&&r&&r.constructor&&(null==(a=this.transformsMap.get(r.constructor))?void 0:a.shouldTransform(t,r)))return a;for(var e=0,n=this.transforms;e<n.length;e++){var a;if((a=n[e]).shouldTransform(t,r))return a}},t.prototype.transform=function(){for(var r=this,e=[this._handleValue((function(){return r.references}),null,null)],n=0,a=this.circularCandidatesDescrs;n<a.length;n++){var o=a[n];o.refIdx>0&&(e[o.refIdx]=o.parent[o.key],o.parent[o.key]=t._createRefMark(o.refIdx))}return e},t}(),l=function(){function t(t,r){this.activeTransformsStack=[],this.visitedRefs=Object.create(null),this.references=t,this.transformMap=r}return t.prototype._handlePlainObject=function(t){var r=Object.create(null);for(var n in"constructor"in t&&(t.constructor&&"string"==typeof t.constructor.name||(t.constructor={name:"Object"})),t)t.hasOwnProperty(n)&&(this._handleValue(t[n],t,n),e.test(n)&&(r[n.substring(1)]=t[n],delete t[n]));for(var a in r)t[a]=r[a]},t.prototype._handleTransformedObject=function(t,e,n){var a=t[r],o=this.transformMap[a];if(!o)throw new Error("Can\'t find transform for \\""+a+\'" type.\');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=o.fromSerializable(t.data)},t.prototype._handleCircularSelfRefDuringTransform=function(t,r,e){var n=this.references;Object.defineProperty(r,e,{val:void 0,configurable:!0,enumerable:!0,get:function(){return void 0===this.val&&(this.val=n[t]),this.val},set:function(t){this.val=t}})},t.prototype._handleCircularRef=function(t,r,e){this.activeTransformsStack.includes(this.references[t])?this._handleCircularSelfRefDuringTransform(t,r,e):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),r[e]=this.references[t])},t.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var a=t["@r"];if(void 0!==a)this._handleCircularRef(a,e,n);else if(t[r])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var o=0;o<t.length;o++)this._handleValue(t[o],t,o);else this._handlePlainObject(t)}},t.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]},t}(),d=[{type:"[[NaN]]",shouldTransform:function(t,r){return"number"===t&&isNaN(r)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",lookup:Date,shouldTransform:function(t,r){return r instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var r=new Date;return r.setTime(t),r}},{type:"[[RegExp]]",lookup:RegExp,shouldTransform:function(t,r){return r instanceof RegExp},toSerializable:function(t){var r={src:t.source,flags:""};return t.globalThis&&(r.flags+="g"),t.ignoreCase&&(r.flags+="i"),t.multiline&&(r.flags+="m"),r},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",lookup:Error,shouldTransform:function(t,r){return r instanceof Error},toSerializable:function(t){var r,e;return t.stack||null===(e=(r=Error).captureStackTrace)||void 0===e||e.call(r,t),{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var r=new(n[t.name]||Error)(t.message);return r.stack=t.stack,r}},{type:"[[ArrayBuffer]]",lookup:a&&ArrayBuffer,shouldTransform:function(t,r){return a&&r instanceof ArrayBuffer},toSerializable:function(t){var r=new Int8Array(t);return s.call(r)},fromSerializable:function(t){if(a){var r=new ArrayBuffer(t.length);return new Int8Array(r).set(t),r}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,r){if(a)return ArrayBuffer.isView(r)&&!(r instanceof DataView);for(var e=0,o=u;e<o.length;e++){var i=o[e];if("function"==typeof n[i]&&r instanceof n[i])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:s.call(t)}},fromSerializable:function(t){return"function"==typeof n[t.ctorName]?new n[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",lookup:o&&Map,shouldTransform:function(t,r){return o&&r instanceof Map},toSerializable:function(t){var r=[];return t.forEach((function(t,e){r.push(e),r.push(t)})),r},fromSerializable:function(t){if(o){for(var r=new Map,e=0;e<t.length;e+=2)r.set(t[e],t[e+1]);return r}for(var n=[],a=0;a<t.length;a+=2)n.push([t[e],t[e+1]]);return n}}
1,{type:"[[Set]]",lookup:i&&Set,shouldTransform:function(t,r){return i&&r instanceof Set},toSerializable:function(t){var r=[];return t.forEach((function(t){r.push(t)})),r},fromSerializable:function(t){if(i){for(var r=new Set,e=0;e<t.length;e++)r.add(t[e]);return r}return t}}],p=function(){function t(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||f,this.addTransforms(d)}return t.prototype.addTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r];if(this.transformsMap[n.type])throw new Error(\'Transform with type "\'+n.type+\'" was already added.\');this.transforms.push(n),this.transformsMap[n.type]=n}return this},t.prototype.removeTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r],a=this.transforms.indexOf(n);a>-1&&this.transforms.splice(a,1),delete this.transformsMap[n.type]}return this},t.prototype.encode=function(t){var r=new c(t,this.transforms).transform();return this.serializer.serialize(r)},t.prototype.decode=function(t){var r=this.serializer.deserialize(t);return new l(r,this.transformsMap).transform()},t}();t.default=p}(z);var E=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};S.__esModule=!0,S.Decode=P=S.Encode=void 0;var k=E(O),C=E(w),D=E(A),I=E(j),N=E(z),R=[D.default,C.default,k.default,I.default],x=new N.default;x.addTransforms(R);var P=S.Encode=function(t){return JSON.parse(x.encode(t))};S.Decode=function(t){return x.decode(JSON.stringify(t))},function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var a=e(n),i=e(o),u=S;r.default=function(t,r,e){void 0===e&&(e=!0);for(var n=t,o={pointers:{},src:{npm:"https://npmjs.com/package/console-feed",github:"https://github.com/samdenty99/console-feed"}},s=function(t){var a=n[t];n[t]=function(){a.apply(this,arguments);var n=[].slice.call(arguments);setTimeout((function(){var a=i.default(t,n);if(a){var o=a;e&&(o=u.Encode(a)),r(o,a)}}))},o.pointers[t]=a},f=0,c=a.default;f<c.length;f++)s(c[f]);return n.feed=o,n}}(e),r(e)(window.console,(function(t){var r=P(t);parent.postMessage({type:"console",codesandbox:!0,log:Array.isArray(r)?r[0]:r,channelId:scope.channelId},"*")}));\n'},"6whx":(t,e,r)=>{r.r(e),r.d(e,{SandpackStatic:()=>c});var n=r("Qm2c"),o=r("qx7J"),i=r("Dnt+"),a=r("TFe8"),s=(r("72gZ"),r("D6cf"),function(t){return"string"==typeof t?t:(new TextDecoder).decode(t)}),c=function(t){function e(e,r,n){var a;void 0===n&&(n={});var c=t.call(this,e,r,n)||this;if(c.files=new Map,c.status="initializing",c.emitter=new i.E,c.previewController=new o.PreviewController({baseUrl:null!==(a=n.bundlerURL)&&void 0!==a?a:"https://preview.sandpack-static-server.codesandbox.io",getFileContent:function(t){var e=c.files.get(t);if(!e)throw new Error("File not found");if(t.endsWith(".html")||t.endsWith(".htm"))try{e=function(t){var e=s(t),r=(new DOMParser).parseFromString(e,"text/html");r.documentElement.getAttribute("lang")||r.documentElement.setAttribute("lang","en");var n=r.documentElement.outerHTML;return"<!DOCTYPE html>\n".concat(n)}(e),e=c.injectProtocolScript(e),e=c.injectExternalResources(e,n.externalResources),e=c.injectScriptIntoHead(e,{script:i.c,scope:{channelId:(0,i.g)()}})}catch(t){console.error("Runtime injection failed",t)}return e}}),"string"==typeof e){c.selector=e;var u=document.querySelector(e);c.element=u,c.iframe=document.createElement("iframe")}else c.element=e,c.iframe=e;return c.iframe.getAttribute("sandbox")||(c.iframe.setAttribute("sandbox","allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads allow-pointer-lock"),c.iframe.setAttribute("allow","accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-read; clipboard-write; xr-spatial-tracking;")),c.eventListener=c.eventListener.bind(c),"undefined"!=typeof window&&window.addEventListener("message",c.eventListener),c.updateSandbox(),c}return(0,n.g)(e,t),e.prototype.injectContentIntoHead=function(t,e){var r;return null!==(r=function(t,e,r){var n=/<head[^<>]*>/g.exec(e);if(n&&n.length>=1){var o=n.index+n[0].length;return e.substring(0,o)+r+e.substring(o)}}(0,t=s(t),"\n"+e))&&void 0!==r?r:e+"\n"+t},e.prototype.injectProtocolScript=function(t){return this.injectContentIntoHead(t,'<script>\n window.addEventListener("message", (message) => {\n if(message.data.type === "refresh") {\n window.location.reload();\n }\n })\n<\/script>')},e.prototype.injectExternalResources=function(t,e){void 0===e&&(e=[]);var r=e.map((function(t){var e=t.match(/\.([^.]*)$/),r=null==e?void 0:e[1];if("css"===r||t.includes("fonts.googleapis"))return'<link rel="stylesheet" href="'.concat(t,'">');if("js"===r)return'<script src="'.concat(t,'"><\/script>');throw new Error("Unable to determine file type for external resource: ".concat(t))})).join("\n");return this.injectContentIntoHead(t,r)},e.prototype.injectScriptIntoHead=function(t,e){var r=e.script,n=e.scope,o=void 0===n?{}:n,i="\n <script>\n const scope = ".concat(JSON.stringify(o),";\n ").concat(r,"\n <\/script>\n ").trim();return this.injectContentIntoHead(t,i)},e.prototype.updateSandbox=function(t,e){void 0===t&&(t=this.sandboxSetup);var r=(0,i.f)(t.files);this.dispatch({codesandbox:!0,modules:r,template:t.template,type:"compile"})},e.prototype.compile=function(t){return(0,n._)(this,void 0,void 0,(function(){var e;return(0,n.a)(this,(function(r){switch(r.label){case 0:return this.files=new Map(Object.entries(t)),[4,this.previewController.initPreview()];case 1:return e=r.sent(),this.iframe.setAttribute("src",e),this.status="done",this.dispatch({type:"done",compilatonError:!1}),this.dispatch({type:"urlchange",url:e,back:!1,forward:!1}),[2]}}))}))},e.prototype.eventListener=function(t){if(t.source===this.iframe.contentWindow){var e=t.data;e.codesandbox&&this.dispatch(e)}},e.prototype.dispatch=function(t){var e;"compile"===t.type?this.compile(t.modules):(null===(e=this.iframe.contentWindow)||void 0===e||e.postMessage(t,"*"),this.emitter.dispatch(t))},e.prototype.listen=function(t){return this.emitter.listener(t)},e.prototype.destroy=function(){this.emitter.cleanup(),"undefined"!=typeof window&&window.removeEventListener("message",this.eventListener)},e}(a.S)},XLBo:(t,e,r)=>{r.d(e,{Jy:()=>o});var n=r("Qm2c");function o(t,e,o){var i;return void 0===o&&(o={}),(0,n._)(this,void 0,void 0,(function(){var a;return(0,n.a)(this,(function(n){switch(n.label){case 0:switch(null!==(i=e.template)&&void 0!==i?i:"parcel"){case"node":return[3,1];case"static":return[3,3]}return[3,5];case 1:return[4,Promise.all([r.e(1599),r.e(8587)]).then(r.bind(r,"/y3F")).then((function(t){return t.SandpackNode}))];case 2:return a=n.sent(),[3,7];case 3:return[4,Promise.all([r.e(1599),r.e(6412)]).then(r.bind(r,"6whx")).then((function(t){return t.SandpackStatic}))];case 4:return a=n.sent(),[3,7];case 5:return[4,Promise.all([r.e(1599),r.e(4172)]).then(r.bind(r,"czUq")).then((function(t){return t.SandpackRuntime}))];case 6:a=n.sent(),n.label=7;case 7:return[2,new a(t,e,o)]}}))}))}r("72gZ")},Qm2c:(t,e,r)=>{r.d(e,{S:()=>a,_:()=>c,a:()=>u,b:()=>m,c:()=>d,d:()=>v,e:()=>y,f:()=>g,g:()=>i,h:()=>s,i:()=>l,n:()=>f});
1var n=r("72gZ"),o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},o(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var a,s=function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s.apply(this,arguments)};function c(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))}function u(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function l(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}!function(t){t[t.None=0]="None",t[t.Error=10]="Error",t[t.Warning=20]="Warning",t[t.Info=30]="Info",t[t.Debug=40]="Debug"}(a||(a={}));var d=function(t){return"[sandpack-client]: ".concat(t)};function f(t,e){return void 0===e&&(e="Value is nullish"),(0,n.V1)(null!=t,d(e)),t}var p='"dependencies" was not specified - provide either a package.json or a "dependencies" value',h='"entry" was not specified - provide either a package.json with the "main" field or an "entry" value';function m(t,e,r){return void 0===t&&(t={}),void 0===e&&(e={}),void 0===r&&(r="/index.js"),JSON.stringify({name:"sandpack-project",main:r,dependencies:t,devDependencies:e},null,2)}function v(t,e,r,n){var o,i,a=g(t),c=a["/package.json"];if(!c)return f(e,p),f(n,h),a["/package.json"]={code:m(e,r,n)},a;if(c){var u=JSON.parse(c.code);f(!(!e&&!u.dependencies),h),e&&(u.dependencies=s(s({},null!==(o=u.dependencies)&&void 0!==o?o:{}),null!=e?e:{})),r&&(u.devDependencies=s(s({},null!==(i=u.devDependencies)&&void 0!==i?i:{}),null!=r?r:{})),n&&(u.main=n),a["/package.json"]={code:JSON.stringify(u,null,2)}}return a}function y(t){var e;if("SyntaxError"===t.title)return{title:t.title,path:t.path,message:t.message,line:t.line,column:t.column};var r=function(t){if(t)return t.find((function(t){return!!t._originalFileName}))}(null===(e=t.payload)||void 0===e?void 0:e.frames);if(!r)return{message:t.message};var n,o,i,a=(o=(n=r)._originalScriptCode[n._originalScriptCode.length-1].lineNumber.toString().length,i=2+o+3+n._originalColumnNumber,n._originalScriptCode.reduce((function(t,e){var r=e.highlight?">":" ",n=e.lineNumber.toString().length===o?"".concat(e.lineNumber):" ".concat(e.lineNumber),a=e.highlight?"\n"+" ".repeat(i)+"^":"";return t+"\n"+r+" "+n+" | "+e.content+a}),"")),s=function(t){return t?" (".concat(t._originalLineNumber,":").concat(t._originalColumnNumber,")"):""}(r),c=function(t,e,r,n){return"".concat(t,": ").concat(e).concat(r,"\n").concat(n)}(r._originalFileName,t.message,s,a);return{message:c,title:t.title,path:r._originalFileName,line:r._originalLineNumber,column:r._originalColumnNumber}}var g=function(t){return"string"==typeof t?t.startsWith("/")?t:"/".concat(t):Array.isArray(t)?t.map((function(t){return t.startsWith("/")?t:"/".concat(t)})):"object"==typeof t&&null!==t?Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return t[r.startsWith("/")?r:"/".concat(r)]=n,t}),{}):null}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.