+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var Y=Object.create;var D=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ne=(d,m)=>()=>(m||d((m={exports:{}}).exports,m),m.exports),oe=(d,m)=>{for(var b in m)D(d,b,{get:m[b],enumerable:!0})},Z=(d,m,b,y)=>{if(m&&typeof m=="object"||typeof m=="function")for(let L of V(m))!te.call(d,L)&&L!==b&&D(d,L,{get:()=>m[L],enumerable:!(y=F(m,L))||y.enumerable});return d};var se=(d,m,b)=>(b=d!=null?Y(ee(d)):{},Z(m||!d||!d.__esModule?D(b,"default",{value:d,enumerable:!0}):b,d)),re=d=>Z(D({},"__esModule",{value:!0}),d);var $=ne((de,K)=>{var ie=function(){var d=String.fromCharCode,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function L(n,e){if(!y[n]){y[n]={};for(var c=0;c<n.length;c++)y[n][n.charAt(c)]=c}return y[n][e]}var x={compressToBase64:function(n){if(n==null)return"";var e=x._compress(n,6,function(c){return m.charAt(c)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(n){return n==null?"":n==""?null:x._decompress(n.length,32,function(e){return L(m,n.charAt(e))})},compressToUTF16:function(n){return n==null?"":x._compress(n,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(n){return n==null?"":n==""?null:x._decompress(n.length,16384,function(e){return n.charCodeAt(e)-32})},compressToUint8Array:function(n){for(var e=x.compress(n),c=new Uint8Array(e.length*2),t=0,r=e.length;t<r;t++){var h=e.charCodeAt(t);c[t*2]=h>>>8,c[t*2+1]=h%256}return c},decompressFromUint8Array:function(n){if(n==null)return x.decompress(n);for(var e=new Array(n.length/2),c=0,t=e.length;c<t;c++)e[c]=n[c*2]*256+n[c*2+1];var r=[];return e.forEach(function(h){r.push(d(h))}),x.decompress(r.join(""))},compressToEncodedURIComponent:function(n){return n==null?"":x._compress(n,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(n){return n==null?"":n==""?null:(n=n.replace(/ /g,"+"),x._decompress(n.length,32,function(e){return L(b,n.charAt(e))}))},compress:function(n){return x._compress(n,16,function(e){return d(e)})},_compress:function(n,e,c){if(n==null)return"";var t,r,h={},v={},w="",O="",p="",E=2,M=3,a=2,f=[],s=0,o=0,S;for(S=0;S<n.length;S+=1)if(w=n.charAt(S),Object.prototype.hasOwnProperty.call(h,w)||(h[w]=M++,v[w]=!0),O=p+w,Object.prototype.hasOwnProperty.call(h,O))p=O;else{if(Object.prototype.hasOwnProperty.call(v,p)){if(p.charCodeAt(0)<256){for(t=0;t<a;t++)s=s<<1,o==e-1?(o=0,f.push(c(s)),s=0):o++;for(r=p.charCodeAt(0),t=0;t<8;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}else{for(r=1,t=0;t<a;t++)s=s<<1|r,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=0;for(r=p.charCodeAt(0),t=0;t<16;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}E--,E==0&&(E=Math.pow(2,a),a++),delete v[p]}else for(r=h[p],t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;E--,E==0&&(E=Math.pow(2,a),a++),h[O]=M++,p=String(w)}if(p!==""){if(Object.prototype.hasOwnProperty.call(v,p)){if(p.charCodeAt(0)<256){for(t=0;t<a;t++)s=s<<1,o==e-1?(o=0,f.push(c(s)),s=0):o++;for(r=p.charCodeAt(0),t=0;t<8;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}else{for(r=1,t=0;t<a;t++)s=s<<1|r,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=0;for(r=p.charCodeAt(0),t=0;t<16;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}E--,E==0&&(E=Math.pow(2,a),a++),delete v[p]}else for(r=h[p],t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;E--,E==0&&(E=Math.pow(2,a),a++)}for(r=2,t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;for(;;)if(s=s<<1,o==e-1){f.push(c(s));break}else o++;return f.join("")},decompress:function(n){return n==null?"":n==""?null:x._decompress(n.length,32768,function(e){return n.charCodeAt(e)})},_decompress:function(n,e,c){var t=[],r,h=4,v=4,w=3,O="",p=[],E,M,a,f,s,o,S,l={val:c(0),position:e,index:1};for(E=0;E<3;E+=1)t[E]=E;for(a=0,s=Math.pow(2,2),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;switch(r=a){case 0:for(a=0,s=Math.pow(2,8),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;S=d(a);break;case 1:for(a=0,s=Math.pow(2,16),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;S=d(a);break;case 2:return""}for(t[3]=S,M=S,p.push(S);;){if(l.index>n)return"";for(a=0,s=Math.pow(2,w),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;switch(S=a){case 0:for(a=0,s=Math.pow(2,8),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;t[v++]=d(a),S=v-1,h--;break;case 1:for(a=0,s=Math.pow(2,16),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;t[v++]=d(a),S=v-1,h--;break;case 2:return p.join("")}if(h==0&&(h=Math.pow(2,w),w++),t[S])O=t[S];else if(S===v)O=M+M.charAt(0);else return null;p.push(O),t[v++]=M+O.charAt(0),h--,M=O,h==0&&(h=Math.pow(2,w),w++)}}};return x}();typeof K!="undefined"&&K!=null&&(K.exports=ie)});var le={};oe(le,{createPlayground:()=>ae,getPlaygroundUrl:()=>G});module.exports=re(le);var W=se($());async function ae(d,m={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(m=d,d=null);let{config:b={},headless:y,loading:L="lazy",view:x}=m,n=y||x==="headless",e=null,c=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(n&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(n)e=document.createElement("div"),z(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let t=new URL(G(m)),r=t.origin;t.searchParams.set("embed","true"),t.searchParams.set("loading",n?"eager":L),t.searchParams.set("sdkVersion","0.11.1"),typeof b=="object"&&Object.keys(b).length>0&&t.searchParams.set("config","sdk");let h=m.params;typeof h=="object"&&Object.keys(h).length>0&&JSON.stringify(h).length<1800&&Object.keys(h).forEach(i=>{t.searchParams.set(i,encodeURIComponent(String(h[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",p=await new Promise(i=>{var R,U,H,k,T,B,q,J,N;if(!e)return;let g=e.dataset.height||e.style.height;if(g&&!n){let _=isNaN(Number(g))?g:g+"px";e.style.height=_}e.dataset.defaultStyles!=="false"&&!n&&((R=e.style).backgroundColor||(R.backgroundColor="#fff"),(U=e.style).border||(U.border="1px solid black"),(H=e.style).borderRadius||(H.borderRadius="8px"),(k=e.style).boxSizing||(k.boxSizing="border-box"),(T=e.style).padding||(T.padding="0"),(B=e.style).width||(B.width="100%"),(q=e.style).height||(q.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(J=e.style).overflow||(J.overflow="hidden"),(N=e.style).resize||(N.resize="vertical"));let P="livecodes",A=e.querySelector(`iframe.${P}`),u=A||document.createElement("iframe");u.classList.add(P),u.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),u.setAttribute("allowtransparency","true"),u.setAttribute("allowpaymentrequest","true"),u.setAttribute("allowfullscreen","true"),u.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let j=L==="eager"?"eager":"lazy";u.setAttribute("loading",j),n?z(u):(u.style.height="100%",u.style.minHeight="200px",u.style.width="100%",u.style.margin="0",u.style.border="0",u.style.borderRadius=e.style.borderRadius),addEventListener("message",function _(C){var I;C.source!==u.contentWindow||C.origin!==r||((I=C.data)==null?void 0:I.type)!=="livecodes-init"||(removeEventListener("message",_),c=Number(C.data.payload.appVersion.replace(/^v/,"")))}),(!c||c<46)&&addEventListener("message",function _(C){var I,Q;C.source!==u.contentWindow||C.origin!==r||((I=C.data)==null?void 0:I.type)!=="livecodes-get-config"||(removeEventListener("message",_),(Q=u.contentWindow)==null||Q.postMessage({type:"livecodes-config",payload:b},r))}),u.onload=()=>{i(u)},u.src=t.href,A||e.appendChild(u)}),E=new Promise(i=>{addEventListener("message",function g(P){var A;P.source!==p.contentWindow||P.origin!==r||((A=P.data)==null?void 0:A.type)!=="livecodes-ready"||(removeEventListener("message",g),i(),E.settled=!0)})}),M=()=>v?Promise.reject(w):new Promise(async i=>{var P;E.settled&&i();let g={type:"livecodes-load"};(P=p.contentWindow)==null||P.postMessage(g,r),await E,i()}),a=(i,g)=>new Promise(async(P,A)=>{var j;if(v)return A(w);await M();let u=X();addEventListener("message",function R(U){var H,k;if(!(U.source!==p.contentWindow||U.origin!==r||((H=U.data)==null?void 0:H.type)!=="livecodes-api-response"||((k=U.data)==null?void 0:k.id)!==u)&&U.data.method===i){removeEventListener("message",R);let T=U.data.payload;T!=null&&T.error?A(T.error):P(T)}}),(j=p.contentWindow)==null||j.postMessage({method:i,id:u,args:g},r)}),f={},s=["load","ready","code","console","tests","destroy"],o=(i,g)=>{var P;if(v)throw new Error(w);return s.includes(i)?(a("watch",[i]),f[i]||(f[i]=[]),(P=f[i])==null||P.push(g),{remove:()=>{var A,u;f[i]=(A=f[i])==null?void 0:A.filter(j=>j!==g),((u=f[i])==null?void 0:u.length)===0&&a("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},S=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];addEventListener("message",async i=>{var A,u,j,R;let g=S((u=(A=i.data)==null?void 0:A.type)!=null?u:"");if(i.source!==p.contentWindow||i.origin!==r||!g||!f[g])return;let P=(j=i.data)==null?void 0:j.payload;(R=f[g])==null||R.forEach(U=>{U(P)})});let l=()=>{var i;Object.values(f).forEach(g=>{g.length=0}),(i=p==null?void 0:p.remove)==null||i.call(p),v=!0};L==="lazy"&&"IntersectionObserver"in window&&new IntersectionObserver((g,P)=>{g.forEach(async A=>{A.isIntersecting&&(await M(),P.unobserve(e))})},{rootMargin:"150px"}).observe(e);function z(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let X=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>M(),run:()=>a("run"),format:i=>a("format",[i]),getShareUrl:i=>a("getShareUrl",[i]),getConfig:i=>a("getConfig",[i]),setConfig:i=>a("setConfig",[i]),getCode:()=>a("getCode"),show:(i,g)=>a("show",[i,g]),runTests:()=>a("runTests"),onChange:i=>o("code",i),watch:o,exec:(i,...g)=>a("exec",[i,...g]),destroy:()=>E.settled?a("destroy").then(l):v?Promise.reject(w):(l(),Promise.resolve())}}function G(d={}){let{appUrl:m="https://livecodes.io",params:b={},config:y={},headless:L,import:x,lite:n,view:e,...c}=d,t;try{t=new URL(m)}catch(v){throw new Error(`${m} is not a valid URL.`)}let r=new URLSearchParams;Object.entries(c).forEach(([v,w])=>{w!==void 0&&t.searchParams.set(v,String(w))});let h=d.view==="headless"||L;if(n&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":t.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:t.searchParams.set("view",e)),typeof y=="string")try{new URL(y),t.searchParams.set("config",encodeURIComponent(y))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&t.searchParams.set("title",y.title),y.description&&y.description.length>0&&t.searchParams.set("description",y.description),r.set("config","code/"+(0,W.compressToEncodedURIComponent)(JSON.stringify(y))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{r.set("params",(0,W.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(v){Object.keys(b).forEach(w=>{t.searchParams.set(w,encodeURIComponent(String(b[w])))})}return x&&t.searchParams.set("x",encodeURIComponent(x)),h&&t.searchParams.set("headless","true"),t.hash=r.toString(),t.href} | ||
| "use strict";var ee=Object.create;var K=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var se=(c,h)=>()=>(h||c((h={exports:{}}).exports,h),h.exports),ie=(c,h)=>{for(var E in h)K(c,E,{get:h[E],enumerable:!0})},$=(c,h,E,y)=>{if(h&&typeof h=="object"||typeof h=="function")for(let M of ne(h))!re.call(c,M)&&M!==E&&K(c,M,{get:()=>h[M],enumerable:!(y=te(h,M))||y.enumerable});return c};var ae=(c,h,E)=>(E=c!=null?ee(oe(c)):{},$(h||!c||!c.__esModule?K(E,"default",{value:c,enumerable:!0}):E,c)),le=c=>$(K({},"__esModule",{value:!0}),c);var G=se((pe,W)=>{var ce=function(){var c=String.fromCharCode,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function M(r,e){if(!y[r]){y[r]={};for(var l=0;l<r.length;l++)y[r][r.charAt(l)]=l}return y[r][e]}var A={compressToBase64:function(r){if(r==null)return"";var e=A._compress(r,6,function(l){return h.charAt(l)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(r){return r==null?"":r==""?null:A._decompress(r.length,32,function(e){return M(h,r.charAt(e))})},compressToUTF16:function(r){return r==null?"":A._compress(r,15,function(e){return c(e+32)})+" "},decompressFromUTF16:function(r){return r==null?"":r==""?null:A._decompress(r.length,16384,function(e){return r.charCodeAt(e)-32})},compressToUint8Array:function(r){for(var e=A.compress(r),l=new Uint8Array(e.length*2),n=0,s=e.length;n<s;n++){var m=e.charCodeAt(n);l[n*2]=m>>>8,l[n*2+1]=m%256}return l},decompressFromUint8Array:function(r){if(r==null)return A.decompress(r);for(var e=new Array(r.length/2),l=0,n=e.length;l<n;l++)e[l]=r[l*2]*256+r[l*2+1];var s=[];return e.forEach(function(m){s.push(c(m))}),A.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return r==null?"":A._compress(r,6,function(e){return E.charAt(e)})},decompressFromEncodedURIComponent:function(r){return r==null?"":r==""?null:(r=r.replace(/ /g,"+"),A._decompress(r.length,32,function(e){return M(E,r.charAt(e))}))},compress:function(r){return A._compress(r,16,function(e){return c(e)})},_compress:function(r,e,l){if(r==null)return"";var n,s,m={},v={},w="",O="",g="",S=2,P=3,d=2,f=[],t=0,o=0,x;for(x=0;x<r.length;x+=1)if(w=r.charAt(x),Object.prototype.hasOwnProperty.call(m,w)||(m[w]=P++,v[w]=!0),O=g+w,Object.prototype.hasOwnProperty.call(m,O))g=O;else{if(Object.prototype.hasOwnProperty.call(v,g)){if(g.charCodeAt(0)<256){for(n=0;n<d;n++)t=t<<1,o==e-1?(o=0,f.push(l(t)),t=0):o++;for(s=g.charCodeAt(0),n=0;n<8;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}else{for(s=1,n=0;n<d;n++)t=t<<1|s,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=0;for(s=g.charCodeAt(0),n=0;n<16;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}S--,S==0&&(S=Math.pow(2,d),d++),delete v[g]}else for(s=m[g],n=0;n<d;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;S--,S==0&&(S=Math.pow(2,d),d++),m[O]=P++,g=String(w)}if(g!==""){if(Object.prototype.hasOwnProperty.call(v,g)){if(g.charCodeAt(0)<256){for(n=0;n<d;n++)t=t<<1,o==e-1?(o=0,f.push(l(t)),t=0):o++;for(s=g.charCodeAt(0),n=0;n<8;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}else{for(s=1,n=0;n<d;n++)t=t<<1|s,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=0;for(s=g.charCodeAt(0),n=0;n<16;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}S--,S==0&&(S=Math.pow(2,d),d++),delete v[g]}else for(s=m[g],n=0;n<d;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;S--,S==0&&(S=Math.pow(2,d),d++)}for(s=2,n=0;n<d;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;for(;;)if(t=t<<1,o==e-1){f.push(l(t));break}else o++;return f.join("")},decompress:function(r){return r==null?"":r==""?null:A._decompress(r.length,32768,function(e){return r.charCodeAt(e)})},_decompress:function(r,e,l){var n=[],s,m=4,v=4,w=3,O="",g=[],S,P,d,f,t,o,x,a={val:l(0),position:e,index:1};for(S=0;S<3;S+=1)n[S]=S;for(d=0,t=Math.pow(2,2),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;switch(s=d){case 0:for(d=0,t=Math.pow(2,8),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;x=c(d);break;case 1:for(d=0,t=Math.pow(2,16),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;x=c(d);break;case 2:return""}for(n[3]=x,P=x,g.push(x);;){if(a.index>r)return"";for(d=0,t=Math.pow(2,w),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;switch(x=d){case 0:for(d=0,t=Math.pow(2,8),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;n[v++]=c(d),x=v-1,m--;break;case 1:for(d=0,t=Math.pow(2,16),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;n[v++]=c(d),x=v-1,m--;break;case 2:return g.join("")}if(m==0&&(m=Math.pow(2,w),w++),n[x])O=n[x];else if(x===v)O=P+P.charAt(0);else return null;g.push(O),n[v++]=P+O.charAt(0),m--,P=O,m==0&&(m=Math.pow(2,w),w++)}}};return A}();typeof W!="undefined"&&W!=null&&(W.exports=ce)});var fe={};ie(fe,{createPlayground:()=>de,getPlaygroundUrl:()=>X});module.exports=le(fe);var z=ae(G());async function de(c,h={}){typeof c=="object"&&!(c instanceof HTMLElement)&&(c.headless||c.view==="headless")&&(h=c,c=null);let{config:E={},headless:y,loading:M="lazy",view:A}=h,r=y||A==="headless",e=null,l=null;if(typeof c=="string")e=document.querySelector(c);else if(c instanceof HTMLElement)e=c;else if(!(r&&typeof c=="object"))throw new Error("A valid container element is required.");if(!e)if(r)e=document.createElement("div"),B(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${c}"`);let n=new URL(X(h)),s=n.origin;n.searchParams.set("embed","true"),n.searchParams.set("loading",r?"eager":M),n.searchParams.set("sdkVersion","0.12.0"),typeof E=="object"&&Object.keys(E).length>0&&n.searchParams.set("config","sdk");let m=h.params;typeof m=="object"&&Object.keys(m).length>0&&JSON.stringify(m).length<1800&&Object.keys(m).forEach(i=>{n.searchParams.set(i,encodeURIComponent(String(m[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",O=[],g=(i,u="message")=>{addEventListener(u,i),O.push(i)},P=await new Promise(i=>{var C,U,R,k,j,q,J,N,Q;if(!e)return;let u=e.dataset.height||e.style.height;if(u&&!r){let I=isNaN(Number(u))?u:u+"px";e.style.height=I}e.dataset.defaultStyles!=="false"&&!r&&((C=e.style).backgroundColor||(C.backgroundColor="#fff"),(U=e.style).border||(U.border="1px solid black"),(R=e.style).borderRadius||(R.borderRadius="8px"),(k=e.style).boxSizing||(k.boxSizing="border-box"),(j=e.style).padding||(j.padding="0"),(q=e.style).width||(q.width="100%"),(J=e.style).height||(J.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(N=e.style).overflow||(N.overflow="hidden"),(Q=e.style).resize||(Q.resize="vertical"));let b="livecodes",L=e.querySelector(`iframe.${b}`),p=L||document.createElement("iframe");p.classList.add(b),p.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),p.setAttribute("allowtransparency","true"),p.setAttribute("allowpaymentrequest","true"),p.setAttribute("allowfullscreen","true"),p.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let H=M==="eager"?"eager":"lazy";p.setAttribute("loading",H),r?B(p):(p.style.height="100%",p.style.minHeight="200px",p.style.width="100%",p.style.margin="0",p.style.border="0",p.style.borderRadius=e.style.borderRadius),g(function I(T){var _;T.source!==p.contentWindow||T.origin!==s||((_=T.data)==null?void 0:_.type)!=="livecodes-init"||(removeEventListener("message",I),l=Number(T.data.payload.appVersion.replace(/^v/,"")))}),(!l||l<46)&&g(function I(T){var _,Z;T.source!==p.contentWindow||T.origin!==s||((_=T.data)==null?void 0:_.type)!=="livecodes-get-config"||(removeEventListener("message",I),(Z=p.contentWindow)==null||Z.postMessage({type:"livecodes-config",payload:E},s))}),p.onload=()=>{i(p)},p.src=n.href,L||e.appendChild(p)}),d=new Promise(i=>{g(function u(b){var L;b.source!==P.contentWindow||b.origin!==s||((L=b.data)==null?void 0:L.type)!=="livecodes-ready"||(removeEventListener("message",u),i(),d.settled=!0)})}),f=()=>v?Promise.reject(w):new Promise(async i=>{var b;d.settled&&i();let u={type:"livecodes-load"};(b=P.contentWindow)==null||b.postMessage(u,s),await d,i()}),t=(i,u)=>new Promise(async(b,L)=>{var H;if(v)return L(w);await f();let p=V();g(function C(U){var R,k;if(!(U.source!==P.contentWindow||U.origin!==s||((R=U.data)==null?void 0:R.type)!=="livecodes-api-response"||((k=U.data)==null?void 0:k.id)!==p)&&U.data.method===i){removeEventListener("message",C);let j=U.data.payload;j!=null&&j.error?L(j.error):b(j)}}),(H=P.contentWindow)==null||H.postMessage({method:i,id:p,args:u},s)}),o={},x=["load","ready","code","console","tests","destroy"],a=(i,u)=>{var b;if(v)throw new Error(w);return x.includes(i)?(t("watch",[i]),o[i]||(o[i]=[]),(b=o[i])==null||b.push(u),{remove:()=>{var L,p;o[i]=(L=o[i])==null?void 0:L.filter(H=>H!==u),((p=o[i])==null?void 0:p.length)===0&&t("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},Y=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];g(async function(u){var p,H,C,U;let b=Y((H=(p=u.data)==null?void 0:p.type)!=null?H:"");if(u.source!==P.contentWindow||u.origin!==s||!b||!o[b])return;let L=(C=u.data)==null?void 0:C.payload;(U=o[b])==null||U.forEach(R=>{R(L)})});let F=()=>{var i;(i=P==null?void 0:P.remove)==null||i.call(P),Object.values(o).forEach(u=>{u.length=0}),O.forEach(u=>removeEventListener("message",u)),O.length=0,D&&e&&D.unobserve(e),v=!0},D;M==="lazy"&&"IntersectionObserver"in window&&(D=new IntersectionObserver((i,u)=>{i.forEach(async b=>{b.isIntersecting&&(await f(),u.unobserve(e))})},{rootMargin:"150px"}),D.observe(e));function B(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let V=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>f(),run:()=>t("run"),format:i=>t("format",[i]),getShareUrl:i=>t("getShareUrl",[i]),getConfig:i=>t("getConfig",[i]),setConfig:i=>t("setConfig",[i]),getCode:()=>t("getCode"),show:(i,u)=>t("show",[i,u]),runTests:()=>t("runTests"),onChange:i=>a("code",i),watch:a,exec:(i,...u)=>t("exec",[i,...u]),destroy:()=>v?Promise.reject(w):(F(),Promise.resolve())}}function X(c={}){let{appUrl:h="https://livecodes.io",params:E={},config:y={},headless:M,import:A,lite:r,view:e,...l}=c,n;try{n=new URL(h)}catch(v){throw new Error(`${h} is not a valid URL.`)}let s=new URLSearchParams;Object.entries(l).forEach(([v,w])=>{w!==void 0&&n.searchParams.set(v,String(w))});let m=c.view==="headless"||M;if(r&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":n.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:n.searchParams.set("view",e)),typeof y=="string")try{new URL(y),n.searchParams.set("config",encodeURIComponent(y))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&n.searchParams.set("title",y.title),y.description&&y.description.length>0&&n.searchParams.set("description",y.description),s.set("config","code/"+(0,z.compressToEncodedURIComponent)(JSON.stringify(y))));if(E&&typeof E=="object"&&Object.keys(E).length>0)try{s.set("params",(0,z.compressToEncodedURIComponent)(JSON.stringify(E)))}catch(v){Object.keys(E).forEach(w=>{n.searchParams.set(w,encodeURIComponent(String(E[w])))})}return A&&n.searchParams.set("x",encodeURIComponent(A)),m&&n.searchParams.set("headless","true"),s.toString().length>0&&(n.hash=s.toString()),n.href} |
+1
-1
@@ -1,1 +0,1 @@ | ||
| var G=Object.create;var Q=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var ee=(d,g)=>()=>(g||d((g={exports:{}}).exports,g),g.exports);var te=(d,g,b,y)=>{if(g&&typeof g=="object"||typeof g=="function")for(let L of Y(g))!V.call(d,L)&&L!==b&&Q(d,L,{get:()=>g[L],enumerable:!(y=X(g,L))||y.enumerable});return d};var ne=(d,g,b)=>(b=d!=null?G(F(d)):{},te(g||!d||!d.__esModule?Q(b,"default",{value:d,enumerable:!0}):b,d));var Z=ee((ie,D)=>{var oe=function(){var d=String.fromCharCode,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function L(n,e){if(!y[n]){y[n]={};for(var c=0;c<n.length;c++)y[n][n.charAt(c)]=c}return y[n][e]}var x={compressToBase64:function(n){if(n==null)return"";var e=x._compress(n,6,function(c){return g.charAt(c)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(n){return n==null?"":n==""?null:x._decompress(n.length,32,function(e){return L(g,n.charAt(e))})},compressToUTF16:function(n){return n==null?"":x._compress(n,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(n){return n==null?"":n==""?null:x._decompress(n.length,16384,function(e){return n.charCodeAt(e)-32})},compressToUint8Array:function(n){for(var e=x.compress(n),c=new Uint8Array(e.length*2),t=0,r=e.length;t<r;t++){var m=e.charCodeAt(t);c[t*2]=m>>>8,c[t*2+1]=m%256}return c},decompressFromUint8Array:function(n){if(n==null)return x.decompress(n);for(var e=new Array(n.length/2),c=0,t=e.length;c<t;c++)e[c]=n[c*2]*256+n[c*2+1];var r=[];return e.forEach(function(m){r.push(d(m))}),x.decompress(r.join(""))},compressToEncodedURIComponent:function(n){return n==null?"":x._compress(n,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(n){return n==null?"":n==""?null:(n=n.replace(/ /g,"+"),x._decompress(n.length,32,function(e){return L(b,n.charAt(e))}))},compress:function(n){return x._compress(n,16,function(e){return d(e)})},_compress:function(n,e,c){if(n==null)return"";var t,r,m={},v={},w="",O="",p="",E=2,M=3,a=2,f=[],s=0,o=0,S;for(S=0;S<n.length;S+=1)if(w=n.charAt(S),Object.prototype.hasOwnProperty.call(m,w)||(m[w]=M++,v[w]=!0),O=p+w,Object.prototype.hasOwnProperty.call(m,O))p=O;else{if(Object.prototype.hasOwnProperty.call(v,p)){if(p.charCodeAt(0)<256){for(t=0;t<a;t++)s=s<<1,o==e-1?(o=0,f.push(c(s)),s=0):o++;for(r=p.charCodeAt(0),t=0;t<8;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}else{for(r=1,t=0;t<a;t++)s=s<<1|r,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=0;for(r=p.charCodeAt(0),t=0;t<16;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}E--,E==0&&(E=Math.pow(2,a),a++),delete v[p]}else for(r=m[p],t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;E--,E==0&&(E=Math.pow(2,a),a++),m[O]=M++,p=String(w)}if(p!==""){if(Object.prototype.hasOwnProperty.call(v,p)){if(p.charCodeAt(0)<256){for(t=0;t<a;t++)s=s<<1,o==e-1?(o=0,f.push(c(s)),s=0):o++;for(r=p.charCodeAt(0),t=0;t<8;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}else{for(r=1,t=0;t<a;t++)s=s<<1|r,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=0;for(r=p.charCodeAt(0),t=0;t<16;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}E--,E==0&&(E=Math.pow(2,a),a++),delete v[p]}else for(r=m[p],t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;E--,E==0&&(E=Math.pow(2,a),a++)}for(r=2,t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;for(;;)if(s=s<<1,o==e-1){f.push(c(s));break}else o++;return f.join("")},decompress:function(n){return n==null?"":n==""?null:x._decompress(n.length,32768,function(e){return n.charCodeAt(e)})},_decompress:function(n,e,c){var t=[],r,m=4,v=4,w=3,O="",p=[],E,M,a,f,s,o,S,l={val:c(0),position:e,index:1};for(E=0;E<3;E+=1)t[E]=E;for(a=0,s=Math.pow(2,2),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;switch(r=a){case 0:for(a=0,s=Math.pow(2,8),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;S=d(a);break;case 1:for(a=0,s=Math.pow(2,16),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;S=d(a);break;case 2:return""}for(t[3]=S,M=S,p.push(S);;){if(l.index>n)return"";for(a=0,s=Math.pow(2,w),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;switch(S=a){case 0:for(a=0,s=Math.pow(2,8),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;t[v++]=d(a),S=v-1,m--;break;case 1:for(a=0,s=Math.pow(2,16),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;t[v++]=d(a),S=v-1,m--;break;case 2:return p.join("")}if(m==0&&(m=Math.pow(2,w),w++),t[S])O=t[S];else if(S===v)O=M+M.charAt(0);else return null;p.push(O),t[v++]=M+O.charAt(0),m--,M=O,m==0&&(m=Math.pow(2,w),w++)}}};return x}();typeof D!="undefined"&&D!=null&&(D.exports=oe)});var K=ne(Z());async function ae(d,g={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(g=d,d=null);let{config:b={},headless:y,loading:L="lazy",view:x}=g,n=y||x==="headless",e=null,c=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(n&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(n)e=document.createElement("div"),W(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let t=new URL(se(g)),r=t.origin;t.searchParams.set("embed","true"),t.searchParams.set("loading",n?"eager":L),t.searchParams.set("sdkVersion","0.11.1"),typeof b=="object"&&Object.keys(b).length>0&&t.searchParams.set("config","sdk");let m=g.params;typeof m=="object"&&Object.keys(m).length>0&&JSON.stringify(m).length<1800&&Object.keys(m).forEach(i=>{t.searchParams.set(i,encodeURIComponent(String(m[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",p=await new Promise(i=>{var R,U,H,k,T,z,B,q,J;if(!e)return;let h=e.dataset.height||e.style.height;if(h&&!n){let _=isNaN(Number(h))?h:h+"px";e.style.height=_}e.dataset.defaultStyles!=="false"&&!n&&((R=e.style).backgroundColor||(R.backgroundColor="#fff"),(U=e.style).border||(U.border="1px solid black"),(H=e.style).borderRadius||(H.borderRadius="8px"),(k=e.style).boxSizing||(k.boxSizing="border-box"),(T=e.style).padding||(T.padding="0"),(z=e.style).width||(z.width="100%"),(B=e.style).height||(B.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(q=e.style).overflow||(q.overflow="hidden"),(J=e.style).resize||(J.resize="vertical"));let P="livecodes",A=e.querySelector(`iframe.${P}`),u=A||document.createElement("iframe");u.classList.add(P),u.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),u.setAttribute("allowtransparency","true"),u.setAttribute("allowpaymentrequest","true"),u.setAttribute("allowfullscreen","true"),u.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let j=L==="eager"?"eager":"lazy";u.setAttribute("loading",j),n?W(u):(u.style.height="100%",u.style.minHeight="200px",u.style.width="100%",u.style.margin="0",u.style.border="0",u.style.borderRadius=e.style.borderRadius),addEventListener("message",function _(C){var I;C.source!==u.contentWindow||C.origin!==r||((I=C.data)==null?void 0:I.type)!=="livecodes-init"||(removeEventListener("message",_),c=Number(C.data.payload.appVersion.replace(/^v/,"")))}),(!c||c<46)&&addEventListener("message",function _(C){var I,N;C.source!==u.contentWindow||C.origin!==r||((I=C.data)==null?void 0:I.type)!=="livecodes-get-config"||(removeEventListener("message",_),(N=u.contentWindow)==null||N.postMessage({type:"livecodes-config",payload:b},r))}),u.onload=()=>{i(u)},u.src=t.href,A||e.appendChild(u)}),E=new Promise(i=>{addEventListener("message",function h(P){var A;P.source!==p.contentWindow||P.origin!==r||((A=P.data)==null?void 0:A.type)!=="livecodes-ready"||(removeEventListener("message",h),i(),E.settled=!0)})}),M=()=>v?Promise.reject(w):new Promise(async i=>{var P;E.settled&&i();let h={type:"livecodes-load"};(P=p.contentWindow)==null||P.postMessage(h,r),await E,i()}),a=(i,h)=>new Promise(async(P,A)=>{var j;if(v)return A(w);await M();let u=$();addEventListener("message",function R(U){var H,k;if(!(U.source!==p.contentWindow||U.origin!==r||((H=U.data)==null?void 0:H.type)!=="livecodes-api-response"||((k=U.data)==null?void 0:k.id)!==u)&&U.data.method===i){removeEventListener("message",R);let T=U.data.payload;T!=null&&T.error?A(T.error):P(T)}}),(j=p.contentWindow)==null||j.postMessage({method:i,id:u,args:h},r)}),f={},s=["load","ready","code","console","tests","destroy"],o=(i,h)=>{var P;if(v)throw new Error(w);return s.includes(i)?(a("watch",[i]),f[i]||(f[i]=[]),(P=f[i])==null||P.push(h),{remove:()=>{var A,u;f[i]=(A=f[i])==null?void 0:A.filter(j=>j!==h),((u=f[i])==null?void 0:u.length)===0&&a("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},S=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];addEventListener("message",async i=>{var A,u,j,R;let h=S((u=(A=i.data)==null?void 0:A.type)!=null?u:"");if(i.source!==p.contentWindow||i.origin!==r||!h||!f[h])return;let P=(j=i.data)==null?void 0:j.payload;(R=f[h])==null||R.forEach(U=>{U(P)})});let l=()=>{var i;Object.values(f).forEach(h=>{h.length=0}),(i=p==null?void 0:p.remove)==null||i.call(p),v=!0};L==="lazy"&&"IntersectionObserver"in window&&new IntersectionObserver((h,P)=>{h.forEach(async A=>{A.isIntersecting&&(await M(),P.unobserve(e))})},{rootMargin:"150px"}).observe(e);function W(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let $=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>M(),run:()=>a("run"),format:i=>a("format",[i]),getShareUrl:i=>a("getShareUrl",[i]),getConfig:i=>a("getConfig",[i]),setConfig:i=>a("setConfig",[i]),getCode:()=>a("getCode"),show:(i,h)=>a("show",[i,h]),runTests:()=>a("runTests"),onChange:i=>o("code",i),watch:o,exec:(i,...h)=>a("exec",[i,...h]),destroy:()=>E.settled?a("destroy").then(l):v?Promise.reject(w):(l(),Promise.resolve())}}function se(d={}){let{appUrl:g="https://livecodes.io",params:b={},config:y={},headless:L,import:x,lite:n,view:e,...c}=d,t;try{t=new URL(g)}catch(v){throw new Error(`${g} is not a valid URL.`)}let r=new URLSearchParams;Object.entries(c).forEach(([v,w])=>{w!==void 0&&t.searchParams.set(v,String(w))});let m=d.view==="headless"||L;if(n&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":t.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:t.searchParams.set("view",e)),typeof y=="string")try{new URL(y),t.searchParams.set("config",encodeURIComponent(y))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&t.searchParams.set("title",y.title),y.description&&y.description.length>0&&t.searchParams.set("description",y.description),r.set("config","code/"+(0,K.compressToEncodedURIComponent)(JSON.stringify(y))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{r.set("params",(0,K.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(v){Object.keys(b).forEach(w=>{t.searchParams.set(w,encodeURIComponent(String(b[w])))})}return x&&t.searchParams.set("x",encodeURIComponent(x)),m&&t.searchParams.set("headless","true"),t.hash=r.toString(),t.href}export{ae as createPlayground,se as getPlaygroundUrl}; | ||
| var F=Object.create;var Z=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var oe=(d,g)=>()=>(g||d((g={exports:{}}).exports,g),g.exports);var re=(d,g,b,y)=>{if(g&&typeof g=="object"||typeof g=="function")for(let M of ee(g))!ne.call(d,M)&&M!==b&&Z(d,M,{get:()=>g[M],enumerable:!(y=V(g,M))||y.enumerable});return d};var se=(d,g,b)=>(b=d!=null?F(te(d)):{},re(g||!d||!d.__esModule?Z(b,"default",{value:d,enumerable:!0}):b,d));var $=oe((ce,K)=>{var ie=function(){var d=String.fromCharCode,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function M(r,e){if(!y[r]){y[r]={};for(var l=0;l<r.length;l++)y[r][r.charAt(l)]=l}return y[r][e]}var A={compressToBase64:function(r){if(r==null)return"";var e=A._compress(r,6,function(l){return g.charAt(l)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(r){return r==null?"":r==""?null:A._decompress(r.length,32,function(e){return M(g,r.charAt(e))})},compressToUTF16:function(r){return r==null?"":A._compress(r,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(r){return r==null?"":r==""?null:A._decompress(r.length,16384,function(e){return r.charCodeAt(e)-32})},compressToUint8Array:function(r){for(var e=A.compress(r),l=new Uint8Array(e.length*2),n=0,s=e.length;n<s;n++){var h=e.charCodeAt(n);l[n*2]=h>>>8,l[n*2+1]=h%256}return l},decompressFromUint8Array:function(r){if(r==null)return A.decompress(r);for(var e=new Array(r.length/2),l=0,n=e.length;l<n;l++)e[l]=r[l*2]*256+r[l*2+1];var s=[];return e.forEach(function(h){s.push(d(h))}),A.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return r==null?"":A._compress(r,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(r){return r==null?"":r==""?null:(r=r.replace(/ /g,"+"),A._decompress(r.length,32,function(e){return M(b,r.charAt(e))}))},compress:function(r){return A._compress(r,16,function(e){return d(e)})},_compress:function(r,e,l){if(r==null)return"";var n,s,h={},v={},w="",O="",m="",S=2,P=3,c=2,f=[],t=0,o=0,x;for(x=0;x<r.length;x+=1)if(w=r.charAt(x),Object.prototype.hasOwnProperty.call(h,w)||(h[w]=P++,v[w]=!0),O=m+w,Object.prototype.hasOwnProperty.call(h,O))m=O;else{if(Object.prototype.hasOwnProperty.call(v,m)){if(m.charCodeAt(0)<256){for(n=0;n<c;n++)t=t<<1,o==e-1?(o=0,f.push(l(t)),t=0):o++;for(s=m.charCodeAt(0),n=0;n<8;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}else{for(s=1,n=0;n<c;n++)t=t<<1|s,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=0;for(s=m.charCodeAt(0),n=0;n<16;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}S--,S==0&&(S=Math.pow(2,c),c++),delete v[m]}else for(s=h[m],n=0;n<c;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;S--,S==0&&(S=Math.pow(2,c),c++),h[O]=P++,m=String(w)}if(m!==""){if(Object.prototype.hasOwnProperty.call(v,m)){if(m.charCodeAt(0)<256){for(n=0;n<c;n++)t=t<<1,o==e-1?(o=0,f.push(l(t)),t=0):o++;for(s=m.charCodeAt(0),n=0;n<8;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}else{for(s=1,n=0;n<c;n++)t=t<<1|s,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=0;for(s=m.charCodeAt(0),n=0;n<16;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}S--,S==0&&(S=Math.pow(2,c),c++),delete v[m]}else for(s=h[m],n=0;n<c;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;S--,S==0&&(S=Math.pow(2,c),c++)}for(s=2,n=0;n<c;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;for(;;)if(t=t<<1,o==e-1){f.push(l(t));break}else o++;return f.join("")},decompress:function(r){return r==null?"":r==""?null:A._decompress(r.length,32768,function(e){return r.charCodeAt(e)})},_decompress:function(r,e,l){var n=[],s,h=4,v=4,w=3,O="",m=[],S,P,c,f,t,o,x,a={val:l(0),position:e,index:1};for(S=0;S<3;S+=1)n[S]=S;for(c=0,t=Math.pow(2,2),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),c|=(f>0?1:0)*o,o<<=1;switch(s=c){case 0:for(c=0,t=Math.pow(2,8),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),c|=(f>0?1:0)*o,o<<=1;x=d(c);break;case 1:for(c=0,t=Math.pow(2,16),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),c|=(f>0?1:0)*o,o<<=1;x=d(c);break;case 2:return""}for(n[3]=x,P=x,m.push(x);;){if(a.index>r)return"";for(c=0,t=Math.pow(2,w),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),c|=(f>0?1:0)*o,o<<=1;switch(x=c){case 0:for(c=0,t=Math.pow(2,8),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),c|=(f>0?1:0)*o,o<<=1;n[v++]=d(c),x=v-1,h--;break;case 1:for(c=0,t=Math.pow(2,16),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),c|=(f>0?1:0)*o,o<<=1;n[v++]=d(c),x=v-1,h--;break;case 2:return m.join("")}if(h==0&&(h=Math.pow(2,w),w++),n[x])O=n[x];else if(x===v)O=P+P.charAt(0);else return null;m.push(O),n[v++]=P+O.charAt(0),h--,P=O,h==0&&(h=Math.pow(2,w),w++)}}};return A}();typeof K!="undefined"&&K!=null&&(K.exports=ie)});var W=se($());async function de(d,g={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(g=d,d=null);let{config:b={},headless:y,loading:M="lazy",view:A}=g,r=y||A==="headless",e=null,l=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(r&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(r)e=document.createElement("div"),z(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let n=new URL(ae(g)),s=n.origin;n.searchParams.set("embed","true"),n.searchParams.set("loading",r?"eager":M),n.searchParams.set("sdkVersion","0.12.0"),typeof b=="object"&&Object.keys(b).length>0&&n.searchParams.set("config","sdk");let h=g.params;typeof h=="object"&&Object.keys(h).length>0&&JSON.stringify(h).length<1800&&Object.keys(h).forEach(i=>{n.searchParams.set(i,encodeURIComponent(String(h[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",O=[],m=(i,u="message")=>{addEventListener(u,i),O.push(i)},P=await new Promise(i=>{var C,U,R,k,j,B,q,J,N;if(!e)return;let u=e.dataset.height||e.style.height;if(u&&!r){let I=isNaN(Number(u))?u:u+"px";e.style.height=I}e.dataset.defaultStyles!=="false"&&!r&&((C=e.style).backgroundColor||(C.backgroundColor="#fff"),(U=e.style).border||(U.border="1px solid black"),(R=e.style).borderRadius||(R.borderRadius="8px"),(k=e.style).boxSizing||(k.boxSizing="border-box"),(j=e.style).padding||(j.padding="0"),(B=e.style).width||(B.width="100%"),(q=e.style).height||(q.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(J=e.style).overflow||(J.overflow="hidden"),(N=e.style).resize||(N.resize="vertical"));let E="livecodes",L=e.querySelector(`iframe.${E}`),p=L||document.createElement("iframe");p.classList.add(E),p.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),p.setAttribute("allowtransparency","true"),p.setAttribute("allowpaymentrequest","true"),p.setAttribute("allowfullscreen","true"),p.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let H=M==="eager"?"eager":"lazy";p.setAttribute("loading",H),r?z(p):(p.style.height="100%",p.style.minHeight="200px",p.style.width="100%",p.style.margin="0",p.style.border="0",p.style.borderRadius=e.style.borderRadius),m(function I(T){var _;T.source!==p.contentWindow||T.origin!==s||((_=T.data)==null?void 0:_.type)!=="livecodes-init"||(removeEventListener("message",I),l=Number(T.data.payload.appVersion.replace(/^v/,"")))}),(!l||l<46)&&m(function I(T){var _,Q;T.source!==p.contentWindow||T.origin!==s||((_=T.data)==null?void 0:_.type)!=="livecodes-get-config"||(removeEventListener("message",I),(Q=p.contentWindow)==null||Q.postMessage({type:"livecodes-config",payload:b},s))}),p.onload=()=>{i(p)},p.src=n.href,L||e.appendChild(p)}),c=new Promise(i=>{m(function u(E){var L;E.source!==P.contentWindow||E.origin!==s||((L=E.data)==null?void 0:L.type)!=="livecodes-ready"||(removeEventListener("message",u),i(),c.settled=!0)})}),f=()=>v?Promise.reject(w):new Promise(async i=>{var E;c.settled&&i();let u={type:"livecodes-load"};(E=P.contentWindow)==null||E.postMessage(u,s),await c,i()}),t=(i,u)=>new Promise(async(E,L)=>{var H;if(v)return L(w);await f();let p=Y();m(function C(U){var R,k;if(!(U.source!==P.contentWindow||U.origin!==s||((R=U.data)==null?void 0:R.type)!=="livecodes-api-response"||((k=U.data)==null?void 0:k.id)!==p)&&U.data.method===i){removeEventListener("message",C);let j=U.data.payload;j!=null&&j.error?L(j.error):E(j)}}),(H=P.contentWindow)==null||H.postMessage({method:i,id:p,args:u},s)}),o={},x=["load","ready","code","console","tests","destroy"],a=(i,u)=>{var E;if(v)throw new Error(w);return x.includes(i)?(t("watch",[i]),o[i]||(o[i]=[]),(E=o[i])==null||E.push(u),{remove:()=>{var L,p;o[i]=(L=o[i])==null?void 0:L.filter(H=>H!==u),((p=o[i])==null?void 0:p.length)===0&&t("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},G=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];m(async function(u){var p,H,C,U;let E=G((H=(p=u.data)==null?void 0:p.type)!=null?H:"");if(u.source!==P.contentWindow||u.origin!==s||!E||!o[E])return;let L=(C=u.data)==null?void 0:C.payload;(U=o[E])==null||U.forEach(R=>{R(L)})});let X=()=>{var i;(i=P==null?void 0:P.remove)==null||i.call(P),Object.values(o).forEach(u=>{u.length=0}),O.forEach(u=>removeEventListener("message",u)),O.length=0,D&&e&&D.unobserve(e),v=!0},D;M==="lazy"&&"IntersectionObserver"in window&&(D=new IntersectionObserver((i,u)=>{i.forEach(async E=>{E.isIntersecting&&(await f(),u.unobserve(e))})},{rootMargin:"150px"}),D.observe(e));function z(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let Y=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>f(),run:()=>t("run"),format:i=>t("format",[i]),getShareUrl:i=>t("getShareUrl",[i]),getConfig:i=>t("getConfig",[i]),setConfig:i=>t("setConfig",[i]),getCode:()=>t("getCode"),show:(i,u)=>t("show",[i,u]),runTests:()=>t("runTests"),onChange:i=>a("code",i),watch:a,exec:(i,...u)=>t("exec",[i,...u]),destroy:()=>v?Promise.reject(w):(X(),Promise.resolve())}}function ae(d={}){let{appUrl:g="https://livecodes.io",params:b={},config:y={},headless:M,import:A,lite:r,view:e,...l}=d,n;try{n=new URL(g)}catch(v){throw new Error(`${g} is not a valid URL.`)}let s=new URLSearchParams;Object.entries(l).forEach(([v,w])=>{w!==void 0&&n.searchParams.set(v,String(w))});let h=d.view==="headless"||M;if(r&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":n.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:n.searchParams.set("view",e)),typeof y=="string")try{new URL(y),n.searchParams.set("config",encodeURIComponent(y))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&n.searchParams.set("title",y.title),y.description&&y.description.length>0&&n.searchParams.set("description",y.description),s.set("config","code/"+(0,W.compressToEncodedURIComponent)(JSON.stringify(y))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{s.set("params",(0,W.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(v){Object.keys(b).forEach(w=>{n.searchParams.set(w,encodeURIComponent(String(b[w])))})}return A&&n.searchParams.set("x",encodeURIComponent(A)),h&&n.searchParams.set("headless","true"),s.toString().length>0&&(n.hash=s.toString()),n.href}export{de as createPlayground,ae as getPlaygroundUrl}; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var livecodes=(()=>{var Y=Object.create;var D=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ne=(d,m)=>()=>(m||d((m={exports:{}}).exports,m),m.exports),oe=(d,m)=>{for(var b in m)D(d,b,{get:m[b],enumerable:!0})},Z=(d,m,b,y)=>{if(m&&typeof m=="object"||typeof m=="function")for(let L of V(m))!te.call(d,L)&&L!==b&&D(d,L,{get:()=>m[L],enumerable:!(y=F(m,L))||y.enumerable});return d};var se=(d,m,b)=>(b=d!=null?Y(ee(d)):{},Z(m||!d||!d.__esModule?D(b,"default",{value:d,enumerable:!0}):b,d)),re=d=>Z(D({},"__esModule",{value:!0}),d);var $=ne((de,K)=>{var ie=function(){var d=String.fromCharCode,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function L(n,e){if(!y[n]){y[n]={};for(var c=0;c<n.length;c++)y[n][n.charAt(c)]=c}return y[n][e]}var x={compressToBase64:function(n){if(n==null)return"";var e=x._compress(n,6,function(c){return m.charAt(c)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(n){return n==null?"":n==""?null:x._decompress(n.length,32,function(e){return L(m,n.charAt(e))})},compressToUTF16:function(n){return n==null?"":x._compress(n,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(n){return n==null?"":n==""?null:x._decompress(n.length,16384,function(e){return n.charCodeAt(e)-32})},compressToUint8Array:function(n){for(var e=x.compress(n),c=new Uint8Array(e.length*2),t=0,r=e.length;t<r;t++){var h=e.charCodeAt(t);c[t*2]=h>>>8,c[t*2+1]=h%256}return c},decompressFromUint8Array:function(n){if(n==null)return x.decompress(n);for(var e=new Array(n.length/2),c=0,t=e.length;c<t;c++)e[c]=n[c*2]*256+n[c*2+1];var r=[];return e.forEach(function(h){r.push(d(h))}),x.decompress(r.join(""))},compressToEncodedURIComponent:function(n){return n==null?"":x._compress(n,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(n){return n==null?"":n==""?null:(n=n.replace(/ /g,"+"),x._decompress(n.length,32,function(e){return L(b,n.charAt(e))}))},compress:function(n){return x._compress(n,16,function(e){return d(e)})},_compress:function(n,e,c){if(n==null)return"";var t,r,h={},v={},w="",O="",p="",E=2,M=3,a=2,f=[],s=0,o=0,S;for(S=0;S<n.length;S+=1)if(w=n.charAt(S),Object.prototype.hasOwnProperty.call(h,w)||(h[w]=M++,v[w]=!0),O=p+w,Object.prototype.hasOwnProperty.call(h,O))p=O;else{if(Object.prototype.hasOwnProperty.call(v,p)){if(p.charCodeAt(0)<256){for(t=0;t<a;t++)s=s<<1,o==e-1?(o=0,f.push(c(s)),s=0):o++;for(r=p.charCodeAt(0),t=0;t<8;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}else{for(r=1,t=0;t<a;t++)s=s<<1|r,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=0;for(r=p.charCodeAt(0),t=0;t<16;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}E--,E==0&&(E=Math.pow(2,a),a++),delete v[p]}else for(r=h[p],t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;E--,E==0&&(E=Math.pow(2,a),a++),h[O]=M++,p=String(w)}if(p!==""){if(Object.prototype.hasOwnProperty.call(v,p)){if(p.charCodeAt(0)<256){for(t=0;t<a;t++)s=s<<1,o==e-1?(o=0,f.push(c(s)),s=0):o++;for(r=p.charCodeAt(0),t=0;t<8;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}else{for(r=1,t=0;t<a;t++)s=s<<1|r,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=0;for(r=p.charCodeAt(0),t=0;t<16;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1}E--,E==0&&(E=Math.pow(2,a),a++),delete v[p]}else for(r=h[p],t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;E--,E==0&&(E=Math.pow(2,a),a++)}for(r=2,t=0;t<a;t++)s=s<<1|r&1,o==e-1?(o=0,f.push(c(s)),s=0):o++,r=r>>1;for(;;)if(s=s<<1,o==e-1){f.push(c(s));break}else o++;return f.join("")},decompress:function(n){return n==null?"":n==""?null:x._decompress(n.length,32768,function(e){return n.charCodeAt(e)})},_decompress:function(n,e,c){var t=[],r,h=4,v=4,w=3,O="",p=[],E,M,a,f,s,o,S,l={val:c(0),position:e,index:1};for(E=0;E<3;E+=1)t[E]=E;for(a=0,s=Math.pow(2,2),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;switch(r=a){case 0:for(a=0,s=Math.pow(2,8),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;S=d(a);break;case 1:for(a=0,s=Math.pow(2,16),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;S=d(a);break;case 2:return""}for(t[3]=S,M=S,p.push(S);;){if(l.index>n)return"";for(a=0,s=Math.pow(2,w),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;switch(S=a){case 0:for(a=0,s=Math.pow(2,8),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;t[v++]=d(a),S=v-1,h--;break;case 1:for(a=0,s=Math.pow(2,16),o=1;o!=s;)f=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(f>0?1:0)*o,o<<=1;t[v++]=d(a),S=v-1,h--;break;case 2:return p.join("")}if(h==0&&(h=Math.pow(2,w),w++),t[S])O=t[S];else if(S===v)O=M+M.charAt(0);else return null;p.push(O),t[v++]=M+O.charAt(0),h--,M=O,h==0&&(h=Math.pow(2,w),w++)}}};return x}();typeof K!="undefined"&&K!=null&&(K.exports=ie)});var le={};oe(le,{createPlayground:()=>ae,getPlaygroundUrl:()=>G});var W=se($());async function ae(d,m={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(m=d,d=null);let{config:b={},headless:y,loading:L="lazy",view:x}=m,n=y||x==="headless",e=null,c=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(n&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(n)e=document.createElement("div"),z(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let t=new URL(G(m)),r=t.origin;t.searchParams.set("embed","true"),t.searchParams.set("loading",n?"eager":L),t.searchParams.set("sdkVersion","0.11.1"),typeof b=="object"&&Object.keys(b).length>0&&t.searchParams.set("config","sdk");let h=m.params;typeof h=="object"&&Object.keys(h).length>0&&JSON.stringify(h).length<1800&&Object.keys(h).forEach(i=>{t.searchParams.set(i,encodeURIComponent(String(h[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",p=await new Promise(i=>{var R,U,H,k,T,B,q,J,N;if(!e)return;let g=e.dataset.height||e.style.height;if(g&&!n){let _=isNaN(Number(g))?g:g+"px";e.style.height=_}e.dataset.defaultStyles!=="false"&&!n&&((R=e.style).backgroundColor||(R.backgroundColor="#fff"),(U=e.style).border||(U.border="1px solid black"),(H=e.style).borderRadius||(H.borderRadius="8px"),(k=e.style).boxSizing||(k.boxSizing="border-box"),(T=e.style).padding||(T.padding="0"),(B=e.style).width||(B.width="100%"),(q=e.style).height||(q.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(J=e.style).overflow||(J.overflow="hidden"),(N=e.style).resize||(N.resize="vertical"));let P="livecodes",A=e.querySelector(`iframe.${P}`),u=A||document.createElement("iframe");u.classList.add(P),u.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),u.setAttribute("allowtransparency","true"),u.setAttribute("allowpaymentrequest","true"),u.setAttribute("allowfullscreen","true"),u.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let j=L==="eager"?"eager":"lazy";u.setAttribute("loading",j),n?z(u):(u.style.height="100%",u.style.minHeight="200px",u.style.width="100%",u.style.margin="0",u.style.border="0",u.style.borderRadius=e.style.borderRadius),addEventListener("message",function _(C){var I;C.source!==u.contentWindow||C.origin!==r||((I=C.data)==null?void 0:I.type)!=="livecodes-init"||(removeEventListener("message",_),c=Number(C.data.payload.appVersion.replace(/^v/,"")))}),(!c||c<46)&&addEventListener("message",function _(C){var I,Q;C.source!==u.contentWindow||C.origin!==r||((I=C.data)==null?void 0:I.type)!=="livecodes-get-config"||(removeEventListener("message",_),(Q=u.contentWindow)==null||Q.postMessage({type:"livecodes-config",payload:b},r))}),u.onload=()=>{i(u)},u.src=t.href,A||e.appendChild(u)}),E=new Promise(i=>{addEventListener("message",function g(P){var A;P.source!==p.contentWindow||P.origin!==r||((A=P.data)==null?void 0:A.type)!=="livecodes-ready"||(removeEventListener("message",g),i(),E.settled=!0)})}),M=()=>v?Promise.reject(w):new Promise(async i=>{var P;E.settled&&i();let g={type:"livecodes-load"};(P=p.contentWindow)==null||P.postMessage(g,r),await E,i()}),a=(i,g)=>new Promise(async(P,A)=>{var j;if(v)return A(w);await M();let u=X();addEventListener("message",function R(U){var H,k;if(!(U.source!==p.contentWindow||U.origin!==r||((H=U.data)==null?void 0:H.type)!=="livecodes-api-response"||((k=U.data)==null?void 0:k.id)!==u)&&U.data.method===i){removeEventListener("message",R);let T=U.data.payload;T!=null&&T.error?A(T.error):P(T)}}),(j=p.contentWindow)==null||j.postMessage({method:i,id:u,args:g},r)}),f={},s=["load","ready","code","console","tests","destroy"],o=(i,g)=>{var P;if(v)throw new Error(w);return s.includes(i)?(a("watch",[i]),f[i]||(f[i]=[]),(P=f[i])==null||P.push(g),{remove:()=>{var A,u;f[i]=(A=f[i])==null?void 0:A.filter(j=>j!==g),((u=f[i])==null?void 0:u.length)===0&&a("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},S=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];addEventListener("message",async i=>{var A,u,j,R;let g=S((u=(A=i.data)==null?void 0:A.type)!=null?u:"");if(i.source!==p.contentWindow||i.origin!==r||!g||!f[g])return;let P=(j=i.data)==null?void 0:j.payload;(R=f[g])==null||R.forEach(U=>{U(P)})});let l=()=>{var i;Object.values(f).forEach(g=>{g.length=0}),(i=p==null?void 0:p.remove)==null||i.call(p),v=!0};L==="lazy"&&"IntersectionObserver"in window&&new IntersectionObserver((g,P)=>{g.forEach(async A=>{A.isIntersecting&&(await M(),P.unobserve(e))})},{rootMargin:"150px"}).observe(e);function z(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let X=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>M(),run:()=>a("run"),format:i=>a("format",[i]),getShareUrl:i=>a("getShareUrl",[i]),getConfig:i=>a("getConfig",[i]),setConfig:i=>a("setConfig",[i]),getCode:()=>a("getCode"),show:(i,g)=>a("show",[i,g]),runTests:()=>a("runTests"),onChange:i=>o("code",i),watch:o,exec:(i,...g)=>a("exec",[i,...g]),destroy:()=>E.settled?a("destroy").then(l):v?Promise.reject(w):(l(),Promise.resolve())}}function G(d={}){let{appUrl:m="https://livecodes.io",params:b={},config:y={},headless:L,import:x,lite:n,view:e,...c}=d,t;try{t=new URL(m)}catch(v){throw new Error(`${m} is not a valid URL.`)}let r=new URLSearchParams;Object.entries(c).forEach(([v,w])=>{w!==void 0&&t.searchParams.set(v,String(w))});let h=d.view==="headless"||L;if(n&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":t.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:t.searchParams.set("view",e)),typeof y=="string")try{new URL(y),t.searchParams.set("config",encodeURIComponent(y))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&t.searchParams.set("title",y.title),y.description&&y.description.length>0&&t.searchParams.set("description",y.description),r.set("config","code/"+(0,W.compressToEncodedURIComponent)(JSON.stringify(y))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{r.set("params",(0,W.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(v){Object.keys(b).forEach(w=>{t.searchParams.set(w,encodeURIComponent(String(b[w])))})}return x&&t.searchParams.set("x",encodeURIComponent(x)),h&&t.searchParams.set("headless","true"),t.hash=r.toString(),t.href}return re(le);})(); | ||
| "use strict";var livecodes=(()=>{var ee=Object.create;var K=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var se=(c,h)=>()=>(h||c((h={exports:{}}).exports,h),h.exports),ie=(c,h)=>{for(var E in h)K(c,E,{get:h[E],enumerable:!0})},$=(c,h,E,y)=>{if(h&&typeof h=="object"||typeof h=="function")for(let M of ne(h))!re.call(c,M)&&M!==E&&K(c,M,{get:()=>h[M],enumerable:!(y=te(h,M))||y.enumerable});return c};var ae=(c,h,E)=>(E=c!=null?ee(oe(c)):{},$(h||!c||!c.__esModule?K(E,"default",{value:c,enumerable:!0}):E,c)),le=c=>$(K({},"__esModule",{value:!0}),c);var G=se((pe,W)=>{var ce=function(){var c=String.fromCharCode,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function M(r,e){if(!y[r]){y[r]={};for(var l=0;l<r.length;l++)y[r][r.charAt(l)]=l}return y[r][e]}var A={compressToBase64:function(r){if(r==null)return"";var e=A._compress(r,6,function(l){return h.charAt(l)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(r){return r==null?"":r==""?null:A._decompress(r.length,32,function(e){return M(h,r.charAt(e))})},compressToUTF16:function(r){return r==null?"":A._compress(r,15,function(e){return c(e+32)})+" "},decompressFromUTF16:function(r){return r==null?"":r==""?null:A._decompress(r.length,16384,function(e){return r.charCodeAt(e)-32})},compressToUint8Array:function(r){for(var e=A.compress(r),l=new Uint8Array(e.length*2),n=0,s=e.length;n<s;n++){var m=e.charCodeAt(n);l[n*2]=m>>>8,l[n*2+1]=m%256}return l},decompressFromUint8Array:function(r){if(r==null)return A.decompress(r);for(var e=new Array(r.length/2),l=0,n=e.length;l<n;l++)e[l]=r[l*2]*256+r[l*2+1];var s=[];return e.forEach(function(m){s.push(c(m))}),A.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return r==null?"":A._compress(r,6,function(e){return E.charAt(e)})},decompressFromEncodedURIComponent:function(r){return r==null?"":r==""?null:(r=r.replace(/ /g,"+"),A._decompress(r.length,32,function(e){return M(E,r.charAt(e))}))},compress:function(r){return A._compress(r,16,function(e){return c(e)})},_compress:function(r,e,l){if(r==null)return"";var n,s,m={},v={},w="",O="",g="",S=2,P=3,d=2,f=[],t=0,o=0,x;for(x=0;x<r.length;x+=1)if(w=r.charAt(x),Object.prototype.hasOwnProperty.call(m,w)||(m[w]=P++,v[w]=!0),O=g+w,Object.prototype.hasOwnProperty.call(m,O))g=O;else{if(Object.prototype.hasOwnProperty.call(v,g)){if(g.charCodeAt(0)<256){for(n=0;n<d;n++)t=t<<1,o==e-1?(o=0,f.push(l(t)),t=0):o++;for(s=g.charCodeAt(0),n=0;n<8;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}else{for(s=1,n=0;n<d;n++)t=t<<1|s,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=0;for(s=g.charCodeAt(0),n=0;n<16;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}S--,S==0&&(S=Math.pow(2,d),d++),delete v[g]}else for(s=m[g],n=0;n<d;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;S--,S==0&&(S=Math.pow(2,d),d++),m[O]=P++,g=String(w)}if(g!==""){if(Object.prototype.hasOwnProperty.call(v,g)){if(g.charCodeAt(0)<256){for(n=0;n<d;n++)t=t<<1,o==e-1?(o=0,f.push(l(t)),t=0):o++;for(s=g.charCodeAt(0),n=0;n<8;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}else{for(s=1,n=0;n<d;n++)t=t<<1|s,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=0;for(s=g.charCodeAt(0),n=0;n<16;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1}S--,S==0&&(S=Math.pow(2,d),d++),delete v[g]}else for(s=m[g],n=0;n<d;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;S--,S==0&&(S=Math.pow(2,d),d++)}for(s=2,n=0;n<d;n++)t=t<<1|s&1,o==e-1?(o=0,f.push(l(t)),t=0):o++,s=s>>1;for(;;)if(t=t<<1,o==e-1){f.push(l(t));break}else o++;return f.join("")},decompress:function(r){return r==null?"":r==""?null:A._decompress(r.length,32768,function(e){return r.charCodeAt(e)})},_decompress:function(r,e,l){var n=[],s,m=4,v=4,w=3,O="",g=[],S,P,d,f,t,o,x,a={val:l(0),position:e,index:1};for(S=0;S<3;S+=1)n[S]=S;for(d=0,t=Math.pow(2,2),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;switch(s=d){case 0:for(d=0,t=Math.pow(2,8),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;x=c(d);break;case 1:for(d=0,t=Math.pow(2,16),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;x=c(d);break;case 2:return""}for(n[3]=x,P=x,g.push(x);;){if(a.index>r)return"";for(d=0,t=Math.pow(2,w),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;switch(x=d){case 0:for(d=0,t=Math.pow(2,8),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;n[v++]=c(d),x=v-1,m--;break;case 1:for(d=0,t=Math.pow(2,16),o=1;o!=t;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),d|=(f>0?1:0)*o,o<<=1;n[v++]=c(d),x=v-1,m--;break;case 2:return g.join("")}if(m==0&&(m=Math.pow(2,w),w++),n[x])O=n[x];else if(x===v)O=P+P.charAt(0);else return null;g.push(O),n[v++]=P+O.charAt(0),m--,P=O,m==0&&(m=Math.pow(2,w),w++)}}};return A}();typeof W!="undefined"&&W!=null&&(W.exports=ce)});var fe={};ie(fe,{createPlayground:()=>de,getPlaygroundUrl:()=>X});var z=ae(G());async function de(c,h={}){typeof c=="object"&&!(c instanceof HTMLElement)&&(c.headless||c.view==="headless")&&(h=c,c=null);let{config:E={},headless:y,loading:M="lazy",view:A}=h,r=y||A==="headless",e=null,l=null;if(typeof c=="string")e=document.querySelector(c);else if(c instanceof HTMLElement)e=c;else if(!(r&&typeof c=="object"))throw new Error("A valid container element is required.");if(!e)if(r)e=document.createElement("div"),B(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${c}"`);let n=new URL(X(h)),s=n.origin;n.searchParams.set("embed","true"),n.searchParams.set("loading",r?"eager":M),n.searchParams.set("sdkVersion","0.12.0"),typeof E=="object"&&Object.keys(E).length>0&&n.searchParams.set("config","sdk");let m=h.params;typeof m=="object"&&Object.keys(m).length>0&&JSON.stringify(m).length<1800&&Object.keys(m).forEach(i=>{n.searchParams.set(i,encodeURIComponent(String(m[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",O=[],g=(i,u="message")=>{addEventListener(u,i),O.push(i)},P=await new Promise(i=>{var C,U,R,k,j,q,J,N,Q;if(!e)return;let u=e.dataset.height||e.style.height;if(u&&!r){let I=isNaN(Number(u))?u:u+"px";e.style.height=I}e.dataset.defaultStyles!=="false"&&!r&&((C=e.style).backgroundColor||(C.backgroundColor="#fff"),(U=e.style).border||(U.border="1px solid black"),(R=e.style).borderRadius||(R.borderRadius="8px"),(k=e.style).boxSizing||(k.boxSizing="border-box"),(j=e.style).padding||(j.padding="0"),(q=e.style).width||(q.width="100%"),(J=e.style).height||(J.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(N=e.style).overflow||(N.overflow="hidden"),(Q=e.style).resize||(Q.resize="vertical"));let b="livecodes",L=e.querySelector(`iframe.${b}`),p=L||document.createElement("iframe");p.classList.add(b),p.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),p.setAttribute("allowtransparency","true"),p.setAttribute("allowpaymentrequest","true"),p.setAttribute("allowfullscreen","true"),p.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let H=M==="eager"?"eager":"lazy";p.setAttribute("loading",H),r?B(p):(p.style.height="100%",p.style.minHeight="200px",p.style.width="100%",p.style.margin="0",p.style.border="0",p.style.borderRadius=e.style.borderRadius),g(function I(T){var _;T.source!==p.contentWindow||T.origin!==s||((_=T.data)==null?void 0:_.type)!=="livecodes-init"||(removeEventListener("message",I),l=Number(T.data.payload.appVersion.replace(/^v/,"")))}),(!l||l<46)&&g(function I(T){var _,Z;T.source!==p.contentWindow||T.origin!==s||((_=T.data)==null?void 0:_.type)!=="livecodes-get-config"||(removeEventListener("message",I),(Z=p.contentWindow)==null||Z.postMessage({type:"livecodes-config",payload:E},s))}),p.onload=()=>{i(p)},p.src=n.href,L||e.appendChild(p)}),d=new Promise(i=>{g(function u(b){var L;b.source!==P.contentWindow||b.origin!==s||((L=b.data)==null?void 0:L.type)!=="livecodes-ready"||(removeEventListener("message",u),i(),d.settled=!0)})}),f=()=>v?Promise.reject(w):new Promise(async i=>{var b;d.settled&&i();let u={type:"livecodes-load"};(b=P.contentWindow)==null||b.postMessage(u,s),await d,i()}),t=(i,u)=>new Promise(async(b,L)=>{var H;if(v)return L(w);await f();let p=V();g(function C(U){var R,k;if(!(U.source!==P.contentWindow||U.origin!==s||((R=U.data)==null?void 0:R.type)!=="livecodes-api-response"||((k=U.data)==null?void 0:k.id)!==p)&&U.data.method===i){removeEventListener("message",C);let j=U.data.payload;j!=null&&j.error?L(j.error):b(j)}}),(H=P.contentWindow)==null||H.postMessage({method:i,id:p,args:u},s)}),o={},x=["load","ready","code","console","tests","destroy"],a=(i,u)=>{var b;if(v)throw new Error(w);return x.includes(i)?(t("watch",[i]),o[i]||(o[i]=[]),(b=o[i])==null||b.push(u),{remove:()=>{var L,p;o[i]=(L=o[i])==null?void 0:L.filter(H=>H!==u),((p=o[i])==null?void 0:p.length)===0&&t("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},Y=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];g(async function(u){var p,H,C,U;let b=Y((H=(p=u.data)==null?void 0:p.type)!=null?H:"");if(u.source!==P.contentWindow||u.origin!==s||!b||!o[b])return;let L=(C=u.data)==null?void 0:C.payload;(U=o[b])==null||U.forEach(R=>{R(L)})});let F=()=>{var i;(i=P==null?void 0:P.remove)==null||i.call(P),Object.values(o).forEach(u=>{u.length=0}),O.forEach(u=>removeEventListener("message",u)),O.length=0,D&&e&&D.unobserve(e),v=!0},D;M==="lazy"&&"IntersectionObserver"in window&&(D=new IntersectionObserver((i,u)=>{i.forEach(async b=>{b.isIntersecting&&(await f(),u.unobserve(e))})},{rootMargin:"150px"}),D.observe(e));function B(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let V=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>f(),run:()=>t("run"),format:i=>t("format",[i]),getShareUrl:i=>t("getShareUrl",[i]),getConfig:i=>t("getConfig",[i]),setConfig:i=>t("setConfig",[i]),getCode:()=>t("getCode"),show:(i,u)=>t("show",[i,u]),runTests:()=>t("runTests"),onChange:i=>a("code",i),watch:a,exec:(i,...u)=>t("exec",[i,...u]),destroy:()=>v?Promise.reject(w):(F(),Promise.resolve())}}function X(c={}){let{appUrl:h="https://livecodes.io",params:E={},config:y={},headless:M,import:A,lite:r,view:e,...l}=c,n;try{n=new URL(h)}catch(v){throw new Error(`${h} is not a valid URL.`)}let s=new URLSearchParams;Object.entries(l).forEach(([v,w])=>{w!==void 0&&n.searchParams.set(v,String(w))});let m=c.view==="headless"||M;if(r&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":n.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:n.searchParams.set("view",e)),typeof y=="string")try{new URL(y),n.searchParams.set("config",encodeURIComponent(y))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&n.searchParams.set("title",y.title),y.description&&y.description.length>0&&n.searchParams.set("description",y.description),s.set("config","code/"+(0,z.compressToEncodedURIComponent)(JSON.stringify(y))));if(E&&typeof E=="object"&&Object.keys(E).length>0)try{s.set("params",(0,z.compressToEncodedURIComponent)(JSON.stringify(E)))}catch(v){Object.keys(E).forEach(w=>{n.searchParams.set(w,encodeURIComponent(String(E[w])))})}return A&&n.searchParams.set("x",encodeURIComponent(A)),m&&n.searchParams.set("headless","true"),s.toString().length>0&&(n.hash=s.toString()),n.href}return le(fe);})(); |
+1
-1
| { | ||
| "name": "livecodes", | ||
| "version": "0.11.1", | ||
| "version": "0.12.0", | ||
| "description": "A Code Playground That Just Works!", | ||
@@ -5,0 +5,0 @@ "author": "Hatem Hosny", |
+1
-1
@@ -1,1 +0,1 @@ | ||
| var F=Object.create;var Z=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var oe=(d,m)=>()=>(m||d((m={exports:{}}).exports,m),m.exports);var se=(d,m,b,p)=>{if(m&&typeof m=="object"||typeof m=="function")for(let x of ee(m))!ne.call(d,x)&&x!==b&&Z(d,x,{get:()=>m[x],enumerable:!(p=V(m,x))||p.enumerable});return d};var re=(d,m,b)=>(b=d!=null?F(te(d)):{},se(m||!d||!d.__esModule?Z(b,"default",{value:d,enumerable:!0}):b,d));var $=oe((ue,N)=>{var ie=function(){var d=String.fromCharCode,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",p={};function x(o,e){if(!p[o]){p[o]={};for(var i=0;i<o.length;i++)p[o][o.charAt(i)]=i}return p[o][e]}var S={compressToBase64:function(o){if(o==null)return"";var e=S._compress(o,6,function(i){return m.charAt(i)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(o){return o==null?"":o==""?null:S._decompress(o.length,32,function(e){return x(m,o.charAt(e))})},compressToUTF16:function(o){return o==null?"":S._compress(o,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(o){return o==null?"":o==""?null:S._decompress(o.length,16384,function(e){return o.charCodeAt(e)-32})},compressToUint8Array:function(o){for(var e=S.compress(o),i=new Uint8Array(e.length*2),t=0,r=e.length;t<r;t++){var h=e.charCodeAt(t);i[t*2]=h>>>8,i[t*2+1]=h%256}return i},decompressFromUint8Array:function(o){if(o==null)return S.decompress(o);for(var e=new Array(o.length/2),i=0,t=e.length;i<t;i++)e[i]=o[i*2]*256+o[i*2+1];var r=[];return e.forEach(function(h){r.push(d(h))}),S.decompress(r.join(""))},compressToEncodedURIComponent:function(o){return o==null?"":S._compress(o,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(o){return o==null?"":o==""?null:(o=o.replace(/ /g,"+"),S._decompress(o.length,32,function(e){return x(b,o.charAt(e))}))},compress:function(o){return S._compress(o,16,function(e){return d(e)})},_compress:function(o,e,i){if(o==null)return"";var t,r,h={},g={},v="",M="",u="",w=2,A=3,a=2,f=[],n=0,s=0,P;for(P=0;P<o.length;P+=1)if(v=o.charAt(P),Object.prototype.hasOwnProperty.call(h,v)||(h[v]=A++,g[v]=!0),M=u+v,Object.prototype.hasOwnProperty.call(h,M))u=M;else{if(Object.prototype.hasOwnProperty.call(g,u)){if(u.charCodeAt(0)<256){for(t=0;t<a;t++)n=n<<1,s==e-1?(s=0,f.push(i(n)),n=0):s++;for(r=u.charCodeAt(0),t=0;t<8;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1}else{for(r=1,t=0;t<a;t++)n=n<<1|r,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=0;for(r=u.charCodeAt(0),t=0;t<16;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1}w--,w==0&&(w=Math.pow(2,a),a++),delete g[u]}else for(r=h[u],t=0;t<a;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1;w--,w==0&&(w=Math.pow(2,a),a++),h[M]=A++,u=String(v)}if(u!==""){if(Object.prototype.hasOwnProperty.call(g,u)){if(u.charCodeAt(0)<256){for(t=0;t<a;t++)n=n<<1,s==e-1?(s=0,f.push(i(n)),n=0):s++;for(r=u.charCodeAt(0),t=0;t<8;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1}else{for(r=1,t=0;t<a;t++)n=n<<1|r,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=0;for(r=u.charCodeAt(0),t=0;t<16;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1}w--,w==0&&(w=Math.pow(2,a),a++),delete g[u]}else for(r=h[u],t=0;t<a;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1;w--,w==0&&(w=Math.pow(2,a),a++)}for(r=2,t=0;t<a;t++)n=n<<1|r&1,s==e-1?(s=0,f.push(i(n)),n=0):s++,r=r>>1;for(;;)if(n=n<<1,s==e-1){f.push(i(n));break}else s++;return f.join("")},decompress:function(o){return o==null?"":o==""?null:S._decompress(o.length,32768,function(e){return o.charCodeAt(e)})},_decompress:function(o,e,i){var t=[],r,h=4,g=4,v=3,M="",u=[],w,A,a,f,n,s,P,c={val:i(0),position:e,index:1};for(w=0;w<3;w+=1)t[w]=w;for(a=0,n=Math.pow(2,2),s=1;s!=n;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),a|=(f>0?1:0)*s,s<<=1;switch(r=a){case 0:for(a=0,n=Math.pow(2,8),s=1;s!=n;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),a|=(f>0?1:0)*s,s<<=1;P=d(a);break;case 1:for(a=0,n=Math.pow(2,16),s=1;s!=n;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),a|=(f>0?1:0)*s,s<<=1;P=d(a);break;case 2:return""}for(t[3]=P,A=P,u.push(P);;){if(c.index>o)return"";for(a=0,n=Math.pow(2,v),s=1;s!=n;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),a|=(f>0?1:0)*s,s<<=1;switch(P=a){case 0:for(a=0,n=Math.pow(2,8),s=1;s!=n;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),a|=(f>0?1:0)*s,s<<=1;t[g++]=d(a),P=g-1,h--;break;case 1:for(a=0,n=Math.pow(2,16),s=1;s!=n;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),a|=(f>0?1:0)*s,s<<=1;t[g++]=d(a),P=g-1,h--;break;case 2:return u.join("")}if(h==0&&(h=Math.pow(2,v),v++),t[P])M=t[P];else if(P===g)M=A+A.charAt(0);else return null;u.push(M),t[g++]=A+M.charAt(0),h--,A=M,h==0&&(h=Math.pow(2,v),v++)}}};return S}();typeof N!="undefined"&&N!=null&&(N.exports=ie)});import{useEffect as X,useRef as le,useState as H}from"react";var J=re($());async function G(d,m={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(m=d,d=null);let{config:b={},headless:p,loading:x="lazy",view:S}=m,o=p||S==="headless",e=null,i=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(o&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(o)e=document.createElement("div"),K(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let t=new URL(ae(m)),r=t.origin;t.searchParams.set("embed","true"),t.searchParams.set("loading",o?"eager":x),t.searchParams.set("sdkVersion","0.11.1"),typeof b=="object"&&Object.keys(b).length>0&&t.searchParams.set("config","sdk");let h=m.params;typeof h=="object"&&Object.keys(h).length>0&&JSON.stringify(h).length<1800&&Object.keys(h).forEach(l=>{t.searchParams.set(l,encodeURIComponent(String(h[l])))});let g=!1,v="Cannot call API methods after calling `destroy()`.",u=await new Promise(l=>{var T,C,k,_,U,W,z,B,q;if(!e)return;let E=e.dataset.height||e.style.height;if(E&&!o){let I=isNaN(Number(E))?E:E+"px";e.style.height=I}e.dataset.defaultStyles!=="false"&&!o&&((T=e.style).backgroundColor||(T.backgroundColor="#fff"),(C=e.style).border||(C.border="1px solid black"),(k=e.style).borderRadius||(k.borderRadius="8px"),(_=e.style).boxSizing||(_.boxSizing="border-box"),(U=e.style).padding||(U.padding="0"),(W=e.style).width||(W.width="100%"),(z=e.style).height||(z.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(B=e.style).overflow||(B.overflow="hidden"),(q=e.style).resize||(q.resize="vertical"));let O="livecodes",L=e.querySelector(`iframe.${O}`),y=L||document.createElement("iframe");y.classList.add(O),y.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),y.setAttribute("allowtransparency","true"),y.setAttribute("allowpaymentrequest","true"),y.setAttribute("allowfullscreen","true"),y.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let R=x==="eager"?"eager":"lazy";y.setAttribute("loading",R),o?K(y):(y.style.height="100%",y.style.minHeight="200px",y.style.width="100%",y.style.margin="0",y.style.border="0",y.style.borderRadius=e.style.borderRadius),addEventListener("message",function I(j){var D;j.source!==y.contentWindow||j.origin!==r||((D=j.data)==null?void 0:D.type)!=="livecodes-init"||(removeEventListener("message",I),i=Number(j.data.payload.appVersion.replace(/^v/,"")))}),(!i||i<46)&&addEventListener("message",function I(j){var D,Q;j.source!==y.contentWindow||j.origin!==r||((D=j.data)==null?void 0:D.type)!=="livecodes-get-config"||(removeEventListener("message",I),(Q=y.contentWindow)==null||Q.postMessage({type:"livecodes-config",payload:b},r))}),y.onload=()=>{l(y)},y.src=t.href,L||e.appendChild(y)}),w=new Promise(l=>{addEventListener("message",function E(O){var L;O.source!==u.contentWindow||O.origin!==r||((L=O.data)==null?void 0:L.type)!=="livecodes-ready"||(removeEventListener("message",E),l(),w.settled=!0)})}),A=()=>g?Promise.reject(v):new Promise(async l=>{var O;w.settled&&l();let E={type:"livecodes-load"};(O=u.contentWindow)==null||O.postMessage(E,r),await w,l()}),a=(l,E)=>new Promise(async(O,L)=>{var R;if(g)return L(v);await A();let y=Y();addEventListener("message",function T(C){var k,_;if(!(C.source!==u.contentWindow||C.origin!==r||((k=C.data)==null?void 0:k.type)!=="livecodes-api-response"||((_=C.data)==null?void 0:_.id)!==y)&&C.data.method===l){removeEventListener("message",T);let U=C.data.payload;U!=null&&U.error?L(U.error):O(U)}}),(R=u.contentWindow)==null||R.postMessage({method:l,id:y,args:E},r)}),f={},n=["load","ready","code","console","tests","destroy"],s=(l,E)=>{var O;if(g)throw new Error(v);return n.includes(l)?(a("watch",[l]),f[l]||(f[l]=[]),(O=f[l])==null||O.push(E),{remove:()=>{var L,y;f[l]=(L=f[l])==null?void 0:L.filter(R=>R!==E),((y=f[l])==null?void 0:y.length)===0&&a("watch",[l,"unsubscribe"])}}):{remove:()=>{}}},P=l=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[l];addEventListener("message",async l=>{var L,y,R,T;let E=P((y=(L=l.data)==null?void 0:L.type)!=null?y:"");if(l.source!==u.contentWindow||l.origin!==r||!E||!f[E])return;let O=(R=l.data)==null?void 0:R.payload;(T=f[E])==null||T.forEach(C=>{C(O)})});let c=()=>{var l;Object.values(f).forEach(E=>{E.length=0}),(l=u==null?void 0:u.remove)==null||l.call(u),g=!0};x==="lazy"&&"IntersectionObserver"in window&&new IntersectionObserver((E,O)=>{E.forEach(async L=>{L.isIntersecting&&(await A(),O.unobserve(e))})},{rootMargin:"150px"}).observe(e);function K(l){l.style.position="absolute",l.style.top="0",l.style.visibility="hidden",l.style.opacity="0"}let Y=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>A(),run:()=>a("run"),format:l=>a("format",[l]),getShareUrl:l=>a("getShareUrl",[l]),getConfig:l=>a("getConfig",[l]),setConfig:l=>a("setConfig",[l]),getCode:()=>a("getCode"),show:(l,E)=>a("show",[l,E]),runTests:()=>a("runTests"),onChange:l=>s("code",l),watch:s,exec:(l,...E)=>a("exec",[l,...E]),destroy:()=>w.settled?a("destroy").then(c):g?Promise.reject(v):(c(),Promise.resolve())}}function ae(d={}){let{appUrl:m="https://livecodes.io",params:b={},config:p={},headless:x,import:S,lite:o,view:e,...i}=d,t;try{t=new URL(m)}catch(g){throw new Error(`${m} is not a valid URL.`)}let r=new URLSearchParams;Object.entries(i).forEach(([g,v])=>{v!==void 0&&t.searchParams.set(g,String(v))});let h=d.view==="headless"||x;if(o&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof p=="object"&&p.mode==null?p.mode="lite":t.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof p=="object"&&p.view==null&&e!=="headless"?p.view=e:t.searchParams.set("view",e)),typeof p=="string")try{new URL(p),t.searchParams.set("config",encodeURIComponent(p))}catch(g){throw new Error('"config" is not a valid URL or configuration object.')}else p&&typeof p=="object"&&Object.keys(p).length>0&&(p.title&&p.title!=="Untitled Project"&&t.searchParams.set("title",p.title),p.description&&p.description.length>0&&t.searchParams.set("description",p.description),r.set("config","code/"+(0,J.compressToEncodedURIComponent)(JSON.stringify(p))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{r.set("params",(0,J.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(g){Object.keys(b).forEach(v=>{t.searchParams.set(v,encodeURIComponent(String(b[v])))})}return S&&t.searchParams.set("x",encodeURIComponent(S)),h&&t.searchParams.set("headless","true"),t.hash=r.toString(),t.href}import{jsx as de}from"react/jsx-runtime";function ce(d){let m=le(null),[b,p]=H(d.className||""),[x,S]=H(d.style||{}),[o,e]=H(d.height),[i,t]=H(),[r,h]=H(JSON.stringify(d.config||"")),[g,v]=H("");return X(()=>{if(!m.current)return;let{className:M,style:u,height:w,sdkReady:A,config:a,...f}=d;if(p(M||""),S(u||{}),e(w),!i||g!==JSON.stringify(f))v(JSON.stringify(f)),i==null||i.destroy(),G(m.current,{config:a,...f}).then(n=>{t(n),typeof A=="function"&&A(n)});else{if(r===JSON.stringify(a))return;h(JSON.stringify(a)),typeof a=="string"?fetch(a).then(n=>n.json()).then(n=>{i==null||i.setConfig(n)}):a&&i.setConfig(a)}},[d]),X(()=>()=>{i==null||i.destroy()},[]),de("div",{ref:m,className:b,style:x,"data-height":o})}export{ce as default}; | ||
| var te=Object.create;var $=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ie=(d,m)=>()=>(m||d((m={exports:{}}).exports,m),m.exports);var ae=(d,m,b,u)=>{if(m&&typeof m=="object"||typeof m=="function")for(let A of oe(m))!re.call(d,A)&&A!==b&&$(d,A,{get:()=>m[A],enumerable:!(u=ne(m,A))||u.enumerable});return d};var le=(d,m,b)=>(b=d!=null?te(se(d)):{},ae(m||!d||!d.__esModule?$(b,"default",{value:d,enumerable:!0}):b,d));var G=ie((ye,J)=>{var ce=function(){var d=String.fromCharCode,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",u={};function A(s,e){if(!u[s]){u[s]={};for(var i=0;i<s.length;i++)u[s][s.charAt(i)]=i}return u[s][e]}var O={compressToBase64:function(s){if(s==null)return"";var e=O._compress(s,6,function(i){return m.charAt(i)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(s){return s==null?"":s==""?null:O._decompress(s.length,32,function(e){return A(m,s.charAt(e))})},compressToUTF16:function(s){return s==null?"":O._compress(s,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(s){return s==null?"":s==""?null:O._decompress(s.length,16384,function(e){return s.charCodeAt(e)-32})},compressToUint8Array:function(s){for(var e=O.compress(s),i=new Uint8Array(e.length*2),n=0,r=e.length;n<r;n++){var y=e.charCodeAt(n);i[n*2]=y>>>8,i[n*2+1]=y%256}return i},decompressFromUint8Array:function(s){if(s==null)return O.decompress(s);for(var e=new Array(s.length/2),i=0,n=e.length;i<n;i++)e[i]=s[i*2]*256+s[i*2+1];var r=[];return e.forEach(function(y){r.push(d(y))}),O.decompress(r.join(""))},compressToEncodedURIComponent:function(s){return s==null?"":O._compress(s,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(s){return s==null?"":s==""?null:(s=s.replace(/ /g,"+"),O._decompress(s.length,32,function(e){return A(b,s.charAt(e))}))},compress:function(s){return O._compress(s,16,function(e){return d(e)})},_compress:function(s,e,i){if(s==null)return"";var n,r,y={},v={},w="",M="",g="",S=2,E=3,l=2,f=[],t=0,o=0,x;for(x=0;x<s.length;x+=1)if(w=s.charAt(x),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=E++,v[w]=!0),M=g+w,Object.prototype.hasOwnProperty.call(y,M))g=M;else{if(Object.prototype.hasOwnProperty.call(v,g)){if(g.charCodeAt(0)<256){for(n=0;n<l;n++)t=t<<1,o==e-1?(o=0,f.push(i(t)),t=0):o++;for(r=g.charCodeAt(0),n=0;n<8;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1}else{for(r=1,n=0;n<l;n++)t=t<<1|r,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=0;for(r=g.charCodeAt(0),n=0;n<16;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1}S--,S==0&&(S=Math.pow(2,l),l++),delete v[g]}else for(r=y[g],n=0;n<l;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1;S--,S==0&&(S=Math.pow(2,l),l++),y[M]=E++,g=String(w)}if(g!==""){if(Object.prototype.hasOwnProperty.call(v,g)){if(g.charCodeAt(0)<256){for(n=0;n<l;n++)t=t<<1,o==e-1?(o=0,f.push(i(t)),t=0):o++;for(r=g.charCodeAt(0),n=0;n<8;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1}else{for(r=1,n=0;n<l;n++)t=t<<1|r,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=0;for(r=g.charCodeAt(0),n=0;n<16;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1}S--,S==0&&(S=Math.pow(2,l),l++),delete v[g]}else for(r=y[g],n=0;n<l;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1;S--,S==0&&(S=Math.pow(2,l),l++)}for(r=2,n=0;n<l;n++)t=t<<1|r&1,o==e-1?(o=0,f.push(i(t)),t=0):o++,r=r>>1;for(;;)if(t=t<<1,o==e-1){f.push(i(t));break}else o++;return f.join("")},decompress:function(s){return s==null?"":s==""?null:O._decompress(s.length,32768,function(e){return s.charCodeAt(e)})},_decompress:function(s,e,i){var n=[],r,y=4,v=4,w=3,M="",g=[],S,E,l,f,t,o,x,c={val:i(0),position:e,index:1};for(S=0;S<3;S+=1)n[S]=S;for(l=0,t=Math.pow(2,2),o=1;o!=t;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),l|=(f>0?1:0)*o,o<<=1;switch(r=l){case 0:for(l=0,t=Math.pow(2,8),o=1;o!=t;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),l|=(f>0?1:0)*o,o<<=1;x=d(l);break;case 1:for(l=0,t=Math.pow(2,16),o=1;o!=t;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),l|=(f>0?1:0)*o,o<<=1;x=d(l);break;case 2:return""}for(n[3]=x,E=x,g.push(x);;){if(c.index>s)return"";for(l=0,t=Math.pow(2,w),o=1;o!=t;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),l|=(f>0?1:0)*o,o<<=1;switch(x=l){case 0:for(l=0,t=Math.pow(2,8),o=1;o!=t;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),l|=(f>0?1:0)*o,o<<=1;n[v++]=d(l),x=v-1,y--;break;case 1:for(l=0,t=Math.pow(2,16),o=1;o!=t;)f=c.val&c.position,c.position>>=1,c.position==0&&(c.position=e,c.val=i(c.index++)),l|=(f>0?1:0)*o,o<<=1;n[v++]=d(l),x=v-1,y--;break;case 2:return g.join("")}if(y==0&&(y=Math.pow(2,w),w++),n[x])M=n[x];else if(x===v)M=E+E.charAt(0);else return null;g.push(M),n[v++]=E+M.charAt(0),y--,E=M,y==0&&(y=Math.pow(2,w),w++)}}};return O}();typeof J!="undefined"&&J!=null&&(J.exports=ce)});import{useEffect as Y,useRef as fe,useState as k}from"react";var K=le(G());async function X(d,m={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(m=d,d=null);let{config:b={},headless:u,loading:A="lazy",view:O}=m,s=u||O==="headless",e=null,i=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(s&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(s)e=document.createElement("div"),W(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let n=new URL(de(m)),r=n.origin;n.searchParams.set("embed","true"),n.searchParams.set("loading",s?"eager":A),n.searchParams.set("sdkVersion","0.12.0"),typeof b=="object"&&Object.keys(b).length>0&&n.searchParams.set("config","sdk");let y=m.params;typeof y=="object"&&Object.keys(y).length>0&&JSON.stringify(y).length<1800&&Object.keys(y).forEach(a=>{n.searchParams.set(a,encodeURIComponent(String(y[a])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",M=[],g=(a,p="message")=>{addEventListener(p,a),M.push(a)},E=await new Promise(a=>{var j,C,T,I,U,z,B,q,Q;if(!e)return;let p=e.dataset.height||e.style.height;if(p&&!s){let _=isNaN(Number(p))?p:p+"px";e.style.height=_}e.dataset.defaultStyles!=="false"&&!s&&((j=e.style).backgroundColor||(j.backgroundColor="#fff"),(C=e.style).border||(C.border="1px solid black"),(T=e.style).borderRadius||(T.borderRadius="8px"),(I=e.style).boxSizing||(I.boxSizing="border-box"),(U=e.style).padding||(U.padding="0"),(z=e.style).width||(z.width="100%"),(B=e.style).height||(B.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(q=e.style).overflow||(q.overflow="hidden"),(Q=e.style).resize||(Q.resize="vertical"));let P="livecodes",L=e.querySelector(`iframe.${P}`),h=L||document.createElement("iframe");h.classList.add(P),h.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),h.setAttribute("allowtransparency","true"),h.setAttribute("allowpaymentrequest","true"),h.setAttribute("allowfullscreen","true"),h.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let R=A==="eager"?"eager":"lazy";h.setAttribute("loading",R),s?W(h):(h.style.height="100%",h.style.minHeight="200px",h.style.width="100%",h.style.margin="0",h.style.border="0",h.style.borderRadius=e.style.borderRadius),g(function _(H){var D;H.source!==h.contentWindow||H.origin!==r||((D=H.data)==null?void 0:D.type)!=="livecodes-init"||(removeEventListener("message",_),i=Number(H.data.payload.appVersion.replace(/^v/,"")))}),(!i||i<46)&&g(function _(H){var D,Z;H.source!==h.contentWindow||H.origin!==r||((D=H.data)==null?void 0:D.type)!=="livecodes-get-config"||(removeEventListener("message",_),(Z=h.contentWindow)==null||Z.postMessage({type:"livecodes-config",payload:b},r))}),h.onload=()=>{a(h)},h.src=n.href,L||e.appendChild(h)}),l=new Promise(a=>{g(function p(P){var L;P.source!==E.contentWindow||P.origin!==r||((L=P.data)==null?void 0:L.type)!=="livecodes-ready"||(removeEventListener("message",p),a(),l.settled=!0)})}),f=()=>v?Promise.reject(w):new Promise(async a=>{var P;l.settled&&a();let p={type:"livecodes-load"};(P=E.contentWindow)==null||P.postMessage(p,r),await l,a()}),t=(a,p)=>new Promise(async(P,L)=>{var R;if(v)return L(w);await f();let h=ee();g(function j(C){var T,I;if(!(C.source!==E.contentWindow||C.origin!==r||((T=C.data)==null?void 0:T.type)!=="livecodes-api-response"||((I=C.data)==null?void 0:I.id)!==h)&&C.data.method===a){removeEventListener("message",j);let U=C.data.payload;U!=null&&U.error?L(U.error):P(U)}}),(R=E.contentWindow)==null||R.postMessage({method:a,id:h,args:p},r)}),o={},x=["load","ready","code","console","tests","destroy"],c=(a,p)=>{var P;if(v)throw new Error(w);return x.includes(a)?(t("watch",[a]),o[a]||(o[a]=[]),(P=o[a])==null||P.push(p),{remove:()=>{var L,h;o[a]=(L=o[a])==null?void 0:L.filter(R=>R!==p),((h=o[a])==null?void 0:h.length)===0&&t("watch",[a,"unsubscribe"])}}):{remove:()=>{}}},F=a=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[a];g(async function(p){var h,R,j,C;let P=F((R=(h=p.data)==null?void 0:h.type)!=null?R:"");if(p.source!==E.contentWindow||p.origin!==r||!P||!o[P])return;let L=(j=p.data)==null?void 0:j.payload;(C=o[P])==null||C.forEach(T=>{T(L)})});let V=()=>{var a;(a=E==null?void 0:E.remove)==null||a.call(E),Object.values(o).forEach(p=>{p.length=0}),M.forEach(p=>removeEventListener("message",p)),M.length=0,N&&e&&N.unobserve(e),v=!0},N;A==="lazy"&&"IntersectionObserver"in window&&(N=new IntersectionObserver((a,p)=>{a.forEach(async P=>{P.isIntersecting&&(await f(),p.unobserve(e))})},{rootMargin:"150px"}),N.observe(e));function W(a){a.style.position="absolute",a.style.top="0",a.style.visibility="hidden",a.style.opacity="0"}let ee=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>f(),run:()=>t("run"),format:a=>t("format",[a]),getShareUrl:a=>t("getShareUrl",[a]),getConfig:a=>t("getConfig",[a]),setConfig:a=>t("setConfig",[a]),getCode:()=>t("getCode"),show:(a,p)=>t("show",[a,p]),runTests:()=>t("runTests"),onChange:a=>c("code",a),watch:c,exec:(a,...p)=>t("exec",[a,...p]),destroy:()=>v?Promise.reject(w):(V(),Promise.resolve())}}function de(d={}){let{appUrl:m="https://livecodes.io",params:b={},config:u={},headless:A,import:O,lite:s,view:e,...i}=d,n;try{n=new URL(m)}catch(v){throw new Error(`${m} is not a valid URL.`)}let r=new URLSearchParams;Object.entries(i).forEach(([v,w])=>{w!==void 0&&n.searchParams.set(v,String(w))});let y=d.view==="headless"||A;if(s&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof u=="object"&&u.mode==null?u.mode="lite":n.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof u=="object"&&u.view==null&&e!=="headless"?u.view=e:n.searchParams.set("view",e)),typeof u=="string")try{new URL(u),n.searchParams.set("config",encodeURIComponent(u))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else u&&typeof u=="object"&&Object.keys(u).length>0&&(u.title&&u.title!=="Untitled Project"&&n.searchParams.set("title",u.title),u.description&&u.description.length>0&&n.searchParams.set("description",u.description),r.set("config","code/"+(0,K.compressToEncodedURIComponent)(JSON.stringify(u))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{r.set("params",(0,K.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(v){Object.keys(b).forEach(w=>{n.searchParams.set(w,encodeURIComponent(String(b[w])))})}return O&&n.searchParams.set("x",encodeURIComponent(O)),y&&n.searchParams.set("headless","true"),r.toString().length>0&&(n.hash=r.toString()),n.href}import{jsx as pe}from"react/jsx-runtime";function ue(d){let m=fe(null),[b,u]=k(d.className||""),[A,O]=k(d.style||{}),[s,e]=k(d.height),[i,n]=k(),[r,y]=k(JSON.stringify(d.config||"")),[v,w]=k("");return Y(()=>{if(!m.current)return;let{className:M,style:g,height:S,sdkReady:E,config:l,...f}=d;if(u(M||""),O(g||{}),e(S),!i||v!==JSON.stringify(f))w(JSON.stringify(f)),i==null||i.destroy(),X(m.current,{config:l,...f}).then(t=>{n(t),typeof E=="function"&&E(t)});else{if(r===JSON.stringify(l))return;y(JSON.stringify(l)),typeof l=="string"?fetch(l).then(t=>t.json()).then(t=>{i==null||i.setConfig(t)}):l&&i.setConfig(l)}},[d]),Y(()=>()=>{i==null||i.destroy()},[]),pe("div",{ref:m,className:b,style:A,"data-height":s})}export{ue as default}; |
+10
-5
@@ -16,7 +16,7 @@ # LiveCodes | ||
| [](https://www.jsdelivr.com/package/npm/livecodes) | ||
| [](https://livecodes.io/docs/languages/) | ||
| [](https://livecodes.io/docs/languages/) | ||
| [](https://livecodes.io/docs/) | ||
| [](https://livecodes.io/docs/llms.txt) | ||
| [](https://livecodes.io/docs/llms-full.txt) | ||
| [](https://www.codacy.com/gh/live-codes/livecodes/dashboard?utm_source=github.com&utm_medium=referral&utm_content=live-codes/livecodes&utm_campaign=Badge_Grade) | ||
| [](https://app.codacy.com/gh/live-codes/livecodes/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | ||
| [](https://app.lokalise.com/public/34958094667a72e9454592.95108106/) | ||
@@ -89,3 +89,3 @@ [](https://app.lokalise.com/public/34958094667a72e9454592.95108106/) | ||
| 1. Download a [release](https://github.com/live-codes/livecodes/releases) | ||
| 2. Put it on a static file server (for free!) <sup><a href="https://pages.cloudflare.com/" target="_blank" rel="noopener">1</a>, <a href="https://vercel.com/" target="_blank" rel="noopener">2</a>, <a href="https://www.netlify.com/" target="_blank" rel="noopener">3</a>, <a href="https://firebase.google.com/" target="_blank" rel="noopener">4</a>, <a href="https://pages.github.com/" target="_blank" rel="noopener">5</a></sup> | ||
| 2. Put it on a static file server (for free!) <sup><a href="https://pages.cloudflare.com/" target="_blank" rel="noopener">1</a>, <a href="https://www.netlify.com/" target="_blank" rel="noopener">2</a>, <a href="https://firebase.google.com/" target="_blank" rel="noopener">3</a>, <a href="https://pages.github.com/" target="_blank" rel="noopener">4</a></sup> | ||
@@ -275,7 +275,12 @@ <sup>Check the guide for <a href="https://livecodes.io/docs/features/self-hosting" target="_blank" rel="noopener">self-hosting</a> (including the built-in setup to deploy to GitHub Pages).</sup> | ||
| <p> | ||
| <a href="https://codeium.com/" target="_blank" title="Codeium"> | ||
| <img alt="Codeium" width="200" src="https://dev.livecodes.io/docs/img/credits/codeium.svg"> | ||
| <a href="https://windsurf.com/" target="_blank" title="Windsurf"> | ||
| <img alt="Windsurf" width="200" src="https://dev.livecodes.io/docs/img/credits/windsurf.svg"> | ||
| </img></a><br /><br /> | ||
| </p> | ||
| <p> | ||
| <a href="https://m.do.co/c/fb8c00b45b91" target="_blank" title="DigitalOcean"> | ||
| <img alt="DigitalOcean" width="200" src="https://dev.livecodes.io/docs/img/credits/digital-ocean.svg"> | ||
| </img></a><br /><br /> | ||
| </p> | ||
| <p> | ||
| <a href="https://bundlejs.com/" target="_blank" title="bundlejs"> | ||
@@ -282,0 +287,0 @@ <img alt="bundlejs" width="200" src="https://dev.livecodes.io/docs/img/credits/bundlejs.jpg"> |
+1
-1
@@ -1,1 +0,1 @@ | ||
| var F=Object.create;var G=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var oe=(d,h)=>()=>(h||d((h={exports:{}}).exports,h),h.exports);var re=(d,h,S,y)=>{if(h&&typeof h=="object"||typeof h=="function")for(let b of ee(h))!ne.call(d,b)&&b!==S&&G(d,b,{get:()=>h[b],enumerable:!(y=V(h,b))||y.enumerable});return d};var se=(d,h,S)=>(S=d!=null?F(te(d)):{},re(h||!d||!d.__esModule?G(S,"default",{value:d,enumerable:!0}):S,d));var X=oe((me,N)=>{var ie=function(){var d=String.fromCharCode,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",y={};function b(n,e){if(!y[n]){y[n]={};for(var c=0;c<n.length;c++)y[n][n.charAt(c)]=c}return y[n][e]}var P={compressToBase64:function(n){if(n==null)return"";var e=P._compress(n,6,function(c){return h.charAt(c)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(n){return n==null?"":n==""?null:P._decompress(n.length,32,function(e){return b(h,n.charAt(e))})},compressToUTF16:function(n){return n==null?"":P._compress(n,15,function(e){return d(e+32)})+" "},decompressFromUTF16:function(n){return n==null?"":n==""?null:P._decompress(n.length,16384,function(e){return n.charCodeAt(e)-32})},compressToUint8Array:function(n){for(var e=P.compress(n),c=new Uint8Array(e.length*2),t=0,s=e.length;t<s;t++){var f=e.charCodeAt(t);c[t*2]=f>>>8,c[t*2+1]=f%256}return c},decompressFromUint8Array:function(n){if(n==null)return P.decompress(n);for(var e=new Array(n.length/2),c=0,t=e.length;c<t;c++)e[c]=n[c*2]*256+n[c*2+1];var s=[];return e.forEach(function(f){s.push(d(f))}),P.decompress(s.join(""))},compressToEncodedURIComponent:function(n){return n==null?"":P._compress(n,6,function(e){return S.charAt(e)})},decompressFromEncodedURIComponent:function(n){return n==null?"":n==""?null:(n=n.replace(/ /g,"+"),P._decompress(n.length,32,function(e){return b(S,n.charAt(e))}))},compress:function(n){return P._compress(n,16,function(e){return d(e)})},_compress:function(n,e,c){if(n==null)return"";var t,s,f={},g={},v="",O="",u="",w=2,L=3,a=2,p=[],r=0,o=0,x;for(x=0;x<n.length;x+=1)if(v=n.charAt(x),Object.prototype.hasOwnProperty.call(f,v)||(f[v]=L++,g[v]=!0),O=u+v,Object.prototype.hasOwnProperty.call(f,O))u=O;else{if(Object.prototype.hasOwnProperty.call(g,u)){if(u.charCodeAt(0)<256){for(t=0;t<a;t++)r=r<<1,o==e-1?(o=0,p.push(c(r)),r=0):o++;for(s=u.charCodeAt(0),t=0;t<8;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1}else{for(s=1,t=0;t<a;t++)r=r<<1|s,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=0;for(s=u.charCodeAt(0),t=0;t<16;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1}w--,w==0&&(w=Math.pow(2,a),a++),delete g[u]}else for(s=f[u],t=0;t<a;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1;w--,w==0&&(w=Math.pow(2,a),a++),f[O]=L++,u=String(v)}if(u!==""){if(Object.prototype.hasOwnProperty.call(g,u)){if(u.charCodeAt(0)<256){for(t=0;t<a;t++)r=r<<1,o==e-1?(o=0,p.push(c(r)),r=0):o++;for(s=u.charCodeAt(0),t=0;t<8;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1}else{for(s=1,t=0;t<a;t++)r=r<<1|s,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=0;for(s=u.charCodeAt(0),t=0;t<16;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1}w--,w==0&&(w=Math.pow(2,a),a++),delete g[u]}else for(s=f[u],t=0;t<a;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1;w--,w==0&&(w=Math.pow(2,a),a++)}for(s=2,t=0;t<a;t++)r=r<<1|s&1,o==e-1?(o=0,p.push(c(r)),r=0):o++,s=s>>1;for(;;)if(r=r<<1,o==e-1){p.push(c(r));break}else o++;return p.join("")},decompress:function(n){return n==null?"":n==""?null:P._decompress(n.length,32768,function(e){return n.charCodeAt(e)})},_decompress:function(n,e,c){var t=[],s,f=4,g=4,v=3,O="",u=[],w,L,a,p,r,o,x,l={val:c(0),position:e,index:1};for(w=0;w<3;w+=1)t[w]=w;for(a=0,r=Math.pow(2,2),o=1;o!=r;)p=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(p>0?1:0)*o,o<<=1;switch(s=a){case 0:for(a=0,r=Math.pow(2,8),o=1;o!=r;)p=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(p>0?1:0)*o,o<<=1;x=d(a);break;case 1:for(a=0,r=Math.pow(2,16),o=1;o!=r;)p=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(p>0?1:0)*o,o<<=1;x=d(a);break;case 2:return""}for(t[3]=x,L=x,u.push(x);;){if(l.index>n)return"";for(a=0,r=Math.pow(2,v),o=1;o!=r;)p=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(p>0?1:0)*o,o<<=1;switch(x=a){case 0:for(a=0,r=Math.pow(2,8),o=1;o!=r;)p=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(p>0?1:0)*o,o<<=1;t[g++]=d(a),x=g-1,f--;break;case 1:for(a=0,r=Math.pow(2,16),o=1;o!=r;)p=l.val&l.position,l.position>>=1,l.position==0&&(l.position=e,l.val=c(l.index++)),a|=(p>0?1:0)*o,o<<=1;t[g++]=d(a),x=g-1,f--;break;case 2:return u.join("")}if(f==0&&(f=Math.pow(2,v),v++),t[x])O=t[x];else if(x===g)O=L+L.charAt(0);else return null;u.push(O),t[g++]=L+O.charAt(0),f--,L=O,f==0&&(f=Math.pow(2,v),v++)}}};return P}();typeof N!="undefined"&&N!=null&&(N.exports=ie)});import{h as le,onMounted as ce,onUnmounted as de,ref as K,watch as fe}from"vue";var D=se(X());async function J(d,h={}){typeof d=="object"&&!(d instanceof HTMLElement)&&(d.headless||d.view==="headless")&&(h=d,d=null);let{config:S={},headless:y,loading:b="lazy",view:P}=h,n=y||P==="headless",e=null,c=null;if(typeof d=="string")e=document.querySelector(d);else if(d instanceof HTMLElement)e=d;else if(!(n&&typeof d=="object"))throw new Error("A valid container element is required.");if(!e)if(n)e=document.createElement("div"),W(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${d}"`);let t=new URL(ae(h)),s=t.origin;t.searchParams.set("embed","true"),t.searchParams.set("loading",n?"eager":b),t.searchParams.set("sdkVersion","0.11.1"),typeof S=="object"&&Object.keys(S).length>0&&t.searchParams.set("config","sdk");let f=h.params;typeof f=="object"&&Object.keys(f).length>0&&JSON.stringify(f).length<1800&&Object.keys(f).forEach(i=>{t.searchParams.set(i,encodeURIComponent(String(f[i])))});let g=!1,v="Cannot call API methods after calling `destroy()`.",u=await new Promise(i=>{var k,A,j,H,U,z,q,Q,Z;if(!e)return;let E=e.dataset.height||e.style.height;if(E&&!n){let _=isNaN(Number(E))?E:E+"px";e.style.height=_}e.dataset.defaultStyles!=="false"&&!n&&((k=e.style).backgroundColor||(k.backgroundColor="#fff"),(A=e.style).border||(A.border="1px solid black"),(j=e.style).borderRadius||(j.borderRadius="8px"),(H=e.style).boxSizing||(H.boxSizing="border-box"),(U=e.style).padding||(U.padding="0"),(z=e.style).width||(z.width="100%"),(q=e.style).height||(q.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(Q=e.style).overflow||(Q.overflow="hidden"),(Z=e.style).resize||(Z.resize="vertical"));let C="livecodes",M=e.querySelector(`iframe.${C}`),m=M||document.createElement("iframe");m.classList.add(C),m.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),m.setAttribute("allowtransparency","true"),m.setAttribute("allowpaymentrequest","true"),m.setAttribute("allowfullscreen","true"),m.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let R=b==="eager"?"eager":"lazy";m.setAttribute("loading",R),n?W(m):(m.style.height="100%",m.style.minHeight="200px",m.style.width="100%",m.style.margin="0",m.style.border="0",m.style.borderRadius=e.style.borderRadius),addEventListener("message",function _(T){var I;T.source!==m.contentWindow||T.origin!==s||((I=T.data)==null?void 0:I.type)!=="livecodes-init"||(removeEventListener("message",_),c=Number(T.data.payload.appVersion.replace(/^v/,"")))}),(!c||c<46)&&addEventListener("message",function _(T){var I,$;T.source!==m.contentWindow||T.origin!==s||((I=T.data)==null?void 0:I.type)!=="livecodes-get-config"||(removeEventListener("message",_),($=m.contentWindow)==null||$.postMessage({type:"livecodes-config",payload:S},s))}),m.onload=()=>{i(m)},m.src=t.href,M||e.appendChild(m)}),w=new Promise(i=>{addEventListener("message",function E(C){var M;C.source!==u.contentWindow||C.origin!==s||((M=C.data)==null?void 0:M.type)!=="livecodes-ready"||(removeEventListener("message",E),i(),w.settled=!0)})}),L=()=>g?Promise.reject(v):new Promise(async i=>{var C;w.settled&&i();let E={type:"livecodes-load"};(C=u.contentWindow)==null||C.postMessage(E,s),await w,i()}),a=(i,E)=>new Promise(async(C,M)=>{var R;if(g)return M(v);await L();let m=Y();addEventListener("message",function k(A){var j,H;if(!(A.source!==u.contentWindow||A.origin!==s||((j=A.data)==null?void 0:j.type)!=="livecodes-api-response"||((H=A.data)==null?void 0:H.id)!==m)&&A.data.method===i){removeEventListener("message",k);let U=A.data.payload;U!=null&&U.error?M(U.error):C(U)}}),(R=u.contentWindow)==null||R.postMessage({method:i,id:m,args:E},s)}),p={},r=["load","ready","code","console","tests","destroy"],o=(i,E)=>{var C;if(g)throw new Error(v);return r.includes(i)?(a("watch",[i]),p[i]||(p[i]=[]),(C=p[i])==null||C.push(E),{remove:()=>{var M,m;p[i]=(M=p[i])==null?void 0:M.filter(R=>R!==E),((m=p[i])==null?void 0:m.length)===0&&a("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},x=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];addEventListener("message",async i=>{var M,m,R,k;let E=x((m=(M=i.data)==null?void 0:M.type)!=null?m:"");if(i.source!==u.contentWindow||i.origin!==s||!E||!p[E])return;let C=(R=i.data)==null?void 0:R.payload;(k=p[E])==null||k.forEach(A=>{A(C)})});let l=()=>{var i;Object.values(p).forEach(E=>{E.length=0}),(i=u==null?void 0:u.remove)==null||i.call(u),g=!0};b==="lazy"&&"IntersectionObserver"in window&&new IntersectionObserver((E,C)=>{E.forEach(async M=>{M.isIntersecting&&(await L(),C.unobserve(e))})},{rootMargin:"150px"}).observe(e);function W(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let Y=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>L(),run:()=>a("run"),format:i=>a("format",[i]),getShareUrl:i=>a("getShareUrl",[i]),getConfig:i=>a("getConfig",[i]),setConfig:i=>a("setConfig",[i]),getCode:()=>a("getCode"),show:(i,E)=>a("show",[i,E]),runTests:()=>a("runTests"),onChange:i=>o("code",i),watch:o,exec:(i,...E)=>a("exec",[i,...E]),destroy:()=>w.settled?a("destroy").then(l):g?Promise.reject(v):(l(),Promise.resolve())}}function ae(d={}){let{appUrl:h="https://livecodes.io",params:S={},config:y={},headless:b,import:P,lite:n,view:e,...c}=d,t;try{t=new URL(h)}catch(g){throw new Error(`${h} is not a valid URL.`)}let s=new URLSearchParams;Object.entries(c).forEach(([g,v])=>{v!==void 0&&t.searchParams.set(g,String(v))});let f=d.view==="headless"||b;if(n&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof y=="object"&&y.mode==null?y.mode="lite":t.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof y=="object"&&y.view==null&&e!=="headless"?y.view=e:t.searchParams.set("view",e)),typeof y=="string")try{new URL(y),t.searchParams.set("config",encodeURIComponent(y))}catch(g){throw new Error('"config" is not a valid URL or configuration object.')}else y&&typeof y=="object"&&Object.keys(y).length>0&&(y.title&&y.title!=="Untitled Project"&&t.searchParams.set("title",y.title),y.description&&y.description.length>0&&t.searchParams.set("description",y.description),s.set("config","code/"+(0,D.compressToEncodedURIComponent)(JSON.stringify(y))));if(S&&typeof S=="object"&&Object.keys(S).length>0)try{s.set("params",(0,D.compressToEncodedURIComponent)(JSON.stringify(S)))}catch(g){Object.keys(S).forEach(v=>{t.searchParams.set(v,encodeURIComponent(String(S[v])))})}return P&&t.searchParams.set("x",encodeURIComponent(P)),f&&t.searchParams.set("headless","true"),t.hash=s.toString(),t.href}var pe={appUrl:String,config:[Object,String],headless:Boolean,import:String,lite:Boolean,loading:String,params:Object,template:String,view:String,height:String},B=d=>JSON.parse(JSON.stringify(d)),ue={props:pe,emits:["sdkReady"],setup(d,h){let{height:S,...y}=d,b=K(),P=K(S||""),n=K(),{config:e,...c}=y,t=JSON.stringify(e),s=JSON.stringify(c);return ce(()=>{b.value&&J(b.value,B(y)).then(f=>{n.value=f,h.emit("sdkReady",f)})}),fe(d,async f=>{var w;if(!b.value||!n.value)return;let{height:g,...v}=f;P.value=g||"";let{config:O,...u}=v;typeof O=="string"&&(O=await fetch(O).then(L=>L.json())),JSON.stringify(u)!==s?(await((w=n.value)==null?void 0:w.destroy()),J(b.value,B(v)).then(L=>{n.value=L,h.emit("sdkReady",L)})):JSON.stringify(O)!==t&&n.value.setConfig(B(O)||{}),t=JSON.stringify(O),s=JSON.stringify(u)}),de(()=>{var f;(f=n.value)==null||f.destroy()}),()=>{var f,g;return le("div",{ref:b,"data-height":P},((g=(f=h.slots).default)==null?void 0:g.call(f))||"")}}},we=ue;export{we as default}; | ||
| var te=Object.create;var X=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var ie=(c,g)=>()=>(g||c((g={exports:{}}).exports,g),g.exports);var ae=(c,g,b,p)=>{if(g&&typeof g=="object"||typeof g=="function")for(let O of oe(g))!se.call(c,O)&&O!==b&&X(c,O,{get:()=>g[O],enumerable:!(p=ne(g,O))||p.enumerable});return c};var le=(c,g,b)=>(b=c!=null?te(re(c)):{},ae(g||!c||!c.__esModule?X(b,"default",{value:c,enumerable:!0}):b,c));var Y=ie((ve,D)=>{var ce=function(){var c=String.fromCharCode,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",p={};function O(o,e){if(!p[o]){p[o]={};for(var l=0;l<o.length;l++)p[o][o.charAt(l)]=l}return p[o][e]}var x={compressToBase64:function(o){if(o==null)return"";var e=x._compress(o,6,function(l){return g.charAt(l)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(o){return o==null?"":o==""?null:x._decompress(o.length,32,function(e){return O(g,o.charAt(e))})},compressToUTF16:function(o){return o==null?"":x._compress(o,15,function(e){return c(e+32)})+" "},decompressFromUTF16:function(o){return o==null?"":o==""?null:x._decompress(o.length,16384,function(e){return o.charCodeAt(e)-32})},compressToUint8Array:function(o){for(var e=x.compress(o),l=new Uint8Array(e.length*2),t=0,s=e.length;t<s;t++){var d=e.charCodeAt(t);l[t*2]=d>>>8,l[t*2+1]=d%256}return l},decompressFromUint8Array:function(o){if(o==null)return x.decompress(o);for(var e=new Array(o.length/2),l=0,t=e.length;l<t;l++)e[l]=o[l*2]*256+o[l*2+1];var s=[];return e.forEach(function(d){s.push(c(d))}),x.decompress(s.join(""))},compressToEncodedURIComponent:function(o){return o==null?"":x._compress(o,6,function(e){return b.charAt(e)})},decompressFromEncodedURIComponent:function(o){return o==null?"":o==""?null:(o=o.replace(/ /g,"+"),x._decompress(o.length,32,function(e){return O(b,o.charAt(e))}))},compress:function(o){return x._compress(o,16,function(e){return c(e)})},_compress:function(o,e,l){if(o==null)return"";var t,s,d={},v={},w="",P="",h="",S=2,E=3,f=2,u=[],n=0,r=0,M;for(M=0;M<o.length;M+=1)if(w=o.charAt(M),Object.prototype.hasOwnProperty.call(d,w)||(d[w]=E++,v[w]=!0),P=h+w,Object.prototype.hasOwnProperty.call(d,P))h=P;else{if(Object.prototype.hasOwnProperty.call(v,h)){if(h.charCodeAt(0)<256){for(t=0;t<f;t++)n=n<<1,r==e-1?(r=0,u.push(l(n)),n=0):r++;for(s=h.charCodeAt(0),t=0;t<8;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1}else{for(s=1,t=0;t<f;t++)n=n<<1|s,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=0;for(s=h.charCodeAt(0),t=0;t<16;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1}S--,S==0&&(S=Math.pow(2,f),f++),delete v[h]}else for(s=d[h],t=0;t<f;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1;S--,S==0&&(S=Math.pow(2,f),f++),d[P]=E++,h=String(w)}if(h!==""){if(Object.prototype.hasOwnProperty.call(v,h)){if(h.charCodeAt(0)<256){for(t=0;t<f;t++)n=n<<1,r==e-1?(r=0,u.push(l(n)),n=0):r++;for(s=h.charCodeAt(0),t=0;t<8;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1}else{for(s=1,t=0;t<f;t++)n=n<<1|s,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=0;for(s=h.charCodeAt(0),t=0;t<16;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1}S--,S==0&&(S=Math.pow(2,f),f++),delete v[h]}else for(s=d[h],t=0;t<f;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1;S--,S==0&&(S=Math.pow(2,f),f++)}for(s=2,t=0;t<f;t++)n=n<<1|s&1,r==e-1?(r=0,u.push(l(n)),n=0):r++,s=s>>1;for(;;)if(n=n<<1,r==e-1){u.push(l(n));break}else r++;return u.join("")},decompress:function(o){return o==null?"":o==""?null:x._decompress(o.length,32768,function(e){return o.charCodeAt(e)})},_decompress:function(o,e,l){var t=[],s,d=4,v=4,w=3,P="",h=[],S,E,f,u,n,r,M,a={val:l(0),position:e,index:1};for(S=0;S<3;S+=1)t[S]=S;for(f=0,n=Math.pow(2,2),r=1;r!=n;)u=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),f|=(u>0?1:0)*r,r<<=1;switch(s=f){case 0:for(f=0,n=Math.pow(2,8),r=1;r!=n;)u=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),f|=(u>0?1:0)*r,r<<=1;M=c(f);break;case 1:for(f=0,n=Math.pow(2,16),r=1;r!=n;)u=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),f|=(u>0?1:0)*r,r<<=1;M=c(f);break;case 2:return""}for(t[3]=M,E=M,h.push(M);;){if(a.index>o)return"";for(f=0,n=Math.pow(2,w),r=1;r!=n;)u=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),f|=(u>0?1:0)*r,r<<=1;switch(M=f){case 0:for(f=0,n=Math.pow(2,8),r=1;r!=n;)u=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),f|=(u>0?1:0)*r,r<<=1;t[v++]=c(f),M=v-1,d--;break;case 1:for(f=0,n=Math.pow(2,16),r=1;r!=n;)u=a.val&a.position,a.position>>=1,a.position==0&&(a.position=e,a.val=l(a.index++)),f|=(u>0?1:0)*r,r<<=1;t[v++]=c(f),M=v-1,d--;break;case 2:return h.join("")}if(d==0&&(d=Math.pow(2,w),w++),t[M])P=t[M];else if(M===v)P=E+E.charAt(0);else return null;h.push(P),t[v++]=E+P.charAt(0),d--,E=P,d==0&&(d=Math.pow(2,w),w++)}}};return x}();typeof D!="undefined"&&D!=null&&(D.exports=ce)});import{h as fe,onMounted as pe,onUnmounted as ue,ref as B,watch as ye}from"vue";var J=le(Y());async function K(c,g={}){typeof c=="object"&&!(c instanceof HTMLElement)&&(c.headless||c.view==="headless")&&(g=c,c=null);let{config:b={},headless:p,loading:O="lazy",view:x}=g,o=p||x==="headless",e=null,l=null;if(typeof c=="string")e=document.querySelector(c);else if(c instanceof HTMLElement)e=c;else if(!(o&&typeof c=="object"))throw new Error("A valid container element is required.");if(!e)if(o)e=document.createElement("div"),z(e),document.body.appendChild(e);else throw new Error(`Cannot find element: "${c}"`);let t=new URL(de(g)),s=t.origin;t.searchParams.set("embed","true"),t.searchParams.set("loading",o?"eager":O),t.searchParams.set("sdkVersion","0.12.0"),typeof b=="object"&&Object.keys(b).length>0&&t.searchParams.set("config","sdk");let d=g.params;typeof d=="object"&&Object.keys(d).length>0&&JSON.stringify(d).length<1800&&Object.keys(d).forEach(i=>{t.searchParams.set(i,encodeURIComponent(String(d[i])))});let v=!1,w="Cannot call API methods after calling `destroy()`.",P=[],h=(i,y="message")=>{addEventListener(y,i),P.push(i)},E=await new Promise(i=>{var k,L,j,H,U,q,Q,Z,$;if(!e)return;let y=e.dataset.height||e.style.height;if(y&&!o){let _=isNaN(Number(y))?y:y+"px";e.style.height=_}e.dataset.defaultStyles!=="false"&&!o&&((k=e.style).backgroundColor||(k.backgroundColor="#fff"),(L=e.style).border||(L.border="1px solid black"),(j=e.style).borderRadius||(j.borderRadius="8px"),(H=e.style).boxSizing||(H.boxSizing="border-box"),(U=e.style).padding||(U.padding="0"),(q=e.style).width||(q.width="100%"),(Q=e.style).height||(Q.height=e.style.height||"300px"),e.style.minHeight="200px",e.style.flexGrow="1",(Z=e.style).overflow||(Z.overflow="hidden"),($=e.style).resize||($.resize="vertical"));let C="livecodes",A=e.querySelector(`iframe.${C}`),m=A||document.createElement("iframe");m.classList.add(C),m.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),m.setAttribute("allowtransparency","true"),m.setAttribute("allowpaymentrequest","true"),m.setAttribute("allowfullscreen","true"),m.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts");let R=O==="eager"?"eager":"lazy";m.setAttribute("loading",R),o?z(m):(m.style.height="100%",m.style.minHeight="200px",m.style.width="100%",m.style.margin="0",m.style.border="0",m.style.borderRadius=e.style.borderRadius),h(function _(T){var I;T.source!==m.contentWindow||T.origin!==s||((I=T.data)==null?void 0:I.type)!=="livecodes-init"||(removeEventListener("message",_),l=Number(T.data.payload.appVersion.replace(/^v/,"")))}),(!l||l<46)&&h(function _(T){var I,G;T.source!==m.contentWindow||T.origin!==s||((I=T.data)==null?void 0:I.type)!=="livecodes-get-config"||(removeEventListener("message",_),(G=m.contentWindow)==null||G.postMessage({type:"livecodes-config",payload:b},s))}),m.onload=()=>{i(m)},m.src=t.href,A||e.appendChild(m)}),f=new Promise(i=>{h(function y(C){var A;C.source!==E.contentWindow||C.origin!==s||((A=C.data)==null?void 0:A.type)!=="livecodes-ready"||(removeEventListener("message",y),i(),f.settled=!0)})}),u=()=>v?Promise.reject(w):new Promise(async i=>{var C;f.settled&&i();let y={type:"livecodes-load"};(C=E.contentWindow)==null||C.postMessage(y,s),await f,i()}),n=(i,y)=>new Promise(async(C,A)=>{var R;if(v)return A(w);await u();let m=ee();h(function k(L){var j,H;if(!(L.source!==E.contentWindow||L.origin!==s||((j=L.data)==null?void 0:j.type)!=="livecodes-api-response"||((H=L.data)==null?void 0:H.id)!==m)&&L.data.method===i){removeEventListener("message",k);let U=L.data.payload;U!=null&&U.error?A(U.error):C(U)}}),(R=E.contentWindow)==null||R.postMessage({method:i,id:m,args:y},s)}),r={},M=["load","ready","code","console","tests","destroy"],a=(i,y)=>{var C;if(v)throw new Error(w);return M.includes(i)?(n("watch",[i]),r[i]||(r[i]=[]),(C=r[i])==null||C.push(y),{remove:()=>{var A,m;r[i]=(A=r[i])==null?void 0:A.filter(R=>R!==y),((m=r[i])==null?void 0:m.length)===0&&n("watch",[i,"unsubscribe"])}}):{remove:()=>{}}},F=i=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[i];h(async function(y){var m,R,k,L;let C=F((R=(m=y.data)==null?void 0:m.type)!=null?R:"");if(y.source!==E.contentWindow||y.origin!==s||!C||!r[C])return;let A=(k=y.data)==null?void 0:k.payload;(L=r[C])==null||L.forEach(j=>{j(A)})});let V=()=>{var i;(i=E==null?void 0:E.remove)==null||i.call(E),Object.values(r).forEach(y=>{y.length=0}),P.forEach(y=>removeEventListener("message",y)),P.length=0,N&&e&&N.unobserve(e),v=!0},N;O==="lazy"&&"IntersectionObserver"in window&&(N=new IntersectionObserver((i,y)=>{i.forEach(async C=>{C.isIntersecting&&(await u(),y.unobserve(e))})},{rootMargin:"150px"}),N.observe(e));function z(i){i.style.position="absolute",i.style.top="0",i.style.visibility="hidden",i.style.opacity="0"}let ee=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>u(),run:()=>n("run"),format:i=>n("format",[i]),getShareUrl:i=>n("getShareUrl",[i]),getConfig:i=>n("getConfig",[i]),setConfig:i=>n("setConfig",[i]),getCode:()=>n("getCode"),show:(i,y)=>n("show",[i,y]),runTests:()=>n("runTests"),onChange:i=>a("code",i),watch:a,exec:(i,...y)=>n("exec",[i,...y]),destroy:()=>v?Promise.reject(w):(V(),Promise.resolve())}}function de(c={}){let{appUrl:g="https://livecodes.io",params:b={},config:p={},headless:O,import:x,lite:o,view:e,...l}=c,t;try{t=new URL(g)}catch(v){throw new Error(`${g} is not a valid URL.`)}let s=new URLSearchParams;Object.entries(l).forEach(([v,w])=>{w!==void 0&&t.searchParams.set(v,String(w))});let d=c.view==="headless"||O;if(o&&(console.warn(`Deprecation notice: "lite" option is deprecated. Use "config: { mode: 'lite' }" instead.`),typeof p=="object"&&p.mode==null?p.mode="lite":t.searchParams.set("lite","true")),e&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),typeof p=="object"&&p.view==null&&e!=="headless"?p.view=e:t.searchParams.set("view",e)),typeof p=="string")try{new URL(p),t.searchParams.set("config",encodeURIComponent(p))}catch(v){throw new Error('"config" is not a valid URL or configuration object.')}else p&&typeof p=="object"&&Object.keys(p).length>0&&(p.title&&p.title!=="Untitled Project"&&t.searchParams.set("title",p.title),p.description&&p.description.length>0&&t.searchParams.set("description",p.description),s.set("config","code/"+(0,J.compressToEncodedURIComponent)(JSON.stringify(p))));if(b&&typeof b=="object"&&Object.keys(b).length>0)try{s.set("params",(0,J.compressToEncodedURIComponent)(JSON.stringify(b)))}catch(v){Object.keys(b).forEach(w=>{t.searchParams.set(w,encodeURIComponent(String(b[w])))})}return x&&t.searchParams.set("x",encodeURIComponent(x)),d&&t.searchParams.set("headless","true"),s.toString().length>0&&(t.hash=s.toString()),t.href}var me={appUrl:String,config:[Object,String],headless:Boolean,import:String,lite:Boolean,loading:String,params:Object,template:String,view:String,height:String},W=c=>JSON.parse(JSON.stringify(c)),he={props:me,emits:["sdkReady"],setup(c,g){let{height:b,...p}=c,O=B(),x=B(b||""),o=B(),{config:e,...l}=p,t=JSON.stringify(e),s=JSON.stringify(l);return pe(()=>{O.value&&K(O.value,W(p)).then(d=>{o.value=d,g.emit("sdkReady",d)})}),ye(c,async d=>{var S;if(!O.value||!o.value)return;let{height:v,...w}=d;x.value=v||"";let{config:P,...h}=w;typeof P=="string"&&(P=await fetch(P).then(E=>E.json())),JSON.stringify(h)!==s?(await((S=o.value)==null?void 0:S.destroy()),K(O.value,W(w)).then(E=>{o.value=E,g.emit("sdkReady",E)})):JSON.stringify(P)!==t&&o.value.setConfig(W(P)||{}),t=JSON.stringify(P),s=JSON.stringify(h)}),ue(()=>{var d;(d=o.value)==null||d.destroy()}),()=>{var d,v;return fe("div",{ref:O,"data-height":x.value},((v=(d=g.slots).default)==null?void 0:v.call(d))||"")}}},be=he;export{be as default}; |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
155824
0.25%1739
0.17%343
1.48%