superleap-code-editor 1.0.27 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { _ as R, a as A, b as L } from "./index-DubmFJaq.mjs";
2
- import { a as $, E as H, b as N, c as W } from "./consoleHook-59e792cb-BENKPG8V.mjs";
3
- import { S as D } from "./base-80a1f760-BUp2JSxY.mjs";
1
+ import { _ as R, a as A, b as L } from "./index-XUF80T81.mjs";
2
+ import { a as $, E as H, b as N, c as W } from "./consoleHook-59e792cb-B2mDKKX0.mjs";
3
+ import { S as D } from "./base-80a1f760-8cUWWPNm.mjs";
4
4
  var k, U;
5
5
  function B() {
6
6
  if (U) return k;
@@ -184,12 +184,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
184
184
  - less than the value passed to \`max\` (or ${qb} if no \`max\` prop is set)
185
185
  - \`null\` or \`undefined\` if the progress is indeterminate.
186
186
 
187
- Defaulting to \`null\`.`}var Epe=dI,Dpe=pI;const Qpe=O.forwardRef(({value:t=0,max:e=100,className:n,color:r="primary",...i},a)=>{const o=`bg-${r}-base`;return d.jsx(Epe,{ref:a,value:t,max:e,className:X("relative h-8 w-full overflow-hidden rounded-128 bg-fill-default-fill-gray",n),...i,children:d.jsx(Dpe,{className:X("h-full transition-all",o),style:{width:`${t/e*100}%`}})})});Qpe.displayName="Progress";class gI{config;files=[];constructor(e){this.config=e}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(e){if(e==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${e} not found`)}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n),console.log(`Updated file ${e} with content:`,n)}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date().getMilliseconds()}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(e=>({id:`version-${e}`,name:`v${e}.js`,type:"file",path:`/versions/v${e}.js`,metadata:{language:"javascript"}}))}]}findFileById(e){const n=r=>{for(const i of r){if(i.id===e)return i;if(i.children){const a=n(i.children);if(a)return a}}return null};return n(this.files)}}class yI{config;files=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(e){if(e==="form-code")return this.config.codeContent;throw new Error(`File ${e} not found`)}async updateFileContent(e,n){if(e==="form-code"){this.config.codeContent=n;const r=this.files.find(i=>i.id===e);r&&(r.content=n)}}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}initializeFiles(){this.files=[{id:"form-code",name:this.config.fileName||"code.js",type:"file",path:`/${this.config.fileName||"code.js"}`,content:this.config.codeContent,metadata:{language:this.config.language||"javascript",lastModified:new Date().getMilliseconds()}}]}findFileById(e){return Jo(this.files,e)||null}}class bI{config;originalFiles=[];newFiles=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return[...this.originalFiles,...this.newFiles]}async getFileContent(e){const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return n.content;if(n.metadata&&"url"in n.metadata&&n.metadata.url)try{const r=await fetch(n.metadata.url);if(!r.ok)throw new Error(`Failed to fetch file: ${r.statusText}`);const i=await r.text();return n.content=i,i}catch(r){throw new Error(`Error fetching file content: ${r}`)}return""}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const r=e.split("/").pop()||"untitled",i={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:e,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(i),i}async createFolder(e){const n=e.split("/").pop()||"untitled",r={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:e,children:[],metadata:{lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(r),r}async deleteFile(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async deleteFolder(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return e.forEach(r=>{if(r.type==="file"&&r.content){const i=Un(r.path,r.name);n[i]=r.content}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:"1.0.0"}}}async loadEditorData(e){this.newFiles=[],e.files.forEach(n=>{n.metadata?.isNew&&this.newFiles.push(n)}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(i.content=r)})}initializeFiles(){this.originalFiles=this.config.fileUrls.map((e,n)=>({id:`url-file-${n}`,name:e.name,type:"file",path:`/${e.name}`,metadata:{language:e.type,url:e.url,lastModified:new Date().getMilliseconds()}}))}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Jo(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}}class Ape{config;originalFiles=[];newFiles=[];changeJournal=new Map;contentCache=new Map;PROVIDER_VERSION="1.0";constructor(e){this.config=e,this.initializeFiles()}async getFiles(){let e=[...this.originalFiles];for(const n of this.newFiles)this.changeJournal.get(n.id)!=="deleted"&&(e=oo(n,e));return this.filterDeletedFiles(e)}filterDeletedFiles(e){return e.filter(n=>this.changeJournal.get(n.id)!=="deleted").map(n=>({...n,children:n.children?this.filterDeletedFiles(n.children):void 0}))}async getFileContent(e){if(this.contentCache.has(e))return this.contentCache.get(e);const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return this.contentCache.set(e,n.content),n.content;try{const r=this.buildFileUrl(n),i=await fetch(r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);const a=await i.text();return this.contentCache.set(e,a),a}catch(r){throw new Error(`Error fetching file content: ${r}`)}}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,this.contentCache.set(e,n),this.changeJournal.has(e)||this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const{name:r,parentPath:i}=qO(e),a={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:i,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION}};return this.newFiles.push(a),this.changeJournal.set(a.id,"new"),this.contentCache.set(a.id,n),a}async createFolder(e){const{name:n,parentPath:r}=qO(e),i={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:r,children:[],metadata:{lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION}};return this.newFiles.push(i),this.changeJournal.set(i.id,"new"),i}async deleteFile(e){this.changeJournal.set(e,"deleted"),this.contentCache.delete(e)}async deleteFolder(e){this.changeJournal.set(e,"deleted")}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async saveAllChanges(){let e=[];const n=[],r=bi(this.originalFiles);for(const a of r)this.changeJournal.has(a.id)||(e=oo({...a,content:void 0},e));const i=this.changeJournal.entries();for(const[a,o]of i)if(o!=="deleted"&&(o==="new"||o==="modified")){const s=this.findFileById(a);if(!s)continue;try{s.type==="file"&&await this.uploadFile(s);const l={id:s.id,name:s.name,type:s.type,path:s.path,children:s.children,metadata:{...s.metadata,lastModified:new Date().getMilliseconds(),isNew:void 0,isDirty:void 0}};e=oo(l,e),s.type==="file"&&this.contentCache.delete(a)}catch(l){n.push(`Failed to upload ${s.name}: ${l}`)}}if(n.length>0)throw new Error(`Upload errors: ${n.join(", ")}`);return this.changeJournal.clear(),this.newFiles=[],e}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return this.contentCache.forEach((r,i)=>{const a=this.findFileById(i);if(a){const o=Un(a.path,a.name);n[o]=r}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:this.PROVIDER_VERSION}}}async loadEditorData(e){this.newFiles=[],this.changeJournal.clear(),this.contentCache.clear(),e.files.forEach(n=>{n.metadata?.isNew&&(this.newFiles.push(n),this.changeJournal.set(n.id,"new"))}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(this.contentCache.set(i.id,r),i.content=r)})}async uploadFile(e){if(!this.config)throw new Error("Configuration not provided");const n=await this.config.getAuthToken(),r=new FormData,i=e.content||this.contentCache.get(e.id)||"",a=new Blob([i],{type:this.getMimeTypeFromPath(e.path)});r.append("file",a,e.name),r.append("keep_file_name_unchanged","1");const o=this.buildS3Path(e.path);r.append("custom_path",o);const s=await fetch(this.config.uploadEndpoint,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Cache-Control":"no-cache"},body:r});if(!s.ok)throw new Error(`Upload failed: ${s.statusText}`)}buildFileUrl(e){if(!this.config?.base_url)throw new Error("Base URL not configured");const n=this.config.base_url.replace(/\/$/,""),i=e.path.split("/").filter(Boolean).map(o=>encodeURIComponent(o)).join("/"),a=encodeURIComponent(e.name);return`${n}/${i}${i?"/":""}${a}`}buildS3Path(e){const r=e.replace(/^\/+|\/+$/g,"").split("/");r.pop();const i=r.join("/");if(this.config?.base_url){const a=this.config.base_url.match(/\/file\/(.+)$/);if(a&&a[1])return i?`${a[1]}/${i}`:a[1]}return i}initializeFiles(){this.originalFiles=this.config?.files||[]}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Jo(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}getMimeTypeFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"application/javascript",ts:"application/typescript",jsx:"application/javascript",tsx:"application/typescript",html:"text/html",css:"text/css",json:"application/json",md:"text/markdown",py:"text/x-python",java:"text/x-java-source",cpp:"text/x-c++src",c:"text/x-csrc",txt:"text/plain"}[n||""]||"text/plain"}}function Hb(t){if(t.workflowConfig)return new gI(t.workflowConfig);if(t.formConfig)return new yI(t.formConfig);if(t.urlConfig)return new bI(t.urlConfig);if(t.externalFilesConfig)return new Ape(t.externalFilesConfig);throw new Error("No valid configuration provided")}var Et=(t=>(t.Explorer="explorer",t.Data="data",t.Functions="functions",t.Versions="versions",t.Tests="tests",t))(Et||{});const OI=t=>{switch(t){case 1:return"number";case 4:return"number";case 5:return"string";case 6:return"boolean";case 7:return"datetime";case 8:return"date";case 9:return"time";case 11:return"email";case 14:return"string";case 15:return"select";case 16:return"multiselect";case 17:return"url";case 20:return"file";case 21:return"phone";case 22:return"number";case 23:return"currency";case 24:return"select";case 18:return"string";case 27:return"string";case 29:return"file";default:return"custom"}},Rpe=t=>{switch(t){case"text":return"string";case"long_text":return"string";case"number":return"number";case"decimal":return"number";case"date_time":return"datetime";case"date":return"date";case"time":return"time";case"currency":return"currency";case"checkbox":return"boolean";case"rating":return"number";case"phone_number":return"phone";case"relationship":return"relationship";case"file_upload":return"file";case"multi_file_upload":return"file";case"email":return"email";case"url":return"url";case"single_select":return"select";case"multi_select":return"multiselect";case"stage":return"select";case"location":return"string";case"region":return"string";default:return"custom"}},$pe=t=>{switch(t){case 1:return"one-to-one";case 2:return"one-to-many";case 3:return"many-to-one";default:return"many-to-one"}},zpe=t=>{const e=OI(t.column_data_type),n={key:t.slug,name:t.slug,displayName:t.display_name,type:e,description:t.description||t.help_text,metadata:{required:!!t.is_required,unique:!!t.is_unique,primary:!!t.is_primary,nullable:!t.is_required,defaultValue:t.default_value,constraints:t.constraints||void 0}};return t.relationship_type&&t.relation&&(n.type="relationship",n.metadata.relationship={type:$pe(t.relationship_type),target:t.relation.object_slug,foreignKey:t.relation.column_slug}),t.enum_group&&t.enum_group.values&&(n.metadata.enum={options:t.enum_group.values.map(r=>({value:r.slug,label:r.display_name,badge:r.badge_config?{color:r.badge_config.class_name,icon:r.badge_config.start_icon}:void 0})),allowMultiple:e==="multiselect"}),t.properties?.format&&(n.metadata.format=t.properties.format),n},vI=(t,e)=>{const n=t.org_object_columns?t.org_object_columns.map(zpe):[];return{key:t.slug,name:t.slug,displayName:t.display_singular_name,type:"object",description:`${t.display_plural_name} - ${t.type} object`,children:n,count:e,category:t.type==="standard"?"Standard Objects":t.type==="custom"?"Custom Objects":"System Objects",metadata:{objectType:t.type,baseType:t.base_type,isHidden:!!t.is_hidden,properties:t.properties}}},Jb=(t,e)=>t.map(n=>vI(n,e?.[n.slug])),Fl=(t,e,n,r=[])=>{const i=[...r,e];let a,o,s;if(t===null)a="null";else if(t===void 0)a="undefined";else if(typeof t=="boolean")a="boolean";else if(typeof t=="number")a="number";else if(typeof t=="string")t.includes("@")&&t.includes(".")?a="email":t.startsWith("http://")||t.startsWith("https://")?a="url":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)?a="datetime":/^\d{4}-\d{2}-\d{2}$/.test(t)?a="date":/^\d{2}:\d{2}:\d{2}$/.test(t)?a="time":a="string";else if(typeof t=="function")a="function";else if(Array.isArray(t))a="array",s=t.length,o=t.slice(0,100).map((l,f)=>Fl(l,`${e}[${f}]`,`[${f}]`,i));else if(typeof t=="object"){a="object";const l=Object.entries(t);s=l.length,o=l.map(([f,c])=>Fl(c,`${e}.${f}`,f,i))}else a="custom";return{key:i.join("."),name:e,displayName:n||e,type:a,value:a==="object"||a==="array"?void 0:t,children:o,count:s,metadata:{path:i,originalType:typeof t}}},_pe=t=>t?Array.isArray(t)&&t.length>0&&"key"in t[0]&&"type"in t[0]?t:Array.isArray(t)&&t.length>0&&typeof t[0]=="object"&&t[0]!==null&&"org_object_columns"in t[0]?Jb(t):typeof t=="object"&&t!==null&&"org_object_columns"in t?[vI(t)]:Array.isArray(t)?t.map((e,n)=>Fl(e,`item_${n}`,`Item ${n}`)):[Fl(t,"root","Root")]:[],Zpe=()=>[{key:"users",name:"users",displayName:"Users",type:"object",count:1250,category:"Core Objects",children:[{key:"users.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"users.email",name:"email",type:"email",metadata:{unique:!0,required:!0}},{key:"users.profile",name:"profile",type:"object",children:[{key:"users.profile.firstName",name:"firstName",type:"string",metadata:{required:!0}},{key:"users.profile.lastName",name:"lastName",type:"string",metadata:{required:!0}},{key:"users.profile.avatar",name:"avatar",type:"file"}]},{key:"users.status",name:"status",type:"select",metadata:{enum:{options:[{value:"active",label:"Active",badge:{color:"green"}},{value:"inactive",label:"Inactive",badge:{color:"red"}},{value:"pending",label:"Pending",badge:{color:"orange"}}]}}}]},{key:"orders",name:"orders",displayName:"Orders",type:"object",count:5420,category:"Business Objects",children:[{key:"orders.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"orders.userId",name:"userId",type:"relationship",metadata:{relationship:{type:"many-to-one",target:"users",foreignKey:"id"}}},{key:"orders.total",name:"total",type:"currency",metadata:{required:!0}},{key:"orders.items",name:"items",type:"array",count:3,children:[{key:"orders.items[0]",name:"[0]",type:"object",children:[{key:"orders.items[0].productId",name:"productId",type:"number"},{key:"orders.items[0].quantity",name:"quantity",type:"number"},{key:"orders.items[0].price",name:"price",type:"currency"}]}]}]}];function wI(t){switch(t){case"ts":return"typescript";case"tsx":return"typescript";case"html":return"html";case"css":return"css";case"json":return"json";case"jsx":case"js":case"javascript":return"javascript";default:return"text"}}const Kb=({value:t,onChange:e,language:n="javascript",readOnly:r=!1,loading:i=!1})=>{const a=o=>{o!==void 0&&e(o)};return console.log({language:n}),d.jsx("div",{className:"h-full w-full",children:d.jsx(uQ,{loading:i,height:"100%",defaultLanguage:n,language:n,defaultValue:t,value:t,onChange:a,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:r}})})},Ype=[{id:Et.Explorer,icon:F.IconFolderOpen,label:"Files"},{id:Et.Data,icon:F.IconDatabase,label:"Data"},{id:Et.Functions,icon:F.IconCode,label:"Functions"},{id:Et.Versions,icon:F.IconHistory,label:"Versions"},{id:Et.Tests,icon:F.IconFlask,label:"Tests"}],Bpe=({activePanel:t,setActivePanel:e,allowedPannels:n})=>{const r=x.useMemo(()=>Ype.filter(i=>n.includes(i.id)),[n]);return d.jsx("div",{className:"border-r-1/2 border-borderColor-border-primary flex flex-col gap-8 items-center py-12 px-12 m-0",children:r.map(i=>{const a=i.icon;return d.jsx(nh,{children:d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:d.jsx(rt,{variant:t===i.id?"primary":"ghost",icon:d.jsx(a,{size:16}),onClick:()=>e(i.id),className:"p-8"})}),d.jsx(Mf,{align:"center",side:"right",children:i.label})]})},i.id)})})},eO=({leftPanel:t,editor:e,rightPanel:n,activePanel:r,setActivePanel:i,allowedPannels:a=[Et.Explorer]})=>d.jsxs("div",{className:"flex flex-1 overflow-hidden ",children:[d.jsx(Bpe,{activePanel:r,setActivePanel:i,allowedPannels:a}),d.jsx("div",{className:"flex-1",children:n?d.jsxs(Xi.Splitter,{style:{height:"100%"},children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:"50%",min:"30%",children:e}),d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"20%",max:"60%",className:"bg-white !border-borderColor-border-primary",collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:n})})]}):d.jsxs(Xi.Splitter,{style:{height:"100%"},children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:"75%",min:"60%",children:e})]})})]});function Wpe(t){return["html","css","json","javascript","typescript","jsx","tsx"].includes(t)}function xI(t){return[...t].sort((e,n)=>e.type==="folder"&&n.type==="file"?-1:e.type==="file"&&n.type==="folder"?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase())).map(e=>({...e,children:e.children?xI(e.children):void 0}))}const SI=({activeFile:t,showPreview:e,setShowPreview:n,handleOnSave:r,className:i,extras:a})=>{const o=Wpe(t?.metadata?.language||"");return d.jsxs("div",{className:`bg-white flex items-center justify-between px-16 py-8 ${i}`,children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("h1",{className:"text-semi-18 text-typography-primary-text mr-4",children:"CRM Code Editor"}),t&&d.jsx(ea,{className:"text-typography-tertiary-text",children:t.name})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[o&&d.jsx(rt,{variant:"ghost",onClick:()=>n?.(!e),title:e?"Hide Preview":"Show Preview",icon:e?d.jsx(F.IconEyeOff,{}):d.jsx(F.IconEye,{})}),d.jsx(rt,{variant:"primary",onClick:r,children:"Save"}),a]})]})},MI=({item:t,depth:e=0,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o})=>{const[s,l]=x.useState(t.isExpanded||!1),f=t.children&&t.children.length>0,c=x.useCallback(()=>{if(n){const h=a(o,t.key);h&&n(t,h)}},[n,a,o,t]),u=x.useCallback(h=>{h.stopPropagation(),l(!s)},[s]);return d.jsxs("div",{className:t.isVirtual?"opacity-60":"",children:[d.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 hover:bg-neutral-surface-hover cursor-pointer rounded transition-colors",style:{paddingLeft:`${e*16+8}px`},onClick:c,children:[f?d.jsx(rt,{variant:"linkInline",size:"small",onClick:u,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":s?"Collapse":"Expand",children:s?d.jsx(F.IconChevronDown,{size:16}):d.jsx(F.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[r(t.type,t.metadata),i(t)]})]}),f&&s&&d.jsx("div",{children:t.children.map(h=>d.jsx(MI,{item:h,depth:e+1,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o},h.key))})]})},Fpe=({items:t,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,className:a=""})=>d.jsx("div",{className:`data-explorer-tree ${a}`,children:t.map(o=>d.jsx(MI,{item:o,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,organizedData:t},o.key))}),Xpe=({data:t=[],title:e="Data Explorer",searchPlaceholder:n="Search data...",onItemSelect:r,onRefresh:i,showMetadata:a=!0,showCounts:o=!0,groupByCategory:s=!1,sortByName:l=!1,sortOrder:f="asc",customIcons:c={},customRenderers:u={},filters:h})=>{const[p,g]=x.useState(""),[m,y]=x.useState(l),[b,v]=x.useState(f),w=x.useCallback((T,D)=>{if(c[T])return c[T];const N={size:16,className:"text-typography-tertiary-text"};switch(T){case"object":return d.jsx(F.IconDatabase,{...N});case"array":return d.jsx(F.IconList,{...N});case"string":return d.jsx(F.IconLetterT,{...N});case"number":return d.jsx(F.IconHash,{...N});case"boolean":return d.jsx(F.IconCheck,{...N});case"date":case"datetime":return d.jsx(F.IconCalendar,{...N});case"time":return d.jsx(F.IconClock,{...N});case"email":return d.jsx(F.IconMail,{...N});case"url":return d.jsx(F.IconWorld,{...N});case"phone":return d.jsx(F.IconPhone,{...N});case"currency":return d.jsx(F.IconCurrency,{...N});case"file":case"image":return d.jsx(F.IconFile,{...N});case"select":case"multiselect":case"enum":return d.jsx(F.IconTag,{...N});case"relationship":return d.jsx(F.IconLink,{...N});default:return D?.primary?d.jsx(F.IconKey,{...N,className:"text-warning-base"}):d.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-reg-10 text-typography-quaternary-text",children:"•"})}},[c]),S=x.useCallback((T,D)=>{if(D?.primary)return"text-warning-text-base font-normal";if(D?.required)return"text-info-text-base";if(D?.unique)return"text-success-text-base";switch(T){case"object":return"text-typography-secondary-text font-normal";case"relationship":return"text-purple-text-base";case"enum":case"select":case"multiselect":return"text-warning-text-base";default:return"text-typography-tertiary-text"}},[]),C=x.useCallback(T=>{if(u[T.type])return u[T.type](T);const D=T.displayName||T.name,N=[];if(a&&T.metadata){const{metadata:L}=T;L.primary&&N.push(d.jsx(ea,{color:"warning",size:"small",className:"!text-reg-10 min-w-fit",children:"PK"},"primary")),L.required&&N.push(d.jsx(ea,{color:"info",size:"small",className:"!text-reg-10 min-w-fit",children:"Required"},"required")),L.unique&&N.push(d.jsx(ea,{color:"success",size:"small",className:"!text-reg-10 min-w-fit",children:"Unique"},"unique")),L.relationship&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-reg-10 min-w-fit",children:L.relationship.type.toUpperCase()},"relationship"))}o&&typeof T.count=="number"&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-[10px] min-w-fit",children:T.count},"count"));const Z=d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("span",{className:`truncate ${S(T.type,T.metadata)}`,children:D}),N.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:N})]});if(T.description||T.metadata){const L=d.jsxs("div",{children:[T.description&&d.jsx("div",{children:T.description}),T.metadata&&d.jsxs("div",{className:"mt-1 text-reg-12",children:[d.jsxs("div",{className:"text-reg-12",children:["Type: ",T.type]}),T.metadata.defaultValue!==void 0&&d.jsxs("div",{children:["Default: ",String(T.metadata.defaultValue)]}),T.metadata.format&&d.jsxs("div",{children:["Format: ",T.metadata.format]})]})]});return d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:Z}),d.jsx(Mf,{children:L})]})}return Z},[u,a,o,S]),M=x.useCallback(T=>m?[...T].sort((N,Z)=>{const L=(N.displayName||N.name).toLowerCase(),Q=(Z.displayName||Z.name).toLowerCase();return b==="asc"?L.localeCompare(Q):Q.localeCompare(L)}).map(N=>({...N,children:N.children?M(N.children):void 0})):T,[m,b]),j=x.useMemo(()=>{const T=N=>{if(h?.types&&!h.types.includes(N.type)||h?.categories&&N.category&&!h.categories.includes(N.category)||h?.showOnlyWithChildren&&(!N.children||N.children.length===0))return!1;if(p){const Z=p.toLowerCase(),L=N.name.toLowerCase().includes(Z)||(N.displayName?.toLowerCase().includes(Z)??!1),Q=N.description?.toLowerCase().includes(Z)??!1,R=N.children?.some($=>T($))??!1;return L||Q||R}return!0},D=N=>N.filter(T).map(Z=>({...Z,children:Z.children?D(Z.children):void 0}));return D(t)},[t,p,h]),k=x.useCallback((T,D,N=[])=>{for(const Z of T){const L=[...N,Z.name];if(Z.key===D)return L;if(Z.children){const Q=k(Z.children,D,L);if(Q)return Q}}return null},[]),I=x.useMemo(()=>{let T=j;if(s){const D=T.reduce((N,Z)=>{const L=Z.category||"Uncategorized";return N[L]||(N[L]=[]),N[L].push(Z),N},{});T=Object.entries(D).map(([N,Z])=>({key:`category-${N}`,name:N,displayName:N,type:"object",children:M(Z),count:Z.length}))}return M(T)},[j,s,M]);return d.jsx(nh,{children:d.jsxs(H1,{className:"h-full flex flex-col border-0 shadow-none",children:[d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(K1,{className:"text-semi-14 font-medium",children:e}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(rt,{variant:"ghost",startIcon:m?b==="asc"?d.jsx(F.IconSortAscending,{size:16}):d.jsx(F.IconSortDescending,{size:16}):d.jsx(F.IconSortAscending,{size:16,className:"opacity-50"}),title:m?`Sort by name (${b==="asc"?"A-Z":"Z-A"})`:"Sort by name",size:"small",onClick:()=>{m?b==="asc"?v("desc"):y(!1):(y(!0),v("asc"))},className:m?"text-info-text-base":""}),i&&d.jsx(rt,{variant:"ghost",startIcon:d.jsx(F.IconRefresh,{size:16}),title:"Refresh data",size:"small",onClick:i})]})]}),d.jsxs(ey,{className:"flex-1 flex flex-col p-0",children:[d.jsx("div",{className:"p-4 pt-0",children:d.jsx(Lf,{placeholder:n,startIcon:d.jsx(F.IconSearch,{size:16,className:"text-typography-quaternary-text"}),value:p,onChange:T=>g(T.target.value),inputSize:"small",variant:"borderless"})}),d.jsx(Lb,{}),d.jsx(bN,{className:"flex-1",children:d.jsx("div",{className:"p-8",children:d.jsx(Fpe,{items:I,onItemSelect:r,getTypeIcon:w,renderItemTitle:C,findItemPath:k})})})]})]})})},CI=t=>d.jsx(Xpe,{...t}),Vpe=t=>{switch(t.split(".").pop()?.toLowerCase()){case"html":case"htm":return"/html.svg";case"css":return"/css.svg";case"js":case"jsx":case"mjs":case"cjs":return"/js.svg";default:return null}};function jI({file:t,depth:e=0,activeFile:n,selectedItemId:r,onFileSelect:i,onItemSelect:a,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:c}){const[u,h]=x.useState(!0);console.log({selectedItemId:r,file:t});const[p,g]=x.useState(!1),[m,y]=x.useState(!1),[b,v]=x.useState(t.name),w=t.children&&t.children.length>0,S=n===t.id,C=r===t.id,M=t.metadata?.isNew,j=M&&!t.name,k=x.useRef(null),I=x.useCallback(()=>{a&&a(t.id),t.type==="file"&&i(t.id)},[t.id,t.type,i,a]),T=x.useCallback(P=>{P.stopPropagation(),h(!u)},[u]),D=x.useCallback(P=>{P.preventDefault(),P.stopPropagation(),g(!0)},[]),N=x.useCallback(()=>{y(!0),g(!1)},[]),Z=x.useCallback(()=>{b.trim()&&b!==t.name&&f&&(j&&c?c({name:b}):f(t.id,b.trim()),k.current?.blur()),y(!1)},[b,t.name,t.id,f,j,c]),L=x.useCallback(()=>{v(t.name),y(!1)},[t.name]),Q=x.useCallback(()=>{l&&l(t.id),g(!1)},[t.id,l]),R=x.useCallback(()=>{if(o){const P=bu(t);o(P)}g(!1)},[t,o]),$=x.useCallback(()=>{if(s){const P=bu(t);s(P)}g(!1)},[t,s]);return d.jsxs("div",{children:[d.jsxs("div",{className:`flex items-center gap-2 py-1 px-2 hover:bg-primary-surface-hover border-primary-surface-hover cursor-pointer rounded transition-colors relative ${C?"bg-primary-surface text-primary-text-base border-t-1/2 border-b-1/2 ":""} ${M?"bg-success-surface":""}`,style:{paddingLeft:`${e*16+8}px`},onClick:I,onContextMenu:D,children:[w?d.jsx(rt,{variant:"linkInline",size:"small",onClick:T,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":u?"Collapse":"Expand",children:u?d.jsx(F.IconChevronDown,{size:16}):d.jsx(F.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-6 min-w-0 flex-1",children:[t.type==="file"?(()=>{const P=Vpe(t.name);return P?d.jsx("img",{src:P,alt:`${t.name} icon`,width:18,height:18,className:"text-typography-tertiary-text"}):d.jsx(F.IconFile,{size:16,className:"text-typography-tertiary-text"})})():d.jsx(F.IconFolderOpen,{size:16,className:"text-typography-tertiary-text"}),m||j?d.jsx("input",{ref:k,value:b,onChange:P=>v(P.target.value),onBlur:Z,onKeyDown:P=>{P.key==="Enter"&&Z(),P.key==="Escape"&&L()},className:"text-semi-14 h-full bg-transparent",autoFocus:!0}):d.jsx("span",{className:`truncate ${S?"font-medium":""}`,children:t.name})]}),p&&d.jsx("div",{className:"absolute right-2 top-0 bg-white border border-borderColor-border-primary rounded-8 shadow-soft-medium z-10 min-w-32",children:d.jsxs("div",{className:"py-1",children:[t.type==="folder"&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:R,children:[d.jsx(F.IconFile,{size:14}),"New File"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:$,children:[d.jsx(F.IconFolderOpen,{size:14}),"New Folder"]}),d.jsx("div",{className:"border-t border-borderColor-border-primary my-1"})]}),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-sm hover:bg-gray-100 flex items-center gap-2",onClick:N,children:[d.jsx(F.IconEdit,{size:14}),"Rename"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover text-error-text-base flex items-center gap-2",onClick:Q,children:[d.jsx(F.IconTrash,{size:14}),"Delete"]})]})]})})]}),w&&u&&d.jsx("div",{children:t.children.map(P=>d.jsx(jI,{file:P,depth:e+1,activeFile:n,onFileSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,onItemSelect:a,selectedItemId:r,handleItemUpdate:c},P.id))})]})}function Gpe({files:t,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f}){return d.jsx("div",{className:"file-explorer-tree",children:t.map(c=>d.jsx(jI,{file:c,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f},c.id))})}function Upe({handleItemUpdate:t,isFileExplorerHovered:e,activeFileData:n,selectedItemData:r}){const i=()=>{const o=r||n,s=o?bu(o):"";t({name:"",type:"file",path:s})},a=()=>{const o=r||n,s=o?bu(o):"";t({name:"",type:"folder",path:s})};return d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 p-0 px-12",children:[d.jsx(K1,{className:"!text-med-13 text-typography-tertiary-text py-8",children:"Files"}),e&&d.jsxs("div",{className:"flex items-center ",children:[d.jsx(rt,{variant:"ghost",icon:d.jsx(F.IconFilePlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new file or folder",onClick:i}),d.jsx(rt,{variant:"ghost",icon:d.jsx(F.IconFolderPlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new file or folder",onClick:a})]})]})}const tO=({files:t,activeFileData:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,error:a=null,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f})=>{const[c,u]=x.useState(!1),[h,p]=x.useState();console.log({newItemData:h});const g=x.useCallback((v,w)=>{for(const S of v){if(S.id===w)return S;if(S.children){const C=g(S.children,w);if(C)return C}}},[]),m=n?g(t,n):void 0,y=x.useCallback(v=>{p(w=>v&&w?{...w,...v}:v?{...v}:w)},[]);x.useEffect(()=>{if(h&&h.name&&h.name.trim()){const v=h.type,w=Un(h.path,h.name.trim());v==="file"?o?.(w):s?.(w),p(void 0)}},[h,o,s]);const b=x.useMemo(()=>{let v=[...t];if(h&&h.path!==void 0){const w=Un(h.path,h.name),S={id:`new-${h.type}`,name:h.name,type:h.type,path:w,children:[],metadata:{isNew:!0}};v=oo(S,v)}return xI(v)},[t,h]);return d.jsx(d.Fragment,{children:d.jsxs(H1,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:"h-full flex flex-col border-0 shadow-none",children:[d.jsx(Upe,{isFileExplorerHovered:c,handleItemUpdate:y,activeFileData:e,selectedItemData:m}),d.jsx(ey,{className:"flex-1 flex flex-col p-0",children:d.jsxs("div",{className:"",children:[a&&d.jsx(aC,{title:"Error loading files",description:a,color:"error"}),d.jsx(Gpe,{files:b,activeFile:e?.id||null,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:y})]})})]})})},kI=()=>{const t=[{name:"formatCurrency",description:"Format a number as currency",category:"Formatting"},{name:"calculateDiscount",description:"Calculate discount based on amount",category:"Calculations"},{name:"getLeadData",description:"Fetch lead data from CRM",category:"Data Access"},{name:"updateContact",description:"Update contact information",category:"Data Modification"},{name:"sendEmail",description:"Send an email to a contact",category:"Communication"},{name:"validateEmail",description:"Validate email format",category:"Validation"}];return d.jsxs("div",{className:"h-full",children:[d.jsx("div",{className:"flex items-center justify-between p-4 border-b border-borderColor-border-primary",children:d.jsx("h2",{className:"font-medium text-semi-14",children:"Function Library"})}),d.jsxs("div",{className:"p-3",children:[d.jsxs("div",{className:"relative mb-3",children:[d.jsx(F.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-typography-quaternary-text"}),d.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-semi-14 border border-borderColor-border-primary rounded-8 focus:outline-none focus:ring-2 focus:ring-primary-border"})]}),d.jsx("div",{children:t.map(e=>d.jsxs("div",{className:"p-2 border border-borderColor-border-primary rounded-8 mb-2 hover:bg-neutral-surface-hover cursor-pointer",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(F.IconCode,{size:16,className:"mr-2 text-typography-tertiary-text"}),d.jsx("span",{className:"text-semi-14 font-medium",children:e.name})]}),d.jsx("span",{className:"text-reg-12 bg-neutral-surface px-2 py-0.5 rounded text-typography-tertiary-text",children:e.category})]}),d.jsx("p",{className:"text-reg-12 text-typography-tertiary-text mt-1",children:e.description})]},e.name))}),d.jsxs("div",{className:"mt-4 p-3 bg-neutral-surface rounded-8 border border-borderColor-border-primary flex items-center",children:[d.jsx(F.IconBook,{size:16,className:"text-typography-tertiary-text mr-2"}),d.jsx("span",{className:"text-reg-12 text-typography-tertiary-text",children:"Browse documentation for more functions and examples"})]})]})]})};var Ve="colors",Vt="sizes",he="space",qpe={gap:he,gridGap:he,columnGap:he,gridColumnGap:he,rowGap:he,gridRowGap:he,inset:he,insetBlock:he,insetBlockEnd:he,insetBlockStart:he,insetInline:he,insetInlineEnd:he,insetInlineStart:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,marginBlock:he,marginBlockEnd:he,marginBlockStart:he,marginInline:he,marginInlineEnd:he,marginInlineStart:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,paddingBlock:he,paddingBlockEnd:he,paddingBlockStart:he,paddingInline:he,paddingInlineEnd:he,paddingInlineStart:he,top:he,right:he,bottom:he,left:he,scrollMargin:he,scrollMarginTop:he,scrollMarginRight:he,scrollMarginBottom:he,scrollMarginLeft:he,scrollMarginX:he,scrollMarginY:he,scrollMarginBlock:he,scrollMarginBlockEnd:he,scrollMarginBlockStart:he,scrollMarginInline:he,scrollMarginInlineEnd:he,scrollMarginInlineStart:he,scrollPadding:he,scrollPaddingTop:he,scrollPaddingRight:he,scrollPaddingBottom:he,scrollPaddingLeft:he,scrollPaddingX:he,scrollPaddingY:he,scrollPaddingBlock:he,scrollPaddingBlockEnd:he,scrollPaddingBlockStart:he,scrollPaddingInline:he,scrollPaddingInlineEnd:he,scrollPaddingInlineStart:he,fontSize:"fontSizes",background:Ve,backgroundColor:Ve,backgroundImage:Ve,borderImage:Ve,border:Ve,borderBlock:Ve,borderBlockEnd:Ve,borderBlockStart:Ve,borderBottom:Ve,borderBottomColor:Ve,borderColor:Ve,borderInline:Ve,borderInlineEnd:Ve,borderInlineStart:Ve,borderLeft:Ve,borderLeftColor:Ve,borderRight:Ve,borderRightColor:Ve,borderTop:Ve,borderTopColor:Ve,caretColor:Ve,color:Ve,columnRuleColor:Ve,fill:Ve,outline:Ve,outlineColor:Ve,stroke:Ve,textDecorationColor:Ve,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Vt,minBlockSize:Vt,maxBlockSize:Vt,inlineSize:Vt,minInlineSize:Vt,maxInlineSize:Vt,width:Vt,minWidth:Vt,maxWidth:Vt,height:Vt,minHeight:Vt,maxHeight:Vt,flexBasis:Vt,gridTemplateColumns:Vt,gridTemplateRows:Vt,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},Hpe=(t,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,Bf=()=>{const t=Object.create(null);return(e,n,...r)=>{const i=(a=>JSON.stringify(a,Hpe))(e);return i in t?t[i]:t[i]=n(e,...r)}},ru=Symbol.for("sxs.internal"),nO=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),a2=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:Jpe}=Object.prototype,xg=t=>t.includes("-")?t:t.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),Kpe=/\s+(?![^()]*\))/,Ua=t=>e=>t(...typeof e=="string"?String(e).split(Kpe):[e]),o2={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:Ua(((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t}))),marginInline:Ua(((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t}))),maxSize:Ua(((t,e)=>({maxBlockSize:t,maxInlineSize:e||t}))),minSize:Ua(((t,e)=>({minBlockSize:t,minInlineSize:e||t}))),paddingBlock:Ua(((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t}))),paddingInline:Ua(((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t})))},g0=/([\d.]+)([^]*)/,e0e=(t,e)=>t.length?t.reduce(((n,r)=>(n.push(...e.map((i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i))),n)),[]):e,t0e=(t,e)=>t in n0e&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((n,r,i,a)=>r+(i==="stretch"?`-moz-available${a};${xg(t)}:${r}-webkit-fill-available`:`-moz-fit-content${a};${xg(t)}:${r}fit-content`)+a)):String(e),n0e={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},ni=t=>t?t+"-":"",LI=(t,e,n)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((r,i,a,o,s)=>o=="$"==!!a?r:(i||o=="--"?"calc(":"")+"var(--"+(o==="$"?ni(e)+(s.includes("$")?"":ni(n))+s.replace(/\$/g,"-"):s)+")"+(i||o=="--"?"*"+(i||"")+(a||"1")+")":""))),r0e=/\s*,\s*(?![^()]*\))/,i0e=Object.prototype.toString,no=(t,e,n,r,i)=>{let a,o,s;const l=(f,c,u)=>{let h,p;const g=m=>{for(h in m){const v=h.charCodeAt(0)===64,w=v&&Array.isArray(m[h])?m[h]:[m[h]];for(p of w){const S=/[A-Z]/.test(b=h)?b:b.replace(/-[^]/g,(M=>M[1].toUpperCase())),C=typeof p=="object"&&p&&p.toString===i0e&&(!r.utils[S]||!c.length);if(S in r.utils&&!C){const M=r.utils[S];if(M!==o){o=M,g(M(p)),o=null;continue}}else if(S in o2){const M=o2[S];if(M!==s){s=M,g(M(p)),s=null;continue}}if(v&&(y=h.slice(1)in r.media?"@media "+r.media[h.slice(1)]:h,h=y.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((M,j,k,I,T,D)=>{const N=g0.test(j),Z=.0625*(N?-1:1),[L,Q]=N?[I,j]:[j,I];return"("+(k[0]==="="?"":k[0]===">"===N?"max-":"min-")+L+":"+(k[0]!=="="&&k.length===1?Q.replace(g0,((R,$,P)=>Number($)+Z*(k===">"?1:-1)+P)):Q)+(T?") and ("+(T[0]===">"?"min-":"max-")+L+":"+(T.length===1?D.replace(g0,((R,$,P)=>Number($)+Z*(T===">"?-1:1)+P)):D):"")+")"}))),C){const M=v?u.concat(h):[...u],j=v?[...c]:e0e(c,h.split(r0e));a!==void 0&&i(s2(...a)),a=void 0,l(p,j,M)}else a===void 0&&(a=[[],c,u]),h=v||h.charCodeAt(0)!==36?h:`--${ni(r.prefix)}${h.slice(1).replace(/\$/g,"-")}`,p=C?p:typeof p=="number"?p&&S in a0e?String(p)+"px":String(p):LI(t0e(S,p??""),r.prefix,r.themeMap[S]),a[0].push(`${v?`${h} `:`${xg(h)}:`}${p}`)}}var y,b};g(f),a!==void 0&&i(s2(...a)),a=void 0};l(t,e,n)},s2=(t,e,n)=>`${n.map((r=>`${r}{`)).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,a0e={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},l2=t=>String.fromCharCode(t+(t>25?39:97)),oa=t=>(e=>{let n,r="";for(n=Math.abs(e);n>52;n=n/52|0)r=l2(n%52)+r;return l2(n%52)+r})(((e,n)=>{let r=n.length;for(;r;)e=33*e^n.charCodeAt(--r);return e})(5381,JSON.stringify(t))>>>0),sl=["themed","global","styled","onevar","resonevar","allvar","inline"],o0e=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch{return!1}},s0e=t=>{let e;const n=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,((a,o)=>{const{cssText:s}=a;let l="";if(s.startsWith("--sxs"))return"";if(i[o-1]&&(l=i[o-1].cssText).startsWith("--sxs")){if(!a.cssRules.length)return"";for(const f in e.rules)if(e.rules[f].group===a)return`--sxs{--sxs:${[...e.rules[f].cache].join(" ")}}${s}`;return a.cssRules.length?`${l}${s}`:""}return s})).join("")},r=()=>{if(e){const{rules:s,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const f in s)delete s[f]}const i=Object(t).styleSheets||[];for(const s of i)if(o0e(s)){for(let l=0,f=s.cssRules;f[l];++l){const c=Object(f[l]);if(c.type!==1)continue;const u=Object(f[l+1]);if(u.type!==4)continue;++l;const{cssText:h}=c;if(!h.startsWith("--sxs"))continue;const p=h.slice(14,-3).trim().split(/\s+/),g=sl[p[0]];g&&(e||(e={sheet:s,reset:r,rules:{},toString:n}),e.rules[g]={group:u,index:l,cache:new Set(p)})}if(e)break}if(!e){const s=(l,f)=>({type:f,cssRules:[],insertRule(c,u){this.cssRules.splice(u,0,s(c,{import:3,undefined:1}[(c.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,(c=>c.cssText)).join("")}}`:l}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:s("","text/css"),rules:{},reset:r,toString:n}}const{sheet:a,rules:o}=e;for(let s=sl.length-1;s>=0;--s){const l=sl[s];if(!o[l]){const f=sl[s+1],c=o[f]?o[f].index:a.cssRules.length;a.insertRule("@media{}",c),a.insertRule(`--sxs{--sxs:${s}}`,c),o[l]={group:a.cssRules[c+1],index:c,cache:new Set([s])}}l0e(o[l])}};return r(),e},l0e=t=>{const e=t.group;let n=e.cssRules.length;t.apply=r=>{try{e.insertRule(r,n),++n}catch{}}},Ws=Symbol(),f0e=Bf(),c0e=(t,e)=>f0e(t,(()=>(...n)=>{let r={type:null,composers:new Set};for(const i of n)if(i!=null)if(i[ru]){r.type==null&&(r.type=i[ru].type);for(const a of i[ru].composers)r.composers.add(a)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(u0e(i,t));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),d0e(t,r,e)})),u0e=({variants:t,compoundVariants:e,defaultVariants:n,...r},i)=>{const a=`${ni(i.prefix)}c-${oa(r)}`,o=[],s=[],l=Object.create(null),f=[];for(const h in n)l[h]=String(n[h]);if(typeof t=="object"&&t)for(const h in t){c=l,u=h,Jpe.call(c,u)||(l[h]="undefined");const p=t[h];for(const g in p){const m={[h]:String(g)};String(g)==="undefined"&&f.push(h);const y=p[g],b=[m,y,!a2(y)];o.push(b)}}var c,u;if(typeof e=="object"&&e)for(const h of e){let{css:p,...g}=h;p=typeof p=="object"&&p||{};for(const y in g)g[y]=String(g[y]);const m=[g,p,!a2(p)];s.push(m)}return[a,r,o,s,l,f]},d0e=(t,e,n)=>{const[r,i,a,o]=h0e(e.composers),s=typeof e.type=="function"||e.type.$$typeof?(u=>{function h(){for(let p=0;p<h[Ws].length;p++){const[g,m]=h[Ws][p];u.rules[g].apply(m)}return h[Ws]=[],null}return h[Ws]=[],h.rules={},sl.forEach((p=>h.rules[p]={apply:g=>h[Ws].push([p,g])})),h})(n):null,l=(s||n).rules,f=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,c=u=>{u=typeof u=="object"&&u||p0e;const{css:h,...p}=u,g={};for(const b in a)if(delete p[b],b in u){let v=u[b];typeof v=="object"&&v?g[b]={"@initial":a[b],...v}:(v=String(v),g[b]=v!=="undefined"||o.has(b)?v:a[b])}else g[b]=a[b];const m=new Set([...i]);for(const[b,v,w,S]of e.composers){n.rules.styled.cache.has(b)||(n.rules.styled.cache.add(b),no(v,[`.${b}`],[],t,(j=>{l.styled.apply(j)})));const C=f2(w,g,t.media),M=f2(S,g,t.media,!0);for(const j of C)if(j!==void 0)for(const[k,I,T]of j){const D=`${b}-${oa(I)}-${k}`;m.add(D);const N=(T?n.rules.resonevar:n.rules.onevar).cache,Z=T?l.resonevar:l.onevar;N.has(D)||(N.add(D),no(I,[`.${D}`],[],t,(L=>{Z.apply(L)})))}for(const j of M)if(j!==void 0)for(const[k,I]of j){const T=`${b}-${oa(I)}-${k}`;m.add(T),n.rules.allvar.cache.has(T)||(n.rules.allvar.cache.add(T),no(I,[`.${T}`],[],t,(D=>{l.allvar.apply(D)})))}}if(typeof h=="object"&&h){const b=`${r}-i${oa(h)}-css`;m.add(b),n.rules.inline.cache.has(b)||(n.rules.inline.cache.add(b),no(h,[`.${b}`],[],t,(v=>{l.inline.apply(v)})))}for(const b of String(u.className||"").trim().split(/\s+/))b&&m.add(b);const y=p.className=[...m].join(" ");return{type:e.type,className:y,selector:f,props:p,toString:()=>y,deferredInjector:s}};return nO(c,{className:r,selector:f,[ru]:e,toString:()=>(n.rules.styled.cache.has(r)||c(),r)})},h0e=t=>{let e="";const n=[],r={},i=[];for(const[a,,,,o,s]of t){e===""&&(e=a),n.push(a),i.push(...s);for(const l in o){const f=o[l];(r[l]===void 0||f!=="undefined"||s.includes(f))&&(r[l]=f)}}return[e,n,r,new Set(i)]},f2=(t,e,n,r)=>{const i=[];e:for(let[a,o,s]of t){if(s)continue;let l,f=0,c=!1;for(l in a){const u=a[l];let h=e[l];if(h!==u){if(typeof h!="object"||!h)continue e;{let p,g,m=0;for(const y in h){if(u===String(h[y])){if(y!=="@initial"){const b=y.slice(1);(g=g||[]).push(b in n?n[b]:y.replace(/^@media ?/,"")),c=!0}f+=m,p=!0}++m}if(g&&g.length&&(o={["@media "+g.join(", ")]:o}),!p)continue e}}}(i[f]=i[f]||[]).push([r?"cv":`${l}-${a[l]}`,o,c])}return i},p0e={},m0e=Bf(),g0e=(t,e)=>m0e(t,(()=>(...n)=>{const r=()=>{for(let i of n){i=typeof i=="object"&&i||{};let a=oa(i);if(!e.rules.global.cache.has(a)){if(e.rules.global.cache.add(a),"@import"in i){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let s of[].concat(i["@import"]))s=s.includes('"')||s.includes("'")?s:`"${s}"`,e.sheet.insertRule(`@import ${s};`,o++);delete i["@import"]}no(i,[],[],t,(o=>{e.rules.global.apply(o)}))}}return""};return nO(r,{toString:r})})),y0e=Bf(),b0e=(t,e)=>y0e(t,(()=>n=>{const r=`${ni(t.prefix)}k-${oa(n)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const a=[];no(n,[],[],t,(s=>a.push(s)));const o=`@keyframes ${r}{${a.join("")}}`;e.rules.global.apply(o)}return r};return nO(i,{get name(){return i()},toString:i})})),O0e=class{constructor(t,e,n,r){this.token=t==null?"":String(t),this.value=e==null?"":String(e),this.scale=n==null?"":String(n),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+ni(this.prefix)+ni(this.scale)+this.token}toString(){return this.computedValue}},v0e=Bf(),w0e=(t,e)=>v0e(t,(()=>(n,r)=>{r=typeof n=="object"&&n||Object(r);const i=`.${n=(n=typeof n=="string"?n:"")||`${ni(t.prefix)}t-${oa(r)}`}`,a={},o=[];for(const l in r){a[l]={};for(const f in r[l]){const c=`--${ni(t.prefix)}${l}-${f}`,u=LI(String(r[l][f]),t.prefix,l);a[l][f]=new O0e(f,u,l,t.prefix),o.push(`${c}:${u}`)}}const s=()=>{if(o.length&&!e.rules.themed.cache.has(n)){e.rules.themed.cache.add(n);const l=`${r===t.theme?":root,":""}.${n}{${o.join(";")}}`;e.rules.themed.apply(l)}return n};return{...a,get className(){return s()},selector:i,toString:s}})),x0e=Bf(),S0e=t=>{let e=!1;const n=x0e(t,(r=>{e=!0;const i="prefix"in(r=typeof r=="object"&&r||{})?String(r.prefix):"",a=typeof r.media=="object"&&r.media||{},o=typeof r.root=="object"?r.root||null:globalThis.document||null,s=typeof r.theme=="object"&&r.theme||{},l={prefix:i,media:a,theme:s,themeMap:typeof r.themeMap=="object"&&r.themeMap||{...qpe},utils:typeof r.utils=="object"&&r.utils||{}},f=s0e(o),c={css:c0e(l,f),globalCss:g0e(l,f),keyframes:b0e(l,f),createTheme:w0e(l,f),reset(){f.reset(),c.theme.toString()},theme:{},sheet:f,config:l,prefix:i,getCssText:f.toString,toString:f.toString};return String(c.theme=c.createTheme(s)),c}));return e||n.reset(),n},c2=Object.prototype.hasOwnProperty;function u2(t,e,n){for(n of t.keys())if(yo(n,e))return n}function yo(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&yo(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(i=r,i&&typeof i=="object"&&(i=u2(e,i),!i)||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(i=r[0],i&&typeof i=="object"&&(i=u2(e,i),!i)||!yo(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(c2.call(t,n)&&++r&&!c2.call(e,n)||!(n in e)||!yo(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var M0e=/(%?)(%([sdjo]))/g;function C0e(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const n=JSON.stringify(t);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?t:n}}}function Sg(t,...e){if(e.length===0)return t;let n=0,r=t.replace(M0e,(i,a,o,s)=>{const l=e[n],f=C0e(l,s);return a?i:(n++,f)});return n<e.length&&(r+=` ${e.slice(n).join(" ")}`),r=r.replace(/%{2,2}/g,"%"),r}var j0e=2;function k0e(t){if(!t.stack)return;const e=t.stack.split(`
187
+ Defaulting to \`null\`.`}var Epe=dI,Dpe=pI;const Qpe=O.forwardRef(({value:t=0,max:e=100,className:n,color:r="primary",...i},a)=>{const o=`bg-${r}-base`;return d.jsx(Epe,{ref:a,value:t,max:e,className:X("relative h-8 w-full overflow-hidden rounded-128 bg-fill-default-fill-gray",n),...i,children:d.jsx(Dpe,{className:X("h-full transition-all",o),style:{width:`${t/e*100}%`}})})});Qpe.displayName="Progress";class gI{config;files=[];constructor(e){this.config=e}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(e){if(e==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${e} not found`)}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n),console.log(`Updated file ${e} with content:`,n)}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date().getMilliseconds()}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(e=>({id:`version-${e}`,name:`v${e}.js`,type:"file",path:`/versions/v${e}.js`,metadata:{language:"javascript"}}))}]}findFileById(e){const n=r=>{for(const i of r){if(i.id===e)return i;if(i.children){const a=n(i.children);if(a)return a}}return null};return n(this.files)}}class yI{config;files=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(e){if(e==="form-code")return this.config.codeContent;throw new Error(`File ${e} not found`)}async updateFileContent(e,n){if(e==="form-code"){this.config.codeContent=n;const r=this.files.find(i=>i.id===e);r&&(r.content=n)}}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}initializeFiles(){this.files=[{id:"form-code",name:this.config.fileName||"code.js",type:"file",path:`/${this.config.fileName||"code.js"}`,content:this.config.codeContent,metadata:{language:this.config.language||"javascript",lastModified:new Date().getMilliseconds()}}]}findFileById(e){return Jo(this.files,e)||null}}class bI{config;originalFiles=[];newFiles=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return[...this.originalFiles,...this.newFiles]}async getFileContent(e){const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return n.content;if(n.metadata&&"url"in n.metadata&&n.metadata.url)try{const r=await fetch(n.metadata.url);if(!r.ok)throw new Error(`Failed to fetch file: ${r.statusText}`);const i=await r.text();return n.content=i,i}catch(r){throw new Error(`Error fetching file content: ${r}`)}return""}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const r=e.split("/").pop()||"untitled",i={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:e,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(i),i}async createFolder(e){const n=e.split("/").pop()||"untitled",r={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:e,children:[],metadata:{lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(r),r}async deleteFile(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async deleteFolder(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return e.forEach(r=>{if(r.type==="file"&&r.content){const i=Un(r.path,r.name);n[i]=r.content}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:"1.0.0"}}}async loadEditorData(e){this.newFiles=[],e.files.forEach(n=>{n.metadata?.isNew&&this.newFiles.push(n)}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(i.content=r)})}initializeFiles(){this.originalFiles=this.config.fileUrls.map((e,n)=>({id:`url-file-${n}`,name:e.name,type:"file",path:`/${e.name}`,metadata:{language:e.type,url:e.url,lastModified:new Date().getMilliseconds()}}))}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Jo(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}}class Ape{config;originalFiles=[];newFiles=[];changeJournal=new Map;contentCache=new Map;PROVIDER_VERSION="1.0";constructor(e){this.config=e,this.initializeFiles()}async getFiles(){let e=[...this.originalFiles];for(const n of this.newFiles)this.changeJournal.get(n.id)!=="deleted"&&(e=oo(n,e));return this.filterDeletedFiles(e)}filterDeletedFiles(e){return e.filter(n=>this.changeJournal.get(n.id)!=="deleted").map(n=>({...n,children:n.children?this.filterDeletedFiles(n.children):void 0}))}async getFileContent(e){if(this.contentCache.has(e))return this.contentCache.get(e);const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return this.contentCache.set(e,n.content),n.content;try{const r=this.buildFileUrl(n),i=await fetch(r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);const a=await i.text();return this.contentCache.set(e,a),a}catch(r){throw new Error(`Error fetching file content: ${r}`)}}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,this.contentCache.set(e,n),this.changeJournal.has(e)||this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const{name:r,parentPath:i}=qO(e),a={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:i,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION}};return this.newFiles.push(a),this.changeJournal.set(a.id,"new"),this.contentCache.set(a.id,n),a}async createFolder(e){const{name:n,parentPath:r}=qO(e),i={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:r,children:[],metadata:{lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION}};return this.newFiles.push(i),this.changeJournal.set(i.id,"new"),i}async deleteFile(e){this.changeJournal.set(e,"deleted"),this.contentCache.delete(e)}async deleteFolder(e){this.changeJournal.set(e,"deleted")}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async saveAllChanges(){let e=[];const n=[],r=bi(this.originalFiles);for(const a of r)this.changeJournal.has(a.id)||(e=oo({...a,content:void 0},e));const i=this.changeJournal.entries();for(const[a,o]of i)if(o!=="deleted"&&(o==="new"||o==="modified")){const s=this.findFileById(a);if(!s)continue;try{s.type==="file"&&await this.uploadFile(s);const l={id:s.id,name:s.name,type:s.type,path:s.path,children:s.children,metadata:{...s.metadata,lastModified:new Date().getMilliseconds(),isNew:void 0,isDirty:void 0}};e=oo(l,e),s.type==="file"&&this.contentCache.delete(a)}catch(l){n.push(`Failed to upload ${s.name}: ${l}`)}}if(n.length>0)throw new Error(`Upload errors: ${n.join(", ")}`);return this.changeJournal.clear(),this.newFiles=[],e}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return this.contentCache.forEach((r,i)=>{const a=this.findFileById(i);if(a){const o=Un(a.path,a.name);n[o]=r}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:this.PROVIDER_VERSION}}}async loadEditorData(e){this.newFiles=[],this.changeJournal.clear(),this.contentCache.clear(),e.files.forEach(n=>{n.metadata?.isNew&&(this.newFiles.push(n),this.changeJournal.set(n.id,"new"))}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(this.contentCache.set(i.id,r),i.content=r)})}async uploadFile(e){if(!this.config)throw new Error("Configuration not provided");const n=await this.config.getAuthToken(),r=new FormData,i=e.content||this.contentCache.get(e.id)||"",a=new Blob([i],{type:this.getMimeTypeFromPath(e.name)});r.append("file",a,e.name),r.append("keep_file_name_unchanged","1");const o=this.buildS3Path(e.path);r.append("custom_path",o);const s=await fetch(this.config.uploadEndpoint,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Cache-Control":"no-cache"},body:r});if(!s.ok)throw new Error(`Upload failed: ${s.statusText}`)}buildFileUrl(e){if(!this.config?.base_url)throw new Error("Base URL not configured");const n=this.config.base_url.replace(/\/$/,""),i=e.path.split("/").filter(Boolean).map(o=>encodeURIComponent(o)).join("/"),a=encodeURIComponent(e.name);return`${n}/${i}${i?"/":""}${a}`}buildS3Path(e){const r=e.replace(/^\/+|\/+$/g,"").split("/");r.pop();const i=r.join("/");if(this.config?.base_url){const a=this.config.base_url.match(/\/file\/(.+)$/);if(a&&a[1])return i?`${a[1]}/${i}`:a[1]}return i}initializeFiles(){this.originalFiles=this.config?.files||[]}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Jo(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}getMimeTypeFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"application/javascript",ts:"application/typescript",jsx:"application/javascript",tsx:"application/typescript",html:"text/html",css:"text/css",json:"application/json",md:"text/markdown",py:"text/x-python",java:"text/x-java-source",cpp:"text/x-c++src",c:"text/x-csrc",txt:"text/plain"}[n||""]||"text/plain"}}function Hb(t){if(t.workflowConfig)return new gI(t.workflowConfig);if(t.formConfig)return new yI(t.formConfig);if(t.urlConfig)return new bI(t.urlConfig);if(t.externalFilesConfig)return new Ape(t.externalFilesConfig);throw new Error("No valid configuration provided")}var Et=(t=>(t.Explorer="explorer",t.Data="data",t.Functions="functions",t.Versions="versions",t.Tests="tests",t))(Et||{});const OI=t=>{switch(t){case 1:return"number";case 4:return"number";case 5:return"string";case 6:return"boolean";case 7:return"datetime";case 8:return"date";case 9:return"time";case 11:return"email";case 14:return"string";case 15:return"select";case 16:return"multiselect";case 17:return"url";case 20:return"file";case 21:return"phone";case 22:return"number";case 23:return"currency";case 24:return"select";case 18:return"string";case 27:return"string";case 29:return"file";default:return"custom"}},Rpe=t=>{switch(t){case"text":return"string";case"long_text":return"string";case"number":return"number";case"decimal":return"number";case"date_time":return"datetime";case"date":return"date";case"time":return"time";case"currency":return"currency";case"checkbox":return"boolean";case"rating":return"number";case"phone_number":return"phone";case"relationship":return"relationship";case"file_upload":return"file";case"multi_file_upload":return"file";case"email":return"email";case"url":return"url";case"single_select":return"select";case"multi_select":return"multiselect";case"stage":return"select";case"location":return"string";case"region":return"string";default:return"custom"}},$pe=t=>{switch(t){case 1:return"one-to-one";case 2:return"one-to-many";case 3:return"many-to-one";default:return"many-to-one"}},zpe=t=>{const e=OI(t.column_data_type),n={key:t.slug,name:t.slug,displayName:t.display_name,type:e,description:t.description||t.help_text,metadata:{required:!!t.is_required,unique:!!t.is_unique,primary:!!t.is_primary,nullable:!t.is_required,defaultValue:t.default_value,constraints:t.constraints||void 0}};return t.relationship_type&&t.relation&&(n.type="relationship",n.metadata.relationship={type:$pe(t.relationship_type),target:t.relation.object_slug,foreignKey:t.relation.column_slug}),t.enum_group&&t.enum_group.values&&(n.metadata.enum={options:t.enum_group.values.map(r=>({value:r.slug,label:r.display_name,badge:r.badge_config?{color:r.badge_config.class_name,icon:r.badge_config.start_icon}:void 0})),allowMultiple:e==="multiselect"}),t.properties?.format&&(n.metadata.format=t.properties.format),n},vI=(t,e)=>{const n=t.org_object_columns?t.org_object_columns.map(zpe):[];return{key:t.slug,name:t.slug,displayName:t.display_singular_name,type:"object",description:`${t.display_plural_name} - ${t.type} object`,children:n,count:e,category:t.type==="standard"?"Standard Objects":t.type==="custom"?"Custom Objects":"System Objects",metadata:{objectType:t.type,baseType:t.base_type,isHidden:!!t.is_hidden,properties:t.properties}}},Jb=(t,e)=>t.map(n=>vI(n,e?.[n.slug])),Fl=(t,e,n,r=[])=>{const i=[...r,e];let a,o,s;if(t===null)a="null";else if(t===void 0)a="undefined";else if(typeof t=="boolean")a="boolean";else if(typeof t=="number")a="number";else if(typeof t=="string")t.includes("@")&&t.includes(".")?a="email":t.startsWith("http://")||t.startsWith("https://")?a="url":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)?a="datetime":/^\d{4}-\d{2}-\d{2}$/.test(t)?a="date":/^\d{2}:\d{2}:\d{2}$/.test(t)?a="time":a="string";else if(typeof t=="function")a="function";else if(Array.isArray(t))a="array",s=t.length,o=t.slice(0,100).map((l,f)=>Fl(l,`${e}[${f}]`,`[${f}]`,i));else if(typeof t=="object"){a="object";const l=Object.entries(t);s=l.length,o=l.map(([f,c])=>Fl(c,`${e}.${f}`,f,i))}else a="custom";return{key:i.join("."),name:e,displayName:n||e,type:a,value:a==="object"||a==="array"?void 0:t,children:o,count:s,metadata:{path:i,originalType:typeof t}}},_pe=t=>t?Array.isArray(t)&&t.length>0&&"key"in t[0]&&"type"in t[0]?t:Array.isArray(t)&&t.length>0&&typeof t[0]=="object"&&t[0]!==null&&"org_object_columns"in t[0]?Jb(t):typeof t=="object"&&t!==null&&"org_object_columns"in t?[vI(t)]:Array.isArray(t)?t.map((e,n)=>Fl(e,`item_${n}`,`Item ${n}`)):[Fl(t,"root","Root")]:[],Zpe=()=>[{key:"users",name:"users",displayName:"Users",type:"object",count:1250,category:"Core Objects",children:[{key:"users.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"users.email",name:"email",type:"email",metadata:{unique:!0,required:!0}},{key:"users.profile",name:"profile",type:"object",children:[{key:"users.profile.firstName",name:"firstName",type:"string",metadata:{required:!0}},{key:"users.profile.lastName",name:"lastName",type:"string",metadata:{required:!0}},{key:"users.profile.avatar",name:"avatar",type:"file"}]},{key:"users.status",name:"status",type:"select",metadata:{enum:{options:[{value:"active",label:"Active",badge:{color:"green"}},{value:"inactive",label:"Inactive",badge:{color:"red"}},{value:"pending",label:"Pending",badge:{color:"orange"}}]}}}]},{key:"orders",name:"orders",displayName:"Orders",type:"object",count:5420,category:"Business Objects",children:[{key:"orders.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"orders.userId",name:"userId",type:"relationship",metadata:{relationship:{type:"many-to-one",target:"users",foreignKey:"id"}}},{key:"orders.total",name:"total",type:"currency",metadata:{required:!0}},{key:"orders.items",name:"items",type:"array",count:3,children:[{key:"orders.items[0]",name:"[0]",type:"object",children:[{key:"orders.items[0].productId",name:"productId",type:"number"},{key:"orders.items[0].quantity",name:"quantity",type:"number"},{key:"orders.items[0].price",name:"price",type:"currency"}]}]}]}];function wI(t){switch(t){case"ts":return"typescript";case"tsx":return"typescript";case"html":return"html";case"css":return"css";case"json":return"json";case"jsx":case"js":case"javascript":return"javascript";default:return"text"}}const Kb=({value:t,onChange:e,language:n="javascript",readOnly:r=!1,loading:i=!1})=>{const a=o=>{o!==void 0&&e(o)};return console.log({language:n}),d.jsx("div",{className:"h-full w-full",children:d.jsx(uQ,{loading:i,height:"100%",defaultLanguage:n,language:n,defaultValue:t,value:t,onChange:a,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:r}})})},Ype=[{id:Et.Explorer,icon:F.IconFolderOpen,label:"Files"},{id:Et.Data,icon:F.IconDatabase,label:"Data"},{id:Et.Functions,icon:F.IconCode,label:"Functions"},{id:Et.Versions,icon:F.IconHistory,label:"Versions"},{id:Et.Tests,icon:F.IconFlask,label:"Tests"}],Bpe=({activePanel:t,setActivePanel:e,allowedPannels:n})=>{const r=x.useMemo(()=>Ype.filter(i=>n.includes(i.id)),[n]);return d.jsx("div",{className:"border-r-1/2 border-borderColor-border-primary flex flex-col gap-8 items-center py-12 px-12 m-0",children:r.map(i=>{const a=i.icon;return d.jsx(nh,{children:d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:d.jsx(rt,{variant:t===i.id?"primary":"ghost",icon:d.jsx(a,{size:16}),onClick:()=>e(i.id),className:"p-8"})}),d.jsx(Mf,{align:"center",side:"right",children:i.label})]})},i.id)})})},eO=({leftPanel:t,editor:e,rightPanel:n,activePanel:r,setActivePanel:i,allowedPannels:a=[Et.Explorer]})=>d.jsxs("div",{className:"flex flex-1 overflow-hidden ",children:[d.jsx(Bpe,{activePanel:r,setActivePanel:i,allowedPannels:a}),d.jsx("div",{className:"flex-1",children:n?d.jsxs(Xi.Splitter,{style:{height:"100%"},children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:"50%",min:"30%",children:e}),d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"20%",max:"60%",className:"bg-white !border-borderColor-border-primary",collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:n})})]}):d.jsxs(Xi.Splitter,{style:{height:"100%"},children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:"75%",min:"60%",children:e})]})})]});function Wpe(t){return["html","css","json","javascript","typescript","jsx","tsx"].includes(t)}function xI(t){return[...t].sort((e,n)=>e.type==="folder"&&n.type==="file"?-1:e.type==="file"&&n.type==="folder"?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase())).map(e=>({...e,children:e.children?xI(e.children):void 0}))}const SI=({activeFile:t,showPreview:e,setShowPreview:n,handleOnSave:r,className:i,extras:a})=>{const o=Wpe(t?.metadata?.language||"");return d.jsxs("div",{className:`bg-white flex items-center justify-between px-16 py-8 ${i}`,children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("h1",{className:"text-semi-18 text-typography-primary-text mr-4",children:"CRM Code Editor"}),t&&d.jsx(ea,{className:"text-typography-tertiary-text",children:t.name})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[o&&d.jsx(rt,{variant:"ghost",onClick:()=>n?.(!e),title:e?"Hide Preview":"Show Preview",icon:e?d.jsx(F.IconEyeOff,{}):d.jsx(F.IconEye,{})}),d.jsx(rt,{variant:"primary",onClick:r,children:"Save"}),a]})]})},MI=({item:t,depth:e=0,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o})=>{const[s,l]=x.useState(t.isExpanded||!1),f=t.children&&t.children.length>0,c=x.useCallback(()=>{if(n){const h=a(o,t.key);h&&n(t,h)}},[n,a,o,t]),u=x.useCallback(h=>{h.stopPropagation(),l(!s)},[s]);return d.jsxs("div",{className:t.isVirtual?"opacity-60":"",children:[d.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 hover:bg-neutral-surface-hover cursor-pointer rounded transition-colors",style:{paddingLeft:`${e*16+8}px`},onClick:c,children:[f?d.jsx(rt,{variant:"linkInline",size:"small",onClick:u,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":s?"Collapse":"Expand",children:s?d.jsx(F.IconChevronDown,{size:16}):d.jsx(F.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[r(t.type,t.metadata),i(t)]})]}),f&&s&&d.jsx("div",{children:t.children.map(h=>d.jsx(MI,{item:h,depth:e+1,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o},h.key))})]})},Fpe=({items:t,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,className:a=""})=>d.jsx("div",{className:`data-explorer-tree ${a}`,children:t.map(o=>d.jsx(MI,{item:o,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,organizedData:t},o.key))}),Xpe=({data:t=[],title:e="Data Explorer",searchPlaceholder:n="Search data...",onItemSelect:r,onRefresh:i,showMetadata:a=!0,showCounts:o=!0,groupByCategory:s=!1,sortByName:l=!1,sortOrder:f="asc",customIcons:c={},customRenderers:u={},filters:h})=>{const[p,g]=x.useState(""),[m,y]=x.useState(l),[b,v]=x.useState(f),w=x.useCallback((T,D)=>{if(c[T])return c[T];const N={size:16,className:"text-typography-tertiary-text"};switch(T){case"object":return d.jsx(F.IconDatabase,{...N});case"array":return d.jsx(F.IconList,{...N});case"string":return d.jsx(F.IconLetterT,{...N});case"number":return d.jsx(F.IconHash,{...N});case"boolean":return d.jsx(F.IconCheck,{...N});case"date":case"datetime":return d.jsx(F.IconCalendar,{...N});case"time":return d.jsx(F.IconClock,{...N});case"email":return d.jsx(F.IconMail,{...N});case"url":return d.jsx(F.IconWorld,{...N});case"phone":return d.jsx(F.IconPhone,{...N});case"currency":return d.jsx(F.IconCurrency,{...N});case"file":case"image":return d.jsx(F.IconFile,{...N});case"select":case"multiselect":case"enum":return d.jsx(F.IconTag,{...N});case"relationship":return d.jsx(F.IconLink,{...N});default:return D?.primary?d.jsx(F.IconKey,{...N,className:"text-warning-base"}):d.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-reg-10 text-typography-quaternary-text",children:"•"})}},[c]),S=x.useCallback((T,D)=>{if(D?.primary)return"text-warning-text-base font-normal";if(D?.required)return"text-info-text-base";if(D?.unique)return"text-success-text-base";switch(T){case"object":return"text-typography-secondary-text font-normal";case"relationship":return"text-purple-text-base";case"enum":case"select":case"multiselect":return"text-warning-text-base";default:return"text-typography-tertiary-text"}},[]),C=x.useCallback(T=>{if(u[T.type])return u[T.type](T);const D=T.displayName||T.name,N=[];if(a&&T.metadata){const{metadata:L}=T;L.primary&&N.push(d.jsx(ea,{color:"warning",size:"small",className:"!text-reg-10 min-w-fit",children:"PK"},"primary")),L.required&&N.push(d.jsx(ea,{color:"info",size:"small",className:"!text-reg-10 min-w-fit",children:"Required"},"required")),L.unique&&N.push(d.jsx(ea,{color:"success",size:"small",className:"!text-reg-10 min-w-fit",children:"Unique"},"unique")),L.relationship&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-reg-10 min-w-fit",children:L.relationship.type.toUpperCase()},"relationship"))}o&&typeof T.count=="number"&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-[10px] min-w-fit",children:T.count},"count"));const Z=d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("span",{className:`truncate ${S(T.type,T.metadata)}`,children:D}),N.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:N})]});if(T.description||T.metadata){const L=d.jsxs("div",{children:[T.description&&d.jsx("div",{children:T.description}),T.metadata&&d.jsxs("div",{className:"mt-1 text-reg-12",children:[d.jsxs("div",{className:"text-reg-12",children:["Type: ",T.type]}),T.metadata.defaultValue!==void 0&&d.jsxs("div",{children:["Default: ",String(T.metadata.defaultValue)]}),T.metadata.format&&d.jsxs("div",{children:["Format: ",T.metadata.format]})]})]});return d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:Z}),d.jsx(Mf,{children:L})]})}return Z},[u,a,o,S]),M=x.useCallback(T=>m?[...T].sort((N,Z)=>{const L=(N.displayName||N.name).toLowerCase(),Q=(Z.displayName||Z.name).toLowerCase();return b==="asc"?L.localeCompare(Q):Q.localeCompare(L)}).map(N=>({...N,children:N.children?M(N.children):void 0})):T,[m,b]),j=x.useMemo(()=>{const T=N=>{if(h?.types&&!h.types.includes(N.type)||h?.categories&&N.category&&!h.categories.includes(N.category)||h?.showOnlyWithChildren&&(!N.children||N.children.length===0))return!1;if(p){const Z=p.toLowerCase(),L=N.name.toLowerCase().includes(Z)||(N.displayName?.toLowerCase().includes(Z)??!1),Q=N.description?.toLowerCase().includes(Z)??!1,R=N.children?.some($=>T($))??!1;return L||Q||R}return!0},D=N=>N.filter(T).map(Z=>({...Z,children:Z.children?D(Z.children):void 0}));return D(t)},[t,p,h]),k=x.useCallback((T,D,N=[])=>{for(const Z of T){const L=[...N,Z.name];if(Z.key===D)return L;if(Z.children){const Q=k(Z.children,D,L);if(Q)return Q}}return null},[]),I=x.useMemo(()=>{let T=j;if(s){const D=T.reduce((N,Z)=>{const L=Z.category||"Uncategorized";return N[L]||(N[L]=[]),N[L].push(Z),N},{});T=Object.entries(D).map(([N,Z])=>({key:`category-${N}`,name:N,displayName:N,type:"object",children:M(Z),count:Z.length}))}return M(T)},[j,s,M]);return d.jsx(nh,{children:d.jsxs(H1,{className:"h-full flex flex-col border-0 shadow-none",children:[d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(K1,{className:"text-semi-14 font-medium",children:e}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(rt,{variant:"ghost",startIcon:m?b==="asc"?d.jsx(F.IconSortAscending,{size:16}):d.jsx(F.IconSortDescending,{size:16}):d.jsx(F.IconSortAscending,{size:16,className:"opacity-50"}),title:m?`Sort by name (${b==="asc"?"A-Z":"Z-A"})`:"Sort by name",size:"small",onClick:()=>{m?b==="asc"?v("desc"):y(!1):(y(!0),v("asc"))},className:m?"text-info-text-base":""}),i&&d.jsx(rt,{variant:"ghost",startIcon:d.jsx(F.IconRefresh,{size:16}),title:"Refresh data",size:"small",onClick:i})]})]}),d.jsxs(ey,{className:"flex-1 flex flex-col p-0",children:[d.jsx("div",{className:"p-4 pt-0",children:d.jsx(Lf,{placeholder:n,startIcon:d.jsx(F.IconSearch,{size:16,className:"text-typography-quaternary-text"}),value:p,onChange:T=>g(T.target.value),inputSize:"small",variant:"borderless"})}),d.jsx(Lb,{}),d.jsx(bN,{className:"flex-1",children:d.jsx("div",{className:"p-8",children:d.jsx(Fpe,{items:I,onItemSelect:r,getTypeIcon:w,renderItemTitle:C,findItemPath:k})})})]})]})})},CI=t=>d.jsx(Xpe,{...t}),Vpe=t=>{switch(t.split(".").pop()?.toLowerCase()){case"html":case"htm":return"/html.svg";case"css":return"/css.svg";case"js":case"jsx":case"mjs":case"cjs":return"/js.svg";default:return null}};function jI({file:t,depth:e=0,activeFile:n,selectedItemId:r,onFileSelect:i,onItemSelect:a,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:c}){const[u,h]=x.useState(!0);console.log({selectedItemId:r,file:t});const[p,g]=x.useState(!1),[m,y]=x.useState(!1),[b,v]=x.useState(t.name),w=t.children&&t.children.length>0,S=n===t.id,C=r===t.id,M=t.metadata?.isNew,j=M&&!t.name,k=x.useRef(null),I=x.useCallback(()=>{a&&a(t.id),t.type==="file"&&i(t.id)},[t.id,t.type,i,a]),T=x.useCallback(P=>{P.stopPropagation(),h(!u)},[u]),D=x.useCallback(P=>{P.preventDefault(),P.stopPropagation(),g(!0)},[]),N=x.useCallback(()=>{y(!0),g(!1)},[]),Z=x.useCallback(()=>{b.trim()&&b!==t.name&&f&&(j&&c?c({name:b}):f(t.id,b.trim()),k.current?.blur()),y(!1)},[b,t.name,t.id,f,j,c]),L=x.useCallback(()=>{v(t.name),y(!1)},[t.name]),Q=x.useCallback(()=>{l&&l(t.id),g(!1)},[t.id,l]),R=x.useCallback(()=>{if(o){const P=bu(t);o(P)}g(!1)},[t,o]),$=x.useCallback(()=>{if(s){const P=bu(t);s(P)}g(!1)},[t,s]);return d.jsxs("div",{children:[d.jsxs("div",{className:`flex items-center gap-2 py-1 px-2 hover:bg-primary-surface-hover border-primary-surface-hover cursor-pointer rounded transition-colors relative ${C?"bg-primary-surface text-primary-text-base border-t-1/2 border-b-1/2 ":""} ${M?"bg-success-surface":""}`,style:{paddingLeft:`${e*16+8}px`},onClick:I,onContextMenu:D,children:[w?d.jsx(rt,{variant:"linkInline",size:"small",onClick:T,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":u?"Collapse":"Expand",children:u?d.jsx(F.IconChevronDown,{size:16}):d.jsx(F.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-6 min-w-0 flex-1",children:[t.type==="file"?(()=>{const P=Vpe(t.name);return P?d.jsx("img",{src:P,alt:`${t.name} icon`,width:18,height:18,className:"text-typography-tertiary-text"}):d.jsx(F.IconFile,{size:16,className:"text-typography-tertiary-text"})})():d.jsx(F.IconFolderOpen,{size:16,className:"text-typography-tertiary-text"}),m||j?d.jsx("input",{ref:k,value:b,onChange:P=>v(P.target.value),onBlur:Z,onKeyDown:P=>{P.key==="Enter"&&Z(),P.key==="Escape"&&L()},className:"text-semi-14 h-full bg-transparent",autoFocus:!0}):d.jsx("span",{className:`truncate ${S?"font-medium":""}`,children:t.name})]}),p&&d.jsx("div",{className:"absolute right-2 top-0 bg-white border border-borderColor-border-primary rounded-8 shadow-soft-medium z-10 min-w-32",children:d.jsxs("div",{className:"py-1",children:[t.type==="folder"&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:R,children:[d.jsx(F.IconFile,{size:14}),"New File"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:$,children:[d.jsx(F.IconFolderOpen,{size:14}),"New Folder"]}),d.jsx("div",{className:"border-t border-borderColor-border-primary my-1"})]}),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-sm hover:bg-gray-100 flex items-center gap-2",onClick:N,children:[d.jsx(F.IconEdit,{size:14}),"Rename"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover text-error-text-base flex items-center gap-2",onClick:Q,children:[d.jsx(F.IconTrash,{size:14}),"Delete"]})]})]})})]}),w&&u&&d.jsx("div",{children:t.children.map(P=>d.jsx(jI,{file:P,depth:e+1,activeFile:n,onFileSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,onItemSelect:a,selectedItemId:r,handleItemUpdate:c},P.id))})]})}function Gpe({files:t,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f}){return d.jsx("div",{className:"file-explorer-tree",children:t.map(c=>d.jsx(jI,{file:c,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f},c.id))})}function Upe({handleItemUpdate:t,isFileExplorerHovered:e,activeFileData:n,selectedItemData:r}){const i=()=>{const o=r||n,s=o?bu(o):"";t({name:"",type:"file",path:s})},a=()=>{const o=r||n,s=o?bu(o):"";t({name:"",type:"folder",path:s})};return d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 p-0 px-12",children:[d.jsx(K1,{className:"!text-med-13 text-typography-tertiary-text py-8",children:"Files"}),e&&d.jsxs("div",{className:"flex items-center ",children:[d.jsx(rt,{variant:"ghost",icon:d.jsx(F.IconFilePlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new file or folder",onClick:i}),d.jsx(rt,{variant:"ghost",icon:d.jsx(F.IconFolderPlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new file or folder",onClick:a})]})]})}const tO=({files:t,activeFileData:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,error:a=null,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f})=>{const[c,u]=x.useState(!1),[h,p]=x.useState();console.log({newItemData:h});const g=x.useCallback((v,w)=>{for(const S of v){if(S.id===w)return S;if(S.children){const C=g(S.children,w);if(C)return C}}},[]),m=n?g(t,n):void 0,y=x.useCallback(v=>{p(w=>v&&w?{...w,...v}:v?{...v}:w)},[]);x.useEffect(()=>{if(h&&h.name&&h.name.trim()){const v=h.type,w=Un(h.path,h.name.trim());v==="file"?o?.(w):s?.(w),p(void 0)}},[h,o,s]);const b=x.useMemo(()=>{let v=[...t];if(h&&h.path!==void 0){const w=Un(h.path,h.name),S={id:`new-${h.type}`,name:h.name,type:h.type,path:w,children:[],metadata:{isNew:!0}};v=oo(S,v)}return xI(v)},[t,h]);return d.jsx(d.Fragment,{children:d.jsxs(H1,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:"h-full flex flex-col border-0 shadow-none",children:[d.jsx(Upe,{isFileExplorerHovered:c,handleItemUpdate:y,activeFileData:e,selectedItemData:m}),d.jsx(ey,{className:"flex-1 flex flex-col p-0",children:d.jsxs("div",{className:"",children:[a&&d.jsx(aC,{title:"Error loading files",description:a,color:"error"}),d.jsx(Gpe,{files:b,activeFile:e?.id||null,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:y})]})})]})})},kI=()=>{const t=[{name:"formatCurrency",description:"Format a number as currency",category:"Formatting"},{name:"calculateDiscount",description:"Calculate discount based on amount",category:"Calculations"},{name:"getLeadData",description:"Fetch lead data from CRM",category:"Data Access"},{name:"updateContact",description:"Update contact information",category:"Data Modification"},{name:"sendEmail",description:"Send an email to a contact",category:"Communication"},{name:"validateEmail",description:"Validate email format",category:"Validation"}];return d.jsxs("div",{className:"h-full",children:[d.jsx("div",{className:"flex items-center justify-between p-4 border-b border-borderColor-border-primary",children:d.jsx("h2",{className:"font-medium text-semi-14",children:"Function Library"})}),d.jsxs("div",{className:"p-3",children:[d.jsxs("div",{className:"relative mb-3",children:[d.jsx(F.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-typography-quaternary-text"}),d.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-semi-14 border border-borderColor-border-primary rounded-8 focus:outline-none focus:ring-2 focus:ring-primary-border"})]}),d.jsx("div",{children:t.map(e=>d.jsxs("div",{className:"p-2 border border-borderColor-border-primary rounded-8 mb-2 hover:bg-neutral-surface-hover cursor-pointer",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(F.IconCode,{size:16,className:"mr-2 text-typography-tertiary-text"}),d.jsx("span",{className:"text-semi-14 font-medium",children:e.name})]}),d.jsx("span",{className:"text-reg-12 bg-neutral-surface px-2 py-0.5 rounded text-typography-tertiary-text",children:e.category})]}),d.jsx("p",{className:"text-reg-12 text-typography-tertiary-text mt-1",children:e.description})]},e.name))}),d.jsxs("div",{className:"mt-4 p-3 bg-neutral-surface rounded-8 border border-borderColor-border-primary flex items-center",children:[d.jsx(F.IconBook,{size:16,className:"text-typography-tertiary-text mr-2"}),d.jsx("span",{className:"text-reg-12 text-typography-tertiary-text",children:"Browse documentation for more functions and examples"})]})]})]})};var Ve="colors",Vt="sizes",he="space",qpe={gap:he,gridGap:he,columnGap:he,gridColumnGap:he,rowGap:he,gridRowGap:he,inset:he,insetBlock:he,insetBlockEnd:he,insetBlockStart:he,insetInline:he,insetInlineEnd:he,insetInlineStart:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,marginBlock:he,marginBlockEnd:he,marginBlockStart:he,marginInline:he,marginInlineEnd:he,marginInlineStart:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,paddingBlock:he,paddingBlockEnd:he,paddingBlockStart:he,paddingInline:he,paddingInlineEnd:he,paddingInlineStart:he,top:he,right:he,bottom:he,left:he,scrollMargin:he,scrollMarginTop:he,scrollMarginRight:he,scrollMarginBottom:he,scrollMarginLeft:he,scrollMarginX:he,scrollMarginY:he,scrollMarginBlock:he,scrollMarginBlockEnd:he,scrollMarginBlockStart:he,scrollMarginInline:he,scrollMarginInlineEnd:he,scrollMarginInlineStart:he,scrollPadding:he,scrollPaddingTop:he,scrollPaddingRight:he,scrollPaddingBottom:he,scrollPaddingLeft:he,scrollPaddingX:he,scrollPaddingY:he,scrollPaddingBlock:he,scrollPaddingBlockEnd:he,scrollPaddingBlockStart:he,scrollPaddingInline:he,scrollPaddingInlineEnd:he,scrollPaddingInlineStart:he,fontSize:"fontSizes",background:Ve,backgroundColor:Ve,backgroundImage:Ve,borderImage:Ve,border:Ve,borderBlock:Ve,borderBlockEnd:Ve,borderBlockStart:Ve,borderBottom:Ve,borderBottomColor:Ve,borderColor:Ve,borderInline:Ve,borderInlineEnd:Ve,borderInlineStart:Ve,borderLeft:Ve,borderLeftColor:Ve,borderRight:Ve,borderRightColor:Ve,borderTop:Ve,borderTopColor:Ve,caretColor:Ve,color:Ve,columnRuleColor:Ve,fill:Ve,outline:Ve,outlineColor:Ve,stroke:Ve,textDecorationColor:Ve,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Vt,minBlockSize:Vt,maxBlockSize:Vt,inlineSize:Vt,minInlineSize:Vt,maxInlineSize:Vt,width:Vt,minWidth:Vt,maxWidth:Vt,height:Vt,minHeight:Vt,maxHeight:Vt,flexBasis:Vt,gridTemplateColumns:Vt,gridTemplateRows:Vt,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},Hpe=(t,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,Bf=()=>{const t=Object.create(null);return(e,n,...r)=>{const i=(a=>JSON.stringify(a,Hpe))(e);return i in t?t[i]:t[i]=n(e,...r)}},ru=Symbol.for("sxs.internal"),nO=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),a2=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:Jpe}=Object.prototype,xg=t=>t.includes("-")?t:t.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),Kpe=/\s+(?![^()]*\))/,Ua=t=>e=>t(...typeof e=="string"?String(e).split(Kpe):[e]),o2={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:Ua(((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t}))),marginInline:Ua(((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t}))),maxSize:Ua(((t,e)=>({maxBlockSize:t,maxInlineSize:e||t}))),minSize:Ua(((t,e)=>({minBlockSize:t,minInlineSize:e||t}))),paddingBlock:Ua(((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t}))),paddingInline:Ua(((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t})))},g0=/([\d.]+)([^]*)/,e0e=(t,e)=>t.length?t.reduce(((n,r)=>(n.push(...e.map((i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i))),n)),[]):e,t0e=(t,e)=>t in n0e&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((n,r,i,a)=>r+(i==="stretch"?`-moz-available${a};${xg(t)}:${r}-webkit-fill-available`:`-moz-fit-content${a};${xg(t)}:${r}fit-content`)+a)):String(e),n0e={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},ni=t=>t?t+"-":"",LI=(t,e,n)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((r,i,a,o,s)=>o=="$"==!!a?r:(i||o=="--"?"calc(":"")+"var(--"+(o==="$"?ni(e)+(s.includes("$")?"":ni(n))+s.replace(/\$/g,"-"):s)+")"+(i||o=="--"?"*"+(i||"")+(a||"1")+")":""))),r0e=/\s*,\s*(?![^()]*\))/,i0e=Object.prototype.toString,no=(t,e,n,r,i)=>{let a,o,s;const l=(f,c,u)=>{let h,p;const g=m=>{for(h in m){const v=h.charCodeAt(0)===64,w=v&&Array.isArray(m[h])?m[h]:[m[h]];for(p of w){const S=/[A-Z]/.test(b=h)?b:b.replace(/-[^]/g,(M=>M[1].toUpperCase())),C=typeof p=="object"&&p&&p.toString===i0e&&(!r.utils[S]||!c.length);if(S in r.utils&&!C){const M=r.utils[S];if(M!==o){o=M,g(M(p)),o=null;continue}}else if(S in o2){const M=o2[S];if(M!==s){s=M,g(M(p)),s=null;continue}}if(v&&(y=h.slice(1)in r.media?"@media "+r.media[h.slice(1)]:h,h=y.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((M,j,k,I,T,D)=>{const N=g0.test(j),Z=.0625*(N?-1:1),[L,Q]=N?[I,j]:[j,I];return"("+(k[0]==="="?"":k[0]===">"===N?"max-":"min-")+L+":"+(k[0]!=="="&&k.length===1?Q.replace(g0,((R,$,P)=>Number($)+Z*(k===">"?1:-1)+P)):Q)+(T?") and ("+(T[0]===">"?"min-":"max-")+L+":"+(T.length===1?D.replace(g0,((R,$,P)=>Number($)+Z*(T===">"?-1:1)+P)):D):"")+")"}))),C){const M=v?u.concat(h):[...u],j=v?[...c]:e0e(c,h.split(r0e));a!==void 0&&i(s2(...a)),a=void 0,l(p,j,M)}else a===void 0&&(a=[[],c,u]),h=v||h.charCodeAt(0)!==36?h:`--${ni(r.prefix)}${h.slice(1).replace(/\$/g,"-")}`,p=C?p:typeof p=="number"?p&&S in a0e?String(p)+"px":String(p):LI(t0e(S,p??""),r.prefix,r.themeMap[S]),a[0].push(`${v?`${h} `:`${xg(h)}:`}${p}`)}}var y,b};g(f),a!==void 0&&i(s2(...a)),a=void 0};l(t,e,n)},s2=(t,e,n)=>`${n.map((r=>`${r}{`)).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,a0e={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},l2=t=>String.fromCharCode(t+(t>25?39:97)),oa=t=>(e=>{let n,r="";for(n=Math.abs(e);n>52;n=n/52|0)r=l2(n%52)+r;return l2(n%52)+r})(((e,n)=>{let r=n.length;for(;r;)e=33*e^n.charCodeAt(--r);return e})(5381,JSON.stringify(t))>>>0),sl=["themed","global","styled","onevar","resonevar","allvar","inline"],o0e=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch{return!1}},s0e=t=>{let e;const n=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,((a,o)=>{const{cssText:s}=a;let l="";if(s.startsWith("--sxs"))return"";if(i[o-1]&&(l=i[o-1].cssText).startsWith("--sxs")){if(!a.cssRules.length)return"";for(const f in e.rules)if(e.rules[f].group===a)return`--sxs{--sxs:${[...e.rules[f].cache].join(" ")}}${s}`;return a.cssRules.length?`${l}${s}`:""}return s})).join("")},r=()=>{if(e){const{rules:s,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const f in s)delete s[f]}const i=Object(t).styleSheets||[];for(const s of i)if(o0e(s)){for(let l=0,f=s.cssRules;f[l];++l){const c=Object(f[l]);if(c.type!==1)continue;const u=Object(f[l+1]);if(u.type!==4)continue;++l;const{cssText:h}=c;if(!h.startsWith("--sxs"))continue;const p=h.slice(14,-3).trim().split(/\s+/),g=sl[p[0]];g&&(e||(e={sheet:s,reset:r,rules:{},toString:n}),e.rules[g]={group:u,index:l,cache:new Set(p)})}if(e)break}if(!e){const s=(l,f)=>({type:f,cssRules:[],insertRule(c,u){this.cssRules.splice(u,0,s(c,{import:3,undefined:1}[(c.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,(c=>c.cssText)).join("")}}`:l}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:s("","text/css"),rules:{},reset:r,toString:n}}const{sheet:a,rules:o}=e;for(let s=sl.length-1;s>=0;--s){const l=sl[s];if(!o[l]){const f=sl[s+1],c=o[f]?o[f].index:a.cssRules.length;a.insertRule("@media{}",c),a.insertRule(`--sxs{--sxs:${s}}`,c),o[l]={group:a.cssRules[c+1],index:c,cache:new Set([s])}}l0e(o[l])}};return r(),e},l0e=t=>{const e=t.group;let n=e.cssRules.length;t.apply=r=>{try{e.insertRule(r,n),++n}catch{}}},Ws=Symbol(),f0e=Bf(),c0e=(t,e)=>f0e(t,(()=>(...n)=>{let r={type:null,composers:new Set};for(const i of n)if(i!=null)if(i[ru]){r.type==null&&(r.type=i[ru].type);for(const a of i[ru].composers)r.composers.add(a)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(u0e(i,t));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),d0e(t,r,e)})),u0e=({variants:t,compoundVariants:e,defaultVariants:n,...r},i)=>{const a=`${ni(i.prefix)}c-${oa(r)}`,o=[],s=[],l=Object.create(null),f=[];for(const h in n)l[h]=String(n[h]);if(typeof t=="object"&&t)for(const h in t){c=l,u=h,Jpe.call(c,u)||(l[h]="undefined");const p=t[h];for(const g in p){const m={[h]:String(g)};String(g)==="undefined"&&f.push(h);const y=p[g],b=[m,y,!a2(y)];o.push(b)}}var c,u;if(typeof e=="object"&&e)for(const h of e){let{css:p,...g}=h;p=typeof p=="object"&&p||{};for(const y in g)g[y]=String(g[y]);const m=[g,p,!a2(p)];s.push(m)}return[a,r,o,s,l,f]},d0e=(t,e,n)=>{const[r,i,a,o]=h0e(e.composers),s=typeof e.type=="function"||e.type.$$typeof?(u=>{function h(){for(let p=0;p<h[Ws].length;p++){const[g,m]=h[Ws][p];u.rules[g].apply(m)}return h[Ws]=[],null}return h[Ws]=[],h.rules={},sl.forEach((p=>h.rules[p]={apply:g=>h[Ws].push([p,g])})),h})(n):null,l=(s||n).rules,f=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,c=u=>{u=typeof u=="object"&&u||p0e;const{css:h,...p}=u,g={};for(const b in a)if(delete p[b],b in u){let v=u[b];typeof v=="object"&&v?g[b]={"@initial":a[b],...v}:(v=String(v),g[b]=v!=="undefined"||o.has(b)?v:a[b])}else g[b]=a[b];const m=new Set([...i]);for(const[b,v,w,S]of e.composers){n.rules.styled.cache.has(b)||(n.rules.styled.cache.add(b),no(v,[`.${b}`],[],t,(j=>{l.styled.apply(j)})));const C=f2(w,g,t.media),M=f2(S,g,t.media,!0);for(const j of C)if(j!==void 0)for(const[k,I,T]of j){const D=`${b}-${oa(I)}-${k}`;m.add(D);const N=(T?n.rules.resonevar:n.rules.onevar).cache,Z=T?l.resonevar:l.onevar;N.has(D)||(N.add(D),no(I,[`.${D}`],[],t,(L=>{Z.apply(L)})))}for(const j of M)if(j!==void 0)for(const[k,I]of j){const T=`${b}-${oa(I)}-${k}`;m.add(T),n.rules.allvar.cache.has(T)||(n.rules.allvar.cache.add(T),no(I,[`.${T}`],[],t,(D=>{l.allvar.apply(D)})))}}if(typeof h=="object"&&h){const b=`${r}-i${oa(h)}-css`;m.add(b),n.rules.inline.cache.has(b)||(n.rules.inline.cache.add(b),no(h,[`.${b}`],[],t,(v=>{l.inline.apply(v)})))}for(const b of String(u.className||"").trim().split(/\s+/))b&&m.add(b);const y=p.className=[...m].join(" ");return{type:e.type,className:y,selector:f,props:p,toString:()=>y,deferredInjector:s}};return nO(c,{className:r,selector:f,[ru]:e,toString:()=>(n.rules.styled.cache.has(r)||c(),r)})},h0e=t=>{let e="";const n=[],r={},i=[];for(const[a,,,,o,s]of t){e===""&&(e=a),n.push(a),i.push(...s);for(const l in o){const f=o[l];(r[l]===void 0||f!=="undefined"||s.includes(f))&&(r[l]=f)}}return[e,n,r,new Set(i)]},f2=(t,e,n,r)=>{const i=[];e:for(let[a,o,s]of t){if(s)continue;let l,f=0,c=!1;for(l in a){const u=a[l];let h=e[l];if(h!==u){if(typeof h!="object"||!h)continue e;{let p,g,m=0;for(const y in h){if(u===String(h[y])){if(y!=="@initial"){const b=y.slice(1);(g=g||[]).push(b in n?n[b]:y.replace(/^@media ?/,"")),c=!0}f+=m,p=!0}++m}if(g&&g.length&&(o={["@media "+g.join(", ")]:o}),!p)continue e}}}(i[f]=i[f]||[]).push([r?"cv":`${l}-${a[l]}`,o,c])}return i},p0e={},m0e=Bf(),g0e=(t,e)=>m0e(t,(()=>(...n)=>{const r=()=>{for(let i of n){i=typeof i=="object"&&i||{};let a=oa(i);if(!e.rules.global.cache.has(a)){if(e.rules.global.cache.add(a),"@import"in i){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let s of[].concat(i["@import"]))s=s.includes('"')||s.includes("'")?s:`"${s}"`,e.sheet.insertRule(`@import ${s};`,o++);delete i["@import"]}no(i,[],[],t,(o=>{e.rules.global.apply(o)}))}}return""};return nO(r,{toString:r})})),y0e=Bf(),b0e=(t,e)=>y0e(t,(()=>n=>{const r=`${ni(t.prefix)}k-${oa(n)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const a=[];no(n,[],[],t,(s=>a.push(s)));const o=`@keyframes ${r}{${a.join("")}}`;e.rules.global.apply(o)}return r};return nO(i,{get name(){return i()},toString:i})})),O0e=class{constructor(t,e,n,r){this.token=t==null?"":String(t),this.value=e==null?"":String(e),this.scale=n==null?"":String(n),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+ni(this.prefix)+ni(this.scale)+this.token}toString(){return this.computedValue}},v0e=Bf(),w0e=(t,e)=>v0e(t,(()=>(n,r)=>{r=typeof n=="object"&&n||Object(r);const i=`.${n=(n=typeof n=="string"?n:"")||`${ni(t.prefix)}t-${oa(r)}`}`,a={},o=[];for(const l in r){a[l]={};for(const f in r[l]){const c=`--${ni(t.prefix)}${l}-${f}`,u=LI(String(r[l][f]),t.prefix,l);a[l][f]=new O0e(f,u,l,t.prefix),o.push(`${c}:${u}`)}}const s=()=>{if(o.length&&!e.rules.themed.cache.has(n)){e.rules.themed.cache.add(n);const l=`${r===t.theme?":root,":""}.${n}{${o.join(";")}}`;e.rules.themed.apply(l)}return n};return{...a,get className(){return s()},selector:i,toString:s}})),x0e=Bf(),S0e=t=>{let e=!1;const n=x0e(t,(r=>{e=!0;const i="prefix"in(r=typeof r=="object"&&r||{})?String(r.prefix):"",a=typeof r.media=="object"&&r.media||{},o=typeof r.root=="object"?r.root||null:globalThis.document||null,s=typeof r.theme=="object"&&r.theme||{},l={prefix:i,media:a,theme:s,themeMap:typeof r.themeMap=="object"&&r.themeMap||{...qpe},utils:typeof r.utils=="object"&&r.utils||{}},f=s0e(o),c={css:c0e(l,f),globalCss:g0e(l,f),keyframes:b0e(l,f),createTheme:w0e(l,f),reset(){f.reset(),c.theme.toString()},theme:{},sheet:f,config:l,prefix:i,getCssText:f.toString,toString:f.toString};return String(c.theme=c.createTheme(s)),c}));return e||n.reset(),n},c2=Object.prototype.hasOwnProperty;function u2(t,e,n){for(n of t.keys())if(yo(n,e))return n}function yo(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&yo(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(i=r,i&&typeof i=="object"&&(i=u2(e,i),!i)||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(i=r[0],i&&typeof i=="object"&&(i=u2(e,i),!i)||!yo(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(c2.call(t,n)&&++r&&!c2.call(e,n)||!(n in e)||!yo(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var M0e=/(%?)(%([sdjo]))/g;function C0e(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const n=JSON.stringify(t);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?t:n}}}function Sg(t,...e){if(e.length===0)return t;let n=0,r=t.replace(M0e,(i,a,o,s)=>{const l=e[n],f=C0e(l,s);return a?i:(n++,f)});return n<e.length&&(r+=` ${e.slice(n).join(" ")}`),r=r.replace(/%{2,2}/g,"%"),r}var j0e=2;function k0e(t){if(!t.stack)return;const e=t.stack.split(`
188
188
  `);e.splice(1,j0e),t.stack=e.join(`
189
189
  `)}var L0e=class extends Error{constructor(t,...e){super(t),this.message=t,this.name="Invariant Violation",this.message=Sg(t,...e),k0e(this)}},rO=(t,e,...n)=>{if(!t)throw new L0e(e,...n)};rO.as=(t,e,n,...r)=>{if(!e)throw t.prototype.name!=null?new t(Sg(n,r)):t(Sg(n,r))};var Mg=function(t,e){return Mg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Mg(t,e)};function T0e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Mg(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}exports.__assign=function(){return exports.__assign=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},exports.__assign.apply(this,arguments)};function TI(t,e,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function s(c){try{f(r.next(c))}catch(u){o(u)}}function l(c){try{f(r.throw(c))}catch(u){o(u)}}function f(c){c.done?a(c.value):i(c.value).then(s,l)}f((r=r.apply(t,[])).next())})}function NI(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(c){return l([f,c])}}function l(f){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=e.call(t,n)}catch(c){f=[6,c],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function N0e(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,a;r<i;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}exports.SandpackLogLevel=void 0;(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"})(exports.SandpackLogLevel||(exports.SandpackLogLevel={}));var II=function(t){return"[sandpack-client]: ".concat(t)};function iu(t,e){return e===void 0&&(e="Value is nullish"),rO(t!=null,II(e)),t}var I0e='"dependencies" was not specified - provide either a package.json or a "dependencies" value',d2='"entry" was not specified - provide either a package.json with the "main" field or an "entry" value';function PI(t,e,n){return t===void 0&&(t={}),e===void 0&&(e={}),n===void 0&&(n="/index.js"),JSON.stringify({name:"sandpack-project",main:n,dependencies:t,devDependencies:e},null,2)}function EI(t,e,n,r){var i,a,o=ba(t),s=o["/package.json"];if(!s)return iu(e,I0e),iu(r,d2),o["/package.json"]={code:PI(e,n,r)},o;if(s){var l=JSON.parse(s.code);iu(!(!e&&!l.dependencies),d2),e&&(l.dependencies=exports.__assign(exports.__assign({},(i=l.dependencies)!==null&&i!==void 0?i:{}),e??{})),n&&(l.devDependencies=exports.__assign(exports.__assign({},(a=l.devDependencies)!==null&&a!==void 0?a:{}),n??{})),r&&(l.main=r),o["/package.json"]={code:JSON.stringify(l,null,2)}}return o}function DI(t){var e;if(t.title==="SyntaxError"){var n=t.title,r=t.path,i=t.message,a=t.line,o=t.column;return{title:n,path:r,message:i,line:a,column:o}}var s=P0e((e=t.payload)===null||e===void 0?void 0:e.frames);if(!s)return{message:t.message};var l=D0e(s),f=E0e(s),c=Q0e(s._originalFileName,t.message,f,l);return{message:c,title:t.title,path:s._originalFileName,line:s._originalLineNumber,column:s._originalColumnNumber}}function P0e(t){if(t)return t.find(function(e){return!!e._originalFileName})}function E0e(t){return t?" (".concat(t._originalLineNumber,":").concat(t._originalColumnNumber,")"):""}function D0e(t){var e=t._originalScriptCode[t._originalScriptCode.length-1],n=e.lineNumber.toString().length,r=2,i=3,a=r+n+i+t._originalColumnNumber;return t._originalScriptCode.reduce(function(o,s){var l=s.highlight?">":" ",f=s.lineNumber.toString().length===n?"".concat(s.lineNumber):" ".concat(s.lineNumber),c=s.highlight?`
190
190
  `+" ".repeat(a)+"^":"";return o+`
191
191
  `+l+" "+f+" | "+s.content+c},"")}function Q0e(t,e,n,r){return"".concat(t,": ").concat(e).concat(n,`
192
- `).concat(r)}var ba=function(t){return typeof t=="string"?t.startsWith("/")?t:"/".concat(t):Array.isArray(t)?t.map(function(e){return e.startsWith("/")?e:"/".concat(e)}):typeof t=="object"&&t!==null?Object.entries(t).reduce(function(e,n){var r=n[0],i=n[1],a=r.startsWith("/")?r:"/".concat(r);return e[a]=i,e},{}):null};function A0e(t,e,n){var r;return n===void 0&&(n={}),TI(this,void 0,void 0,function(){var i,a,o;return NI(this,function(s){switch(s.label){case 0:switch(i=(r=e.template)!==null&&r!==void 0?r:"parcel",o=i,o){case"node":return[3,1];case"static":return[3,3]}return[3,5];case 1:return[4,Promise.resolve().then(()=>require("./index-dg_yzRo7.js")).then(function(l){return l.SandpackNode})];case 2:return a=s.sent(),[3,7];case 3:return[4,Promise.resolve().then(()=>require("./index-599aeaf7-Coto8o_j.js")).then(function(l){return l.SandpackStatic})];case 4:return a=s.sent(),[3,7];case 5:return[4,Promise.resolve().then(()=>require("./index-CQ-BignZ.js")).then(function(l){return l.SandpackRuntime})];case 6:a=s.sent(),s.label=7;case 7:return[2,new a(t,e,n)]}})})}let Cg=[],QI=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?QI:Cg).push(n=n+t[e])})();function R0e(t){if(t<768)return!1;for(let e=0,n=Cg.length;;){let r=e+n>>1;if(t<Cg[r])n=r;else if(t>=QI[r])e=r+1;else return!0;if(e==n)return!1}}function h2(t){return t>=127462&&t<=127487}const p2=8205;function $0e(t,e,n=!0,r=!0){return(n?AI:z0e)(t,e,r)}function AI(t,e,n){if(e==t.length)return e;e&&RI(t.charCodeAt(e))&&$I(t.charCodeAt(e-1))&&e--;let r=y0(t,e);for(e+=m2(r);e<t.length;){let i=y0(t,e);if(r==p2||i==p2||n&&R0e(i))e+=m2(i),r=i;else if(h2(i)){let a=0,o=e-2;for(;o>=0&&h2(y0(t,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function z0e(t,e,n){for(;e>0;){let r=AI(t,e-2,n);if(r<e)return r;e--}return 0}function y0(t,e){let n=t.charCodeAt(e);if(!$I(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return RI(r)?(n-55296<<10)+(r-56320)+65536:n}function RI(t){return t>=56320&&t<57344}function $I(t){return t>=55296&&t<56320}function m2(t){return t<65536?1:2}class Ae{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=_o(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),vr.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=_o(this,e,n);let r=[];return this.decompose(e,n,r,0),vr.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ml(this),a=new ml(e);for(let o=n,s=n;;){if(i.next(o),a.next(o),o=0,i.lineBreak!=a.lineBreak||i.done!=a.done||i.value!=a.value)return!1;if(s+=i.value.length,i.done||s>=r)return!0}}iter(e=1){return new ml(this,e)}iterRange(e,n=this.length){return new zI(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new _I(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Ae.empty:e.length<=32?new pt(e):vr.from(pt.split(e,[]))}}class pt extends Ae{constructor(e,n=_0e(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let a=0;;a++){let o=this.text[a],s=i+o.length;if((n?r:s)>=e)return new Z0e(i,s,r,o);i=s+1,r++}}decompose(e,n,r,i){let a=e<=0&&n>=this.length?this:new pt(g2(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),s=au(a.text,o.text.slice(),0,a.length);if(s.length<=32)r.push(new pt(s,o.length+a.length));else{let l=s.length>>1;r.push(new pt(s.slice(0,l)),new pt(s.slice(l)))}}else r.push(a)}replace(e,n,r){if(!(r instanceof pt))return super.replace(e,n,r);[e,n]=_o(this,e,n);let i=au(this.text,au(r.text,g2(this.text,0,e)),n),a=this.length+r.length-(n-e);return i.length<=32?new pt(i,a):vr.from(pt.split(i,[]),a)}sliceString(e,n=this.length,r=`
192
+ `).concat(r)}var ba=function(t){return typeof t=="string"?t.startsWith("/")?t:"/".concat(t):Array.isArray(t)?t.map(function(e){return e.startsWith("/")?e:"/".concat(e)}):typeof t=="object"&&t!==null?Object.entries(t).reduce(function(e,n){var r=n[0],i=n[1],a=r.startsWith("/")?r:"/".concat(r);return e[a]=i,e},{}):null};function A0e(t,e,n){var r;return n===void 0&&(n={}),TI(this,void 0,void 0,function(){var i,a,o;return NI(this,function(s){switch(s.label){case 0:switch(i=(r=e.template)!==null&&r!==void 0?r:"parcel",o=i,o){case"node":return[3,1];case"static":return[3,3]}return[3,5];case 1:return[4,Promise.resolve().then(()=>require("./index-8ukDJ4gJ.js")).then(function(l){return l.SandpackNode})];case 2:return a=s.sent(),[3,7];case 3:return[4,Promise.resolve().then(()=>require("./index-599aeaf7-CMsCrme3.js")).then(function(l){return l.SandpackStatic})];case 4:return a=s.sent(),[3,7];case 5:return[4,Promise.resolve().then(()=>require("./index-DLPrZKll.js")).then(function(l){return l.SandpackRuntime})];case 6:a=s.sent(),s.label=7;case 7:return[2,new a(t,e,n)]}})})}let Cg=[],QI=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?QI:Cg).push(n=n+t[e])})();function R0e(t){if(t<768)return!1;for(let e=0,n=Cg.length;;){let r=e+n>>1;if(t<Cg[r])n=r;else if(t>=QI[r])e=r+1;else return!0;if(e==n)return!1}}function h2(t){return t>=127462&&t<=127487}const p2=8205;function $0e(t,e,n=!0,r=!0){return(n?AI:z0e)(t,e,r)}function AI(t,e,n){if(e==t.length)return e;e&&RI(t.charCodeAt(e))&&$I(t.charCodeAt(e-1))&&e--;let r=y0(t,e);for(e+=m2(r);e<t.length;){let i=y0(t,e);if(r==p2||i==p2||n&&R0e(i))e+=m2(i),r=i;else if(h2(i)){let a=0,o=e-2;for(;o>=0&&h2(y0(t,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function z0e(t,e,n){for(;e>0;){let r=AI(t,e-2,n);if(r<e)return r;e--}return 0}function y0(t,e){let n=t.charCodeAt(e);if(!$I(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return RI(r)?(n-55296<<10)+(r-56320)+65536:n}function RI(t){return t>=56320&&t<57344}function $I(t){return t>=55296&&t<56320}function m2(t){return t<65536?1:2}class Ae{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=_o(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),vr.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=_o(this,e,n);let r=[];return this.decompose(e,n,r,0),vr.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ml(this),a=new ml(e);for(let o=n,s=n;;){if(i.next(o),a.next(o),o=0,i.lineBreak!=a.lineBreak||i.done!=a.done||i.value!=a.value)return!1;if(s+=i.value.length,i.done||s>=r)return!0}}iter(e=1){return new ml(this,e)}iterRange(e,n=this.length){return new zI(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new _I(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Ae.empty:e.length<=32?new pt(e):vr.from(pt.split(e,[]))}}class pt extends Ae{constructor(e,n=_0e(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let a=0;;a++){let o=this.text[a],s=i+o.length;if((n?r:s)>=e)return new Z0e(i,s,r,o);i=s+1,r++}}decompose(e,n,r,i){let a=e<=0&&n>=this.length?this:new pt(g2(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),s=au(a.text,o.text.slice(),0,a.length);if(s.length<=32)r.push(new pt(s,o.length+a.length));else{let l=s.length>>1;r.push(new pt(s.slice(0,l)),new pt(s.slice(l)))}}else r.push(a)}replace(e,n,r){if(!(r instanceof pt))return super.replace(e,n,r);[e,n]=_o(this,e,n);let i=au(this.text,au(r.text,g2(this.text,0,e)),n),a=this.length+r.length-(n-e);return i.length<=32?new pt(i,a):vr.from(pt.split(i,[]),a)}sliceString(e,n=this.length,r=`
193
193
  `){[e,n]=_o(this,e,n);let i="";for(let a=0,o=0;a<=n&&o<this.text.length;o++){let s=this.text[o],l=a+s.length;a>e&&o&&(i+=r),e<l&&n>a&&(i+=s.slice(Math.max(0,e-a),n-a)),a=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let a of e)r.push(a),i+=a.length+1,r.length==32&&(n.push(new pt(r,i)),r=[],i=-1);return i>-1&&n.push(new pt(r,i)),n}}class vr extends Ae{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let a=0;;a++){let o=this.children[a],s=i+o.length,l=r+o.lines-1;if((n?l:s)>=e)return o.lineInner(e,n,r,i);i=s+1,r=l+1}}decompose(e,n,r,i){for(let a=0,o=0;o<=n&&a<this.children.length;a++){let s=this.children[a],l=o+s.length;if(e<=l&&n>=o){let f=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!f?r.push(s):s.decompose(e-o,n-o,r,f)}o=l+1}}replace(e,n,r){if([e,n]=_o(this,e,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e>=a&&n<=s){let l=o.replace(e-a,n-a,r),f=this.lines-o.lines+l.lines;if(l.lines<f>>4&&l.lines>f>>6){let c=this.children.slice();return c[i]=l,new vr(c,this.length-(n-e)+r.length)}return super.replace(a,s,l)}a=s+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
194
194
  `){[e,n]=_o(this,e,n);let i="";for(let a=0,o=0;a<this.children.length&&o<=n;a++){let s=this.children[a],l=o+s.length;o>e&&a&&(i+=r),e<l&&n>o&&(i+=s.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof vr))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let l=this.children[i],f=e.children[a];if(l!=f)return r+l.scanIdentical(f,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let g of e)g.flatten(p);return new pt(p,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],l=0,f=-1,c=[];function u(p){let g;if(p.lines>a&&p instanceof vr)for(let m of p.children)u(m);else p.lines>o&&(l>o||!l)?(h(),s.push(p)):p instanceof pt&&l&&(g=c[c.length-1])instanceof pt&&p.lines+g.lines<=32?(l+=p.lines,f+=p.length+1,c[c.length-1]=new pt(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>i&&h(),l+=p.lines,f+=p.length+1,c.push(p))}function h(){l!=0&&(s.push(c.length==1?c[0]:vr.from(c,f)),f=-1,l=c.length=0)}for(let p of e)u(p);return h(),s.length==1?s[0]:new vr(s,n)}}Ae.empty=new pt([""],0);function _0e(t){let e=-1;for(let n of t)e+=n.length+1;return e}function au(t,e,n=0,r=1e9){for(let i=0,a=0,o=!0;a<t.length&&i<=r;a++){let s=t[a],l=i+s.length;l>=n&&(l>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(e[e.length-1]+=s,o=!1):e.push(s)),i=l+1}return e}function g2(t,e,n){return au(t,[""],e,n)}class ml{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof pt?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],a=this.offsets[r],o=a>>1,s=i instanceof pt?i.text.length:i.children.length;if(o==(n>0?s:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
195
195
  `,this;e--}else if(i instanceof pt){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof pt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class zI{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new ml(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _I{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ae.prototype[Symbol.iterator]=function(){return this.iter()},ml.prototype[Symbol.iterator]=zI.prototype[Symbol.iterator]=_I.prototype[Symbol.iterator]=function(){return this});class Z0e{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function _o(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Gt(t,e,n=!0,r=!0){return $0e(t,e,n,r)}function Y0e(t){return t>=56320&&t<57344}function B0e(t){return t>=55296&&t<56320}function Aa(t,e){let n=t.charCodeAt(e);if(!B0e(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Y0e(r)?(n-55296<<10)+(r-56320)+65536:n}function W0e(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Vh(t){return t<65536?1:2}const jg=/\r\n?|\n/;var _t=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(_t||(_t={}));class Lr{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let a=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,a),i+=a):i+=o,r+=a}}iterChangedRanges(e,n=!1){kg(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new Lr(e)}composeDesc(e){return this.empty?e:e.empty?this:ZI(this,e)}mapDesc(e,n=!1){return e.empty?this:Lg(this,e,n)}mapPos(e,n=-1,r=_t.Simple){let i=0,a=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],l=this.sections[o++],f=i+s;if(l<0){if(f>e)return a+(e-i);a+=s}else{if(r!=_t.Simple&&f>=e&&(r==_t.TrackDel&&i<e&&f>e||r==_t.TrackBefore&&i<e||r==_t.TrackAfter&&f>e))return null;if(f>e||f==e&&n<0&&!s)return e==i||n<0?a:a+l;a+=l}i=f}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return a}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let a=this.sections[r++],o=this.sections[r++],s=i+a;if(o>=0&&i<=n&&s>=e)return i<e&&s>n?"cover":!0;i=s}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Lr(e)}static create(e){return new Lr(e)}}class Ct extends Lr{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kg(this,(n,r,i,a,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return Lg(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,a=0;i<n.length;i+=2){let o=n[i],s=n[i+1];if(s>=0){n[i]=s,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(Ae.empty);r.push(o?e.slice(a,a+o):Ae.empty)}a+=o}return new Ct(n,r)}compose(e){return this.empty?e:e.empty?this:ZI(this,e,!0)}map(e,n=!1){return e.empty?this:Lg(this,e,n,!0)}iterChanges(e,n=!1){kg(this,e,n)}get desc(){return Lr.create(this.sections)}filter(e){let n=[],r=[],i=[],a=new Xl(this);e:for(let o=0,s=0;;){let l=o==e.length?1e9:e[o++];for(;s<l||s==l&&a.len==0;){if(a.done)break e;let c=Math.min(a.len,l-s);zt(i,c,-1);let u=a.ins==-1?-1:a.off==0?a.ins:0;zt(n,c,u),u>0&&Oi(r,n,a.text),a.forward(c),s+=c}let f=e[o++];for(;s<f;){if(a.done)break e;let c=Math.min(a.len,f-s);zt(n,c,-1),zt(i,c,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(c),s+=c}}return{changes:new Ct(n,r),filtered:Lr.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],a=[],o=0,s=null;function l(c=!1){if(!c&&!i.length)return;o<n&&zt(i,n-o,-1);let u=new Ct(i,a);s=s?s.compose(u.map(s)):u,i=[],a=[],o=0}function f(c){if(Array.isArray(c))for(let u of c)f(u);else if(c instanceof Ct){if(c.length!=n)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${n})`);l(),s=s?s.compose(c.map(s)):c}else{let{from:u,to:h=u,insert:p}=c;if(u>h||u<0||h>n)throw new RangeError(`Invalid change range ${u} to ${h} (in doc of length ${n})`);let g=p?typeof p=="string"?Ae.of(p.split(r||jg)):p:Ae.empty,m=g.length;if(u==h&&m==0)return;u<o&&l(),u>o&&zt(i,u-o,-1),zt(i,h-u,m),Oi(a,i,g),o=h}}return f(e),l(!s),s}static empty(e){return new Ct(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i];if(typeof a=="number")n.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,s)=>s&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)n.push(a[0],0);else{for(;r.length<i;)r.push(Ae.empty);r[i]=Ae.of(a.slice(1)),n.push(a[0],r[i].length)}}}return new Ct(n,r)}static createSet(e,n){return new Ct(e,n)}}function zt(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Oi(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Ae.empty);t.push(n)}}function kg(t,e,n){let r=t.inserted;for(let i=0,a=0,o=0;o<t.sections.length;){let s=t.sections[o++],l=t.sections[o++];if(l<0)i+=s,a+=s;else{let f=i,c=a,u=Ae.empty;for(;f+=s,c+=l,l&&r&&(u=u.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)s=t.sections[o++],l=t.sections[o++];e(i,f,a,c,u),i=f,a=c}}}function Lg(t,e,n,r=!1){let i=[],a=r?[]:null,o=new Xl(t),s=new Xl(e);for(let l=-1;;){if(o.done&&s.len||s.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&s.ins==-1){let f=Math.min(o.len,s.len);zt(i,f,-1),o.forward(f),s.forward(f)}else if(s.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let f=s.len;for(zt(i,s.ins,-1);f;){let c=Math.min(o.len,f);o.ins>=0&&l<o.i&&o.len<=c&&(zt(i,0,o.ins),a&&Oi(a,i,o.text),l=o.i),o.forward(c),f-=c}s.next()}else if(o.ins>=0){let f=0,c=o.len;for(;c;)if(s.ins==-1){let u=Math.min(c,s.len);f+=u,c-=u,s.forward(u)}else if(s.ins==0&&s.len<c)c-=s.len,s.next();else break;zt(i,f,l<o.i?o.ins:0),a&&l<o.i&&Oi(a,i,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&s.done)return a?Ct.createSet(i,a):Lr.create(i);throw new Error("Mismatched change set lengths")}}}function ZI(t,e,n=!1){let r=[],i=n?[]:null,a=new Xl(t),o=new Xl(e);for(let s=!1;;){if(a.done&&o.done)return i?Ct.createSet(r,i):Lr.create(r);if(a.ins==0)zt(r,a.len,0,s),a.next();else if(o.len==0&&!o.done)zt(r,0,o.ins,s),i&&Oi(i,r,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(a.len2,o.len),f=r.length;if(a.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;zt(r,l,c,s),i&&c&&Oi(i,r,o.text)}else o.ins==-1?(zt(r,a.off?0:a.len,l,s),i&&Oi(i,r,a.textBit(l))):(zt(r,a.off?0:a.len,o.off?0:o.ins,s),i&&!o.off&&Oi(i,r,o.text));s=(a.ins>l||o.ins>=0&&o.len>l)&&(s||r.length>f),a.forward2(l),o.forward(l)}}}}class Xl{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Ae.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Ae.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ra{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new ra(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return re.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return re.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return re.range(e.anchor,e.head)}static create(e,n,r){return new ra(e,n,r)}}class re{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:re.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new re([this.main],0)}addRange(e,n=!0){return re.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,re.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new re(e.ranges.map(n=>ra.fromJSON(n)),e.main)}static single(e,n=e){return new re([re.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let a=e[i];if(a.empty?a.from<=r:a.from<r)return re.normalized(e.slice(),n);r=a.to}return new re(e,n)}static cursor(e,n=0,r,i){return ra.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let a=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?ra.create(n,e,48|a):ra.create(e,n,(n>e?8:0)|a)}static normalized(e,n=0){let r=e[n];e.sort((i,a)=>i.from-a.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let a=e[i],o=e[i-1];if(a.empty?a.from<=o.to:a.from<o.to){let s=o.from,l=Math.max(a.to,o.to);i<=n&&n--,e.splice(--i,2,a.anchor>a.head?re.range(l,s):re.range(s,l))}}return new re(e,n)}}function YI(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let iO=0;class me{constructor(e,n,r,i,a){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=iO++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new me(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:aO),!!e.static,e.enables)}of(e){return new ou([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ou(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ou(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function aO(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class ou{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=iO++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,a=this.id,o=e[a]>>1,s=this.type==2,l=!1,f=!1,c=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?f=!0:(((n=e[u.id])!==null&&n!==void 0?n:1)&1)==0&&c.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,h){if(l&&h.docChanged||f&&(h.docChanged||h.selection)||Tg(u,c)){let p=r(u);if(s?!y2(p,u.values[o],i):!i(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,h)=>{let p,g=h.config.address[a];if(g!=null){let m=ad(h,g);if(this.dependencies.every(y=>y instanceof me?h.facet(y)===u.facet(y):y instanceof cr?h.field(y,!1)==u.field(y,!1):!0)||(s?y2(p=r(u),m,i):i(p=r(u),m)))return u.values[o]=m,0}else p=r(u);return u.values[o]=p,1}}}}function y2(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Tg(t,e){let n=!1;for(let r of e)gl(t,r)&1&&(n=!0);return n}function F0e(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),a=r.filter(l=>!(l&1)),o=t[e.id]>>1;function s(l){let f=[];for(let c=0;c<r.length;c++){let u=ad(l,r[c]);if(i[c]==2)for(let h of u)f.push(h);else f.push(u)}return e.combine(f)}return{create(l){for(let f of r)gl(l,f);return l.values[o]=s(l),1},update(l,f){if(!Tg(l,a))return 0;let c=s(l);return e.compare(c,l.values[o])?0:(l.values[o]=c,1)},reconfigure(l,f){let c=Tg(l,r),u=f.config.facets[e.id],h=f.facet(e);if(u&&!c&&aO(n,u))return l.values[o]=h,0;let p=s(l);return e.compare(p,h)?(l.values[o]=h,0):(l.values[o]=p,1)}}}const gc=me.define({static:!0});class cr{constructor(e,n,r,i,a){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=a,this.provides=void 0}static define(e){let n=new cr(iO++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(gc).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let a=r.values[n],o=this.updateF(a,i);return this.compareF(a,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let a=r.facet(gc),o=i.facet(gc),s;return(s=a.find(l=>l.field==this))&&s!=o.find(l=>l.field==this)?(r.values[n]=s.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,gc.of({field:this,create:e})]}get extension(){return this}}const na={lowest:4,low:3,default:2,high:1,highest:0};function Fs(t){return e=>new BI(e,t)}const Gh={highest:Fs(na.highest),high:Fs(na.high),default:Fs(na.default),low:Fs(na.low),lowest:Fs(na.lowest)};class BI{constructor(e,n){this.inner=e,this.prec=n}}class Uh{of(e){return new Ng(this,e)}reconfigure(e){return Uh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ng{constructor(e,n){this.compartment=e,this.inner=n}}class id{constructor(e,n,r,i,a,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],a=Object.create(null),o=new Map;for(let h of X0e(e,n,o))h instanceof cr?i.push(h):(a[h.facet.id]||(a[h.facet.id]=[])).push(h);let s=Object.create(null),l=[],f=[];for(let h of i)s[h.id]=f.length<<1,f.push(p=>h.slot(p));let c=r?.config.facets;for(let h in a){let p=a[h],g=p[0].facet,m=c&&c[h]||[];if(p.every(y=>y.type==0))if(s[g.id]=l.length<<1|1,aO(m,p))l.push(r.facet(g));else{let y=g.combine(p.map(b=>b.value));l.push(r&&g.compare(y,r.facet(g))?r.facet(g):y)}else{for(let y of p)y.type==0?(s[y.id]=l.length<<1|1,l.push(y.value)):(s[y.id]=f.length<<1,f.push(b=>y.dynamicSlot(b)));s[g.id]=f.length<<1,f.push(y=>F0e(y,g,p))}}let u=f.map(h=>h(s));return new id(e,o,u,s,l,a)}}function X0e(t,e,n){let r=[[],[],[],[],[]],i=new Map;function a(o,s){let l=i.get(o);if(l!=null){if(l<=s)return;let f=r[l].indexOf(o);f>-1&&r[l].splice(f,1),o instanceof Ng&&n.delete(o.compartment)}if(i.set(o,s),Array.isArray(o))for(let f of o)a(f,s);else if(o instanceof Ng){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(o.compartment)||o.inner;n.set(o.compartment,f),a(f,s)}else if(o instanceof BI)a(o.inner,o.prec);else if(o instanceof cr)r[s].push(o),o.provides&&a(o.provides,s);else if(o instanceof ou)r[s].push(o),o.facet.extensions&&a(o.facet.extensions,na.default);else{let f=o.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(f,s)}}return a(t,na.default),r.reduce((o,s)=>o.concat(s))}function gl(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function ad(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const WI=me.define(),Ig=me.define({combine:t=>t.some(e=>e),static:!0}),FI=me.define({combine:t=>t.length?t[0]:void 0,static:!0}),XI=me.define(),VI=me.define(),GI=me.define(),UI=me.define({combine:t=>t.length?t[0]:!1});class ir{constructor(e,n){this.type=e,this.value=n}static define(){return new V0e}}class V0e{of(e){return new ir(this,e)}}class G0e{constructor(e){this.map=e}of(e){return new Ge(this,e)}}class Ge{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Ge(this.type,n)}is(e){return this.type==e}static define(e={}){return new G0e(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let a=i.map(n);a&&r.push(a)}return r}}Ge.reconfigure=Ge.define();Ge.appendConfig=Ge.define();class xt{constructor(e,n,r,i,a,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&YI(r,n.newLength),a.some(s=>s.type==xt.time)||(this.annotations=a.concat(xt.time.of(Date.now())))}static create(e,n,r,i,a,o){return new xt(e,n,r,i,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(xt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}xt.time=ir.define();xt.userEvent=ir.define();xt.addToHistory=ir.define();xt.remote=ir.define();function U0e(t,e){let n=[];for(let r=0,i=0;;){let a,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))a=t[r++],o=t[r++];else if(i<e.length)a=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function qI(t,e,n){var r;let i,a,o;return n?(i=e.changes,a=Ct.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(a):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:Ge.mapEffects(t.effects,i).concat(Ge.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Pg(t,e,n){let r=e.selection,i=bo(e.annotations);return e.userEvent&&(i=i.concat(xt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ct?e.changes:Ct.of(e.changes||[],n,t.facet(FI)),selection:r&&(r instanceof re?r:re.single(r.anchor,r.head)),effects:bo(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function HI(t,e,n){let r=Pg(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(n=!1);let o=!!e[a].sequential;r=qI(r,Pg(t,e[a],o?r.changes.newLength:t.doc.length),o)}let i=xt.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return H0e(n?q0e(i):i)}function q0e(t){let e=t.startState,n=!0;for(let i of e.facet(XI)){let a=i(t);if(a===!1){n=!1;break}Array.isArray(a)&&(n=n===!0?a:U0e(n,a))}if(n!==!0){let i,a;if(n===!1)a=t.changes.invertedDesc,i=Ct.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}t=xt.create(e,i,t.selection&&t.selection.map(a),Ge.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let r=e.facet(VI);for(let i=r.length-1;i>=0;i--){let a=r[i](t);a instanceof xt?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof xt?t=a[0]:t=HI(e,bo(a),!1)}return t}function H0e(t){let e=t.startState,n=e.facet(GI),r=t;for(let i=n.length-1;i>=0;i--){let a=n[i](t);a&&Object.keys(a).length&&(r=qI(r,Pg(e,a,t.changes.newLength),!0))}return r==t?t:xt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const J0e=[];function bo(t){return t==null?J0e:Array.isArray(t)?t:[t]}var Pn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Pn||(Pn={}));const K0e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Eg;try{Eg=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function eme(t){if(Eg)return Eg.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||K0e.test(n)))return!0}return!1}function tme(t){return e=>{if(!/\S/.test(e))return Pn.Space;if(eme(e))return Pn.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Pn.Word;return Pn.Other}}class Ze{constructor(e,n,r,i,a,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let s=0;s<this.config.dynamicSlots.length;s++)gl(this,s<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return gl(this,r),ad(this,r)}update(...e){return HI(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let s of e.effects)s.is(Uh.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,f)=>i.set(f,l)),n=null),i.set(s.value.compartment,s.value.extension)):s.is(Ge.reconfigure)?(n=null,r=s.value):s.is(Ge.appendConfig)&&(n=null,r=bo(r).concat(s.value));let a;n?a=e.startState.values.slice():(n=id.resolve(r,i,this),a=new Ze(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,f)=>f.reconfigure(l,this),null).values);let o=e.startState.facet(Ig)?e.newSelection:e.newSelection.asSingle();new Ze(n,e.newDoc,o,a,(s,l)=>l.update(s,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:re.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),a=[r.range],o=bo(r.effects);for(let s=1;s<n.ranges.length;s++){let l=e(n.ranges[s]),f=this.changes(l.changes),c=f.map(i);for(let h=0;h<s;h++)a[h]=a[h].map(c);let u=i.mapDesc(f,!0);a.push(l.range.map(u)),i=i.compose(c),o=Ge.mapEffects(o,c).concat(Ge.mapEffects(bo(l.effects),u))}return{changes:i,selection:re.create(a,n.mainIndex),effects:o}}changes(e=[]){return e instanceof Ct?e:Ct.of(e,this.doc.length,this.facet(Ze.lineSeparator))}toText(e){return Ae.of(e.split(this.facet(Ze.lineSeparator)||jg))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(gl(this,n),ad(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof cr&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let a in r)if(Object.prototype.hasOwnProperty.call(e,a)){let o=r[a],s=e[a];i.push(o.init(l=>o.spec.fromJSON(s,l)))}}return Ze.create({doc:e.doc,selection:re.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=id.resolve(e.extensions||[],new Map),r=e.doc instanceof Ae?e.doc:Ae.of((e.doc||"").split(n.staticFacet(Ze.lineSeparator)||jg)),i=e.selection?e.selection instanceof re?e.selection:re.single(e.selection.anchor,e.selection.head):re.single(0);return YI(i,r.length),n.staticFacet(Ig)||(i=i.asSingle()),new Ze(n,r,i,n.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Ze.tabSize)}get lineBreak(){return this.facet(Ze.lineSeparator)||`
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-gS_Z-Oc2.js"),$=require("./base-80a1f760-GbzWmCl8.js"),g=require("./consoleHook-59e792cb-C4HB77P4.js");var V=Object.create,F=Object.defineProperty,z=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyNames,G=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty,Y=(t,n,e)=>n in t?F(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,P=(t,n)=>function(){return n||(0,t[U(t)[0]])((n={exports:{}}).exports,n),n.exports},K=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of U(n))!J.call(t,s)&&s!==e&&F(t,s,{get:()=>n[s],enumerable:!(r=z(n,s))||r.enumerable});return t},j=(t,n,e)=>(e=t!=null?V(G(t)):{},K(!t||!t.__esModule?F(e,"default",{value:t,enumerable:!0}):e,t)),X=(t,n,e)=>(Y(t,n+"",e),e),x=(t,n,e)=>{if(!n.has(t))throw TypeError("Cannot "+e)},_=(t,n,e)=>(x(t,n,"read from private field"),e?e.call(t):n.get(t)),M=(t,n,e)=>{if(n.has(t))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(t):n.set(t,e)},k=(t,n,e,r)=>(x(t,n,"write to private field"),n.set(t,e),e),E=(t,n,e)=>(x(t,n,"access private method"),e),B=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/pad.js"(t,n){n.exports=function(r,s){var i="000000000"+r;return i.substr(i.length-s)}}}),Q=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/fingerprint.browser.js"(t,n){var e=B(),r=typeof window=="object"?window:self,s=Object.keys(r).length,i=navigator.mimeTypes?navigator.mimeTypes.length:0,o=e((i+navigator.userAgent.length).toString(36)+s.toString(36),4);n.exports=function(){return o}}}),Z=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/getRandomValue.browser.js"(t,n){var e,r=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof self<"u"&&self.crypto;r?(s=Math.pow(2,32)-1,e=function(){return Math.abs(r.getRandomValues(new Uint32Array(1))[0]/s)}):e=Math.random;var s;n.exports=e}}),W=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/index.js"(t,n){var e=Q(),r=B(),s=Z(),i=0,o=4,a=36,d=Math.pow(a,o);function l(){return r((s()*d<<0).toString(a),o)}function f(){return i=i<d?i:0,i++,i-1}function m(){var v="c",w=new Date().getTime().toString(a),b=r(f().toString(a),o),c=e(),u=l()+l();return v+w+b+c+u}m.slug=function(){var w=new Date().getTime().toString(36),b=f().toString(36).slice(-4),c=e().slice(0,1)+e().slice(-1),u=l().slice(-2);return w.slice(-2)+b+c+u},m.isCuid=function(w){return typeof w!="string"?!1:!!w.startsWith("c")},m.isSlug=function(w){if(typeof w!="string")return!1;var b=w.length;return b>=7&&b<=10},m.fingerprint=e,n.exports=m}}),N=P({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/createDeferredExecutor.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createDeferredExecutor=void 0;function n(){const e=(r,s)=>{e.state="pending",e.resolve=i=>{if(e.state!=="pending")return;e.result=i;const o=a=>(e.state="fulfilled",a);return r(i instanceof Promise?i:Promise.resolve(i).then(o))},e.reject=i=>{if(e.state==="pending")return queueMicrotask(()=>{e.state="rejected"}),s(e.rejectionReason=i)}};return e}t.createDeferredExecutor=n}}),ee=P({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/DeferredPromise.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=void 0;var n=N(),e=class extends Promise{#e;resolve;reject;constructor(r=null){const s=(0,n.createDeferredExecutor)();super((i,o)=>{s(i,o),r?.(s.resolve,s.reject)}),this.#e=s,this.resolve=this.#e.resolve,this.reject=this.#e.reject}get state(){return this.#e.state}get rejectionReason(){return this.#e.rejectionReason}then(r,s){return this.#t(super.then(r,s))}catch(r){return this.#t(super.catch(r))}finally(r){return this.#t(super.finally(r))}#t(r){return Object.defineProperties(r,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})}};t.DeferredPromise=e}}),A=P({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/index.js"(t){var n=t&&t.__createBinding||(Object.create?function(r,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(r,o,a)}:function(r,s,i,o){o===void 0&&(o=i),r[o]=s[i]}),e=t&&t.__exportStar||function(r,s){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&n(s,r,i)};Object.defineProperty(t,"__esModule",{value:!0}),e(N(),t),e(ee(),t)}}),q=P({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/MemoryLeakError.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryLeakError=void 0;var n=class extends Error{emitter;type;count;constructor(e,r,s){super(`Possible EventEmitter memory leak detected. ${s} ${r.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=r,this.count=s,this.name="MaxListenersExceededWarning"}};t.MemoryLeakError=n}}),te=P({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/Emitter.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=void 0;var n=q(),e,r,s,i,o,a,d,l,f,m,v,w=class{constructor(){M(this,i),M(this,a),M(this,l),M(this,m),M(this,e,void 0),M(this,r,void 0),M(this,s,void 0),k(this,e,new Map),k(this,r,w.defaultMaxListeners),k(this,s,!1)}static listenerCount(c,u){return c.listenerCount(u)}setMaxListeners(c){return k(this,r,c),this}getMaxListeners(){return _(this,r)}eventNames(){return Array.from(_(this,e).keys())}emit(c,...u){const p=E(this,i,o).call(this,c);return p.forEach(I=>{I.apply(this,u)}),p.length>0}addListener(c,u){E(this,m,v).call(this,"newListener",c,u);const p=E(this,i,o).call(this,c).concat(u);if(_(this,e).set(c,p),_(this,r)>0&&this.listenerCount(c)>_(this,r)&&!_(this,s)){k(this,s,!0);const I=new n.MemoryLeakError(this,c,this.listenerCount(c));console.warn(I)}return this}on(c,u){return this.addListener(c,u)}once(c,u){return this.addListener(c,E(this,l,f).call(this,c,u))}prependListener(c,u){const p=E(this,i,o).call(this,c);if(p.length>0){const I=[u].concat(p);_(this,e).set(c,I)}else _(this,e).set(c,p.concat(u));return this}prependOnceListener(c,u){return this.prependListener(c,E(this,l,f).call(this,c,u))}removeListener(c,u){const p=E(this,i,o).call(this,c);return p.length>0&&(E(this,a,d).call(this,p,u),_(this,e).set(c,p),E(this,m,v).call(this,"removeListener",c,u)),this}off(c,u){return this.removeListener(c,u)}removeAllListeners(c){return c?_(this,e).delete(c):_(this,e).clear(),this}listeners(c){return Array.from(E(this,i,o).call(this,c))}listenerCount(c){return E(this,i,o).call(this,c).length}rawListeners(c){return this.listeners(c)}},b=w;e=new WeakMap,r=new WeakMap,s=new WeakMap,i=new WeakSet,o=function(c){return _(this,e).get(c)||[]},a=new WeakSet,d=function(c,u){const p=c.indexOf(u);return p>-1&&c.splice(p,1),[]},l=new WeakSet,f=function(c,u){const p=(...I)=>{this.removeListener(c,p),u.apply(this,I)};return p},m=new WeakSet,v=function(c,u,p){this.emit(c,u,p)},X(b,"defaultMaxListeners",10),t.Emitter=b}}),re=P({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/index.js"(t){var n=t&&t.__createBinding||(Object.create?function(r,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(r,o,a)}:function(r,s,i,o){o===void 0&&(o=i),r[o]=s[i]}),e=t&&t.__exportStar||function(r,s){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&n(s,r,i)};Object.defineProperty(t,"__esModule",{value:!0}),e(te(),t),e(q(),t)}}),ne=j(W()),ie=/(%?)(%([sdjo]))/g;function se(t,n){switch(n){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const e=JSON.stringify(t);return e==="{}"||e==="[]"||/^\[object .+?\]$/.test(e)?t:e}}}function y(t,...n){if(n.length===0)return t;let e=0,r=t.replace(ie,(s,i,o,a)=>{const d=n[e],l=se(d,a);return i?s:(e++,l)});return e<n.length&&(r+=` ${n.slice(e).join(" ")}`),r=r.replace(/%{2,2}/g,"%"),r}var oe=2;function ae(t){if(!t.stack)return;const n=t.stack.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-5_oIqttU.js"),$=require("./base-80a1f760-DvuNn8dj.js"),g=require("./consoleHook-59e792cb-CHjpVIPM.js");var V=Object.create,F=Object.defineProperty,z=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyNames,G=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty,Y=(t,n,e)=>n in t?F(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,P=(t,n)=>function(){return n||(0,t[U(t)[0]])((n={exports:{}}).exports,n),n.exports},K=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of U(n))!J.call(t,s)&&s!==e&&F(t,s,{get:()=>n[s],enumerable:!(r=z(n,s))||r.enumerable});return t},j=(t,n,e)=>(e=t!=null?V(G(t)):{},K(!t||!t.__esModule?F(e,"default",{value:t,enumerable:!0}):e,t)),X=(t,n,e)=>(Y(t,n+"",e),e),x=(t,n,e)=>{if(!n.has(t))throw TypeError("Cannot "+e)},_=(t,n,e)=>(x(t,n,"read from private field"),e?e.call(t):n.get(t)),M=(t,n,e)=>{if(n.has(t))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(t):n.set(t,e)},k=(t,n,e,r)=>(x(t,n,"write to private field"),n.set(t,e),e),E=(t,n,e)=>(x(t,n,"access private method"),e),B=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/pad.js"(t,n){n.exports=function(r,s){var i="000000000"+r;return i.substr(i.length-s)}}}),Q=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/fingerprint.browser.js"(t,n){var e=B(),r=typeof window=="object"?window:self,s=Object.keys(r).length,i=navigator.mimeTypes?navigator.mimeTypes.length:0,o=e((i+navigator.userAgent.length).toString(36)+s.toString(36),4);n.exports=function(){return o}}}),Z=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/getRandomValue.browser.js"(t,n){var e,r=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof self<"u"&&self.crypto;r?(s=Math.pow(2,32)-1,e=function(){return Math.abs(r.getRandomValues(new Uint32Array(1))[0]/s)}):e=Math.random;var s;n.exports=e}}),W=P({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/index.js"(t,n){var e=Q(),r=B(),s=Z(),i=0,o=4,a=36,d=Math.pow(a,o);function l(){return r((s()*d<<0).toString(a),o)}function f(){return i=i<d?i:0,i++,i-1}function m(){var v="c",w=new Date().getTime().toString(a),b=r(f().toString(a),o),c=e(),u=l()+l();return v+w+b+c+u}m.slug=function(){var w=new Date().getTime().toString(36),b=f().toString(36).slice(-4),c=e().slice(0,1)+e().slice(-1),u=l().slice(-2);return w.slice(-2)+b+c+u},m.isCuid=function(w){return typeof w!="string"?!1:!!w.startsWith("c")},m.isSlug=function(w){if(typeof w!="string")return!1;var b=w.length;return b>=7&&b<=10},m.fingerprint=e,n.exports=m}}),N=P({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/createDeferredExecutor.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createDeferredExecutor=void 0;function n(){const e=(r,s)=>{e.state="pending",e.resolve=i=>{if(e.state!=="pending")return;e.result=i;const o=a=>(e.state="fulfilled",a);return r(i instanceof Promise?i:Promise.resolve(i).then(o))},e.reject=i=>{if(e.state==="pending")return queueMicrotask(()=>{e.state="rejected"}),s(e.rejectionReason=i)}};return e}t.createDeferredExecutor=n}}),ee=P({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/DeferredPromise.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=void 0;var n=N(),e=class extends Promise{#e;resolve;reject;constructor(r=null){const s=(0,n.createDeferredExecutor)();super((i,o)=>{s(i,o),r?.(s.resolve,s.reject)}),this.#e=s,this.resolve=this.#e.resolve,this.reject=this.#e.reject}get state(){return this.#e.state}get rejectionReason(){return this.#e.rejectionReason}then(r,s){return this.#t(super.then(r,s))}catch(r){return this.#t(super.catch(r))}finally(r){return this.#t(super.finally(r))}#t(r){return Object.defineProperties(r,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})}};t.DeferredPromise=e}}),A=P({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/index.js"(t){var n=t&&t.__createBinding||(Object.create?function(r,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(r,o,a)}:function(r,s,i,o){o===void 0&&(o=i),r[o]=s[i]}),e=t&&t.__exportStar||function(r,s){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&n(s,r,i)};Object.defineProperty(t,"__esModule",{value:!0}),e(N(),t),e(ee(),t)}}),q=P({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/MemoryLeakError.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryLeakError=void 0;var n=class extends Error{emitter;type;count;constructor(e,r,s){super(`Possible EventEmitter memory leak detected. ${s} ${r.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=r,this.count=s,this.name="MaxListenersExceededWarning"}};t.MemoryLeakError=n}}),te=P({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/Emitter.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=void 0;var n=q(),e,r,s,i,o,a,d,l,f,m,v,w=class{constructor(){M(this,i),M(this,a),M(this,l),M(this,m),M(this,e,void 0),M(this,r,void 0),M(this,s,void 0),k(this,e,new Map),k(this,r,w.defaultMaxListeners),k(this,s,!1)}static listenerCount(c,u){return c.listenerCount(u)}setMaxListeners(c){return k(this,r,c),this}getMaxListeners(){return _(this,r)}eventNames(){return Array.from(_(this,e).keys())}emit(c,...u){const p=E(this,i,o).call(this,c);return p.forEach(I=>{I.apply(this,u)}),p.length>0}addListener(c,u){E(this,m,v).call(this,"newListener",c,u);const p=E(this,i,o).call(this,c).concat(u);if(_(this,e).set(c,p),_(this,r)>0&&this.listenerCount(c)>_(this,r)&&!_(this,s)){k(this,s,!0);const I=new n.MemoryLeakError(this,c,this.listenerCount(c));console.warn(I)}return this}on(c,u){return this.addListener(c,u)}once(c,u){return this.addListener(c,E(this,l,f).call(this,c,u))}prependListener(c,u){const p=E(this,i,o).call(this,c);if(p.length>0){const I=[u].concat(p);_(this,e).set(c,I)}else _(this,e).set(c,p.concat(u));return this}prependOnceListener(c,u){return this.prependListener(c,E(this,l,f).call(this,c,u))}removeListener(c,u){const p=E(this,i,o).call(this,c);return p.length>0&&(E(this,a,d).call(this,p,u),_(this,e).set(c,p),E(this,m,v).call(this,"removeListener",c,u)),this}off(c,u){return this.removeListener(c,u)}removeAllListeners(c){return c?_(this,e).delete(c):_(this,e).clear(),this}listeners(c){return Array.from(E(this,i,o).call(this,c))}listenerCount(c){return E(this,i,o).call(this,c).length}rawListeners(c){return this.listeners(c)}},b=w;e=new WeakMap,r=new WeakMap,s=new WeakMap,i=new WeakSet,o=function(c){return _(this,e).get(c)||[]},a=new WeakSet,d=function(c,u){const p=c.indexOf(u);return p>-1&&c.splice(p,1),[]},l=new WeakSet,f=function(c,u){const p=(...I)=>{this.removeListener(c,p),u.apply(this,I)};return p},m=new WeakSet,v=function(c,u,p){this.emit(c,u,p)},X(b,"defaultMaxListeners",10),t.Emitter=b}}),re=P({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/index.js"(t){var n=t&&t.__createBinding||(Object.create?function(r,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(r,o,a)}:function(r,s,i,o){o===void 0&&(o=i),r[o]=s[i]}),e=t&&t.__exportStar||function(r,s){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&n(s,r,i)};Object.defineProperty(t,"__esModule",{value:!0}),e(te(),t),e(q(),t)}}),ne=j(W()),ie=/(%?)(%([sdjo]))/g;function se(t,n){switch(n){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const e=JSON.stringify(t);return e==="{}"||e==="[]"||/^\[object .+?\]$/.test(e)?t:e}}}function y(t,...n){if(n.length===0)return t;let e=0,r=t.replace(ie,(s,i,o,a)=>{const d=n[e],l=se(d,a);return i?s:(e++,l)});return e<n.length&&(r+=` ${n.slice(e).join(" ")}`),r=r.replace(/%{2,2}/g,"%"),r}var oe=2;function ae(t){if(!t.stack)return;const n=t.stack.split(`
2
2
  `);n.splice(1,oe),t.stack=n.join(`
3
3
  `)}var ce=class extends Error{constructor(t,...n){super(t),this.message=t,this.name="Invariant Violation",this.message=y(t,...n),ae(this)}},S=(t,n,...e)=>{if(!t)throw new ce(n,...e)};S.as=(t,n,e,...r)=>{if(!n)throw t.prototype.name!=null?new t(y(e,r)):t(y(e,r))};var C=j(A()),de=window.localStorage.CSB_EMULATOR_DEBUG,le="\x1B[0m",ue="\x1B[32;1m",he="\x1B[31m",fe="\x1B[34m",pe="\x1B[33;1m",me="\x1B[35;1m",D="\x1B[36;1m",ve={preview:pe,emulator:me,runtime:D,bridge:fe,"runtime:worker":D};function H(t){return function(e,...r){if(de==="true"){const s=()=>e.includes("sender")?`${ue}sender`:e.includes("receiver")?`${he}receiver`:"",i=e.replace(/\[.+\]:/,"");console.debug(`${ve[t]}${t}:${s()}${le}:${i}`,...r)}}}var L=H("emulator"),we=class{constructor(t){this.target=t,this.emitter=new EventTarget,this.channel=new MessageChannel,this.receiverPort=this.channel.port1;const n=new C.DeferredPromise,e=r=>{r.data.type==="internal/ready"&&(L("[message-sender]: runtime is ready"),n.resolve())};window.addEventListener("message",e),n.then(()=>{window.removeEventListener("message",e)}),this.receiverReadyPromise=n,this.receiverPort.onmessage=r=>{const s=r.data;s.type!=null&&(L('[message-sender]: emitting "%s" event...',s.type,s.payload),this.emitter.dispatchEvent(new MessageEvent(s.type,{data:s.payload})))}}emitter;channel;receiverPort;receiverReadyPromise;async handshake(){const t=new C.DeferredPromise;await this.receiverReadyPromise,L("[message-sender]: sending handshake"),this.target.postMessage({type:"internal/handshake"},"*",[this.channel.port2]),this.on("internal/handshake/done",()=>{t.resolve(),clearTimeout(n)});const n=setTimeout(()=>{t.reject(new Error("MessageSender: Handshake timeout"))},5e3);return t}on(t,n,e){L('[message-sender]: add listener "%s"',t),this.emitter.addEventListener(t,r=>{r instanceof MessageEvent&&n(r)},e)}off(t,n,e){this.emitter.removeEventListener(t,n,e)}async send(t,...n){const e=new C.DeferredPromise,r=(0,ne.default)(),s=n[0]||{};L('[message-sender]: send "%s" (%s)',t,r,s),this.receiverPort.postMessage({type:t,payload:{operationId:r,payload:s}}),L('[message-sender]: adding done listener for "%s" (%s)',t,r);const i=a=>{const{data:d}=a;if(d.operationId===r){const l=d.listenerPayload||{};L('[message-sender]: resolving "%s (%s) promise!',t,r),e.resolve({...l,operationId:d.operationId})}},o=a=>{const{data:d}=a;d.operationId===r&&(L('[message-sender]: rejecting "%s (%s) promise!',t,r),e.reject(d.error))};return this.on("internal/operation/done",i),this.on("internal/operation/failed",o),e.finally(()=>{this.emitter.removeEventListener("internal/operation/done",i),this.emitter.removeEventListener("internal/operation/failed",o)})}},T=j(A()),ge=j(W()),ye=class{constructor(t){this.channel=t}async init(t){await this.channel.send("fs/init",{files:t})}async readFile(t,n){const e=await this.channel.send("fs/readFile",{path:t,encoding:n}).catch(r=>{throw new Error(y('Failed to read file at path "%s"',t),{cause:r})});if(!e)throw new Error("File not found");return e.data}async writeFile(t,n,e){let r,s=!1;typeof e=="object"?(r=e.encoding,s=!!e.recursive):typeof e=="string"&&(r=e),await this.channel.send("fs/writeFile",{path:t,content:n,encoding:r,recursive:s}).catch(i=>{throw new Error(y('Failed to write file at path "%s"',t),{cause:i})})}async readdir(t){const n=await this.channel.send("fs/readdir",{path:t}).catch(e=>{throw new Error(y('Failed to read directory at path "%s"',t),{cause:e})});if(!n)throw new Error("Directory not found");return n.data}async mkdir(t,n){const e=!!n?.recursive;await this.channel.send("fs/mkdir",{path:t,recursive:e}).catch(r=>{throw new Error(y('Failed to make directory at path "%s"',t),{cause:r})})}async stat(t){const n=await this.channel.send("fs/stat",{path:t}).catch(e=>{throw new Error(y('Failed to stat file at path "%s"',t),{cause:e})});if(!n)throw new Error("File not found");return n.data}async rm(t,n){const{force:e,recursive:r}=n||{};await this.channel.send("fs/rm",{path:t,force:e,recursive:r}).catch(s=>{throw new Error(y('Failed to remove file at path "%s"',t),{cause:s})})}async watch(t,n,e){const r=(0,ge.default)();return await this.channel.send("fs/watch",{watcherId:r,includes:t,excludes:n}),this.channel.on("fs/watch-event",({data:s})=>{if(s.watcherId===r&&e){const i={...s};delete i.watcherId,e(i)}}),{dispose:()=>this.channel.send("fs/unwatch",{watcherId:r})}}},R=j(re()),_e=class{constructor(t){this.channel=t}create(){return new Ee(this.channel)}},Ee=class{constructor(t){this.channel=t,this.state="running",this.stdout=new R.Emitter,this.stderr=new R.Emitter,this.stdin={write:n=>{if(!this.id)throw new Error("Failed to write to stdin, no process is currently running");return this.channel.send("shell/stdin",{data:n,workerId:this.id})}},this.forwardStdEvents()}id;state;stdout;stderr;stdin;forwardStdEvents(){this.channel.on("worker/tty",t=>{const{data:n}=t;if(n.workerId===this.id)switch(n.payload.type){case"out":{this.stdout.emit("data",n.payload.data);break}case"err":{this.stderr.emit("data",n.payload.data);break}}})}async runCommand(t,n,e={}){S(!this.id,'Failed to run "runCommand" on a ShellProcess: there is already a process running.');const r=await this.channel.send("shell/runCommand",{command:t,args:n,options:e});return S(r,'Failed to run "runCommand" on a ShellProcess: was not able to retrieve a running process.'),this.id=r.id,this.state="running",r}async on(t,n){switch(t){case"progress":{this.channel.on("worker/progress",({data:e})=>{n(e.status)});return}case"exit":{this.channel.on("worker/exit",({data:e})=>{e.workerId===this.id&&n(e.exitCode,e.error)});return}}}async kill(){S(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(t=>{throw new Error(y('Failed to kill shell with ID "%s"',this.id),{cause:t})}),this.id=void 0}},Pe=j(A()),be=2e4,Se=class{constructor(t){this.channel=t}async waitFor(t,n,e=be){const r=new Pe.DeferredPromise,s=setTimeout(()=>{r.reject()},e),i=await this.channel.send("preview/get/info",t).catch(a=>{r.reject(new Error(y('Failed to look up preview information for shell ID "%s" (port: %d)',t.sourceShellId,t.port)))}),o=i&&n(i);return o&&r.resolve({url:i.url,port:i.port,sourceShellId:i.sourceShellId}),this.channel.on("preview/port/ready",({data:a})=>{!o&&n(a)&&r.resolve({url:a.url,port:a.port,sourceShellId:a.sourceShellId})}),r.finally(()=>{clearTimeout(s)})}async getByShellId(t,n){return this.waitFor({sourceShellId:t},e=>e.sourceShellId===t,n).catch(e=>{throw new Error(y('Failed to get shell by ID "%s"',t),{cause:e})})}async waitForPort(t,n){return this.waitFor({port:t},e=>e.port===t,n).catch(e=>{throw new Error(y("Failed to await port %d",t),{cause:e})})}},Le="https://nodebox-runtime.codesandbox.io",O=H("emulator"),Ie=class{constructor(t){this.options=t,S(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||Le,this.isConnected=!1}channel=null;isConnected;url;fileSystemApi=null;shellApi=null;previewApi=null;async connect(){const{iframe:t,cdnUrl:n}=this.options;O("[message-sender]: Connecting to node emulator...");const e=new T.DeferredPromise;this.url||e.reject(new Error("Nodebox URL is missing. Did you forget to provide it when creating this Nodebox instance?")),S(t.contentWindow,"Failed to create a MessageChannel with the Nodebox iframe: no content window found"),this.channel=new we(t.contentWindow);const r=new T.DeferredPromise;return t.setAttribute("src",this.url),t.addEventListener("load",()=>{r.resolve()},{once:!0}),t.addEventListener("error",s=>{r.reject(s.error)},{once:!0}),await r,O("[message-sender]: IFrame loaded..."),await this.channel.handshake(),O("[message-sender]: Handshake completed..."),this.channel.send("connect",{cdnUrl:n}),this.channel.on("runtime/ready",()=>{e.resolve()}),e.then(()=>{O("[message-sender]: Connected to runtime..."),this.isConnected=!0})}get fs(){return S(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 ye(this.channel),this.fileSystemApi)}get shell(){return S(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 _e(this.channel),this.shellApi)}get preview(){return S(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 Se(this.channel),this.previewApi)}},Me="INJECT_AND_INVOKE",je="PREVIEW_LOADED";function ke(t,n){return h.__awaiter(this,void 0,void 0,function(){var e,r,s,i,o;return h.__generator(this,function(a){return e=t.contentWindow,h.nullthrows(e,"Failed to await preview iframe: no content window found"),r=9e4,s=20,i=0,[2,new Promise(function(d,l){var f=function(){var m=function(){clearTimeout(o),i=s,d(),t.removeEventListener("load",m)};if(i>=s){l(h.createError("Could not able to connect to preview."));return}t.setAttribute("src",n),o=setTimeout(function(){f(),t.removeEventListener("load",m)},r),i=i+1,t.addEventListener("load",m)};t.addEventListener("error",function(){return l(new Error("Iframe error"))}),t.addEventListener("abort",function(){return l(new Error("Aborted"))}),f()})]})})}var Oe=function(t,n){t.style.border="0",t.style.width=n.width||"100%",t.style.height=n.height||"100%",t.style.overflow="hidden",t.allow="cross-origin-isolated"};function Ce(t){var n=t.scope,e=window.history.__proto__,r=[],s=0,i=function(d){parent.postMessage({type:"urlchange",url:d,back:s>0,forward:s<r.length-1,channelId:n.channelId},"*")};function o(d,l){r.splice(s+1),r.push({url:d,state:l}),s=r.length-1}Object.assign(window.history,{go:function(d){var l=s+d;if(l>=0&&l<=r.length-1){s=l;var f=r[s],m=f.url,v=f.state;e.replaceState.call(window.history,v,"",m);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(d,l,f){e.replaceState.call(window.history,d,l,f),o(f,d),i(document.location.href)},replaceState:function(d,l,f){e.replaceState.call(window.history,d,l,f),r[s]={state:d,url:f},i(document.location.href)}});function a(d){var l=d.data;l.type==="urlback"?history.back():l.type==="urlforward"?history.forward():l.type==="refresh"&&document.location.reload()}window.addEventListener("message",a)}function Fe(t){var n=t.scope,e=0;function r(){if(typeof window>"u")return 0;var a=document.body,d=document.documentElement;return Math.max(a.scrollHeight,a.offsetHeight,d.offsetHeight)}function s(){var a=r();e!==a&&window.parent.postMessage({type:"resize",height:a,codesandbox:!0,channelId:n.channelId},"*"),e=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 xe=[{code:Ce.toString(),id:"historyListener"},{code:"function consoleHook({ scope }) {"+g.consoleHook+`
4
4
  };`,id:"consoleHook"},{code:Fe.toString(),id:"watchResize"}],Ae=function(t,n){xe.forEach(function(e){var r,s=e.code,i=e.id,o={uid:i,type:Me,code:"exports.activate = ".concat(s),scope:{channelId:n}};(r=t.contentWindow)===null||r===void 0||r.postMessage(o,"*")})},De=(function(t){h.__extends(n,t);function n(e,r,s){s===void 0&&(s={});var i=t.call(this,e,r,h.__assign(h.__assign({},s),{bundlerURL:s.bundlerURL}))||this;return i._modulesCache=new Map,i.messageChannelId=g.generateRandomId(),i._initPromise=null,i.emitter=new g.EventEmitter,i.manageIframes(e),i.emulator=new Ie({iframe:i.emulatorIframe,runtimeUrl:i.options.bundlerURL}),i.updateSandbox(r),i}return n.prototype._init=function(e){return h.__awaiter(this,void 0,void 0,function(){return h.__generator(this,function(r){switch(r.label){case 0:return[4,this.emulator.connect()];case 1:return r.sent(),[4,this.emulator.fs.init(e)];case 2:return r.sent(),[4,this.globalListeners()];case 3:return r.sent(),[2]}})})},n.prototype.compile=function(e){return h.__awaiter(this,void 0,void 0,function(){var r,s;return h.__generator(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(e)),[4,this._initPromise];case 1:return i.sent(),this.dispatch({type:"connected"}),[4,this.createShellProcessFromTask(e)];case 2:return r=i.sent().id,[4,this.createPreviewURLFromId(r)];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.getMessageFromError(s)}),this.dispatch({type:"done",compilatonError:!0}),[3,6];case 6:return[2]}})})},n.prototype.createShellProcessFromTask=function(e){return h.__awaiter(this,void 0,void 0,function(){var r,s,i=this;return h.__generator(this,function(o){switch(o.label){case 0:return r=g.readBuffer(e["/package.json"]),this.emulatorCommand=g.findStartScriptPackageJson(r),this.emulatorShellProcess=this.emulator.shell.create(),[4,this.emulatorShellProcess.on("exit",function(a){i.dispatch({type:"action",action:"notification",notificationType:"error",title:h.createError("Error: process.exit(".concat(a,") called."))})})];case 1:return o.sent(),[4,this.emulatorShellProcess.on("progress",function(a){var d,l;if(a.state==="command_running"||a.state==="starting_command"){i.dispatch({type:"shell/progress",data:h.__assign(h.__assign({},a),{command:[(d=i.emulatorCommand)===null||d===void 0?void 0:d[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()]}})})},n.prototype.createPreviewURLFromId=function(e){var r;return h.__awaiter(this,void 0,void 0,function(){var s;return h.__generator(this,function(i){switch(i.label){case 0:return this.iframePreviewUrl=void 0,[4,this.emulator.preview.getByShellId(e)];case 1:return s=i.sent().url,this.iframePreviewUrl=s+((r=this.options.startRoute)!==null&&r!==void 0?r:""),[2]}})})},n.prototype.manageIframes=function(e){var r;if(typeof e=="string"){var s=document.querySelector(e);h.nullthrows(s,"The element '".concat(e,"' was not found")),this.iframe=document.createElement("iframe"),s?.appendChild(this.iframe)}else this.iframe=e;Oe(this.iframe,this.options),h.nullthrows(this.iframe.parentNode,"The given iframe does not have a parent."),this.emulatorIframe=document.createElement("iframe"),this.emulatorIframe.classList.add("sp-bridge-frame"),(r=this.iframe.parentNode)===null||r===void 0||r.appendChild(this.emulatorIframe)},n.prototype.setLocationURLIntoIFrame=function(){return h.__awaiter(this,void 0,void 0,function(){return h.__generator(this,function(e){switch(e.label){case 0:return this.iframePreviewUrl?[4,ke(this.iframe,this.iframePreviewUrl)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},n.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})},n.prototype.globalListeners=function(){return h.__awaiter(this,void 0,void 0,function(){var e=this;return h.__generator(this,function(r){switch(r.label){case 0:return window.addEventListener("message",function(s){s.data.type===je&&Ae(e.iframe,e.messageChannelId),s.data.type==="urlchange"&&s.data.channelId===e.messageChannelId?e.dispatch({type:"urlchange",url:s.data.url,back:s.data.back,forward:s.data.forward}):s.data.channelId===e.messageChannelId&&e.dispatch(s.data)}),[4,this.emulator.fs.watch(["*"],[".next","node_modules","build","dist","vendor",".config",".vuepress"],function(s){return h.__awaiter(e,void 0,void 0,function(){var i,o,a,d,l,f,m;return h.__generator(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]),d=i.type,d){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,g.writeBuffer(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 f=v.sent(),this.dispatch({type:"fs/change",path:i.newPath,content:f}),this._modulesCache.set(i.newPath,g.writeBuffer(f)),[3,9];case 8:return[3,9];case 9:return[3,11];case 10:return m=v.sent(),this.dispatch({type:"action",action:"notification",notificationType:"error",title:g.getMessageFromError(m)}),[3,11];case 11:return[2]}})})})];case 1:return r.sent(),[2]}})})},n.prototype.restartShellProcess=function(){var e;return h.__awaiter(this,void 0,void 0,function(){return h.__generator(this,function(r){switch(r.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 r.sent(),(e=this.iframe)===null||e===void 0||e.removeAttribute("attr"),this.emulator.fs.rm("/node_modules/.vite",{recursive:!0,force:!0}),[4,this.compile(Object.fromEntries(this._modulesCache))];case 2:r.sent(),r.label=3;case 3:return[2]}})})},n.prototype.updateSandbox=function(e){var r=this,s,i=g.fromBundlerFilesToFS(e.files);if(((s=this.emulatorShellProcess)===null||s===void 0?void 0:s.state)==="running"){Object.entries(i).forEach(function(o){var a=o[0],d=o[1];(!r._modulesCache.get(a)||g.readBuffer(d)!==g.readBuffer(r._modulesCache.get(a)))&&r.emulator.fs.writeFile(a,d,{recursive:!0})});return}this.dispatch({codesandbox:!0,modules:i,template:e.template,type:"compile"}),Object.entries(i).forEach(function(o){var a=o[0],d=o[1];r._modulesCache.set(a,g.writeBuffer(d))})},n.prototype.dispatch=function(e){var r,s;return h.__awaiter(this,void 0,void 0,function(){var i;return h.__generator(this,function(o){switch(o.label){case 0:switch(i=e.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(e.modules),[3,8];case 2:return[4,this.setLocationURLIntoIFrame()];case 3:return o.sent(),[3,8];case 4:return(s=(r=this.iframe)===null||r===void 0?void 0:r.contentWindow)===null||s===void 0||s.postMessage(e,"*"),[3,8];case 5:return this.restartShellProcess(),[3,8];case 6:return window.open(this.iframePreviewUrl,"_blank"),[3,8];case 7:this.emitter.dispatch(e),o.label=8;case 8:return[2]}})})},n.prototype.listen=function(e){return this.emitter.listener(e)},n.prototype.destroy=function(){this.emulatorIframe.remove(),this.emitter.cleanup()},n})($.SandpackClient);exports.SandpackNode=De;
@@ -1,5 +1,5 @@
1
- import { g as C, _ as E, a as z, b as q, e as M, c as x, f as W, d as D, S as P, h as N, n as F, j as g, k as A } from "./index-DubmFJaq.mjs";
2
- import { S as $ } from "./base-80a1f760-BUp2JSxY.mjs";
1
+ import { g as C, _ as E, a as z, b as q, e as M, c as x, f as W, d as D, S as P, h as N, n as F, j as g, k as A } from "./index-XUF80T81.mjs";
2
+ import { S as $ } from "./base-80a1f760-8cUWWPNm.mjs";
3
3
  const B = {
4
4
  "application/1d-interleaved-parityfec": { source: "iana" },
5
5
  "application/3gpdash-qoe-report+xml": { source: "iana", charset: "UTF-8", compressible: !0 },