@johnnycubides/catalejo-vue3-desktop-v2 0.4.1 → 0.4.2
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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* empty css */import{s as Ce,a as tt,b as ot,u as Le,c as Fe,d as xe,e as fe,f as V,g as ye,h as Ie,i as Ee,j as at,k as nt,l as lt,P as st,T as it,D as rt}from"./primevue-BmCb0h8-.js";import{d as S,r as s,w as F,g as Te,Q as h,f as k,o as U,q as I,t as p,x as j,C as g,B as Y,F as z,E as ne,e as ct,n as ut,i as se,R as dt,j as pt,I as ft,z as ue,K as de,S as vt}from"./@vue-zv1stXxC.js";import{S as mt,l as gt,p as ht,s as bt}from"./codemirror-OB90vtSj.js";import{b as X,E as Ne,B as yt,p as Et,l as _t}from"./blockly-BA4rjO3i.js";import{defaultPaths as xt,plugins as wt}from"../plugins/plugins.js";import"./@lezer-D9M01xfV.js";import"./crelt-C8TCjufn.js";import"./style-mod-Bc2inJdb.js";import"./w3c-keyname-Vcq4gwWv.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function t(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(n){if(n.ep)return;n.ep=!0;const i=t(n);fetch(n.href,i)}})();const ve="py lua json ck",Se="py lua ck",Be="json",Dt={py:"Python",lua:"Lua",ck:"Chuck",json:"JSON",txt:"Text plain"},Re={name:"Python",extension:"py"},Ve={name:"Lua",extension:"lua"};var r=(e=>(e[e.OK=0]="OK",e[e.FAILED=1]="FAILED",e[e.CHANGE=2]="CHANGE",e[e.WITHOUTCHANGE=3]="WITHOUTCHANGE",e[e.REQUEST=4]="REQUEST",e[e.REQUEST_SELECT_FILE_IN_TABVIEW=5]="REQUEST_SELECT_FILE_IN_TABVIEW",e[e.EXISTS=6]="EXISTS",e[e.NOEXIST=7]="NOEXIST",e[e.FOUND=8]="FOUND",e[e.NOTFOUND=9]="NOTFOUND",e[e.ADDED=10]="ADDED",e[e.SAVED=11]="SAVED",e[e.UNSAVED=12]="UNSAVED",e[e.SET_WS=13]="SET_WS",e[e.ENABLED=14]="ENABLED",e[e.DESABLED=15]="DESABLED",e))(r||{}),ae=(e=>(e[e.TOAST=0]="TOAST",e[e.TEXT_PRINT=1]="TEXT_PRINT",e[e.TEXT_AREA=2]="TEXT_AREA",e[e.URL_PRINT=3]="URL_PRINT",e[e.TERM=4]="TERM",e))(ae||{}),le=(e=>(e[e.YES_OR_NO_QUESTION=0]="YES_OR_NO_QUESTION",e[e.UPLOADFILE=1]="UPLOADFILE",e))(le||{}),R=(e=>(e[e.WELCOME=0]="WELCOME",e[e.CODEMIRROR=1]="CODEMIRROR",e[e.BLOCKLY=2]="BLOCKLY",e[e.FREE=3]="FREE",e))(R||{}),Q=(e=>(e[e.EN=0]="EN",e[e.ES=1]="ES",e))(Q||{}),T=(e=>(e[e.UNIX=0]="UNIX",e[e.WINDOWS=1]="WINDOWS",e[e.LINUX=2]="LINUX",e[e.MACOS=3]="MACOS",e[e.UNKNOW=4]="UNKNOW",e))(T||{}),_e=(e=>(e[e.WEBSOCKET=0]="WEBSOCKET",e[e.TCP_IP=1]="TCP_IP",e[e.SERIAL=2]="SERIAL",e))(_e||{}),Z=(e=>(e[e.RELATIVE=0]="RELATIVE",e[e.ABSOLUTE=1]="ABSOLUTE",e[e.UNKNOW=2]="UNKNOW",e))(Z||{});function Ot(e){switch(e){case Re.extension:return ht();case Ve.extension:return mt.define(gt);default:return}}const kt=S({__name:"TextEditor",props:["projects","index","update","activate","workspace"],emits:["content-cursor-index"],setup(e,{emit:o}){const t=e,a=o,n=s(""),i=s(),l=s();return F(()=>[t.index,t.update],async()=>{t.projects.length>0&&t.workspace==R.CODEMIRROR&&(l.value.setCursor(0),i.value=Ot(t.projects[t.index].extension),n.value=t.projects[t.index].content)}),F(n,y=>{a("content-cursor-index",y,l.value.getCursor(),t.index)}),(y,u)=>(k(),Te(h(bt),{ref_key:"cm",ref:l,modelValue:n.value,"onUpdate:modelValue":u[0]||(u[0]=v=>n.value=v),basic:"","tab-size":2,dark:!1,gutter:!0,tab:!0,lang:i.value},null,8,["modelValue","lang"]))}});function Ue(e,o){for(let t=0;t<e.length;t++)if(e[t]==o)return{status:r.FOUND,data:t};return{status:r.NOTFOUND}}function we(e){const o=/^[a-zA-Z]:\\/,t=/^\//,a=/^[^\/\\:*?"<>|]+(?:\\|\/|$)/,n=/^[^\/]+(?:\/|$)/;return o.test(e)?{so:T.WINDOWS,pathType:Z.ABSOLUTE}:t.test(e)?{so:T.UNIX,pathType:Z.ABSOLUTE}:n.test(e)?{so:T.UNIX,pathType:Z.RELATIVE}:a.test(e)?{so:T.WINDOWS,pathType:Z.RELATIVE}:{so:T.UNKNOW,pathType:Z.UNKNOW}}function Ct(e){const o=we(e);if(o.so==T.UNIX){const t=e.split("/").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else if(o.so==T.WINDOWS){const t=e.split("\\").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else return{path:"",filename:"",extension:""}}function It(e){return ve.includes(e)?"pi pi-file-edit":""}function Nt(e){let o=[];for(let t=0;t<e.length;t++){const a=Ct(e[t]);o.push({key:String(t),label:a.filename,leaf:!0,icon:a.extension!=""?It(a.extension):"",data:a.path,extension:a.extension})}return o}function Pt(e){const o=we(e);if(o.so==T.UNIX){const t=e.split("/").pop();return(e.includes(".")?e.split(".").pop():"")!=""?{status:r.FAILED}:{status:r.OK,data:{path:e,dirname:t||"noname"}}}else if(o.so==T.WINDOWS){const t=e.split("\\").pop();return(e.includes(".")?e.split(".").pop():"")!=""?{status:r.FAILED}:{status:r.OK,data:{path:e,dirname:t||"noname"}}}else return{status:r.FAILED}}function jt(e){let o=[];for(let t=0;t<e.length;t++){const a=Pt(e[t]);a.status==r.OK&&o.push({key:String(t),label:a.data.dirname,leaf:!0,icon:"pi pi-folder",data:a.data.path})}return o}const ie="http://"+location.hostname,re="8080",ce="cors";async function $e(e,o){try{const a=await(await fetch(e,o)).json();return a.status==r.OK,a}catch(t){return console.error(t),{status:r.FAILED}}}async function Lt(e){const t=ie+":"+re+"/"+"fs/dirconfig",a={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:e})};try{const i=await(await fetch(t,a)).json();return i.status==r.OK?i:{status:r.FAILED}}catch(n){return console.error(n),{status:r.FAILED}}}async function Ft(e){const t=ie+":"+re+"/"+"fs/readFile",a={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e})};try{const i=await(await fetch(t,a)).json();if(i.status==r.OK)return i}catch(n){return console.error(n),{status:-1}}}async function Tt(e,o){const a=ie+":"+re+"/"+"fs/writeFile",n={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,content:o})};try{const l=await(await fetch(a,n)).json();return l.status==r.OK?l:{status:r.FAILED}}catch(i){return console.error(i),{status:r.FAILED}}}async function St(e){const t=ie+":"+re+"/"+"fs/deleteFile",a={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})};return await $e(t,a)}async function Bt(e){const t=ie+":"+re+"/"+"fs/uploadFile";return await $e(t,{method:"POST",mode:ce,headers:{},body:e})}const Pe={dirTitle:{en:"Directories:",es:"Directorios:"},fileTitle:{en:"Files:",es:"Archivos:"}},pe={menu:{en:"",es:""},save:{en:"Save",es:"Guardar"},close:{en:"Close",es:"cerrar"},config:{en:"Config",es:"Configurar"}},P={save:{en:"Save",es:"Guardar"},close:{en:"Close",es:"cerrar"},file:{en:"File",es:"Archivo"},opendir:{en:"Open dir",es:"Abrir directorio"},selectDirPath:{header:{en:"Put dir path.",es:"Poner ruta de directorio"}},newProject:{en:"New project",es:"Nuevo proyecto"},delete:{en:"Delete file",es:"Borrar archivo"},fileUpload:{en:"Upload files",es:"Subir archivos"},dialogDeleteFile:{title:{en:"Delete file?",es:"¿Borrar archivo?"},content:{en:"Do you want delete the file: ",es:"Quiere borrar el archivo: "}},dialogNewProject:{header:{en:"New project",es:"Nuevo proyecto"},labelInput:{en:"1. Insert a file name for project, the extension file will created atomatically.",es:"1. Agregar un nombre de archivo para el proyecto, la extensión será creada automáticamente."},labelDirPath:{en:"The project file will created in the path: ",es:"El proyecto será creado en el path: "},labelSelectPlatform:{en:"2. Select a platform compatible with editor: ",es:"2. Seleccionar una plataforma compatible con el editor: "},labelSelectProjectType:{en:"3. Select project type to create.",es:"3. Selecciona el tipo de proyecto a crear."}},dialogButtonYesNo:{ok:{en:"Yes",es:"Sí"},close:{en:"Cancel",es:"Cancelar"}},dialogButton:{ok:{en:"Ok",es:"Ok"},close:{en:"Close",es:"Cerrar"}}},K={savefile:{ok:{en:"File save",es:"Archivo guardado"},error:{en:"Don't save file",es:"No se guardó el archivo"}},deleteFile:{ok:{en:"The file has been deleted",es:"El archivo ha sido eliminado"},error:{en:"The file was not deleted",es:"El archivo no fue borrado"}},titleConfigProjectDialog:{en:"Config project",es:"Configuar proyecto"},dialogButton:{ok:{en:"Ok",es:"Ok"},close:{en:"Close",es:"Cerrar"}},toastProccess:{en:"In process",es:"En proceso"},toastUpdateContentDir:{en:"Updated files in editor from directory: ",es:"Archivos actualizados en el editor desde directorio: "}},Rt={scrollableTabsDefault:{en:"Projects loaded in workspace",es:"Proyectos cargados en el área de trabajo"}};function b(e,o){return o==Q.EN?e.en:o==Q.ES?e.es:"noname"}const Vt={class:"card flex justify-content-center"},Ut={for:"mask",class:"font-bold block mb-2"},$t={for:"mask",class:"font-bold block mb-2"},Wt=S({__name:"TreeView",props:["dirPaths","dirPathsLength","filePaths","lang"],emits:["dir-path-selected","file-selected"],setup(e,{emit:o}){const t=e,a=o,n=s(),i=s(),l=s(""),y=s("");U(()=>{l.value=b(Pe.dirTitle,t.lang),y.value=b(Pe.fileTitle,t.lang)});const u=f=>{console.log(f.data),a("dir-path-selected",f.data)},v=f=>{console.log(f.data),a("file-selected",f.data)};return F(()=>t.dirPathsLength,()=>{i.value=jt(t.dirPaths)}),F(()=>t.filePaths,async f=>{n.value=Nt(f)}),(f,x)=>(k(),I("div",Vt,[p("label",Ut,j(l.value),1),g(h(Ce),{value:i.value,selectionMode:"single",onNodeSelect:u,class:"w-full md:w-30rem"},null,8,["value"]),p("label",$t,j(y.value),1),g(h(Ce),{value:n.value,selectionMode:"single",onNodeSelect:v,class:"w-full md:w-30rem"},null,8,["value"])]))}}),ee=(e,o)=>{const t=e.__vccOpts||e;for(const[a,n]of o)t[a]=n;return t},At=ee(Wt,[["__scopeId","data-v-7d510def"]]);function Kt(e){let o=[];for(let t=0;t<e.length;t++)o.push({title:e[t].filename,indexOfProject:t});return o}const Xt={id:"divTabview",class:"card"},Mt=S({__name:"TabViewEditor",props:["index","update","projects","contentchanges","lang"],emits:["index-of-project-to-load"],setup(e,{emit:o}){const t=o,a=e,n=s([]),i=s(0),l=u=>a.projects.length>0?Kt(a.projects):[{title:b(Rt.scrollableTabsDefault,u),indexOfProject:-1}];F(()=>[a.index,a.update],([u])=>{n.value=l(a.lang),a.projects.length>0?i.value=u:i.value=0}),F(()=>a.lang,u=>{n.value=l(u)}),U(()=>{n.value=l(a.lang)});const y=u=>{t("index-of-project-to-load",u.index)};return(u,v)=>(k(),I("div",Xt,[g(h(tt),{scrollable:!0,onTabClick:y,activeIndex:i.value,"onUpdate:activeIndex":v[0]||(v[0]=f=>i.value=f)},{default:Y(()=>[(k(!0),I(z,null,ne(n.value,f=>(k(),Te(h(ot),{key:f.title,header:f.title},null,8,["header"]))),128))]),_:1},8,["activeIndex"])]))}}),qt=ee(Mt,[["__scopeId","data-v-8ef45e55"]]),Ht={class:"card"},zt={class:"flex align-items-center"},Qt=["for"],Jt={class:"flex align-items-center"},Gt=["for"],Zt=S({__name:"MenubarCommon",props:{lang:{},workDirPath:{},filePathSelected:{},plugins:{}},emits:["dirconfig-update","save-project-request","dir-path-selected","new-project-request","run-app-function-with-dialog-request"],setup(e,{emit:o}){Le(),s("Soltar aquí el directorio de trabajo");const t=e,a=s(!1),n=s(""),i=s(""),l=s(!1),y=s(""),u=s(""),v=s(""),f=s(""),x=s(""),E=s(""),w=s(""),N=s(""),C=s(""),L=o,W=s([]),$=m=>{W.value=[{label:b(P.file,m),icon:"pi pi-file",items:[{label:b(P.newProject,m),icon:"pi pi-file-plus",command:()=>{v.value="",q(t.lang),l.value=!0}},{label:b(P.opendir,m),icon:"pi pi-folder-open",command:()=>{i.value="",a.value=!0}},{label:b(P.save,m),icon:"pi pi-save",command:()=>{L("save-project-request")}},{label:b(P.delete,m),icon:"pi pi-eraser",command:()=>{const _={typeDialog:le.YES_OR_NO_QUESTION,data:{title:b(P.dialogDeleteFile.title,m),content:b(P.dialogDeleteFile.content,m)+t.filePathSelected,emit:"delete-file-request",args:{filePath:t.filePathSelected},okLabel:b(P.dialogButtonYesNo.ok,m),cancelLabel:b(P.dialogButtonYesNo.close,m)}};L("run-app-function-with-dialog-request",_)}},{label:b(P.fileUpload,m),icon:"pi pi-file-arrow-up",command:()=>{const _={title:"Subir archivos",content:"nn",emit:"upload-file",args:{}},D={typeDialog:le.UPLOADFILE,data:_};L("run-app-function-with-dialog-request",D)}}]}]},M=()=>{a.value=!1,L("dir-path-selected",i.value)};F(v,m=>{m.split(".").pop()&&m.split(".").pop()});const A=m=>{n.value=b(P.selectDirPath.header,m)},q=m=>{y.value=b(P.dialogNewProject.header,m),u.value=b(P.dialogNewProject.labelInput,m)+" (."+ve.replace(/ /g,", .")+"):",f.value=b(P.dialogNewProject.labelDirPath,m)+'"'+t.workDirPath+'".',x.value=b(P.dialogNewProject.labelSelectPlatform,m),E.value=b(P.dialogNewProject.labelSelectProjectType,m)},B=m=>{w.value=b(P.dialogButton.ok,m),N.value=b(P.dialogButton.close,m)},H=m=>{A(m),q(m),B(m)},ge=()=>{let m="",_="";te.value=="Blockly"?(m=t.plugins[C.value].blockly_template,_=".json"):(m=t.plugins[C.value].lang_template,_="."+t.plugins[C.value].platformLang.extension);const D=t.workDirPath+"/"+v.value+_;L("new-project-request",D,m),l.value=!1};F(()=>t.lang,m=>{H(m),$(m)});const J=s([]),te=s("");return F(C,()=>{J.value=[];const m=t.plugins[C.value].platformLang.extension,_=Dt[m];J.value.push(_),t.plugins[C.value].blockly_template!=null&&J.value.push("Blockly")}),U(()=>{H(t.lang),$(t.lang)}),(m,_)=>(k(),I("div",Ht,[g(h(Fe),{model:W.value},null,8,["model"]),g(h(xe)),g(h(ye),{visible:a.value,"onUpdate:visible":_[2]||(_[2]=D=>a.value=D),modal:"",header:n.value,style:{width:"25rem"}},{default:Y(()=>[p("div",null,[g(h(fe),{type:"text",modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=D=>i.value=D)},null,8,["modelValue"])]),p("div",null,[g(h(V),{type:"button",label:N.value,severity:"secondary",onClick:_[1]||(_[1]=D=>a.value=!1)},null,8,["label"]),g(h(V),{type:"button",label:w.value,onClick:M},null,8,["label"])])]),_:1},8,["visible","header"]),g(h(ye),{visible:l.value,"onUpdate:visible":_[7]||(_[7]=D=>l.value=D),modal:"",header:y.value,style:{width:"35rem"}},{default:Y(()=>[p("div",null,[p("p",null,j(u.value),1),g(h(fe),{type:"text",modelValue:v.value,"onUpdate:modelValue":_[3]||(_[3]=D=>v.value=D)},null,8,["modelValue"]),p("p",null,j(f.value),1),p("p",null,j(x.value),1)]),(k(!0),I(z,null,ne(t.plugins,D=>(k(),I("div",zt,[g(h(Ie),{modelValue:C.value,"onUpdate:modelValue":_[4]||(_[4]=oe=>C.value=oe),inputId:D.platform,name:"dynamic",value:D.platform},null,8,["modelValue","inputId","value"]),p("label",{for:D.platform,class:"ml-2"},j(D.platform),9,Qt)]))),256)),p("div",null,[p("p",null,j(E.value),1)]),(k(!0),I(z,null,ne(J.value,D=>(k(),I("div",Jt,[g(h(Ie),{modelValue:te.value,"onUpdate:modelValue":_[5]||(_[5]=oe=>te.value=oe),inputId:D,name:"dynamic",value:D},null,8,["modelValue","inputId","value"]),p("label",{for:D,class:"ml-2"},j(D),9,Gt)]))),256)),p("div",null,[g(h(V),{type:"button",label:N.value,severity:"secondary",onClick:_[6]||(_[6]=D=>l.value=!1)},null,8,["label"]),g(h(V),{type:"button",label:w.value,onClick:ge},null,8,["label"])])]),_:1},8,["visible","header"])]))}}),Yt=ee(Zt,[["__scopeId","data-v-d8d9c184"]]),eo=`
|
|
2
|
+
|
|
3
|
+
<xml id="toolbox" style="display: none">
|
|
4
|
+
<category name="Lógica" colour="%{BKY_LOGIC_HUE}">
|
|
5
|
+
<block type="controls_if"></block>
|
|
6
|
+
</category>
|
|
7
|
+
<category name="Secuencias" colour="%{BKY_LOOPS_HUE}">
|
|
8
|
+
<block type="controls_repeat_ext">
|
|
9
|
+
<value name="TIMES">
|
|
10
|
+
<shadow type="math_number">
|
|
11
|
+
<field name="NUM">10</field>
|
|
12
|
+
</shadow>
|
|
13
|
+
</value>
|
|
14
|
+
</block>
|
|
15
|
+
</category>
|
|
16
|
+
</xml>`;function to(){const e=window.innerWidth,o=window.innerHeight;return e<o}const oo={media:"media/",renderer:"geras",toolboxPosition:"start",horizontalLayout:to(),zoom:{controls:!0,wheel:!0,startScale:1,maxScale:3,minScale:.3,scaleSpeed:1.2,pinch:!0},trashcan:!0,grid:{spacing:25,length:1,colour:"#ccc",snap:!0},toolbox:eo};function ao(e){return X.inject(e.value,oo)}function no(e,o){const t=X.utils.xml.textToDom(e);try{return X.Xml.clearWorkspaceAndLoadFromXml(t,o),{status:r.OK}}catch{return{status:r.FAILED}}}function lo(e){e==Q.ES?X.setLocale(Ne):X.setLocale(Ne)}function so(e){switch(e.platformLang.name){case Ve.name:return _t.luaGenerator;case Re.name:return Et.pythonGenerator;default:return}}let je=[];function io(e,o){Ue(je,e.platform).status==r.NOTFOUND&&(e.initBlockly(yt,so(e),o),je.push(e.platform))}const ro={class:"div_blockly"},co=S({__name:"BlocklyEditor",props:["projects","index","update","workspace","plugin"],emits:["xmltext-index","blockly-mounted"],setup(e,{emit:o}){const t=e,a=o,n=s(),i=s();let l;const y=[X.Events.SELECTED],u=v=>{for(const f in y)if(v.type===y[f]){const x=X.Xml.workspaceToDom(l),E=X.Xml.domToPrettyText(x);a("xmltext-index",E,t.index)}};return U(async()=>{l=ao(n),lo(0),l.addChangeListener(u),a("blockly-mounted")}),F(()=>[t.index,t.update],async([v])=>{if(t.projects.length>0&&t.workspace==R.BLOCKLY){await ut();const f=t.projects[v].config.platform;f!=null&&f!=""&&(io(t.plugin,l),l.updateToolbox(t.plugin.toolbox)),no(t.projects[v].blocklycode,l),X.svgResize(l),l.scrollCenter()}}),(v,f)=>(k(),I("div",ro,[p("div",{class:"blocklyDivClass",id:"blocklyDiv",ref_key:"blocklyDivRef",ref:n},null,512),p("xml",{style:{display:"none"},ref_key:"blocklyToolbox",ref:i},[ct(v.$slots,"default")],512)]))}}),uo={class:"card"},po=S({__name:"ToolBar",props:["lang","plugin"],emits:["menu-toggle","save-project-request","close-project","config-project","plugin-command"],setup(e,{emit:o}){const t=e,a=o,n=s([]),i=s(Q.EN),l=[{label:b(pe.menu,t.lang),icon:"pi pi-arrow-right-arrow-left",command:()=>{a("menu-toggle")}},{label:b(pe.save,t.lang),icon:"pi pi-save",command:()=>{a("save-project-request")}},{label:b(pe.close,t.lang),icon:"pi pi-times",command:()=>{a("close-project")}},{label:b(pe.config,t.lang),icon:"pi pi-cog",command:()=>{a("config-project")}}];function y(v){for(let f=0;f<v.length;f++)if(Array.isArray(v[f].items))y(v[f].items);else{const x=v[f].command;v[f].command=function(){a("plugin-command",x)}}return v}const u=v=>{if(v!=null){let f=v.getItemsToolBarOfPlugin(t.lang);f!=null&&f.length>0?(f=y(f),n.value=[...l,...f]):n.value=l}else n.value=l};return F(()=>t.plugin,v=>{u(v)}),F(()=>t.lang,()=>{i.value=t.lang}),U(()=>{n.value=l}),(v,f)=>(k(),I("div",uo,[g(h(Fe),{model:n.value},null,8,["model"]),g(h(xe))]))}}),fo={class:"container"},vo=S({__name:"TextareaDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),n=s("");return U(()=>{t=o.value.data,a.value=t.description,n.value=t.content}),(i,l)=>(k(),I("div",fo,[p("p",null,j(a.value),1),g(h(Ee),{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=y=>n.value=y),autoResize:""},null,8,["modelValue"])]))}}),mo=ee(vo,[["__scopeId","data-v-e2622354"]]),go=["href"],ho=S({__name:"UrlprintDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),n=s("");return U(()=>{t=o.value.data,a.value=t.description,n.value=t.content}),(i,l)=>(k(),I(z,null,[p("p",null,j(a.value),1),p("a",{href:n.value,target:" _blank"},j(n.value),9,go)],64))}}),bo={class:"p-fluid p-formgrid p-grid"},yo={class:"p-col-12"},Eo={class:"p-col-12"},_o={class:"p-col-12"},xo={class:"p-col-12"},wo={key:0},Do=S({__name:"TerminalDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),n=s(""),i=s([]),l=s(null),y=s(!1);U(()=>{var E,w,N,C,L;if(t=o.value.data,t.typeConnection==_e.WEBSOCKET){const W=(E=t.data)==null?void 0:E.ip,$=(w=t.data)==null?void 0:w.port,M=(N=t.data)==null?void 0:N.user,A=(C=t.data)==null?void 0:C.password,q=(L=t.data)==null?void 0:L.endOfCommand;l.value=new WebSocket("ws://"+W+":"+$+"/"),l.value.onopen=async()=>{var B,H;y.value=!0,console.log("onopen"),await x(100),M!=""&&M!=null&&((B=l.value)==null||B.send(M+q),await x(100)),A!=""&&A!=null&&((H=l.value)==null||H.send(A+q),await x(100))},l.value.onmessage=B=>{a.value+=B.data},l.value.onclose=()=>{y.value=!1,console.log("onclose")},l.value.onerror=B=>{console.error("WebSocket error: ",B)}}}),dt(()=>{l.value&&l.value.close()});const u=()=>{var E,w;n.value.trim()!==""&&(t.typeConnection==_e.WEBSOCKET&&((w=l.value)==null||w.send(n.value+((E=t.data)==null?void 0:E.endOfCommand))),i.value.unshift(n.value),i.value.length>10&&i.value.pop(),n.value="")},v=E=>{n.value=E},f=E=>(E.length>20?E.slice(0,20)+"...":E).replace(/\n/g," ");function x(E){return new Promise(w=>setTimeout(w,E))}return(E,w)=>(k(),I("div",bo,[p("div",yo,[w[2]||(w[2]=p("h3",null,"Área de Lectura",-1)),g(h(Ee),{modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=N=>a.value=N),readonly:!0,rows:"10",placeholder:"Este es el área de lectura.",class:"full-width-textarea"},null,8,["modelValue"])]),p("div",Eo,[w[3]||(w[3]=p("h3",null,"Área de Escritura",-1)),g(h(Ee),{modelValue:n.value,"onUpdate:modelValue":w[1]||(w[1]=N=>n.value=N),rows:"4",placeholder:"Escribe aquí algo...",class:"full-width-textarea"},null,8,["modelValue"])]),p("div",_o,[g(h(V),{label:"Enviar",icon:"pi pi-send",onClick:u})]),p("div",xo,[w[4]||(w[4]=p("h3",null,"Buffer (últimos 10 envíos)",-1)),i.value.length===0?(k(),I("div",wo,"No hay mensajes recientes")):pt("",!0),(k(!0),I(z,null,ne(i.value,(N,C)=>(k(),I("div",{key:C,class:"p-mb-2"},[g(h(V),{class:"p-button-text",onClick:L=>v(N)},{default:Y(()=>[ft(j(f(N)),1)]),_:2},1032,["onClick"])]))),128))])]))}}),Oo=ee(Do,[["__scopeId","data-v-84f4b391"]]),ko={class:"flex justify-end gap-2"},Co=S({__name:"YesNoQuestionDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),n=s(""),i=s("Ok"),l=s("Cancel");U(()=>{t=o.value.data,n.value=t.content,t.description&&(a.value=t.description),t.okLabel&&(i.value=t.okLabel),t.cancelLabel&&(l.value=t.cancelLabel)});const y=()=>{o.value.close(!0)},u=()=>{o.value.close(!1)};return(v,f)=>(k(),I(z,null,[p("div",null,[p("p",null,j(a.value),1),p("p",null,j(n.value),1)]),p("div",ko,[g(h(V),{type:"button",label:i.value,severity:"secondary",onClick:y},null,8,["label"]),g(h(V),{type:"button",label:l.value,onClick:u},null,8,["label"])])],64))}}),Io=S({__name:"FileUploadDialog",setup(e){const o=s(),t=se("dialogRef"),a=s("Soltar aquí el directorio de trabajo");let n;const i=s(""),l=s("");U(()=>{n=t.value.data,i.value=n.description,l.value=n.content});const y=()=>{console.log(o.value.files),t.value.close(o.value.files)};return(u,v)=>(k(),I("div",null,[p("p",null,j(i.value),1),p("p",null,j(l.value),1),g(h(at),{ref_key:"fileupload",ref:o,mode:"advanced",name:"demo[]",url:"/api/upload",disable:"true",multiple:!1,accept:"",maxFileSize:1e8,showUploadButton:!1,showCancelButton:!1,fileLimit:10,auto:!1},{empty:Y(()=>[p("p",null,j(a.value),1)]),_:1},512),g(h(V),{label:"Upload",onClick:y,severity:"secondary"})]))}});function We(e,o){for(let t=0;t<e.length;t++)if(e[t].path===o)return{status:r.EXISTS,data:t};return{status:r.NOEXIST}}async function No(e,o){const t=Ae(o);if(t.extension=="")return{status:r.WITHOUTCHANGE};if(!ve.includes(t.extension))return{status:r.WITHOUTCHANGE};const a=We(e,t.path);if(a.status==r.EXISTS)return{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:a.data};{const n=await Ft(t.path);if(n.status==0){const i=t.extension=="json"?JSON.parse(n.data):{},l=De(n.data,t.extension),y={path:t.path,filename:t.filename,extension:t.extension,content:n.data,blocklycode:i.blocklycode||void 0,codemirrorCursor:0,config:l,status:r.ADDED};return e.push(y),{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:e.length-1}}else return{status:r.WITHOUTCHANGE}}}async function Po(e,o,t){const a=Ae(o);if(a.extension=="")return{status:r.WITHOUTCHANGE};if(!ve.includes(a.extension))return{status:r.WITHOUTCHANGE};const n=We(e,a.path);if(n.status==r.EXISTS)return{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:n.data};if(t!=""){const i=a.extension=="json"?JSON.parse(t):{},l=De(t,a.extension),y={path:a.path,filename:a.filename,extension:a.extension,content:t,blocklycode:i.blocklycode||void 0,codemirrorCursor:0,config:l,status:r.ADDED};return e.push(y),{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:e.length-1}}else return{status:r.WITHOUTCHANGE}}function jo(e,o){return e!==void 0&&e.length>o?(e.splice(o,1),{status:r.OK}):{status:r.FAILED}}function Lo(e,o,t,a){return e[a].content=o,e[a].codemirrorCursor=t,e[a].status=r.UNSAVED,{status:r.OK}}function Fo(e,o,t){return e[t].blocklycode=o,e[t].status=r.UNSAVED,{status:r.OK}}function To(e){return Be.includes(e.extension)?{status:r.SET_WS,data:R.BLOCKLY}:Se.includes(e.extension)?{status:r.SET_WS,data:R.CODEMIRROR}:{status:r.SET_WS,data:R.WELCOME}}function So(e,o){const t=e[o];if(t.extension=="json"&&t.blocklycode!==void 0){const a={config:t.config||"",blocklycode:t.blocklycode};e[o].content=JSON.stringify(a)}return{status:r.OK}}function Bo(e,o,t){const a=e[o];let n;if(Be.includes(a.extension)&&t!=null)n=t;else if(Se.includes(a.extension))n=De(a.content,a.extension);else return{status:r.FAILED};return e[o].config=n,{status:r.OK}}function De(e,o){return o=="lua"?Vo(e):o=="py"?Ro(e):o=="json"?Uo(e):{}}function Ro(e){const o={},t=e.split(`
|
|
17
|
+
`);for(const a of t){const n=a.match(/# (\w+): (.+)/);if(n){const[,i,l]=n;o[i]=String(l)}}return o}function Vo(e){const o={},t=e.split(`
|
|
18
|
+
`);for(const a of t){const n=a.match(/-- (\w+): (.+)/);if(n){const[,i,l]=n;o[i]=String(l)}}return o}function Uo(e){const o=JSON.parse(e).config;return o===void 0?{}:o}function $o(e){let o=[];return e.config!=null&&(Object.keys(e.config).forEach(t=>{o.push({label:[t],value:e.config[t]})}),o.push({label:"",value:""})),o}function Wo(e){let o={};for(let t=0;t<e.length;t++){const a=e[t].label;if(a!=""&&a!=null){const n=e[t].value;o[a]=n}}return o}function Ae(e){const o=we(e);if(o.so==T.UNIX){const t=e.split("/").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else if(o.so==T.WINDOWS){const t=e.split("\\").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else return{path:"",filename:"",extension:""}}async function Ao(e){return await Lt(e)}async function Ko(e,o){return So(e,o),Bo(e,o),await Tt(e[o].path,e[o].content)}async function Xo(e){return await St(e)}async function Mo(e){return await Bt(e)}function qo(e,o){if(o.length>0)for(let t=0;t<o.length;t++)e[o[t].platform]=o[t]}const Ho={style:{height:"100%"}},zo={class:"main_div"},Qo={id:"tree_and_commands",class:"tree_and_commands"},Jo={id:"treeview",class:"treeview"},Go={id:"editor",class:"editor"},Zo={id:"toolbar",class:"toolbar"},Yo={id:"tabView",class:"tabview"},ea={id:"blocklyEditor",class:"blocklyeditorclass"},ta={id:"textEditor",class:"texteditorclass"},oa=S({__name:"App",setup(e){const o=s([]),t=s(""),a=s([]),n=s(""),i=s(0),l=s([]),y=s(),u=s(),v=s(!1),f=s(!1),x=s(Q.EN),E=s(R.BLOCKLY),w=s({}),N=s();x.value=Q.ES;const C=Le(),L=nt(),W=s(!0),$=s(!1),M=s(""),A=s([{label:"",value:""}]),q=s(""),B=s(""),H=c=>{o.value=c},ge=c=>{t.value=c},J=c=>{u.value=c},te=(c,d,O)=>{f.value=!f.value,Lo(l.value,c,d,O)},m=(c,d)=>{f.value=!f.value,Fo(l.value,c,d)},_=async(c,d)=>{const O=await Po(l.value,c,d);O.status==r.REQUEST_SELECT_FILE_IN_TABVIEW&&(u.value=O.data)},D=async()=>{(await Ko(l.value,u.value||0)).status==r.OK?C.add({severity:"success",summary:b(K.savefile.ok,x.value),detail:"",life:3e3}):C.add({severity:"error",summary:b(K.savefile.error,x.value),detail:"",life:3e3})},oe=()=>{l.value.length>0&&(jo(l.value,u.value||0),l.value.length>0&&u.value!=null?u.value<l.value.length?v.value=!v.value:u.value=u.value-1:(E.value=R.WELCOME,u.value=-1))},Ke=async c=>{if((await Xo(c)).status==r.OK){const O={severity:"success",summary:b(K.deleteFile.ok,x.value),detail:c,life:3e3};C.add(O)}else{const O={severity:"error",summary:b(K.deleteFile.error,x.value),detail:c,life:3e3};C.add(O)}},Xe=()=>{M.value=b(K.titleConfigProjectDialog,x.value),q.value=b(K.dialogButton.ok,x.value),B.value=b(K.dialogButton.close,x.value),u.value!=null&&(A.value=$o(l.value[u.value])),$.value=!0},Me=()=>{E.value=R.WELCOME},he=async c=>{const d=await Ao(c);if(d.status==r.OK){Ue(a.value,c).status==r.NOTFOUND&&a.value.push(c),o.value=d.data,n.value=c,i.value=a.value.length;const O={severity:"info",summary:b(K.toastUpdateContentDir,x.value),detail:c,life:3e3};C.add(O)}},qe=async c=>{for(let d=0;d<c.length;d++){const O=c[d],G=new FormData;G.append("file",O);const et=await Mo(G);let be;et.status==r.OK?be={severity:"info",summary:"Update file",detail:"",life:3e3}:be={severity:"warn",summary:"Dont update",detail:"",life:3e3},C.add(be)}};s(!1),s(""),s();const He=async c=>{if(C.add({severity:"info",summary:b(K.toastProccess,x.value),detail:"",life:1500}),N.value!=null){const d=await N.value.commandEmit(y.value,c,x.value);switch(d.typeResult){case ae.TOAST:C.add(d.data);break;case ae.TEXT_PRINT:L.open(mo,{data:d.data,props:{maximizable:!0,header:d.data.title}});break;case ae.URL_PRINT:L.open(ho,{data:d.data,props:{maximizable:!0,header:d.data.title}});break;case ae.TERM:L.open(Oo,{data:d.data,props:{maximizable:!0}});break}}},Oe=(c,d)=>{switch(c){case"delete-file-request":d.filePath&&Ke(d.filePath);break;case"upload-file":d.files&&qe(d.files);break}},ze=async c=>{switch(c.typeDialog){case le.YES_OR_NO_QUESTION:L.open(Co,{data:c.data,props:{maximizable:!0,header:c.data.title},onClose:d=>{(d?d.data:!1)==!0&&Oe(c.data.emit,c.data.args)}});break;case le.UPLOADFILE:L.open(Io,{data:c.data,props:{maximizable:!0,header:c.data.title},onClose:d=>{const O=d?d.data:void 0;O&&Oe(c.data.emit,{files:O})}});break}},ke=c=>{},Qe=()=>{W.value=!W.value,v.value=!v.value},Je=()=>{$.value=!1,u.value!=null&&(l.value[u.value].config=Wo(A.value))},Ge=()=>{if(l.value.length>0&&u.value!==void 0){const c=To(l.value[u.value]);c.status==r.SET_WS&&(E.value=c.data)}},Ze=()=>{if(l.value.length>0&&u.value!==void 0){const c=l.value[u.value].config.platform;c!=null&&c!=""?N.value=w.value[c]:N.value=void 0}},Ye=()=>{u.value!=null&&(y.value=l.value[u.value])};return F(u,()=>{Ge(),Ze(),Ye()}),F(t,async c=>{const d=await No(l.value,c||"");d.status==r.REQUEST_SELECT_FILE_IN_TABVIEW&&(u.value=d.data)}),U(async()=>{for(const c of xt)he(c);qo(w.value,wt)}),(c,d)=>(k(),I("main",Ho,[p("div",zo,[ue(p("div",{id:"menu_collapse",class:"menu_collapse",onMouseover:d[0]||(d[0]=O=>ke()),onMouseout:d[1]||(d[1]=O=>ke())},[d[4]||(d[4]=p("p",null,"Catalejo",-1)),ue(p("div",Qo,[p("div",null,[g(Yt,{plugins:w.value,lang:x.value,workDirPath:n.value,filePathSelected:t.value,onDirconfigUpdate:H,onSaveProjectRequest:D,onNewProjectRequest:_,onDirPathSelected:he,onRunAppFunctionWithDialogRequest:ze},null,8,["plugins","lang","workDirPath","filePathSelected"])]),p("div",Jo,[g(At,{filePaths:o.value,dirPaths:a.value,dirPathsLength:i.value,lang:x.value,onFileSelected:ge,onDirPathSelected:he},null,8,["filePaths","dirPaths","dirPathsLength","lang"])])],512),[[de,W.value]])],544),[[de,W.value]]),p("div",Go,[p("div",Zo,[g(po,{lang:x.value,plugin:N.value,onMenuToggle:Qe,onSaveProjectRequest:D,onCloseProject:oe,onConfigProject:Xe,onPluginCommand:He},null,8,["lang","plugin"])]),p("div",Yo,[g(qt,{index:u.value,projects:l.value,contentchanges:f.value,lang:x.value,update:v.value,onIndexOfProjectToLoad:J},null,8,["index","projects","contentchanges","lang","update"])]),ue(p("div",ea,[g(co,{projects:l.value,index:u.value,workspace:E.value,plugin:N.value,update:v.value,onXmltextIndex:m,onBlocklyMounted:Me},null,8,["projects","index","workspace","plugin","update"])],512),[[de,E.value==h(R).BLOCKLY]]),ue(p("div",ta,[g(kt,{projects:l.value,index:u.value,workspace:E.value,update:v.value,onContentCursorIndex:te},null,8,["projects","index","workspace","update"])],512),[[de,E.value==h(R).CODEMIRROR]])]),g(h(ye),{visible:$.value,"onUpdate:visible":d[3]||(d[3]=O=>$.value=O),modal:"",header:M.value,style:{width:"32rem"}},{default:Y(()=>[p("div",null,[(k(!0),I(z,null,ne(A.value,O=>(k(),I("div",null,[g(h(fe),{type:"text",size:"small",modelValue:O.label,"onUpdate:modelValue":G=>O.label=G,class:"textInputDialogClass"},null,8,["modelValue","onUpdate:modelValue"]),d[5]||(d[5]=p("span",null,": ",-1)),g(h(fe),{type:"text",size:"small",modelValue:O.value,"onUpdate:modelValue":G=>O.value=G},null,8,["modelValue","onUpdate:modelValue"])]))),256)),g(h(V),{type:"button",label:B.value,severity:"secondary",onClick:d[2]||(d[2]=O=>$.value=!1)},null,8,["label"]),g(h(V),{type:"button",label:q.value,onClick:Je},null,8,["label"])])]),_:1},8,["visible","header"]),g(h(xe)),g(h(lt))]),d[6]||(d[6]=p("div",{id:"log"},null,-1))]))}}),aa=ee(oa,[["__scopeId","data-v-ed5c9240"]]),me=vt(aa);me.use(st);me.use(it);me.use(rt);me.mount("#app");
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" href="/favicon.ico">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Vite App</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-B-Zt9aWG.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/@vue-zv1stXxC.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/primevue-BmCb0h8-.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/@lezer-D9M01xfV.js">
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* empty css */import{s as Ce,a as ot,b as at,u as Le,c as Fe,d as xe,e as fe,f as V,g as ye,h as Ie,i as Ee,j as lt,k as nt,l as st,P as it,T as rt,D as ct}from"./primevue-BmCb0h8-.js";import{d as S,r as s,w as F,g as Te,Q as h,f as O,o as U,q as I,t as p,x as j,C as g,B as Y,F as z,E as le,e as ut,n as dt,i as se,R as pt,j as ft,I as vt,z as ue,K as de,S as mt}from"./@vue-zv1stXxC.js";import{S as gt,l as ht,p as bt,s as yt}from"./codemirror-OB90vtSj.js";import{b as X,E as Ne,B as Et,p as _t,l as xt}from"./blockly-BA4rjO3i.js";import"./@lezer-D9M01xfV.js";import"./crelt-C8TCjufn.js";import"./style-mod-Bc2inJdb.js";import"./w3c-keyname-Vcq4gwWv.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const n of i.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&a(n)}).observe(document,{childList:!0,subtree:!0});function t(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(l){if(l.ep)return;l.ep=!0;const i=t(l);fetch(l.href,i)}})();const ve="py lua json ck",Se="py lua ck",Be="json",wt={py:"Python",lua:"Lua",ck:"Chuck",json:"JSON",txt:"Text plain"},Re={name:"Python",extension:"py"},Ve={name:"Lua",extension:"lua"};var r=(e=>(e[e.OK=0]="OK",e[e.FAILED=1]="FAILED",e[e.CHANGE=2]="CHANGE",e[e.WITHOUTCHANGE=3]="WITHOUTCHANGE",e[e.REQUEST=4]="REQUEST",e[e.REQUEST_SELECT_FILE_IN_TABVIEW=5]="REQUEST_SELECT_FILE_IN_TABVIEW",e[e.EXISTS=6]="EXISTS",e[e.NOEXIST=7]="NOEXIST",e[e.FOUND=8]="FOUND",e[e.NOTFOUND=9]="NOTFOUND",e[e.ADDED=10]="ADDED",e[e.SAVED=11]="SAVED",e[e.UNSAVED=12]="UNSAVED",e[e.SET_WS=13]="SET_WS",e[e.ENABLED=14]="ENABLED",e[e.DESABLED=15]="DESABLED",e))(r||{}),ae=(e=>(e[e.TOAST=0]="TOAST",e[e.TEXT_PRINT=1]="TEXT_PRINT",e[e.TEXT_AREA=2]="TEXT_AREA",e[e.URL_PRINT=3]="URL_PRINT",e[e.TERM=4]="TERM",e))(ae||{}),ne=(e=>(e[e.YES_OR_NO_QUESTION=0]="YES_OR_NO_QUESTION",e[e.UPLOADFILE=1]="UPLOADFILE",e))(ne||{}),R=(e=>(e[e.WELCOME=0]="WELCOME",e[e.CODEMIRROR=1]="CODEMIRROR",e[e.BLOCKLY=2]="BLOCKLY",e[e.FREE=3]="FREE",e))(R||{}),Q=(e=>(e[e.EN=0]="EN",e[e.ES=1]="ES",e))(Q||{}),T=(e=>(e[e.UNIX=0]="UNIX",e[e.WINDOWS=1]="WINDOWS",e[e.LINUX=2]="LINUX",e[e.MACOS=3]="MACOS",e[e.UNKNOW=4]="UNKNOW",e))(T||{}),_e=(e=>(e[e.WEBSOCKET=0]="WEBSOCKET",e[e.TCP_IP=1]="TCP_IP",e[e.SERIAL=2]="SERIAL",e))(_e||{}),Z=(e=>(e[e.RELATIVE=0]="RELATIVE",e[e.ABSOLUTE=1]="ABSOLUTE",e[e.UNKNOW=2]="UNKNOW",e))(Z||{});function Dt(e){switch(e){case Re.extension:return bt();case Ve.extension:return gt.define(ht);default:return}}const kt=S({__name:"TextEditor",props:["projects","index","update","activate","workspace"],emits:["content-cursor-index"],setup(e,{emit:o}){const t=e,a=o,l=s(""),i=s(),n=s();return F(()=>[t.index,t.update],async()=>{t.projects.length>0&&t.workspace==R.CODEMIRROR&&(n.value.setCursor(0),i.value=Dt(t.projects[t.index].extension),l.value=t.projects[t.index].content)}),F(l,y=>{a("content-cursor-index",y,n.value.getCursor(),t.index)}),(y,u)=>(O(),Te(h(yt),{ref_key:"cm",ref:n,modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=v=>l.value=v),basic:"","tab-size":2,dark:!1,gutter:!0,tab:!0,lang:i.value},null,8,["modelValue","lang"]))}});function Ue(e,o){for(let t=0;t<e.length;t++)if(e[t]==o)return{status:r.FOUND,data:t};return{status:r.NOTFOUND}}function we(e){const o=/^[a-zA-Z]:\\/,t=/^\//,a=/^[^\/\\:*?"<>|]+(?:\\|\/|$)/,l=/^[^\/]+(?:\/|$)/;return o.test(e)?{so:T.WINDOWS,pathType:Z.ABSOLUTE}:t.test(e)?{so:T.UNIX,pathType:Z.ABSOLUTE}:l.test(e)?{so:T.UNIX,pathType:Z.RELATIVE}:a.test(e)?{so:T.WINDOWS,pathType:Z.RELATIVE}:{so:T.UNKNOW,pathType:Z.UNKNOW}}function Ot(e){const o=we(e);if(o.so==T.UNIX){const t=e.split("/").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else if(o.so==T.WINDOWS){const t=e.split("\\").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else return{path:"",filename:"",extension:""}}function Ct(e){return ve.includes(e)?"pi pi-file-edit":""}function It(e){let o=[];for(let t=0;t<e.length;t++){const a=Ot(e[t]);o.push({key:String(t),label:a.filename,leaf:!0,icon:a.extension!=""?Ct(a.extension):"",data:a.path,extension:a.extension})}return o}function Nt(e){const o=we(e);if(o.so==T.UNIX){const t=e.split("/").pop();return(e.includes(".")?e.split(".").pop():"")!=""?{status:r.FAILED}:{status:r.OK,data:{path:e,dirname:t||"noname"}}}else if(o.so==T.WINDOWS){const t=e.split("\\").pop();return(e.includes(".")?e.split(".").pop():"")!=""?{status:r.FAILED}:{status:r.OK,data:{path:e,dirname:t||"noname"}}}else return{status:r.FAILED}}function Pt(e){let o=[];for(let t=0;t<e.length;t++){const a=Nt(e[t]);a.status==r.OK&&o.push({key:String(t),label:a.data.dirname,leaf:!0,icon:"pi pi-folder",data:a.data.path})}return o}const ie="http://"+location.hostname,re="8080",ce="cors";async function $e(e,o){try{const a=await(await fetch(e,o)).json();return a.status==r.OK,a}catch(t){return console.error(t),{status:r.FAILED}}}async function jt(e){const t=ie+":"+re+"/"+"fs/dirconfig",a={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:e})};try{const i=await(await fetch(t,a)).json();return i.status==r.OK?i:{status:r.FAILED}}catch(l){return console.error(l),{status:r.FAILED}}}async function Lt(e){const t=ie+":"+re+"/"+"fs/readFile",a={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e})};try{const i=await(await fetch(t,a)).json();if(i.status==r.OK)return i}catch(l){return console.error(l),{status:-1}}}async function Ft(e,o){const a=ie+":"+re+"/"+"fs/writeFile",l={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,content:o})};try{const n=await(await fetch(a,l)).json();return n.status==r.OK?n:{status:r.FAILED}}catch(i){return console.error(i),{status:r.FAILED}}}async function Tt(e){const t=ie+":"+re+"/"+"fs/deleteFile",a={method:"PUT",mode:ce,headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})};return await $e(t,a)}async function St(e){const t=ie+":"+re+"/"+"fs/uploadFile";return await $e(t,{method:"POST",mode:ce,headers:{},body:e})}const Pe={dirTitle:{en:"Directories:",es:"Directorios:"},fileTitle:{en:"Files:",es:"Archivos:"}},pe={menu:{en:"",es:""},save:{en:"Save",es:"Guardar"},close:{en:"Close",es:"cerrar"},config:{en:"Config",es:"Configurar"}},P={save:{en:"Save",es:"Guardar"},close:{en:"Close",es:"cerrar"},file:{en:"File",es:"Archivo"},opendir:{en:"Open dir",es:"Abrir directorio"},selectDirPath:{header:{en:"Put dir path.",es:"Poner ruta de directorio"}},newProject:{en:"New project",es:"Nuevo proyecto"},delete:{en:"Delete file",es:"Borrar archivo"},fileUpload:{en:"Upload files",es:"Subir archivos"},dialogDeleteFile:{title:{en:"Delete file?",es:"¿Borrar archivo?"},content:{en:"Do you want delete the file: ",es:"Quiere borrar el archivo: "}},dialogNewProject:{header:{en:"New project",es:"Nuevo proyecto"},labelInput:{en:"1. Insert a file name for project, the extension file will created atomatically.",es:"1. Agregar un nombre de archivo para el proyecto, la extensión será creada automáticamente."},labelDirPath:{en:"The project file will created in the path: ",es:"El proyecto será creado en el path: "},labelSelectPlatform:{en:"2. Select a platform compatible with editor: ",es:"2. Seleccionar una plataforma compatible con el editor: "},labelSelectProjectType:{en:"3. Select project type to create.",es:"3. Selecciona el tipo de proyecto a crear."}},dialogButtonYesNo:{ok:{en:"Yes",es:"Sí"},close:{en:"Cancel",es:"Cancelar"}},dialogButton:{ok:{en:"Ok",es:"Ok"},close:{en:"Close",es:"Cerrar"}}},K={savefile:{ok:{en:"File save",es:"Archivo guardado"},error:{en:"Don't save file",es:"No se guardó el archivo"}},deleteFile:{ok:{en:"The file has been deleted",es:"El archivo ha sido eliminado"},error:{en:"The file was not deleted",es:"El archivo no fue borrado"}},titleConfigProjectDialog:{en:"Config project",es:"Configuar proyecto"},dialogButton:{ok:{en:"Ok",es:"Ok"},close:{en:"Close",es:"Cerrar"}},toastProccess:{en:"In process",es:"En proceso"},toastUpdateContentDir:{en:"Updated files in editor from directory: ",es:"Archivos actualizados en el editor desde directorio: "}},Bt={scrollableTabsDefault:{en:"Projects loaded in workspace",es:"Proyectos cargados en el área de trabajo"}};function b(e,o){return o==Q.EN?e.en:o==Q.ES?e.es:"noname"}const Rt={class:"card flex justify-content-center"},Vt={for:"mask",class:"font-bold block mb-2"},Ut={for:"mask",class:"font-bold block mb-2"},$t=S({__name:"TreeView",props:["dirPaths","dirPathsLength","filePaths","lang"],emits:["dir-path-selected","file-selected"],setup(e,{emit:o}){const t=e,a=o,l=s(),i=s(),n=s(""),y=s("");U(()=>{n.value=b(Pe.dirTitle,t.lang),y.value=b(Pe.fileTitle,t.lang)});const u=f=>{console.log(f.data),a("dir-path-selected",f.data)},v=f=>{console.log(f.data),a("file-selected",f.data)};return F(()=>t.dirPathsLength,()=>{i.value=Pt(t.dirPaths)}),F(()=>t.filePaths,async f=>{l.value=It(f)}),(f,x)=>(O(),I("div",Rt,[p("label",Vt,j(n.value),1),g(h(Ce),{value:i.value,selectionMode:"single",onNodeSelect:u,class:"w-full md:w-30rem"},null,8,["value"]),p("label",Ut,j(y.value),1),g(h(Ce),{value:l.value,selectionMode:"single",onNodeSelect:v,class:"w-full md:w-30rem"},null,8,["value"])]))}}),ee=(e,o)=>{const t=e.__vccOpts||e;for(const[a,l]of o)t[a]=l;return t},Wt=ee($t,[["__scopeId","data-v-7d510def"]]);function At(e){let o=[];for(let t=0;t<e.length;t++)o.push({title:e[t].filename,indexOfProject:t});return o}const Kt={id:"divTabview",class:"card"},Xt=S({__name:"TabViewEditor",props:["index","update","projects","contentchanges","lang"],emits:["index-of-project-to-load"],setup(e,{emit:o}){const t=o,a=e,l=s([]),i=s(0),n=u=>a.projects.length>0?At(a.projects):[{title:b(Bt.scrollableTabsDefault,u),indexOfProject:-1}];F(()=>[a.index,a.update],([u])=>{l.value=n(a.lang),a.projects.length>0?i.value=u:i.value=0}),F(()=>a.lang,u=>{l.value=n(u)}),U(()=>{l.value=n(a.lang)});const y=u=>{t("index-of-project-to-load",u.index)};return(u,v)=>(O(),I("div",Kt,[g(h(ot),{scrollable:!0,onTabClick:y,activeIndex:i.value,"onUpdate:activeIndex":v[0]||(v[0]=f=>i.value=f)},{default:Y(()=>[(O(!0),I(z,null,le(l.value,f=>(O(),Te(h(at),{key:f.title,header:f.title},null,8,["header"]))),128))]),_:1},8,["activeIndex"])]))}}),Mt=ee(Xt,[["__scopeId","data-v-8ef45e55"]]),qt={class:"card"},Ht={class:"flex align-items-center"},zt=["for"],Qt={class:"flex align-items-center"},Jt=["for"],Gt=S({__name:"MenubarCommon",props:{lang:{},workDirPath:{},filePathSelected:{},plugins:{}},emits:["dirconfig-update","save-project-request","dir-path-selected","new-project-request","run-app-function-with-dialog-request"],setup(e,{emit:o}){Le(),s("Soltar aquí el directorio de trabajo");const t=e,a=s(!1),l=s(""),i=s(""),n=s(!1),y=s(""),u=s(""),v=s(""),f=s(""),x=s(""),E=s(""),w=s(""),N=s(""),C=s(""),L=o,W=s([]),$=m=>{W.value=[{label:b(P.file,m),icon:"pi pi-file",items:[{label:b(P.newProject,m),icon:"pi pi-file-plus",command:()=>{v.value="",q(t.lang),n.value=!0}},{label:b(P.opendir,m),icon:"pi pi-folder-open",command:()=>{i.value="",a.value=!0}},{label:b(P.save,m),icon:"pi pi-save",command:()=>{L("save-project-request")}},{label:b(P.delete,m),icon:"pi pi-eraser",command:()=>{const _={typeDialog:ne.YES_OR_NO_QUESTION,data:{title:b(P.dialogDeleteFile.title,m),content:b(P.dialogDeleteFile.content,m)+t.filePathSelected,emit:"delete-file-request",args:{filePath:t.filePathSelected},okLabel:b(P.dialogButtonYesNo.ok,m),cancelLabel:b(P.dialogButtonYesNo.close,m)}};L("run-app-function-with-dialog-request",_)}},{label:b(P.fileUpload,m),icon:"pi pi-file-arrow-up",command:()=>{const _={title:"Subir archivos",content:"nn",emit:"upload-file",args:{}},D={typeDialog:ne.UPLOADFILE,data:_};L("run-app-function-with-dialog-request",D)}}]}]},M=()=>{a.value=!1,L("dir-path-selected",i.value)};F(v,m=>{m.split(".").pop()&&m.split(".").pop()});const A=m=>{l.value=b(P.selectDirPath.header,m)},q=m=>{y.value=b(P.dialogNewProject.header,m),u.value=b(P.dialogNewProject.labelInput,m)+" (."+ve.replace(/ /g,", .")+"):",f.value=b(P.dialogNewProject.labelDirPath,m)+'"'+t.workDirPath+'".',x.value=b(P.dialogNewProject.labelSelectPlatform,m),E.value=b(P.dialogNewProject.labelSelectProjectType,m)},B=m=>{w.value=b(P.dialogButton.ok,m),N.value=b(P.dialogButton.close,m)},H=m=>{A(m),q(m),B(m)},ge=()=>{let m="",_="";te.value=="Blockly"?(m=t.plugins[C.value].blockly_template,_=".json"):(m=t.plugins[C.value].lang_template,_="."+t.plugins[C.value].platformLang.extension);const D=t.workDirPath+"/"+v.value+_;L("new-project-request",D,m),n.value=!1};F(()=>t.lang,m=>{H(m),$(m)});const J=s([]),te=s("");return F(C,()=>{J.value=[];const m=t.plugins[C.value].platformLang.extension,_=wt[m];J.value.push(_),t.plugins[C.value].blockly_template!=null&&J.value.push("Blockly")}),U(()=>{H(t.lang),$(t.lang)}),(m,_)=>(O(),I("div",qt,[g(h(Fe),{model:W.value},null,8,["model"]),g(h(xe)),g(h(ye),{visible:a.value,"onUpdate:visible":_[2]||(_[2]=D=>a.value=D),modal:"",header:l.value,style:{width:"25rem"}},{default:Y(()=>[p("div",null,[g(h(fe),{type:"text",modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=D=>i.value=D)},null,8,["modelValue"])]),p("div",null,[g(h(V),{type:"button",label:N.value,severity:"secondary",onClick:_[1]||(_[1]=D=>a.value=!1)},null,8,["label"]),g(h(V),{type:"button",label:w.value,onClick:M},null,8,["label"])])]),_:1},8,["visible","header"]),g(h(ye),{visible:n.value,"onUpdate:visible":_[7]||(_[7]=D=>n.value=D),modal:"",header:y.value,style:{width:"35rem"}},{default:Y(()=>[p("div",null,[p("p",null,j(u.value),1),g(h(fe),{type:"text",modelValue:v.value,"onUpdate:modelValue":_[3]||(_[3]=D=>v.value=D)},null,8,["modelValue"]),p("p",null,j(f.value),1),p("p",null,j(x.value),1)]),(O(!0),I(z,null,le(t.plugins,D=>(O(),I("div",Ht,[g(h(Ie),{modelValue:C.value,"onUpdate:modelValue":_[4]||(_[4]=oe=>C.value=oe),inputId:D.platform,name:"dynamic",value:D.platform},null,8,["modelValue","inputId","value"]),p("label",{for:D.platform,class:"ml-2"},j(D.platform),9,zt)]))),256)),p("div",null,[p("p",null,j(E.value),1)]),(O(!0),I(z,null,le(J.value,D=>(O(),I("div",Qt,[g(h(Ie),{modelValue:te.value,"onUpdate:modelValue":_[5]||(_[5]=oe=>te.value=oe),inputId:D,name:"dynamic",value:D},null,8,["modelValue","inputId","value"]),p("label",{for:D,class:"ml-2"},j(D),9,Jt)]))),256)),p("div",null,[g(h(V),{type:"button",label:N.value,severity:"secondary",onClick:_[6]||(_[6]=D=>n.value=!1)},null,8,["label"]),g(h(V),{type:"button",label:w.value,onClick:ge},null,8,["label"])])]),_:1},8,["visible","header"])]))}}),Zt=ee(Gt,[["__scopeId","data-v-d8d9c184"]]),Yt=`
|
|
2
|
-
|
|
3
|
-
<xml id="toolbox" style="display: none">
|
|
4
|
-
<category name="Lógica" colour="%{BKY_LOGIC_HUE}">
|
|
5
|
-
<block type="controls_if"></block>
|
|
6
|
-
</category>
|
|
7
|
-
<category name="Secuencias" colour="%{BKY_LOOPS_HUE}">
|
|
8
|
-
<block type="controls_repeat_ext">
|
|
9
|
-
<value name="TIMES">
|
|
10
|
-
<shadow type="math_number">
|
|
11
|
-
<field name="NUM">10</field>
|
|
12
|
-
</shadow>
|
|
13
|
-
</value>
|
|
14
|
-
</block>
|
|
15
|
-
</category>
|
|
16
|
-
</xml>`;function eo(){const e=window.innerWidth,o=window.innerHeight;return e<o}const to={media:"media/",renderer:"geras",toolboxPosition:"start",horizontalLayout:eo(),zoom:{controls:!0,wheel:!0,startScale:1,maxScale:3,minScale:.3,scaleSpeed:1.2,pinch:!0},trashcan:!0,grid:{spacing:25,length:1,colour:"#ccc",snap:!0},toolbox:Yt};function oo(e){return X.inject(e.value,to)}function ao(e,o){const t=X.utils.xml.textToDom(e);try{return X.Xml.clearWorkspaceAndLoadFromXml(t,o),{status:r.OK}}catch{return{status:r.FAILED}}}function lo(e){e==Q.ES?X.setLocale(Ne):X.setLocale(Ne)}function no(e){switch(e.platformLang.name){case Ve.name:return xt.luaGenerator;case Re.name:return _t.pythonGenerator;default:return}}let je=[];function so(e,o){Ue(je,e.platform).status==r.NOTFOUND&&(e.initBlockly(Et,no(e),o),je.push(e.platform))}const io={class:"div_blockly"},ro=S({__name:"BlocklyEditor",props:["projects","index","update","workspace","plugin"],emits:["xmltext-index","blockly-mounted"],setup(e,{emit:o}){const t=e,a=o,l=s(),i=s();let n;const y=[X.Events.SELECTED],u=v=>{for(const f in y)if(v.type===y[f]){const x=X.Xml.workspaceToDom(n),E=X.Xml.domToPrettyText(x);a("xmltext-index",E,t.index)}};return U(async()=>{n=oo(l),lo(0),n.addChangeListener(u),a("blockly-mounted")}),F(()=>[t.index,t.update],async([v])=>{if(t.projects.length>0&&t.workspace==R.BLOCKLY){await dt();const f=t.projects[v].config.platform;f!=null&&f!=""&&(so(t.plugin,n),n.updateToolbox(t.plugin.toolbox)),ao(t.projects[v].blocklycode,n),X.svgResize(n),n.scrollCenter()}}),(v,f)=>(O(),I("div",io,[p("div",{class:"blocklyDivClass",id:"blocklyDiv",ref_key:"blocklyDivRef",ref:l},null,512),p("xml",{style:{display:"none"},ref_key:"blocklyToolbox",ref:i},[ut(v.$slots,"default")],512)]))}}),co={class:"card"},uo=S({__name:"ToolBar",props:["lang","plugin"],emits:["menu-toggle","save-project-request","close-project","config-project","plugin-command"],setup(e,{emit:o}){const t=e,a=o,l=s([]),i=s(Q.EN),n=[{label:b(pe.menu,t.lang),icon:"pi pi-arrow-right-arrow-left",command:()=>{a("menu-toggle")}},{label:b(pe.save,t.lang),icon:"pi pi-save",command:()=>{a("save-project-request")}},{label:b(pe.close,t.lang),icon:"pi pi-times",command:()=>{a("close-project")}},{label:b(pe.config,t.lang),icon:"pi pi-cog",command:()=>{a("config-project")}}];function y(v){for(let f=0;f<v.length;f++)if(Array.isArray(v[f].items))y(v[f].items);else{const x=v[f].command;v[f].command=function(){a("plugin-command",x)}}return v}const u=v=>{if(v!=null){let f=v.getItemsToolBarOfPlugin(t.lang);f!=null&&f.length>0?(f=y(f),l.value=[...n,...f]):l.value=n}else l.value=n};return F(()=>t.plugin,v=>{u(v)}),F(()=>t.lang,()=>{i.value=t.lang}),U(()=>{l.value=n}),(v,f)=>(O(),I("div",co,[g(h(Fe),{model:l.value},null,8,["model"]),g(h(xe))]))}}),po={class:"container"},fo=S({__name:"TextareaDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),l=s("");return U(()=>{t=o.value.data,a.value=t.description,l.value=t.content}),(i,n)=>(O(),I("div",po,[p("p",null,j(a.value),1),g(h(Ee),{modelValue:l.value,"onUpdate:modelValue":n[0]||(n[0]=y=>l.value=y),autoResize:""},null,8,["modelValue"])]))}}),vo=ee(fo,[["__scopeId","data-v-e2622354"]]),mo=["href"],go=S({__name:"UrlprintDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),l=s("");return U(()=>{t=o.value.data,a.value=t.description,l.value=t.content}),(i,n)=>(O(),I(z,null,[p("p",null,j(a.value),1),p("a",{href:l.value,target:" _blank"},j(l.value),9,mo)],64))}}),ho={class:"p-fluid p-formgrid p-grid"},bo={class:"p-col-12"},yo={class:"p-col-12"},Eo={class:"p-col-12"},_o={class:"p-col-12"},xo={key:0},wo=S({__name:"TerminalDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),l=s(""),i=s([]),n=s(null),y=s(!1);U(()=>{var E,w,N,C,L;if(t=o.value.data,t.typeConnection==_e.WEBSOCKET){const W=(E=t.data)==null?void 0:E.ip,$=(w=t.data)==null?void 0:w.port,M=(N=t.data)==null?void 0:N.user,A=(C=t.data)==null?void 0:C.password,q=(L=t.data)==null?void 0:L.endOfCommand;n.value=new WebSocket("ws://"+W+":"+$+"/"),n.value.onopen=async()=>{var B,H;y.value=!0,console.log("onopen"),await x(100),M!=""&&M!=null&&((B=n.value)==null||B.send(M+q),await x(100)),A!=""&&A!=null&&((H=n.value)==null||H.send(A+q),await x(100))},n.value.onmessage=B=>{a.value+=B.data},n.value.onclose=()=>{y.value=!1,console.log("onclose")},n.value.onerror=B=>{console.error("WebSocket error: ",B)}}}),pt(()=>{n.value&&n.value.close()});const u=()=>{var E,w;l.value.trim()!==""&&(t.typeConnection==_e.WEBSOCKET&&((w=n.value)==null||w.send(l.value+((E=t.data)==null?void 0:E.endOfCommand))),i.value.unshift(l.value),i.value.length>10&&i.value.pop(),l.value="")},v=E=>{l.value=E},f=E=>(E.length>20?E.slice(0,20)+"...":E).replace(/\n/g," ");function x(E){return new Promise(w=>setTimeout(w,E))}return(E,w)=>(O(),I("div",ho,[p("div",bo,[w[2]||(w[2]=p("h3",null,"Área de Lectura",-1)),g(h(Ee),{modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=N=>a.value=N),readonly:!0,rows:"10",placeholder:"Este es el área de lectura.",class:"full-width-textarea"},null,8,["modelValue"])]),p("div",yo,[w[3]||(w[3]=p("h3",null,"Área de Escritura",-1)),g(h(Ee),{modelValue:l.value,"onUpdate:modelValue":w[1]||(w[1]=N=>l.value=N),rows:"4",placeholder:"Escribe aquí algo...",class:"full-width-textarea"},null,8,["modelValue"])]),p("div",Eo,[g(h(V),{label:"Enviar",icon:"pi pi-send",onClick:u})]),p("div",_o,[w[4]||(w[4]=p("h3",null,"Buffer (últimos 10 envíos)",-1)),i.value.length===0?(O(),I("div",xo,"No hay mensajes recientes")):ft("",!0),(O(!0),I(z,null,le(i.value,(N,C)=>(O(),I("div",{key:C,class:"p-mb-2"},[g(h(V),{class:"p-button-text",onClick:L=>v(N)},{default:Y(()=>[vt(j(f(N)),1)]),_:2},1032,["onClick"])]))),128))])]))}}),Do=ee(wo,[["__scopeId","data-v-84f4b391"]]),ko={class:"flex justify-end gap-2"},Oo=S({__name:"YesNoQuestionDialog",setup(e){const o=se("dialogRef");let t;const a=s(""),l=s(""),i=s("Ok"),n=s("Cancel");U(()=>{t=o.value.data,l.value=t.content,t.description&&(a.value=t.description),t.okLabel&&(i.value=t.okLabel),t.cancelLabel&&(n.value=t.cancelLabel)});const y=()=>{o.value.close(!0)},u=()=>{o.value.close(!1)};return(v,f)=>(O(),I(z,null,[p("div",null,[p("p",null,j(a.value),1),p("p",null,j(l.value),1)]),p("div",ko,[g(h(V),{type:"button",label:i.value,severity:"secondary",onClick:y},null,8,["label"]),g(h(V),{type:"button",label:n.value,onClick:u},null,8,["label"])])],64))}}),Co=S({__name:"FileUploadDialog",setup(e){const o=s(),t=se("dialogRef"),a=s("Soltar aquí el directorio de trabajo");let l;const i=s(""),n=s("");U(()=>{l=t.value.data,i.value=l.description,n.value=l.content});const y=()=>{console.log(o.value.files),t.value.close(o.value.files)};return(u,v)=>(O(),I("div",null,[p("p",null,j(i.value),1),p("p",null,j(n.value),1),g(h(lt),{ref_key:"fileupload",ref:o,mode:"advanced",name:"demo[]",url:"/api/upload",disable:"true",multiple:!1,accept:"",maxFileSize:1e8,showUploadButton:!1,showCancelButton:!1,fileLimit:10,auto:!1},{empty:Y(()=>[p("p",null,j(a.value),1)]),_:1},512),g(h(V),{label:"Upload",onClick:y,severity:"secondary"})]))}});function We(e,o){for(let t=0;t<e.length;t++)if(e[t].path===o)return{status:r.EXISTS,data:t};return{status:r.NOEXIST}}async function Io(e,o){const t=Ae(o);if(t.extension=="")return{status:r.WITHOUTCHANGE};if(!ve.includes(t.extension))return{status:r.WITHOUTCHANGE};const a=We(e,t.path);if(a.status==r.EXISTS)return{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:a.data};{const l=await Lt(t.path);if(l.status==0){const i=t.extension=="json"?JSON.parse(l.data):{},n=De(l.data,t.extension),y={path:t.path,filename:t.filename,extension:t.extension,content:l.data,blocklycode:i.blocklycode||void 0,codemirrorCursor:0,config:n,status:r.ADDED};return e.push(y),{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:e.length-1}}else return{status:r.WITHOUTCHANGE}}}async function No(e,o,t){const a=Ae(o);if(a.extension=="")return{status:r.WITHOUTCHANGE};if(!ve.includes(a.extension))return{status:r.WITHOUTCHANGE};const l=We(e,a.path);if(l.status==r.EXISTS)return{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:l.data};if(t!=""){const i=a.extension=="json"?JSON.parse(t):{},n=De(t,a.extension),y={path:a.path,filename:a.filename,extension:a.extension,content:t,blocklycode:i.blocklycode||void 0,codemirrorCursor:0,config:n,status:r.ADDED};return e.push(y),{status:r.REQUEST_SELECT_FILE_IN_TABVIEW,data:e.length-1}}else return{status:r.WITHOUTCHANGE}}function Po(e,o){return e!==void 0&&e.length>o?(e.splice(o,1),{status:r.OK}):{status:r.FAILED}}function jo(e,o,t,a){return e[a].content=o,e[a].codemirrorCursor=t,e[a].status=r.UNSAVED,{status:r.OK}}function Lo(e,o,t){return e[t].blocklycode=o,e[t].status=r.UNSAVED,{status:r.OK}}function Fo(e){return Be.includes(e.extension)?{status:r.SET_WS,data:R.BLOCKLY}:Se.includes(e.extension)?{status:r.SET_WS,data:R.CODEMIRROR}:{status:r.SET_WS,data:R.WELCOME}}function To(e,o){const t=e[o];if(t.extension=="json"&&t.blocklycode!==void 0){const a={config:t.config||"",blocklycode:t.blocklycode};e[o].content=JSON.stringify(a)}return{status:r.OK}}function So(e,o,t){const a=e[o];let l;if(Be.includes(a.extension)&&t!=null)l=t;else if(Se.includes(a.extension))l=De(a.content,a.extension);else return{status:r.FAILED};return e[o].config=l,{status:r.OK}}function De(e,o){return o=="lua"?Ro(e):o=="py"?Bo(e):o=="json"?Vo(e):{}}function Bo(e){const o={},t=e.split(`
|
|
17
|
-
`);for(const a of t){const l=a.match(/# (\w+): (.+)/);if(l){const[,i,n]=l;o[i]=String(n)}}return o}function Ro(e){const o={},t=e.split(`
|
|
18
|
-
`);for(const a of t){const l=a.match(/-- (\w+): (.+)/);if(l){const[,i,n]=l;o[i]=String(n)}}return o}function Vo(e){const o=JSON.parse(e).config;return o===void 0?{}:o}function Uo(e){let o=[];return e.config!=null&&(Object.keys(e.config).forEach(t=>{o.push({label:[t],value:e.config[t]})}),o.push({label:"",value:""})),o}function $o(e){let o={};for(let t=0;t<e.length;t++){const a=e[t].label;if(a!=""&&a!=null){const l=e[t].value;o[a]=l}}return o}function Ae(e){const o=we(e);if(o.so==T.UNIX){const t=e.split("/").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else if(o.so==T.WINDOWS){const t=e.split("\\").pop(),a=e.includes(".")?e.split(".").pop():"";return{path:e,filename:t||"",extension:a||""}}else return{path:"",filename:"",extension:""}}async function Wo(e){return await jt(e)}async function Ao(e,o){return To(e,o),So(e,o),await Ft(e[o].path,e[o].content)}async function Ko(e){return await Tt(e)}async function Xo(e){return await St(e)}function Mo(e,o){if(o.length>0)for(let t=0;t<o.length;t++)e[o[t].platform]=o[t]}let qo=[],Ke=[];Ke.push("work");console.log("plugins to load");const Ho={style:{height:"100%"}},zo={class:"main_div"},Qo={id:"tree_and_commands",class:"tree_and_commands"},Jo={id:"treeview",class:"treeview"},Go={id:"editor",class:"editor"},Zo={id:"toolbar",class:"toolbar"},Yo={id:"tabView",class:"tabview"},ea={id:"blocklyEditor",class:"blocklyeditorclass"},ta={id:"textEditor",class:"texteditorclass"},oa=S({__name:"App",setup(e){const o=s([]),t=s(""),a=s([]),l=s(""),i=s(0),n=s([]),y=s(),u=s(),v=s(!1),f=s(!1),x=s(Q.EN),E=s(R.BLOCKLY),w=s({}),N=s();x.value=Q.ES;const C=Le(),L=nt(),W=s(!0),$=s(!1),M=s(""),A=s([{label:"",value:""}]),q=s(""),B=s(""),H=c=>{o.value=c},ge=c=>{t.value=c},J=c=>{u.value=c},te=(c,d,k)=>{f.value=!f.value,jo(n.value,c,d,k)},m=(c,d)=>{f.value=!f.value,Lo(n.value,c,d)},_=async(c,d)=>{const k=await No(n.value,c,d);k.status==r.REQUEST_SELECT_FILE_IN_TABVIEW&&(u.value=k.data)},D=async()=>{(await Ao(n.value,u.value||0)).status==r.OK?C.add({severity:"success",summary:b(K.savefile.ok,x.value),detail:"",life:3e3}):C.add({severity:"error",summary:b(K.savefile.error,x.value),detail:"",life:3e3})},oe=()=>{n.value.length>0&&(Po(n.value,u.value||0),n.value.length>0&&u.value!=null?u.value<n.value.length?v.value=!v.value:u.value=u.value-1:(E.value=R.WELCOME,u.value=-1))},Xe=async c=>{if((await Ko(c)).status==r.OK){const k={severity:"success",summary:b(K.deleteFile.ok,x.value),detail:c,life:3e3};C.add(k)}else{const k={severity:"error",summary:b(K.deleteFile.error,x.value),detail:c,life:3e3};C.add(k)}},Me=()=>{M.value=b(K.titleConfigProjectDialog,x.value),q.value=b(K.dialogButton.ok,x.value),B.value=b(K.dialogButton.close,x.value),u.value!=null&&(A.value=Uo(n.value[u.value])),$.value=!0},qe=()=>{E.value=R.WELCOME},he=async c=>{const d=await Wo(c);if(d.status==r.OK){Ue(a.value,c).status==r.NOTFOUND&&a.value.push(c),o.value=d.data,l.value=c,i.value=a.value.length;const k={severity:"info",summary:b(K.toastUpdateContentDir,x.value),detail:c,life:3e3};C.add(k)}},He=async c=>{for(let d=0;d<c.length;d++){const k=c[d],G=new FormData;G.append("file",k);const tt=await Xo(G);let be;tt.status==r.OK?be={severity:"info",summary:"Update file",detail:"",life:3e3}:be={severity:"warn",summary:"Dont update",detail:"",life:3e3},C.add(be)}};s(!1),s(""),s();const ze=async c=>{if(C.add({severity:"info",summary:b(K.toastProccess,x.value),detail:"",life:1500}),N.value!=null){const d=await N.value.commandEmit(y.value,c,x.value);switch(d.typeResult){case ae.TOAST:C.add(d.data);break;case ae.TEXT_PRINT:L.open(vo,{data:d.data,props:{maximizable:!0,header:d.data.title}});break;case ae.URL_PRINT:L.open(go,{data:d.data,props:{maximizable:!0,header:d.data.title}});break;case ae.TERM:L.open(Do,{data:d.data,props:{maximizable:!0}});break}}},ke=(c,d)=>{switch(c){case"delete-file-request":d.filePath&&Xe(d.filePath);break;case"upload-file":d.files&&He(d.files);break}},Qe=async c=>{switch(c.typeDialog){case ne.YES_OR_NO_QUESTION:L.open(Oo,{data:c.data,props:{maximizable:!0,header:c.data.title},onClose:d=>{(d?d.data:!1)==!0&&ke(c.data.emit,c.data.args)}});break;case ne.UPLOADFILE:L.open(Co,{data:c.data,props:{maximizable:!0,header:c.data.title},onClose:d=>{const k=d?d.data:void 0;k&&ke(c.data.emit,{files:k})}});break}},Oe=c=>{},Je=()=>{W.value=!W.value,v.value=!v.value},Ge=()=>{$.value=!1,u.value!=null&&(n.value[u.value].config=$o(A.value))},Ze=()=>{if(n.value.length>0&&u.value!==void 0){const c=Fo(n.value[u.value]);c.status==r.SET_WS&&(E.value=c.data)}},Ye=()=>{if(n.value.length>0&&u.value!==void 0){const c=n.value[u.value].config.platform;c!=null&&c!=""?N.value=w.value[c]:N.value=void 0}},et=()=>{u.value!=null&&(y.value=n.value[u.value])};return F(u,()=>{Ze(),Ye(),et()}),F(t,async c=>{const d=await Io(n.value,c||"");d.status==r.REQUEST_SELECT_FILE_IN_TABVIEW&&(u.value=d.data)}),U(async()=>{for(const c of Ke)he(c);Mo(w.value,qo)}),(c,d)=>(O(),I("main",Ho,[p("div",zo,[ue(p("div",{id:"menu_collapse",class:"menu_collapse",onMouseover:d[0]||(d[0]=k=>Oe()),onMouseout:d[1]||(d[1]=k=>Oe())},[d[4]||(d[4]=p("p",null,"Catalejo",-1)),ue(p("div",Qo,[p("div",null,[g(Zt,{plugins:w.value,lang:x.value,workDirPath:l.value,filePathSelected:t.value,onDirconfigUpdate:H,onSaveProjectRequest:D,onNewProjectRequest:_,onDirPathSelected:he,onRunAppFunctionWithDialogRequest:Qe},null,8,["plugins","lang","workDirPath","filePathSelected"])]),p("div",Jo,[g(Wt,{filePaths:o.value,dirPaths:a.value,dirPathsLength:i.value,lang:x.value,onFileSelected:ge,onDirPathSelected:he},null,8,["filePaths","dirPaths","dirPathsLength","lang"])])],512),[[de,W.value]])],544),[[de,W.value]]),p("div",Go,[p("div",Zo,[g(uo,{lang:x.value,plugin:N.value,onMenuToggle:Je,onSaveProjectRequest:D,onCloseProject:oe,onConfigProject:Me,onPluginCommand:ze},null,8,["lang","plugin"])]),p("div",Yo,[g(Mt,{index:u.value,projects:n.value,contentchanges:f.value,lang:x.value,update:v.value,onIndexOfProjectToLoad:J},null,8,["index","projects","contentchanges","lang","update"])]),ue(p("div",ea,[g(ro,{projects:n.value,index:u.value,workspace:E.value,plugin:N.value,update:v.value,onXmltextIndex:m,onBlocklyMounted:qe},null,8,["projects","index","workspace","plugin","update"])],512),[[de,E.value==h(R).BLOCKLY]]),ue(p("div",ta,[g(kt,{projects:n.value,index:u.value,workspace:E.value,update:v.value,onContentCursorIndex:te},null,8,["projects","index","workspace","update"])],512),[[de,E.value==h(R).CODEMIRROR]])]),g(h(ye),{visible:$.value,"onUpdate:visible":d[3]||(d[3]=k=>$.value=k),modal:"",header:M.value,style:{width:"32rem"}},{default:Y(()=>[p("div",null,[(O(!0),I(z,null,le(A.value,k=>(O(),I("div",null,[g(h(fe),{type:"text",size:"small",modelValue:k.label,"onUpdate:modelValue":G=>k.label=G,class:"textInputDialogClass"},null,8,["modelValue","onUpdate:modelValue"]),d[5]||(d[5]=p("span",null,": ",-1)),g(h(fe),{type:"text",size:"small",modelValue:k.value,"onUpdate:modelValue":G=>k.value=G},null,8,["modelValue","onUpdate:modelValue"])]))),256)),g(h(V),{type:"button",label:B.value,severity:"secondary",onClick:d[2]||(d[2]=k=>$.value=!1)},null,8,["label"]),g(h(V),{type:"button",label:q.value,onClick:Ge},null,8,["label"])])]),_:1},8,["visible","header"]),g(h(xe)),g(h(st))]),d[6]||(d[6]=p("div",{id:"log"},null,-1))]))}}),aa=ee(oa,[["__scopeId","data-v-ed5c9240"]]),me=mt(aa);me.use(it);me.use(rt);me.use(ct);me.mount("#app");
|