@kaeawc/auto-mobile 0.0.92 → 0.0.93
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/build-info.json +12 -12
- package/dist/schemas/test-plan.schema.json +370 -52
- package/dist/src/{chunk-jhnbfj19.js → chunk-00167wan.js} +5 -5
- package/dist/src/chunk-0jrrsnc9.js +6 -0
- package/dist/src/chunk-0n6swkwg.js +5 -0
- package/dist/src/chunk-0qsy1qsx.js +57 -0
- package/dist/src/chunk-11m8wj8j.js +237 -0
- package/dist/src/{chunk-4pfftt07.js → chunk-1p7xf5kb.js} +3 -3
- package/dist/src/chunk-23p5f095.js +4 -0
- package/dist/src/{chunk-a4k9rt7z.js → chunk-26k317v5.js} +3 -3
- package/dist/src/chunk-284ptqa4.js +7 -0
- package/dist/src/chunk-28re4xrg.js +4 -0
- package/dist/src/chunk-2f9rkmhx.js +5 -0
- package/dist/src/chunk-2fxdh48t.js +4 -0
- package/dist/src/chunk-2tbdrbt6.js +4 -0
- package/dist/src/chunk-2tqzq5qh.js +971 -0
- package/dist/src/chunk-32gvv9b4.js +21 -0
- package/dist/src/chunk-3f3t1x97.js +8 -0
- package/dist/src/chunk-3fspkbc7.js +4 -0
- package/dist/src/chunk-3qwrzxh0.js +11 -0
- package/dist/src/chunk-3sy6ahhz.js +26 -0
- package/dist/src/chunk-3vg455e6.js +4 -0
- package/dist/src/chunk-3xkpk44w.js +5 -0
- package/dist/src/chunk-3y6eykz9.js +4 -0
- package/dist/src/chunk-49bsqdx3.js +4 -0
- package/dist/src/chunk-4hw3665t.js +42 -0
- package/dist/src/chunk-58wzr3mt.js +5 -0
- package/dist/src/chunk-5d2hft6c.js +5 -0
- package/dist/src/chunk-5snsn9cf.js +4 -0
- package/dist/src/chunk-5tm9mn47.js +54 -0
- package/dist/src/chunk-5zc77a5t.js +4 -0
- package/dist/src/chunk-64j0majr.js +19 -0
- package/dist/src/chunk-65y8v4td.js +17 -0
- package/dist/src/chunk-6awz7vhq.js +5 -0
- package/dist/src/{chunk-stfzjr9y.js → chunk-6bznss4t.js} +5 -5
- package/dist/src/chunk-6ep7f5ge.js +4 -0
- package/dist/src/{chunk-0dfnyfkh.js → chunk-6wt9rgjf.js} +3 -3
- package/dist/src/chunk-6xmss8er.js +8 -0
- package/dist/src/chunk-710rxz9y.js +5 -0
- package/dist/src/chunk-7cs2da62.js +5 -0
- package/dist/src/chunk-7g103b54.js +4 -0
- package/dist/src/chunk-7j5vj4pa.js +4 -0
- package/dist/src/chunk-7rz9898k.js +5 -0
- package/dist/src/chunk-7tw8x05v.js +4 -0
- package/dist/src/chunk-7zy586cb.js +4 -0
- package/dist/src/{chunk-r0f1q783.js → chunk-8037tzzj.js} +3 -3
- package/dist/src/chunk-84nanf8s.js +5 -0
- package/dist/src/{chunk-950qcq1e.js → chunk-8g1922rp.js} +4 -4
- package/dist/src/chunk-8gvwcv2p.js +4 -0
- package/dist/src/{chunk-sz1a7p43.js → chunk-8ph29g99.js} +1 -1
- package/dist/src/chunk-8thrmfat.js +4 -0
- package/dist/src/chunk-8zgzzs7k.js +78 -0
- package/dist/src/chunk-97b1zmaq.js +4 -0
- package/dist/src/chunk-9fth9ayh.js +4 -0
- package/dist/src/chunk-9j6anhjr.js +4 -0
- package/dist/src/{chunk-w7zsh13a.js → chunk-aabchzxk.js} +4 -4
- package/dist/src/{chunk-wry6skrm.js → chunk-ayp07wbb.js} +1 -1
- package/dist/src/chunk-bfjwqk8q.js +4 -0
- package/dist/src/{chunk-jdqvcq0a.js → chunk-bfw6125s.js} +3 -3
- package/dist/src/chunk-bnhscm2n.js +4 -0
- package/dist/src/chunk-bxmsax22.js +5 -0
- package/dist/src/chunk-c1vs4g1n.js +4 -0
- package/dist/src/chunk-ct3e7yng.js +4 -0
- package/dist/src/{chunk-8en08r7q.js → chunk-cyy71ggq.js} +3 -3
- package/dist/src/chunk-ddzkz92z.js +4 -0
- package/dist/src/chunk-dgrbdpb7.js +9 -0
- package/dist/src/chunk-drdz8hee.js +5 -0
- package/dist/src/chunk-e98dqnc9.js +145 -0
- package/dist/src/chunk-eersndy7.js +5 -0
- package/dist/src/chunk-eggq53ks.js +4 -0
- package/dist/src/chunk-f2dya7cs.js +4 -0
- package/dist/src/chunk-fbakd6cw.js +4 -0
- package/dist/src/chunk-fgb98zjj.js +5 -0
- package/dist/src/chunk-fmpad823.js +5 -0
- package/dist/src/{chunk-v90es00d.js → chunk-g04bwyj3.js} +2 -2
- package/dist/src/chunk-g0xr8zw0.js +4 -0
- package/dist/src/chunk-g3rjs80x.js +4 -0
- package/dist/src/chunk-g78rtrfv.js +4 -0
- package/dist/src/{chunk-r20pe1nv.js → chunk-g7tmjbkt.js} +3 -3
- package/dist/src/chunk-gabgv3y5.js +4 -0
- package/dist/src/chunk-gmr45m8f.js +4 -0
- package/dist/src/chunk-gsyfebqj.js +4 -0
- package/dist/src/chunk-h5rpn9wr.js +247 -0
- package/dist/src/chunk-hb1x7v55.js +4 -0
- package/dist/src/chunk-hrfytkxh.js +168 -0
- package/dist/src/chunk-j4yjzbak.js +4 -0
- package/dist/src/chunk-jd6a5v6p.js +5 -0
- package/dist/src/chunk-jh6vhqzx.js +5 -0
- package/dist/src/chunk-kn5spq15.js +4 -0
- package/dist/src/{chunk-w2mwa0jk.js → chunk-m94qs0f0.js} +2 -2
- package/dist/src/chunk-mjrps0ac.js +7 -0
- package/dist/src/chunk-n03dmn5q.js +5 -0
- package/dist/src/chunk-n72qhwd9.js +4 -0
- package/dist/src/{chunk-km0dy5vc.js → chunk-ndt1ccxm.js} +9 -9
- package/dist/src/chunk-nr6y0n4y.js +5 -0
- package/dist/src/chunk-pcsen2vs.js +4 -0
- package/dist/src/chunk-ppfr0b8h.js +4 -0
- package/dist/src/chunk-q10bdnat.js +4 -0
- package/dist/src/chunk-q9xmq595.js +4 -0
- package/dist/src/{chunk-2v7tw1nj.js → chunk-qcxzr2my.js} +3 -3
- package/dist/src/chunk-qf6nynk6.js +7 -0
- package/dist/src/chunk-qyqypn28.js +5 -0
- package/dist/src/chunk-r2epb56s.js +4 -0
- package/dist/src/chunk-r5bxavdx.js +311 -0
- package/dist/src/{chunk-r14wwk37.js → chunk-r6z1eztj.js} +12 -12
- package/dist/src/{chunk-d57432wq.js → chunk-r7bpkgff.js} +2 -2
- package/dist/src/chunk-r8jf3d92.js +4 -0
- package/dist/src/{chunk-9rkfyt6q.js → chunk-rbpdk7m0.js} +3 -3
- package/dist/src/chunk-rc0dbypm.js +4 -0
- package/dist/src/chunk-rhcty4ms.js +4 -0
- package/dist/src/chunk-rpvckv3p.js +4 -0
- package/dist/src/{chunk-s1zq65ny.js → chunk-rqc9ap3x.js} +2 -2
- package/dist/src/chunk-rvvy1bte.js +7 -0
- package/dist/src/chunk-ry0mz41y.js +4 -0
- package/dist/src/{chunk-34zxqcmq.js → chunk-s3jc6cwp.js} +3 -3
- package/dist/src/chunk-sfv61xjb.js +6 -0
- package/dist/src/chunk-t6bfvfkg.js +4 -0
- package/dist/src/chunk-t6c8akcm.js +5 -0
- package/dist/src/chunk-t7w8rctc.js +4 -0
- package/dist/src/chunk-thbh3jew.js +5 -0
- package/dist/src/chunk-v2wd4n3e.js +5 -0
- package/dist/src/{chunk-zg67wjkh.js → chunk-v6pya0dm.js} +3 -3
- package/dist/src/chunk-vy3bwm1d.js +17 -0
- package/dist/src/chunk-w3vs79ex.js +27 -0
- package/dist/src/chunk-w4zga19f.js +4 -0
- package/dist/src/chunk-w5b2jwk3.js +14 -0
- package/dist/src/chunk-w7hkv422.js +5 -0
- package/dist/src/{chunk-qv2918jt.js → chunk-waqwcjyn.js} +2 -2
- package/dist/src/{chunk-b4cxdzwy.js → chunk-wbh8spm5.js} +7 -7
- package/dist/src/{chunk-ajsrz473.js → chunk-wyrkw6hw.js} +3 -3
- package/dist/src/chunk-xa73x2cx.js +5 -0
- package/dist/src/{chunk-eka89q3k.js → chunk-xgan0qqp.js} +1 -1
- package/dist/src/chunk-y2vs6jwg.js +4 -0
- package/dist/src/chunk-yattm52s.js +4 -0
- package/dist/src/{chunk-9y5bcy28.js → chunk-yb97j25b.js} +4 -4
- package/dist/src/{chunk-c9nk1r78.js → chunk-ybbtagbt.js} +3 -3
- package/dist/src/chunk-ycaj2sgf.js +9 -0
- package/dist/src/chunk-yf7ympyz.js +325 -0
- package/dist/src/chunk-yjawdzk8.js +4 -0
- package/dist/src/chunk-z637nqg8.js +11 -0
- package/dist/src/{chunk-0w1spptt.js → chunk-zgja5f3p.js} +4 -4
- package/dist/src/chunk-zs1sghs9.js +4 -0
- package/dist/src/daemon/processEntry.js +2 -2
- package/dist/src/index.js +4 -4
- package/dist/src/runtime/bunRuntimeGuard.js +2 -2
- package/dist/src/utils/workers/iosBundleExtractWorker.js +2 -2
- package/ios/CameraPosterInjection/Injection/CameraPosterInjection.m +466 -0
- package/package.json +3 -2
- package/schemas/test-plan.schema.json +370 -52
- package/dist/src/chunk-09442h7v.js +0 -4
- package/dist/src/chunk-0e4gm1kj.js +0 -5
- package/dist/src/chunk-0eb8576f.js +0 -4
- package/dist/src/chunk-0rjm4nx7.js +0 -5
- package/dist/src/chunk-1zmh2eak.js +0 -4
- package/dist/src/chunk-28k63ha3.js +0 -5
- package/dist/src/chunk-2d4wmp8b.js +0 -4
- package/dist/src/chunk-2e6s75qv.js +0 -78
- package/dist/src/chunk-32jpxz2y.js +0 -323
- package/dist/src/chunk-3jmvqygr.js +0 -238
- package/dist/src/chunk-3swvfhqt.js +0 -5
- package/dist/src/chunk-44bt78m9.js +0 -5
- package/dist/src/chunk-488vt2bp.js +0 -4
- package/dist/src/chunk-4fgdhcwx.js +0 -5
- package/dist/src/chunk-4jp2se4w.js +0 -4
- package/dist/src/chunk-4vhr9e4t.js +0 -4
- package/dist/src/chunk-4xd6zs3y.js +0 -15
- package/dist/src/chunk-51567pg8.js +0 -4
- package/dist/src/chunk-5agqsfev.js +0 -4
- package/dist/src/chunk-5d706gmr.js +0 -4
- package/dist/src/chunk-5kd4rqk7.js +0 -5
- package/dist/src/chunk-61t538bm.js +0 -4
- package/dist/src/chunk-6d3mmqxt.js +0 -54
- package/dist/src/chunk-6hyt398x.js +0 -5
- package/dist/src/chunk-6mnr8kpm.js +0 -4
- package/dist/src/chunk-79q5xsdc.js +0 -42
- package/dist/src/chunk-7bdgand3.js +0 -4
- package/dist/src/chunk-84cp9dw5.js +0 -4
- package/dist/src/chunk-86f2h5ww.js +0 -5
- package/dist/src/chunk-8cghfzb2.js +0 -19
- package/dist/src/chunk-9tf2p9y9.js +0 -5
- package/dist/src/chunk-a2sc4jm0.js +0 -5
- package/dist/src/chunk-aa5ng3d1.js +0 -4
- package/dist/src/chunk-b3h0a6ca.js +0 -4
- package/dist/src/chunk-b6a737qt.js +0 -4
- package/dist/src/chunk-bn64x5z5.js +0 -5
- package/dist/src/chunk-bvh649za.js +0 -12
- package/dist/src/chunk-c9tyfg4j.js +0 -26
- package/dist/src/chunk-cfsdfqnm.js +0 -4
- package/dist/src/chunk-cxyf04jc.js +0 -7
- package/dist/src/chunk-da08tx5v.js +0 -4
- package/dist/src/chunk-f2tc08m2.js +0 -4
- package/dist/src/chunk-f8tnk179.js +0 -5
- package/dist/src/chunk-f9s1kkhx.js +0 -5
- package/dist/src/chunk-fbp8a4rx.js +0 -4
- package/dist/src/chunk-fd2z0sze.js +0 -4
- package/dist/src/chunk-fk927f4q.js +0 -54
- package/dist/src/chunk-fxmr3a0f.js +0 -4
- package/dist/src/chunk-gaqwhd44.js +0 -4
- package/dist/src/chunk-ggtd5x5a.js +0 -5
- package/dist/src/chunk-gndcfrm7.js +0 -4
- package/dist/src/chunk-h3n4adc6.js +0 -310
- package/dist/src/chunk-h5pjbb83.js +0 -4
- package/dist/src/chunk-hgnnh302.js +0 -4
- package/dist/src/chunk-hmke8nhx.js +0 -5
- package/dist/src/chunk-j2bx12hn.js +0 -4
- package/dist/src/chunk-j70y1a2g.js +0 -4
- package/dist/src/chunk-js1jpyxp.js +0 -6
- package/dist/src/chunk-kbjq0qvb.js +0 -4
- package/dist/src/chunk-kfwx57xd.js +0 -4
- package/dist/src/chunk-kzwctna2.js +0 -4
- package/dist/src/chunk-m9ehyehy.js +0 -4
- package/dist/src/chunk-mct91p1f.js +0 -4
- package/dist/src/chunk-mf9spd4g.js +0 -5
- package/dist/src/chunk-mgrcansb.js +0 -4
- package/dist/src/chunk-mqc1d0eb.js +0 -6
- package/dist/src/chunk-n1zmpk0z.js +0 -4
- package/dist/src/chunk-ncyjf63g.js +0 -4
- package/dist/src/chunk-nr64d21q.js +0 -973
- package/dist/src/chunk-nwm2pq5v.js +0 -168
- package/dist/src/chunk-pm06b05d.js +0 -9
- package/dist/src/chunk-q50s00ry.js +0 -4
- package/dist/src/chunk-qwye1958.js +0 -14
- package/dist/src/chunk-r8z9pfve.js +0 -5
- package/dist/src/chunk-rdpgkjf6.js +0 -4
- package/dist/src/chunk-rkr0dks9.js +0 -5
- package/dist/src/chunk-rn84t3sf.js +0 -11
- package/dist/src/chunk-s123kn7n.js +0 -4
- package/dist/src/chunk-s73qn3fx.js +0 -4
- package/dist/src/chunk-sjn0nj4p.js +0 -5
- package/dist/src/chunk-sns0c35v.js +0 -7
- package/dist/src/chunk-t4dr5c8v.js +0 -8
- package/dist/src/chunk-tc8k9c1j.js +0 -4
- package/dist/src/chunk-teznhase.js +0 -4
- package/dist/src/chunk-ty9xgmz4.js +0 -4
- package/dist/src/chunk-tyazf3sk.js +0 -145
- package/dist/src/chunk-v6npjrjm.js +0 -5
- package/dist/src/chunk-vbvtzkwz.js +0 -5
- package/dist/src/chunk-vefd8qee.js +0 -8
- package/dist/src/chunk-vs9r72ta.js +0 -17
- package/dist/src/chunk-w88k0bgr.js +0 -4
- package/dist/src/chunk-wzdt0enk.js +0 -4
- package/dist/src/chunk-xhhv854c.js +0 -4
- package/dist/src/chunk-y58270hd.js +0 -4
- package/dist/src/chunk-yk0hmbex.js +0 -4
- package/dist/src/chunk-ympy4fdz.js +0 -28
- package/dist/src/chunk-yw436axy.js +0 -4
- package/dist/src/chunk-z04jrpjy.js +0 -5
- package/dist/src/chunk-z2xznczw.js +0 -4
- package/dist/src/chunk-z4xnrgps.js +0 -4
- package/dist/src/chunk-z7csyszv.js +0 -4
- package/dist/src/chunk-z8t0v07j.js +0 -11
- package/dist/src/chunk-z916af47.js +0 -228
- package/dist/src/chunk-zcr8he8q.js +0 -5
- package/dist/src/chunk-zd9vmkzn.js +0 -9
- package/dist/src/chunk-zj939v0h.js +0 -5
- package/dist/src/chunk-zkdjwtc1.js +0 -4
- package/dist/src/chunk-zkv5kzt6.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{i,e}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{i,e}from"./chunk-z637nqg8.js";import{Ns,R,Bt,sz,Pn,Zv,Rp,An,qa}from"./chunk-r5bxavdx.js";import{Wr}from"./chunk-0qsy1qsx.js";import{wo}from"./chunk-7rz9898k.js";import{LP,YE,BM,BP,JE,fy}from"./chunk-6xmss8er.js";import{yN}from"./chunk-w5b2jwk3.js";import{t}from"./chunk-rbpdk7m0.js";var f="to start a device gesture recording";async function G(n,o,s,r=()=>{return}){let d=await n.getBootedDevices(s??"either");await Wr(d,"device-gesture-recording-resolve");let c=s?d.filter((a)=>a.platform===s):d,u=s?`connected ${s} devices`:"connected devices";if(o){let a=c.find((l)=>l.deviceId===o);if(!a)throw new t(`Device ${o} not found among ${u}.`);return a}if(c.length===0)throw new t(`No ${u} found.`);if(c.length===1)return c[0];let v=r(),m=c.find((a)=>a.deviceId===v);if(m)return m;throw new t(`Multiple ${u}; specify deviceId. Found: ${c.map((a)=>a.deviceId).join(", ")}`)}var h=async(n)=>{let o=R.sessionManager(),s=R.devicePool();if(!o||!s)return;await Zv({action:n.action,deviceId:n.device.deviceId,platform:n.device.platform,requesterSessionUuid:n.requesterSessionUuid,sessionManager:o,gate:s})};function p(n,o=(s)=>{if(!s)return;let r=R.sessionManager();return r?r.getDeviceForSession(s)??void 0:wo(s)?.device.deviceId}){return{selectDevice:(s,r,d)=>{let c=n(),u=d?.trim()||void 0;return G(c.getPlatformDeviceManager(),s,r,()=>o(u))},readyDevice:(s,r)=>n().ensureDeviceReady(s.platform,s.deviceId,{sessionId:r})}}function S(n){return typeof n?.sessionUuid==="string"?{...n,sessionUuid:n.sessionUuid.trim()||void 0}:n}var I=(n)=>{if(n===void 0)return;if(n==="android"||n==="ios")return n;throw Error(`Unsupported platform value: ${String(n)}`)};class D extends qa{authenticator;admissionGate;deviceResolution;bindingGate;constructor(n=Bt(sz),o=i,s=An("deviceGestureRecording"),{admissionGate:r=Ns,deviceResolution:d=p(()=>{throw new t("Inject device readiness before recording gestures.")}),bindingGate:c=h}={}){super(n,o,"DeviceGestureRecording");this.authenticator=s,this.admissionGate=r,this.deviceResolution=d,this.bindingGate=c}async handleRequest(n){let o=S(n),s=o?.command;if(!s)throw Error("Request missing command field.");switch(s){case"start":{if(o.deviceId!==void 0){let d=yN(o.deviceId,o.sessionUuid);if(d)return d}let r=R.isInitialized();if(!r)this.authenticator.authorize({sessionUuid:o.sessionUuid,deviceId:o.deviceId});if(o.deviceId!==void 0)this.admissionGate.assertDeviceActionable(o.deviceId,f);return this.handleStart(o,r)}case"stop":return this.handleStop(o);case"status":{this.authenticator.authorize({sessionUuid:o.sessionUuid,deviceId:o.deviceId,admitViewer:!0});let r=BP();if(!r)return{success:!0};return{success:!0,recording:r}}default:throw Error(`Unsupported device gesture recording command: ${String(s)}`)}}async handleStart(n,o){let s=I(n.platform),r=await this.deviceResolution.selectDevice(n.deviceId,s,n.sessionUuid);this.admissionGate.assertDeviceActionable(r.deviceId,f);let d=yN(r.deviceId,n.sessionUuid);if(d)return d;if(!o)Rp(this.authenticator,{sessionUuid:n.sessionUuid,deviceId:r.deviceId});await this.bindingGate({action:"deviceGestureRecording start",device:r,requesterSessionUuid:n.sessionUuid});let c=yN(r.deviceId,n.sessionUuid,!0);if(c)return c;if(o)Rp(this.authenticator,{sessionUuid:n.sessionUuid,deviceId:r.deviceId});let u=await this.deviceResolution.readyDevice(r,n.sessionUuid),v=await JE(u,void 0,void 0,{ownerSessionUuid:n.sessionUuid});return{success:!0,recordingId:v.recordingId,startedAt:v.startedAt,deviceId:v.deviceId,platform:v.platform}}async handleStop(n){if(n.recordingId)try{let r=await BM(n.recordingId,n.sessionUuid);if(r)return this.toStopResponse(r)}catch(r){return this.toStopFailure(r)}let o=BP(),s=!o&&n.recordingId?YE(n.recordingId,n.sessionUuid):void 0;if(s)return this.toStopResponse(s);if(this.authenticator.authorize({sessionUuid:n.sessionUuid,deviceId:o?.deviceId??n.deviceId}),!o)throw new t("No active recording. Start a recording before stopping.");if(n.deviceId!==void 0&&o.deviceId!==n.deviceId)throw new t(`No active recording found for device ${n.deviceId}.`);return await this.bindingGate({action:"deviceGestureRecording stop",device:{deviceId:o.deviceId,platform:o.platform},requesterSessionUuid:n.sessionUuid}),fy(n.recordingId,n.planName).then((r)=>this.toStopResponse(r)).catch((r)=>this.toStopFailure(r))}toStopFailure(n){if(!(n instanceof LP))throw n;return e.warn(`[DeviceGestureRecording] ${n.message}`,n),{success:!1,error:n.message,reason:n.reason}}toStopResponse(n){return{success:!0,recordingId:n.recordingId,startedAt:n.startedAt,stoppedAt:n.stoppedAt,deviceId:n.deviceId,platform:n.platform,planName:n.planName,planContent:n.planContent,stepCount:n.stepCount,durationMs:n.durationMs,...n.error?{error:n.error}:{}}}createErrorResponse(n,o){return{success:!1,error:o}}}var g=new Pn;function EK(){return g.instance?.getSocketPath()??Bt(sz)}async function IK(n){await g.start(()=>new D(void 0,void 0,void 0,{deviceResolution:p(()=>n)}))}async function _K(){await g.stop()}
|
|
3
|
+
export{EK,IK,_K};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=3DD67E262B6D4F0764756E2164756E21
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{e}from"./chunk-
|
|
2
|
+
import{e}from"./chunk-z637nqg8.js";import"./chunk-58wzr3mt.js";class i{inner;log;stoppedReason;answersOnlyReason;receivedRequestIds=new Set;pendingAnswerWrites=0;messageCallback;answerWait;constructor(s,n=(r)=>e.debug(r)){this.inner=s;this.log=n}stopSending(s){this.stoppedReason??=s,this.answerWait?.resolve()}answerReceivedThenStop(s){if(!this.answerWait)this.answerWait=Promise.withResolvers(),this.answersOnlyReason=s,this.stopIfAnswered();return this.answerWait.promise}stopIfAnswered(){if(this.stoppedReason!==void 0)this.answerWait?.resolve();else if(this.answersOnlyReason!==void 0&&this.receivedRequestIds.size===0&&this.pendingAnswerWrites===0)this.stopSending(this.answersOnlyReason)}async send(s,n){let r=!("method"in s)&&"id"in s?s.id:void 0,t=this.stoppedReason??(this.answersOnlyReason!==void 0&&(r===void 0||!this.receivedRequestIds.has(r))?this.answersOnlyReason:void 0);if(t!==void 0){this.log(`[OutputGatedTransport] Dropped ${"method"in s?s.method:"response"}: ${t}`);return}if(r===void 0)return this.inner.send(s,n);this.pendingAnswerWrites++;try{await this.inner.send(s,n)}finally{this.receivedRequestIds.delete(r),this.pendingAnswerWrites--,this.stopIfAnswered()}}start(){return this.inner.start()}close(){return this.inner.close()}get sessionId(){return this.inner.sessionId}setProtocolVersion(s){this.inner.setProtocolVersion?.(s)}get onmessage(){return this.messageCallback}set onmessage(s){this.messageCallback=s,this.inner.onmessage=(n,r)=>{if("method"in n&&"id"in n)this.receivedRequestIds.add(n.id);else if("method"in n&&n.method==="notifications/cancelled"){let t=n.params?.requestId;if(typeof t==="string"||typeof t==="number")this.receivedRequestIds.delete(t),this.stopIfAnswered()}s?.(n,r)}}get onclose(){return this.inner.onclose}set onclose(s){this.inner.onclose=s}get onerror(){return this.inner.onerror}set onerror(s){this.inner.onerror=s}}export{i as OutputGatedTransport};
|
|
3
3
|
|
|
4
4
|
//# debugId=F996DBF661FB7D4564756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{yh,BA,VS,B0,$0,vh}from"./chunk-2f9rkmhx.js";import"./chunk-00167wan.js";import"./chunk-w7hkv422.js";import"./chunk-7rz9898k.js";import"./chunk-fgb98zjj.js";import"./chunk-3xkpk44w.js";import"./chunk-0qsy1qsx.js";import"./chunk-rvvy1bte.js";import"./chunk-r5bxavdx.js";import"./chunk-yf7ympyz.js";import"./chunk-4hw3665t.js";import"./chunk-5d2hft6c.js";import"./chunk-z637nqg8.js";import"./chunk-58wzr3mt.js";export{BA as DEFAULT_MCP_REQUEST_TIMEOUT_MS,yh as MAX_CALLER_MCP_REQUEST_TIMEOUT_MS,vh as ProgressExtendableDeadline,VS as clampCallerMcpRequestTimeoutMs,B0 as resolveMcpRequestTimeoutMs,$0 as resolveMcpRequestTimeoutMsOnce};
|
|
3
|
+
|
|
4
|
+
//# debugId=618DCD6F7699A92664756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qae,jy,E4}from"./chunk-hrfytkxh.js";import"./chunk-5d2hft6c.js";import"./chunk-z637nqg8.js";import"./chunk-58wzr3mt.js";export{qae as createTemplateMaintenance,jy as getDefaultSimulatorCreationService,E4 as stopTemplateBuilds};
|
|
3
|
+
|
|
4
|
+
//# debugId=6A53D57475ACADC764756E2164756E21
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{i,
|
|
3
|
-
${l.stdout}`;return{identifier:H(p,"Identifier"),teamIdentifier:
|
|
4
|
-
export{
|
|
2
|
+
import{i,Se,Qe,e}from"./chunk-z637nqg8.js";import{f}from"./chunk-58wzr3mt.js";import{Io,_o,sn,De,nY,une,pne,an,bi,so,NY}from"./chunk-r5bxavdx.js";import{n,a,s}from"./chunk-4hw3665t.js";import{r,t}from"./chunk-rbpdk7m0.js";import E from"path";var k="AutoMobile Network Identity Probe.app",L="dev.jasonpearson.automobile.networkfilter",C="dev.jasonpearson.automobile.networkfilter.provider",q=E.posix.join("Contents","MacOS","network-filter-controller"),B=E.posix.join("Contents","Library","SystemExtensions",`${C}.systemextension`),S="/Applications",g=f.NETWORK_FILTER_APP_PATH.name,M=f.NETWORK_FILTER_TEAM_ID.name,hm="auto-mobile --ios-network-filter install",W=`Open System Settings > General > Login Items & Extensions > Network Extensions (macOS 13 and 14: System Settings > Privacy & Security, then Allow) and enable "AutoMobile Network Identity Probe". Allow the content filter when macOS asks, then run \`${hm}\` again. AutoMobile never approves the extension for you.`,K=`Restart macOS to finish installing the Network Extension, then run \`${hm}\` again.`;function I(o=S){return E.join(o,k)}function R(o){return E.join(o,q)}function V(o){return E.join(o,B)}import v from"path";var z=127;class d{async run(o,l,p={}){try{let c=await Io((m)=>_o(o,[...l],m),{timeoutMs:p.timeoutMs,maxBuffer:16777216,killSignal:"SIGKILL"},{command:o,args:[...l]},{preserveError:!0});return{exitCode:0,stdout:c.stdout,stderr:c.stderr,timedOut:!1}}catch(c){let m=c;return e.debug(`[NETWORK_FILTER] ${o} exited unsuccessfully: ${r(c)}`),{exitCode:typeof m.code==="number"?m.code:z,stdout:String(m.stdout??""),stderr:String(m.stderr??(typeof m.code==="string"?m.code:"")),timedOut:m.killed===!0&&m.signal==="SIGKILL"}}}}import*as u from"fs/promises";var X=448,Z=384;async function j(o){try{let l=await u.stat(o);if(l.isDirectory())return"directory";return l.isFile()?"file":null}catch(l){return e.debug(`[NETWORK_FILTER] ${o} is not statable: ${r(l)}`),null}}class w{async isDirectory(o){return await j(o)==="directory"}async isFile(o){return await j(o)==="file"}async readText(o){try{return await u.readFile(o,"utf8")}catch(l){return e.debug(`[NETWORK_FILTER] ${o} is not readable: ${r(l)}`),null}}async writeText(o,l){await u.writeFile(o,l,{encoding:"utf8",mode:Z})}async ensureDir(o){await u.mkdir(o,{recursive:!0,mode:X})}async remove(o){await u.rm(o,{recursive:!0,force:!0})}async rename(o,l){await u.rename(o,l)}}var Q="network-filter",Y="network-filter.json",ee=60000,te=60000,x="local-override";class T{downloader;checksumCalculator;fileSystem;commandRunner;cacheDir;timer;cache;env;downloadTimeoutMs;expectedChecksumOverride;releaseUrlOverride;inFlight=null;constructor(o={}){this.downloader=o.downloader??new bi,this.checksumCalculator=o.checksumCalculator??new an,this.fileSystem=o.fileSystem??new w,this.commandRunner=o.commandRunner??new d,this.cacheDir=o.cacheDir??Qe(Q),this.timer=o.timer??i,this.cache=new so({downloader:this.downloader,checksumCalculator:this.checksumCalculator,fileSystem:this.fileSystem,timer:this.timer}),this.env=o.env??process.env,this.downloadTimeoutMs=o.downloadTimeoutMs??ee,this.expectedChecksumOverride=o.expectedChecksum,this.releaseUrlOverride=o.releaseUrl}get cacheDirectory(){return this.cacheDir}async ensure(){if(this.inFlight)return this.inFlight;return this.inFlight=this.doEnsure().finally(()=>{this.inFlight=null}),this.inFlight}async doEnsure(){let o=this.env[g]?.trim();if(o)return this.resolveOverride(o);let l=sn(De(this.env)),p=this.expectedChecksumOverride??pne(this.env);if(p.length===0)throw new t(`No Network Extension app is published for AutoMobile ${l}: the release checksum registry has no networkFilterSha256 for this version, so no download can be trusted. Upgrade AutoMobile, or set ${g} to a locally built, Developer ID signed app.`);let c=await this.tryCache(p);if(c)return e.info("[NETWORK_FILTER] Reusing verified release app",{path:c}),{appPath:c,source:"release",version:l,sha256:p};return{appPath:await this.download(p,l),source:"release",version:l,sha256:p}}async resolveOverride(o){let l=Se(o,this.env);if(!l.endsWith(".app")||!await this.fileSystem.isDirectory(l))throw new t(`${g} must point at an app bundle directory ending in .app, but ${l} is not one. Build it with scripts/ios/build-network-filter-probe.sh signed.`);if(!await this.fileSystem.isFile(R(l)))throw new t(`${g} points at ${l}, which has no Contents/MacOS/network-filter-controller. Build it with scripts/ios/build-network-filter-probe.sh signed.`);return{appPath:l,source:"override",version:x,sha256:null}}get metadataPath(){return v.join(this.cacheDir,Y)}get appDir(){return v.join(this.cacheDir,"app")}get cachedAppPath(){return v.join(this.appDir,k)}async tryCache(o){return await this.cache.isCached({label:"[NETWORK_FILTER]",subject:"app",expectedSha256:o,metadataPath:this.metadataPath,parseMetadata:(p)=>re(p)?p:null,verifyArtifact:()=>this.fileSystem.isFile(R(this.cachedAppPath))})?this.cachedAppPath:null}async download(o,l){await this.fileSystem.ensureDir(this.cacheDir);let p=v.join(this.cacheDir,`${nY}.download`),c=v.join(this.cacheDir,"app.download");return await this.cache.fetch({label:"[NETWORK_FILTER]",expectedSha256:o,url:this.releaseUrlOverride??une(this.env),archivePath:p,metadataPath:this.metadataPath,downloadTimeoutMs:this.downloadTimeoutMs,mismatchError:(m,N)=>new t(`Network Extension app checksum verification failed. Expected: ${m}, Got: ${N}. The downloaded release asset is corrupted or tampered; nothing was installed.`),timeoutError:()=>new t(`Timed out downloading the Network Extension app after ${this.downloadTimeoutMs}ms. Check GitHub Release asset availability or set ${g} for a local build.`),publish:async(m,N)=>{await this.fileSystem.remove(c),await this.fileSystem.ensureDir(c);let F=await this.commandRunner.run("ditto",["-x","-k",m,c],{timeoutMs:te});if(F.exitCode!==0)throw new t(`Unable to unpack the Network Extension app archive with ditto (exit ${F.exitCode}): ${F.stderr.trim()||"no output"}`);let y=v.join(c,k);if(!await this.fileSystem.isFile(R(y)))throw new t(`The Network Extension release asset does not contain ${k} with its controller executable.`);return await this.fileSystem.remove(this.appDir),await this.fileSystem.rename(c,this.appDir),e.info("[NETWORK_FILTER] Downloaded and verified release app",{path:this.cachedAppPath,sha256:N}),{version:l,sha256:N??o,downloadedAt:this.timer.now()}},discard:()=>this.fileSystem.remove(c),settle:()=>this.fileSystem.remove(p)}),this.cachedAppPath}}function re(o){return typeof o==="object"&&o!==null&&"sha256"in o&&typeof o.sha256==="string"}var U=30000;function H(o,l){let p=`${l}=`,m=o.split(/\r?\n/).find((N)=>N.startsWith(p))?.slice(p.length).trim();return m&&m.length>0?m:null}class A{runner;constructor(o=new d){this.runner=o}async inspect(o){let l=await this.runner.run("codesign",["--verify","--deep","--strict",o],{timeoutMs:U});return{verified:l.exitCode===0,verifyDetail:l.stderr.trim(),app:await this.identity(o),provider:await this.identity(V(o))}}async identity(o){let l=await this.runner.run("codesign",["-dvvv",o],{timeoutMs:U}),p=`${l.stderr}
|
|
3
|
+
${l.stdout}`;return{identifier:H(p,"Identifier"),teamIdentifier:NY(p),cdhash:H(p,"CDHash")}}}var ie=/^[A-Z0-9]{10}$/;function D(o,l){return[ne(o),J("app",o.app.identifier,L),J("provider",o.provider.identifier,C),oe(o),ae(o.app.teamIdentifier,l)].filter((p)=>p!==null)}function ne(o){if(o.verified)return null;return`codesign --verify --deep --strict failed${o.verifyDetail?`: ${o.verifyDetail}`:""}`}function J(o,l,p){return l===p?null:`${o} identifier is ${l??"missing"}, expected ${p}`}function oe(o){let l=o.app.teamIdentifier;if(l===null||!ie.test(l))return`app is not signed by a Developer ID team (TeamIdentifier ${l??"not set"})`;let p=o.provider.teamIdentifier;return p===l?null:`provider team ${p??"not set"} differs from app team ${l}`}function ae(o,l){if(!l||o===l)return null;return`signing team ${o??"not set"} does not match the pinned team ${l}`}var se=30000,le=s({version:a().optional(),state:n(),detail:n()});function pe(o){let p=o.split(/\r?\n/).map((c)=>c.trim()).filter((c)=>c.startsWith("{")).at(-1);if(p===void 0)return null;try{let c=le.safeParse(JSON.parse(p));return c.success?c.data:null}catch(c){return e.debug(`[NETWORK_FILTER] controller output is not JSON: ${r(c)}`),null}}function ce(o){if(o.timedOut)return{state:"unavailable",controllerState:null,detail:"network-filter-controller did not exit in time; activation may still have completed.",nextSteps:`Run \`${hm}\` again to reconcile.`};let l=pe(o.stdout);if(l===null)return{state:"failed",controllerState:null,detail:`network-filter-controller exited ${o.exitCode} without a JSON result`+(o.stderr.trim()?`: ${o.stderr.trim()}`:".")};let p={controllerState:l.state,detail:l.detail};switch(l.state){case"ready":return o.exitCode===0?{...p,state:"ready"}:{...p,state:"failed"};case"approval_required":return/restart/i.test(l.detail)?{...p,state:"restart_required",nextSteps:K}:{...p,state:"approval_required",nextSteps:W};case"unavailable":return{...p,state:"unavailable"};default:return{...p,state:"failed"}}}async function _(o,l,p,c=se){let m=await o.run(R(l),[p],{timeoutMs:c});return ce(m)}import P from"path";var me=120000;class O{runner;fileSystem;constructor(o=new d,l=new w){this.runner=o;this.fileSystem=l}async exists(o){return this.fileSystem.isDirectory(o)}async install(o,l,p){if(!p.replace&&await this.exists(l))throw new t(`Refusing to overwrite the existing ${l}.`);let c=P.join(P.dirname(l),`.${P.basename(l)}.partial`);await this.fileSystem.remove(c);let m=await this.runner.run("ditto",[o,c],{timeoutMs:me});if(m.exitCode!==0)throw await this.fileSystem.remove(c),new t(`Unable to copy the Network Extension app to ${P.dirname(l)} (ditto exit ${m.exitCode}): ${m.stderr.trim()||"no output"}. Installing into /Applications needs an administrator account.`);await this.fileSystem.remove(l),await this.fileSystem.rename(c,l)}}import de from"path";var G="install-receipt.json";function b(o){return de.join(o,G)}class G0{fileSystem;commandRunner;cacheDir;env;destination;constructor(o={}){this.fileSystem=o.fileSystem??new w,this.commandRunner=o.commandRunner??new d,this.cacheDir=o.cacheDir,this.env=o.env??process.env,this.destination=I(o.installDir??S)}async inspect(o={}){let l=this.env[g]?.trim()?x:sn(De(this.env)),p={installed:!1,installedPath:this.destination,installedVersion:null,expectedVersion:l,report:null};if(!await this.fileSystem.isDirectory(this.destination))return p;let c=this.cacheDir??new T({env:this.env}).cacheDirectory;return{...p,installed:!0,installedVersion:await this.readReceiptVersion(c),report:await _(this.commandRunner,this.destination,"status",o.timeoutMs)}}async readReceiptVersion(o){let l=await this.fileSystem.readText(b(o));if(l===null)return null;try{let p=JSON.parse(l);return typeof p==="object"&&p!==null&&"version"in p&&typeof p.version==="string"?p.version:null}catch(p){return e.debug(`[NETWORK_FILTER] Ignoring unreadable install receipt: ${r(p)}`),null}}}function ue(o){let l=o[M]?.trim();return l&&l.length>0?l:null}class Iae{appSource;verifier;fileInstaller;commandRunner;fileSystem;timer;env;platform;destination;constructor(o={}){this.env=o.env??process.env,this.commandRunner=o.commandRunner??new d,this.fileSystem=o.fileSystem??new w,this.appSource=o.appSource??new T({env:this.env,commandRunner:this.commandRunner,fileSystem:this.fileSystem}),this.verifier=o.verifier??new A(this.commandRunner),this.fileInstaller=o.fileInstaller??new O(this.commandRunner,this.fileSystem),this.timer=o.timer??i,this.platform=o.platform??process.platform,this.destination=I(o.installDir??S)}async install(o={}){let l={action:"none",installedPath:this.destination};if(this.platform!=="darwin")return{...l,state:"unavailable",detail:"The Network Extension app only runs on macOS hosts."};let p,c;try{p=await this.appSource.ensure(),c=await this.verifier.inspect(p.appPath)}catch(h){return e.warn(`[NETWORK_FILTER] Unable to prepare the app: ${r(h)}`,h),{...l,state:"failed",detail:r(h)}}let m={source:p.source,version:p.version},N=D(c,ue(this.env));if(N.length>0)return{...l,...m,state:"failed",detail:`Refusing to install ${p.appPath}: ${N.join("; ")}.`};let F;try{let h=await this.place(p,c,o.upgrade===!0);if("refused"in h)return{...l,...m,state:"failed",...h.refused};F=h.action}catch(h){return e.warn(`[NETWORK_FILTER] Unable to install the app: ${r(h)}`,h),{...l,...m,state:"failed",detail:r(h)}}await this.writeReceipt(p,c);let y=await this.activate();return{...m,action:F,installedPath:this.destination,state:y.state,detail:y.detail,nextSteps:y.nextSteps,controllerState:y.controllerState}}async place(o,l,p){if(!await this.fileInstaller.exists(this.destination))return await this.fileInstaller.install(o.appPath,this.destination,{replace:!1}),{action:"installed"};let c=await this.verifier.inspect(this.destination);if(c.app.cdhash!==null&&c.app.cdhash===l.app.cdhash&&c.app.teamIdentifier===l.app.teamIdentifier&&D(c,null).length===0)return{action:"unchanged"};if(!p)return{refused:{detail:`${this.destination} already exists with a different version or signature (installed CDHash ${c.app.cdhash??"unknown"}, team ${c.app.teamIdentifier??"not set"}). It was left unchanged.`,nextSteps:`Run \`${hm} --upgrade\` to replace it.`}};return await this.fileInstaller.install(o.appPath,this.destination,{replace:!0}),{action:"upgraded"}}async writeReceipt(o,l){let p={version:o.version,source:o.source,sha256:o.sha256,cdhash:l.app.cdhash,installedAt:this.timer.now()};try{await this.fileSystem.ensureDir(this.appSource.cacheDirectory),await this.fileSystem.writeText(b(this.appSource.cacheDirectory),JSON.stringify(p,null,2))}catch(c){e.warn(`[NETWORK_FILTER] Unable to write the install receipt: ${r(c)}`,c)}}async activate(){try{return await _(this.commandRunner,this.destination,"activate")}catch(o){return e.warn(`[NETWORK_FILTER] Activation failed: ${r(o)}`,o),{state:"failed",controllerState:null,detail:r(o)}}}}
|
|
4
|
+
export{hm,G0,Iae};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=0FEFFBAE98DCA2BA64756E2164756E21
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{nr}from"./chunk-r5bxavdx.js";var t;function QZ(n){t=n}function a(n){let r=(e)=>(n??t)?.stopStreamsForDevice({deviceId:e,reason:"device_restored",cause:"incarnation change"})??Promise.resolve();return{name:"webrtc-streams",prepareForIncarnationChange:(e)=>r(e),onDeviceIncarnationChanged:(e)=>r(e)}}nr(a());
|
|
3
|
+
export{QZ};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=81BF5421FCF0E82564756E2164756E21
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{i,vE,wae,we,qt,l,e}from"./chunk-z637nqg8.js";import{ra,sr,al,xT,kW,EW,OL,E3,ML,Ao}from"./chunk-0qsy1qsx.js";import{B}from"./chunk-yf7ympyz.js";import{no,Dr,H,J,jr,Wn,ni,o,P,nb,ib,Qm,Ip,Ut,fr,Ee,Zt,Hr,Ab,sO,x,E,Ws}from"./chunk-r5bxavdx.js";import{pP,mP}from"./chunk-4hw3665t.js";import{n3,rte,nte,ite,ote,qh,vw,bw,bv}from"./chunk-7rz9898k.js";import{il,Oe}from"./chunk-3xkpk44w.js";import{cs,ute,nW,xC,c3,mte}from"./chunk-qyqypn28.js";import{Ca,Wh,Wi}from"./chunk-fgb98zjj.js";import{Vo,BW,KC,wc,_3,Ma,Na,eg,NT,Fa,Tw,x3,C3,tg,rg,Sn,kw,Ew,Iw,Iv,Yte}from"./chunk-rvvy1bte.js";import{r,t,u,St}from"./chunk-rbpdk7m0.js";class Q{dependencies;constructor(n){this.dependencies=n}async resolveState(n,s){o(n);let{talkBack:a,unconfirmed:c}=await P(Wh(this.dependencies.accessibilityDetector,this.dependencies.target.device.deviceId,this.dependencies.target.adb,this.dependencies.featureFlags),n);if(o(n),c)s?.([Ca]);return a===!0}async dispatchTap(n,s,a,{signal:c,context:d}){let p={assertCurrent:()=>{o(c),d.assertCurrent()}},m=this.dependencies.talkBackDriverFactory.createDriver(this.dependencies.target.device),h={requestTraversalOrder:m.requestTraversalOrder.bind(m),requestCurrentFocus:m.requestCurrentFocus.bind(m),requestAction:m.requestAction.bind(m),requestNodeAction:m.requestNodeAction.bind(m),supportsNodeActionSelectors:m.supportsNodeActionSelectors.bind(m),requestTapCoordinates:async(y)=>{let{x:b,y:T,duration:g=10,onDispatch:v}=y;p.assertCurrent();let R=()=>{d.onDispatched?.(),v?.()},S=this.dependencies.useContextualFocusTap?await this.requestContextualTalkBackFocus({x:b,y:T},g,a,{signal:c,fence:p,onDispatch:R}):await m.requestTapCoordinates({x:b,y:T,duration:g,onDispatch:R});if(S.success)d.onTapDelivered();return o(c),{...S,totalTimeMs:0}},requestDoubleTapCoordinates:async(y,b,T)=>{p.assertCurrent();let g=await m.requestDoubleTapCoordinates(y,b,()=>{d.onDispatched?.(),T?.()});if(g.success)d.onTapDelivered(),d.onTapDelivered();return o(c),g}},f=await P(n.action==="longPress"?this.dependencies.talkBackStrategy.executeCoordinateFallback({x:s.x,y:s.y},"longPress",Tw(n,"android"),{driver:h,fenceOptions:{displayFence:p}}):this.dependencies.talkBackStrategy.executePreciseTap(s.x,s.y,h,p),c);if(d.onActivationWarnings?.(f.warnings),!f.success)throw new t(`TalkBack coordinate tap failed: ${f.error??"activation was not confirmed"}${f.focusCompleted?" Focus touch was delivered; activation failed. Do not retry automatically.":""}`);o(c)}async requestContextualTalkBackFocus(n,s,a,c){let{signal:d,fence:p,onDispatch:m}=c,h=!1;try{let f=await this.dependencies.androidClient.requestTapCoordinates({x:n.x,y:n.y,duration:s,timeoutMs:Ab(s),frameContext:a,onDispatch:()=>{h=!0},signal:d,beforeSend:p.assertCurrent});if(h&&!Fa(f.error))m();return f}catch(f){if(h)throw m(),Sn(r(f));throw u(f,"TalkBack focus tap failed before dispatch")}}}class Z{dependencies;constructor(n){this.dependencies=n}async dispatchAndroidTaps(n,s,a,c){let{transitionRevision:d}=c,p=await this.dispatchAndroidTapWithOneFreshRetry(n,s,a,c);if(!c.talkBackEnabled)await this.dispatchSecondAndroidTap(n,s,d,{...c,firstTap:p})}async dispatchAndroidTapWithOneFreshRetry(n,s,a,c){let{signal:d,transitionRevision:p,perf:m}=c,h=a.viewHierarchy?.frameContext,f=!1,y=!1,b=()=>{f=!0,c.onTapDelivered()};try{if(c.talkBackEnabled)return await this.dependencies.androidTalkBack.dispatchTap(n,s,h,{signal:d,context:{assertCurrent:()=>this.dependencies.host.assertDisplayRevisionCurrent(p),onTapDelivered:b,onDispatched:()=>{y=!0},onActivationWarnings:c.onActivationWarnings}}),{doubleTapDelivered:!1,startedAt:this.dependencies.timer.now()};return await this.dispatchAndroidFirstTap(n,s,h,{signal:d,context:{assertCurrent:()=>this.dependencies.host.assertDisplayRevisionCurrent(p),onTapDelivered:c.onTapDelivered}})}catch(T){o(d);let g=u(T,"Failed to dispatch Android coordinate tap");if(f||y||h===void 0||!Fa(g.message))throw g;o(d);let v=await this.dependencies.host.observeScreen.execute({freshness:this.dependencies.host.retryFreshness(n),signal:d,perf:m});this.dependencies.host.assertDisplayRevisionCurrent(p),this.dependencies.host.assertSnapshotCurrent(n,v);let R=this.dependencies.host.resolveFreshFrameRetry(n,s,a,v);if(!R)throw g;if(c.talkBackEnabled)return await this.dependencies.androidTalkBack.dispatchTap(n,R.point,R.frameContext,{signal:d,context:{assertCurrent:()=>this.dependencies.host.assertDisplayRevisionCurrent(p),onTapDelivered:b,onDispatched:()=>{y=!0},onActivationWarnings:c.onActivationWarnings}}),{doubleTapDelivered:!1,startedAt:this.dependencies.timer.now()};return await this.dispatchAndroidFirstTap(n,R.point,R.frameContext,{signal:d,context:{assertCurrent:()=>this.dependencies.host.assertDisplayRevisionCurrent(p),onTapDelivered:c.onTapDelivered}})}}async dispatchAndroidFirstTap(n,s,a,{signal:c,context:d}){let p=this.dependencies.timer.now();if(n.action==="doubleTap"&&await C3(this.dependencies.androidClient,{...s,frameContext:a,signal:c,assertCurrent:d.assertCurrent,onTapDelivered:d.onTapDelivered}))return{doubleTapDelivered:!0,startedAt:p};return await this.dispatchAndroidTap(s,Tw(n,"android"),a,{signal:c,context:d}),{doubleTapDelivered:!1,startedAt:p}}async dispatchSecondAndroidTap(n,s,a,c){let{signal:d}=c;if(n.action!=="doubleTap"||c.firstTap.doubleTapDelivered)return;await x3(this.dependencies.timer,c.firstTap.startedAt,{signal:d,onWarning:(p)=>c.onActivationWarnings([p])}),this.dependencies.host.assertDisplayRevisionCurrent(a),await this.dispatchAndroidTap(s,Tw(n,"android"),void 0,{signal:d,context:{assertCurrent:()=>this.dependencies.host.assertDisplayRevisionCurrent(a),onTapDelivered:c.onTapDelivered}})}async dispatchAndroidTap(n,s,a,{signal:c,context:d}){let p=ite(d.onTapDelivered);await this.dependencies.androidCoordinateTap(this.dependencies.androidClient,this.dependencies.host.adb,n,{durationMs:s,options:{frameContext:a,signal:c,assertCurrent:d.assertCurrent,onTapDelivered:p}}),p(),o(c)}}import{createHash as fe}from"crypto";import{isDeepStrictEqual as rt}from"util";var nt=300000,it=128,ot=new Set(["extras","view-id","occlusionState","occludedBy","occludedByViewId"]);function V(n){if(Array.isArray(n))return n.map(V);if(!n||typeof n!=="object")return n;return Object.fromEntries(Object.entries(n).filter(([s])=>!ot.has(s)).map(([s,a])=>[s,V(a)]))}function Te(n){return Boolean(ib(n.truncationReasons).length||ib(n.viewHierarchy?.truncationReasons).length)}function ge(n){return Boolean(n.truncationReasons?.some(nb)||n.viewHierarchy?.truncationReasons?.some(nb)||n.viewHierarchy?.windows?.some((s)=>s.truncationReasons?.some(nb)))}function Se(n){return Te(n)||ge(n)&&(!n.viewHierarchy||!Qm(n.viewHierarchy))||Boolean(n.viewHierarchy?.windows?.some((s)=>ib(s.truncationReasons??void 0).length>0))}function ye(n){let s=n.rotation??n.viewHierarchy?.rotation;if(!Number.isInteger(s)||!n.viewHierarchy||Te(n))return null;let a=n.viewHierarchy;return{screenSize:{width:n.screenSize?.width,height:n.screenSize?.height},rotation:s,systemInsets:n.systemInsets,insets:n.insets,activeWindow:{appId:n.activeWindow?.appId,activityName:n.activeWindow?.activityName},screenIdentity:n.screenIdentity?{platform:n.screenIdentity.platform,source:n.screenIdentity.source,key:n.screenIdentity.key}:void 0,hierarchy:{tree:V(a.hierarchy),windows:V(a.windows),packageName:a.packageName,foregroundActivity:a.foregroundActivity,screenWidth:a.screenWidth,screenHeight:a.screenHeight,pixelWidth:a.pixelWidth,pixelHeight:a.pixelHeight,nativeScale:a.nativeScale,rotation:a.rotation,systemInsets:a.systemInsets,insets:a.insets}}}function xe(n,s){let a=ye(n),c=ye(s);return a!==null&&c!==null&&rt(a,c)}function st(n){return Number.isFinite(n.width)&&Number.isFinite(n.height)&&n.width>0&&n.height>0}function at(n){return typeof n==="number"&&Number.isFinite(n)&&n>0}function ut(n){return/^([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}):\d+(?::[0-9a-f]+)?$/i.exec(n)?.[1]?.toLowerCase()}function Ae(n){let s=[];if(!n.display?.key)s.push("display");if(!st(n.screenSize))s.push("screenSize");let a=n.rotation??n.viewHierarchy?.rotation;if(!Number.isInteger(a))s.push("rotation");if(!at(n.viewHierarchy?.nativeScale))s.push("nativeScale");if(!n.viewHierarchy?.frameContext)s.push("frameContext");if(Se(n))s.push("completeHierarchy");return s}function ct(n){let s=n.viewHierarchy?.windows?.find((c)=>c.isFocused),a=s?.bounds;return{focusedWindowPresent:s!==void 0,focusedWindowId:s?.id,focusedWindowType:s?.type,focusedWindowPackage:s?.packageName,focusedWindowBounds:a?JSON.stringify([a.left,a.top,a.right,a.bottom]):void 0}}function be(n,s){if(Ae(s).length>0)return;let{width:a,height:c}=s.screenSize;return{deviceId:n,incarnation:no(n),displayKey:s.display.key,displayRole:s.display.role,displayPosture:s.display.posture,width:a,height:c,rotation:s.rotation??s.viewHierarchy?.rotation,nativeScale:s.viewHierarchy.nativeScale,runnerEpoch:ut(s.viewHierarchy.frameContext),appId:s.activeWindow?.appId||s.viewHierarchy?.packageName,hierarchyPackage:s.viewHierarchy?.packageName,activityName:s.activeWindow?.activityName??"",windowType:s.activeWindow?.type,...ct(s)}}function dt(n,s,a){if(a==="runnerEpoch"||a==="focusedWindowPresent")return!1;if((a==="activityName"||a==="windowType")&&(!n[a]||!s[a]))return!1;if(a.startsWith("focusedWindow")&&(!n.focusedWindowPresent||!s.focusedWindowPresent))return!1;return n[a]!==s[a]}function Pe(n){if(n&&typeof n==="object"&&!Array.isArray(n)){let s=n;return[s.left,s.top,s.right,s.bottom]}return n}function q(n,s){if(Array.isArray(s)){for(let d of s)q(n,d);return}if(!s||typeof s!=="object")return;let a=s,c={...a,...we(a)};if(sO(c["resource-id"]))return;n.update("["),n.update(JSON.stringify([c.className??c.class??c.type,c.role,Pe(qt(a)),c.clickable,c.enabled,c["visible-to-user"],c.scrollable,c["resource-id"],Array.isArray(c.actions)?[...c.actions].sort():c.actions])),q(n,a.node),n.update("]")}function ve(n){let s=n.viewHierarchy,a=ge(n)?Qm(s):s,c=fe("sha256");c.update(Dr([n.systemInsets,n.insets,s.screenWidth,s.screenHeight,s.pixelWidth,s.pixelHeight,s.nativeScale,s.rotation,s.systemInsets,s.insets])),q(c,a.hierarchy);let d;if(a.windows!==void 0){let p=fe("sha256");for(let m of a.windows)p.update(JSON.stringify([m.id,m.type,m.isActive,m.isFocused,Pe(m.bounds),m.windowLayer,m.packageName])),q(p,m.hierarchy);d=p.digest("hex")}return{tree:c.digest("hex"),windows:d}}function pt(n,s){return n.tree===s.tree&&(n.windows===void 0||s.windows===void 0||n.windows===s.windows)}class Re{timer;ids;entries=new Map;constructor(n=i,s=B){this.timer=n;this.ids=s}capture(n,s){let a=be(n,s);if(!a)return{status:"unavailable",missing:Ae(s)};this.cleanup();while(this.entries.size>=it)this.entries.delete(this.entries.keys().next().value);let c={snapshotId:this.ids.next(),expiresAt:this.timer.now()+nt};return this.entries.set(c.snapshotId,{...a,...c,layout:ve(s)}),{status:"captured",reference:c}}staleReason(n,s,a){let c=this.entries.get(n);if(!c)return"Snapshot reference is unknown or evicted; re-observe.";if(this.timer.now()>=c.expiresAt)return this.entries.delete(n),"Snapshot reference expired; re-observe.";if(Se(a))return"Snapshot layout is unavailable. The hierarchy capture was incomplete; observe again, or use a selector or coordinates without a snapshotId.";let d=be(s,a);if(!d)return"Snapshot geometry or frame context is unavailable; re-observe.";if(c.runnerEpoch!==d.runnerEpoch)return"Snapshot reference is stale (runner restarted); re-observe.";for(let m of Object.keys(d))if(dt(c,d,m))return`Snapshot reference is stale (${m} changed); re-observe.`;let p=ve(a);if(!pt(c.layout,p))return"Snapshot reference is stale (tap-targeting layout changed); re-observe.";return}get size(){return this.entries.size}cleanup(){for(let[n,s]of this.entries)if(this.timer.now()>=s.expiresAt)this.entries.delete(n)}}var ip=new Re;var N=31,lt=5000;function ee(n){return`shell input stylus ${n}`}function Q5(n){let{pointer:s,platform:a,gesture:c,display:d}=n;if(s===void 0)return;if(s.toolType!=="stylus"&&s.toolType!=="eraser")return`pointer.toolType "${String(s.toolType)}" is not supported; only "stylus" or "eraser" can be injected`;if(a!=="android")return`pointer.toolType "${s.toolType}" is Android-only; omit pointer on iOS`;if(c==="doubleTap")return"stylus pointer does not support doubleTap yet; use tap or longPress";if(d!==void 0)return"stylus pointer does not support display selection yet; omit display";return}async function mt(n,s){let a=await Ut(n,lt,void 0,s);if(a===null)return`could not read the device's Android API level, so stylus input is refused (it needs API ${N} or newer)`;if(a<N)return`stylus input needs Android API ${N} or newer (this device reports API ${a}): older releases build the injected event without a stylus tool type`;return}async function ht(n,s){let a=await mt(n,s);if(a)throw new t(a)}function Ce(n,s){return Q5({pointer:s.pointer,platform:n,gesture:s.action??"tap",display:s.display})}function Ie(n,s,a="tap"){return{success:!1,x:s.x,y:s.y,action:a,error:n}}class vv extends t{}function ft(n,s){let{command:a,dispatched:c,holdMs:d,signal:p}=s;if(n instanceof Ee||n instanceof BW)return n;try{KC(a,jr(n))}catch(h){return h}if(!c)return n;let m=d===void 0?void 0:n3(n,d,p);return new vv(m??r(n),{cause:n})}async function De(n,{command:s,timeoutMs:a,holdMs:c},d){await ht(n,d.signal);let p=!1;try{await _3(n,s,{...d,timeoutMs:a,onDispatch:()=>{p=!0,d.onDispatch?.()}})}catch(m){throw ft(m,{command:s,dispatched:p,holdMs:c,signal:d.signal})}}async function _e(n,s,a,c={}){let{x:d,y:p}=s,m=a.durationMs??NT,h=a.action==="longPress";try{await De(n,h?{command:ee(`swipe ${d} ${p} ${d} ${p} ${Vo(m)}`),timeoutMs:Hr(m),holdMs:m}:{command:ee(`tap ${d} ${p}`)},c)}catch(f){throw f instanceof vv?Sn(f.message):f}}function tte(n,s,a={}){let{from:c,to:d,duration:p}=s;return De(n,{command:ee(`swipe ${c.x} ${c.y} ${d.x} ${d.y} ${Vo(p)}`),timeoutMs:Hr(p)},a)}var ke=new Map;function Y(n){let s=ke.get(n);if(!s)s=new Wn,ke.set(n,s);return s}var yt="dev.jasonpearson.automobile.ctrlproxy/.pointer.PointerInstrumentation",re=31,bt=1,Be=200,vt=15000;function e3(n){return n*2+vt}class Zc extends t{}function Tt(n){return n.points.slice(1).reduce((s,a)=>s+(a.durationMs??Be),0)}function gt(n){let s={version:bt,tool:n.features.toolType,hover:n.features.hover===!0,buttons:n.buttons??0,displayId:n.displayId??0,points:n.points.map((a,c)=>({x:a.x,y:a.y,...c===0?{}:{durationMs:a.durationMs??Be},...a.distance===void 0?{}:{distance:a.distance},...a.pressure===void 0?{}:{pressure:a.pressure},...a.tilt===void 0?{}:{tilt:a.tilt},...a.orientation===void 0?{}:{orientation:a.orientation}}))};return Buffer.from(JSON.stringify(s),"utf8").toString("base64")}function xt(n){return`shell am instrument -w -r --no-restart -e request ${gt(n)} ${yt}`}function At(n){let s=new Map;for(let d of n.split(/\r?\n/)){let p=/^INSTRUMENTATION_RESULT: ([A-Za-z]+)=(.*)$/.exec(d);if(p)s.set(p[1],p[2])}let a=s.get("success");if(a!=="true"&&a!=="false")return;let c=s.get("error");return{success:a==="true",...c?{error:c}:{},injected:Number(s.get("injected")??0),elapsedMs:Number(s.get("elapsedMs")??0)}}async function Pt(n,s){if(/Unable to find instrumentation|INSTRUMENTATION_FAILED|does not exist/i.test(n))return new Zc("The connected CtrlProxy does not include the pointer instrumentation; update CtrlProxy. No input was sent.");if(/Unknown option|--no-restart/i.test(n))return new Zc("This Android version's `am instrument` has no --no-restart, which keeps the injection from restarting CtrlProxy; hover and stylus injection need Android 12 or newer. No input was sent.");if(/Process crashed|INSTRUMENTATION_RESULT: shortMsg=/i.test(n)){let a="";try{a=(await s.executeCommand("shell settings get secure enabled_accessibility_services",{timeoutMs:5000})).stdout.includes("dev.jasonpearson.automobile.ctrlproxy")?" CtrlProxy's accessibility service is still enabled.":" CtrlProxy's accessibility service is not enabled; re-enable it before retrying."}catch(c){e.warn(`Could not read accessibility services after pointer crash: ${r(c)}`,c)}return new t("The pointer instrumentation crashed before reporting a result; the hover or stroke may have partially run. Verify state with observe before retrying."+a)}return new t("The pointer instrumentation did not report a result; the hover or stroke may have partially run. Verify state with observe before retrying.")}var wt=/could not be closed/i,Rt=5000;async function te(n,s,a,c){let d=s.points[0];try{await H(c,()=>n.executeCommand(`shell input stylus motionevent CANCEL ${Math.round(d.x)} ${Math.round(d.y)}`,{timeoutMs:Rt,...c?{signal:c}:{}}))}catch(p){e.warn(`Could not cancel ${a}: ${r(p)}`,p)}}async function Ne(n,s,a){try{return await n()}catch(c){if(!(c instanceof Zc))await te(s,a,"an abandoned pointer run");throw c}}function qV(n,s){let a=Y(s);return async(c,d)=>{o(d),await a.runExclusive(async()=>{o(d);let p=async()=>{let h=await n.executeCommand(xt(c),{timeoutMs:e3(Tt(c)),signal:d}),f=[h.stdout,h.stderr].filter(Boolean).join(`
|
|
3
|
+
`),y=At(f);if(!y)throw await Pt(f,n);return y},m=await Ne(p,n,c);if(!m.success&&m.injected===0&&/refused/i.test(m.error??""))o(d),await te(n,c,"refused pointer input",d),o(d),m=await Ne(p,n,c);if(!m.success&&wt.test(m.error??""))await te(n,c,"an unclosed pointer");if(!m.success)throw new t(`The pointer instrumentation failed after ${m.injected} event${m.injected===1?"":"s"}: ${m.error??"unknown error"}`)})}}function Ct(n,s){let a=s.width-1,c=s.height-1,d=Math.round(n.x),p=Math.round(n.y),m=s.rotation===1?{x:a-p,y:d}:s.rotation===2?{x:a-d,y:c-p}:s.rotation===3?{x:p,y:c-d}:{x:d,y:p};return{x:oe(m.x,a),y:oe(m.y,c)}}function It(n,s){switch(s){case 1:return n+Math.PI/2;case 2:return n+Math.PI;case 3:return n-Math.PI/2;default:return n}}function oe(n,s){return Math.min(Math.max(n,0),s)}function Et(n,s){let a=Math.sin(n)**2,c=Math.sin(s)*Math.cos(s),d=Math.sqrt(Math.max(0,1-4*c*c*a)),p=c===0?a:2*a/(1+d),m=Math.sqrt(p),h=(f)=>Math.max(-90,Math.min(90,Math.round(Math.asin(Math.max(-1,Math.min(1,f)))*180/Math.PI)))||0;return{x:h(-m*Math.sin(s)),y:h(m*Math.cos(s))}}function Dt(n){let s=n.features.hover===!0,a=n.points[0],c=a.pressure??(s?0:1),d=a.distance??(s?0.5:0),m=n.points.some((b)=>b.tilt!==void 0||b.orientation!==void 0)?a.tilt??0:void 0,h=a.orientation??0,f=[{atMs:0,x:a.x,y:a.y,pressure:c,distance:d,tilt:m,orientation:h}],y=0;return n.points.slice(1).forEach((b,T)=>{let g=n.points[T],v=b.durationMs??200,R=Math.max(1,Math.ceil(v/16)),S={pressure:c,distance:d,tilt:m,orientation:h};for(let D=1;D<=R;D++){let A=D/R;c=M(S.pressure,b.pressure??S.pressure,A),d=M(S.distance,b.distance??S.distance,A),m=S.tilt===void 0?void 0:M(S.tilt,b.tilt??S.tilt,A),h=M(S.orientation,b.orientation??S.orientation,A),f.push({atMs:y+Math.floor(v*D/R),x:D===R?b.x:M(g.x,b.x,A),y:D===R?b.y:M(g.y,b.y,A),pressure:c,distance:d,tilt:m,orientation:h})}y+=v}),f}function M(n,s,a){return n+(s-n)*a}function O(n,s){return[3,n,s]}function Me(n,s){return Math.round(oe(n,1)*s)}function se(n,s,a){let c=Ct(n,s),d=!a&&n.tilt!==void 0?Et(n.tilt,It(n.orientation,s.rotation)):void 0;return[...O(0,c.x),...O(1,c.y),...a?O(25,Me(n.distance,255)):O(24,Me(n.pressure,4095)),...d?[...O(26,d.x),...O(27,d.y)]:[]]}var U=[0,0,0];function Fe(n){return n.features.toolType==="eraser"?321:320}function Ue(n,s){return[...n&32?[1,331,s]:[],...n&64?[1,332,s]:[]]}function Ot(n,s,a,c){let d=[1,Fe(c),1];return a?[...d,...se(n,s,!0),...O(24,0),...U]:[...d,1,330,1,...se(n,s,!1),...O(25,0),...Ue(c.buttons??0,1),...U]}function _t(n,s,a){let c=[1,s,0,...U];return n?c:[...Ue(a,0),1,330,0,...O(24,0),...U,...c]}function F(n,s,a){return{code:n,info:{value:0,minimum:s,maximum:a,fuzz:0,flat:0,resolution:0}}}function kt(n){return{id:1,command:"register",name:"automobile-pen",vid:6353,pid:19985,bus:"usb",configuration:[{type:100,data:[0,1,3]},{type:101,data:[320,321,330,331,332]},{type:103,data:[0,1,24,25,26,27]},{type:110,data:[1]}],abs_info:[F(0,0,n.width-1),F(1,0,n.height-1),F(24,0,4095),F(25,0,255),F(26,-90,90),F(27,-90,90)]}}var ne=(n)=>({id:1,command:"inject",events:n}),ie=(n)=>({id:1,command:"delay",duration:n});function Le(n,s){let a=n.features.hover===!0,[c,...d]=Dt(n),p=[kt(s),ie(4000),ne(Ot(c,s,a,n))],m=0;for(let h of d){if(h.atMs>m)p.push(ie(h.atMs-m)),m=h.atMs;p.push(ne([...se(h,s,a),...U]))}return p.push(ne(_t(a,Fe(n),n.buttons??0)),ie(50)),`${p.map((h)=>JSON.stringify(h)).join(`
|
|
4
|
+
`)}
|
|
5
|
+
`}var t3=4050;function $e(n){return t3+n.slice(1).reduce((s,a)=>s+(a.durationMs??200),0)}var Ge=5000,Nt=1e4,Bt=1e5,X="automobile-uinput-exit=",We=97;async function Mt(n,s){let{stdout:a}=await n.executeCommand(bw(0),{timeoutMs:Ge,noRetry:!0,signal:s}),c=vw(a),d=c?bv(c):void 0;if(!d)throw Error(`Could not parse the display size from wm size output: ${a.trim()}`);let p=await al(n,{timeoutMs:Ge,signal:s});if(p===null)throw Error("WindowManager did not report the display rotation");return{...d,rotation:p}}async function Ft(n,s,a,c){let d=Buffer.from(s,"utf8").toString("base64"),p=await n.execute(["shell",`s=$(echo ${d} | base64 -d) || { echo ${X}${We}; exit 0; }; printf '%s\\n' "$s" | uinput - 2>&1; echo ${X}$?`],{timeoutMs:a,noRetry:!0,signal:c}),m=`${p.stdout}
|
|
6
|
+
${p.stderr}`,h=new RegExp(`${X}(\\d+)`).exec(m);return{exitCode:h?Number(h[1]):null,stderr:m.replace(new RegExp(`${X}\\d+`),"").trim()}}function Lt(n){let s=n.stderr||`exit ${n.exitCode??"unknown"}`;if(n.exitCode===We)return new Zc("The device could not decode the uinput script (base64 -d failed). No input was sent.");if(n.exitCode===127||/not found/i.test(n.stderr))return new Zc(`This device has no uinput tool, so the uinput route cannot inject a stylus: ${s}. No input was sent.`);if(/permission denied|eacces/i.test(n.stderr))return new Zc(`/dev/uinput is not writable; run adb root on an emulator or userdebug build: ${s}. No input was sent.`);return new t(`The uinput pen failed and may have played part of the stroke or hover: ${s}. Verify state with observe before retrying.`)}function VV(n,s,a={readGeometry:(c)=>Mt(n,c),runScript:(c,d,p)=>Ft(n,c,d,p)}){let c=Y(s);return async(d,p)=>{if(o(p),(d.displayId??0)!==0)throw new Zc(`display ${d.displayId} is not supported; the uinput route injects on the default display. No input was sent.`);await c.runExclusive(async()=>{o(p);let m=await a.readGeometry(p).catch((y)=>{throw p?.aborted?y:new Zc(`Could not read the display geometry for the uinput pen: ${r(y)}. No input was sent.`)}),h=Le(d,m);if(Buffer.byteLength(h,"utf8")*1.3333333333333333>Bt)throw new Zc("The stroke is too long for one uinput script; split it into shorter gestures. No input was sent.");o(p);let f=await a.runScript(h,$e(d.points)+Nt,p).catch((y)=>{throw p?.aborted?y:new t(`The uinput pen run failed and may have played part of the stroke or hover: ${r(y)}. Verify state with observe before retrying.`,{cause:y})});if(f.exitCode!==0)throw Lt(f)})}}var k={supported:!0};function C(n,s){return s?{supported:!1,reason:n,missingCapability:s}:{supported:!1,reason:n}}class _{dispatch;constructor(n){this.dispatch=n}inject(n,s){return this.dispatch(n,s)}}class ae extends _{route="adb-input-source";supports(n,s){if(s.platform!=="android"||n.toolType!=="stylus")return C("adb input stylus injects a stylus on Android only");if(n.hover||n.variablePressure||n.extendedAxes||n.path)return C("adb input stylus injects a constant-pressure tap or straight swipe; it cannot hover, vary pressure, tilt, press buttons or draw a path");if(s.apiLevel===void 0)return C("the device's Android API level could not be read");return s.apiLevel>=N?k:C(`adb input stylus needs Android API ${N} or newer (this device reports API ${s.apiLevel})`)}}function ze(n){return n.toolType==="finger"&&n.hover!==!0&&n.variablePressure!==!0&&n.extendedAxes!==!0&&n.path!==!0}function L(n){let s=[n.toolType];if(n.hover)s.push("hover");if(n.variablePressure)s.push("variable pressure");if(n.extendedAxes)s.push("tilt, orientation or buttons");if(n.path)s.push("path");return s.join(" ")}function je(n){if(n.hover)return $t(n);if((n.variablePressure||n.extendedAxes||n.path)&&n.toolType!=="stylus"&&n.toolType!=="eraser")return`${n.toolType} input has no variable pressure, tilt, buttons or stroke; only a stylus or eraser does`;if(n.toolType==="mouse")return"mouse input is supported for hover only";return}function $t(n){if(n.toolType==="finger")return"a finger does not hover; hover comes from a stylus or a mouse";if(n.variablePressure)return"hover has no contact, so it has no pressure";if(n.extendedAxes||n.path)return"tilt, orientation, buttons and strokes describe a stylus in contact; a hover carries only a position and distance";return}class ue extends _{route="ctrlproxy-a11y";supports(n,s){if(s.platform!=="android")return C("accessibility gestures are an Android route");return ze(n)?k:C(`accessibility dispatchGesture only produces a finger touch, not ${L(n)}`)}}class ce extends _{route="instrumentation";supports(n,s){if(s.platform!=="android")return C("instrumentation injection is an Android route");if(n.toolType==="finger")return C("finger touches use the accessibility route");if(n.toolType==="eraser")return C("the instrumentation runner does not inject an eraser");let a=n.hover?mP:pP;if(s.capabilities.has(a))return k;let c=s.apiLevel!==void 0&&s.apiLevel<re?`: this device runs Android API ${s.apiLevel} and the route needs Android 12 (API ${re})`:"";return C(`the connected runner does not advertise ${a}${c}`,a)}}class de extends _{route="uinput";supports(n,s){if(s.platform!=="android")return C("uinput injection is an Android route");if(n.toolType!=="stylus"&&n.toolType!=="eraser")return C("the uinput route injects a stylus or eraser only");if(s.rootShell!==!0)return C("uinput injection needs a root adb shell (run adb root on an emulator or userdebug build)");return k}}function WV(n){return[new ue(n.a11y),new ae(n.adbInputSource),new ce(n.instrumentation),new de(n.uinput)]}function r3(n,s,a){let c=je(n);if(c)return{selected:null,missingCapabilities:[],refusal:`${L(n)} is not a valid pointer request: ${c}.`};let d=[],p=new Set;for(let f of a){let y=f.supports(n,s);if(y.supported)return{selected:f};if(d.push(`${f.route}: ${y.reason}`),y.missingCapability)p.add(y.missingCapability)}let m=[...p],h=m.length>0?` Use a device whose runner advertises ${m.join(" and ")}.`:"";return{selected:null,missingCapabilities:m,refusal:`${L(n)} input cannot be injected on this device, and a finger touch is never substituted. ${d.join("; ")}.${h}`}}function Ve(n,s,a){let c=r3(n,s,a);if(c.selected===null)throw new t(c.refusal);return c.selected}function He(n){return new Set([pP,mP].filter((s)=>n(s)))}var Gt=5000,Wt=5000;function zt(n,s){return s==="eraser"||!n.has(pP)||!n.has(mP)}async function jt(n,s){try{let{stdout:a}=await n.executeCommand("shell id -u",{timeoutMs:Wt,noRetry:!0,signal:s});return a.trim()==="0"}catch(a){if(s?.aborted)throw a;return e.warn(`[pointer] could not read the adb shell uid: ${r(a)}`,a),!1}}async function zV(n,s,a,c){let d=E.getExistingInstance(n.deviceId),p=new Set;try{for(let h of[mP,pP])if(d&&await d.supportsCommand(h))p.add(h)}catch(h){if(a?.aborted)throw h;e.warn(`[pointer] could not read the runner's capabilities: ${r(h)}`,h)}return{platform:"android",apiLevel:await Ut(s,Gt,void 0,a).catch((h)=>{if(a?.aborted)throw h;return e.warn(`[pointer] could not read the Android API level: ${r(h)}`,h),null})??void 0,capabilities:He((h)=>p.has(h)),...zt(p,c)?{rootShell:await jt(s,a)}:{}}}var Vt=40;function TC(n,s,a={}){let c=s.map((p)=>{let m=p.pressure??n.pressure,h=p.tilt??n.tilt,f=p.orientation??n.orientation;return{x:p.x,y:p.y,...p.durationMs===void 0?{}:{durationMs:p.durationMs},...m===void 0?{}:{pressure:m},...h===void 0?{}:{tilt:h},...f===void 0?{}:{orientation:f}}}),d=wae(n.buttons);return{features:{toolType:n.toolType,...c.some((p)=>p.pressure!==void 0&&p.pressure!==1)?{variablePressure:!0}:{},...d!==0||c.some((p)=>p.tilt!==void 0||p.orientation!==void 0)?{extendedAxes:!0}:{},...a.path?{path:!0}:{}},points:c,buttons:d}}function Ye(n,s){return[n,{...n,durationMs:s??Vt}]}async function kC(n,s,a,c={}){let d=await(c.readEnvironment??((h)=>zV(n,s,h,a.features.toolType)))(c.signal),p=c.injectors??WV({a11y:qe,adbInputSource:qe,instrumentation:qV(s,n.deviceId),uinput:VV(s,n.deviceId)}),m=Ve(a.features,d,p);c.assertCurrent?.(),c.onDispatch?.();try{await m.inject(a,c.signal)}catch(h){if(h instanceof Zc||c.signal?.aborted)throw h;throw new vv(r(h),{cause:h})}}async function qe(){throw new t("This route cannot inject a stylus with pressure, tilt or buttons.")}class G extends t{}function pe(n,s){return n===1?s*(1-Number.EPSILON):n*s}function W(n,s,a){let c=s+pe(n,a-s);return c>=a?Math.max(s,a-Math.max(Math.abs(a),a-s)*Number.EPSILON):c}var z=["left","top","right","bottom"];function w(n){throw new t(`tapAt image ${n}. Observe again and pass metadata from the same image.`)}function le(n){return!!n&&[n.width,n.height].every((s)=>Number.isFinite(s)&&s>0)}function Xe(n){return le(n)&&Number.isInteger(n.width)&&Number.isInteger(n.height)}function me(n){return!!n&&z.every((s)=>Number.isFinite(n[s]))&&n.right>n.left&&n.bottom>n.top}function Ht(n,s){let a="crop"in n?n.crop:n.screenshot,c="crop"in n?n.rotation:n.screenshot.rotation;if(c!==void 0&&(!Number.isInteger(c)||c<0||c>3))w("rotation must be 0, 1, 2, or 3");if(a.screenshotOrientation==="display")return 0;if(a.screenshotOrientation!=="native")w("requires screenshotOrientation (display or native)");if(c===void 0)w("with native screenshotOrientation requires observe.rotation");if(s==="android"&&c!==0)w("Android requires display-aligned orientation");return c}function Ke(n,s){if(![n.x,n.y].every((a)=>Number.isFinite(a)&&a>0)||Math.abs(n.x-n.y)>xT)w("has missing or inconsistent pixelsPerNativeUnit / aspect ratio");if(s==="android"&&(n.x!==1||n.y!==1))w("Android pixels require scale 1")}function Yt(n){let{screenSize:s,clippedBounds:a,requestedBounds:c}=n;if(!me(a)||!me(c))w("requires finite nonempty crop bounds");let d={left:Math.max(0,c.left),top:Math.max(0,c.top),right:Math.min(s.width,c.right),bottom:Math.min(s.height,c.bottom)};if(z.some((p)=>a[p]!==d[p])||n.clipped!==z.some((p)=>a[p]!==c[p]))w("has inconsistent clippedBounds / requestedBounds")}function Xt(n,s){let{screenSize:a,imageSize:c,pixelsPerNativeUnit:d,rasterBounds:p}=n;if(!me(p))w("requires finite nonempty rasterBounds");let m=EW(a,s),h=ML(OL(n.clippedBounds,a,s),d,{width:m.width*d.x,height:m.height*d.y}),f=p.right-p.left,y=p.bottom-p.top,b=n.screenshotOrientation==="display"&&(s===1||s===3);return!z.some((T)=>!Number.isInteger(p[T])||Math.abs(h[T]-p[T])>0.0000001)&&c.width===(b?y:f)&&c.height===(b?f:y)}function Kt(n,s,a){let c=n.crop,d=[a];if(s==="ios"&&c.screenshotOrientation==="display"&&n.rotation!==void 0&&(n.rotation===2||(n.rotation===1||n.rotation===3)&&c.screenSize.width>c.screenSize.height))d.push(n.rotation);let p=d.filter((m)=>Xt(c,m));if(p.length===0)w("has inconsistent rasterBounds, imageSize, scale, or clippedBounds");return p}function Jt(n,s,a){let c=n.crop;if(c.unit!==(s==="android"?"pixels":"points"))w("crop unit does not match the platform");if(!Xe(c.imageSize))w("requires positive integer crop imageSize");if(!c.pixelsPerNativeUnit)w("requires pixelsPerNativeUnit");if(Ke(c.pixelsPerNativeUnit,s),c.scaleProvenance!=="raster-dimensions"&&c.scaleProvenance!=="native-scale-confirmed")w("requires scaleProvenance");return Yt(c),Kt(n,s,a)}function Qt(n,s,a){let{nativeScale:c,imageSize:d}=n.screenshot;if(c!==void 0&&(!Number.isFinite(c)||c<=0))w("requires positive finite nativeScale provenance");if(d===void 0)return;if(!Xe(d))w("requires positive integer imageSize");Ke({x:d.width/s.width,y:d.height/s.height},a)}function er(n,s){if(n.unit!=="normalized"&&n.unit!=="pixels")w("unit must be normalized or pixels");let a=n.unit==="normalized"?{width:1,height:1}:s;if(!a)w("pixels requires imageSize with the real file dimensions");let c=n.unit==="normalized";for(let[d,p]of[[n.x,a.width],[n.y,a.height]])if(!Number.isFinite(d)||d<0||(c?d>p:d>=p))w(`${n.unit} coordinates must be in [0, ${a.width}${c?"]":")"} x [0, ${a.height}${c?"]":")"}`)}function Je(n,s){return[n.x,n.y].every(Number.isFinite)&&n.x>=0&&n.y>=0&&n.x<s.width&&n.y<s.height}function tr(n,s){if(n.x===s.right)n.x=W(1,s.left,s.right);if(n.y===s.bottom)n.y=W(1,s.top,s.bottom)}function rr(n,s,a){let{crop:c}=s,{pixelsPerNativeUnit:d,rasterBounds:p,screenSize:m}=c,h=a.map((b)=>({bounds:E3({left:p.left/d.x,top:p.top/d.y,right:p.right/d.x,bottom:p.bottom/d.y},m,b),scale:b===1||b===3?{x:d.y,y:d.x}:d})),f=h[0];if(h.some((b)=>z.some((T)=>Math.abs(b.bounds[T]-f.bounds[T])>0.0000001)||b.scale.x!==f.scale.x||b.scale.y!==f.scale.y))w("crop pixel padding is ambiguous between source orientations");let y={x:(f.bounds.left*f.scale.x+n.x)/f.scale.x,y:(f.bounds.top*f.scale.y+n.y)/f.scale.y};if(!Je(y,m))w("pixels resolve outside native screen bounds");return y}function nr(n,s,a,c){let{source:d}=n;if("crop"in d&&d.crop.screenshotOrientation==="display")return rr(n,d,c);let p=EW(s,a),m="crop"in d?d.crop.pixelsPerNativeUnit:{x:d.screenshot.imageSize.width/p.width,y:d.screenshot.imageSize.height/p.height},h="crop"in d?d.crop.rasterBounds:{left:0,top:0},f=kW({x:(h.left+n.x)/m.x,y:(h.top+n.y)/m.y},s,a),y="crop"in d?d.crop.imageSize:d.screenshot.imageSize,b=E3({left:h.left/m.x,top:h.top/m.y,right:(h.left+y.width)/m.x,bottom:(h.top+y.height)/m.y},s,a);if(tr(f,b),!Je(f,s))w("pixels resolve outside native screen bounds");return f}function Qe(n,s,a){let c=n.source,d="crop"in c?c.crop:c.screenshot,{screenSize:p,imageSize:m}=d;if(!le(p)||!le(a))w("requires positive finite screenSize");if(p.width!==a.width||p.height!==a.height)w("source screenSize changed; observe again");let h=Ht(c,s),f=[];if("crop"in c)f=Jt(c,s,h);else Qt(c,EW(p,h),s);if(er(n,m),n.unit==="pixels")return nr(n,p,h,f);let y="crop"in c?c.crop.clippedBounds:{left:0,top:0,right:p.width,bottom:p.height},b=kW(n,{width:1,height:1},h);return{x:W(b.x,y.left,y.right),y:W(b.y,y.top,y.bottom)}}function ir(n){let{durationMs:s}=n,a=n.action??"tap";if(a!=="tap"&&a!=="longPress"&&a!=="doubleTap")return"tapAt action is unsupported";if(s!==void 0&&(a!=="longPress"||!Number.isInteger(s)||s<Na||s>eg))return`tapAt durationMs requires longPress and must be ${Na}\u2013${eg} ms`;return}function I(n){return n.image??{x:n.x,y:n.y}}function et(n,s){let a=I(n);return s==="android"&&!n.image?{x:Math.round(a.x),y:Math.round(a.y)}:a}function or(n,s){return n.x!==void 0||n.y!==void 0||n.coordinateSpace!==void 0?`${s} image is mutually exclusive with x, y, and coordinateSpace`:void 0}function ar(n,s){if(n.image!==void 0)return or(n,s);let{x:a,y:c}=n,d=n.coordinateSpace??"absolute";if(d!=="absolute"&&d!=="normalized"&&d!=="percent")return`${s} coordinateSpace is unsupported`;if(!Number.isFinite(a)||!Number.isFinite(c))return`${s} requires finite x and y coordinates`;let p=d==="normalized"?1:d==="percent"?100:void 0;if(p!==void 0&&!ur(a,c,p))return`${s} ${d} coordinates must be between 0 and ${p}`;return}function ur(n,s,a){return n>=0&&n<=a&&s>=0&&s<=a}function Ze(n,s,a){let c=a==="normalized"?1:a==="percent"?100:void 0;if(c===void 0)return n;return pe(n/c,s)}function cr(n){if(!n)return!1;return Number.isFinite(n.width)&&Number.isFinite(n.height)&&n.width>0&&n.height>0}function dr(n,s){return n.x<0||n.x>=s.width||n.y<0||n.y>=s.height}function pr(n,s){let a=n.image?.source;return a&&"crop"in a?{width:a.crop.rasterBounds.right,height:a.crop.rasterBounds.bottom}:s}function lr(n,s,a){if(!n||!("screenshot"in n.source))return n;let c=n.source.screenshot;if(c.screenSize.width!==s.screenSize.width||c.screenSize.height!==s.screenSize.height)return n;return{...n,source:{screenshot:{...c,screenSize:a}}}}function mr(n,s,a,c){if(a==="android"&&c==="tapAt")ute(s,n.androidXr===!0);let d=a==="android"&&c==="tapAt"&&n.pointSpace!=="native"?nW(s.backStack,n.androidXr??!1):void 0,p=d?c3(s):s.screenSize,m=d?lr(n.image,s,p):n.image,h=d&&m&&"crop"in m.source?s.screenSize:p;return{xr:d,screenSize:p,image:m,imageScreenSize:h}}function Qc(n,s,a,c="tapAt"){let{x:d,y:p}=I(n),m=ar(n,c);if(m)return{x:d,y:p,error:m};let h=n.coordinateSpace??"absolute",{xr:f,screenSize:y,image:b,imageScreenSize:T}=mr(n,s,a,c);if(!cr(y))return{x:d,y:p,error:`${c} requires a positive screenSize from a fresh observation`};let g=b?Qe(b,a==="ios"?"ios":"android",T):{x:Ze(d,y.width,h),y:Ze(p,y.height,h)},{x:v,y:R}=g;if(dr({x:v,y:R},y))return{x:d,y:p,error:`${c} coordinates (${d}, ${p}) are outside screen bounds [0, ${y.width}) x [0, ${y.height})`};let S=pr(n,y),D=a==="android"?Math.min(Math.round(v),Math.ceil(S.width)-1):v,A=a==="android"?Math.min(Math.round(R),Math.ceil(S.height)-1):R;if(f){let j=xC(s,!0),K=mte({x:D,y:A},f.panel,y);return{...K,screenshotPoint:{x:D,y:A},xrPanel:{packageName:f.panel.packageName,taskId:f.panel.id,displayX:K.x,displayY:K.y},warning:j}}return{x:D,y:A}}function hr(n,s,a){let c=n.action??"tap",d=c==="longPress"?"long press":c==="doubleTap"?"double tap":"tap";return Ip(s.viewHierarchy,n.layer,[a],d)}function he(n,s,a){yr(n,s,a);let c=ir(n);if(c)return{x:I(n).x,y:I(n).y,error:c};let d=Qc(n,s,a);if("error"in d)return d;let p=hr(n,s,d);if(p)return{...d,error:p};if(n.planContext)vr(n.planContext,s,d.screenshotPoint??d,a);return d}function yr(n,s,a){let c=n.planContext?.geometry;if(!c)return;let d=s.rotation??s.viewHierarchy?.rotation,m=[["platform",c.platform===a],["dimensions",c.deviceWidth===s.screenSize.width&&c.deviceHeight===s.screenSize.height],["orientation",Number.isInteger(d)&&c.orientation===d],["point",br(n,c,a)]].find(([,h])=>!h)?.[0];if(m)throw new G(`tapAt replay ${m} mismatch: recorded ${JSON.stringify(c)}, current ${a} ${s.screenSize?.width}x${s.screenSize?.height} orientation ${d}. Replay on compatible geometry or record this step again.`)}function br(n,s,a){if(n.image||(n.coordinateSpace??"absolute")!=="absolute")return!1;if(n.x!==s.x||n.y!==s.y)return!1;return a!=="android"||Number.isInteger(s.x)&&Number.isInteger(s.y)}function vr(n,s,a,c){let d=s.rotation??s.viewHierarchy?.rotation;if((c==="android"||c==="ios")&&Number.isInteger(d)&&d!==void 0&&d>=0&&d<=3)n.recordedGeometry={platform:c,deviceWidth:s.screenSize.width,deviceHeight:s.screenSize.height,orientation:d,x:a.x,y:a.y}}function Tr(n,s,a){let c=n.talkBackDriverFactory??a;return{featureFlags:n.featureFlags??sr.getInstance(),accessibilityDetector:n.accessibilityDetector??ni,talkBackDriverFactory:c,talkBackStrategy:n.talkBackStrategy??new Iv({timer:s,driverFactory:c}),useContextualFocusTap:n.talkBackDriverFactory===void 0}}var tt=1000;function gr(n,{detector:s,stateClient:a,featureFlags:c,timer:d}){return()=>{let p=new AbortController;return l(()=>s.isVoiceOverEnabled(n.deviceId,a(),{featureFlags:c,timeoutMs:tt,signal:p.signal}),{timer:d,timeoutMs:tt,label:"tapAt VoiceOver probe",onTimeout:()=>p.abort()})}}class EC extends Oe{androidClient;iosDoubleTap;iosClient;iosCoordinateTap;invalidateIosCache;isIosVoiceOverOn;lastRenderedObservation;stylusRoutes;snapshotReferences;androidTalkBack;androidDispatcher;xrDetector;androidXr;constructor(n,s=null,a={}){super(n,{adb:s,timer:a.timer,displayFence:a});cs(n.platform,"tapAt"),this.androidClient=a.androidClient??Ws(n,this.adbFactory);let c=()=>x.getInstance(n);this.iosClient=a.iosClient??c(),this.iosDoubleTap=a.dispatchIosDoubleTap??Iw,this.iosCoordinateTap=a.dispatchIosCoordinateTap??Ew,this.invalidateIosCache=a.invalidateIosCache??(()=>x.getExistingInstance(this.device.deviceId)?.invalidateCache()),this.lastRenderedObservation=a.lastRenderedObservation,this.stylusRoutes=a.stylus??{},this.snapshotReferences=a.snapshotReferences??ip,this.xrDetector=a.xrDetector;let d=Tr(a,this.timer,new qh(this.adbFactory));this.isIosVoiceOverOn=gr(n,{detector:a.iosVoiceOverDetector??Ao,stateClient:()=>a.iosVoiceOverStateClient??c(),featureFlags:d.featureFlags,timer:this.timer}),this.androidTalkBack=new Q({target:this,androidClient:this.androidClient,...d});let p=this;this.androidDispatcher=new Z({host:{get adb(){return p.adb},get observeScreen(){return p.observeScreen},assertDisplayRevisionCurrent:(m)=>this.assertDisplayRevisionCurrent(m),assertSnapshotCurrent:(m,h)=>this.assertSnapshotCurrent(m,h),resolveFreshFrameRetry:(m,h,f,y)=>this.resolveFreshFrameRetry(m,h,f,y),retryFreshness:(m)=>this.retryFreshness(m)},androidClient:this.androidClient,androidCoordinateTap:a.dispatchAndroidCoordinateTap??kw,androidTalkBack:this.androidTalkBack,timer:this.timer})}async executeOnDisplay(n,s,a){let{onTapDelivered:c,signal:d,onDispatchCompleted:p,onActivationWarnings:m}=a,h=n.action??"tap",{observation:f,displayId:y,followUpDisplay:b,assertCurrent:T}=await Wi(this.device,s,this.observeScreen,{adb:this.adb,lastRenderedObservation:this.lastRenderedObservation,signal:d,transitions:this.displayTransitionReader}),g=this.staleSnapshotReason(n,f);if(g)return{success:!1,x:I(n).x,y:I(n).y,action:h,error:g};let v=await this.resolveWithXr(n,f,d);if("error"in v)return{success:!1,x:v.x,y:v.y,action:h,error:v.error};return this.observedInteraction(async()=>{if(T(),this.device.platform==="android"&&await this.androidTalkBack.resolveState(d,m)){let S=rg(y);if(S)throw S;await this.dispatchDisplayTalkBackTapWithOneFreshRetry(n,v,f,{signal:d,assertCurrent:T,followUpDisplay:b,onTapDelivered:()=>c(!0),onActivationWarnings:m})}else await this.dispatchGesture(n,v,f,{signal:d,displayId:y,assertCurrent:T,onTapDelivered:c,onWarning:(S)=>m?.([S])});return p?.(),{success:!0,x:v.x,y:v.y,action:h,...v.xrPanel?{xrPanel:v.xrPanel}:{},...v.warning?{warning:v.warning}:{}}},{changeExpected:!1,display:b,previousObservation:f,signal:d})}async execute(n,s,a,c){cs(this.device.platform,"tapAt");let{progress:d,signal:p,planContext:m}=Yte(s,a,c),h=Ce(this.device.platform,n);if(h)return Ie(h,I(n),n.action);return this.executeTap(n,d,p,m)}async dispatchStylusTapAt(n,s,a,c){let d={signal:c,assertCurrent:()=>this.assertDisplayRevisionCurrent(a)};if(!vE(n.pointer)){await _e(this.adb,s,n,d);return}let p=n.action==="longPress"?n.durationMs??NT:void 0;try{await kC(this.device,this.adb,TC(n.pointer,Ye(s,p)),{...d,...this.stylusRoutes})}catch(m){throw m instanceof vv?Sn(m.message):m}}async executeTap(n,s,a,c){n={...n,planContext:c};let d=n.action??"tap",p=J();p.serial("tapAt");let m,h,f={tapsDelivered:0,talkBack:!1,displayCompleted:!1},y=new Set,b=rte(y),T=(v=!1)=>{f.talkBack||=v,f.tapsDelivered++},g=this.captureTransitionRevision();try{if(o(a),n.display!==void 0)return{...await this.executeOnDisplay(n,n.display,{onTapDelivered:T,signal:a,onDispatchCompleted:()=>{f.displayCompleted=!0},onActivationWarnings:b}),...y.size?{warnings:[...y]}:{}};if(this.hasStaleCallerRevision(this.displayTransitionReader.revision(this.device.deviceId)))return Zt({success:!1,x:I(n).x,y:I(n).y,action:d},this.staleDisplay(g.observedGeneration));let v=null,R=await this.observedInteraction(async()=>{let S=await this.observeScreen.execute({freshness:"cached-ok",signal:a,perf:p});if(v=S,this.currentActionRevision()!==g.revision)return Zt({success:!1,x:I(n).x,y:I(n).y,action:d},this.staleDisplay(g.observedGeneration));let D=this.staleSnapshotReason(n,S);if(D)return{success:!1,x:I(n).x,y:I(n).y,action:d,error:D};let A=await this.resolveWithXr(n,S,a);if("error"in A)return{success:!1,x:A.x,y:A.y,action:d,error:A.error};switch(m=A,this.assertDisplayRevisionCurrent(g),o(a),this.device.platform){case"android":{if(n.pointer){await this.dispatchStylusTapAt(n,A,g,a),T();break}let j=await this.androidTalkBack.resolveState(a,b);f.talkBack=j,await this.androidDispatcher.dispatchAndroidTaps(n,A,S,{transitionRevision:g,perf:p,signal:a,onTapDelivered:T,talkBackEnabled:j,onActivationWarnings:b});break}case"ios":h=await this.dispatchIosTapsWithOneFreshRetry(n,A,S,{transitionRevision:g,onTapDelivered:T,signal:a});break;default:throw St(this.device.platform,"tap at coordinates")}return{success:!0,x:A.x,y:A.y,action:d,...A.xrPanel?{xrPanel:A.xrPanel}:{},...A.warning?{warning:A.warning}:{}}},{changeExpected:!1,progress:s,perf:p,signal:a,skipPreviousObserve:!0,observationTimestampProvider:()=>h,predictionContext:{toolName:"tapAt",toolArgs:{...n,action:d,platform:this.device.platform}}});return this.annotateDeviceLock(R,v),{...R,...y.size?{warnings:[...y]}:{}}}catch(v){if(v instanceof G)throw v;return this.rethrowObservationAbort(v,a,f.displayCompleted),this.createDispatchFailure(v,n,m,f)}finally{p.end()}}captureTransitionRevision(){return{revision:this.currentActionRevision(),observedGeneration:this.renderedDisplayGeneration(this.device.deviceId)??this.displayTransitionReader.identityRevision(this.device.deviceId)}}createDispatchFailure(n,s,a,c){let d=s.action??"tap",{tapsDelivered:p,talkBack:m}=c;e.warn(`tapAt dispatch failed: ${r(n)}`,n);let h=a??et(s,this.device.platform),f=Zt({success:!1,x:h.x,y:h.y,error:`Failed to tap at coordinates: ${r(n)}`,action:d},n);if(m&&d!=="longPress"){if(n instanceof fr&&p===3)f.error+=" A TalkBack focus touch and an activation double tap were delivered."}else f.error+=n instanceof fr?` ${p} ${p===1?"tap was":"taps were"} delivered.`:nte(d,p);return f}async dispatchIosTapsWithOneFreshRetry(n,s,a,c){let{transitionRevision:d,signal:p}=c,m=a.viewHierarchy?.frameContext;try{return await this.dispatchIosTaps(n,s,m,c)}catch(h){o(p);let f=u(h,"Failed to dispatch iOS coordinate tap");if(m===void 0||!Fa(f.message))throw f;let y=await this.observeScreen.execute({freshness:"fresh",signal:p});this.assertDisplayRevisionCurrent(d),this.assertSnapshotCurrent(n,y);let b=this.resolveFreshFrameRetry(n,s,a,y);if(!b||!il(a,y,!0))throw f;return await this.dispatchIosTaps(n,b.point,b.frameContext,c)}}async dispatchIosTaps(n,s,a,c){let{transitionRevision:d,onTapDelivered:p,signal:m}=c;this.assertDisplayRevisionCurrent(d),await this.dispatchIosCoordinateTap(n.action,s,{durationMs:Tw(n,"ios"),frameContext:a,signal:m});try{if(p(),n.action==="doubleTap")p();return o(m),this.timer.now()}finally{this.invalidateIosCacheSafely()}}async dispatchIosCoordinateTap(n,s,a){let{durationMs:c,frameContext:d,signal:p}=a,m=n==="doubleTap"?this.iosDoubleTap:this.iosCoordinateTap;await ote(()=>m(this.iosClient,s,{durationMs:c,frameContext:d,options:{signal:p}}),this.isIosVoiceOverOn)}invalidateIosCacheSafely(){try{this.invalidateIosCache()}catch(n){e.warn(`tapAt iOS cache invalidation failed: ${r(n)}`,n)}}async dispatchDisplayTalkBackTapWithOneFreshRetry(n,s,a,c){let{signal:d,assertCurrent:p}=c,m=a.viewHierarchy?.frameContext,h=!1,f=!1,y={assertCurrent:p,onTapDelivered:()=>{h=!0,c.onTapDelivered()},onDispatched:()=>{f=!0},onActivationWarnings:c.onActivationWarnings};try{await this.androidTalkBack.dispatchTap(n,s,m,{signal:d,context:y})}catch(b){o(d);let T=u(b,"Failed to dispatch Android coordinate tap");if(h||f||m===void 0||!Fa(T.message))throw T;let g=await this.observeScreen.execute({display:c.followUpDisplay,freshness:this.retryFreshness(n),signal:d});p(),this.assertSnapshotCurrent(n,g);let v=this.resolveFreshFrameRetry(n,s,a,g);if(g.display.key!==a.display.key||!v)throw T;await this.androidTalkBack.dispatchTap(n,v.point,v.frameContext,{signal:d,context:y})}}async resolveWithXr(n,s,a){if(this.device.platform==="android")this.androidXr=await ra({device:this.device,adb:this.adb,backStack:s.backStack,signal:a},this.xrDetector);return he({...n,androidXr:this.androidXr},s,this.device.platform)}resolveFreshFrameRetry(n,s,a,c){let d=he({...n,androidXr:this.androidXr},c,this.device.platform),p=c.viewHierarchy?.frameContext;if("error"in d||d.x!==s.x||d.y!==s.y||!p||this.device.platform!=="ios"&&p===a.viewHierarchy?.frameContext)return;if(!n.snapshotId&&!xe(a,c))throw new t("Stale frame context: screen layout changed since the last observation. Observe again and recompute coordinates, or pass a fresh snapshotId.");return{point:d,frameContext:p}}assertDisplayRevisionCurrent(n){if(this.currentActionRevision()!==n.revision)throw this.staleDisplay(n.observedGeneration)}currentActionRevision(){return this.device.platform==="ios"?this.displayTransitionReader.identityRevision(this.device.deviceId):this.displayTransitionReader.revision(this.device.deviceId)}staleSnapshotReason(n,s){return n.snapshotId?this.snapshotReferences.staleReason(n.snapshotId,this.device.deviceId,s):void 0}assertSnapshotCurrent(n,s){let a=this.staleSnapshotReason(n,s);if(a)throw new t(a)}retryFreshness(n){return n.snapshotId?"fresh":"cached-ok"}hasStaleCallerRevision(n){let s=this.renderedDisplayRevision(this.device.deviceId);if(s===void 0)return!1;return this.device.platform==="ios"?!this.displayTransitionReader.sameIdentitySince(this.device.deviceId,s):s!==n}async dispatchAndroidDisplayGesture(n,s,a,c){let{displayId:d,signal:p}=c;if(await Ma(this.androidClient,d)){o(p),c.assertCurrent();let m=!1,h=()=>{m=!0},f=await this.androidClient.requestTapCoordinates({x:n.x,y:n.y,duration:s,timeoutMs:Ab(s),onDispatch:h,signal:p,displayId:d===0?void 0:d,beforeSend:c.assertCurrent});if(f.success)c.onTapDelivered();if(o(p),f.success)return;if(m)throw Sn(f.error);if(Fa(f.error))throw new t(f.error??"Stale frame context");e.warn(`[TapAtCoordinate] dispatchGesture tap failed (${f.error}), falling back to ADB input`)}o(p),c.assertCurrent(),await wc(this.adb,a,d,{signal:p,assertCurrent:c.assertCurrent,timeoutMs:s>=Na?Hr(s):void 0}),c.onTapDelivered(),o(p)}async dispatchGesture(n,s,a,c){let{signal:d,displayId:p}=c,m=n.action??"tap",h=Tw(n,this.device.platform),f=async()=>{if(o(d),c.assertCurrent(),this.device.platform==="android"){let y=m==="longPress"?`swipe ${s.x} ${s.y} ${s.x} ${s.y} ${h}`:`tap ${s.x} ${s.y}`;await this.dispatchAndroidDisplayGesture(s,h,y,c)}else if(this.device.platform==="ios"){if(await this.dispatchIosCoordinateTap(m,s,{durationMs:h,frameContext:a.viewHierarchy?.frameContext,signal:d}),c.onTapDelivered(),m==="doubleTap")c.onTapDelivered()}else throw St(this.device.platform,"tapAt gesture")};if(this.device.platform==="android"&&m==="doubleTap"){await tg({client:await Ma(this.androidClient,p)?this.androidClient:void 0,point:s,displayId:p===0?void 0:p,timer:this.timer,signal:d,assertCurrent:c.assertCurrent,onTapDelivered:c.onTapDelivered,onWarning:c.onWarning,tap:()=>f()});return}if(await f(),this.device.platform==="ios"){try{o(d)}finally{this.invalidateIosCacheSafely()}return}}}
|
|
7
|
+
export{ip,Q5,vv,tte,e3,Zc,qV,t3,VV,WV,r3,zV,TC,kC,Qc,EC};
|
|
8
|
+
|
|
9
|
+
//# debugId=1A3720A0C6D91EE164756E2164756E21
|