lecodes-cli 2.2.6 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +96 -15
- package/package.json +8 -8
- package/runtime/sdk-types.json +1 -1
- package/runtime/web/VERSION.json +3 -3
- package/runtime/web/assets/browser-BpFb50ko.js +1 -0
- package/runtime/web/assets/webrtc-CbCltXvl.js +1 -0
- package/runtime/web/player.js +6 -6
- package/runtime/web-lite/lite.js +1 -1
- package/runtime/web-lite/plugins/browser/index-BpFb50ko.js +1 -0
- package/runtime/web-lite/plugins/webrtc/index-CbCltXvl.js +1 -0
- package/runtime/web-lite/plugins.json +3 -1
- package/src/commands/app/android.ts +30 -3
- package/src/commands/app/desktop.ts +3 -2
- package/src/commands/app/index.ts +4 -4
- package/src/commands/app/shared.ts +18 -0
- package/src/commands/app/templates/android.ts +14 -2
- package/src/commands/app/templates/ios.ts +35 -3
package/runtime/web-lite/lite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Dn=Object.defineProperty;var Bn=(e,t,n)=>t in e?Dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Bn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const Vn=e=>{if(typeof e=="string")return e;if(e instanceof Error)return e.stack?`${String(e)}
|
|
2
|
-
${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},Wn=(e,t)=>{const n=o=>{fetch(`${e}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let r=-1;const i=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(i,2500)};setTimeout(i,2500);const s=()=>{let o;try{o=new WebSocket(e.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:r})),o.onmessage=l=>{let d={};try{d=JSON.parse(String(l.data))}catch{return}d.type==="reload"&&typeof d.v=="number"&&t(d.v)},o.onclose=()=>{setTimeout(s,2e3)}};return s(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const d=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(d)?d:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Vn).join(" ")}),error:o=>n({type:"error",text:o})}},zn=(e,t)=>{try{const n=new URL(e,t);return n.origin===new URL(t).origin&&(n.protocol==="http:"||n.protocol==="https:")?n.href:null}catch{return null}},Gn="modulepreload",Hn=function(e,t){return new URL(e,t).href},Et={},ce=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(A=>({status:"fulfilled",value:A}),A=>({status:"rejected",reason:A}))))};const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=o(n.map(y=>{if(y=Hn(y,r),y in Et)return;Et[y]=!0;const k=y.endsWith(".css"),A=k?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const b=l[E];if(b.href===y&&(!k||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${A}`))return;const p=document.createElement("link");if(p.rel=k?"stylesheet":Gn,k||(p.as="script"),p.crossOrigin="",p.href=y,f&&p.setAttribute("nonce",f),document.head.appendChild(p),k)return new Promise((E,b)=>{p.addEventListener("load",E),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},wt="2.2.6",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},jn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Kn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const i of n[1].split(";")){const s=i.indexOf("=");if(s===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(i.slice(0,s));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:i.slice(s+1).replace("{fmt}",t)})}return r},Yn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const i=[];for(const s of e)try{const o=new FontFace(s.family,`url("${s.url}")`,{weight:String(s.weight),style:s.italic?"italic":"normal"});r.fonts.add(o),i.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(i),new Promise(s=>setTimeout(s,n))])},qn=e=>{var d,f,y,k;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const A of r[1].split(";"))n.add(A);const i=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",s=((d=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:d[1])??null,o=((y=(f=t.match(/^\/\/ name: (.+)$/m))==null?void 0:f[1])==null?void 0:y.trim())??null,l=new Set((((k=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:k[1])??"").split(";").map(A=>A.trim()).filter(Boolean));return{sdk:s,name:o,preloads:n,gl:i,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Kn(t)}},Xn=1,Jn=2,Qn=3,Zn=4,er=5,tr=6,St=7,nr=8,_t=9,rr=10,or=11,sr=12,ir=13,ar=14,lr=15,cr=16,kt=17,ur=18,fr=19,Oe=20,ai=21,li=22,ci=23,ui=24,fi=25,dr=26,pr=27,hr=28,mr=29,Tt=30,Lt=31,gr=32,br=33,xt=34,Rt=35,Ct=36,Pe=1,yr=2,vr=4,de=8,Er=16,Ye=32,wr=64,qe=128,Sr=256,_r=512,kr=1024,Tr=2048,Lr=4096,At=8192,di=16384,xr=32768,Rr=1<<18,Cr=255,$t=256,Ot=512,Ar=1024,Z=0,$r=1,Or=2,Ur=3,De=4,be=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},Nt=(e,t)=>e==null?t:e===!0||e==="true"||e==="1"||typeof e=="number"&&e>.5,oe=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},Nr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,d=n;d.type!==l.type&&(d.type=l.type),oe(n,"inputmode",l.mode??null);const f=t("enterKey");oe(n,"enterkeyhint",f==null?null:String(f))}const i=t("autocapitalize");oe(n,"autocapitalize",i==null?null:String(i));const s=t("autocorrect");s==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(s,!0)?"on":"off"),oe(n,"spellcheck",Nt(s,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",textWrap:"enum",objectFit:"enum",placeholder:"str",type:"enum",enterKey:"enum",autocapitalize:"enum",autocorrect:"num",maxLength:"num",keyboardShrink:"num",keyboardDismiss:"num",showScrollbar:"num",overscrollMode:"enum",keyboardDismissMode:"enum",snap:"enum",sheetDetents:"str",sheetDetent:"num",sheetDismissible:"num",dim:"num"},Mr={p:"padding",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",px:"paddingHorizontal",py:"paddingVertical",m:"margin",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",mx:"marginHorizontal",my:"marginVertical",bgColor:"backgroundColor",bgImage:"backgroundImage",bgSize:"backgroundSize",bgGradient:"backgroundGradient"},Fr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Pr={display:"flex",overflow:"visible",scrollDirection:"vertical",borderWidth:0,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftWidth:0,borderHorizontalWidth:0,borderVerticalWidth:0,borderStartWidth:0,borderEndWidth:0,backgroundColor:0,borderColor:0,borderTopColor:0,borderRightColor:0,borderBottomColor:0,borderLeftColor:0,backgroundImage:"",backgroundSize:"cover",borderRadius:0,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,opacity:1,transform:"identity",transformOrigin:"50% 50%",pointerEvents:"all",fontSize:14,fontWeight:400,fontStyle:"normal",lineHeight:"normal",letterSpacing:0,textAlign:"start",textDecoration:"none",lineClamp:0,textOverflow:"ellipsis",textWrap:"wrap",objectFit:"cover",placeholder:"",type:"text",enterKey:"done",autocapitalize:"sentences",autocorrect:1,maxLength:0,keyboardShrink:1,keyboardDismiss:1,showScrollbar:1,overscrollMode:"default",keyboardDismissMode:"interactive",snap:"none",sheetDetents:"",sheetDetent:0,sheetDismissible:1,dim:0},Ir=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const i of n)r+=String.fromCharCode(i);return`data:image/svg+xml;base64,${btoa(r)}`}function Dr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Br=/\b(?:calc|min|max|clamp)\(/,Vr=e=>{if(!Br.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let i=0;const s=n;for(;n<e.length;n++)if(e[n]==="(")i++;else if(e[n]===")"&&--i===0)break;t+=e.slice(s,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const i=t[t.length-1]??"";if(!(r==="-"&&(i==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(i)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,i)=>{const s=i.slice(0,r).trimEnd(),o=i.slice(r+n.length).trimStart();return/[\w.%]$/.test(s)||/^[\w.%]/.test(o)||/[*/]$/.test(s)||/^[*/]/.test(o)?n:n+"px"})},Wr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${Wr[e]})))`,zr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Vr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+zr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},Ce=e=>{if(typeof e=="number")return"#"+(e>>>0).toString(16).padStart(e<=16777215?6:8,"0");const t=String(e);return t==="clear"?"transparent":t},Gr=/^(rotate|skew)/,Hr=/^translate/,jr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,i)=>{const s=Hr.test(r)?"px":Gr.test(r)?"deg":null;return s===null?n:`${r}(${i.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+s:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),Q=0,re=1,_e=2,Ie=["top","right","bottom","left"],Kr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(i,s)=>({rank:s,to:o=>i.map(l=>[t(l),Kr(o,l)])}),r=i=>({rank:re,to:s=>[[t(i),se(s)]]});return{[e]:n(Ie,Q),[`${e}Horizontal`]:n(["left","right"],re),[`${e}Vertical`]:n(["top","bottom"],re),[`${e}Start`]:r("inline-start"),[`${e}End`]:r("inline-end"),[`${e}Top`]:n(["top"],_e),[`${e}Right`]:n(["right"],_e),[`${e}Bottom`]:n(["bottom"],_e),[`${e}Left`]:n(["left"],_e)}},Yr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const i of e.trim()){if(i==="("&&n++,i===")"&&n--,/\s/.test(i)&&n===0){r&&t.push(r),r="";continue}r+=i}return r&&t.push(r),t},qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Xr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,i=null,s=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))qr.has(l)?s=l:Xr.test(l)?r=se(l):i=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(i?"1px":"0px")]),o.push([`border-${l}-color`,i??"transparent"]),s&&o.push([`border-${l}-style`,s]);return o}}),Jr=e=>{const t=String(e).trim(),n=(s,o,l)=>[["flex-grow",s],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),i=s=>s!==void 0&&/^-?\d*\.?\d+$/.test(s);return i(r[0])?r.length===1?n(r[0],"1","0%"):i(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},Qr=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(Qr(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},Zr=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},eo=(e,t)=>{const n=typeof e=="string"&&Zr.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},to=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,i=n,s=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",i??"0px"],["border-bottom-left-radius",s??"0px"]]},no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),ro=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||no.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},oo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",so=e=>t=>e[String(t)]??String(t),Ae={width:{css:"width",as:"len"},height:{css:"height",as:"len"},minWidth:{css:"min-width",as:"len"},minHeight:{css:"min-height",as:"len"},maxWidth:{css:"max-width",as:"len"},maxHeight:{css:"max-height",as:"len"},flexBasis:{css:"flex-basis",as:"len"},flexGrow:{css:"flex-grow",as:"num"},flexShrink:{css:"flex-shrink",as:"num"},aspectRatio:{css:"aspect-ratio",as:"num"},gap:{css:["row-gap","column-gap"],as:"len",rank:Q},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:Q},top:{css:"top",as:"len"},right:{css:"right",as:"len"},bottom:{css:"bottom",as:"len"},left:{css:"left",as:"len"},start:{css:"inset-inline-start",as:"len",rank:re},end:{css:"inset-inline-end",as:"len",rank:re},flexDirection:{css:"flex-direction",as:"raw"},justifyContent:{css:"justify-content",as:"raw"},alignItems:{css:"align-items",as:"raw"},alignSelf:{css:"align-self",as:"raw"},position:{css:"position",as:"raw"},flexWrap:{css:"flex-wrap",as:"raw"},boxSizing:{css:"box-sizing",as:"raw"},display:{css:"display",as:"raw"},overflow:{rank:Q,to:e=>{const t=e==="scroll"?"auto":String(e);return[["overflow-x",t],["overflow-y",t]]}},scrollDirection:{to:e=>e==="horizontal"?[["overflow-x","auto"],["overflow-y","hidden"],["flex-direction","row"]]:e==="all"?[["overflow-x","auto"],["overflow-y","auto"]]:[["overflow-x","hidden"],["overflow-y","auto"],["flex-direction","column"]],rank:re},...Yr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:Q},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to,rank:Q},borderTopLeftRadius:{css:"border-top-left-radius"},borderTopRightRadius:{css:"border-top-right-radius"},borderBottomRightRadius:{css:"border-bottom-right-radius"},borderBottomLeftRadius:{css:"border-bottom-left-radius"},opacity:{css:"opacity"},transform:{to:e=>[["transform",jr(e)]]},transformOrigin:{css:"transform-origin",as:"lens"},pointerEvents:{to:e=>[["pointer-events",e==="none"?"none":"auto"]]},dim:{css:"--lc-dim"},fontSize:{css:"font-size"},fontWeight:{css:"font-weight",as:"raw"},fontStyle:{to:e=>[["font-style",e===2?"italic":e===0?"normal":String(e)]]},fontFamily:{to:e=>[["font-family",ro(e)]]},lineHeight:{to:e=>[["line-height",e==="normal"?"1.2":se(e)]]},letterSpacing:{css:"letter-spacing"},textAlign:{css:"text-align"},textDecoration:{css:"text-decoration-line"},lineClamp:{rank:Q,to:e=>Number(e)>0?[["display","-webkit-box"],["-webkit-box-orient","vertical"],["-webkit-line-clamp",String(Math.round(Number(e)))],["overflow-x","hidden"],["overflow-y","hidden"]]:[["-webkit-line-clamp","none"]]},textOverflow:{css:"text-overflow"},textWrap:{rank:Q,to:e=>e==="nowrap"?[["white-space","pre"],["max-width","none"],["overflow-x","hidden"],["overflow-y","hidden"],["text-overflow","ellipsis"]]:[["white-space","pre-wrap"],["max-width","100%"],["text-wrap",String(e)]]},objectFit:{to:e=>[["object-fit",String(e)],["--lc-fit",e==="fill"?"100% 100%":String(e)]]},placeholder:{attr:!0},type:{attr:!0},enterKey:{attr:!0},autocapitalize:{attr:!0},autocorrect:{attr:!0},maxLength:{attr:!0},keyboardShrink:{attr:!0},keyboardDismiss:{attr:!0},showScrollbar:{to:e=>[["scrollbar-width",oo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",so({default:"auto",none:"none",absorb:"contain"})(e)]]},keyboardDismissMode:{attr:!0},snap:{to:e=>e==="none"?[["scroll-snap-type","none"],["--lc-snap","none"]]:[["scroll-snap-type","both mandatory"],["--lc-snap",String(e)]]},sheetDetents:{attr:!0},sheetDetent:{attr:!0},sheetDismissible:{attr:!0},background:{to:eo,rank:Q},border:we(Ie,Q),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:Jr,rank:Q}},Xe=e=>Mr[e]??e,io=e=>e in Ae,bn=e=>{const t=Ae[e];return!!t&&"attr"in t},ao={overflow:"overflow-x",pointerEvents:"pointer-events",fontFamily:"font-family",fontStyle:"font-style",lineHeight:"line-height",objectFit:"object-fit",transform:"transform",borderRadius:"border-top-left-radius",borderWidth:"border-top-width",borderColor:"border-top-color",backgroundImage:"--lc-bg-img",backgroundGradient:"--lc-bg-grad",backgroundSize:"background-size",showScrollbar:"scrollbar-width",overscrollMode:"overscroll-behavior",snap:"--lc-snap",lineClamp:"-webkit-line-clamp",textWrap:"text-wrap",borderTopWidth:"border-top-width",borderRightWidth:"border-right-width",borderBottomWidth:"border-bottom-width",borderLeftWidth:"border-left-width",borderHorizontalWidth:"border-left-width",borderVerticalWidth:"border-top-width",borderStartWidth:"border-inline-start-width",borderEndWidth:"border-inline-end-width"},lo=e=>{const t=Ae[e];return t&&"css"in t&&typeof t.css=="string"?t.css:ao[e]??null},co={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ce},uo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Mt=e=>{const t=Ae[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,s])=>s!=null);r.sort((s,o)=>Mt(s[0])-Mt(o[0]));const i=new Map;for(const[s,o]of r){const l=Ae[s];if(!l){n==null||n(s);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[y,k]of l.to(o,t))i.set(y,k);continue}const d=co[l.as??uo[Be[s]??"layout"]],f=d(o);if(typeof l.css=="string")i.set(l.css,f);else for(const y of l.css)i.set(y,f)}return i},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Le=2,xe=3,En=4,me=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=2*Math.PI/4.5,Ne=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-Ne(1-e)],["outBounce",Ne],["inOutBounce",e=>e<.5?(1-Ne(1-2*e))/2:(1+Ne(2*e-1))/2],["smoothstep",e=>e*e*(3-2*e)]],fo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},po=e=>{const t=fo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},ho=[.25,.1,.25,1],Me={kind:yn,p:[0,0,0,0]},mo=e=>{const t=new Float32Array(me);for(let n=0;n<me;n++)t[n]=e(n/(me-1));return t[0]=0,t[me-1]=1,t},go=e=>{if(e===void 0)return Me;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:mo(e)};if(Array.isArray(e)){const[i,s,o,l]=e;return{kind:Le,p:[i,s,o,l]}}const t=e.trim();if(t==="linear")return Me;if(t==="ease")return{kind:Le,p:ho};if(t==="steps")return{kind:xe,p:[1,0,0,0]};let n=/^steps\(\s*(\d+)\s*(?:,\s*(start|end|jump-start|jump-end)\s*)?\)$/.exec(t);if(n)return{kind:xe,p:[Math.max(1,parseInt(n[1],10)),n[2]==="start"||n[2]==="jump-start"?1:0,0,0]};if(n=/^cubic-bezier\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)$/.exec(t),n)return{kind:Le,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=po(t);return r===0?Me:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Me)},bo=(e,t,n,r,i)=>{const s=1-3*r+3*t,o=3*r-6*t,l=3*t,d=1-3*i+3*n,f=3*i-6*n,y=3*n;let k=e;for(let A=0;A<8;A++){const _=((s*k+o)*k+l)*k-e,p=(3*s*k+2*o)*k+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;k-=_/p}return k=Math.min(1,Math.max(0,k)),((d*k+f)*k+y)*k},yo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Le:return bo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(me-1),i=Math.floor(r),s=n[i],o=n[Math.min(i+1,me-1)];return s+(o-s)*(r-i)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),vo="cubic-bezier(0.3333, 0, 0.6667, 1)",Eo=e=>{switch(e.kind){case yn:return"linear";case Le:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(yo(e,n/Bt)));return`linear(${t.join(", ")})`},wo=e=>e===void 0||e==="smoothstep"?vo:Eo(go(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],So=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",_o=`
|
|
2
|
+
${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},Wn=(e,t)=>{const n=o=>{fetch(`${e}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let r=-1;const i=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(i,2500)};setTimeout(i,2500);const s=()=>{let o;try{o=new WebSocket(e.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:r})),o.onmessage=l=>{let d={};try{d=JSON.parse(String(l.data))}catch{return}d.type==="reload"&&typeof d.v=="number"&&t(d.v)},o.onclose=()=>{setTimeout(s,2e3)}};return s(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const d=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(d)?d:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Vn).join(" ")}),error:o=>n({type:"error",text:o})}},zn=(e,t)=>{try{const n=new URL(e,t);return n.origin===new URL(t).origin&&(n.protocol==="http:"||n.protocol==="https:")?n.href:null}catch{return null}},Gn="modulepreload",Hn=function(e,t){return new URL(e,t).href},Et={},ce=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(A=>({status:"fulfilled",value:A}),A=>({status:"rejected",reason:A}))))};const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=o(n.map(y=>{if(y=Hn(y,r),y in Et)return;Et[y]=!0;const k=y.endsWith(".css"),A=k?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const b=l[E];if(b.href===y&&(!k||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${A}`))return;const p=document.createElement("link");if(p.rel=k?"stylesheet":Gn,k||(p.as="script"),p.crossOrigin="",p.href=y,f&&p.setAttribute("nonce",f),document.head.appendChild(p),k)return new Promise((E,b)=>{p.addEventListener("load",E),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},wt="2.2.8",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},jn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Kn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const i of n[1].split(";")){const s=i.indexOf("=");if(s===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(i.slice(0,s));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:i.slice(s+1).replace("{fmt}",t)})}return r},Yn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const i=[];for(const s of e)try{const o=new FontFace(s.family,`url("${s.url}")`,{weight:String(s.weight),style:s.italic?"italic":"normal"});r.fonts.add(o),i.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(i),new Promise(s=>setTimeout(s,n))])},qn=e=>{var d,f,y,k;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const A of r[1].split(";"))n.add(A);const i=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",s=((d=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:d[1])??null,o=((y=(f=t.match(/^\/\/ name: (.+)$/m))==null?void 0:f[1])==null?void 0:y.trim())??null,l=new Set((((k=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:k[1])??"").split(";").map(A=>A.trim()).filter(Boolean));return{sdk:s,name:o,preloads:n,gl:i,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Kn(t)}},Xn=1,Jn=2,Qn=3,Zn=4,er=5,tr=6,St=7,nr=8,_t=9,rr=10,or=11,sr=12,ir=13,ar=14,lr=15,cr=16,kt=17,ur=18,fr=19,Oe=20,ai=21,li=22,ci=23,ui=24,fi=25,dr=26,pr=27,hr=28,mr=29,Tt=30,Lt=31,gr=32,br=33,xt=34,Rt=35,Ct=36,Pe=1,yr=2,vr=4,de=8,Er=16,Ye=32,wr=64,qe=128,Sr=256,_r=512,kr=1024,Tr=2048,Lr=4096,At=8192,di=16384,xr=32768,Rr=1<<18,Cr=255,$t=256,Ot=512,Ar=1024,Z=0,$r=1,Or=2,Ur=3,De=4,be=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},Nt=(e,t)=>e==null?t:e===!0||e==="true"||e==="1"||typeof e=="number"&&e>.5,oe=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},Nr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,d=n;d.type!==l.type&&(d.type=l.type),oe(n,"inputmode",l.mode??null);const f=t("enterKey");oe(n,"enterkeyhint",f==null?null:String(f))}const i=t("autocapitalize");oe(n,"autocapitalize",i==null?null:String(i));const s=t("autocorrect");s==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(s,!0)?"on":"off"),oe(n,"spellcheck",Nt(s,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",textWrap:"enum",objectFit:"enum",placeholder:"str",type:"enum",enterKey:"enum",autocapitalize:"enum",autocorrect:"num",maxLength:"num",keyboardShrink:"num",keyboardDismiss:"num",showScrollbar:"num",overscrollMode:"enum",keyboardDismissMode:"enum",snap:"enum",sheetDetents:"str",sheetDetent:"num",sheetDismissible:"num",dim:"num"},Mr={p:"padding",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",px:"paddingHorizontal",py:"paddingVertical",m:"margin",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",mx:"marginHorizontal",my:"marginVertical",bgColor:"backgroundColor",bgImage:"backgroundImage",bgSize:"backgroundSize",bgGradient:"backgroundGradient"},Fr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Pr={display:"flex",overflow:"visible",scrollDirection:"vertical",borderWidth:0,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftWidth:0,borderHorizontalWidth:0,borderVerticalWidth:0,borderStartWidth:0,borderEndWidth:0,backgroundColor:0,borderColor:0,borderTopColor:0,borderRightColor:0,borderBottomColor:0,borderLeftColor:0,backgroundImage:"",backgroundSize:"cover",borderRadius:0,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,opacity:1,transform:"identity",transformOrigin:"50% 50%",pointerEvents:"all",fontSize:14,fontWeight:400,fontStyle:"normal",lineHeight:"normal",letterSpacing:0,textAlign:"start",textDecoration:"none",lineClamp:0,textOverflow:"ellipsis",textWrap:"wrap",objectFit:"cover",placeholder:"",type:"text",enterKey:"done",autocapitalize:"sentences",autocorrect:1,maxLength:0,keyboardShrink:1,keyboardDismiss:1,showScrollbar:1,overscrollMode:"default",keyboardDismissMode:"interactive",snap:"none",sheetDetents:"",sheetDetent:0,sheetDismissible:1,dim:0},Ir=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const i of n)r+=String.fromCharCode(i);return`data:image/svg+xml;base64,${btoa(r)}`}function Dr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Br=/\b(?:calc|min|max|clamp)\(/,Vr=e=>{if(!Br.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let i=0;const s=n;for(;n<e.length;n++)if(e[n]==="(")i++;else if(e[n]===")"&&--i===0)break;t+=e.slice(s,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const i=t[t.length-1]??"";if(!(r==="-"&&(i==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(i)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,i)=>{const s=i.slice(0,r).trimEnd(),o=i.slice(r+n.length).trimStart();return/[\w.%]$/.test(s)||/^[\w.%]/.test(o)||/[*/]$/.test(s)||/^[*/]/.test(o)?n:n+"px"})},Wr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${Wr[e]})))`,zr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Vr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+zr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},Ce=e=>{if(typeof e=="number")return"#"+(e>>>0).toString(16).padStart(e<=16777215?6:8,"0");const t=String(e);return t==="clear"?"transparent":t},Gr=/^(rotate|skew)/,Hr=/^translate/,jr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,i)=>{const s=Hr.test(r)?"px":Gr.test(r)?"deg":null;return s===null?n:`${r}(${i.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+s:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),Q=0,re=1,_e=2,Ie=["top","right","bottom","left"],Kr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(i,s)=>({rank:s,to:o=>i.map(l=>[t(l),Kr(o,l)])}),r=i=>({rank:re,to:s=>[[t(i),se(s)]]});return{[e]:n(Ie,Q),[`${e}Horizontal`]:n(["left","right"],re),[`${e}Vertical`]:n(["top","bottom"],re),[`${e}Start`]:r("inline-start"),[`${e}End`]:r("inline-end"),[`${e}Top`]:n(["top"],_e),[`${e}Right`]:n(["right"],_e),[`${e}Bottom`]:n(["bottom"],_e),[`${e}Left`]:n(["left"],_e)}},Yr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const i of e.trim()){if(i==="("&&n++,i===")"&&n--,/\s/.test(i)&&n===0){r&&t.push(r),r="";continue}r+=i}return r&&t.push(r),t},qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Xr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,i=null,s=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))qr.has(l)?s=l:Xr.test(l)?r=se(l):i=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(i?"1px":"0px")]),o.push([`border-${l}-color`,i??"transparent"]),s&&o.push([`border-${l}-style`,s]);return o}}),Jr=e=>{const t=String(e).trim(),n=(s,o,l)=>[["flex-grow",s],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),i=s=>s!==void 0&&/^-?\d*\.?\d+$/.test(s);return i(r[0])?r.length===1?n(r[0],"1","0%"):i(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},Qr=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(Qr(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},Zr=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},eo=(e,t)=>{const n=typeof e=="string"&&Zr.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},to=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,i=n,s=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",i??"0px"],["border-bottom-left-radius",s??"0px"]]},no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),ro=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||no.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},oo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",so=e=>t=>e[String(t)]??String(t),Ae={width:{css:"width",as:"len"},height:{css:"height",as:"len"},minWidth:{css:"min-width",as:"len"},minHeight:{css:"min-height",as:"len"},maxWidth:{css:"max-width",as:"len"},maxHeight:{css:"max-height",as:"len"},flexBasis:{css:"flex-basis",as:"len"},flexGrow:{css:"flex-grow",as:"num"},flexShrink:{css:"flex-shrink",as:"num"},aspectRatio:{css:"aspect-ratio",as:"num"},gap:{css:["row-gap","column-gap"],as:"len",rank:Q},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:Q},top:{css:"top",as:"len"},right:{css:"right",as:"len"},bottom:{css:"bottom",as:"len"},left:{css:"left",as:"len"},start:{css:"inset-inline-start",as:"len",rank:re},end:{css:"inset-inline-end",as:"len",rank:re},flexDirection:{css:"flex-direction",as:"raw"},justifyContent:{css:"justify-content",as:"raw"},alignItems:{css:"align-items",as:"raw"},alignSelf:{css:"align-self",as:"raw"},position:{css:"position",as:"raw"},flexWrap:{css:"flex-wrap",as:"raw"},boxSizing:{css:"box-sizing",as:"raw"},display:{css:"display",as:"raw"},overflow:{rank:Q,to:e=>{const t=e==="scroll"?"auto":String(e);return[["overflow-x",t],["overflow-y",t]]}},scrollDirection:{to:e=>e==="horizontal"?[["overflow-x","auto"],["overflow-y","hidden"],["flex-direction","row"]]:e==="all"?[["overflow-x","auto"],["overflow-y","auto"]]:[["overflow-x","hidden"],["overflow-y","auto"],["flex-direction","column"]],rank:re},...Yr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:Q},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to,rank:Q},borderTopLeftRadius:{css:"border-top-left-radius"},borderTopRightRadius:{css:"border-top-right-radius"},borderBottomRightRadius:{css:"border-bottom-right-radius"},borderBottomLeftRadius:{css:"border-bottom-left-radius"},opacity:{css:"opacity"},transform:{to:e=>[["transform",jr(e)]]},transformOrigin:{css:"transform-origin",as:"lens"},pointerEvents:{to:e=>[["pointer-events",e==="none"?"none":"auto"]]},dim:{css:"--lc-dim"},fontSize:{css:"font-size"},fontWeight:{css:"font-weight",as:"raw"},fontStyle:{to:e=>[["font-style",e===2?"italic":e===0?"normal":String(e)]]},fontFamily:{to:e=>[["font-family",ro(e)]]},lineHeight:{to:e=>[["line-height",e==="normal"?"1.2":se(e)]]},letterSpacing:{css:"letter-spacing"},textAlign:{css:"text-align"},textDecoration:{css:"text-decoration-line"},lineClamp:{rank:Q,to:e=>Number(e)>0?[["display","-webkit-box"],["-webkit-box-orient","vertical"],["-webkit-line-clamp",String(Math.round(Number(e)))],["overflow-x","hidden"],["overflow-y","hidden"]]:[["-webkit-line-clamp","none"]]},textOverflow:{css:"text-overflow"},textWrap:{rank:Q,to:e=>e==="nowrap"?[["white-space","pre"],["max-width","none"],["overflow-x","hidden"],["overflow-y","hidden"],["text-overflow","ellipsis"]]:[["white-space","pre-wrap"],["max-width","100%"],["text-wrap",String(e)]]},objectFit:{to:e=>[["object-fit",String(e)],["--lc-fit",e==="fill"?"100% 100%":String(e)]]},placeholder:{attr:!0},type:{attr:!0},enterKey:{attr:!0},autocapitalize:{attr:!0},autocorrect:{attr:!0},maxLength:{attr:!0},keyboardShrink:{attr:!0},keyboardDismiss:{attr:!0},showScrollbar:{to:e=>[["scrollbar-width",oo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",so({default:"auto",none:"none",absorb:"contain"})(e)]]},keyboardDismissMode:{attr:!0},snap:{to:e=>e==="none"?[["scroll-snap-type","none"],["--lc-snap","none"]]:[["scroll-snap-type","both mandatory"],["--lc-snap",String(e)]]},sheetDetents:{attr:!0},sheetDetent:{attr:!0},sheetDismissible:{attr:!0},background:{to:eo,rank:Q},border:we(Ie,Q),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:Jr,rank:Q}},Xe=e=>Mr[e]??e,io=e=>e in Ae,bn=e=>{const t=Ae[e];return!!t&&"attr"in t},ao={overflow:"overflow-x",pointerEvents:"pointer-events",fontFamily:"font-family",fontStyle:"font-style",lineHeight:"line-height",objectFit:"object-fit",transform:"transform",borderRadius:"border-top-left-radius",borderWidth:"border-top-width",borderColor:"border-top-color",backgroundImage:"--lc-bg-img",backgroundGradient:"--lc-bg-grad",backgroundSize:"background-size",showScrollbar:"scrollbar-width",overscrollMode:"overscroll-behavior",snap:"--lc-snap",lineClamp:"-webkit-line-clamp",textWrap:"text-wrap",borderTopWidth:"border-top-width",borderRightWidth:"border-right-width",borderBottomWidth:"border-bottom-width",borderLeftWidth:"border-left-width",borderHorizontalWidth:"border-left-width",borderVerticalWidth:"border-top-width",borderStartWidth:"border-inline-start-width",borderEndWidth:"border-inline-end-width"},lo=e=>{const t=Ae[e];return t&&"css"in t&&typeof t.css=="string"?t.css:ao[e]??null},co={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ce},uo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Mt=e=>{const t=Ae[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,s])=>s!=null);r.sort((s,o)=>Mt(s[0])-Mt(o[0]));const i=new Map;for(const[s,o]of r){const l=Ae[s];if(!l){n==null||n(s);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[y,k]of l.to(o,t))i.set(y,k);continue}const d=co[l.as??uo[Be[s]??"layout"]],f=d(o);if(typeof l.css=="string")i.set(l.css,f);else for(const y of l.css)i.set(y,f)}return i},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Le=2,xe=3,En=4,me=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=2*Math.PI/4.5,Ne=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-Ne(1-e)],["outBounce",Ne],["inOutBounce",e=>e<.5?(1-Ne(1-2*e))/2:(1+Ne(2*e-1))/2],["smoothstep",e=>e*e*(3-2*e)]],fo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},po=e=>{const t=fo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},ho=[.25,.1,.25,1],Me={kind:yn,p:[0,0,0,0]},mo=e=>{const t=new Float32Array(me);for(let n=0;n<me;n++)t[n]=e(n/(me-1));return t[0]=0,t[me-1]=1,t},go=e=>{if(e===void 0)return Me;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:mo(e)};if(Array.isArray(e)){const[i,s,o,l]=e;return{kind:Le,p:[i,s,o,l]}}const t=e.trim();if(t==="linear")return Me;if(t==="ease")return{kind:Le,p:ho};if(t==="steps")return{kind:xe,p:[1,0,0,0]};let n=/^steps\(\s*(\d+)\s*(?:,\s*(start|end|jump-start|jump-end)\s*)?\)$/.exec(t);if(n)return{kind:xe,p:[Math.max(1,parseInt(n[1],10)),n[2]==="start"||n[2]==="jump-start"?1:0,0,0]};if(n=/^cubic-bezier\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)$/.exec(t),n)return{kind:Le,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=po(t);return r===0?Me:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Me)},bo=(e,t,n,r,i)=>{const s=1-3*r+3*t,o=3*r-6*t,l=3*t,d=1-3*i+3*n,f=3*i-6*n,y=3*n;let k=e;for(let A=0;A<8;A++){const _=((s*k+o)*k+l)*k-e,p=(3*s*k+2*o)*k+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;k-=_/p}return k=Math.min(1,Math.max(0,k)),((d*k+f)*k+y)*k},yo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Le:return bo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(me-1),i=Math.floor(r),s=n[i],o=n[Math.min(i+1,me-1)];return s+(o-s)*(r-i)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),vo="cubic-bezier(0.3333, 0, 0.6667, 1)",Eo=e=>{switch(e.kind){case yn:return"linear";case Le:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(yo(e,n/Bt)));return`linear(${t.join(", ")})`},wo=e=>e===void 0||e==="smoothstep"?vo:Eo(go(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],So=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",_o=`
|
|
3
3
|
@layer ${wn.join(", ")};
|
|
4
4
|
|
|
5
5
|
@layer lc-base {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l={present:e=>e!=null,f64:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,i32:e=>typeof e=="number"&&Number.isInteger(e)&&e>=-2147483648&&e<=2147483647?e:void 0,bool:e=>typeof e=="boolean"?e:void 0,string:e=>typeof e=="string"?e:void 0,json:e=>e,bytes:e=>Object.prototype.toString.call(e)==="[object Uint8Array]"?e.slice():void 0,object:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,array:(e,t)=>Array.isArray(e)&&(t===void 0||e.length===t)?e:void 0,list:(e,t)=>{if(!Array.isArray(e))return;const c=[];for(const s of e){const d=t(s);if(d===void 0)return;c.push(d)}return c},map:(e,t)=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const c={};for(const[s,d]of Object.entries(e)){const a=t(d);if(a===void 0)return;c[s]=a}return c}},L=e=>!l.present(e)||l.object(e)?{}:void 0,x=e=>{const t=l.object(e);if(!t)return;let c;if(l.present(t.callbackScheme)){const i=l.string(t.callbackScheme);if(i===void 0)return;c=i}let s;if(l.present(t.ephemeral)){const i=l.bool(t.ephemeral);if(i===void 0)return;s=i}let d;if(l.present(t.color)){const i=l.string(t.color);if(i===void 0)return;d=i}const a={};return c!==void 0&&(a.callbackScheme=c),s!==void 0&&(a.ephemeral=s),d!==void 0&&(a.color=d),a},M=e=>e==="open"||e==="block"?e:void 0,O=e=>{const t=l.object(e);if(!t)return;let c;if(l.present(t.url)){const n=l.string(t.url);if(n===void 0)return;c=n}let s;if(l.present(t.stops)){const n=l.list(t.stops,u=>l.string(u));if(n===void 0)return;s=n}let d;if(l.present(t.bridge)){const n=l.bool(t.bridge);if(n===void 0)return;d=n}let a;if(l.present(t.externalLinks)){const n=M(t.externalLinks);if(n===void 0)return;a=n}let i;if(l.present(t.userAgent)){const n=l.string(t.userAgent);if(n===void 0)return;i=n}let p;if(l.present(t.ephemeral)){const n=l.bool(t.ephemeral);if(n===void 0)return;p=n}const o={};return c!==void 0&&(o.url=c),s!==void 0&&(o.stops=s),d!==void 0&&(o.bridge=d),a!==void 0&&(o.externalLinks=a),i!==void 0&&(o.userAgent=i),p!==void 0&&(o.ephemeral=p),o};class m extends Error{constructor(t){super(t),this.code=t}}const E={name:"browser",version:1},H=(e,t)=>{e.registerService(E.name,(c,s)=>{const d={closed:()=>s.emit("closed")},a=t(L(c)??{},d);return{call:async(p,o)=>{switch(p){case"show":{const n=l.string(o[0]);if(n===void 0)throw new Error("bad arguments — Browser.show: url");let u;if(l.present(o[1])){const f=x(o[1]);if(f===void 0)throw new Error("bad arguments — Browser.show: options");u=f}return await a.show(n,u)}case"dismiss":{await a.dismiss();return}default:throw new Error(`Unknown method: ${p}`)}},close:()=>{var p;return(p=a.close)==null?void 0:p.call(a)}}},E.version)};class W extends Error{constructor(t){super(t),this.code=t}}const B={name:"webView",version:1},U=(e,t)=>{e.registerView(B.name,(c,s,d)=>{const a={navigate:o=>s.emit("navigate",o),load:o=>s.emit("load",o),error:o=>s.emit("error",o),stop:o=>s.emit("stop",o),message:o=>s.emit("message",o),exit:()=>s.emit("exit")},i=t(O(c)??{},a,d),p=async(o,n)=>{switch(o){case"load":{const u=l.string(n[0]);if(u===void 0)throw new Error("bad arguments — WebView.load: url");let f;if(l.present(n[1])){const v=l.map(n[1],h=>l.string(h));if(v===void 0)throw new Error("bad arguments — WebView.load: headers");f=v}await i.load(u,f);return}case"loadHtml":{const u=l.string(n[0]);if(u===void 0)throw new Error("bad arguments — WebView.loadHtml: html");let f;if(l.present(n[1])){const v=l.string(n[1]);if(v===void 0)throw new Error("bad arguments — WebView.loadHtml: baseUrl");f=v}await i.loadHtml(u,f);return}case"setStops":{const u=l.list(n[0],f=>l.string(f));if(u===void 0)throw new Error("bad arguments — WebView.setStops: stops");await i.setStops(u);return}case"reload":{await i.reload();return}case"stopLoading":{await i.stopLoading();return}case"goBack":{await i.goBack();return}case"goForward":{await i.goForward();return}case"canGoBack":return await i.canGoBack();case"evaluate":{const u=l.string(n[0]);if(u===void 0)throw new Error("bad arguments — WebView.evaluate: js");return await i.evaluate(u)}case"postMessage":{const u=l.json(n[0]);if(u===void 0)throw new Error("bad arguments — WebView.postMessage: data");await i.postMessage(u);return}case"clearData":{await i.clearData();return}default:throw new Error(`Unknown method: ${o}`)}};return{el:i.el,call:p,destroy:()=>{var o;return(o=i.destroy)==null?void 0:o.call(i)}}},B.version)},C=new Set(["http:","https:","about:","data:","blob:"]),S=(e,t)=>{try{return new URL(e,t)}catch{return null}},V=(e,t)=>{try{const c=e==null?void 0:e.location.href;return c&&new URL(c).origin===t?c:null}catch{return null}},F=e=>{typeof window>"u"||typeof document>"u"||(H(e,(t,c)=>{let s=null,d=null,a=null;const i=p=>{d!==null&&(clearInterval(d),d=null);const o=a;a=null,s=null,o==null||o(p===void 0?{}:{url:p}),o&&c.closed()};return{show:p=>new Promise(o=>{if(a)throw new m("busy");const n=S(p);if(!n||n.protocol!=="http:"&&n.protocol!=="https:")throw new m("invalid");const u=window.open(n.href,"_blank","popup,noopener=0,width=480,height=720");if(!u)throw new m("invalid");s=u,a=o;const f=window.location.origin;d=setInterval(()=>{if(!s||s.closed)return i();const v=V(s,f);v&&v!=="about:blank"&&(s.close(),i(v))},250)}),dismiss:()=>{s==null||s.close(),i()},close:()=>{s==null||s.close(),i()}}}),U(e,(t,c,s)=>{const d=s.createElement("div");d.style.cssText="background:#fff;overflow:hidden";const a=s.createElement("iframe");a.style.cssText="position:absolute;inset:0;width:100%;height:100%;border:0",a.setAttribute("allow","payment *; camera; microphone; geolocation"),d.appendChild(a);let i=t.stops??[];const p=t.bridge===!0;let o=t.url??"about:blank";const n=window.location.origin;let u=!1;const f=()=>a.contentWindow,v=()=>V(f(),n),h=r=>{if(r.source!==f())return;const w=r.data;w&&typeof w=="object"&&"lecodes"in w&&c.message({data:w.lecodes})};window.addEventListener("message",h);const j=()=>{const r=f();!p||!r||v()===null||r.lecodes||(r.lecodes={postMessage:w=>c.message({data:w}),onMessage:null})};a.addEventListener("load",()=>{var w;if(u)return;const r=v();if(r!==null){if(i.find(A=>r.startsWith(A))){a.src="about:blank",c.stop({url:r});return}j();let b="";try{b=((w=f())==null?void 0:w.document.title)??""}catch{}c.load({url:r,title:b})}else c.load({url:o,title:""})});const y=r=>{const w=S(r,s.baseURI);if(!w||!C.has(w.protocol))throw new W("invalid");if(o=w.href,i.find(b=>o.startsWith(b))){c.stop({url:o});return}c.navigate({url:o}),a.src=o};t.url&&y(t.url);const k=()=>{const r=f();if(!r||v()===null)throw new W("failed");return r};return{el:d,load:r=>{y(r)},loadHtml:(r,w)=>{o=w??"about:blank",a.srcdoc=w?`<base href="${w.replace(/"/g,""")}">${r}`:r},setStops:r=>{i=r},reload:()=>{const r=f();r&&v()!==null?r.location.reload():a.src=o},stopLoading:()=>{var r;try{(r=f())==null||r.stop()}catch{}},goBack:()=>{var r;try{(r=f())==null||r.history.back()}catch{}},goForward:()=>{var r;try{(r=f())==null||r.history.forward()}catch{}},canGoBack:()=>{var r;try{return(((r=f())==null?void 0:r.history.length)??0)>1}catch{return!1}},evaluate:r=>{const w=k().eval(r);return w===void 0?null:JSON.parse(JSON.stringify(w))},postMessage:r=>{var g,b;(b=(g=k().lecodes)==null?void 0:g.onMessage)==null||b.call(g,r)},clearData:()=>{},destroy:()=>{u=!0,window.removeEventListener("message",h),a.src="about:blank",d.remove()}}}))};export{F as register};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i={present:e=>e!=null,f64:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,i32:e=>typeof e=="number"&&Number.isInteger(e)&&e>=-2147483648&&e<=2147483647?e:void 0,bool:e=>typeof e=="boolean"?e:void 0,string:e=>typeof e=="string"?e:void 0,json:e=>e,bytes:e=>Object.prototype.toString.call(e)==="[object Uint8Array]"?e.slice():void 0,object:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,array:(e,t)=>Array.isArray(e)&&(t===void 0||e.length===t)?e:void 0,list:(e,t)=>{if(!Array.isArray(e))return;const v=[];for(const s of e){const l=t(s);if(l===void 0)return;v.push(l)}return v},map:(e,t)=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const v={};for(const[s,l]of Object.entries(e)){const a=t(l);if(a===void 0)return;v[s]=a}return v}},Y=e=>!i.present(e)||i.object(e)?{}:void 0,Z=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.deviceId)){const r=i.string(t.deviceId);if(r===void 0)return;v=r}let s;if(i.present(t.echoCancellation)){const r=i.bool(t.echoCancellation);if(r===void 0)return;s=r}let l;if(i.present(t.noiseSuppression)){const r=i.bool(t.noiseSuppression);if(r===void 0)return;l=r}let a;if(i.present(t.autoGainControl)){const r=i.bool(t.autoGainControl);if(r===void 0)return;a=r}const f={};return v!==void 0&&(f.deviceId=v),s!==void 0&&(f.echoCancellation=s),l!==void 0&&(f.noiseSuppression=l),a!==void 0&&(f.autoGainControl=a),f},ee=e=>e==="user"||e==="environment"?e:void 0,K=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.deviceId)){const n=i.string(t.deviceId);if(n===void 0)return;v=n}let s;if(i.present(t.facingMode)){const n=ee(t.facingMode);if(n===void 0)return;s=n}let l;if(i.present(t.width)){const n=i.i32(t.width);if(n===void 0)return;l=n}let a;if(i.present(t.height)){const n=i.i32(t.height);if(n===void 0)return;a=n}let f;if(i.present(t.frameRate)){const n=i.f64(t.frameRate);if(n===void 0)return;f=n}const r={};return v!==void 0&&(r.deviceId=v),s!==void 0&&(r.facingMode=s),l!==void 0&&(r.width=l),a!==void 0&&(r.height=a),f!==void 0&&(r.frameRate=f),r},te=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.audio)){const a=Z(t.audio);if(a===void 0)return;v=a}let s;if(i.present(t.video)){const a=K(t.video);if(a===void 0)return;s=a}const l={};return v!==void 0&&(l.audio=v),s!==void 0&&(l.video=s),l},re=e=>e==="audio"||e==="video"?e:void 0,ne=e=>e==="earpiece"||e==="speaker"?e:void 0,ie=e=>{const t=i.object(e);if(!t)return;const v=i.list(t.urls,f=>i.string(f));if(v===void 0)return;let s;if(i.present(t.username)){const f=i.string(t.username);if(f===void 0)return;s=f}let l;if(i.present(t.credential)){const f=i.string(t.credential);if(f===void 0)return;l=f}const a={urls:v};return s!==void 0&&(a.username=s),l!==void 0&&(a.credential=l),a},oe=e=>e==="all"||e==="relay"?e:void 0,ae=e=>e==="balanced"||e==="max-compat"||e==="max-bundle"?e:void 0,U=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.iceServers)){const r=i.list(t.iceServers,n=>ie(n));if(r===void 0)return;v=r}let s;if(i.present(t.iceTransportPolicy)){const r=oe(t.iceTransportPolicy);if(r===void 0)return;s=r}let l;if(i.present(t.bundlePolicy)){const r=ae(t.bundlePolicy);if(r===void 0)return;l=r}let a;if(i.present(t.iceCandidatePoolSize)){const r=i.i32(t.iceCandidatePoolSize);if(r===void 0)return;a=r}const f={};return v!==void 0&&(f.iceServers=v),s!==void 0&&(f.iceTransportPolicy=s),l!==void 0&&(f.bundlePolicy=l),a!==void 0&&(f.iceCandidatePoolSize=a),f},de=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.iceRestart)){const f=i.bool(t.iceRestart);if(f===void 0)return;v=f}let s;if(i.present(t.offerToReceiveAudio)){const f=i.bool(t.offerToReceiveAudio);if(f===void 0)return;s=f}let l;if(i.present(t.offerToReceiveVideo)){const f=i.bool(t.offerToReceiveVideo);if(f===void 0)return;l=f}const a={};return v!==void 0&&(a.iceRestart=v),s!==void 0&&(a.offerToReceiveAudio=s),l!==void 0&&(a.offerToReceiveVideo=l),a},se=e=>e==="offer"||e==="answer"||e==="pranswer"||e==="rollback"?e:void 0,z=e=>{const t=i.object(e);if(!t)return;const v=se(t.type);if(v===void 0)return;const s=i.string(t.sdp);return s===void 0?void 0:{type:v,sdp:s}},ce=e=>{const t=i.object(e);if(!t)return;const v=i.string(t.candidate);if(v===void 0)return;let s=null;if(i.present(t.sdpMid)){const r=i.string(t.sdpMid);if(r===void 0)return;s=r}let l=null;if(i.present(t.sdpMLineIndex)){const r=i.i32(t.sdpMLineIndex);if(r===void 0)return;l=r}let a;if(i.present(t.usernameFragment)){const r=i.string(t.usernameFragment);if(r===void 0)return;a=r}const f={candidate:v,sdpMid:s,sdpMLineIndex:l};return a!==void 0&&(f.usernameFragment=a),f},X=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.rid)){const n=i.string(t.rid);if(n===void 0)return;v=n}let s;if(i.present(t.active)){const n=i.bool(t.active);if(n===void 0)return;s=n}let l;if(i.present(t.maxBitrate)){const n=i.i32(t.maxBitrate);if(n===void 0)return;l=n}let a;if(i.present(t.maxFramerate)){const n=i.f64(t.maxFramerate);if(n===void 0)return;a=n}let f;if(i.present(t.scaleResolutionDownBy)){const n=i.f64(t.scaleResolutionDownBy);if(n===void 0)return;f=n}const r={};return v!==void 0&&(r.rid=v),s!==void 0&&(r.active=s),l!==void 0&&(r.maxBitrate=l),a!==void 0&&(r.maxFramerate=a),f!==void 0&&(r.scaleResolutionDownBy=f),r},fe=e=>{const t=i.object(e);if(!t)return;const v=i.list(t.encodings,l=>X(l));return v===void 0?void 0:{encodings:v}},_=e=>e==="sendrecv"||e==="sendonly"||e==="recvonly"||e==="inactive"||e==="stopped"?e:void 0,ue=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.direction)){const r=_(t.direction);if(r===void 0)return;v=r}let s;if(i.present(t.trackId)){const r=i.string(t.trackId);if(r===void 0)return;s=r}let l;if(i.present(t.streamIds)){const r=i.list(t.streamIds,n=>i.string(n));if(r===void 0)return;l=r}let a;if(i.present(t.sendEncodings)){const r=i.list(t.sendEncodings,n=>X(n));if(r===void 0)return;a=r}const f={};return v!==void 0&&(f.direction=v),s!==void 0&&(f.trackId=s),l!==void 0&&(f.streamIds=l),a!==void 0&&(f.sendEncodings=a),f},ve=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.ordered)){const o=i.bool(t.ordered);if(o===void 0)return;v=o}let s;if(i.present(t.maxPacketLifeTime)){const o=i.i32(t.maxPacketLifeTime);if(o===void 0)return;s=o}let l;if(i.present(t.maxRetransmits)){const o=i.i32(t.maxRetransmits);if(o===void 0)return;l=o}let a;if(i.present(t.protocol)){const o=i.string(t.protocol);if(o===void 0)return;a=o}let f;if(i.present(t.negotiated)){const o=i.bool(t.negotiated);if(o===void 0)return;f=o}let r;if(i.present(t.id)){const o=i.i32(t.id);if(o===void 0)return;r=o}const n={};return v!==void 0&&(n.ordered=v),s!==void 0&&(n.maxPacketLifeTime=s),l!==void 0&&(n.maxRetransmits=l),a!==void 0&&(n.protocol=a),f!==void 0&&(n.negotiated=f),r!==void 0&&(n.id=r),n},q=e=>e==="cover"||e==="contain"?e:void 0,le=e=>{const t=i.object(e);if(!t)return;let v;if(i.present(t.trackId)){const f=i.string(t.trackId);if(f===void 0)return;v=f}let s;if(i.present(t.objectFit)){const f=q(t.objectFit);if(f===void 0)return;s=f}let l;if(i.present(t.mirror)){const f=i.bool(t.mirror);if(f===void 0)return;l=f}const a={};return v!==void 0&&(a.trackId=v),s!==void 0&&(a.objectFit=s),l!==void 0&&(a.mirror=l),a};class T extends Error{constructor(t){super(t),this.code=t}}const G={name:"rtcMedia",version:1},me=(e,t)=>{e.registerService(G.name,(v,s)=>{const l={deviceChange:()=>s.emit("deviceChange"),trackEnded:r=>s.emit("trackEnded",r)},a=t(Y(v)??{},l);return{call:async(r,n)=>{switch(r){case"getUserMedia":{const o=te(n[0]);if(o===void 0)throw new Error("bad arguments — RtcMedia.getUserMedia: constraints");return await a.getUserMedia(o)}case"enumerateDevices":return await a.enumerateDevices();case"setTrackEnabled":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcMedia.setTrackEnabled: trackId");const u=i.bool(n[1]);if(u===void 0)throw new Error("bad arguments — RtcMedia.setTrackEnabled: enabled");await a.setTrackEnabled(o,u);return}case"applyConstraints":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcMedia.applyConstraints: trackId");const u=K(n[1]);if(u===void 0)throw new Error("bad arguments — RtcMedia.applyConstraints: constraints");await a.applyConstraints(o,u);return}case"getTrackSettings":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcMedia.getTrackSettings: trackId");return await a.getTrackSettings(o)}case"stopTrack":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcMedia.stopTrack: trackId");await a.stopTrack(o);return}case"setAudioOutput":{const o=ne(n[0]);if(o===void 0)throw new Error("bad arguments — RtcMedia.setAudioOutput: output");await a.setAudioOutput(o);return}default:throw new Error(`Unknown method: ${r}`)}},close:()=>{var r;return(r=a.close)==null?void 0:r.call(a)}}},G.version)};class E extends Error{constructor(t){super(t),this.code=t}}const N={name:"rtcPeerConnection",version:1},we=(e,t)=>{e.registerService(N.name,(v,s)=>{const l={negotiationNeeded:()=>s.emit("negotiationNeeded"),iceCandidate:r=>s.emit("iceCandidate",r),signalingStateChange:r=>s.emit("signalingStateChange",r),iceGatheringStateChange:r=>s.emit("iceGatheringStateChange",r),iceConnectionStateChange:r=>s.emit("iceConnectionStateChange",r),connectionStateChange:r=>s.emit("connectionStateChange",r),track:r=>s.emit("track",r),trackMute:r=>s.emit("trackMute",r),trackEnded:r=>s.emit("trackEnded",r),dataChannel:r=>s.emit("dataChannel",r),dataChannelStateChange:r=>s.emit("dataChannelStateChange",r),dataChannelMessage:r=>s.emit("dataChannelMessage",r),dataChannelError:r=>s.emit("dataChannelError",r),dataChannelBufferedAmountLow:r=>s.emit("dataChannelBufferedAmountLow",r)},a=t(U(v)??{},l);return{call:async(r,n)=>{switch(r){case"createOffer":{let o;if(i.present(n[0])){const u=de(n[0]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.createOffer: options");o=u}return await a.createOffer(o)}case"createAnswer":return await a.createAnswer();case"setLocalDescription":{let o;if(i.present(n[0])){const u=z(n[0]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.setLocalDescription: description");o=u}return await a.setLocalDescription(o)}case"setRemoteDescription":{const o=z(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.setRemoteDescription: description");await a.setRemoteDescription(o);return}case"addIceCandidate":{let o;if(i.present(n[0])){const u=ce(n[0]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.addIceCandidate: candidate");o=u}await a.addIceCandidate(o);return}case"restartIce":{await a.restartIce();return}case"setConfiguration":{const o=U(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.setConfiguration: configuration");await a.setConfiguration(o);return}case"addTrack":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.addTrack: trackId");let u;if(i.present(n[1])){const w=i.list(n[1],R=>i.string(R));if(w===void 0)throw new Error("bad arguments — RtcPeerConnection.addTrack: streamIds");u=w}return await a.addTrack(o,u)}case"removeTrack":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.removeTrack: senderId");await a.removeTrack(o);return}case"replaceTrack":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.replaceTrack: senderId");let u=null;if(i.present(n[1])){const w=i.string(n[1]);if(w===void 0)throw new Error("bad arguments — RtcPeerConnection.replaceTrack: trackId");u=w}await a.replaceTrack(o,u);return}case"getSenderParameters":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.getSenderParameters: senderId");return await a.getSenderParameters(o)}case"setSenderParameters":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.setSenderParameters: senderId");const u=fe(n[1]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.setSenderParameters: parameters");await a.setSenderParameters(o,u);return}case"addTransceiver":{const o=re(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.addTransceiver: kind");let u;if(i.present(n[1])){const w=ue(n[1]);if(w===void 0)throw new Error("bad arguments — RtcPeerConnection.addTransceiver: options");u=w}return await a.addTransceiver(o,u)}case"getTransceivers":return await a.getTransceivers();case"setTransceiverDirection":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.setTransceiverDirection: transceiverId");const u=_(n[1]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.setTransceiverDirection: direction");await a.setTransceiverDirection(o,u);return}case"stopTransceiver":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.stopTransceiver: transceiverId");await a.stopTransceiver(o);return}case"getStats":{let o;if(i.present(n[0])){const u=i.string(n[0]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.getStats: trackId");o=u}return await a.getStats(o)}case"createDataChannel":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.createDataChannel: label");let u;if(i.present(n[1])){const w=ve(n[1]);if(w===void 0)throw new Error("bad arguments — RtcPeerConnection.createDataChannel: options");u=w}return await a.createDataChannel(o,u)}case"sendText":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.sendText: channelId");const u=i.string(n[1]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.sendText: text");await a.sendText(o,u);return}case"sendBinary":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.sendBinary: channelId");const u=i.bytes(n[1]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.sendBinary: data");await a.sendBinary(o,u);return}case"getBufferedAmount":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.getBufferedAmount: channelId");return await a.getBufferedAmount(o)}case"setBufferedAmountLowThreshold":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.setBufferedAmountLowThreshold: channelId");const u=i.f64(n[1]);if(u===void 0)throw new Error("bad arguments — RtcPeerConnection.setBufferedAmountLowThreshold: threshold");await a.setBufferedAmountLowThreshold(o,u);return}case"closeDataChannel":{const o=i.string(n[0]);if(o===void 0)throw new Error("bad arguments — RtcPeerConnection.closeDataChannel: channelId");await a.closeDataChannel(o);return}default:throw new Error(`Unknown method: ${r}`)}},close:()=>{var r;return(r=a.close)==null?void 0:r.call(a)}}},N.version)};class ge extends Error{constructor(t){super(t),this.code=t}}const $={name:"rtcVideo",version:1},he=(e,t)=>{e.registerView($.name,(v,s,l)=>{const a={resize:n=>s.emit("resize",n)},f=t(le(v)??{},a,l),r=async(n,o)=>{switch(n){case"setTrack":{let u=null;if(i.present(o[0])){const w=i.string(o[0]);if(w===void 0)throw new Error("bad arguments — RtcVideo.setTrack: trackId");u=w}await f.setTrack(u);return}case"setObjectFit":{const u=q(o[0]);if(u===void 0)throw new Error("bad arguments — RtcVideo.setObjectFit: fit");await f.setObjectFit(u);return}case"setMirror":{const u=i.bool(o[0]);if(u===void 0)throw new Error("bad arguments — RtcVideo.setMirror: mirror");await f.setMirror(u);return}default:throw new Error(`Unknown method: ${n}`)}};return{el:f.el,call:r,destroy:()=>{var n;return(n=f.destroy)==null?void 0:n.call(f)}}},$.version)},p=new Map,M=new Map,S=new Map;let pe=1;const P=e=>`${e}${pe++}`,L=e=>({id:e.id,kind:e.kind,label:e.label,enabled:e.enabled,muted:e.muted}),J=e=>{let t=M.get(e);return t||M.set(e,t=new MediaStream),t},Ce=e=>e instanceof Error?e.message:String(e),W=e=>{const t={};return e.deviceId?t.deviceId={exact:e.deviceId}:e.facingMode&&(t.facingMode=e.facingMode),e.width&&(t.width={ideal:e.width}),e.height&&(t.height={ideal:e.height}),e.frameRate&&(t.frameRate={ideal:e.frameRate}),t},be=e=>{const t=e instanceof DOMException?e.name:"";return t==="NotAllowedError"||t==="SecurityError"?new T("denied"):t==="NotFoundError"||t==="OverconstrainedError"||t==="NotReadableError"?new T("notFound"):new T("failed")},ye=e=>{me(e,(t,v)=>{var l,a;const s=()=>v.deviceChange();return(a=(l=navigator.mediaDevices).addEventListener)==null||a.call(l,"devicechange",s),{async getUserMedia(f){var o;const r={};if(f.audio){const u=f.audio,w={};u.deviceId&&(w.deviceId={exact:u.deviceId}),u.echoCancellation!==void 0&&(w.echoCancellation=u.echoCancellation),u.noiseSuppression!==void 0&&(w.noiseSuppression=u.noiseSuppression),u.autoGainControl!==void 0&&(w.autoGainControl=u.autoGainControl),r.audio=Object.keys(w).length?w:!0}if(f.video){const u=W(f.video);!f.video.deviceId&&!f.video.facingMode&&(u.facingMode="user"),r.video=u}let n;try{n=await navigator.mediaDevices.getUserMedia(r)}catch(u){throw be(u)}for(const u of n.getTracks())p.set(u.id,u),u.kind==="video"&&S.set(u.id,((o=f.video)==null?void 0:o.facingMode)??"user"),u.addEventListener("ended",()=>{p.get(u.id)===u&&(p.delete(u.id),v.trackEnded({trackId:u.id}))});return M.set(n.id,n),{id:n.id,tracks:n.getTracks().map(L)}},async enumerateDevices(){return(await navigator.mediaDevices.enumerateDevices()).map(r=>({deviceId:r.deviceId,kind:r.kind,label:r.label}))},setTrackEnabled(f,r){const n=p.get(f);if(!n)throw new T("notFound");n.enabled=r},async applyConstraints(f,r){const n=p.get(f);if(!n||n.kind!=="video")throw new T("notFound");try{await n.applyConstraints(W(r))}catch{throw new T("failed")}r.facingMode&&S.set(f,r.facingMode)},getTrackSettings(f){const r=p.get(f);if(!r)throw new T("notFound");const n=r.getSettings(),o={};n.deviceId&&(o.deviceId=n.deviceId);const u=n.facingMode??S.get(f);return u&&(o.facingMode=u),n.width&&(o.width=n.width),n.height&&(o.height=n.height),n.frameRate&&(o.frameRate=n.frameRate),o},stopTrack(f){const r=p.get(f);r&&(p.delete(f),S.delete(f),r.stop())},setAudioOutput(){},close(){var f,r;(r=(f=navigator.mediaDevices).removeEventListener)==null||r.call(f,"devicechange",s)}}})},H=e=>{const t={};return e.iceServers&&(t.iceServers=e.iceServers.map(v=>({urls:v.urls,...v.username!==void 0?{username:v.username}:{},...v.credential!==void 0?{credential:v.credential}:{}}))),e.iceTransportPolicy&&(t.iceTransportPolicy=e.iceTransportPolicy),e.bundlePolicy&&(t.bundlePolicy=e.bundlePolicy),e.iceCandidatePoolSize!==void 0&&(t.iceCandidatePoolSize=e.iceCandidatePoolSize),t},C=e=>new E(e instanceof DOMException&&e.name==="InvalidStateError"&&/closed/i.test(e.message)?"closed":"failed"),D=e=>({type:(e==null?void 0:e.type)??"offer",sdp:(e==null?void 0:e.sdp)??""}),Ee=e=>{we(e,(t,v)=>{const s=new RTCPeerConnection(H(t)),l=new Map,a=new Map,f=new Map,r=new Map,n=new Map,o=new Set;let u=!1;const w=d=>{let c=a.get(d);return c||(c=P("sender"),a.set(d,c),l.set(c,d)),c},R=d=>{let c=r.get(d);return c||(c=P("transceiver"),r.set(d,c),f.set(c,d)),c},A=d=>{var c;return{id:w(d),trackId:((c=d.track)==null?void 0:c.id)??null}},F=d=>{o.has(d.id)||(o.add(d.id),p.set(d.id,d),d.addEventListener("mute",()=>v.trackMute({trackId:d.id,muted:!0})),d.addEventListener("unmute",()=>v.trackMute({trackId:d.id,muted:!1})),d.addEventListener("ended",()=>{p.get(d.id)===d&&p.delete(d.id),v.trackEnded({trackId:d.id})}))},B=d=>(F(d.receiver.track),{id:R(d),mid:d.mid,direction:d.direction,currentDirection:d.currentDirection??null,sender:A(d.sender),receiverTrack:L(d.receiver.track),stopped:d.direction==="stopped"}),j=(d,c)=>({id:d,label:c.label,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime??null,maxRetransmits:c.maxRetransmits??null,protocol:c.protocol,negotiated:c.negotiated,streamId:c.id??null,readyState:c.readyState}),O=(d,c)=>{n.set(d,c),c.binaryType="arraybuffer",c.addEventListener("open",()=>v.dataChannelStateChange({id:d,state:"open"})),c.addEventListener("closing",()=>v.dataChannelStateChange({id:d,state:"closing"})),c.addEventListener("close",()=>{n.delete(d),v.dataChannelStateChange({id:d,state:"closed"})}),c.addEventListener("error",m=>v.dataChannelError({id:d,message:Ce(m.error??"error")})),c.addEventListener("bufferedamountlow",()=>v.dataChannelBufferedAmountLow({id:d})),c.addEventListener("message",m=>{const g=m.data;typeof g=="string"?v.dataChannelMessage({id:d,text:g}):v.dataChannelMessage({id:d,binary:new Uint8Array(g)})})},k=d=>{const c=n.get(d);if(!c)throw new E("notFound");return c},I=d=>{const c=l.get(d);if(!c)throw new E("notFound");return c},x=d=>{const c=p.get(d);if(!c)throw new E("notFound");return c},b=()=>{if(u)throw new E("closed")};return s.addEventListener("negotiationneeded",()=>v.negotiationNeeded()),s.addEventListener("icecandidate",d=>{const c=d.candidate,m=c&&c.candidate?{candidate:c.candidate,sdpMid:c.sdpMid,sdpMLineIndex:c.sdpMLineIndex,...c.usernameFragment?{usernameFragment:c.usernameFragment}:{}}:null;v.iceCandidate({candidate:m})}),s.addEventListener("signalingstatechange",()=>v.signalingStateChange({state:s.signalingState})),s.addEventListener("icegatheringstatechange",()=>v.iceGatheringStateChange({state:s.iceGatheringState})),s.addEventListener("iceconnectionstatechange",()=>v.iceConnectionStateChange({state:s.iceConnectionState})),s.addEventListener("connectionstatechange",()=>v.connectionStateChange({state:s.connectionState})),s.addEventListener("track",d=>{F(d.track);for(const c of d.streams)M.set(c.id,c);v.track({track:L(d.track),streamIds:d.streams.map(c=>c.id),transceiverId:R(d.transceiver)})}),s.addEventListener("datachannel",d=>{const c=P("channel");O(c,d.channel),v.dataChannel(j(c,d.channel))}),{async createOffer(d){b();try{return D(await s.createOffer(d??{}))}catch(c){throw C(c)}},async createAnswer(){b();try{return D(await s.createAnswer())}catch(d){throw C(d)}},async setLocalDescription(d){b();try{d?await s.setLocalDescription(d):await s.setLocalDescription()}catch(c){throw C(c)}return D(s.localDescription)},async setRemoteDescription(d){b();try{await s.setRemoteDescription(d)}catch(c){throw C(c)}},async addIceCandidate(d){b();try{await s.addIceCandidate(d??void 0)}catch(c){throw C(c)}},restartIce(){s.restartIce()},setConfiguration(d){try{s.setConfiguration(H(d))}catch(c){throw C(c)}},addTrack(d,c=[]){b();const m=x(d);try{return A(s.addTrack(m,...c.map(J)))}catch(g){throw C(g)}},removeTrack(d){b();try{s.removeTrack(I(d))}catch(c){throw C(c)}},async replaceTrack(d,c){b();const m=c===null?null:x(c);try{await I(d).replaceTrack(m)}catch(g){throw C(g)}},getSenderParameters(d){return{encodings:(I(d).getParameters().encodings??[]).map(m=>({...m.rid!==void 0?{rid:m.rid}:{},...m.active!==void 0?{active:m.active}:{},...m.maxBitrate!==void 0?{maxBitrate:m.maxBitrate}:{},...m.maxFramerate!==void 0?{maxFramerate:m.maxFramerate}:{},...m.scaleResolutionDownBy!==void 0?{scaleResolutionDownBy:m.scaleResolutionDownBy}:{}}))}},async setSenderParameters(d,c){const m=I(d),g=m.getParameters();g.encodings=(g.encodings??[]).map((h,Q)=>{const y=c.encodings.find(V=>V.rid&&V.rid===h.rid)??c.encodings[Q];return y&&(y.active!==void 0&&(h.active=y.active),y.maxBitrate!==void 0&&(h.maxBitrate=y.maxBitrate),y.maxFramerate!==void 0&&(h.maxFramerate=y.maxFramerate),y.scaleResolutionDownBy!==void 0&&(h.scaleResolutionDownBy=y.scaleResolutionDownBy)),h});try{await m.setParameters(g)}catch(h){throw C(h)}},addTransceiver(d,c={}){b();const m={};c.direction&&(m.direction=c.direction),c.streamIds&&(m.streams=c.streamIds.map(J)),c.sendEncodings&&(m.sendEncodings=c.sendEncodings.map(h=>({...h})));const g=c.trackId?x(c.trackId):d;try{return B(s.addTransceiver(g,m))}catch(h){throw C(h)}},getTransceivers(){return s.getTransceivers().map(B)},setTransceiverDirection(d,c){const m=f.get(d);if(!m)throw new E("notFound");try{m.direction=c}catch(g){throw C(g)}},stopTransceiver(d){const c=f.get(d);if(!c)throw new E("notFound");c.stop()},async getStats(d){const c=await s.getStats(d?p.get(d)??null:null),m={};return c.forEach((g,h)=>{m[h]=JSON.parse(JSON.stringify(g))}),m},createDataChannel(d,c={}){b();let m;try{m=s.createDataChannel(d,c)}catch(h){throw C(h)}const g=P("channel");return O(g,m),j(g,m)},sendText(d,c){const m=k(d);if(m.readyState!=="open")throw new E("closed");m.send(c)},sendBinary(d,c){const m=k(d);if(m.readyState!=="open")throw new E("closed");m.send(c)},getBufferedAmount(d){return k(d).bufferedAmount},setBufferedAmountLowThreshold(d,c){k(d).bufferedAmountLowThreshold=c},closeDataChannel(d){var c;(c=n.get(d))==null||c.close()},close(){if(!u){u=!0,s.close();for(const d of n.values())d.close();n.clear()}}}})},Te=e=>{he(e,(t,v,s)=>{const l=s.createElement("div");l.style.cssText="background:#000;overflow:hidden";const a=s.createElement("video");a.autoplay=!0,a.muted=!0,a.playsInline=!0,a.setAttribute("playsinline",""),a.style.cssText="position:absolute;inset:0;width:100%;height:100%",l.appendChild(a);let f=t.objectFit??"cover",r=t.mirror??!1;const n=()=>{a.style.objectFit=f,a.style.transform=r?"scaleX(-1)":""};n(),a.addEventListener("resize",()=>{a.videoWidth&&v.resize({width:a.videoWidth,height:a.videoHeight})});const o=u=>{if(u===null){a.srcObject=null;return}const w=p.get(u);if(!w)throw new ge("notFound");a.srcObject=new MediaStream([w]),a.play().catch(()=>{})};try{o(t.trackId??null)}catch{}return{el:l,setTrack:u=>{o(u)},setObjectFit:u=>{f=u,n()},setMirror:u=>{r=u,n()},destroy:()=>{a.srcObject=null,l.remove()}}})},Re=e=>{var t;typeof navigator>"u"||typeof RTCPeerConnection>"u"||typeof((t=navigator.mediaDevices)==null?void 0:t.getUserMedia)!="function"||(ye(e),Ee(e),Te(e))};export{Re as register};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"plugins": {
|
|
3
|
+
"browser": "plugins/browser/index-BpFb50ko.js",
|
|
3
4
|
"camera": "plugins/camera/index-5XOM8eHl.js",
|
|
4
5
|
"geolocation": "plugins/geolocation/index-BjTKN9_P.js",
|
|
5
6
|
"map": "plugins/map/index-BTBHQ264.js",
|
|
6
|
-
"qr-scanner": "plugins/qr-scanner/index-CK_cYoJR.js"
|
|
7
|
+
"qr-scanner": "plugins/qr-scanner/index-CK_cYoJR.js",
|
|
8
|
+
"webrtc": "plugins/webrtc/index-CbCltXvl.js"
|
|
7
9
|
}
|
|
8
10
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type AppConfig, ANDROID_SDK_VARIANTS, type AndroidSdkVariant, VERSION_RE, androidSdkArtifact, androidVariantEngines,
|
|
12
12
|
childEnv, cmpVersion, ensureShellIgnored, fetchLatestSdkVersion,
|
|
13
13
|
projectRoot, readJson, resolvePlugin, resolveSdkVersion, resolveVariant, runTool, sdkSatisfies, slugify,
|
|
14
|
-
writeJson, type LockEntry, resolveUpdateUrl,
|
|
14
|
+
writeJson, type LockEntry, resolveUpdateUrl, urlSchemeOf,
|
|
15
15
|
} from "./shared"
|
|
16
16
|
import { loadIconMaster, restampManifestIcon, writeAndroidIcons } from "./icon"
|
|
17
17
|
import {
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
appManifestTemplate, appViewModelTemplate, gradleWrapperProperties, mainActivityTemplate,
|
|
21
21
|
pluginBuildGradleTemplate, rootBuildGradleTemplate, runtimeBuildGradleTemplate,
|
|
22
22
|
runtimeKotlinTemplate, settingsGradleTemplate, stringsXmlTemplate, themesXmlTemplate,
|
|
23
|
-
type AndroidRuntimePlugin, type AndroidShellIdentity, runtimeManifestTemplate,
|
|
23
|
+
type AndroidRuntimePlugin, type AndroidShellIdentity, runtimeManifestTemplate, urlSchemeFilter,
|
|
24
24
|
} from "./templates/android"
|
|
25
25
|
import { GRADLEW_BAT, GRADLEW_SH } from "./templates/gradlew"
|
|
26
26
|
|
|
@@ -171,7 +171,7 @@ export const initAndroid = async (opts: AndroidInitOptions) => {
|
|
|
171
171
|
|
|
172
172
|
write("app/build.gradle.kts", appBuildGradleTemplate(identity, config.android!.minify ?? true))
|
|
173
173
|
write("app/proguard-rules.pro", APP_PROGUARD_RULES)
|
|
174
|
-
write("app/src/main/AndroidManifest.xml", appManifestTemplate())
|
|
174
|
+
write("app/src/main/AndroidManifest.xml", appManifestTemplate(urlSchemeOf(config)))
|
|
175
175
|
write(`app/src/main/java/${pkgPath}/MainActivity.kt`, mainActivityTemplate(identity.applicationId))
|
|
176
176
|
write(`app/src/main/java/${pkgPath}/AppViewModel.kt`, appViewModelTemplate(identity.applicationId))
|
|
177
177
|
write("app/src/main/res/values/themes.xml", themesXmlTemplate())
|
|
@@ -395,12 +395,39 @@ export const syncAndroid = async (root: string, config: AppConfig, prior: SyncAr
|
|
|
395
395
|
await writeAndroidIcons(androidDir, await loadIconMaster(root, config))
|
|
396
396
|
restampManifestIcon(androidDir)
|
|
397
397
|
}
|
|
398
|
+
restampManifestUrlScheme(androidDir, urlSchemeOf(config))
|
|
398
399
|
|
|
399
400
|
log("")
|
|
400
401
|
success(`Android shell synced: app.js + ${runtimePlugins.length} plugin(s), SDK ${sdkVersion}, v${config.version ?? "1.0.0"} (${config.android?.versionCode ?? 1}).`)
|
|
401
402
|
note("Build & run from Android Studio (`lecodes app open android`) — user files in android/app/ were not touched.")
|
|
402
403
|
}
|
|
403
404
|
|
|
405
|
+
/** The `lecodes:urlScheme` block of the USER-owned manifest follows app.json: written into the
|
|
406
|
+
* activity when the key appears, rewritten when it changes, removed when it goes. A manifest
|
|
407
|
+
* without the tag and without a MainActivity to put it in is left alone, with a warning. */
|
|
408
|
+
export const restampManifestUrlScheme = (androidDir: string, urlScheme: string | undefined): void => {
|
|
409
|
+
const path = join(androidDir, "app", "src", "main", "AndroidManifest.xml")
|
|
410
|
+
if (!existsSync(path)) return
|
|
411
|
+
const content = readFileSync(path, "utf8")
|
|
412
|
+
const tagged = /\n[ \t]*<!-- lecodes:urlScheme[\s\S]*?<!-- \/lecodes:urlScheme -->/
|
|
413
|
+
const block = urlSchemeFilter(urlScheme)
|
|
414
|
+
let next: string
|
|
415
|
+
if (tagged.test(content)) next = content.replace(tagged, block)
|
|
416
|
+
else if (!urlScheme) return
|
|
417
|
+
else {
|
|
418
|
+
// Inside the MainActivity element: right after its LAUNCHER intent-filter.
|
|
419
|
+
const launcher = /(<category android:name="android\.intent\.category\.LAUNCHER" \/>\s*<\/intent-filter>)/
|
|
420
|
+
if (!launcher.test(content)) {
|
|
421
|
+
warn(`couldn't find the launcher activity in app/src/main/AndroidManifest.xml — add an intent-filter for the "${urlScheme}" scheme yourself.`)
|
|
422
|
+
return
|
|
423
|
+
}
|
|
424
|
+
next = content.replace(launcher, `$1${block}`)
|
|
425
|
+
}
|
|
426
|
+
if (next === content) return
|
|
427
|
+
writeFileSync(path, next)
|
|
428
|
+
log(`${c.green("updated")} android/app/src/main/AndroidManifest.xml: urlScheme ${urlScheme ? `→ ${urlScheme}://` : "removed"}`)
|
|
429
|
+
}
|
|
430
|
+
|
|
404
431
|
/** Values-only restamps + tagged-line management in the USER-owned app/build.gradle.kts —
|
|
405
432
|
* the Android analog of the pbxproj MARKETING_VERSION restamp + CODE_SIGN_ENTITLEMENTS
|
|
406
433
|
* injection: warn-not-fail when the user restructured, and the ONLY lines sync ever removes
|
|
@@ -116,8 +116,9 @@ const buildDesktop = async (flags: FlagValues<typeof desktopBuildFlags>): Promis
|
|
|
116
116
|
|
|
117
117
|
// Only what the bundle actually references ships — the compile inventory lists EVERY project
|
|
118
118
|
// resource (design/ references included), which would multiply the build size. asset() compiles
|
|
119
|
-
// to
|
|
120
|
-
|
|
119
|
+
// to `"id:" + _creatorFetch.local("<name>")` (fetchLocal in pre-2.0 bundles), so the bundle itself is
|
|
120
|
+
// the reference list.
|
|
121
|
+
const wanted = new Set([...js.matchAll(/(?:fetchLocal|_creatorFetch\.local)\("([^"]+)"\)/g)].map((m) => m[1]))
|
|
121
122
|
// Compiled shader artifacts always ship: their name is built at runtime ("<hash>_" +
|
|
122
123
|
// _creator.backend + ".filamat" — one bundle serves every native backend), so no literal for
|
|
123
124
|
// the scan above to find. They only exist here when a shader was actually compiled locally.
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
FIRST_PARTY_PLUGINS, SDK_VARIANTS, cmpVersion, ensureShellIgnored,
|
|
16
16
|
fetchLatestSdkVersion, isLocalPluginSpec, latestPluginTag, projectRoot, readJson, resolvePlugin, resolveSdkVersion, sdkSatisfies,
|
|
17
|
-
resolveVariant, runTool, slugify, writeJson, VERSION_RE, type AppConfig, type LockEntry, resolveUpdateUrl,
|
|
17
|
+
resolveVariant, runTool, slugify, writeJson, VERSION_RE, type AppConfig, type LockEntry, resolveUpdateUrl, urlSchemeOf,
|
|
18
18
|
} from "./shared"
|
|
19
19
|
import {
|
|
20
20
|
ANDROID_SDK_MIN_VERSION, ANDROID_SDK_REPO, androidBuild, doctorAndroidChecks, initAndroid,
|
|
@@ -165,7 +165,7 @@ const initIos = async (opts: IosInitOptions): Promise<void> => {
|
|
|
165
165
|
write("App/AppDelegate.swift", APP_DELEGATE)
|
|
166
166
|
write("App/SceneDelegate.swift", SCENE_DELEGATE)
|
|
167
167
|
write("App/ViewController.swift", VIEW_CONTROLLER)
|
|
168
|
-
write("App/Info.plist", infoPlistTemplate({}))
|
|
168
|
+
write("App/Info.plist", infoPlistTemplate({}, undefined, urlSchemeOf(config)))
|
|
169
169
|
write("App/App.entitlements", entitlementsTemplate({}))
|
|
170
170
|
write("App/Base.lproj/LaunchScreen.storyboard", LAUNCH_STORYBOARD)
|
|
171
171
|
write("App/Assets.xcassets/Contents.json", ASSETS_ROOT_JSON)
|
|
@@ -376,7 +376,7 @@ const syncIos = async (root: string, config: AppConfig): Promise<SyncArtifacts>
|
|
|
376
376
|
const mergedKeys: Record<string, string> = {}
|
|
377
377
|
for (const [key, values] of Object.entries(infoValues)) mergedKeys[key] = [...new Set(values)].join(" ")
|
|
378
378
|
const updateUrl = resolveUpdateUrl(config.update, root, sdkVersion)
|
|
379
|
-
writeFileSync(join(iosDir, "App", "Info.plist"), infoPlistTemplate(mergedKeys, updateUrl))
|
|
379
|
+
writeFileSync(join(iosDir, "App", "Info.plist"), infoPlistTemplate(mergedKeys, updateUrl, urlSchemeOf(config)))
|
|
380
380
|
if (updateUrl) log(`${c.green("update")} OTA source ${updateUrl} — checked natively at launch, new code applies next launch${config.update === undefined ? c.dim(' ("update": false in app.json turns it off)') : ""}`)
|
|
381
381
|
else if (config.update === false) log(`${c.green("update")} off (app.json "update": false)`)
|
|
382
382
|
else note(`no OTA: a local-only project has no bundle on the platform — push it, or set "update": {"url": "https://…/app.js"} for custom hosting`)
|
|
@@ -439,7 +439,7 @@ const sync = defineCommand({
|
|
|
439
439
|
name: "sync",
|
|
440
440
|
summary: "Make every existing shell match the project: bundle + assets + SDK variant + plugins + CLI-owned files",
|
|
441
441
|
usage: "[ios|android]",
|
|
442
|
-
description: "Compiles the bundle and embeds the assets it references (ios/App/Resources/ resp. the android assets/; offline by default, also for server projects — app.json \"resources\": {\"remote\": [globs]} keeps heavy assets streaming), picks the SDK variant from the bundle's engine use, vendors the app.json plugins (pinned in plugins.lock.json) and regenerates the CLI-owned shell files. User files (ios/App/*.swift, android/app/) are never touched.\n\nNative OTA JS updates at launch (both shells; the current launch runs the newest LOCAL bundle, a download applies on the next): on by default for a pushed project (its bundle on the platform, the launcher's own URL), app.json \"update\": {\"url\": …} for custom hosting, \"update\": false turns it off. A download runs only when it is of the shell's SDK major and not older than the bundle running. app.json \"icon\" (a square ≥1024px image) renders the app icons every sync (\"iconBackground\": the adaptive / flatten backdrop). No platform = every shell that exists; a dual-shell project compiles once.",
|
|
442
|
+
description: "Compiles the bundle and embeds the assets it references (ios/App/Resources/ resp. the android assets/; offline by default, also for server projects — app.json \"resources\": {\"remote\": [globs]} keeps heavy assets streaming), picks the SDK variant from the bundle's engine use, vendors the app.json plugins (pinned in plugins.lock.json) and regenerates the CLI-owned shell files. User files (ios/App/*.swift, android/app/) are never touched.\n\nNative OTA JS updates at launch (both shells; the current launch runs the newest LOCAL bundle, a download applies on the next): on by default for a pushed project (its bundle on the platform, the launcher's own URL), app.json \"update\": {\"url\": …} for custom hosting, \"update\": false turns it off. A download runs only when it is of the shell's SDK major and not older than the bundle running. app.json \"icon\" (a square ≥1024px image) renders the app icons every sync (\"iconBackground\": the adaptive / flatten backdrop). app.json \"urlScheme\" (\"myshop\") is the scheme the shells open on: iOS CFBundleURLTypes, Android a BROWSABLE intent-filter — a link arrives as app.launchUrl / the \"url\" event (the return of Browser.open with a returnUrl). No platform = every shell that exists; a dual-shell project compiles once.",
|
|
443
443
|
examples: ["lecodes app sync", "lecodes app sync android"],
|
|
444
444
|
run: ({ args }) => runSync(args[0]),
|
|
445
445
|
})
|
|
@@ -29,6 +29,7 @@ export const FIRST_PARTY_PLUGINS: Record<string, string> = {
|
|
|
29
29
|
"map": "letary/lecodes-plugins",
|
|
30
30
|
"geolocation": "letary/lecodes-plugins",
|
|
31
31
|
"push": "letary/lecodes-plugins",
|
|
32
|
+
"browser": "letary/lecodes-plugins",
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export interface AppConfig {
|
|
@@ -43,6 +44,11 @@ export interface AppConfig {
|
|
|
43
44
|
* layer, and what a transparent master is flattened onto for the opacity-required iOS icon. */
|
|
44
45
|
iconBackground?: string
|
|
45
46
|
plugins?: Record<string, string>
|
|
47
|
+
/** The custom URL scheme the shells open on (`myshop` → `myshop://…`): iOS CFBundleURLTypes,
|
|
48
|
+
* Android a BROWSABLE intent-filter on the activity. A link reaches the app as `app.launchUrl`
|
|
49
|
+
* / the "url" event — what `Browser.open(url, { returnUrl })` resolves on after an OAuth redirect.
|
|
50
|
+
* Lowercase letters, digits, `+ - .`, starting with a letter. */
|
|
51
|
+
urlScheme?: string
|
|
46
52
|
/** `remote`: lecodesignore-style globs of resources to STREAM from the server instead of
|
|
47
53
|
* embedding in the app (server-backed projects only — a streamed asset needs a server URL). */
|
|
48
54
|
resources?: { remote?: string[] }
|
|
@@ -195,6 +201,18 @@ export interface DesktopWindowConfig {
|
|
|
195
201
|
scale?: number | "fit" | "system"
|
|
196
202
|
}
|
|
197
203
|
|
|
204
|
+
/** app.json "urlScheme", checked: what both platforms accept as a scheme (RFC 3986, lowercase —
|
|
205
|
+
* Android matches it case-sensitively). Undefined when the key is absent. */
|
|
206
|
+
export const urlSchemeOf = (config: Pick<AppConfig, "urlScheme"> | null | undefined): string | undefined => {
|
|
207
|
+
const scheme = config?.urlScheme
|
|
208
|
+
if (scheme === undefined) return undefined
|
|
209
|
+
if (typeof scheme !== "string" || !/^[a-z][a-z0-9+.-]*$/.test(scheme)) {
|
|
210
|
+
throw new CliError(`app.json "urlScheme" must be lowercase letters, digits, "+", "-" or ".", starting with a letter — got ${JSON.stringify(scheme)}.`)
|
|
211
|
+
}
|
|
212
|
+
if (scheme === "http" || scheme === "https") throw new CliError(`app.json "urlScheme" is the app's OWN scheme ("myshop" → myshop://…), not ${scheme}.`)
|
|
213
|
+
return scheme
|
|
214
|
+
}
|
|
215
|
+
|
|
198
216
|
/** app.json wherever a command needs the project-level desktop/window config. Tolerant of a
|
|
199
217
|
* missing or broken file — standalone projects (no app.json) must keep working everywhere
|
|
200
218
|
* this is consulted. */
|
|
@@ -455,7 +455,19 @@ export const APP_PROGUARD_RULES = `# R8 rules for app-local code (yours — \`le
|
|
|
455
455
|
# -keep class com.example.myapp.MyBridge { *; }
|
|
456
456
|
`
|
|
457
457
|
|
|
458
|
-
|
|
458
|
+
/** The BROWSABLE intent-filter of app.json "urlScheme", tagged so sync can restamp it in the
|
|
459
|
+
* user-owned manifest (`restampManifestUrlScheme`). Empty without a scheme. */
|
|
460
|
+
export const urlSchemeFilter = (urlScheme?: string): string => !urlScheme ? "" : `
|
|
461
|
+
<!-- lecodes:urlScheme — app.json "urlScheme": links the app opens on (the "url" app event) -->
|
|
462
|
+
<intent-filter>
|
|
463
|
+
<action android:name="android.intent.action.VIEW" />
|
|
464
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
465
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
466
|
+
<data android:scheme="${urlScheme}" />
|
|
467
|
+
</intent-filter>
|
|
468
|
+
<!-- /lecodes:urlScheme -->`
|
|
469
|
+
|
|
470
|
+
export const appManifestTemplate = (urlScheme?: string): string => `<?xml version="1.0" encoding="utf-8"?>
|
|
459
471
|
<!-- Generated by \`lecodes app init\` — yours to edit. Sync leaves it alone, except that with
|
|
460
472
|
app.json "icon" set it restamps the android:icon VALUE to the generated @mipmap set.
|
|
461
473
|
Plugin permissions/services arrive through the plugin modules' own manifests via the AGP
|
|
@@ -480,7 +492,7 @@ export const appManifestTemplate = (): string => `<?xml version="1.0" encoding="
|
|
|
480
492
|
<intent-filter>
|
|
481
493
|
<action android:name="android.intent.action.MAIN" />
|
|
482
494
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
483
|
-
</intent-filter
|
|
495
|
+
</intent-filter>${urlSchemeFilter(urlScheme)}
|
|
484
496
|
</activity>
|
|
485
497
|
</application>
|
|
486
498
|
|
|
@@ -472,11 +472,30 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
472
472
|
LeCodesAppHooks.coldStartNotification(response)
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
+
let controller = ViewController()
|
|
476
|
+
// Cold-started by a link (app.json "urlScheme", or a universal link): the engine reads it as
|
|
477
|
+
// app.launchUrl — set BEFORE the view loads, which boots the JS world.
|
|
478
|
+
if let url = connectionOptions.urlContexts.first?.url
|
|
479
|
+
?? connectionOptions.userActivities.first(where: { $0.activityType == NSUserActivityTypeBrowsingWeb })?.webpageURL {
|
|
480
|
+
controller.engine.setLaunchUrl(url.absoluteString)
|
|
481
|
+
}
|
|
475
482
|
let window = UIWindow(windowScene: windowScene)
|
|
476
|
-
window.rootViewController =
|
|
483
|
+
window.rootViewController = controller
|
|
477
484
|
self.window = window
|
|
478
485
|
window.makeKeyAndVisible()
|
|
479
486
|
}
|
|
487
|
+
|
|
488
|
+
// A link while the app runs: the "url" app event (an OAuth redirect back into the app, a
|
|
489
|
+
// checkout's return — what Browser.open(url, { returnUrl }) resolves on).
|
|
490
|
+
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
|
491
|
+
guard let url = URLContexts.first?.url else { return }
|
|
492
|
+
(window?.rootViewController as? ViewController)?.engine.emitUrl(url.absoluteString)
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
|
|
496
|
+
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, let url = userActivity.webpageURL else { return }
|
|
497
|
+
(window?.rootViewController as? ViewController)?.engine.emitUrl(url.absoluteString)
|
|
498
|
+
}
|
|
480
499
|
}
|
|
481
500
|
`
|
|
482
501
|
|
|
@@ -536,9 +555,22 @@ ${body}</dict>
|
|
|
536
555
|
/** Info.plist — CLI-owned: the scene manifest plus usage-description keys merged from the
|
|
537
556
|
* installed plugins' manifests (sorted for stable diffs), plus the native OTA source
|
|
538
557
|
* (app.json "update" → LeCodesUpdater reads this key at launch). */
|
|
539
|
-
export const infoPlistTemplate = (pluginKeys: Record<string, string>, updateUrl?: string): string => {
|
|
558
|
+
export const infoPlistTemplate = (pluginKeys: Record<string, string>, updateUrl?: string, urlScheme?: string): string => {
|
|
540
559
|
const xml = (s: string) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
|
541
560
|
const keys = Object.keys(pluginKeys).sort()
|
|
561
|
+
const schemeBlock = !urlScheme ? "" : `
|
|
562
|
+
<!-- lecodes:urlScheme — app.json "urlScheme": links the app opens on (the "url" app event) -->
|
|
563
|
+
<key>CFBundleURLTypes</key>
|
|
564
|
+
<array>
|
|
565
|
+
<dict>
|
|
566
|
+
<key>CFBundleURLName</key>
|
|
567
|
+
<string>${xml(urlScheme)}</string>
|
|
568
|
+
<key>CFBundleURLSchemes</key>
|
|
569
|
+
<array>
|
|
570
|
+
<string>${xml(urlScheme)}</string>
|
|
571
|
+
</array>
|
|
572
|
+
</dict>
|
|
573
|
+
</array>`
|
|
542
574
|
const pluginBlock = keys.length === 0 ? "" : `
|
|
543
575
|
<!-- lecodes:plugins — merged from installed plugin manifests by \`lecodes app sync\` -->
|
|
544
576
|
${keys.map(k => ` <key>${k}</key>\n <string>${pluginKeys[k]}</string>`).join("\n")}`
|
|
@@ -554,7 +586,7 @@ ${keys.map(k => ` <key>${k}</key>\n <string>${pluginKeys[k]}</string>`).join("\n
|
|
|
554
586
|
so App Store Connect skips the "Missing Compliance" prompt on every build.
|
|
555
587
|
Flip to <true/> only if the app adds its own non-exempt cryptography. -->
|
|
556
588
|
<key>ITSAppUsesNonExemptEncryption</key>
|
|
557
|
-
<false
|
|
589
|
+
<false/>${schemeBlock}
|
|
558
590
|
<key>UIApplicationSceneManifest</key>
|
|
559
591
|
<dict>
|
|
560
592
|
<key>UIApplicationSupportsMultipleScenes</key>
|