@limrun/ui 0.22.1 → 0.22.3
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/README.md +13 -7
- package/dist/{BufferGeometryUtils-B2-bJqFj.js → BufferGeometryUtils-CMbyl1DL.js} +1 -1
- package/dist/{BufferGeometryUtils-BcXIkYhS.mjs → BufferGeometryUtils-DEy5W2hb.mjs} +1 -1
- package/dist/{GLTFLoader-BQvr_TBF.mjs → GLTFLoader-B3xbM8m1.mjs} +2 -2
- package/dist/{GLTFLoader-CsxjkQ8a.js → GLTFLoader-CfPNHfJQ.js} +1 -1
- package/dist/components/macbook-geometry.d.ts +5 -5
- package/dist/components/model-source.d.ts +4 -1
- package/dist/components/remote-control.d.ts +3 -2
- package/dist/{duo-frame-CyoWZakh.mjs → duo-frame-BCmB9_5p.mjs} +4 -4
- package/dist/{duo-frame-B04_gIge.js → duo-frame-Bm0hprn9.js} +2 -2
- package/dist/{duo-view-DJEQ3Q74.mjs → duo-view-C07GD_5E.mjs} +2 -2
- package/dist/{duo-view-BHwnQmx_.js → duo-view-tUJbbWoS.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2 -2
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +1 -1
- package/dist/macbook-frame-BxJfxUcU.js +2 -0
- package/dist/macbook-frame-Dm6ko0j9.mjs +340 -0
- package/dist/macbook-model-B4t8BSHX.js +1 -0
- package/dist/macbook-model-BYrio_FY.mjs +4 -0
- package/dist/{model-source-BAZAKTcr.mjs → model-source-CN_i4mVy.mjs} +57 -47
- package/dist/{model-source-DbYJQWkh.js → model-source-D3_k9qRK.js} +1 -1
- package/dist/{remote-control-PGtDEDgm.mjs → remote-control-BX6dzHtt.mjs} +686 -720
- package/dist/remote-control-CEVcOPQZ.js +1 -0
- package/package.json +1 -1
- package/dist/macbook-frame-Be0dCliH.js +0 -3
- package/dist/macbook-frame-DzwIHHCA.mjs +0 -344
- package/dist/macbook-model-BiMxLpmf.mjs +0 -4
- package/dist/macbook-model-BpUdvtlU.js +0 -1
- package/dist/remote-control-Db6ssV0S.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./index.css');const g=require("react/jsx-runtime"),r=require("./core-BCBQrYsk.js"),l=require("react"),Uo=require("react-dom"),ee={sideBezel:1.7,topBezel:2.4,chin:2.4,baseHeight:2.2,baseOverhang:4,screenRadius:.9,lidThickness:.7},St=100+2*ee.sideBezel,et=St+2*ee.baseOverhang,xt=ee.topBezel+ee.chin+ee.baseHeight,Fo=(xt-2*ee.topBezel)/2,zo=8;function Go(d){const t=100/d,s=t+ee.topBezel+ee.chin;return{screenHeight:t,lidHeight:s,depth:s}}const qo=Math.PI/2,Zo=135,Jo=100,Qo=2400;function en(d){return qo-d*Math.PI/180}function tn(d){const t=Math.max(0,Math.min(1,d));return 1-Math.pow(1-t,3)}function ke(d,t,s,u=6){const v=[],E=[[d/2-s.top,t/2-s.top,s.top,0],[-d/2+s.top,t/2-s.top,s.top,Math.PI/2],[-d/2+s.bottom,-t/2+s.bottom,s.bottom,Math.PI],[d/2-s.bottom,-t/2+s.bottom,s.bottom,Math.PI*1.5]];for(const[y,M,N,S]of E)for(let k=0;k<=u;k++){const R=S+k*Math.PI/2/u;v.push({x:y+N*Math.cos(R),y:M+N*Math.sin(R),nx:Math.cos(R),ny:Math.sin(R)})}return v}function on(d){const{screenHeight:t,lidHeight:s,depth:u}=Go(d),v=[],E=(f,O,A)=>v.push({part:f,kind:O,vertices:new Float32Array(A)}),y=(f,O,A,L,P)=>{const H=A.map(Z=>Z.x),U=A.map(Z=>Z.y),[ne,G,ue,F]=[Math.min(...H),Math.max(...H),Math.min(...U),Math.max(...U)],q=(ne+G)/2,w=(ue+F)/2,ge=(Z,j)=>[...L(Z,j),...P,(Z-ne)/(G-ne||1),(j-ue)/(F-ue||1)],tt=[];for(let Z=0;Z<A.length;Z++){const j=A[Z],Te=A[(Z+1)%A.length];for(const De of[ge(q,w),ge(j.x,j.y),ge(Te.x,Te.y)])tt.push(...De)}E(f,O,tt)},M=(f,O,A,L,P,H,U)=>{const ne=[];for(let G=0;G<A.length;G++){const ue=A[G],F=A[(G+1)%A.length],q=(w,ge)=>[...L(w.x,w.y,ge),...P(w.nx,w.ny),0,0];for(const w of[q(ue,H),q(F,H),q(F,U),q(ue,H),q(F,U),q(ue,U)])ne.push(...w)}E(f,O,ne)},N=ke(St,s,{top:2.2,bottom:.4}),S=f=>f+s/2,k=ee.lidThickness;M("lid","shell",N,(f,O,A)=>[f,S(O),A],(f,O)=>[f,O,0],-k,0),y("lid","shell",N,(f,O)=>[f,S(O),-k],[0,0,-1]),y("lid","glass",ke(St-.5,s-.5,{top:1.95,bottom:.2}),(f,O)=>[f,S(O),.01],[0,0,1]);const R=ee.chin;y("lid","screen",ke(100,t,{top:ee.screenRadius,bottom:0}),(f,O)=>[f,R+t/2+O,.02],[0,0,1]),y("lid","camera",ke(.5,.5,{top:.25,bottom:.25},4),(f,O)=>[f,s-ee.topBezel/2+O,.02],[0,0,1]);const Y=ke(et,u+k,{top:3,bottom:3}),K=f=>(u-k)/2-f;M("base","shell",Y,(f,O,A)=>[f,A,K(O)],(f,O)=>[f,0,-O],-2.2,0),y("base","shell",Y,(f,O)=>[f,0,K(O)],[0,1,0]),y("base","shell",Y,(f,O)=>[f,-2.2,K(O)],[0,-1,0]);const te=(f,O,A,L,P,H,U)=>y("base",f,ke(L,P,{top:U,bottom:U},3),(ne,G)=>[O+ne,H,A-G],[0,1,0]),pe=et*.72,ae=u*.08,_=[.55,1,1,1,1,1],oe=u*.4/_.reduce((f,O)=>f+O,0);te("well",0,ae+u*.4/2,pe+1.4,u*.4+1.4,.01,.8);let B=ae;for(const[f,O]of _.entries()){const A=O*oe,L=pe/14;for(let P=0;P<14;P++){if(f===5&&P>4&&P<9)continue;const H=f===5&&P===4?5:1;te("keys",-pe/2+L*(P+H/2),B+A/2,L*H-.5,A-.5,.03,.3)}B+=A}te("trackpad",0,u*.72,et*.4,u*.36,.01,1.2),y("base","scoop",ke(14,.9,{top:0,bottom:.45},3),(f,O)=>[f,-.45+O,u+.01],[0,0,1]);const D=new Map;for(const f of v){const O=`${f.part}:${f.kind}`;D.set(O,[...D.get(O)??[],f])}return[...D.values()].map(f=>{const O=new Float32Array(f.reduce((L,P)=>L+P.vertices.length,0));let A=0;for(const L of f)O.set(L.vertices,A),A+=L.vertices.length;return{part:f[0].part,kind:f[0].kind,vertices:O}})}function nn(d,t,s=0){const u=d>=t?1:d/t,v=d>=t?t/d:1,E=(1-u)/2,y=s>0?1-v:(1-v)/2;return{repeat:[1/u,1/v],offset:[(0-E)/u,(0-y)/v]}}function rn(d,t,s){const u=d*s.repeat[0]+s.offset[0],v=t*s.repeat[1]+s.offset[1],E=1e-9;if(u<-E||u>1+E||v<-E||v>1+E)return;const y=M=>Math.max(0,Math.min(1,M));return{x:y(u),y:y(1-v)}}const sn=150,cn=8;class an{constructor(t,s=()=>!1){this.send=t,this.blocked=s}send;blocked;last;gesture;screen;pointer(t,s,u){const v=t===r.MAC_INPUT_ACTION.UP&&!!this.last?.buttons;this.blocked()&&!v||(this.last={...s,buttons:u},this.send(r.createMouseControlMessage(t,s.width,s.height,s.x,s.y,u)))}scroll(t,s,u){this.blocked()||this.send(r.createMacScrollMessage(t.width,t.height,t.x,t.y,s,u))}touch(t,s,u){const v=this.gesture;if(s.length>=2){const y={x:s.reduce((M,N)=>M+N.x,0)/s.length,y:s.reduce((M,N)=>M+N.y,0)/s.length};if(v?.mode==="scroll"){const M=u.map(y.x,y.y);M&&t==="touchmove"&&this.scroll(M,(v.x-y.x)*u.scale,(v.y-y.y)*u.scale)}else v?.mode==="press"?this.lift(v,u):v?.mode==="pending"&&clearTimeout(v.timer);return this.gesture={mode:"scroll",...y},!1}const E=s[0];if(E&&t==="touchstart"&&!v)return this.blocked()||!u.contains(E.x,E.y)?!1:(this.screen=u,this.gesture={mode:"pending",x:E.x,y:E.y,timer:setTimeout(()=>this.press(),sn)},!0);if(E&&v?.mode==="pending"){if(Math.hypot(E.x-v.x,E.y-v.y)<cn)return!1;this.press()}if(E&&this.gesture?.mode==="press"){this.gesture={mode:"press",x:E.x,y:E.y};const y=u.map(E.x,E.y);return y&&this.pointer(r.MAC_INPUT_ACTION.MOVE,y,1),!1}if(s.length===0){v?.mode==="pending"&&(t==="touchcancel"?clearTimeout(v.timer):this.press());const y=this.gesture;y?.mode==="press"&&this.lift(y,u),this.gesture=void 0}return!1}release(){clearTimeout(this.gesture?.timer),this.gesture=void 0;const t=this.last;t?.buttons&&this.pointer(r.MAC_INPUT_ACTION.UP,t,0)}press(){const t=this.gesture;if(t?.mode!=="pending")return;clearTimeout(t.timer),this.gesture={mode:"press",x:t.x,y:t.y};const s=this.screen?.map(t.x,t.y);s&&this.pointer(r.MAC_INPUT_ACTION.DOWN,s,1)}lift(t,s){const u=s.map(t.x,t.y);u&&this.pointer(r.MAC_INPUT_ACTION.UP,u,0)}}function ln(d,t){return t.type==="choose"?t.mode===d.mode?d:t.mode==="3d"?{...d,mode:"3d",selection:d.selection+1}:{...d,mode:"2d"}:d.mode!=="3d"||t.selection!==d.selection||d.ready===t.selection?d:{...d,ready:t.selection}}function ao(d){const[t,s]=l.useReducer(ln,{mode:"2d",selection:0,ready:0}),u=l.useRef(t);u.current=t;const v=l.useRef(d);v.current=d;const{mode:E,selection:y,ready:M}=t,N=l.useCallback(R=>s({type:"choose",mode:R}),[]),S=l.useCallback(()=>{const R=u.current;R.mode!=="3d"||R.selection!==y||R.ready===y||(v.current?.(),s({type:"ready",selection:y}))},[y]),k=E==="3d"&&M!==y;return{mode:E,shown:E==="3d"&&!k?"3d":"2d",loading:k,choose:N,onReady:S}}function lo({view:d,label:t}){return g.jsxs("div",{className:"rc-duo-mode",role:"group","aria-label":t,children:[g.jsx("button",{type:"button","aria-pressed":d.mode==="2d",onClick:()=>d.choose("2d"),children:"2D"}),g.jsx("button",{type:"button","aria-pressed":d.mode==="3d","aria-busy":d.loading,title:d.loading?"Loading 3D":void 0,onClick:()=>d.choose("3d"),children:"3D"})]})}const dn=async d=>{if(!d)return!1;try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(d),!0}catch{}try{const t=document.createElement("textarea");t.value=d,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}catch{return!1}},un=l.memo(function({element:t,screen:s,highlighted:u,selected:v,selectable:E,onClick:y}){const M=r.clampAxFrameForScreen(t.frame,s);if(!M)return null;const N=r.axElementSummary(t);return g.jsx("button",{type:"button",className:t.enabled?"rc-inspect-box":"rc-inspect-box rc-inspect-box-disabled","data-ax-id":t.id,"data-ax-path":t.path,"data-ax-label":t.label||void 0,"data-ax-role":t.role||void 0,"data-highlighted":u?"true":"false","data-selected":v?"true":"false","aria-label":N,onClick:S=>{E&&(S.preventDefault(),S.stopPropagation(),y(t,{x:S.clientX,y:S.clientY}))},style:{left:`${M.x/s.width*100}%`,top:`${M.y/s.height*100}%`,width:`${M.width/s.width*100}%`,height:`${M.height/s.height*100}%`}})},(d,t)=>d.highlighted===t.highlighted&&d.selected===t.selected&&d.selectable===t.selectable&&d.screen.width===t.screen.width&&d.screen.height===t.screen.height&&d.onClick===t.onClick&&r.axElementsEqual(d.element,t.element)),hn=260,fn=220,mn=6,pn=8,gn=l.memo(function({element:t,platform:s,anchor:u,cursorAnchored:v,showActions:E,onTap:y}){const[M,N]=l.useState(null);l.useEffect(()=>{if(!M)return;const _=window.setTimeout(()=>N(null),1100);return()=>window.clearTimeout(_)},[M]);const S=l.useMemo(()=>{const _=hn,oe=fn,B=mn,D=pn,f=typeof window<"u"?window.innerWidth:1024,O=typeof window<"u"?window.innerHeight:768,A=u.x+B+_<=f-D,L=u.y-B-oe>=D;let P=A?u.x+B:u.x-B,H=L?u.y-B:u.y+B;const G=`translate(${A?"0":"-100%"}, ${L?"-100%":"0"})`;return P=Math.max(D+(A?0:_),Math.min(f-D-(A?_:0),P)),H=Math.max(D+(L?oe:0),Math.min(O-D-(L?0:oe),H)),{left:`${P}px`,top:`${H}px`,transform:G}},[u.x,u.y]),k=l.useMemo(()=>r.axElementSelectorExpression(t,s),[t,s]),R=s==="ios"?t.selectors.AXUniqueId:t.selectors.resourceId,Y=s==="ios"?"AXUniqueId":"resourceId",K=l.useCallback(async(_,oe)=>{if(!_)return;await dn(_)&&N(oe)},[]),te=r.axElementRoleLabel(t),pe=t.label||t.value||te,ae=r.axElementSummary(t);return Uo.createPortal(g.jsxs("div",{className:"rc-inspect-card","data-cursor-anchored":v?"true":"false",style:S,onClick:_=>_.stopPropagation(),onMouseDown:_=>_.stopPropagation(),onMouseMove:_=>_.stopPropagation(),children:[g.jsxs("div",{className:"rc-inspect-card-header",children:[g.jsx("span",{className:"rc-inspect-card-role",children:te}),!t.enabled&&g.jsx("span",{className:"rc-inspect-card-tag",children:"disabled"}),t.focused&&g.jsx("span",{className:"rc-inspect-card-tag rc-inspect-card-tag-blue",children:"focused"})]}),g.jsx("p",{className:"rc-inspect-card-title",title:ae,children:pe}),R&&g.jsxs("div",{className:"rc-inspect-card-row",children:[g.jsxs("span",{className:"rc-inspect-card-row-label",children:[Y,":"]}),g.jsx("span",{className:"rc-inspect-card-row-value",children:R})]}),t.value&&t.value!==t.label&&g.jsxs("div",{className:"rc-inspect-card-row",children:[g.jsx("span",{className:"rc-inspect-card-row-label",children:"value:"}),g.jsx("span",{className:"rc-inspect-card-row-value",children:t.value})]}),g.jsxs("div",{className:"rc-inspect-card-row",children:[g.jsx("span",{className:"rc-inspect-card-row-label",children:"frame:"}),g.jsxs("span",{className:"rc-inspect-card-row-value",children:[Math.round(t.frame.width),"×",Math.round(t.frame.height)," @ ",Math.round(t.frame.x),",",Math.round(t.frame.y)]})]}),E&&g.jsxs("div",{className:"rc-inspect-card-actions",children:[g.jsx("button",{type:"button",className:"rc-inspect-card-btn rc-inspect-card-btn-primary",disabled:!y,onClick:()=>y?.(t,u),children:"Tap"}),g.jsx("button",{type:"button",className:M==="selector"?"rc-inspect-card-btn rc-inspect-card-btn-copied":"rc-inspect-card-btn",disabled:!k,title:k??"No usable selector for this element",onClick:()=>K(k??void 0,"selector"),children:M==="selector"?"Copied!":"Copy selector"}),g.jsx("button",{type:"button",className:M==="id"?"rc-inspect-card-btn rc-inspect-card-btn-copied":"rc-inspect-card-btn",disabled:!R,title:R??`No ${Y}`,onClick:()=>K(R,"id"),children:M==="id"?"Copied!":`Copy ${Y}`})]})]}),document.body)}),yn=l.memo(function({snapshot:t,geometry:s,highlightedId:u,selectedId:v,mode:E,cursorPosition:y,frozenCursorPosition:M,onSelectChange:N,onTapElement:S}){const k=E==="select",R=k?u!==null&&u!==v:u!==null,Y=k?u??v:u,K=l.useMemo(()=>{const D=new Map;if(!t)return D;for(const f of t.elements)D.set(f.id,f);return D},[t]),te=l.useMemo(()=>Y?K.get(Y)??null:null,[Y,K]);if(!(!!t&&!!s&&t.screen.width>0&&t.screen.height>0&&t.elements.length>0))return null;const ae=R?y:M??y,_=R,oe=k&&!R&&v!==null,B=D=>{k&&D.target===D.currentTarget&&N(null,null)};return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:k?"rc-inspect-overlay rc-inspect-overlay-select":"rc-inspect-overlay",style:{left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`},onClick:B,children:t.elements.map(D=>g.jsx(un,{element:D,screen:t.screen,highlighted:D.id===u,selected:D.id===v,selectable:k,onClick:N},D.id))}),te&&ae&&g.jsx(gn,{element:te,platform:t.platform,anchor:ae,cursorAnchored:_,showActions:oe,onTap:S})]})});function vn(d,t){if(!t.startsWith("lim_st_"))return!1;try{const s=new URL(d).pathname.split("/").map(decodeURIComponent).find(S=>/^(ios|android)_[a-z0-9_]+$/.test(S));if(!s)return!1;const u=s.split("_")[0],v=t.slice(7).split(".");if(v.length!==3||v.some(S=>!S))return!1;const E=atob(v[1].replace(/-/g,"+").replace(/_/g,"/")),y=JSON.parse(new TextDecoder().decode(Uint8Array.from(E,S=>S.charCodeAt(0))));if(!y||typeof y!="object"||!("scopes"in y))return!1;const M=y.scopes;if(!Array.isArray(M)||!M.every(S=>typeof S=="string"))return!1;let N=!1;for(const S of M){const[k,R,Y,K]=S.split(":");if(!(K!==void 0||k!==u&&k!=="*")&&!(R!==s&&R!=="*")){if(Y==="stream"||Y==="all")return!1;Y==="watch"&&(N=!0)}}return N}catch{return!1}}const Tn=l.lazy(()=>Promise.resolve().then(()=>require("./duo-view-tUJbbWoS.js")).then(d=>d.duoView)),On=l.lazy(()=>Promise.resolve().then(()=>require("./macbook-frame-BxJfxUcU.js"))),gt=d=>Object.entries(r.AMOTION_EVENT).find(([s,u])=>s.startsWith("ACTION_")&&u===d)?.[0]??String(d),so=1920,co=1200,En=(d,t)=>d===so&&t===co||d===co&&t===so,Mn={ios:{videoBorderRadiusMultiplier:.15,loadingLogoSize:"20%",videoPosition:{portrait:{heightMultiplier:.9678},landscape:{widthMultiplier:.9678}}},android:{videoBorderRadiusMultiplier:.13,loadingLogoSize:"40%",videoPosition:{portrait:{heightMultiplier:.967},landscape:{widthMultiplier:.962}}},macos:{videoBorderRadiusMultiplier:0,loadingLogoSize:"10%",videoPosition:{portrait:{heightMultiplier:1},landscape:{widthMultiplier:1}}}},An={"iphone-se":{videoBorderRadiusMultiplier:0,loadingLogoSize:"20%",videoPosition:{portrait:{heightMultiplier:667/889},landscape:{widthMultiplier:667/889}},homeButton:{offset:389/889,diameter:64/889}},"iphone-17e":{videoBorderRadiusMultiplier:47.33/452,loadingLogoSize:"20%",videoPosition:{portrait:{heightMultiplier:844/888},landscape:{widthMultiplier:844/888}}}},Ct=16/10,yt=44,bn={videoBorderRadiusMultiplier:32/1837,loadingLogoSize:"40%",videoPosition:{portrait:{heightMultiplier:2560/2798},landscape:{widthMultiplier:2560/2798}}};function Nn(d){const t=d.code,s=r.codeMap[t];if(!s)return r.debugWarn(`Unknown event.code: ${t}, key: ${d.key}`),null;let u=r.ANDROID_KEYS.META_NONE;const v=t>="KeyA"&&t<="KeyZ",E=d.getModifierState("CapsLock"),y=d.shiftKey;let M=y;return v&&(M=y!==E),M&&(u|=r.ANDROID_KEYS.META_SHIFT_ON),d.ctrlKey&&(u|=r.ANDROID_KEYS.META_CTRL_ON),d.altKey&&(u|=r.ANDROID_KEYS.META_ALT_ON),d.metaKey&&(u|=r.ANDROID_KEYS.META_META_ON),{keycode:s,metaState:u}}function vt(d,t){const s=Object.keys(d);return s.length===Object.keys(t).length&&s.every(u=>d[u]===t[u])}const _n=l.forwardRef(({className:d,url:t,token:s,sessionId:u,openUrl:v,watchOnly:E=!1,showFrame:y=!0,animateLid:M=!0,deviceModel:N,duoModelUrl:S,macbookModelUrl:k,autoReconnect:R,jitterBufferTargetMs:Y,onPlaybackStats:K,onTerminated:te,assets:pe,onConnectionStateChange:ae,inspectMode:_,onAxSnapshotChange:oe,onInspectSelectionChange:B,onAxStatusChange:D,axPollIntervalMs:f,axMaxBackoffMs:O,androidElementTreeOptions:A,onCameraDemandChange:L,onCameraStats:P,onTrace:H,microphoneEnabled:U=!1,onMicrophoneStateChange:ne},G)=>{const ue=l.useMemo(()=>vn(t,s),[t,s]),F=E||ue,q=l.useRef(null),w=l.useRef(null),ge=l.useRef(null),[tt,Z]=l.useState(!1),j=N==="iphone-duo"||tt,Te=N==="iphone-duo"?N:void 0,De=l.useRef(null),[kt,uo]=l.useState(null),[Dt,ho]=l.useState(),[fo,mo]=l.useState(!1),[po,go]=l.useState(!1),[yo,vo]=l.useState(!1),[Tt,Pt]=l.useState(!1),[Lt,Yt]=l.useState(!1),[To,Ht]=l.useState({}),[Wt,Xt]=l.useState(null),[Ot,Oo]=l.useState(null),[Kt,Eo]=l.useState(null),[jt,Vt]=l.useState(null),Ue=ao(()=>ct.current?.release()),ot=l.useRef(!1),Et=l.useRef(null),$=l.useRef(new Map),Oe=l.useRef(!1),[Mo,Ao]=l.useState(!1),W=l.useRef(null),Pe=l.useRef(null),Fe=l.useRef({handle:()=>{},end:()=>{}}),[Ee,nt]=l.useState(null),[$t,Mt]=l.useState(null),[At,ze]=l.useState(null),[bt,it]=l.useState(null),[bo,Bt]=l.useState(null),[No,Ut]=l.useState(null),rt=l.useRef(null),he=l.useRef(void 0),Ft=e=>{rt.current=e,he.current===void 0&&(he.current=window.requestAnimationFrame(()=>{he.current=void 0,Ut(rt.current)}))},[_o,Le]=l.useState(null),Me=l.useRef(null);Me.current=$t;const Ye=l.useRef(B);Ye.current=B;const Ae=_===!0||_==="hover-only",zt=l.useRef(Ae);zt.current=Ae;const wo=_==="hover-only"?"hover-only":"select",V=l.useMemo(()=>r.detectPlatform(t),[t]),Io=l.useMemo(()=>u||Array.from(crypto.getRandomValues(new Uint32Array(4)),e=>e.toString(36)).join(""),[u]),Ge=V==="ios"&&N&&N!=="iphone-duo"?N:void 0,be=V==="android"&&Lt?bn:Ge?An[Ge]:Mn[V],ie=pe?.[V],Gt=Ge&&ie?.modelFrames?.[Ge],qt=V==="android"&&Lt?Tt?ie?.tabletFrameLandscape:ie?.tabletFrame:Ge?Tt?Gt?.frameLandscape:Gt?.frame:Tt?ie?.frameLandscape:ie?.frame,Zt=ie?.loadingLogo,qe=!j&&V!=="macos"&&y&&!!qt,le=V==="macos"&&y,Ne=le&&ie?.frame&&ie.screen?{src:ie.frame,screen:ie.screen}:void 0,Nt=l.useRef(null),Ro=le&&Ue.mode==="3d",_e=le&&Ue.shown==="3d";ot.current=_e;const Jt=Ue.choose;l.useEffect(()=>{le||Jt("2d")},[le,Jt]);const C=l.useRef(null),se=e=>C.current?.sendControl(e),st=l.useRef(new Set),Qt=l.useRef(!1);Qt.current=_===!0;const ct=l.useRef(null);ct.current||(ct.current=new an(e=>C.current?.sendControl(e),()=>Qt.current));const we=ct.current;l.useEffect(()=>()=>we.release(),[we]);const Ze=l.useCallback(()=>{for(const e of st.current)C.current?.sendControl(r.createMacKeyMessage(r.MAC_INPUT_ACTION.UP,e));st.current.clear()},[]),_t=(e,n)=>C.current?.sendDuoControl(e,n)??Promise.reject(new Error("Simulator disconnected")),eo=-10,to=(e,n)=>{const i=We();if(!i)return;const o=fe(i,e,n);if(!o)return;const{videoX:c,videoY:h,videoWidth:a,videoHeight:m}=o,p=r.createTouchControlMessage(r.AMOTION_EVENT.ACTION_DOWN,eo,a,m,c,h,1,r.AMOTION_EVENT.BUTTON_PRIMARY,r.AMOTION_EVENT.BUTTON_PRIMARY);p&&se(p),window.setTimeout(()=>{const b=r.createTouchControlMessage(r.AMOTION_EVENT.ACTION_UP,eo,a,m,c,h,0,r.AMOTION_EVENT.BUTTON_PRIMARY,r.AMOTION_EVENT.BUTTON_PRIMARY);b&&se(b)},60)},Co=(e,n)=>{const i=We();if(!i||n.screen.width<=0||n.screen.height<=0)return;const o=e.frame.x+e.frame.width/2,c=e.frame.y+e.frame.height/2,h=o/n.screen.width*i.actualWidth,a=c/n.screen.height*i.actualHeight,m=i.videoRect.left+i.offsetX+h,p=i.videoRect.top+i.offsetY+a;to(m,p)},at=-1,lt=-2,Ie=-3,He=(e,n,i,o,c,h)=>{const a=r.createTouchControlMessage(e,n,i,o,c,h,1,r.AMOTION_EVENT.BUTTON_PRIMARY,r.AMOTION_EVENT.BUTTON_PRIMARY);a&&(r.debugLog("[rc-touch] sendSingleTouch",{action:e,actionName:gt(e),pointerId:n,x:c,y:h,video:{width:i,height:o}}),se(a))},Re=(e,n,i)=>{if(!i)return;const{videoX:o,videoY:c,videoWidth:h,videoHeight:a}=i;let m=null,p=null,b=1;const x=r.AMOTION_EVENT.BUTTON_PRIMARY;switch(n){case"down":e!==Ie&&Fe.current.end(),m=$.current.size===0?r.AMOTION_EVENT.ACTION_DOWN:r.AMOTION_EVENT.ACTION_POINTER_DOWN,p={x:o,y:c},$.current.set(e,p),e===-1&&w.current?.focus();break;case"move":$.current.has(e)&&(m=r.AMOTION_EVENT.ACTION_MOVE,p={x:o,y:c},$.current.set(e,p));break;case"up":case"cancel":$.current.has(e)&&(p=$.current.get(e),$.current.delete(e),n==="cancel"?m=r.AMOTION_EVENT.ACTION_CANCEL:m=$.current.size===0?r.AMOTION_EVENT.ACTION_UP:r.AMOTION_EVENT.ACTION_POINTER_UP);break}if(m!==null&&p!==null){r.debugLog("[rc-touch][mouse->touch] sending",{pointerId:e,eventType:n,action:m,actionName:gt(m),positionToSend:p,video:{width:h,height:a},altHeld:Oe.current,activePointersAfter:Array.from($.current.entries()).map(([Q,X])=>({id:Q,x:X.x,y:X.y}))});const T=r.createTouchControlMessage(m,e,h,a,p.x,p.y,b,x,x);T&&(r.debugLog("[rc-touch][mouse->touch] buffer",{pointerId:e,actionName:gt(m),byteLength:T.byteLength}),se(T))}else(n==="up"||n==="cancel")&&$.current.delete(e)},wt=e=>{if(Oe.current!==e&&(Oe.current=e,Ao(e),e||nt(null),r.debugLog("[rc-touch][alt] updateAltHeld",{nextHeld:e,activePointerIds:Array.from($.current.keys())}),V==="ios"&&C.current?.getState().controlReady)){const n=e?r.ANDROID_KEYS.ACTION_DOWN:r.ANDROID_KEYS.ACTION_UP,i=r.createInjectKeycodeMessage(n,r.ANDROID_KEYS.KEYCODE_ALT_LEFT,0,r.ANDROID_KEYS.META_NONE);r.debugLog("[rc-touch][alt] sending Indigo modifier keycode",{action:n,keycode:r.ANDROID_KEYS.KEYCODE_ALT_LEFT}),i&&se(i)}},We=()=>{const e=w.current,n=q.current;if(!e||!n)return null;const i=e.videoWidth,o=e.videoHeight;if(!i||!o)return null;const c=e.getBoundingClientRect(),h=n.getBoundingClientRect(),a=c.width,m=c.height,p=i/o,b=a/m;let x=a,T=m;p>b?T=a/p:x=m*p;const Q=(a-x)/2,X=(m-T)/2;return{videoWidth:i,videoHeight:o,videoRect:c,containerRect:h,actualWidth:x,actualHeight:T,offsetX:Q,offsetY:X}},fe=(e,n,i)=>{const o=n-e.videoRect.left-e.offsetX,c=i-e.videoRect.top-e.offsetY,h=Math.max(0,Math.min(e.actualWidth,o)),a=Math.max(0,Math.min(e.actualHeight,c)),m=Math.max(0,Math.min(e.videoWidth,h/e.actualWidth*e.videoWidth)),p=Math.max(0,Math.min(e.videoHeight,a/e.actualHeight*e.videoHeight));return{videoX:m,videoY:p,videoWidth:e.videoWidth,videoHeight:e.videoHeight}},So=(e,n,i)=>{const o=n-e.videoRect.left-e.offsetX,c=i-e.videoRect.top-e.offsetY,h=Math.max(0,Math.min(e.actualWidth,o)),a=Math.max(0,Math.min(e.actualHeight,c)),m=Math.max(0,Math.min(e.videoWidth,h/e.actualWidth*e.videoWidth)),p=Math.max(0,Math.min(e.videoHeight,a/e.actualHeight*e.videoHeight)),b=e.videoWidth-m,x=e.videoHeight-p,T=e.videoRect.left+e.offsetX,Q=e.videoRect.top+e.offsetY,X=T-e.containerRect.left+h,z=Q-e.containerRect.top+a,re=T-e.containerRect.left+(e.actualWidth-h),I=Q-e.containerRect.top+(e.actualHeight-a);return{containerX:X,containerY:z,mirrorContainerX:re,mirrorContainerY:I,videoX:m,videoY:p,mirrorVideoX:b,mirrorVideoY:x,videoWidth:e.videoWidth,videoHeight:e.videoHeight}},xo=(e,n,i,o,c,h,a)=>{const m=r.createTwoFingerTouchControlMessage(e,n,i,o,c,h,a);r.debugLog("[rc-touch2] sendTwoFingerMessage (iOS)",{actionName:gt(e),video:{width:n,height:i},p0:{x:o,y:c},p1:{x:h,y:a},byteLength:m.byteLength}),se(m)},Xe=(e,n,i,o,c,h,a,m,p)=>{if(r.debugLog("[rc-touch2] applyTwoFingerEvent",{platform:V,eventType:e,video:{width:n,height:i},p0:{x:o,y:c,id:m},p1:{x:h,y:a,id:p}}),e==="down"&&Fe.current.end(),V==="ios"){const b=e==="down"?r.AMOTION_EVENT.ACTION_DOWN:e==="move"?r.AMOTION_EVENT.ACTION_MOVE:r.AMOTION_EVENT.ACTION_UP;xo(b,n,i,o,c,h,a)}else e==="down"?(He(r.AMOTION_EVENT.ACTION_DOWN,m,n,i,o,c),He(r.AMOTION_EVENT.ACTION_POINTER_DOWN,p,n,i,h,a)):e==="move"?(He(r.AMOTION_EVENT.ACTION_MOVE,m,n,i,o,c),He(r.AMOTION_EVENT.ACTION_MOVE,p,n,i,h,a)):(He(r.AMOTION_EVENT.ACTION_POINTER_UP,p,n,i,h,a),He(r.AMOTION_EVENT.ACTION_UP,m,n,i,o,c))},ko=(e,n,i)=>{if(!Oe.current){Ee!==null&&nt(null);return}const o=So(e,n,i);nt(o)},Do=(e,n,i)=>{const o=Me.current;if(!o||o.screen.width<=0||o.screen.height<=0)return null;const c=n-e.videoRect.left-e.offsetX,h=i-e.videoRect.top-e.offsetY;if(c<0||h<0||c>e.actualWidth||h>e.actualHeight)return null;const a=c/e.actualWidth*o.screen.width,m=h/e.actualHeight*o.screen.height;return r.axElementAtPoint(o,a,m)},Po=e=>({map:(n,i)=>{const o=fe(e,n,i);if(o)return{x:o.videoX,y:o.videoY,width:o.videoWidth,height:o.videoHeight}},contains:(n,i)=>{const o=n-e.videoRect.left-e.offsetX,c=i-e.videoRect.top-e.offsetY;return o>=0&&o<=e.actualWidth&&c>=0&&c<=e.actualHeight},scale:e.actualWidth>0?e.videoWidth/e.actualWidth:1}),ye=e=>{if(j||ot.current)return;e.preventDefault(),e.stopPropagation();const n=We();if((_===!0||_==="hover-only")&&!("touches"in e))if(e.type==="mousemove"){if(Ft({x:e.clientX,y:e.clientY}),n){const o=Do(n,e.clientX,e.clientY);ze(o?.id??null)}}else e.type==="mouseleave"&&(Ft(null),ze(null));if(_!==!0){if(V==="macos"){if(!n||!C.current?.getState().controlReady)return;if("touches"in e){const a=Array.from(e.touches,m=>({x:m.clientX,y:m.clientY}));we.touch(e.type,a,Po(n))&&w.current?.focus();return}const o=fe(n,e.clientX,e.clientY);if(!o)return;const c=e.type==="mousedown"?r.MAC_INPUT_ACTION.DOWN:e.type==="mouseup"?r.MAC_INPUT_ACTION.UP:r.MAC_INPUT_ACTION.MOVE,h=e.type==="mouseleave"?0:e.buttons;e.type==="mousedown"&&w.current?.focus(),we.pointer(c,{x:o.videoX,y:o.videoY,width:o.videoWidth,height:o.videoHeight},h);return}if(!("touches"in e)&&n&&(e.type==="mousemove"?ko(n,e.clientX,e.clientY):e.type==="mouseleave"&&nt(null)),!(!C.current?.getState().controlReady||!w.current||!n))if("touches"in e){const o=e.touches,c=e.changedTouches;let h;switch(e.type){case"touchstart":h="down";break;case"touchmove":h="move";break;case"touchend":h="up";break;case"touchcancel":h="cancel";break;default:return}if(o.length===2){const a=o[0],m=o[1],p=fe(n,a.clientX,a.clientY),b=fe(n,m.clientX,m.clientY);if(!p||!b)return;W.current?W.current.source==="real-touch"&&(W.current.finger0={x:p.videoX,y:p.videoY},W.current.finger1={x:b.videoX,y:b.videoY},Xe("move",p.videoWidth,p.videoHeight,p.videoX,p.videoY,b.videoX,b.videoY,W.current.pointerId0,W.current.pointerId1)):(W.current={finger0:{x:p.videoX,y:p.videoY},finger1:{x:b.videoX,y:b.videoY},videoSize:{width:p.videoWidth,height:p.videoHeight},source:"real-touch",pointerId0:a.identifier,pointerId1:m.identifier},Xe("down",p.videoWidth,p.videoHeight,p.videoX,p.videoY,b.videoX,b.videoY,a.identifier,m.identifier))}else if(o.length<2&&W.current?.source==="real-touch"){const a=W.current;Xe("up",a.videoSize.width,a.videoSize.height,a.finger0.x,a.finger0.y,a.finger1.x,a.finger1.y,a.pointerId0,a.pointerId1),W.current=null;return}else{if(o.length>2)return;{const a=c[0];if(a){const m=fe(n,a.clientX,a.clientY);Re(a.identifier,h,m)}}}}else{let c=null;const h=W.current?.source==="alt-mouse";switch(e.type){case"mousedown":e.button===0&&(c="down");break;case"mousemove":(h||$.current.has(-1))&&(c="move");break;case"mouseup":e.button===0&&(c="up");break;case"mouseleave":(h||$.current.has(-1))&&(c="up");break}if(c){const a=fe(n,e.clientX,e.clientY);if(!a)return;r.debugLog("[rc-touch][mouse] event",{domType:e.type,eventType:c,button:e.button,buttons:e.buttons,client:{x:e.clientX,y:e.clientY},altHeldRef:Oe.current,inTwoFingerMode:h,geometry:{videoX:a.videoX,videoY:a.videoY,videoWidth:a.videoWidth,videoHeight:a.videoHeight},activePointerIds:Array.from($.current.keys())}),Oe.current||h?Lo(c,a):Re(-1,c,a)}}}},Lo=(e,n)=>{const{videoX:i,videoY:o,videoWidth:c,videoHeight:h}=n,a=c-i,m=h-o;if(e==="down"){W.current={finger0:{x:i,y:o},finger1:{x:a,y:m},videoSize:{width:c,height:h},source:"alt-mouse",pointerId0:at,pointerId1:lt},w.current?.focus(),Xe("down",c,h,i,o,a,m,at,lt);return}if(e==="move"){W.current?.source==="alt-mouse"&&(W.current.finger0={x:i,y:o},W.current.finger1={x:a,y:m},Xe("move",c,h,i,o,a,m,at,lt));return}if(e==="up"||e==="cancel"){const p=W.current;if(p?.source==="alt-mouse"){const{finger0:b,finger1:x,videoSize:T}=p;Xe("up",T.width,T.height,b.x,b.y,x.x,x.y,at,lt),W.current=null}return}},Yo=150,oo=()=>{const e=Pe.current;e&&(window.clearTimeout(e.endTimer),Re(Ie,"up",e.pos),Pe.current=null)},Ho=e=>{if(!C.current?.getState().controlReady||e.ctrlKey)return;if(V==="macos"){if(ot.current)return;const I=We();if(!I)return;const Ce=e.clientX-I.videoRect.left-I.offsetX,me=e.clientY-I.videoRect.top-I.offsetY;if(Ce<0||Ce>I.actualWidth||me<0||me>I.actualHeight)return;const de=fe(I,e.clientX,e.clientY);if(!de)return;e.preventDefault();const je=e.deltaMode===WheelEvent.DOM_DELTA_LINE?16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?I.actualHeight:1;we.scroll({x:de.videoX,y:de.videoY,width:de.videoWidth,height:de.videoHeight},e.deltaX*je,e.deltaY*je);return}if(Oe.current||W.current)return;const n=$.current.size;if(n>1||n===1&&!$.current.has(Ie))return;const i=We();if(!i)return;const o=e.clientX-i.videoRect.left-i.offsetX,c=e.clientY-i.videoRect.top-i.offsetY;if(o<0||o>i.actualWidth||c<0||c>i.actualHeight)return;const h=fe(i,e.clientX,e.clientY);if(!h)return;e.preventDefault();const a=(e.deltaMode===1?16:e.deltaMode===2?i.actualWidth:1)*(i.videoWidth/i.actualWidth),m=(e.deltaMode===1?16:e.deltaMode===2?i.actualHeight:1)*(i.videoHeight/i.actualHeight),p=-e.deltaX*a,b=-e.deltaY*m,x=I=>{window.clearTimeout(I.endTimer),I.endTimer=window.setTimeout(oo,Yo)};if(p===0&&b===0){Pe.current&&x(Pe.current);return}const T=()=>({videoWidth:h.videoWidth,videoHeight:h.videoHeight,videoX:Math.abs(p)>Math.abs(b)?Math.min(Math.max(h.videoX,h.videoWidth*.2),h.videoWidth*.8):h.videoX,videoY:Math.abs(b)>=Math.abs(p)?Math.min(Math.max(h.videoY,h.videoHeight*.2),h.videoHeight*.8):h.videoY}),Q=I=>({...I,videoX:Math.min(Math.max(I.videoX+p,0),I.videoWidth),videoY:Math.min(Math.max(I.videoY+b,0),I.videoHeight)});let X=Pe.current;if(X)window.clearTimeout(X.endTimer);else{const I=T();Re(Ie,"down",I),X={pos:I,endTimer:0},Pe.current=X}let z=X.pos,re=Q(z);re.videoX===z.videoX&&re.videoY===z.videoY&&(Re(Ie,"up",z),z=T(),Re(Ie,"down",z),re=Q(z)),Re(Ie,"move",re),X.pos=re,x(X)};l.useEffect(()=>{Fe.current={handle:Ho,end:oo}}),l.useEffect(()=>{const e=q.current;if(!e)return;const n=i=>Fe.current.handle(i);return e.addEventListener("wheel",n,{passive:!1}),()=>{Fe.current.end(),e.removeEventListener("wheel",n)}},[]),l.useEffect(()=>{const e=c=>{c.key==="Alt"&&wt(!0)},n=c=>{c.key==="Alt"&&wt(!1)},i=()=>{wt(!1),Ze()},o=()=>{document.hidden&&Ze()};return window.addEventListener("keydown",e,!0),window.addEventListener("keyup",n,!0),window.addEventListener("blur",i),document.addEventListener("visibilitychange",o),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("keyup",n,!0),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",o)}},[Ze]);const Ke=e=>{e.preventDefault(),e.stopPropagation();const n=document.activeElement===w.current||(j||ot.current)&&document.activeElement===e.currentTarget;if(r.debugLog("Keyboard event:",{type:e.type,key:e.key,keyCode:e.keyCode,code:e.code,target:e.target.tagName,focused:n}),!n){r.debugWarn("Simulator input not focused, skipping keyboard event");return}if(!C.current?.getState().controlReady){r.debugWarn("Data channel not ready for keyboard event:",C.current?.getState().connection);return}if(V==="macos"){if(e.type==="keydown"&&e.repeat)return;const o=r.macKeyCodeFor(e.code);if(o===void 0){r.debugLog(`Ignoring unmapped key for macOS: code=${e.code}`);return}e.type==="keydown"?st.current.add(o):st.current.delete(o),se(r.createMacKeyMessage(e.type==="keydown"?r.MAC_INPUT_ACTION.DOWN:r.MAC_INPUT_ACTION.UP,o));return}if(e.type==="keydown"){if(e.key.toLowerCase()==="v"&&(e.metaKey||e.ctrlKey)){r.debugLog("Paste shortcut detected"),navigator.clipboard.readText().then(o=>{if(o){r.debugLog("Pasting text via SET_CLIPBOARD:",o.substring(0,20)+(o.length>20?"...":""));const c=r.createSetClipboardMessage(o,!0);se(c)}}).catch(o=>{console.error("Failed to read clipboard contents: ",o)});return}if(e.key.toLowerCase()==="m"&&(e.metaKey||e.ctrlKey)){r.debugLog("Menu shortcut detected");const o=r.createInjectKeycodeMessage(r.ANDROID_KEYS.ACTION_DOWN,r.ANDROID_KEYS.MENU,0,r.ANDROID_KEYS.META_NONE);se(o);const c=r.createInjectKeycodeMessage(r.ANDROID_KEYS.ACTION_UP,r.ANDROID_KEYS.MENU,0,r.ANDROID_KEYS.META_NONE);se(c);return}}const i=Nn(e);if(i){const{keycode:o,metaState:c}=i,h=e.type==="keydown"?r.ANDROID_KEYS.ACTION_DOWN:r.ANDROID_KEYS.ACTION_UP;r.debugLog(`Sending Keycode: key=${e.key}, code=${o}, action=${h}, meta=${c}`);const a=r.createInjectKeycodeMessage(h,o,0,c);se(a)}else r.debugLog(`Ignoring unhandled key event: type=${e.type}, key=${e.key}`)},Wo=e=>{e.stopPropagation(),C.current?.reconnect()},J=l.useRef({onAxSnapshotChange:oe,onAxStatusChange:D,onCameraDemandChange:L,onCameraStats:P,onMicrophoneStateChange:ne,onTrace:H,onTerminated:te,onConnectionStateChange:ae,onPlaybackStats:K});J.current={onAxSnapshotChange:oe,onAxStatusChange:D,onCameraDemandChange:L,onCameraStats:P,onMicrophoneStateChange:ne,onTrace:H,onTerminated:te,onConnectionStateChange:ae,onPlaybackStats:K};const It=!!H;l.useEffect(()=>{Et.current=null,Pt(!1),Yt(!1),Ht({}),Xt(null)},[t,Te]),l.useEffect(()=>{let e=!0;Me.current!==null&&(Me.current=null,Mt(null),r.safeInvoke("onAxSnapshotChange",J.current.onAxSnapshotChange,null));const n=r.createDeviceStream({url:t,token:s,sessionId:Io,watchOnly:F,deviceModel:Te,autoReconnect:R,jitterBufferTargetMs:Y,openUrl:v,inspectMode:_,axPollIntervalMs:f,axMaxBackoffMs:O,androidElementTreeOptions:A,microphoneEnabled:U,onStateChange:o=>{(o.videoReady||o.connection==="idle"||o.connection==="connecting"||o.connection==="reconnecting")&&mo(o.videoReady),go(o.connection==="failed"),vo(o.connection==="terminated"),Z(o.duo),uo(o.duoState),ho(o.duoError)},onAxSnapshotChange:o=>{e&&(Mt(c=>r.axSnapshotsEqual(c,o)?c:o),J.current.onAxSnapshotChange?.(o))},onAxStatusChange:(...o)=>J.current.onAxStatusChange?.(...o),onCameraDemandChange:(...o)=>J.current.onCameraDemandChange?.(...o),onCameraStats:P?(...o)=>J.current.onCameraStats?.(...o):void 0,onMicrophoneStateChange:(...o)=>J.current.onMicrophoneStateChange?.(...o),onTrace:It?(...o)=>J.current.onTrace?.(...o):void 0,onTerminated:()=>J.current.onTerminated?.(),onConnectionStateChange:(...o)=>J.current.onConnectionStateChange?.(...o),onPlaybackStats:K?(...o)=>J.current.onPlaybackStats?.(...o):void 0});C.current=n;const i=w.current?n.attachVideo(w.current):void 0;return n.start(),()=>{e=!1,n.dispose(),i?.(),C.current=null}},[t,u,Te,It,F]),l.useEffect(()=>{if(j&&De.current)return C.current?.attachVideo(De.current,"inner")},[j,t,u,Te,It,F]),l.useEffect(()=>{C.current?.updateOptions({token:s,openUrl:v,axPollIntervalMs:f,axMaxBackoffMs:O,androidElementTreeOptions:A,autoReconnect:R,jitterBufferTargetMs:Y,microphoneEnabled:U,inspectMode:_,onPlaybackStats:K?(...e)=>J.current.onPlaybackStats?.(...e):void 0,onCameraStats:P?(...e)=>J.current.onCameraStats?.(...e):void 0})},[s,R,Y,U,_,!!K,!!P,v,f,O,A]);const Je=()=>{if(!zt.current)return;const e=We();if(!e){Bt(null);return}const n={left:e.videoRect.left-e.containerRect.left+e.offsetX,top:e.videoRect.top-e.containerRect.top+e.offsetY,width:e.actualWidth,height:e.actualHeight};Bt(i=>i&&i.left===n.left&&i.top===n.top&&i.width===n.width&&i.height===n.height?i:n)};l.useEffect(()=>{const e=w.current,n=ge.current,i=q.current;if(!e)return;const o=x=>Ht(T=>vt(T,x)?T:x),c=x=>Xt(T=>T&&x&&vt(T,x)?T:x),h=x=>Oo(T=>T&&x&&vt(T,x)?T:x),a=()=>{const x=e.videoWidth>0&&e.videoHeight>0;x&&(Et.current={width:e.videoWidth,height:e.videoHeight});const T=Et.current,Q=T?`${T.width} / ${T.height}`:void 0,X=Nt.current;if(Ne&&i){if(Vt(T?T.width/T.height:Ct),!X?.naturalWidth)return;const Se=X.naturalWidth/X.naturalHeight,dt=i.clientHeight-yt,xe=i.clientHeight>0?Math.min(i.clientWidth,dt*Se):i.clientWidth;if(xe<=0)return;const Ve=xe/Se,ve=i.clientHeight>0?yt/2:0,{screen:ce}=Ne,ut=ce.notch??0,$e=ce.left*xe,Be=ce.top*Ve,ht=ce.width*xe,ft=ce.height*Ve,io=T?T.width/T.height:Ct,mt=Math.min(ht,ft*io),Rt=mt/io,jo=$e+(ht-mt)/2,Vo=ut>0?Be:Be+(ft-Rt)/2,ro=(Qe,pt,$o,Bo)=>`translate(calc(-50% + ${Qe+$o/2-xe/2}px), calc(-50% + ${pt+Bo/2-Ve/2+ve}px))`;o({width:`${mt}px`,height:`${Rt}px`,transform:ro(jo,Vo,mt,Rt)}),Eo(Qe=>{const pt={width:`${ht}px`,height:`${ft}px`,transform:ro($e,Be,ht,ft)};return Qe&&vt(Qe,pt)?Qe:pt}),h({width:`${xe}px`,height:`${Ve}px`,transform:ve?`translateY(${ve}px)`:void 0}),c(null),Je();return}if(le&&i){const Se=T?T.width/T.height:Ct,dt=i.clientWidth*100/et,Ve=(i.clientHeight-yt)/(1/Se+xt/100),ve=i.clientHeight>0?Math.min(dt,Ve):dt;if(ve<=0)return;const ce=ve/100,ut=ve/Se,$e=i.clientHeight>0?yt/2:0,Be=`${ce*ee.screenRadius}px`;o({aspectRatio:`${Se}`,width:`${ve}px`,height:`${ut}px`,borderRadius:`${Be} ${Be} 0 0`,transform:`translate(-50%, calc(-50% - ${ce*Fo-$e}px))`}),h({width:`${ce*et}px`,height:`${ut+ce*xt}px`,transform:$e?`translateY(${$e}px)`:void 0,"--rc-macbook-unit":`${ce}px`}),Vt(Se),c(null),Je();return}if(h(null),!qe||!n){o(!x&&T?{aspectRatio:Q,contain:"size",containIntrinsicSize:`${T.width}px ${T.height}px`}:{}),c(null),Je();return}const z=n.clientWidth,re=n.clientHeight;if(z===0||re===0)return;const I=T?T.width>T.height:!1;Pt(I),Yt(V==="android"&&!!T&&En(T.width,T.height));const Ce=I?be.videoPosition.landscape:be.videoPosition.portrait;let me={aspectRatio:Q};Ce.heightMultiplier?(me.height=`${re*Ce.heightMultiplier}px`,me.width="auto"):Ce.widthMultiplier&&(me.width=`${z*Ce.widthMultiplier}px`,me.height="auto"),me.borderRadius=`${I?re*be.videoBorderRadiusMultiplier:z*be.videoBorderRadiusMultiplier}px`,o(me);const de=be.homeButton,je=I?z:re,no=`calc(50% + ${je*(de?.offset??0)}px)`;c(de?{width:`${je*de.diameter}px`,height:`${je*de.diameter}px`,left:I?no:"50%",top:I?"50%":no}:null),Je()},m=new ResizeObserver(()=>{a()});n&&m.observe(n),m.observe(e),i&&m.observe(i),n&&n.addEventListener("load",a);const p=Nt.current;p?.addEventListener("load",a),e.addEventListener("loadedmetadata",a),e.addEventListener("resize",a);const b=()=>C.current?.bumpActivity();return e.addEventListener("resize",b),a(),()=>{m.disconnect(),e.removeEventListener("loadedmetadata",a),e.removeEventListener("resize",a),e.removeEventListener("resize",b),n&&n.removeEventListener("load",a),p?.removeEventListener("load",a)}},[be,qe,le,Ne?.src,_e,t,N]),l.useEffect(()=>{Ae?Je():(Mt(null),ze(null),it(null),Ut(null),Le(null),rt.current=null,he.current!==void 0&&(window.cancelAnimationFrame(he.current),he.current=void 0))},[Ae]),l.useEffect(()=>()=>{he.current!==void 0&&(window.cancelAnimationFrame(he.current),he.current=void 0)},[]),l.useEffect(()=>{if(!Ae)return;const e=n=>{n.key==="Escape"&&(bt||At)&&(it(null),ze(null),Le(null),r.safeInvoke("onInspectSelectionChange",Ye.current,null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Ae,bt,At]);const Xo=()=>{w.current&&w.current.focus()};l.useImperativeHandle(G,()=>({openUrl:e=>C.current?.openUrl(e),sendKeyEvent:e=>C.current?.sendKeyEvent(e),screenshot:e=>C.current?.screenshot(e)??Promise.reject(new Error("Simulator disconnected")),terminateApp:e=>C.current?.terminateApp(e)??Promise.reject(new Error("Simulator disconnected")),reconnect:()=>C.current?.reconnect(),refreshAxTree:()=>C.current?.refreshAxTree()??Promise.reject(new Error("Simulator disconnected")),getAxSnapshot:()=>C.current?.getAxSnapshot()??null,setInspectHighlight:e=>{ze(e?.id??null)},setInspectSelection:e=>{it(e?.id??null),Le(e?rt.current:null);const n=Me.current;e&&n?r.safeInvoke("onInspectSelectionChange",Ye.current,{element:e,snapshot:n}):r.safeInvoke("onInspectSelectionChange",Ye.current,null)},getAxStatus:()=>C.current?.getAxStatus()??"idle"}));const Ko=Mo&&Ee!==null;return g.jsxs("div",{ref:q,className:["rc-container",d].filter(Boolean).join(" "),style:{touchAction:"none"},onMouseDown:ye,onMouseMove:ye,onMouseUp:ye,onMouseLeave:ye,onTouchStart:ye,onTouchMove:ye,onTouchEnd:ye,onTouchCancel:ye,onContextMenu:V==="macos"?e=>e.preventDefault():void 0,children:[Ko&&Ee&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"rc-touch-indicator",style:{left:`${Ee.containerX}px`,top:`${Ee.containerY}px`}}),g.jsx("div",{className:"rc-touch-indicator",style:{left:`${Ee.mirrorContainerX}px`,top:`${Ee.mirrorContainerY}px`}})]}),qe&&g.jsx("img",{ref:ge,src:qt,alt:"",className:V==="ios"?"rc-phone-frame rc-phone-frame-ios":"rc-phone-frame",draggable:!1}),Ne&&!_e&&Kt&&g.jsx("div",{className:"rc-macbook-screen",style:Kt,"aria-hidden":"true"}),Ne&&!_e&&g.jsx("img",{ref:Nt,src:Ne.src,alt:"",className:"rc-macbook-image",style:Ot??{visibility:"hidden"},draggable:!1}),le&&!Ne&&Ot&&!_e&&g.jsxs("div",{className:"rc-macbook",style:Ot,"aria-hidden":"true",children:[g.jsx("div",{className:"rc-macbook-lid",children:g.jsx("div",{className:"rc-macbook-camera"})}),g.jsx("div",{className:"rc-macbook-base"})]}),qe&&Wt&&!F&&g.jsx("button",{type:"button",className:"rc-home-button","aria-label":"Home",title:"Home",style:Wt,onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onTouchEnd:e=>{e.stopPropagation(),e.preventDefault(),C.current?.pressButton("home")},onClick:e=>{e.stopPropagation(),C.current?.pressButton("home")}}),g.jsx("video",{ref:w,className:["rc-video",!qe&&!le&&"rc-video-frameless",!fo&&(V==="macos"?"rc-video-loading-desktop":"rc-video-loading")].filter(Boolean).join(" "),style:{...To,...j||_e?{opacity:0,width:1,height:1,pointerEvents:"none"}:{},...Zt?{backgroundImage:`url("${Zt}")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:be.loadingLogoSize}:{}},autoPlay:!0,playsInline:!0,muted:!0,tabIndex:j||_e?-1:0,onKeyDown:Ke,onKeyUp:Ke,onClick:Xo,onFocus:()=>{w.current&&(w.current.style.outline="none")},onBlur:()=>{w.current&&(w.current.style.outline="none"),Ze()}}),Ro&&jt&&g.jsx(l.Suspense,{fallback:null,children:g.jsx(On,{video:w.current,aspect:jt,model:k??ie?.model,animateLid:M,watchOnly:F,onReady:Ue.onReady,pointer:(e,n,i,o)=>{const c=w.current;!c?.videoWidth||!C.current?.getState().controlReady||we.pointer(e==="down"?r.MAC_INPUT_ACTION.DOWN:e==="up"?r.MAC_INPUT_ACTION.UP:r.MAC_INPUT_ACTION.MOVE,{x:n*c.videoWidth,y:i*c.videoHeight,width:c.videoWidth,height:c.videoHeight},o)},scroll:(e,n,i,o)=>{const c=w.current;!c?.videoWidth||!C.current?.getState().controlReady||we.scroll({x:e*c.videoWidth,y:n*c.videoHeight,width:c.videoWidth,height:c.videoHeight},i,o)},onKeyDown:Ke,onKeyUp:Ke,onBlur:Ze})}),le&&g.jsx(lo,{view:Ue,label:"MacBook rendering"}),j&&g.jsx("video",{ref:De,autoPlay:!0,playsInline:!0,muted:!0,style:{position:"absolute",width:1,height:1,opacity:0,pointerEvents:"none"}}),j&&kt&&g.jsx(l.Suspense,{fallback:g.jsx("div",{children:"Loading iPhone Duo…"}),children:g.jsx(Tn,{watchOnly:F,showFrame:y,model:S??ie?.model,outer:w.current,inner:De.current,state:kt,setAngle:e=>_t("setHingeAngle",{angleDegrees:e}),setOrientation:e=>_t("setDuoOrientation",{orientation:e}),button:(e,n)=>_t("performActions",{actions:[{type:n?"buttonDown":"buttonUp",button:e}]}),touch:(e,n,i,o)=>{C.current?.sendDisplayTouch(e,n,i,o)},onKeyDown:Ke,onKeyUp:Ke})}),j&&Dt&&g.jsx("div",{role:"alert",className:"rc-duo-error",children:Dt}),!j&&Ae&&g.jsx(yn,{snapshot:$t,geometry:bo,highlightedId:At,selectedId:bt,mode:wo,cursorPosition:No,frozenCursorPosition:_o,onSelectChange:(e,n)=>{it(e?.id??null),e&&n?Le(n):e||Le(null);const i=Me.current;e&&i?r.safeInvoke("onInspectSelectionChange",Ye.current,{element:e,snapshot:i}):r.safeInvoke("onInspectSelectionChange",Ye.current,null)},onTapElement:F?void 0:((e,n)=>{if(n){to(n.x,n.y);return}const i=Me.current;i&&Co(e,i)})}),yo?g.jsxs("div",{className:"rc-terminated",role:"status",children:[g.jsx("div",{className:"rc-terminated-title",children:"Instance terminated"}),g.jsx("div",{className:"rc-terminated-message",children:"This instance no longer exists and can't be reconnected."})]}):po&&g.jsx("button",{type:"button",className:"rc-retry-button",onClick:Wo,children:"Retry"})]})});exports.DeviceModeToggle=lo;exports.MACBOOK_LID_MAX_DEGREES=Zo;exports.MACBOOK_LID_OPENING_MS=Qo;exports.MACBOOK_LID_OPEN_DEGREES=Jo;exports.MACBOOK_VERTEX_FLOATS=zo;exports.RemoteControl=_n;exports.lidEase=tn;exports.lidRotation=en;exports.macbookMeshes=on;exports.streamFit=nn;exports.streamPoint=rn;exports.useDeviceView=ao;
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),f=require("react"),c=require("./remote-control-Db6ssV0S.js"),r=require("./model-source-DbYJQWkh.js"),j={front:{yaw:0,pitch:.1,label:"Front"},desk:{yaw:-.5,pitch:.42,label:"Desk"},side:{yaw:-1.15,pitch:.16,label:"Side"}},ke=28,je={environment:.45,hemisphere:1,key:{intensity:2.2,position:[-120,220,260]},rim:{intensity:.7,position:[220,40,-220]}};function Ge(v,G){const n=r.DoubleSide;switch(v){case"screen":return G;case"shell":return new r.MeshStandardMaterial({color:3421498,metalness:.9,roughness:.34,side:n});case"glass":return new r.MeshPhysicalMaterial({color:328966,roughness:.06,clearcoat:1,side:n});case"camera":return new r.MeshStandardMaterial({color:790549,roughness:.2,side:n});case"well":return new r.MeshStandardMaterial({color:1052690,roughness:.9,side:n});case"keys":return new r.MeshStandardMaterial({color:723725,roughness:.7,side:n});case"trackpad":return new r.MeshPhysicalMaterial({color:2895153,metalness:.4,roughness:.3,clearcoat:.6,side:n});case"scoop":return new r.MeshStandardMaterial({color:1579035,metalness:.6,roughness:.5,side:n})}}const Fe={glass:1,camera:2,screen:2,well:1,keys:2,trackpad:1,scoop:1};function Ke(v){const G=f.useRef(null),n=f.useRef(v);n.current=v;const[oe,$]=f.useState(),[Se,De]=f.useState(!1),ne=f.useRef(!1),{view:se,viewRef:Z,chooseView:_e,locked:S,lockedRef:Ae,setLocked:Be,orbit:ie,drag:Re}=r.useStageView("front"),C=f.useRef(()=>{}),D=f.useRef(c.MACBOOK_LID_OPEN_DEGREES),p=f.useRef(c.MACBOOK_LID_OPEN_DEGREES),[F,J]=f.useState(c.MACBOOK_LID_OPEN_DEGREES),K=f.useRef(void 0),ce=f.useId(),ae=o=>{const u=p.current;D.current=o,K.current={from:u,to:o,start:performance.now(),duration:c.MACBOOK_LID_OPENING_MS*Math.abs(o-u)/c.MACBOOK_LID_OPEN_DEGREES},C.current()};return f.useEffect(()=>C.current(),[se,S]),f.useEffect(()=>{const o=G.current,u=v.video;if(!o||!u)return;const le=()=>{De(!0),n.current.onReady?.()};$(void 0);const _=new r.PerspectiveCamera(ke,1,10,4e3);let Q=1;const T=r.createDeviceStage({container:o,videos:[u],maxPixelRatio:2,lighting:je,resize:(e,t)=>{Q=e/t,_.aspect=Q,_.updateProjectionMatrix()},frame:(e,t)=>Ne(e,t)});if(!T){$("3D rendering is unavailable in this browser. Enable WebGL to use the 3D MacBook."),le();return}const{renderer:U,scene:de,invalidate:I}=T;let Y=!1;const E=new r.VideoTexture(u);E.colorSpace=r.SRGBColorSpace,E.minFilter=r.LinearFilter,E.magFilter=r.LinearFilter,E.anisotropy=U.capabilities.getMaxAnisotropy();const A=new r.MeshBasicMaterial({map:E,toneMapped:!1,side:r.DoubleSide}),ue={value:!1};A.onBeforeCompile=e=>{e.uniforms.fillAbove=ue,e.fragmentShader=`uniform bool fillAbove;
|
|
2
|
-
${e.fragmentShader}`.replace("#include <map_fragment>",`#include <map_fragment>
|
|
3
|
-
if (vMapUv.x < 0.0 || vMapUv.x > 1.0 || vMapUv.y < 0.0 || (vMapUv.y > 1.0 && !fillAbove)) diffuseColor.rgb = vec3(0.0);`)},A.customProgramCacheKey=()=>"macbook-fitted-screen";let N=n.current.aspect,ee=0,B=c.streamFit(N,N);const Pe=()=>{const e=u.videoWidth&&u.videoHeight?u.videoWidth/u.videoHeight:N;B=c.streamFit(e,N,ee),E.repeat.set(B.repeat[0],B.repeat[1]),E.offset.set(B.offset[0],B.offset[1])},y=new r.Group,w=new r.Group,h=new r.Group;h.rotation.x=c.lidRotation(p.current),w.add(h),y.add(w),de.add(y);const fe=[A],X=[];let V;for(const e of c.macbookMeshes(n.current.aspect)){const t=new r.BufferGeometry,l=new r.InterleavedBuffer(e.vertices,c.MACBOOK_VERTEX_FLOATS);t.setAttribute("position",new r.InterleavedBufferAttribute(l,3,0)),t.setAttribute("normal",new r.InterleavedBufferAttribute(l,3,3)),t.setAttribute("uv",new r.InterleavedBufferAttribute(l,2,6));const i=Ge(e.kind,A),a=Fe[e.kind];a&&(i.polygonOffset=!0,i.polygonOffsetFactor=-a,i.polygonOffsetUnits=-a);const M=new r.Mesh(t,i);e.kind==="screen"&&(V=M),(e.part==="lid"?h:w).add(M),X.push(t),i!==A&&X.push(i)}const me=new r.Box3,pe=e=>{const t=h.rotation.x;return h.rotation.x=c.lidRotation(c.MACBOOK_LID_OPEN_DEGREES),e.updateMatrixWorld(!0),me.setFromObject(e),h.rotation.x=t,me},he=()=>{y.rotation.set(0,0,0),w.position.set(0,0,0),w.position.copy(pe(y).getCenter(new r.Vector3)).negate()};he();const Ce=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;let te=!1;const ve=()=>{y.visible=!0,!ne.current&&n.current.animateLid!==!1&&!Ce&&(p.current=0,h.rotation.x=c.lidRotation(0),J(0),ae(c.MACBOOK_LID_OPEN_DEGREES)),ne.current=!0,te=!0,I()},Ie=async e=>{const[{GLTFLoader:t},{MeshoptDecoder:l}]=await Promise.all([Promise.resolve().then(()=>require("./GLTFLoader-CsxjkQ8a.js")),Promise.resolve().then(()=>require("./meshopt_decoder.module-DxJdu6ez.js"))]),{scene:i}=await r.loadModel(new t().setMeshoptDecoder(l),e),a=[];if(i.traverse(d=>{if(d instanceof r.Mesh){a.push(d.geometry);for(const Oe of Array.isArray(d.material)?d.material:[d.material]){a.push(Oe);for(const xe of Object.values(Oe))xe instanceof r.Texture&&a.push(xe)}}}),Y){for(const d of a)d.dispose();return}fe.push(...a);const M=i.getObjectByName("macbook-base"),x=i.getObjectByName("macbook-lid"),L=i.getObjectByName("macbook-screen");if(!M||!x||!(L instanceof r.Mesh))throw new Error("it has no macbook-base, macbook-lid or macbook-screen");for(const d of[...w.children])d!==h&&w.remove(d);h.clear(),w.add(M);for(const d of[...x.children])h.add(d);L.material=A,V=L;const b=L.userData.aspect;typeof b=="number"&&b>0&&(N=b);const k=L.userData.notch;typeof k=="number"&&k>=0&&k<.5&&(ee=k),ue.value=ee>0;for(const d of X.splice(0))d.dispose();he()},re=n.current.model;re&&(y.visible=!1,Ie(re).catch(e=>{Y||$(`The MacBook model could not load: ${e instanceof Error?e.message:e}`)}).finally(()=>{Y||ve()}));const W=new r.Vector3;let O=0;const Me=new r.Raycaster,we=new r.Vector2;let s,R=j[Z.current].yaw,P=j[Z.current].pitch;C.current=I;const q=e=>{if(!V)return;const t=U.domElement.getBoundingClientRect();we.set((e.clientX-t.left)/t.width*2-1,1-(e.clientY-t.top)/t.height*2),Me.setFromCamera(we,_);const l=Me.intersectObject(w,!0)[0],i=l?.object===V?l.uv:void 0;return i&&c.streamPoint(i.x,i.y,B)},be=e=>{if(I(),s)return;const t=n.current.watchOnly||e.altKey?void 0:q(e);!t&&(Ae.current||e.button!==0)||(o.focus({preventScroll:!0}),o.setPointerCapture(e.pointerId),s={pointer:e.pointerId,kind:t?"screen":"orbit",clientX:e.clientX,clientY:e.clientY,x:t?.x??0,y:t?.y??0},t&&n.current.pointer("down",t.x,t.y,e.buttons))},Ee=e=>{if(I(),!s){const t=n.current.watchOnly?void 0:q(e);U.domElement.style.cursor=t?"none":"",t&&n.current.pointer("move",t.x,t.y,0);return}if(s.pointer===e.pointerId){if(s.kind==="screen"){const t=q(e);t&&(s.x=t.x,s.y=t.y),n.current.pointer("move",s.x,s.y,e.buttons)}else Re(e.clientX-s.clientX,e.clientY-s.clientY,1.2);s.clientX=e.clientX,s.clientY=e.clientY}},g=e=>{I(),!(!s||e&&s.pointer!==e.pointerId)&&(s.kind==="screen"&&n.current.pointer("up",s.x,s.y,e?.buttons??0),s=void 0)},ye=e=>{if(n.current.watchOnly||e.ctrlKey)return;const t=q(e);if(!t)return;e.preventDefault();const l=e.deltaMode===WheelEvent.DOM_DELTA_LINE?16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?o.clientHeight:1;n.current.scroll(t.x,t.y,e.deltaX*l,e.deltaY*l)},H=e=>e.stopPropagation(),ge=["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","touchcancel"];for(const e of ge)o.addEventListener(e,H);const Le=e=>e.preventDefault(),z=()=>{g(),n.current.onBlur()};o.addEventListener("pointerdown",be),o.addEventListener("pointermove",Ee),o.addEventListener("pointerup",g),o.addEventListener("pointercancel",g),o.addEventListener("lostpointercapture",g),o.addEventListener("wheel",ye,{passive:!1}),o.addEventListener("wheel",H),o.addEventListener("contextmenu",Le),o.addEventListener("focusout",z),window.addEventListener("blur",z);const Ne=(e,t)=>{const l=j[Z.current];let i=!1;const a=K.current;if(a){const k=a.duration>0?(e-a.start)/a.duration:1;p.current=a.from+(a.to-a.from)*c.lidEase(k),k>=1?K.current=void 0:i=!0,J(p.current)}else p.current!==D.current&&(p.current=r.MathUtils.damp(p.current,D.current,14,t),Math.abs(p.current-D.current)<.05?p.current=D.current:i=!0);h.rotation.x=c.lidRotation(p.current);const M=l.yaw+ie.yaw,x=l.pitch+ie.pitch;R=r.MathUtils.damp(R,M,10,t),P=r.MathUtils.damp(P,x,10,t),Math.abs(R-M)<5e-4&&(R=M),Math.abs(P-x)<5e-4&&(P=x),Pe(),y.rotation.set(P,R,0,"XYZ"),pe(y).getSize(W);const L=Math.tan(r.MathUtils.degToRad(ke/2)),b=Math.max(W.y/2/L,W.x/2/(L*Q))*1.12+W.z/2;return O=O?r.MathUtils.damp(O,b,10,t):b,Math.abs(O-b)<.01&&(O=b),_.position.set(0,0,O),_.lookAt(0,0,0),U.render(de,_),te&&(te=!1,le()),i||R!==M||P!==x||O!==b};return T.start(),re||ve(),()=>{Y=!0,C.current=()=>{},g();for(const e of ge)o.removeEventListener(e,H);o.removeEventListener("pointerdown",be),o.removeEventListener("pointermove",Ee),o.removeEventListener("pointerup",g),o.removeEventListener("pointercancel",g),o.removeEventListener("lostpointercapture",g),o.removeEventListener("wheel",ye),o.removeEventListener("wheel",H),o.removeEventListener("contextmenu",Le),o.removeEventListener("focusout",z),window.removeEventListener("blur",z);for(const e of[...fe,...X])e.dispose();E.dispose(),T.dispose()}},[v.video,v.aspect,v.model]),m.jsxs("div",{className:"rc-duo rc-macbook-3d",style:Se?void 0:{visibility:"hidden"},children:[m.jsx("div",{ref:G,className:"rc-duo-stage","data-position-locked":S,tabIndex:0,role:"application","aria-label":"MacBook running macOS. Use the screen to control the guest. Drag around the MacBook to turn it when position is unlocked.",onKeyDown:v.onKeyDown,onKeyUp:v.onKeyUp}),m.jsxs("div",{className:"rc-duo-controls",onPointerDown:o=>o.stopPropagation(),children:[m.jsxs("div",{className:"rc-duo-hinge",children:[m.jsx("button",{type:"button",className:"rc-duo-fold",onClick:()=>ae(F<45?c.MACBOOK_LID_OPEN_DEGREES:0),children:F<45?"Open":"Close"}),m.jsx("label",{htmlFor:ce,children:"Lid"}),m.jsx("input",{id:ce,type:"range",min:0,max:c.MACBOOK_LID_MAX_DEGREES,step:1,value:Math.round(F),onChange:o=>{const u=Number(o.target.value);K.current=void 0,D.current=u,J(u),C.current()}}),m.jsxs("output",{children:[Math.round(F),"°"]})]}),m.jsxs("div",{className:"rc-duo-views",children:[Object.keys(j).map(o=>m.jsx("button",{type:"button","aria-pressed":se===o,onClick:()=>{_e(o)},children:j[o].label},o)),m.jsx("button",{type:"button",className:"rc-duo-lock","aria-pressed":S,title:S?"Position is locked. The screen still controls macOS.":"Drag around the MacBook to turn it. Alt-drag turns it from the screen.",onClick:()=>Be(!S),children:S?"Position locked":"Lock position"})]})]}),oe&&m.jsx("div",{role:"alert",className:"rc-duo-error",children:oe})]})}exports.default=Ke;
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { jsxs as F, jsx as L } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as k, useState as ie, useId as Ze, useEffect as Ie } from "react";
|
|
3
|
-
import { M as x, l as J, m as qe, a as Je, b as Qe, c as et, s as tt, d as ot, e as Ne } from "./remote-control-PGtDEDgm.mjs";
|
|
4
|
-
import { u as rt, P as nt, c as st, V as it, S as ct, L as _e, M as at, D as Ge, G as ce, B as lt, I as dt, a as ae, b as le, d as Fe, l as ut, T as ft, R as mt, e as R, f as Re, g as pt, h as ht, i as T } from "./model-source-BAZAKTcr.mjs";
|
|
5
|
-
const G = {
|
|
6
|
-
front: { yaw: 0, pitch: 0.1, label: "Front" },
|
|
7
|
-
desk: { yaw: -0.5, pitch: 0.42, label: "Desk" },
|
|
8
|
-
side: { yaw: -1.15, pitch: 0.16, label: "Side" }
|
|
9
|
-
}, Te = 28, vt = {
|
|
10
|
-
environment: 0.45,
|
|
11
|
-
hemisphere: 1,
|
|
12
|
-
key: { intensity: 2.2, position: [-120, 220, 260] },
|
|
13
|
-
rim: { intensity: 0.7, position: [220, 40, -220] }
|
|
14
|
-
};
|
|
15
|
-
function wt(f, Y) {
|
|
16
|
-
const r = Ge;
|
|
17
|
-
switch (f) {
|
|
18
|
-
case "screen":
|
|
19
|
-
return Y;
|
|
20
|
-
case "shell":
|
|
21
|
-
return new R({ color: 3421498, metalness: 0.9, roughness: 0.34, side: r });
|
|
22
|
-
case "glass":
|
|
23
|
-
return new Re({ color: 328966, roughness: 0.06, clearcoat: 1, side: r });
|
|
24
|
-
case "camera":
|
|
25
|
-
return new R({ color: 790549, roughness: 0.2, side: r });
|
|
26
|
-
case "well":
|
|
27
|
-
return new R({ color: 1052690, roughness: 0.9, side: r });
|
|
28
|
-
case "keys":
|
|
29
|
-
return new R({ color: 723725, roughness: 0.7, side: r });
|
|
30
|
-
case "trackpad":
|
|
31
|
-
return new Re({
|
|
32
|
-
color: 2895153,
|
|
33
|
-
metalness: 0.4,
|
|
34
|
-
roughness: 0.3,
|
|
35
|
-
clearcoat: 0.6,
|
|
36
|
-
side: r
|
|
37
|
-
});
|
|
38
|
-
case "scoop":
|
|
39
|
-
return new R({ color: 1579035, metalness: 0.6, roughness: 0.5, side: r });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const bt = {
|
|
43
|
-
glass: 1,
|
|
44
|
-
camera: 2,
|
|
45
|
-
screen: 2,
|
|
46
|
-
well: 1,
|
|
47
|
-
keys: 2,
|
|
48
|
-
trackpad: 1,
|
|
49
|
-
scoop: 1
|
|
50
|
-
};
|
|
51
|
-
function Lt(f) {
|
|
52
|
-
const Y = k(null), r = k(f);
|
|
53
|
-
r.current = f;
|
|
54
|
-
const [de, Q] = ie(), [Ye, Ke] = ie(!1), ue = k(!1), {
|
|
55
|
-
view: fe,
|
|
56
|
-
viewRef: ee,
|
|
57
|
-
chooseView: Xe,
|
|
58
|
-
locked: O,
|
|
59
|
-
lockedRef: Ue,
|
|
60
|
-
setLocked: Ve,
|
|
61
|
-
orbit: me,
|
|
62
|
-
drag: je
|
|
63
|
-
} = rt("front"), I = k(() => {
|
|
64
|
-
}), D = k(x), d = k(x), [K, te] = ie(x), X = k(
|
|
65
|
-
void 0
|
|
66
|
-
), pe = Ze(), he = (o) => {
|
|
67
|
-
const l = d.current;
|
|
68
|
-
D.current = o, X.current = {
|
|
69
|
-
from: l,
|
|
70
|
-
to: o,
|
|
71
|
-
start: performance.now(),
|
|
72
|
-
duration: et * Math.abs(o - l) / x
|
|
73
|
-
}, I.current();
|
|
74
|
-
};
|
|
75
|
-
return Ie(() => I.current(), [fe, O]), Ie(() => {
|
|
76
|
-
const o = Y.current, l = f.video;
|
|
77
|
-
if (!o || !l) return;
|
|
78
|
-
const ve = () => {
|
|
79
|
-
Ke(!0), r.current.onReady?.();
|
|
80
|
-
};
|
|
81
|
-
Q(void 0);
|
|
82
|
-
const S = new nt(Te, 1, 10, 4e3);
|
|
83
|
-
let oe = 1;
|
|
84
|
-
const U = st({
|
|
85
|
-
container: o,
|
|
86
|
-
videos: [l],
|
|
87
|
-
maxPixelRatio: 2,
|
|
88
|
-
lighting: vt,
|
|
89
|
-
resize: (e, t) => {
|
|
90
|
-
oe = e / t, S.aspect = oe, S.updateProjectionMatrix();
|
|
91
|
-
},
|
|
92
|
-
frame: (e, t) => $e(e, t)
|
|
93
|
-
});
|
|
94
|
-
if (!U) {
|
|
95
|
-
Q("3D rendering is unavailable in this browser. Enable WebGL to use the 3D MacBook."), ve();
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const { renderer: V, scene: we, invalidate: N } = U;
|
|
99
|
-
let j = !1;
|
|
100
|
-
const v = new it(l);
|
|
101
|
-
v.colorSpace = ct, v.minFilter = _e, v.magFilter = _e, v.anisotropy = V.capabilities.getMaxAnisotropy();
|
|
102
|
-
const A = new at({
|
|
103
|
-
map: v,
|
|
104
|
-
toneMapped: !1,
|
|
105
|
-
side: Ge
|
|
106
|
-
}), be = { value: !1 };
|
|
107
|
-
A.onBeforeCompile = (e) => {
|
|
108
|
-
e.uniforms.fillAbove = be, e.fragmentShader = `uniform bool fillAbove;
|
|
109
|
-
${e.fragmentShader}`.replace(
|
|
110
|
-
"#include <map_fragment>",
|
|
111
|
-
`#include <map_fragment>
|
|
112
|
-
if (vMapUv.x < 0.0 || vMapUv.x > 1.0 || vMapUv.y < 0.0 || (vMapUv.y > 1.0 && !fillAbove)) diffuseColor.rgb = vec3(0.0);`
|
|
113
|
-
);
|
|
114
|
-
}, A.customProgramCacheKey = () => "macbook-fitted-screen";
|
|
115
|
-
let _ = r.current.aspect, re = 0, B = Ne(_, _);
|
|
116
|
-
const We = () => {
|
|
117
|
-
const e = l.videoWidth && l.videoHeight ? l.videoWidth / l.videoHeight : _;
|
|
118
|
-
B = Ne(e, _, re), v.repeat.set(B.repeat[0], B.repeat[1]), v.offset.set(B.offset[0], B.offset[1]);
|
|
119
|
-
}, w = new ce(), p = new ce(), u = new ce();
|
|
120
|
-
u.rotation.x = J(d.current), p.add(u), w.add(p), we.add(w);
|
|
121
|
-
const ye = [A], W = [];
|
|
122
|
-
let H;
|
|
123
|
-
for (const e of qe(r.current.aspect)) {
|
|
124
|
-
const t = new lt(), c = new dt(e.vertices, Je);
|
|
125
|
-
t.setAttribute("position", new ae(c, 3, 0)), t.setAttribute("normal", new ae(c, 3, 3)), t.setAttribute("uv", new ae(c, 2, 6));
|
|
126
|
-
const s = wt(e.kind, A), i = bt[e.kind];
|
|
127
|
-
i && (s.polygonOffset = !0, s.polygonOffsetFactor = -i, s.polygonOffsetUnits = -i);
|
|
128
|
-
const m = new le(t, s);
|
|
129
|
-
e.kind === "screen" && (H = m), (e.part === "lid" ? u : p).add(m), W.push(t), s !== A && W.push(s);
|
|
130
|
-
}
|
|
131
|
-
const ge = new pt(), Me = (e) => {
|
|
132
|
-
const t = u.rotation.x;
|
|
133
|
-
return u.rotation.x = J(x), e.updateMatrixWorld(!0), ge.setFromObject(e), u.rotation.x = t, ge;
|
|
134
|
-
}, Ee = () => {
|
|
135
|
-
w.rotation.set(0, 0, 0), p.position.set(0, 0, 0), p.position.copy(Me(w).getCenter(new Fe())).negate();
|
|
136
|
-
};
|
|
137
|
-
Ee();
|
|
138
|
-
const He = !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
139
|
-
let ne = !1;
|
|
140
|
-
const Le = () => {
|
|
141
|
-
w.visible = !0, !ue.current && r.current.animateLid !== !1 && !He && (d.current = 0, u.rotation.x = J(0), te(0), he(x)), ue.current = !0, ne = !0, N();
|
|
142
|
-
}, ze = async (e) => {
|
|
143
|
-
const [{ GLTFLoader: t }, { MeshoptDecoder: c }] = await Promise.all([
|
|
144
|
-
import("./GLTFLoader-BQvr_TBF.mjs"),
|
|
145
|
-
import("./meshopt_decoder.module-C4Z_evpr.mjs")
|
|
146
|
-
]), { scene: s } = await ut(new t().setMeshoptDecoder(c), e), i = [];
|
|
147
|
-
if (s.traverse((a) => {
|
|
148
|
-
if (a instanceof le) {
|
|
149
|
-
i.push(a.geometry);
|
|
150
|
-
for (const Pe of Array.isArray(a.material) ? a.material : [a.material]) {
|
|
151
|
-
i.push(Pe);
|
|
152
|
-
for (const Ce of Object.values(Pe)) Ce instanceof ft && i.push(Ce);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}), j) {
|
|
156
|
-
for (const a of i) a.dispose();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
ye.push(...i);
|
|
160
|
-
const m = s.getObjectByName("macbook-base"), M = s.getObjectByName("macbook-lid"), y = s.getObjectByName("macbook-screen");
|
|
161
|
-
if (!m || !M || !(y instanceof le))
|
|
162
|
-
throw new Error("it has no macbook-base, macbook-lid or macbook-screen");
|
|
163
|
-
for (const a of [...p.children]) a !== u && p.remove(a);
|
|
164
|
-
u.clear(), p.add(m);
|
|
165
|
-
for (const a of [...M.children]) u.add(a);
|
|
166
|
-
y.material = A, H = y;
|
|
167
|
-
const h = y.userData.aspect;
|
|
168
|
-
typeof h == "number" && h > 0 && (_ = h);
|
|
169
|
-
const E = y.userData.notch;
|
|
170
|
-
typeof E == "number" && E >= 0 && E < 0.5 && (re = E), be.value = re > 0;
|
|
171
|
-
for (const a of W.splice(0)) a.dispose();
|
|
172
|
-
Ee();
|
|
173
|
-
}, se = r.current.model;
|
|
174
|
-
se && (w.visible = !1, ze(se).catch((e) => {
|
|
175
|
-
j || Q(
|
|
176
|
-
`The MacBook model could not load: ${e instanceof Error ? e.message : e}`
|
|
177
|
-
);
|
|
178
|
-
}).finally(() => {
|
|
179
|
-
j || Le();
|
|
180
|
-
}));
|
|
181
|
-
const z = new Fe();
|
|
182
|
-
let g = 0;
|
|
183
|
-
const ke = new mt(), xe = new ht();
|
|
184
|
-
let n, P = G[ee.current].yaw, C = G[ee.current].pitch;
|
|
185
|
-
I.current = N;
|
|
186
|
-
const $ = (e) => {
|
|
187
|
-
if (!H) return;
|
|
188
|
-
const t = V.domElement.getBoundingClientRect();
|
|
189
|
-
xe.set(
|
|
190
|
-
(e.clientX - t.left) / t.width * 2 - 1,
|
|
191
|
-
1 - (e.clientY - t.top) / t.height * 2
|
|
192
|
-
), ke.setFromCamera(xe, S);
|
|
193
|
-
const c = ke.intersectObject(p, !0)[0], s = c?.object === H ? c.uv : void 0;
|
|
194
|
-
return s && tt(s.x, s.y, B);
|
|
195
|
-
}, Oe = (e) => {
|
|
196
|
-
if (N(), n) return;
|
|
197
|
-
const t = r.current.watchOnly || e.altKey ? void 0 : $(e);
|
|
198
|
-
!t && (Ue.current || e.button !== 0) || (o.focus({ preventScroll: !0 }), o.setPointerCapture(e.pointerId), n = {
|
|
199
|
-
pointer: e.pointerId,
|
|
200
|
-
kind: t ? "screen" : "orbit",
|
|
201
|
-
clientX: e.clientX,
|
|
202
|
-
clientY: e.clientY,
|
|
203
|
-
x: t?.x ?? 0,
|
|
204
|
-
y: t?.y ?? 0
|
|
205
|
-
}, t && r.current.pointer("down", t.x, t.y, e.buttons));
|
|
206
|
-
}, De = (e) => {
|
|
207
|
-
if (N(), !n) {
|
|
208
|
-
const t = r.current.watchOnly ? void 0 : $(e);
|
|
209
|
-
V.domElement.style.cursor = t ? "none" : "", t && r.current.pointer("move", t.x, t.y, 0);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (n.pointer === e.pointerId) {
|
|
213
|
-
if (n.kind === "screen") {
|
|
214
|
-
const t = $(e);
|
|
215
|
-
t && (n.x = t.x, n.y = t.y), r.current.pointer("move", n.x, n.y, e.buttons);
|
|
216
|
-
} else
|
|
217
|
-
je(e.clientX - n.clientX, e.clientY - n.clientY, 1.2);
|
|
218
|
-
n.clientX = e.clientX, n.clientY = e.clientY;
|
|
219
|
-
}
|
|
220
|
-
}, b = (e) => {
|
|
221
|
-
N(), !(!n || e && n.pointer !== e.pointerId) && (n.kind === "screen" && r.current.pointer("up", n.x, n.y, e?.buttons ?? 0), n = void 0);
|
|
222
|
-
}, Se = (e) => {
|
|
223
|
-
if (r.current.watchOnly || e.ctrlKey) return;
|
|
224
|
-
const t = $(e);
|
|
225
|
-
if (!t) return;
|
|
226
|
-
e.preventDefault();
|
|
227
|
-
const c = e.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? o.clientHeight : 1;
|
|
228
|
-
r.current.scroll(t.x, t.y, e.deltaX * c, e.deltaY * c);
|
|
229
|
-
}, Z = (e) => e.stopPropagation(), Ae = [
|
|
230
|
-
"mousedown",
|
|
231
|
-
"mousemove",
|
|
232
|
-
"mouseup",
|
|
233
|
-
"touchstart",
|
|
234
|
-
"touchmove",
|
|
235
|
-
"touchend",
|
|
236
|
-
"touchcancel"
|
|
237
|
-
];
|
|
238
|
-
for (const e of Ae) o.addEventListener(e, Z);
|
|
239
|
-
const Be = (e) => e.preventDefault(), q = () => {
|
|
240
|
-
b(), r.current.onBlur();
|
|
241
|
-
};
|
|
242
|
-
o.addEventListener("pointerdown", Oe), o.addEventListener("pointermove", De), o.addEventListener("pointerup", b), o.addEventListener("pointercancel", b), o.addEventListener("lostpointercapture", b), o.addEventListener("wheel", Se, { passive: !1 }), o.addEventListener("wheel", Z), o.addEventListener("contextmenu", Be), o.addEventListener("focusout", q), window.addEventListener("blur", q);
|
|
243
|
-
const $e = (e, t) => {
|
|
244
|
-
const c = G[ee.current];
|
|
245
|
-
let s = !1;
|
|
246
|
-
const i = X.current;
|
|
247
|
-
if (i) {
|
|
248
|
-
const E = i.duration > 0 ? (e - i.start) / i.duration : 1;
|
|
249
|
-
d.current = i.from + (i.to - i.from) * ot(E), E >= 1 ? X.current = void 0 : s = !0, te(d.current);
|
|
250
|
-
} else d.current !== D.current && (d.current = T.damp(d.current, D.current, 14, t), Math.abs(d.current - D.current) < 0.05 ? d.current = D.current : s = !0);
|
|
251
|
-
u.rotation.x = J(d.current);
|
|
252
|
-
const m = c.yaw + me.yaw, M = c.pitch + me.pitch;
|
|
253
|
-
P = T.damp(P, m, 10, t), C = T.damp(C, M, 10, t), Math.abs(P - m) < 5e-4 && (P = m), Math.abs(C - M) < 5e-4 && (C = M), We(), w.rotation.set(C, P, 0, "XYZ"), Me(w).getSize(z);
|
|
254
|
-
const y = Math.tan(T.degToRad(Te / 2)), h = Math.max(z.y / 2 / y, z.x / 2 / (y * oe)) * 1.12 + z.z / 2;
|
|
255
|
-
return g = g ? T.damp(g, h, 10, t) : h, Math.abs(g - h) < 0.01 && (g = h), S.position.set(0, 0, g), S.lookAt(0, 0, 0), V.render(we, S), ne && (ne = !1, ve()), s || P !== m || C !== M || g !== h;
|
|
256
|
-
};
|
|
257
|
-
return U.start(), se || Le(), () => {
|
|
258
|
-
j = !0, I.current = () => {
|
|
259
|
-
}, b();
|
|
260
|
-
for (const e of Ae) o.removeEventListener(e, Z);
|
|
261
|
-
o.removeEventListener("pointerdown", Oe), o.removeEventListener("pointermove", De), o.removeEventListener("pointerup", b), o.removeEventListener("pointercancel", b), o.removeEventListener("lostpointercapture", b), o.removeEventListener("wheel", Se), o.removeEventListener("wheel", Z), o.removeEventListener("contextmenu", Be), o.removeEventListener("focusout", q), window.removeEventListener("blur", q);
|
|
262
|
-
for (const e of [...ye, ...W]) e.dispose();
|
|
263
|
-
v.dispose(), U.dispose();
|
|
264
|
-
};
|
|
265
|
-
}, [f.video, f.aspect, f.model]), // The Duo's 3D styles serve every 3D device frame.
|
|
266
|
-
// Unseen until its first frame, so the host's 2D MacBook shows while the model loads.
|
|
267
|
-
/* @__PURE__ */ F("div", { className: "rc-duo rc-macbook-3d", style: Ye ? void 0 : { visibility: "hidden" }, children: [
|
|
268
|
-
/* @__PURE__ */ L(
|
|
269
|
-
"div",
|
|
270
|
-
{
|
|
271
|
-
ref: Y,
|
|
272
|
-
className: "rc-duo-stage",
|
|
273
|
-
"data-position-locked": O,
|
|
274
|
-
tabIndex: 0,
|
|
275
|
-
role: "application",
|
|
276
|
-
"aria-label": "MacBook running macOS. Use the screen to control the guest. Drag around the MacBook to turn it when position is unlocked.",
|
|
277
|
-
onKeyDown: f.onKeyDown,
|
|
278
|
-
onKeyUp: f.onKeyUp
|
|
279
|
-
}
|
|
280
|
-
),
|
|
281
|
-
/* @__PURE__ */ F("div", { className: "rc-duo-controls", onPointerDown: (o) => o.stopPropagation(), children: [
|
|
282
|
-
/* @__PURE__ */ F("div", { className: "rc-duo-hinge", children: [
|
|
283
|
-
/* @__PURE__ */ L(
|
|
284
|
-
"button",
|
|
285
|
-
{
|
|
286
|
-
type: "button",
|
|
287
|
-
className: "rc-duo-fold",
|
|
288
|
-
onClick: () => he(K < 45 ? x : 0),
|
|
289
|
-
children: K < 45 ? "Open" : "Close"
|
|
290
|
-
}
|
|
291
|
-
),
|
|
292
|
-
/* @__PURE__ */ L("label", { htmlFor: pe, children: "Lid" }),
|
|
293
|
-
/* @__PURE__ */ L(
|
|
294
|
-
"input",
|
|
295
|
-
{
|
|
296
|
-
id: pe,
|
|
297
|
-
type: "range",
|
|
298
|
-
min: 0,
|
|
299
|
-
max: Qe,
|
|
300
|
-
step: 1,
|
|
301
|
-
value: Math.round(K),
|
|
302
|
-
onChange: (o) => {
|
|
303
|
-
const l = Number(o.target.value);
|
|
304
|
-
X.current = void 0, D.current = l, te(l), I.current();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
),
|
|
308
|
-
/* @__PURE__ */ F("output", { children: [
|
|
309
|
-
Math.round(K),
|
|
310
|
-
"°"
|
|
311
|
-
] })
|
|
312
|
-
] }),
|
|
313
|
-
/* @__PURE__ */ F("div", { className: "rc-duo-views", children: [
|
|
314
|
-
Object.keys(G).map((o) => /* @__PURE__ */ L(
|
|
315
|
-
"button",
|
|
316
|
-
{
|
|
317
|
-
type: "button",
|
|
318
|
-
"aria-pressed": fe === o,
|
|
319
|
-
onClick: () => {
|
|
320
|
-
Xe(o);
|
|
321
|
-
},
|
|
322
|
-
children: G[o].label
|
|
323
|
-
},
|
|
324
|
-
o
|
|
325
|
-
)),
|
|
326
|
-
/* @__PURE__ */ L(
|
|
327
|
-
"button",
|
|
328
|
-
{
|
|
329
|
-
type: "button",
|
|
330
|
-
className: "rc-duo-lock",
|
|
331
|
-
"aria-pressed": O,
|
|
332
|
-
title: O ? "Position is locked. The screen still controls macOS." : "Drag around the MacBook to turn it. Alt-drag turns it from the screen.",
|
|
333
|
-
onClick: () => Ve(!O),
|
|
334
|
-
children: O ? "Position locked" : "Lock position"
|
|
335
|
-
}
|
|
336
|
-
)
|
|
337
|
-
] })
|
|
338
|
-
] }),
|
|
339
|
-
de && /* @__PURE__ */ L("div", { role: "alert", className: "rc-duo-error", children: de })
|
|
340
|
-
] });
|
|
341
|
-
}
|
|
342
|
-
export {
|
|
343
|
-
Lt as default
|
|
344
|
-
};
|