(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["9746"],{9699:function(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>h,frontMatter:()=>a,metadata:()=>r,assets:()=>l,toc:()=>d,contentTitle:()=>c});var r=JSON.parse('{"id":"features/sync","title":"Sync","description":"LiveCodes local data can be synchronized to a GitHub repo. This can be used as a cloud backup, and to synchronize multiple devices.","source":"@site/docs/features/sync.mdx","sourceDirName":"features","slug":"/features/sync","permalink":"/docs/features/sync","draft":false,"unlisted":false,"editUrl":"https://github.com/live-codes/livecodes/tree/develop/docs/docs/features/sync.mdx","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"Deploy","permalink":"/docs/features/deploy"},"next":{"title":"Broadcast","permalink":"/docs/features/broadcast"}}'),o=n("5893"),s=n("65"),i=n("8500");let a={},c="Sync",l={},d=[{value:"Related",id:"related",level:2}];function u(e){let t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",p:"p",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"sync",children:"Sync"})}),"\n",(0,o.jsx)(t.p,{children:"LiveCodes local data can be synchronized to a GitHub repo. This can be used as a cloud backup, and to synchronize multiple devices."}),"\n",(0,o.jsxs)(t.p,{children:["A GitHub account is required. The user must give access to ",(0,o.jsx)(t.a,{href:"/docs/features/github-integration",children:"(Private Repos) while logging in"}),"."]}),"\n",(0,o.jsx)(t.p,{children:"The Sync screen can be accessed from the Settings menu \u2192 Sync."}),"\n","\n",(0,o.jsx)(i.Z,{params:{screen:"sync"},linkText:"direct link"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{alt:"LiveCodes Sync",src:n(5280).Z+"",width:"2240",height:"1400"})}),"\n",(0,o.jsxs)(t.p,{children:["Data can be synchronized to a new (",(0,o.jsx)(t.strong,{children:"private"}),") or existing repo."]}),"\n",(0,o.jsxs)(t.p,{children:["The data is synchronized with the ",(0,o.jsx)(t.code,{children:"main"})," branch in a directory named ",(0,o.jsx)(t.code,{children:"livecodes-data"}),"."]}),"\n",(0,o.jsxs)(t.p,{children:["If ",(0,o.jsx)(t.code,{children:"Auto sync"})," is selected, the sync will be attempted every 5 minutes. Remote files are downloaded only when changed (e.g. sync from another device)."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"Auto sync"})," can be turned off and on by the switch on the Settings menu."]}),"\n",(0,o.jsx)(t.p,{children:"The sync can be manually triggered at any time from the Sync UI. Information regarding the last sync time and repo are displayed on the UI screen."}),"\n",(0,o.jsx)(t.h2,{id:"related",children:"Related"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/backup-restore",children:"Backup / restore"})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/export",children:"Export"})}),"\n"]})]})}function h(e={}){let{wrapper:t}={...(0,s.a)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(u,{...e})}):u(e)}},5280:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=n.p+"assets/images/sync-42a064ad4a4a9cca908a83f32aef3e51.jpg"},7728:function(e,t,n){e=n.nmd(e);var r=function(){var e=String.fromCharCode,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function o(e,t){if(!r[e]){r[e]={};for(var n=0;n>>8,n[2*r+1]=i%256}return n},decompressFromUint8Array:function(t){if(null==t)return s.decompress(t);for(var n=Array(t.length/2),r=0,o=n.length;rd.charCodeAt(0)){for(r=0;r>=1}else{for(r=0,o=1;r>=1}0==--u&&(u=Math.pow(2,p),p++),delete a[d]}else for(r=0,o=i[d];r>=1;0==--u&&(u=Math.pow(2,p),p++),i[l]=h++,d=String(c)}if(""!==d){if(Object.prototype.hasOwnProperty.call(a,d)){if(256>d.charCodeAt(0)){for(r=0;r>=1}else{for(r=0,o=1;r>=1}0==--u&&(u=Math.pow(2,p),p++),delete a[d]}else for(r=0,o=i[d];r>=1;0==--u&&(u=Math.pow(2,p),p++)}for(r=0,o=2;r>=1;for(;;){if(m<<=1,y==t-1){f.push(n(m));break}y++}return f.join("")},decompress:function(e){return null==e?"":""==e?null:s._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(t,n,r){var o,s,i,a,c,l,d,u=[],h=4,p=4,f=3,m="",y=[],g={val:r(0),position:n,index:1};for(o=0;o<3;o+=1)u[o]=o;for(i=0,c=4,l=1;l!=c;)a=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=r(g.index++)),i|=(a>0?1:0)*l,l<<=1;switch(i){case 0:for(i=0,c=256,l=1;l!=c;)a=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=r(g.index++)),i|=(a>0?1:0)*l,l<<=1;d=e(i);break;case 1:for(i=0,c=65536,l=1;l!=c;)a=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=r(g.index++)),i|=(a>0?1:0)*l,l<<=1;d=e(i);break;case 2:return""}for(u[3]=d,s=d,y.push(d);;){if(g.index>t)return"";for(i=0,c=Math.pow(2,f),l=1;l!=c;)a=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=r(g.index++)),i|=(a>0?1:0)*l,l<<=1;switch(d=i){case 0:for(i=0,c=256,l=1;l!=c;)a=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=r(g.index++)),i|=(a>0?1:0)*l,l<<=1;u[p++]=e(i),d=p-1,h--;break;case 1:for(i=0,c=65536,l=1;l!=c;)a=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=r(g.index++)),i|=(a>0?1:0)*l,l<<=1;u[p++]=e(i),d=p-1,h--;break;case 2:return y.join("")}if(0==h&&(h=Math.pow(2,f),f++),u[d])m=u[d];else{if(d!==p)return null;m=s+s.charAt(0)}y.push(m),u[p++]=s+m.charAt(0),h--,s=m,0==h&&(h=Math.pow(2,f),f++)}}};return s}();"function"==typeof define&&define.amd?define(function(){return r}):null!=e&&(e.exports=r)},8500:function(e,t,n){"use strict";n.d(t,{Z:()=>l});var r=n("5893");n("7294");var o=n("6735");function s(e){let{children:t,fallback:n}=e;return(0,o.Z)()?(0,r.jsx)(r.Fragment,{children:t?.()}):n??null}var i=n("1705"),a=n("8294"),c=n("1858");function l(e){let{params:t,config:n,code:o,language:l="js",codeTitle:d="",showLineNumbers:u=!1,formatCode:h=!0,linkText:p="Run in LiveCodes",style:f={},className:m=""}=e,y=(0,a.r)({appUrl:c.G,params:t,config:n});return(0,r.jsxs)("div",{style:{marginBottom:"30px",...f},className:m,children:[o&&(0,r.jsx)(s,{children:()=>(0,r.jsx)(i.Z,{language:l,title:d,showLineNumbers:u,children:h?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"js";return window.prettier?.format(e,{parser:"html"===t?"html":"babel",plugins:window.prettierPlugins})}(o,l):o})}),(0,r.jsxs)("a",{href:y,target:"_blank",rel:"noreferrer",children:[p,(0,r.jsx)("svg",{width:"12",height:"12","aria-hidden":"true",viewBox:"0 0 24 24",className:"iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module",style:{marginLeft:"4px"},children:(0,r.jsx)("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"})})]})]})}},8294:function(e,t,n){"use strict";n.d(t,{T:function(){return o},r:function(){return s}});var r=n(7728);async function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"!=typeof e||e instanceof HTMLElement||!e.headless&&"headless"!==e.view||(t=e,e=null);let{config:n={},headless:r,loading:o="lazy",view:i}=t,a=r||"headless"===i,c=null,l=null;if("string"==typeof e)c=document.querySelector(e);else if(e instanceof HTMLElement)c=e;else if(!(a&&"object"==typeof e))throw Error("A valid container element is required.");if(!c){if(a)k(c=document.createElement("div")),document.body.appendChild(c);else throw Error(`Cannot find element: "${e}"`)}let d=new URL(s(t)),u=d.origin;d.searchParams.set("embed","true"),d.searchParams.set("loading",a?"eager":o);let h=globalThis.process;d.searchParams.set("sdkVersion",h?.env?.SDK_VERSION||"latest"),"object"==typeof n&&Object.keys(n).length>0&&d.searchParams.set("config","sdk");let p=t.params;"object"==typeof p&&Object.keys(p).length>0&&JSON.stringify(p).length<1800&&Object.keys(p).forEach(e=>{d.searchParams.set(e,encodeURIComponent(String(p[e])))});let f=!1,m="Cannot call API methods after calling `destroy()`.",y=await new Promise(e=>{if(!c)return;let t=c.dataset.height||c.style.height;if(t&&!a){let e=isNaN(Number(t))?t:t+"px";c.style.height=e}"false"===c.dataset.defaultStyles||a||(c.style.backgroundColor||="#fff",c.style.border||="1px solid black",c.style.borderRadius||="8px",c.style.boxSizing||="border-box",c.style.padding||="0",c.style.width||="100%",c.style.height||=c.style.height||"300px",c.style.minHeight="200px",c.style.flexGrow="1",c.style.overflow||="hidden",c.style.resize||="vertical");let r="livecodes",s=c.querySelector(`iframe.${r}`),i=s||document.createElement("iframe");i.classList.add(r),i.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),i.setAttribute("allowtransparency","true"),i.setAttribute("allowpaymentrequest","true"),i.setAttribute("allowfullscreen","true"),i.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts"),i.setAttribute("loading","eager"===o?"eager":"lazy"),a?k(i):(i.style.height="100%",i.style.minHeight="200px",i.style.width="100%",i.style.margin="0",i.style.border="0",i.style.borderRadius=c.style.borderRadius),addEventListener("message",function e(t){t.source===i.contentWindow&&t.origin===u&&t.data?.type==="livecodes-init"&&(removeEventListener("message",e),l=Number(t.data.payload.appVersion.replace(/^v/,"")))}),(!l||l<46)&&addEventListener("message",function e(t){t.source===i.contentWindow&&t.origin===u&&t.data?.type==="livecodes-get-config"&&(removeEventListener("message",e),i.contentWindow?.postMessage({type:"livecodes-config",payload:n},u))}),i.onload=()=>{e(i)},i.src=d.href,s||c.appendChild(i)}),g=new Promise(e=>{addEventListener("message",function t(n){n.source===y.contentWindow&&n.origin===u&&n.data?.type==="livecodes-ready"&&(removeEventListener("message",t),e(),g.settled=!0)})}),v=()=>f?Promise.reject(m):new Promise(async e=>{g.settled&&e(),y.contentWindow?.postMessage({type:"livecodes-load"},u),await g,e()}),w=(e,t)=>new Promise(async(n,r)=>{if(f)return r(m);await v();let o=A();addEventListener("message",function t(s){if(s.source===y.contentWindow&&s.origin===u&&s.data?.type==="livecodes-api-response"&&s.data?.id===o&&s.data.method===e){removeEventListener("message",t);let e=s.data.payload;e?.error?r(e.error):n(e)}}),y.contentWindow?.postMessage({method:e,id:o,args:t},u)}),b={},x=["load","ready","code","console","tests","destroy"],j=(e,t)=>{if(f)throw Error(m);return x.includes(e)?(w("watch",[e]),b[e]||(b[e]=[]),b[e]?.push(t),{remove:()=>{b[e]=b[e]?.filter(e=>e!==t),b[e]?.length===0&&w("watch",[e,"unsubscribe"])}}):{remove:()=>void 0}},C=e=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[e];addEventListener("message",async e=>{let t=C(e.data?.type??"");if(e.source!==y.contentWindow||e.origin!==u||!t||!b[t])return;let n=e.data?.payload;b[t]?.forEach(e=>{e(n)})});let E=()=>{Object.values(b).forEach(e=>{e.length=0}),y?.remove?.(),f=!0};function k(e){e.style.position="absolute",e.style.top="0",e.style.visibility="hidden",e.style.opacity="0"}"lazy"===o&&"IntersectionObserver"in window&&new IntersectionObserver((e,t)=>{e.forEach(async e=>{e.isIntersecting&&(await v(),t.unobserve(c))})},{rootMargin:"150px"}).observe(c);let A=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>v(),run:()=>w("run"),format:e=>w("format",[e]),getShareUrl:e=>w("getShareUrl",[e]),getConfig:e=>w("getConfig",[e]),setConfig:e=>w("setConfig",[e]),getCode:()=>w("getCode"),show:(e,t)=>w("show",[e,t]),runTests:()=>w("runTests"),onChange:e=>j("code",e),watch:j,exec:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rg.settled?w("destroy").then(E):f?Promise.reject(m):(E(),Promise.resolve())}}function s(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{appUrl:n="https://livecodes.io",params:o={},config:s={},headless:i,import:a,lite:c,view:l,...d}=t;try{e=new URL(n)}catch{throw Error(`${n} is not a valid URL.`)}let u=new URLSearchParams;Object.entries(d).forEach(t=>{let[n,r]=t;void 0!==r&&e.searchParams.set(n,String(r))});let h="headless"===t.view||i;if(c&&(console.warn('Deprecation notice: "lite" option is deprecated. Use "config: { mode: \'lite\' }" instead.'),"object"==typeof s&&null==s.mode?s.mode="lite":e.searchParams.set("lite","true")),l&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),"object"==typeof s&&null==s.view&&"headless"!==l?s.view=l:e.searchParams.set("view",l)),"string"==typeof s)try{new URL(s),e.searchParams.set("config",encodeURIComponent(s))}catch{throw Error('"config" is not a valid URL or configuration object.')}else s&&"object"==typeof s&&Object.keys(s).length>0&&(s.title&&"Untitled Project"!==s.title&&e.searchParams.set("title",s.title),s.description&&s.description.length>0&&e.searchParams.set("description",s.description),u.set("config","code/"+(0,r.compressToEncodedURIComponent)(JSON.stringify(s))));if(o&&"object"==typeof o&&Object.keys(o).length>0)try{u.set("params",(0,r.compressToEncodedURIComponent)(JSON.stringify(o)))}catch{Object.keys(o).forEach(t=>{e.searchParams.set(t,encodeURIComponent(String(o[t])))})}return a&&e.searchParams.set("x",encodeURIComponent(a)),h&&e.searchParams.set("headless","true"),e.hash=u.toString(),e.href}},65:function(e,t,n){"use strict";n.d(t,{Z:function(){return a},a:function(){return i}});var r=n(7294);let o={},s=r.createContext(o);function i(e){let t=r.useContext(s);return r.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),r.createElement(s.Provider,{value:t},e.children)}}}]);