yaleh commited on
Commit
0c86e29
·
verified ·
1 Parent(s): 062f5c8

Upload folder using huggingface_hub

Browse files
assets/base-80a1f760-BFHJLZCG.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{e as n}from"./index-DF1wlebW.js";var p=function(){function o(t,i,e){e===void 0&&(e={}),this.status="idle",this.options=e,this.sandboxSetup=i,this.iframeSelector=t}return o.prototype.updateOptions=function(t){n(this.options,t)||(this.options=t,this.updateSandbox())},o.prototype.updateSandbox=function(t,i){throw t===void 0&&(t=this.sandboxSetup),Error("Method not implemented")},o.prototype.destroy=function(){throw Error("Method not implemented")},o.prototype.dispatch=function(t){throw Error("Method not implemented")},o.prototype.listen=function(t){throw Error("Method not implemented")},o}();export{p as S};
assets/consoleHook-59e792cb-BWqyNZmr.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{d as h,i as M}from"./index-DF1wlebW.js";var k=function(){function t(){this.listeners={},this.listenersCount=0,this.channelId=Math.floor(Math.random()*1e6),this.listeners=[]}return t.prototype.cleanup=function(){this.listeners={},this.listenersCount=0},t.prototype.dispatch=function(r){Object.values(this.listeners).forEach(function(e){return e(r)})},t.prototype.listener=function(r){var e=this;if(typeof r!="function")return function(){};var s=this.listenersCount;return this.listeners[s]=r,this.listenersCount++,function(){delete e.listeners[s]}},t}();function v(t){return/[a-zA-Z.]/.test(t)}function b(t){return/[a-zA-Z]/.test(t)}function S(t){return/\s/.test(t)}function y(t){return/[&|]/.test(t)}function g(t){return/-/.test(t)}function w(t){return/["']/.test(t)}function _(t){return b(t)&&t===t.toUpperCase()}var a;(function(t){t.OR="OR",t.AND="AND",t.PIPE="PIPE",t.Command="Command",t.Argument="Argument",t.String="String",t.EnvVar="EnvVar"})(a||(a={}));var O=new Map([["&&",{type:a.AND}],["||",{type:a.OR}],["|",{type:a.PIPE}],["-",{type:a.Argument}]]);function E(t){var r=0,e=[];function s(){for(var n="";v(t[r])&&r<t.length;)n+=t[r],r++;return{type:a.Command,value:n}}function f(){for(var n="";y(t[r])&&r<t.length;)n+=t[r],r++;return O.get(n)}function d(){for(var n="";(g(t[r])||b(t[r]))&&r<t.length;)n+=t[r],r++;return{type:a.Argument,value:n}}function c(){var n=t[r],u=t[r];for(r++;t[r]!==n&&r<t.length;)u+=t[r],r++;return u+=t[r],r++,{type:a.String,value:u}}function p(){for(var n={},u=function(){for(var l="",o="";t[r]!=="="&&r<t.length;)l+=t[r],r++;for(t[r]==="="&&r++;t[r]!==" "&&r<t.length;)o+=t[r],r++;n[l]=o};_(t[r])&&r<t.length;)u(),r++;return{type:a.EnvVar,value:n}}for(;r<t.length;){var i=t[r];if(S(i)){r++;continue}switch(!0){case _(i):e.push(p());break;case v(i):e.push(s());break;case y(i):e.push(f());break;case g(i):e.push(d());break;case w(i):e.push(c());break;default:throw new Error("Unknown character: ".concat(i))}}return e}var T=0;function z(){var t=Date.now(),r=Math.round(Math.random()*1e4),e=T+=1;return(+"".concat(t).concat(r).concat(e)).toString(16)}var A=function(t){return typeof t=="string"?new TextEncoder().encode(t):t},C=function(t){return typeof t=="string"?t:new TextDecoder().decode(t)},D=function(t){return Object.entries(t).reduce(function(r,e){var s=e[0],f=e[1];return r[s]=A(f.code),r},{})},I=function(t){var r={},e=["dev","start"];try{r=JSON.parse(t).scripts}catch(c){throw h("Could not parse package.json file: "+c.message)}M(r,"Failed to start. Please provide a `start` or `dev` script on the package.json");for(var s=function(c){if(e[c]in r){var p=e[c],i=r[p],n={},u="",l=[];return E(i).forEach(function(o){var m=u==="";o.type===a.EnvVar&&(n=o.value),o.type===a.Command&&m&&(u=o.value),(o.type===a.Argument||!m&&o.type===a.Command)&&l.push(o.value)}),{value:[u,l,{env:n}]}}},f=0;f<e.length;f++){var d=s(f);if(typeof d=="object")return d.value}throw h("Failed to start. Please provide a `start` or `dev` script on the package.json")},N=function(t){return typeof t=="string"?t:typeof t=="object"&&"message"in t?t.message:h("The server could not be reached. Make sure that the node script is running and that a port has been started.")},P=`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)};return 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.minusInfinity: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;return 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}},{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},"*")}));
2
+ `;export{k as E,D as a,z as b,P as c,I as f,N as g,C as r,A as w};
assets/index-599aeaf7-CcX4Lt6n.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index-DF1wlebW.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index-DZpWGLPZ.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index-Ls9WDZKZ.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ var ie=Object.defineProperty;var V=e=>{throw TypeError(e)};var se=(e,r,t)=>r in e?ie(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var p=(e,r,t)=>se(e,typeof r!="symbol"?r+"":r,t),T=(e,r,t)=>r.has(e)||V("Cannot "+t);var k=(e,r,t)=>(T(e,r,"read from private field"),t?t.call(e):r.get(e)),R=(e,r,t)=>r.has(e)?V("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,t),z=(e,r,t,n)=>(T(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t),F=(e,r,t)=>(T(e,r,"access private method"),t);import{_ as oe,a as E,b as P,c as A,d as X,n as N}from"./index-DF1wlebW.js";import{S as ae}from"./base-80a1f760-BFHJLZCG.js";import{c as ce,g as G,r as U,f as de,w as W,a as le,b as ue,E as he}from"./consoleHook-59e792cb-BWqyNZmr.js";var fe=Object.create,q=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyNames,me=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty,we=(e,r,t)=>r in e?q(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,b=(e,r)=>function(){return r||(0,e[Q(e)[0]])((r={exports:{}}).exports,r),r.exports},ge=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Q(r))!ve.call(e,s)&&s!==t&&q(e,s,{get:()=>r[s],enumerable:!(n=pe(r,s))||n.enumerable});return e},O=(e,r,t)=>(t=e!=null?fe(me(e)):{},ge(!e||!e.__esModule?q(t,"default",{value:e,enumerable:!0}):t,e)),ye=(e,r,t)=>(we(e,r+"",t),t),H=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)},y=(e,r,t)=>(H(e,r,"read from private field"),t?t.call(e):r.get(e)),j=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},C=(e,r,t,n)=>(H(e,r,"write to private field"),r.set(e,t),t),_=(e,r,t)=>(H(e,r,"access private method"),t),Z=b({"../../node_modules/.pnpm/[email protected]/node_modules/cuid/lib/pad.js"(e,r){r.exports=function(n,s){var i="000000000"+n;return i.substr(i.length-s)}}}),_e=b({"../../node_modules/.pnpm/[email protected]/node_modules/cuid/lib/fingerprint.browser.js"(e,r){var t=Z(),n=typeof window=="object"?window:self,s=Object.keys(n).length,i=navigator.mimeTypes?navigator.mimeTypes.length:0,o=t((i+navigator.userAgent.length).toString(36)+s.toString(36),4);r.exports=function(){return o}}}),Ee=b({"../../node_modules/.pnpm/[email protected]/node_modules/cuid/lib/getRandomValue.browser.js"(e,r){var t,n=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof self<"u"&&self.crypto;n?(s=Math.pow(2,32)-1,t=function(){return Math.abs(n.getRandomValues(new Uint32Array(1))[0]/s)}):t=Math.random;var s;r.exports=t}}),ee=b({"../../node_modules/.pnpm/[email protected]/node_modules/cuid/index.js"(e,r){var t=_e(),n=Z(),s=Ee(),i=0,o=4,a=36,c=Math.pow(a,o);function l(){return n((s()*c<<0).toString(a),o)}function h(){return i=i<c?i:0,i++,i-1}function f(){var v="c",w=new Date().getTime().toString(a),S=n(h().toString(a),o),d=t(),u=l()+l();return v+w+S+d+u}f.slug=function(){var w=new Date().getTime().toString(36),S=h().toString(36).slice(-4),d=t().slice(0,1)+t().slice(-1),u=l().slice(-2);return w.slice(-2)+S+d+u},f.isCuid=function(w){return typeof w!="string"?!1:!!w.startsWith("c")},f.isSlug=function(w){if(typeof w!="string")return!1;var S=w.length;return S>=7&&S<=10},f.fingerprint=t,r.exports=f}}),te=b({"../../node_modules/.pnpm/@[email protected]/node_modules/@open-draft/deferred-promise/build/createDeferredExecutor.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createDeferredExecutor=void 0;function r(){const t=(n,s)=>{t.state="pending",t.resolve=i=>{if(t.state!=="pending")return;t.result=i;const o=a=>(t.state="fulfilled",a);return n(i instanceof Promise?i:Promise.resolve(i).then(o))},t.reject=i=>{if(t.state==="pending")return queueMicrotask(()=>{t.state="rejected"}),s(t.rejectionReason=i)}};return t}e.createDeferredExecutor=r}}),Pe=b({"../../node_modules/.pnpm/@[email protected]/node_modules/@open-draft/deferred-promise/build/DeferredPromise.js"(e){var n,s,D,o;Object.defineProperty(e,"__esModule",{value:!0}),e.DeferredPromise=void 0;var r=te(),t=(o=class extends Promise{constructor(c=null){const l=(0,r.createDeferredExecutor)();super((h,f)=>{l(h,f),c==null||c(l.resolve,l.reject)});R(this,s);R(this,n);p(this,"resolve");p(this,"reject");z(this,n,l),this.resolve=k(this,n).resolve,this.reject=k(this,n).reject}get state(){return k(this,n).state}get rejectionReason(){return k(this,n).rejectionReason}then(c,l){return F(this,s,D).call(this,super.then(c,l))}catch(c){return F(this,s,D).call(this,super.catch(c))}finally(c){return F(this,s,D).call(this,super.finally(c))}},n=new WeakMap,s=new WeakSet,D=function(c){return Object.defineProperties(c,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},o);e.DeferredPromise=t}}),$=b({"../../node_modules/.pnpm/@[email protected]/node_modules/@open-draft/deferred-promise/build/index.js"(e){var r=e&&e.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),t=e&&e.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&r(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),t(te(),e),t(Pe(),e)}}),re=b({"../../node_modules/.pnpm/[email protected]/node_modules/strict-event-emitter/lib/MemoryLeakError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MemoryLeakError=void 0;var r=class extends Error{constructor(n,s,i){super(`Possible EventEmitter memory leak detected. ${i} ${s.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`);p(this,"emitter");p(this,"type");p(this,"count");this.emitter=n,this.type=s,this.count=i,this.name="MaxListenersExceededWarning"}};e.MemoryLeakError=r}}),be=b({"../../node_modules/.pnpm/[email protected]/node_modules/strict-event-emitter/lib/Emitter.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=void 0;var r=re(),t,n,s,i,o,a,c,l,h,f,v,w=class{constructor(){j(this,i),j(this,a),j(this,l),j(this,f),j(this,t,void 0),j(this,n,void 0),j(this,s,void 0),C(this,t,new Map),C(this,n,w.defaultMaxListeners),C(this,s,!1)}static listenerCount(d,u){return d.listenerCount(u)}setMaxListeners(d){return C(this,n,d),this}getMaxListeners(){return y(this,n)}eventNames(){return Array.from(y(this,t).keys())}emit(d,...u){const m=_(this,i,o).call(this,d);return m.forEach(M=>{M.apply(this,u)}),m.length>0}addListener(d,u){_(this,f,v).call(this,"newListener",d,u);const m=_(this,i,o).call(this,d).concat(u);if(y(this,t).set(d,m),y(this,n)>0&&this.listenerCount(d)>y(this,n)&&!y(this,s)){C(this,s,!0);const M=new r.MemoryLeakError(this,d,this.listenerCount(d));console.warn(M)}return this}on(d,u){return this.addListener(d,u)}once(d,u){return this.addListener(d,_(this,l,h).call(this,d,u))}prependListener(d,u){const m=_(this,i,o).call(this,d);if(m.length>0){const M=[u].concat(m);y(this,t).set(d,M)}else y(this,t).set(d,m.concat(u));return this}prependOnceListener(d,u){return this.prependListener(d,_(this,l,h).call(this,d,u))}removeListener(d,u){const m=_(this,i,o).call(this,d);return m.length>0&&(_(this,a,c).call(this,m,u),y(this,t).set(d,m),_(this,f,v).call(this,"removeListener",d,u)),this}off(d,u){return this.removeListener(d,u)}removeAllListeners(d){return d?y(this,t).delete(d):y(this,t).clear(),this}listeners(d){return Array.from(_(this,i,o).call(this,d))}listenerCount(d){return _(this,i,o).call(this,d).length}rawListeners(d){return this.listeners(d)}},S=w;t=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakSet,o=function(d){return y(this,t).get(d)||[]},a=new WeakSet,c=function(d,u){const m=d.indexOf(u);return m>-1&&d.splice(m,1),[]},l=new WeakSet,h=function(d,u){const m=(...M)=>{this.removeListener(d,m),u.apply(this,M)};return m},f=new WeakSet,v=function(d,u,m){this.emit(d,u,m)},ye(S,"defaultMaxListeners",10),e.Emitter=S}}),Se=b({"../../node_modules/.pnpm/[email protected]/node_modules/strict-event-emitter/lib/index.js"(e){var r=e&&e.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),t=e&&e.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&r(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),t(be(),e),t(re(),e)}}),Le=O(ee()),Ie=/(%?)(%([sdjo]))/g;function Me(e,r){switch(r){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const t=JSON.stringify(e);return t==="{}"||t==="[]"||/^\[object .+?\]$/.test(t)?e:t}}}function g(e,...r){if(r.length===0)return e;let t=0,n=e.replace(Ie,(s,i,o,a)=>{const c=r[t],l=Me(c,a);return i?s:(t++,l)});return t<r.length&&(n+=` ${r.slice(t).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var je=2;function Oe(e){if(!e.stack)return;const r=e.stack.split(`
2
+ `);r.splice(1,je),e.stack=r.join(`
3
+ `)}var ke=class extends Error{constructor(e,...r){super(e),this.message=e,this.name="Invariant Violation",this.message=g(e,...r),Oe(this)}},L=(e,r,...t)=>{if(!e)throw new ke(r,...t)};L.as=(e,r,t,...n)=>{if(!r)throw e.prototype.name!=null?new e(g(t,n)):e(g(t,n))};var B=O($()),Ce=window.localStorage.CSB_EMULATOR_DEBUG,Fe="\x1B[0m",Ae="\x1B[32;1m",xe="\x1B[31m",De="\x1B[34m",Te="\x1B[33;1m",Re="\x1B[35;1m",J="\x1B[36;1m",Ue={preview:Te,emulator:Re,runtime:J,bridge:De,"runtime:worker":J};function ne(e){return function(t,...n){if(Ce==="true"){const s=()=>t.includes("sender")?`${Ae}sender`:t.includes("receiver")?`${xe}receiver`:"",i=t.replace(/\[.+\]:/,"");console.debug(`${Ue[e]}${e}:${s()}${Fe}:${i}`,...n)}}}var I=ne("emulator"),We=class{constructor(e){p(this,"emitter");p(this,"channel");p(this,"receiverPort");p(this,"receiverReadyPromise");this.target=e,this.emitter=new EventTarget,this.channel=new MessageChannel,this.receiverPort=this.channel.port1;const r=new B.DeferredPromise,t=n=>{n.data.type==="internal/ready"&&(I("[message-sender]: runtime is ready"),r.resolve())};window.addEventListener("message",t),r.then(()=>{window.removeEventListener("message",t)}),this.receiverReadyPromise=r,this.receiverPort.onmessage=n=>{const s=n.data;s.type!=null&&(I('[message-sender]: emitting "%s" event...',s.type,s.payload),this.emitter.dispatchEvent(new MessageEvent(s.type,{data:s.payload})))}}async handshake(){const e=new B.DeferredPromise;await this.receiverReadyPromise,I("[message-sender]: sending handshake"),this.target.postMessage({type:"internal/handshake"},"*",[this.channel.port2]),this.on("internal/handshake/done",()=>{e.resolve(),clearTimeout(r)});const r=setTimeout(()=>{e.reject(new Error("MessageSender: Handshake timeout"))},5e3);return e}on(e,r,t){I('[message-sender]: add listener "%s"',e),this.emitter.addEventListener(e,n=>{n instanceof MessageEvent&&r(n)},t)}off(e,r,t){this.emitter.removeEventListener(e,r,t)}async send(e,...r){const t=new B.DeferredPromise,n=(0,Le.default)(),s=r[0]||{};I('[message-sender]: send "%s" (%s)',e,n,s),this.receiverPort.postMessage({type:e,payload:{operationId:n,payload:s}}),I('[message-sender]: adding done listener for "%s" (%s)',e,n);const i=a=>{const{data:c}=a;if(c.operationId===n){const l=c.listenerPayload||{};I('[message-sender]: resolving "%s (%s) promise!',e,n),t.resolve({...l,operationId:c.operationId})}},o=a=>{const{data:c}=a;c.operationId===n&&(I('[message-sender]: rejecting "%s (%s) promise!',e,n),t.reject(c.error))};return this.on("internal/operation/done",i),this.on("internal/operation/failed",o),t.finally(()=>{this.emitter.removeEventListener("internal/operation/done",i),this.emitter.removeEventListener("internal/operation/failed",o)})}},Y=O($()),Be=O(ee()),Ne=class{constructor(e){this.channel=e}async init(e){await this.channel.send("fs/init",{files:e})}async readFile(e,r){const t=await this.channel.send("fs/readFile",{path:e,encoding:r}).catch(n=>{throw new Error(g('Failed to read file at path "%s"',e),{cause:n})});if(!t)throw new Error("File not found");return t.data}async writeFile(e,r,t){let n,s=!1;typeof t=="object"?(n=t.encoding,s=!!t.recursive):typeof t=="string"&&(n=t),await this.channel.send("fs/writeFile",{path:e,content:r,encoding:n,recursive:s}).catch(i=>{throw new Error(g('Failed to write file at path "%s"',e),{cause:i})})}async readdir(e){const r=await this.channel.send("fs/readdir",{path:e}).catch(t=>{throw new Error(g('Failed to read directory at path "%s"',e),{cause:t})});if(!r)throw new Error("Directory not found");return r.data}async mkdir(e,r){const t=!!(r!=null&&r.recursive);await this.channel.send("fs/mkdir",{path:e,recursive:t}).catch(n=>{throw new Error(g('Failed to make directory at path "%s"',e),{cause:n})})}async stat(e){const r=await this.channel.send("fs/stat",{path:e}).catch(t=>{throw new Error(g('Failed to stat file at path "%s"',e),{cause:t})});if(!r)throw new Error("File not found");return r.data}async rm(e,r){const{force:t,recursive:n}=r||{};await this.channel.send("fs/rm",{path:e,force:t,recursive:n}).catch(s=>{throw new Error(g('Failed to remove file at path "%s"',e),{cause:s})})}async watch(e,r,t){const n=(0,Be.default)();return await this.channel.send("fs/watch",{watcherId:n,includes:e,excludes:r}),this.channel.on("fs/watch-event",({data:s})=>{if(s.watcherId===n&&t){const i={...s};delete i.watcherId,t(i)}}),{dispose:()=>this.channel.send("fs/unwatch",{watcherId:n})}}},K=O(Se()),qe=class{constructor(e){this.channel=e}create(){return new He(this.channel)}},He=class{constructor(e){p(this,"id");p(this,"state");p(this,"stdout");p(this,"stderr");p(this,"stdin");this.channel=e,this.state="running",this.stdout=new K.Emitter,this.stderr=new K.Emitter,this.stdin={write:r=>{if(!this.id)throw new Error("Failed to write to stdin, no process is currently running");return this.channel.send("shell/stdin",{data:r,workerId:this.id})}},this.forwardStdEvents()}forwardStdEvents(){this.channel.on("worker/tty",e=>{const{data:r}=e;if(r.workerId===this.id)switch(r.payload.type){case"out":{this.stdout.emit("data",r.payload.data);break}case"err":{this.stderr.emit("data",r.payload.data);break}}})}async runCommand(e,r,t={}){L(!this.id,'Failed to run "runCommand" on a ShellProcess: there is already a process running.');const n=await this.channel.send("shell/runCommand",{command:e,args:r,options:t});return L(n,'Failed to run "runCommand" on a ShellProcess: was not able to retrieve a running process.'),this.id=n.id,this.state="running",n}async on(e,r){switch(e){case"progress":{this.channel.on("worker/progress",({data:t})=>{r(t.status)});return}case"exit":{this.channel.on("worker/exit",({data:t})=>{t.workerId===this.id&&r(t.exitCode,t.error)});return}}}async kill(){L(this.id,'Failed to run "kill" on a ShellProcess: there is no process running. Did you forget to run it?'),this.state="idle",await this.channel.send("shell/exit",{id:this.id}).catch(e=>{throw new Error(g('Failed to kill shell with ID "%s"',this.id),{cause:e})}),this.id=void 0}},$e=O($()),Ve=2e4,ze=class{constructor(e){this.channel=e}async waitFor(e,r,t=Ve){const n=new $e.DeferredPromise,s=setTimeout(()=>{n.reject()},t),i=await this.channel.send("preview/get/info",e).catch(a=>{n.reject(new Error(g('Failed to look up preview information for shell ID "%s" (port: %d)',e.sourceShellId,e.port)))}),o=i&&r(i);return o&&n.resolve({url:i.url,port:i.port,sourceShellId:i.sourceShellId}),this.channel.on("preview/port/ready",({data:a})=>{!o&&r(a)&&n.resolve({url:a.url,port:a.port,sourceShellId:a.sourceShellId})}),n.finally(()=>{clearTimeout(s)})}async getByShellId(e,r){return this.waitFor({sourceShellId:e},t=>t.sourceShellId===e,r).catch(t=>{throw new Error(g('Failed to get shell by ID "%s"',e),{cause:t})})}async waitForPort(e,r){return this.waitFor({port:e},t=>t.port===e,r).catch(t=>{throw new Error(g("Failed to await port %d",e),{cause:t})})}},Ge="https://nodebox-runtime.codesandbox.io",x=ne("emulator"),Je=class{constructor(e){p(this,"channel",null);p(this,"isConnected");p(this,"url");p(this,"fileSystemApi",null);p(this,"shellApi",null);p(this,"previewApi",null);this.options=e,L(this.options.iframe,'Failed to create a Nodebox: expected "iframe" argument to be a reference to an <iframe> element but got %j',this.options.iframe),this.url=this.options.runtimeUrl||Ge,this.isConnected=!1}async connect(){const{iframe:e,cdnUrl:r}=this.options;x("[message-sender]: Connecting to node emulator...");const t=new Y.DeferredPromise;this.url||t.reject(new Error("Nodebox URL is missing. Did you forget to provide it when creating this Nodebox instance?")),L(e.contentWindow,"Failed to create a MessageChannel with the Nodebox iframe: no content window found"),this.channel=new We(e.contentWindow);const n=new Y.DeferredPromise;return e.setAttribute("src",this.url),e.addEventListener("load",()=>{n.resolve()},{once:!0}),e.addEventListener("error",s=>{n.reject(s.error)},{once:!0}),await n,x("[message-sender]: IFrame loaded..."),await this.channel.handshake(),x("[message-sender]: Handshake completed..."),this.channel.send("connect",{cdnUrl:r}),this.channel.on("runtime/ready",()=>{t.resolve()}),t.then(()=>{x("[message-sender]: Connected to runtime..."),this.isConnected=!0})}get fs(){return L(this.isConnected,'Failed to access the File System API: consumer is not connected. Did you forget to run "connect()"?'),this.fileSystemApi?this.fileSystemApi:(this.fileSystemApi=new Ne(this.channel),this.fileSystemApi)}get shell(){return L(this.isConnected,'Failed to access the Shell API: consumer is not connected. Did you forget to run "connect()"?'),this.shellApi?this.shellApi:(this.shellApi=new qe(this.channel),this.shellApi)}get preview(){return L(this.isConnected,'Failed to access the Preview API: consumer is not connected. Did you forget to run "connect()"?'),this.previewApi?this.previewApi:(this.previewApi=new ze(this.channel),this.previewApi)}},Ye="INJECT_AND_INVOKE",Ke="PREVIEW_LOADED";function Xe(e,r){return E(this,void 0,void 0,function(){var t,n,s,i,o;return P(this,function(a){return t=e.contentWindow,N(t,"Failed to await preview iframe: no content window found"),n=9e4,s=20,i=0,[2,new Promise(function(c,l){var h=function(){var f=function(){clearTimeout(o),i=s,c(),e.removeEventListener("load",f)};if(i>=s){l(X("Could not able to connect to preview."));return}e.setAttribute("src",r),o=setTimeout(function(){h(),e.removeEventListener("load",f)},n),i=i+1,e.addEventListener("load",f)};e.addEventListener("error",function(){return l(new Error("Iframe error"))}),e.addEventListener("abort",function(){return l(new Error("Aborted"))}),h()})]})})}var Qe=function(e,r){e.style.border="0",e.style.width=r.width||"100%",e.style.height=r.height||"100%",e.style.overflow="hidden",e.allow="cross-origin-isolated"};function Ze(e){var r=e.scope,t=window.history.__proto__,n=[],s=0,i=function(c){parent.postMessage({type:"urlchange",url:c,back:s>0,forward:s<n.length-1,channelId:r.channelId},"*")};function o(c,l){n.splice(s+1),n.push({url:c,state:l}),s=n.length-1}Object.assign(window.history,{go:function(c){var l=s+c;if(l>=0&&l<=n.length-1){s=l;var h=n[s],f=h.url,v=h.state;t.replaceState.call(window.history,v,"",f);var w=document.location.href;i(w),window.dispatchEvent(new PopStateEvent("popstate",{state:v}))}},back:function(){window.history.go(-1)},forward:function(){window.history.go(1)},pushState:function(c,l,h){t.replaceState.call(window.history,c,l,h),o(h,c),i(document.location.href)},replaceState:function(c,l,h){t.replaceState.call(window.history,c,l,h),n[s]={state:c,url:h},i(document.location.href)}});function a(c){var l=c.data;l.type==="urlback"?history.back():l.type==="urlforward"?history.forward():l.type==="refresh"&&document.location.reload()}window.addEventListener("message",a)}function et(e){var r=e.scope,t=0;function n(){if(typeof window>"u")return 0;var a=document.body,c=document.documentElement;return Math.max(a.scrollHeight,a.offsetHeight,c.offsetHeight)}function s(){var a=n();t!==a&&window.parent.postMessage({type:"resize",height:a,codesandbox:!0,channelId:r.channelId},"*"),t=a}s();var i,o=new MutationObserver(function(){i===void 0&&(s(),i=setTimeout(function(){i=void 0},300))});o.observe(document,{attributes:!0,childList:!0,subtree:!0}),setInterval(s,300)}var tt=[{code:Ze.toString(),id:"historyListener"},{code:"function consoleHook({ scope }) {"+ce+`
4
+ };`,id:"consoleHook"},{code:et.toString(),id:"watchResize"}],rt=function(e,r){tt.forEach(function(t){var n,s=t.code,i=t.id,o={uid:i,type:Ye,code:"exports.activate = ".concat(s),scope:{channelId:r}};(n=e.contentWindow)===null||n===void 0||n.postMessage(o,"*")})},at=function(e){oe(r,e);function r(t,n,s){s===void 0&&(s={});var i=e.call(this,t,n,A(A({},s),{bundlerURL:s.bundlerURL}))||this;return i._modulesCache=new Map,i.messageChannelId=ue(),i._initPromise=null,i.emitter=new he,i.manageIframes(t),i.emulator=new Je({iframe:i.emulatorIframe,runtimeUrl:i.options.bundlerURL}),i.updateSandbox(n),i}return r.prototype._init=function(t){return E(this,void 0,void 0,function(){return P(this,function(n){switch(n.label){case 0:return[4,this.emulator.connect()];case 1:return n.sent(),[4,this.emulator.fs.init(t)];case 2:return n.sent(),[4,this.globalListeners()];case 3:return n.sent(),[2]}})})},r.prototype.compile=function(t){return E(this,void 0,void 0,function(){var n,s;return P(this,function(i){switch(i.label){case 0:return i.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 i.sent(),this.dispatch({type:"connected"}),[4,this.createShellProcessFromTask(t)];case 2:return n=i.sent().id,[4,this.createPreviewURLFromId(n)];case 3:return i.sent(),[4,this.setLocationURLIntoIFrame()];case 4:return i.sent(),this.dispatchDoneMessage(),[3,6];case 5:return s=i.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:G(s)}),this.dispatch({type:"done",compilatonError:!0}),[3,6];case 6:return[2]}})})},r.prototype.createShellProcessFromTask=function(t){return E(this,void 0,void 0,function(){var n,s,i=this;return P(this,function(o){switch(o.label){case 0:return n=U(t["/package.json"]),this.emulatorCommand=de(n),this.emulatorShellProcess=this.emulator.shell.create(),[4,this.emulatorShellProcess.on("exit",function(a){i.dispatch({type:"action",action:"notification",notificationType:"error",title:X("Error: process.exit(".concat(a,") called."))})})];case 1:return o.sent(),[4,this.emulatorShellProcess.on("progress",function(a){var c,l;if(a.state==="command_running"||a.state==="starting_command"){i.dispatch({type:"shell/progress",data:A(A({},a),{command:[(c=i.emulatorCommand)===null||c===void 0?void 0:c[0],(l=i.emulatorCommand)===null||l===void 0?void 0:l[1].join(" ")].join(" ")})}),i.status="installing-dependencies";return}i.dispatch({type:"shell/progress",data:a})})];case 2:return o.sent(),this.emulatorShellProcess.stdout.on("data",function(a){i.dispatch({type:"stdout",payload:{data:a,type:"out"}})}),this.emulatorShellProcess.stderr.on("data",function(a){i.dispatch({type:"stdout",payload:{data:a,type:"err"}})}),[4,(s=this.emulatorShellProcess).runCommand.apply(s,this.emulatorCommand)];case 3:return[2,o.sent()]}})})},r.prototype.createPreviewURLFromId=function(t){var n;return E(this,void 0,void 0,function(){var s;return P(this,function(i){switch(i.label){case 0:return this.iframePreviewUrl=void 0,[4,this.emulator.preview.getByShellId(t)];case 1:return s=i.sent().url,this.iframePreviewUrl=s+((n=this.options.startRoute)!==null&&n!==void 0?n:""),[2]}})})},r.prototype.manageIframes=function(t){var n;if(typeof t=="string"){var s=document.querySelector(t);N(s,"The element '".concat(t,"' was not found")),this.iframe=document.createElement("iframe"),s==null||s.appendChild(this.iframe)}else this.iframe=t;Qe(this.iframe,this.options),N(this.iframe.parentNode,"The given iframe does not have a parent."),this.emulatorIframe=document.createElement("iframe"),this.emulatorIframe.classList.add("sp-bridge-frame"),(n=this.iframe.parentNode)===null||n===void 0||n.appendChild(this.emulatorIframe)},r.prototype.setLocationURLIntoIFrame=function(){return E(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return this.iframePreviewUrl?[4,Xe(this.iframe,this.iframePreviewUrl)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},r.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})},r.prototype.globalListeners=function(){return E(this,void 0,void 0,function(){var t=this;return P(this,function(n){switch(n.label){case 0:return window.addEventListener("message",function(s){s.data.type===Ke&&rt(t.iframe,t.messageChannelId),s.data.type==="urlchange"&&s.data.channelId===t.messageChannelId?t.dispatch({type:"urlchange",url:s.data.url,back:s.data.back,forward:s.data.forward}):s.data.channelId===t.messageChannelId&&t.dispatch(s.data)}),[4,this.emulator.fs.watch(["*"],[".next","node_modules","build","dist","vendor",".config",".vuepress"],function(s){return E(t,void 0,void 0,function(){var i,o,a,c,l,h,f;return P(this,function(v){switch(v.label){case 0:return s?(i=s,o="newPath"in i?i.newPath:"path"in i?i.path:"",[4,this.emulator.fs.stat(o)]):[2];case 1:if(a=v.sent().type,a!=="file")return[2,null];v.label=2;case 2:switch(v.trys.push([2,10,,11]),c=i.type,c){case"change":return[3,3];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(i.path,"utf8")];case 4:return l=v.sent(),this.dispatch({type:"fs/change",path:i.path,content:l}),this._modulesCache.set(i.path,W(l)),[3,9];case 5:return this.dispatch({type:"fs/remove",path:i.path}),this._modulesCache.delete(i.path),[3,9];case 6:return this.dispatch({type:"fs/remove",path:i.oldPath}),this._modulesCache.delete(i.oldPath),[4,this.emulator.fs.readFile(i.newPath,"utf8")];case 7:return h=v.sent(),this.dispatch({type:"fs/change",path:i.newPath,content:h}),this._modulesCache.set(i.newPath,W(h)),[3,9];case 8:return[3,9];case 9:return[3,11];case 10:return f=v.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:G(f)}),[3,11];case 11:return[2]}})})})];case 1:return n.sent(),[2]}})})},r.prototype.restartShellProcess=function(){var t;return E(this,void 0,void 0,function(){return P(this,function(n){switch(n.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 n.sent(),(t=this.iframe)===null||t===void 0||t.removeAttribute("attr"),this.emulator.fs.rm("/node_modules/.vite",{recursive:!0,force:!0}),[4,this.compile(Object.fromEntries(this._modulesCache))];case 2:n.sent(),n.label=3;case 3:return[2]}})})},r.prototype.updateSandbox=function(t){var n=this,s,i=le(t.files);if(((s=this.emulatorShellProcess)===null||s===void 0?void 0:s.state)==="running"){Object.entries(i).forEach(function(o){var a=o[0],c=o[1];(!n._modulesCache.get(a)||U(c)!==U(n._modulesCache.get(a)))&&n.emulator.fs.writeFile(a,c,{recursive:!0})});return}this.dispatch({codesandbox:!0,modules:i,template:t.template,type:"compile"}),Object.entries(i).forEach(function(o){var a=o[0],c=o[1];n._modulesCache.set(a,W(c))})},r.prototype.dispatch=function(t){var n,s;return E(this,void 0,void 0,function(){var i;return P(this,function(o){switch(o.label){case 0:switch(i=t.type,i){case"compile":return[3,1];case"refresh":return[3,2];case"urlback":return[3,4];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 o.sent(),[3,8];case 4:return(s=(n=this.iframe)===null||n===void 0?void 0:n.contentWindow)===null||s===void 0||s.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),o.label=8;case 8:return[2]}})})},r.prototype.listen=function(t){return this.emitter.listener(t)},r.prototype.destroy=function(){this.emulatorIframe.remove(),this.emitter.cleanup()},r}(ae);export{at as SandpackNode};
index.html CHANGED
@@ -5,7 +5,7 @@
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>ArtiGround</title>
8
- <script type="module" crossorigin src="/assets/index-BXLUDbRI.js"></script>
9
  <link rel="stylesheet" crossorigin href="/assets/index-6RNjSBv1.css">
10
  </head>
11
  <body>
 
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>ArtiGround</title>
8
+ <script type="module" crossorigin src="/assets/index-DF1wlebW.js"></script>
9
  <link rel="stylesheet" crossorigin href="/assets/index-6RNjSBv1.css">
10
  </head>
11
  <body>
system_prompts/angular.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "task_description": "Generate or modify an Angular framework powered web app with a single app.component.ts based on a provided scenario description. Always output your response in two parts: a <Thinking> section for analysis and planning, followed by an <Artifact> section for the actual code. The <Thinking> section should include scenario analysis, scene description, and component listing. The <Artifact> section should contain the Angular TypeScript code for app.component.ts, accurately creating the visual design and layout of the website with a clean and minimalistic appearance.",
3
+ "requirements": [
4
+ "Always begin with a <Thinking> section that includes:",
5
+ " - Careful analysis of the provided scenario description",
6
+ " - Overall scene description based on the scenario",
7
+ " - List and categorization of components to be included",
8
+ " - For modifications, explanation of changes to be made",
9
+ "Always follow with an <Artifact> section that includes:",
10
+ " - Complete Angular TypeScript code for src/app/app.component.ts",
11
+ " - For modifications, the updated code with changes implemented",
12
+ "Use a minimalistic approach, focusing on simplicity and ease of navigation",
13
+ "Verify the code for any errors or inconsistencies before providing the response",
14
+ "Adhere to standard web design conventions, and follow best practices for coding",
15
+ "Consider the existing project structure and files when creating new components or modifying existing ones"
16
+ ],
17
+ "output_format": {
18
+ "structure": "Angular TypeScript code wrapped with <Artifact>",
19
+ "resources": "Angular resources hosted at Cloudflare",
20
+ "formatting": "Use a clear and organized format, with proper indentation and spacing",
21
+ "elements": "Include all necessary Angular components, CSS styles, and resources to create the website design. Embed all these resources into app.component.ts.",
22
+ "images": "Use embedded SVG for images. For larger images (bigger than 100px * 100px), include size labels in the SVG.",
23
+ "analysis": "Output the analysis, including the scene description and component list, in a <Thinking> section before the <Artifact> section"
24
+ },
25
+ "Artifact": [
26
+ "There should be at least two line breaks and two spaces before every <Artifact> tag.",
27
+ "The <Artifact> tag should include the following attributes:",
28
+ " - 'type' (MIME type of the artifact)",
29
+ " - 'filepath' (relative path of the artifact file in the project)",
30
+ " - 'title' (overview title of the artifact)",
31
+ "Don't wrap <Artifact> or the content inside <Artifact> with '```'."
32
+ ],
33
+ "output_example": "<Thinking>
34
+ Scene Description:
35
+ The scenario describes a simple landing page for a fictional company called 'Example Inc.' The page has a clean and minimalistic design with a header, main content area, and footer.
36
+
37
+ Components:
38
+ 1. Header
39
+ - Company name/logo
40
+ 2. Main Content
41
+ - Brief introduction or welcome message
42
+ - Company logo (SVG)
43
+ 3. Footer
44
+ - Copyright information
45
+
46
+ The design focuses on simplicity and ease of navigation, using a neutral color scheme and standard web design conventions.
47
+ </Thinking>
48
+
49
+ <Artifact type="application/artifacts.angular" filepath="src/app/app.component.ts" title="Example Inc. Landing Page">
50
+ import { Component } from '@angular/core';
51
+
52
+ @Component({
53
+ selector: 'app-root',
54
+ template: `
55
+ <div class="app">
56
+ <header>
57
+ <h1>Example Website</h1>
58
+ </header>
59
+ <main>
60
+ <p>This is the main content.</p>
61
+ <svg width="200" height="100" viewBox="0 0 200 100">
62
+ <rect width="200" height="100" fill="#f0f0f0" />
63
+ <text x="100" y="50" font-family="Arial" font-size="16" fill="#333" text-anchor="middle" dominant-baseline="middle">
64
+ Company Logo (200x100)
65
+ </text>
66
+ </svg>
67
+ </main>
68
+ <footer>
69
+ <p>&copy; 2024 Example Inc.</p>
70
+ </footer>
71
+ </div>
72
+ `,
73
+ styles: [`
74
+ .app {
75
+ font-family: Arial, sans-serif;
76
+ max-width: 800px;
77
+ margin: 0 auto;
78
+ padding: 20px;
79
+ }
80
+ header {
81
+ background-color: #f0f0f0;
82
+ padding: 10px;
83
+ }
84
+ main {
85
+ margin: 20px 0;
86
+ }
87
+ footer {
88
+ text-align: center;
89
+ font-size: 0.8em;
90
+ }
91
+ `]
92
+ })
93
+ export class AppComponent {
94
+ title = 'Example Website';
95
+ }
96
+ </Artifact>",
97
+ "resources": [
98
+ "Angular resources hosted at Cloudflare"
99
+ ],
100
+ "project_structure": {
101
+ "file_list": "{fileList}"
102
+ }
103
+ }