remote-webview-debugger 0.2.0 → 0.2.1
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/CHANGELOG.md +13 -0
- package/CHANGELOG.zh-CN.md +13 -0
- package/README.ar.md +5 -5
- package/README.de.md +5 -5
- package/README.es.md +5 -5
- package/README.fr.md +5 -5
- package/README.ja.md +5 -5
- package/README.ko.md +5 -5
- package/README.md +4 -4
- package/README.pt-BR.md +5 -5
- package/README.ru.md +5 -5
- package/README.zh-CN.md +5 -5
- package/README.zh-TW.md +5 -5
- package/dist/index.mjs +293 -284
- package/dist/index.mjs.map +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/ar.mjs +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/de.mjs +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/es.mjs +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/fr.mjs +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ja.mjs +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/ko.mjs +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/pt.mjs +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/ru.mjs +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-TW.mjs +1 -1
- package/dist/sdk.js +2 -2
- package/dist/sdk.js.map +1 -1
- package/package.json +1 -1
package/dist/sdk.js
CHANGED
|
@@ -35,8 +35,8 @@ var RemoteWebviewDebugger=(function(e){if(typeof window<`u`&&window.RemoteWebvie
|
|
|
35
35
|
`?document.execCommand(`insertLineBreak`)||document.execCommand(`insertText`,!1,`
|
|
36
36
|
`):document.execCommand(`insertText`,!1,e))}function Ul(e,t){let n=Al(),r=jl(n),i=!!(t&3),a=!!(t&El),o=!!(t&Dl);if(e===`a`||e===`A`)return t&6?(r?Fl(r,0,r.value.length):document.execCommand(`selectAll`),!0):!1;if(!r)return!(n instanceof HTMLElement)||!n.isContentEditable?!1:Wl(e,i,a,o);let s=r.value,[c,l]=Pl(r),u=r.selectionDirection===`backward`,d=u?c:l,f=u?l:c,p=r instanceof HTMLTextAreaElement,m=e=>{o?Fl(r,Math.min(f,e),Math.max(f,e),e<f):Fl(r,e,e)};switch(e){case`Backspace`:case`Delete`:{let t=e===`Backspace`;if(c!==l)return Il(r,c,l,``,t?`deleteContentBackward`:`deleteContentForward`),!0;let n=c,o=c;return t?a?n=zl(s,c):i?n=Rl(s,c,!0):c>0&&(n=c-Ll(s,c,!0)):a?o=Bl(s,c):i?o=Rl(s,c,!1):c<s.length&&(o=c+Ll(s,c,!1)),n!==o&&Il(r,n,o,``,t?i?`deleteWordBackward`:a?`deleteSoftLineBackward`:`deleteContentBackward`:i?`deleteWordForward`:a?`deleteSoftLineForward`:`deleteContentForward`),!0}case`ArrowLeft`:case`ArrowRight`:{let t=e===`ArrowLeft`;if(!o&&c!==l)return Fl(r,t?c:l,t?c:l),!0;let n;return n=a?t?zl(s,d):Bl(s,d):i?Rl(s,d,t):t?d>0?d-Ll(s,d,!0):0:d<s.length?d+Ll(s,d,!1):s.length,m(n),!0}case`ArrowUp`:case`ArrowDown`:{let t=e===`ArrowUp`;return m(!p||a?t?0:s.length:Vl(s,d,t)),!0}case`Home`:case`End`:{let n=e===`Home`;return!p||t&Tl?m(n?0:s.length):m(n?zl(s,d):Bl(s,d)),!0}default:return!1}}function Wl(e,t,n,r){let i=document.getSelection(),a=n?`lineboundary`:t?`word`:`character`;switch(e){case`Backspace`:case`Delete`:{let t=e===`Backspace`;return i&&i.isCollapsed&&a!==`character`&&i.modify&&i.modify(`extend`,t?`backward`:`forward`,a),document.execCommand(t?`delete`:`forwardDelete`),!0}case`ArrowLeft`:case`ArrowRight`:case`ArrowUp`:case`ArrowDown`:case`Home`:case`End`:{if(!i||!i.modify)return!0;let t=e===`ArrowLeft`||e===`ArrowUp`||e===`Home`,n=e===`Home`||e===`End`?`lineboundary`:e===`ArrowUp`||e===`ArrowDown`?`line`:a;return i.modify(r?`extend`:`move`,t?`backward`:`forward`,n),!0}default:return!1}}var Gl={Backspace:[8,`Backspace`],Tab:[9,`Tab`,`Tab`,` `],Enter:[13,`Enter`,`Enter`,`\r`],Shift:[16,`ShiftLeft`],Control:[17,`ControlLeft`],Alt:[18,`AltLeft`],Meta:[91,`MetaLeft`],CapsLock:[20,`CapsLock`],Escape:[27,`Escape`],Space:[32,`Space`,` `,` `],PageUp:[33,`PageUp`],PageDown:[34,`PageDown`],End:[35,`End`],Home:[36,`Home`],ArrowLeft:[37,`ArrowLeft`],ArrowUp:[38,`ArrowUp`],ArrowRight:[39,`ArrowRight`],ArrowDown:[40,`ArrowDown`],Insert:[45,`Insert`],Delete:[46,`Delete`]};for(let e=1;e<=12;e++)Gl[`F`+e]=[111+e,`F`+e];var Kl={};for(let[e,t,n,r]of[["`",`~`,192,`Backquote`],[`-`,`_`,189,`Minus`],[`=`,`+`,187,`Equal`],[`[`,`{`,219,`BracketLeft`],[`]`,`}`,221,`BracketRight`],[`\\`,`|`,220,`Backslash`],[`;`,`:`,186,`Semicolon`],[`'`,`"`,222,`Quote`],[`,`,`<`,188,`Comma`],[`.`,`>`,190,`Period`],[`/`,`?`,191,`Slash`]])Kl[e]=[n,r,!1],Kl[t]=[n,r,!0];var ql=`)!@#$%^&*(`,Jl={Alt:1,Control:2,Meta:4,Shift:8},Yl=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);function Xl(e,t){let n=Gl[e];if(n){let[t,r,i,a]=n;return{key:i||e,code:r,keyCode:t,text:a||``}}if(/^Key[A-Z]$/.test(e)&&(e=t?e[3]:e[3].toLowerCase()),/^Digit[0-9]$/.test(e)&&(e=e[5]),e.length!==1)return null;if(/[a-zA-Z]/.test(e)){let n=e.toUpperCase(),r=t?n:e;return{key:r,code:`Key`+n,keyCode:n.charCodeAt(0),text:r}}if(/[0-9]/.test(e)){let n=t?ql[+e]:e;return{key:n,code:`Digit`+e,keyCode:e.charCodeAt(0),text:n}}let r=ql.indexOf(e);if(r>=0)return{key:e,code:`Digit`+r,keyCode:48+r,text:e};let i=Kl[e];return i?{key:e,code:i[1],keyCode:i[0],text:e}:e===` `?Xl(`Space`,t):null}function Zl(){let e=Rc();return e instanceof HTMLElement?e:document.body}function Ql(e,t,n,r){let i=new KeyboardEvent(e,{key:t.key,code:t.code,location:t.location||0,bubbles:!0,cancelable:!0,composed:!0,view:window,altKey:!!(n&1),ctrlKey:!!(n&2),metaKey:!!(n&4),shiftKey:!!(n&8)}),a=e===`keypress`?t.text.charCodeAt(0):t.keyCode;for(let t of[`keyCode`,`which`,`charCode`]){let n=t===`charCode`?e===`keypress`?a:0:a;Object.defineProperty(i,t,{configurable:!0,get:()=>n})}return r.dispatchEvent(i)}function $l(e,t){let n=Zl(),r=!!e.text&&!(t&7);e.key===`Enter`&&!(t&7)?(Ql(`keydown`,e,t,n)&&Ql(`keypress`,e,t,n)&&eu(n),Ql(`keyup`,e,t,Zl())):r&&e.key!==`Tab`?(Ql(`keydown`,e,t,n)&&Ql(`keypress`,e,t,n)&&Hl(e.text),Ql(`keyup`,e,t,Zl())):(Ql(`keydown`,e,t,n)&&(e.key===`Tab`&&!(t&7)?tu(!!(t&8)):Ul(e.key,t)),Ql(`keyup`,e,t,Zl()))}function eu(e){if(e instanceof HTMLTextAreaElement||e.isContentEditable)Hl(`
|
|
37
37
|
`);else if(e instanceof HTMLInputElement&&e.form){let t=e.form,n=t.querySelector(`button:not([type]), button[type=submit], input[type=submit], input[type=image]`);n?n.disabled||n.click():typeof t.requestSubmit==`function`?t.requestSubmit():t.dispatchEvent(new Event(`submit`,{bubbles:!0,cancelable:!0}))&&t.submit()}else(e instanceof HTMLAnchorElement||e instanceof HTMLButtonElement)&&e.click()}function tu(e){let t=Array.prototype.filter.call(document.querySelectorAll(`a[href], button, input, select, textarea, [tabindex], [contenteditable]`),e=>e.tabIndex>=0&&!e.disabled&&e.getClientRects().length>0);if(!t.length)return;let n=t.indexOf(Zl());(e?t[(n<=0?t.length:n)-1]:t[(n+1)%t.length]).focus()}function nu(e){if(typeof e!=`string`||!e)throw M(`bad_request`,N().missingParam(`key`));let t=e===`+`?[`+`]:e.split(`+`);t[t.length-1]===``&&t.length>1&&t.splice(t.length-2,2,`+`);let n=t.pop(),r=t.map(e=>e===`ControlOrMeta`?Yl?`Meta`:`Control`:e),i=0;for(let e of r)if(!(e in Jl))throw M(`bad_request`,N().unknownModifier(e));let a=Xl(n,r.indexOf(`Shift`)>=0);if(!a)throw M(`bad_request`,N().unknownKey(n));for(let e of r)i|=Jl[e],Ql(`keydown`,Xl(e,!1),i,Zl());$l(a,i);for(let e=r.length-1;e>=0;e--)i&=~Jl[r[e]],Ql(`keyup`,Xl(r[e],!1),i,Zl())}function ru(e){let t=Array.from(e);for(let e of t){if(e===`
|
|
38
|
-
`||e===`\r`){$l(Xl(`Enter`,!1),0);continue}let t=/[A-Z~!@#$%^&*()_+{}|:"<>?]/.test(e),n=e.length===1&&e!==` `?Xl(e,t):null;n?$l(n,t?8:0):Hl(e)}}var iu=[0,20,50,100,100,250,500];async function au(e,t={}){let n=Date.now()+(t.timeoutMs||5e3),r=``;for(let i=0;;i++){if(i){if(Date.now()>=n)break;await zc(iu[Math.min(i,iu.length-1)])}if(!e.isConnected)throw M(`not_found`,N().elementDetached(q(e)));if(r=Nc(()=>su(e)),r)continue;cu(e.getBoundingClientRect())||e.scrollIntoView({block:`center`,inline:`center`,behavior:`instant`});let a=e.getBoundingClientRect();if(await Bc(),!e.isConnected)continue;let o=e.getBoundingClientRect();if(!lu(a,o)){r=N().reasonMoving;continue}let s=du(o);if(!s.length){r=N().reasonOffscreen;continue}if(t.hitTest===!1)return s[0];let c=s.find(t=>fu(e,Jn(t.x,t.y)));if(c)return c;{let e=Jn(s[0].x,s[0].y);r=N().reasonObscured(q(e),el(e))}}throw M(`not_interactable`,N().notActionable(q(e),r))}function ou(e,t){let n=Jn(t.x,t.y);for(;n&&n.shadowRoot;){let e=n.shadowRoot.elementFromPoint(t.x,t.y);if(!e||e===n)break;n=e}return n&&fu(e,n)?n:e}function su(e){if(!qa(e).visible)return N().reasonHidden;gc();try{if(qs(e))return N().reasonDisabled}finally{_c()}return``}function cu(e){let t=e.left+e.width/2,n=e.top+e.height/2;return t>=0&&n>=0&&t<window.innerWidth&&n<window.innerHeight}function lu(e,t){return Math.abs(e.left-t.left)<1&&Math.abs(e.top-t.top)<1&&Math.abs(e.width-t.width)<1&&Math.abs(e.height-t.height)<1}var uu=[.5,.15,.85];function du(e){let t=Math.max(e.left,0),n=Math.min(e.right,window.innerWidth),r=Math.max(e.top,0),i=Math.min(e.bottom,window.innerHeight);if(n<=t||i<=r)return[];let a=[];for(let e of uu)for(let o of uu)a.push({x:t+(n-t)*o,y:r+(i-r)*e});return a}function fu(e,t){if(Lc(e,t))return!0;let n=tr(t,`label`);return!!(n&&n.control===e||e instanceof HTMLLabelElement&&e.control&&Lc(e.control,t))}var pu=navigator.maxTouchPoints>0||`ontouchstart`in window,mu={left:0,middle:1,right:2},hu=[1,4,2],gu=null;function _u(e,t,n={}){return P({bubbles:!0,cancelable:!0,composed:!0,view:window,clientX:e,clientY:t,screenX:e,screenY:t},n)}function J(e,t,n,r,i={}){if(typeof PointerEvent>`u`)return!0;let a=e===`pointerenter`||e===`pointerleave`;return t.dispatchEvent(new PointerEvent(e,P(P({},_u(n,r,i)),{},{bubbles:!a,cancelable:!a,pointerId:pu?2:1,pointerType:pu?`touch`:`mouse`,isPrimary:!0,width:1,height:1,pressure:i.buttons?.5:0})))}function Y(e,t,n,r,i={}){let a=e===`mouseenter`||e===`mouseleave`;return t.dispatchEvent(new MouseEvent(e,P(P({},_u(n,r,i)),{},{bubbles:!a,cancelable:!a})))}var vu=1;function yu(e,t,n,r){try{let i=new Touch({identifier:vu,target:t,clientX:n,clientY:r,pageX:n+window.scrollX,pageY:r+window.scrollY,screenX:n,screenY:r,radiusX:1,radiusY:1,rotationAngle:0,force:1}),a=e===`touchend`||e===`touchcancel`?[]:[i];return t.dispatchEvent(new TouchEvent(e,{bubbles:!0,cancelable:!0,composed:!0,view:window,touches:a,targetTouches:a,changedTouches:[i]}))}catch(e){return!0}}function bu(e,t){if(gu!==e){let n=gu;n&&n.isConnected&&(J(`pointerout`,n,t.x,t.y,{relatedTarget:e}),J(`pointerleave`,n,t.x,t.y,{relatedTarget:e}),Y(`mouseout`,n,t.x,t.y,{relatedTarget:e}),Y(`mouseleave`,n,t.x,t.y,{relatedTarget:e})),J(`pointerover`,e,t.x,t.y,{relatedTarget:n}),J(`pointerenter`,e,t.x,t.y,{relatedTarget:n}),Y(`mouseover`,e,t.x,t.y,{relatedTarget:n}),Y(`mouseenter`,e,t.x,t.y,{relatedTarget:n}),gu=e}J(`pointermove`,e,t.x,t.y),Y(`mousemove`,e,t.x,t.y)}var xu=`a[href], area[href], button, input, select, textarea, iframe, summary, [tabindex], [contenteditable]:not([contenteditable=false])`;function Su(e){let t=tr(e,xu),n=Rc();t?n!==t&&t.focus({preventScroll:!0}):n&&n!==document.body&&typeof n.blur==`function`&&n.blur()}function Cu(e,t,{button:n=`left`,clickCount:r=1}={}){let i=mu[n]===void 0?0:mu[n],a={button:i,buttons:hu[i]},o={button:i,buttons:0},s=Math.max(1,Math.min(3,r|0||1));if(pu&&i===0)for(let n=1;n<=s;n++){vu++,J(`pointerover`,e,t.x,t.y),J(`pointerenter`,e,t.x,t.y),J(`pointerdown`,e,t.x,t.y,a);let r=yu(`touchstart`,e,t.x,t.y);J(`pointerup`,e,t.x,t.y,o);let i=yu(`touchend`,e,t.x,t.y);J(`pointerout`,e,t.x,t.y),J(`pointerleave`,e,t.x,t.y),r&&i&&(gu!==e&&(Y(`mouseover`,e,t.x,t.y),gu=e),Y(`mousemove`,e,t.x,t.y),Y(`mousedown`,e,t.x,t.y,P(P({},a),{},{detail:n}))&&Su(e),Y(`mouseup`,e,t.x,t.y,P(P({},o),{},{detail:n})),Y(`click`,e,t.x,t.y,P(P({},o),{},{detail:n})))}else{bu(e,t);for(let n=1;n<=s;n++){let r=J(`pointerdown`,e,t.x,t.y,a);r&&Y(`mousedown`,e,t.x,t.y,P(P({},a),{},{detail:n}))&&Su(e),J(`pointerup`,e,t.x,t.y,o),r&&Y(`mouseup`,e,t.x,t.y,P(P({},o),{},{detail:n})),i===0?Y(`click`,e,t.x,t.y,P(P({},o),{},{detail:n})):i===1&&Y(`auxclick`,e,t.x,t.y,P(P({},o),{},{detail:n}))}i===2&&Y(`contextmenu`,e,t.x,t.y,{button:2,buttons:0})}s===2&&i===0&&Y(`dblclick`,e,t.x,t.y,{detail:2})}function wu(e,t){bu(e,t)}function Tu(e,t,n,r){try{e.dispatchEvent(new WheelEvent(`wheel`,P(P({},_u(t.x,t.y)),{},{deltaX:n,deltaY:r,deltaMode:0})))}catch(e){}}async function Eu(e,t,n,r){let i={button:0,buttons:1},a={button:0,buttons:0};vu++,bu(e,t),J(`pointerdown`,e,t.x,t.y,i),Y(`mousedown`,e,t.x,t.y,i),pu&&yu(`touchstart`,e,t.x,t.y);let o=tr(e,`[draggable=true], a[href], img`),s=null;if(o&&o.getAttribute(`draggable`)!==`false`)try{s=new DataTransfer}catch(e){s=null}s&&!Du(`dragstart`,o,t,s)&&(s=null);let c=e;for(let a=1;a<=5;a++){let l={x:t.x+(r.x-t.x)*a/5,y:t.y+(r.y-t.y)*a/5},u=a===5?n:Jn(l.x,l.y);s?(Du(`drag`,o,l,s),u!==c&&Du(`dragenter`,u,l,s),Du(`dragover`,u,l,s)):(bu(u,l),J(`pointermove`,u,l.x,l.y,i),Y(`mousemove`,u,l.x,l.y,i),pu&&yu(`touchmove`,e,l.x,l.y)),c=u,await Bc()}s?(Du(`dragover`,n,r,s)||Du(`drop`,n,r,s),Du(`dragend`,o,r,s)):(J(`pointerup`,n,r.x,r.y,a),Y(`mouseup`,n,r.x,r.y,a),pu&&yu(`touchend`,e,r.x,r.y))}function Du(e,t,n,r){try{return t.dispatchEvent(new DragEvent(e,P(P({},_u(n.x,n.y)),{},{dataTransfer:r})))}catch(e){return!0}}var Ou=[`rwd.click`,`rwd.fill`,`rwd.type`,`rwd.press`,`rwd.select`,`rwd.hover`,`rwd.scroll`,`rwd.drag`,`rwd.navigate`,`rwd.back`,`rwd.reload`];function ku(e,t){try{e.highlight&&e.highlight(t)}catch(e){}}function Au(e,t,n){let r=e||document.scrollingElement||document.documentElement,i=r.scrollLeft,a=r.scrollTop,o=(t,n)=>{e?e.scrollTo({left:t,top:n,behavior:`instant`}):window.scrollTo({left:t,top:n,behavior:`instant`})},s=Math.min(360,Math.max(160,Math.sqrt(t*t+n*n)*.4)),c=Date.now();return new Promise(e=>{let r=()=>{let l=Math.min(1,(Date.now()-c)/s),u=1-(1-l)**3;o(i+t*u,a+n*u),l<1?setTimeout(r,16):e()};r()})}async function ju(e,t,n,r){if(e.pointer)try{await e.pointer(t,n,r)}catch(e){}}async function Mu(e,t){if(!t||!e.confirm)return;let n=Rc();await e.confirm(t),n instanceof HTMLElement&&n.isConnected&&Rc()!==n&&n.focus({preventScroll:!0})}function Nu(e,t){if(typeof e!=`string`)throw M(`bad_request`,N().notString(t));return e}var Pu=/^(checkbox|radio|file|button|submit|reset|image|hidden|range|color)$/;function Fu(e,t){let n=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`);r&&r.set?r.set.call(e,t):e.value=t}function Iu(e){return e instanceof HTMLLabelElement&&e.control?e.control:e}function Lu(e){if(e=Iu(e),e instanceof HTMLInputElement&&!Pu.test(e.type)||e instanceof HTMLTextAreaElement){if(e.readOnly)throw M(`not_interactable`,N().readOnly(q(e)));return e}if(e instanceof HTMLElement&&e.isContentEditable)return e;throw e instanceof HTMLSelectElement?M(`bad_request`,N().isSelect(q(e))):M(`not_interactable`,N().notFillable(q(e)))}function Ru(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)try{let t=e.value.length;e.setSelectionRange(t,t)}catch(e){}}function zu(e){for(;e&&e!==document.body&&e!==document.documentElement;e=e.parentElement){let t=getComputedStyle(e),n=/(auto|scroll|overlay)/.test(t.overflowY)&&e.scrollHeight>e.clientHeight,r=/(auto|scroll|overlay)/.test(t.overflowX)&&e.scrollWidth>e.clientWidth;if(n||r)return e}return null}function Bu(){return document.body&&document.body.innerText||``}function Vu(e){setTimeout(e,50)}function Hu(e){let t=[],n=(e,r)=>{if(e===void 0||typeof e==`function`||typeof e==`symbol`)return null;if(typeof e==`bigint`)return String(e);if(typeof e==`number`)return isFinite(e)?e:String(e);if(typeof e!=`object`||!e)return e;if(typeof Element<`u`&&e instanceof Element)return q(e);if(e instanceof Date)return e.toISOString();if(e instanceof Error)return`${e.name}: ${e.message}`;if(t.indexOf(e)>=0||r>20)return`[Circular]`;t.push(e);let i;if(Array.isArray(e)||typeof NodeList<`u`&&e instanceof NodeList)i=Array.prototype.map.call(e,e=>n(e,r+1));else if(typeof e.toJSON==`function`)i=n(e.toJSON(),r+1);else{i={};for(let t of Object.keys(e)){let a=e[t];a!==void 0&&typeof a!=`function`&&typeof a!=`symbol`&&(i[t]=n(a,r+1))}}return t.pop(),i};return n(e,0)}var Uu={"rwd.ping":()=>({at:Date.now()}),"rwd.snapshot":()=>{let e=$c();return{url:location.href,title:document.title,snapshot:e}},"rwd.query":e=>rl(e),"rwd.click":async(e,t)=>{let n=nl(e.ref);await Mu(t,Cl(n));let r=await au(n,{hitTest:!0});return await ju(t,r,`click`,n),ku(t,n),Cu(ou(n,r),r,{button:e.button||`left`,clickCount:e.clickCount||1}),{}},"rwd.hover":async(e,t)=>{let n=nl(e.ref),r=await au(n,{hitTest:!0});return await ju(t,r,`hover`,n),ku(t,n),wu(ou(n,r),r),{}},"rwd.fill":async(e,t)=>{let n=Lu(nl(e.ref)),r=e.value===void 0||e.value===null?``:String(e.value);if(await ju(t,await au(n,{hitTest:!1}),`focus`,n),ku(t,n),n.focus({preventScroll:!0}),n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement){try{n.select()}catch(e){}n.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`insertText`,data:r}))&&(Fu(n,r),n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:r})),n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=window.getSelection();if(e){let t=document.createRange();t.selectNodeContents(n),e.removeAllRanges(),e.addRange(t)}let t=!1;try{t=document.execCommand(`insertText`,!1,r)}catch(e){t=!1}t||(n.textContent=r,n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:r})))}return{}},"rwd.type":async(e,t)=>{let n=Nu(e.text,`text`);if(e.ref!==void 0&&e.ref!==null){let n=Lu(nl(e.ref));await ju(t,await au(n,{hitTest:!1}),`focus`,n),ku(t,n),document.activeElement!==n&&n.focus({preventScroll:!0}),Ru(n)}return e.submit&&await Mu(t,wl()),ru(n),e.submit&&nu(`Enter`),{}},"rwd.press":async(e,t)=>{let n=Nu(e.key,`key`);return/(^|\+)Enter$/.test(n)&&await Mu(t,wl()),nu(n),{}},"rwd.select":async(e,t)=>{let n=Iu(nl(e.ref));if(!(n instanceof HTMLSelectElement))throw M(`bad_request`,N().notSelect(q(n)));let r=(Array.isArray(e.values)?e.values:[e.values]).filter(e=>e!=null).map(String);if(!r.length)throw M(`bad_request`,N().missingParam(`values`));if(r.length>1&&!n.multiple)throw M(`bad_request`,N().singleSelect);await ju(t,await au(n,{hitTest:!1}),`select`,n),ku(t,n);let i=Array.prototype.slice.call(n.options),a=[];for(let e of r){let t;for(let n of i)t||n.value!==e&&n.label!==e&&(n.textContent||``).trim()!==e||(t=n);if(!t){let t=i.map(e=>(e.textContent||e.value).trim());throw M(`not_found`,N().noSuchOption(e,t))}if(t.disabled)throw M(`not_interactable`,N().optionDisabled(e));a.push(t)}n.focus({preventScroll:!0});for(let e of i)e.selected=a.indexOf(e)>=0;return n.dispatchEvent(new Event(`input`,{bubbles:!0})),n.dispatchEvent(new Event(`change`,{bubbles:!0})),{selected:i.filter(e=>e.selected).map(e=>e.value)}},"rwd.scroll":async(e,t)=>{let n=Number(e.dx)||0,r=Number(e.dy)||0;if(e.ref===void 0||e.ref===null)return await Au(null,n,r),{};let i=nl(e.ref),a=await au(i,{hitTest:!1});return await ju(t,a,`scroll`,i),ku(t,i),Tu(i,a,n,r),await Au(zu(i),n,r),{}},"rwd.drag":async(e,t)=>{let n=nl(e.fromRef),r=nl(e.toRef),i=await au(n,{hitTest:!0});await ju(t,i,`drag`,n),ku(t,n);let a=await au(r,{hitTest:!1});return await Promise.all([Eu(ou(n,i),i,r,a),ju(t,a,`drop`,r)]),ku(t,r),{}},"rwd.navigate":e=>{let t=Nu(e.url,`url`),n;try{n=new URL(t,location.href)}catch(e){throw M(`bad_request`,N().badUrl(t))}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw M(`bad_request`,N().httpOnly);return Vu(()=>location.assign(n.href)),{}},"rwd.back":()=>(Vu(()=>history.back()),{}),"rwd.reload":()=>(Vu(()=>location.reload()),{}),"rwd.waitFor":async e=>{typeof e.timeMs==`number`&&e.timeMs>0&&await zc(Math.min(e.timeMs,6e4));let t=typeof e.text==`string`&&e.text?e.text:``,n=typeof e.textGone==`string`&&e.textGone?e.textGone:``;if(!t&&!n)return{};let r=typeof e.timeoutMs==`number`&&e.timeoutMs>0?e.timeoutMs:1e4,i=Date.now()+r;for(;;){let e=Bu();if((!t||e.indexOf(t)>=0)&&(!n||e.indexOf(n)<0))return{};if(Date.now()>=i)throw M(`timeout`,t?N().textAppearTimeout(t):N().textGoneTimeout(n));await zc(100)}},"rwd.screenshot":async e=>{let t=e.format===`png`||e.format===`webp`?e.format:`jpeg`,n=typeof e.quality==`number`?Math.max(1,Math.min(100,e.quality)):80,r;if(e.ref!==void 0&&e.ref!==null){let t=nl(e.ref);t.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`});let n=t.getBoundingClientRect();if(!n.width||!n.height)throw M(`not_interactable`,N().notVisible(q(t)));r={x:n.left+window.scrollX,y:n.top+window.scrollY,width:n.width,height:n.height,scale:1}}let i=await Qi({format:t,quality:t===`png`?void 0:n,clip:r,captureBeyondViewport:!r&&!!e.fullPage});return{data:i.data,mimeType:`image/`+t,source:i.source,width:i.width,height:i.height}},"rwd.console":e=>xi(e),"rwd.network":e=>Ei(e),"rwd.networkDetail":e=>Ri(e),"rwd.storage":e=>fl(e),"rwd.log":async e=>{let t=typeof e.session==`string`?e.session:void 0;if(e.op===`sessions`)return{sessions:await Gr()};if(e.op===`overview`)return await qr(t);let n=!!e.includeExcluded;return await Kr({session:t,kinds:Array.isArray(e.kinds)?e.kinds.filter(e=>typeof e==`string`):void 0,problems:!!e.problems,page:typeof e.page==`string`?e.page:void 0,text:typeof e.text==`string`?e.text:void 0,after:Number(e.after)||0,from:Number(e.from)||0,to:Number(e.to)||0,limit:Number(e.limit)||100,hide:n?void 0:t=>t.kind===`net`&&Li(t.data.url,e.exclude)})},"rwd.logDetail":e=>Jr(e.seq),"rwd.evaluate":async e=>{let t=Nu(e.function,`function`),n;try{n=(0,eval)(`(${t}\n)`)}catch(e){throw M(`bad_request`,N().badFunction(String(e&&e.message)))}if(typeof n!=`function`)throw M(`bad_request`,N().notAFunction);let r=Array.isArray(e.args)?e.args:[];return{value:Hu(await n.apply(window,r))}}};function Wu(e){return Object.prototype.hasOwnProperty.call(Uu,e)}async function Gu(e,t,n={}){if(!Wu(e))throw M(`bad_request`,N().unknownMethod(e));return await Uu[e](t&&typeof t==`object`?t:{},n)}var Ku=`rwd:device`,qu=`rwd:page`,Ju=`rwd:opener`,Yu=`rwd:lastTap`,Xu=`rwd:dtoken`,Zu=`rwd:resume`,Qu=`rwd:invite`,$u=`rwd_invite`,ed=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function td(e){let t=[],n=window.crypto;if(n&&typeof n.getRandomValues==`function`){let r=new Uint8Array(e);n.getRandomValues(r);for(let n=0;n<e;n++)t.push(r[n])}else for(let n=0;n<e;n++)t.push(Math.floor(Math.random()*256));return t}function nd(e){let t=``;for(;t.length<e;)for(let n of td(e))n<248&&t.length<e&&(t+=ed[n%62]);return t}function rd(){let e=window.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=td(16);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=t.map(e=>(e+256).toString(16).slice(1)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function X(e,t){try{return window[e].getItem(t)}catch(e){return null}}function Z(e,t,n){try{n===null?window[e].removeItem(t):window[e].setItem(t,n)}catch(e){}}function id(e){if(e)return X(`localStorage`,Ku)!==e&&Z(`localStorage`,Xu,null),Z(`localStorage`,Ku,e),e;let t=X(`localStorage`,Ku);return t||(t=rd(),Z(`localStorage`,Ku,t)),t}function ad(){try{let e=window.opener;if(e&&e!==window)return e.sessionStorage.getItem(qu)}catch(e){}return null}function od(e){let t=id(e),n=ad(),r=X(`sessionStorage`,qu);if(r&&n&&r===n&&(r=null),!r){r=nd(12);let e=n;if(!e)try{let t=JSON.parse(X(`localStorage`,Yu)||`null`);t&&typeof t.p==`string`&&Date.now()-t.t<5e3&&(e=t.p)}catch(e){}Z(`sessionStorage`,qu,r),Z(`sessionStorage`,Ju,e||``)}return{deviceId:t,pageId:r,openerId:X(`sessionStorage`,Ju)||n||null}}function sd(e){Z(`localStorage`,Yu,JSON.stringify({p:e,t:Date.now()}))}function cd(e){let t=window.BroadcastChannel;if(typeof t!=`function`)return Promise.resolve();let n=nd(8),r=!1,i=null,a=()=>{try{i=new t(`rwd:pages`)}catch(e){i=null;return}let a=i;a.onmessage=t=>{let i=t.data;i&&typeof i==`object`&&(i.t===`probe`&&i.page===e.pageId&&i.from!==n?a.postMessage({t:`taken`,page:i.page,to:i.from}):i.t===`taken`&&i.to===n&&(r=!0))}};return a(),i?(window.addEventListener(`pagehide`,()=>{i&&i.close(),i=null}),window.addEventListener(`pageshow`,e=>{e.persisted&&!i&&a()}),i.postMessage({t:`probe`,page:e.pageId,from:n}),new Promise(t=>setTimeout(()=>{r&&(e.openerId=e.pageId,e.pageId=nd(12),Z(`sessionStorage`,qu,e.pageId),Z(`sessionStorage`,Ju,e.openerId)),t()},60))):Promise.resolve()}function ld(e){try{let t=JSON.parse(X(`sessionStorage`,Zu)||`null`);if(t&&t.p===e&&typeof t.r==`string`)return t.r}catch(e){}return null}function ud(e,t){Z(`sessionStorage`,Zu,t?JSON.stringify({p:e,r:t}):null)}function dd(e){e.pageId=nd(12),Z(`sessionStorage`,qu,e.pageId),ud(e.pageId,null)}function fd(){try{let e=new URL(location.href),t=e.searchParams.get($u);t!==null&&(e.searchParams.delete($u),history.replaceState(history.state,``,e.href),t&&Z(`sessionStorage`,Qu,t))}catch(e){}return X(`sessionStorage`,Qu)}function pd(){Z(`sessionStorage`,Qu,null)}var md=3e4,hd=class{constructor(e){this.opts=e,this.attach=null,this.confirmation=null,this.channel=null;let t=window.BroadcastChannel;if(typeof t==`function`)try{this.channel=new t(`rwd:approval`),this.channel.onmessage=e=>{let t=e.data;t&&t.t===`decided`&&this.attach&&this.attach.info.requestId===t.requestId&&this.dropAttach()}}catch(e){this.channel=null}}pending(){let e=this.confirmation||this.attach;return e?P({},e.info):null}onAttachRequest(e){let t=typeof e.requestId==`string`?e.requestId:``;if(!t)return;this.dropAttach();let n=[];for(let t of Array.isArray(e.levels)?e.levels:[]){let e=gl(t);n.indexOf(e)<0&&n.push(e)}n.length||n.push(`observe`);let r=e.agent&&typeof e.agent==`object`?e.agent:{},i=this.opts.ui.t,a={kind:`attach`,requestId:t,agent:{name:String(r.name||i.agentName),keyHint:r.keyHint?String(r.keyHint):null},levels:n,expiresAt:Date.now()+(Number(e.expiresInSec)>0?Number(e.expiresInSec):30)*1e3},o={info:a,dialog:null,timer:setTimeout(()=>this.dropAttach(),a.expiresAt-Date.now()),finish:e=>{if(this.attach!==o)return;this.dropAttach();let r=e===null?null:n.indexOf(e)>=0?e:null;this.opts.send({t:`attach_decision`,requestId:t,level:r}),this.channel&&this.channel.postMessage({t:`decided`,requestId:t})}};this.attach=o;let s=this.opts.ui.autoLevel();if(s){let e=e=>[`observe`,`interact`,`advanced`].indexOf(e),t=n.filter(t=>e(t)<=e(s)),r=t.length?t[t.length-1]:n[0];o.finish(r),this.opts.ui.toast(i.autoAllowedToast(a.agent.name,i.attachLevels[r]))}else this.opts.native||(o.dialog=this.opts.ui.dialog({title:i.attachTitle,text:i.attachText(a.agent.name),hint:a.agent.keyHint?`API Key ${a.agent.keyHint}`:void 0,choices:n.map(e=>({value:e,label:i.attachLevels[e]})),choice:n[n.length-1],okText:i.allow,cancelText:i.deny,expiresAt:a.expiresAt,onDecide:(e,t)=>o.finish(e?t||n[n.length-1]:null)}))}onAttachCancel(e){this.attach&&this.attach.info.requestId===e&&this.dropAttach()}confirm(e){return this.confirmation?Promise.reject(new cr(`forbidden`,N().confirmBusy)):new Promise((t,n)=>{let r={kind:`confirm`,requestId:nd(12),action:e,expiresAt:Date.now()+md},i={info:r,dialog:null,timer:setTimeout(()=>i.finish(null),md),finish:e=>{this.confirmation===i&&(clearTimeout(i.timer),i.dialog&&i.dialog.close(),this.confirmation=null,e===`allow`?t():n(new cr(`forbidden`,N().userDenied)))}};if(this.confirmation=i,!this.opts.native){let t=this.opts.ui.t;i.dialog=this.opts.ui.dialog({title:t.confirmTitle,text:t.confirmText(e),okText:t.allow,cancelText:t.deny,expiresAt:r.expiresAt,onDecide:e=>i.finish(e?`allow`:null)})}})}cancelConfirm(){this.confirmation&&this.confirmation.finish(null)}decide(e,t){return this.attach&&this.attach.info.requestId===e?t!==null&&this.attach.info.levels.indexOf(t)<0?!1:(this.attach.finish(t),!0):this.confirmation&&this.confirmation.info.requestId===e?t!==null&&t!==`allow`?!1:(this.confirmation.finish(t),!0):!1}destroy(){this.dropAttach(),this.cancelConfirm(),this.channel&&this.channel.close(),this.channel=null}dropAttach(){let e=this.attach;e&&(this.attach=null,clearTimeout(e.timer),e.dialog&&e.dialog.close())}},gd=6e4,_d=6e4,vd=3,yd=100,bd=6e5,xd=3e5,Sd=class{constructor(e){this.opts=e,this.ws=null,this.failures=0,this.attempt=0,this.polls=0,this.online=!1,this.stopped=!0,this.queue=[],this.state=`stopped`}start(){this.stopped&&(this.stopped=!1,this.connect())}stop(){this.stopped=!0,this.clearTimers(),this.stopPolling(),this.drop(),this.queue=[],this.setState(`stopped`)}restart(e=0){this.stopped||(this.clearTimers(),this.stopPolling(),this.drop(),this.timer=setTimeout(()=>this.connect(),e))}suspend(){this.clearTimers(),this.stopPolling(),this.drop()}resume(){!this.stopped&&!this.ws&&this.connect()}isOnline(){return this.online}send(e,t=!1){if(this.online&&this.ws&&this.ws.readyState===1)try{return this.ws.send(JSON.stringify(e)),!0}catch(e){}return t&&(this.queue.push(e),this.queue.length>yd&&this.queue.shift()),!1}setState(e){this.state!==e&&(this.state=e,this.opts.onState(e))}clearTimers(){clearTimeout(this.timer),clearTimeout(this.idleTimer)}drop(){let e=this.ws;if(this.ws=null,this.online=!1,e){e.onopen=e.onmessage=e.onclose=e.onerror=null;try{e.close(1e3)}catch(e){}}}connect(){if(this.stopped)return;this.clearTimers(),this.drop(),this.setState(`connecting`);let e;try{e=new(f())(this.opts.wsUrl)}catch(e){this.failed();return}this.ws=e;let t=!1,n=()=>{clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.ws===e&&(this.drop(),this.scheduleReconnect())},gd)};e.onopen=()=>{n();try{e.send(JSON.stringify(this.opts.hello()))}catch(e){}},e.onmessage=e=>{n();let r;try{r=JSON.parse(String(e.data))}catch(e){return}r&&typeof r==`object`&&(r.t===`welcome`?(t=!0,this.online=!0,this.failures=0,this.attempt=0,this.setState(`online`),this.opts.onMessage(r),this.flush()):r.t!==`hb`&&(r.t===`reconnect`?this.restart(Math.max(0,Number(r.afterMs)||0)):this.opts.onMessage(r)))},e.onclose=n=>{if(this.ws!==e||(this.ws=null,this.online=!1,clearTimeout(this.idleTimer),this.stopped))return;let r=n&&n.code;r===4401?this.opts.onRejected()?this.timer=setTimeout(()=>this.connect(),0):this.backOff(`rejected`,bd):r===4429?this.backOff(`quota`,xd):(r===4409?this.opts.onConflict():t||this.failures++,this.scheduleReconnect())},e.onerror=()=>{}}failed(){this.failures++,this.scheduleReconnect()}scheduleReconnect(){if(this.stopped)return;if(this.failures>=vd){this.startPolling();return}this.setState(`connecting`);let e=Math.min(3e4,1e3*2**this.attempt++),t=e/2+e/2*Math.random();clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),t)}backOff(e,t){this.setState(e),clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),t*(.75+Math.random()*.5))}flush(){let e=this.queue;this.queue=[];for(let t of e)this.send(t,!0)}startPolling(){this.setState(`polling`),this.pollTimer||(this.polls=0,this.poll(),this.pollTimer=setInterval(()=>this.poll(),_d))}stopPolling(){this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=void 0}retryWebSocket(){this.stopPolling(),this.failures=0,this.attempt=0,this.connect()}poll(){this.stopped||(this.polls++,this.polls>1&&this.polls%5==1?this.retryWebSocket():d&&d(this.opts.presenceUrl,{method:`POST`,headers:{"Content-Type":`text/plain;charset=UTF-8`},body:JSON.stringify(this.opts.presence()),credentials:`omit`,cache:`no-store`}).then(e=>e.ok?e.json():null).then(e=>{e&&!this.stopped&&this.pollTimer&&(this.opts.onPresence(e),e.connect&&this.retryWebSocket())}).catch(()=>{}))}};function Cd(){return{url:location.href,title:document.title,visibility:document.visibilityState===`hidden`?`hidden`:`visible`}}var wd=`a, button, input, select, textarea, label, summary, [role=button], [role=link], [role=tab], [role=menuitem], [role=checkbox], [role=radio], [role=switch], [role=option], [onclick]`;function Td(e){let t=tr(e,wd)||e,{role:n,name:r}=Fc(t),i=r;!i&&!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(i=rr(t)?A:j((t.textContent||``).replace(/\s+/g,` `).trim())),i.length>30&&(i=i.slice(0,30)+`…`);let a=N(),o=a.roles[n]||a.element;return i?a.tapped(o,i):a.tappedTag(o,q(t))}function Ed(e){let{role:t,name:n}=Fc(e);return n?`${t} "${n.length>30?n.slice(0,30)+`…`:n}"`:q(e)}function Dd(e){if(rr(e))return A;if(e instanceof HTMLInputElement){if(e.type===`password`)return A;if(e.type===`checkbox`||e.type===`radio`)return e.checked?`checked`:`unchecked`}let t=j(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value:``);return t.length>200?t.slice(0,200)+`…`:t}function Od(e){let t=Cd(),n,r=()=>{n=void 0;let r=Cd();if(r.url===t.url&&r.title===t.title&&r.visibility===t.visibility)return;let i=t;t=r,r.url!==i.url&&R(`page`,{event:`nav`,url:j(r.url),from:j(i.url),title:j(r.title)}),r.visibility!==i.visibility&&(R(`page`,{event:`visibility`,state:r.visibility}),r.visibility===`hidden`&&Ir()),e.onChange(r)},i=()=>{n||(n=setTimeout(r,50))};for(let e of[`pushState`,`replaceState`]){let t=history[e];typeof t==`function`&&(history[e]=function(){let e=t.apply(this,arguments);return i(),e})}window.addEventListener(`popstate`,i),window.addEventListener(`hashchange`,i),document.addEventListener(`visibilitychange`,r);try{new MutationObserver(i).observe(document.head||document.documentElement,{subtree:!0,childList:!0,characterData:!0})}catch(e){}window.addEventListener(`click`,t=>{if(!t.isTrusted)return;let n=t.composedPath?t.composedPath()[0]:t.target;if(n&&n.nodeType===1&&!nr(n))try{let t=Td(n);e.onTap(t,n),R(`action`,{event:`tap`,target:t,tag:q(n)},!0)}catch(e){}},!0),document.addEventListener(`change`,e=>{let t=e.target;if(e.isTrusted&&t&&t.nodeType===1&&!nr(t))try{R(`action`,{event:`input`,target:Ed(t),value:Dd(t)},!0)}catch(e){}},!0),document.addEventListener(`submit`,e=>{let t=e.target;if(e.isTrusted&&t&&t.nodeType===1)try{R(`action`,{event:`submit`,target:Ed(t)},!0)}catch(e){}},!0);let a=new Map;return document.addEventListener(`scroll`,e=>{if(!e.isTrusted||!e.target)return;let t=e.target,n=a.get(t);n&&clearTimeout(n),a.set(t,setTimeout(()=>{a.delete(t);let e=t===document?document.scrollingElement:t;e&&!nr(e)&&R(`action`,{event:`scroll`,target:t===document?`page`:q(e),y:Math.round(e.scrollTop),x:Math.round(e.scrollLeft)})},600))},!0),{check:r}}var kd=1e4,Ad=``,jd=``;try{let e=document.currentScript;e&&e.src&&(Ad=e.src.replace(/[^/]*([?#].*)?$/,``)),e&&(jd=e.nonce||e.getAttribute(`nonce`)||``)}catch(e){}function Md(e){return new Promise((t,n)=>{let r=document.createElement(`script`),i,a=a=>{clearTimeout(i),r.remove(),a?t():n(Error(`failed to load ${e}`))};i=setTimeout(()=>a(!1),kd),r.onload=()=>a(!0),r.onerror=()=>a(!1),r.async=!0,jd&&(r.nonce=jd),r.src=e,(document.head||document.documentElement).appendChild(r)})}function Nd(e,t){let n=[];if(Ad&&n.push(`${Ad}locales/${e}.js`),t){let r=`${t.replace(/\/+$/,``)}/locales/${e}.js`;n.indexOf(r)<0&&n.push(r)}let r=Promise.reject(Error(`no URL to load locale ${e} from`));for(let e of n)r=r.catch(()=>Md(e));return r.then(()=>null)}var Pd={id:`en`,name:`English`,dir:`ltr`,ui:{levels:{observe:`View only`,interact:`View and interact`,advanced:`Advanced (run scripts, read storage)`},attachLevels:{observe:`View only`,interact:`View and interact`,advanced:`Advanced (also run scripts, read storage)`},state:{none:`Idle: no AI connected`,observe:`AI is viewing this page`,agent:`AI is in control; your input is paused`,user:`You've taken over; AI is paused`},link:{connecting:`Connecting`,online:`Online`,offline:`Offline`},connecting:`Connecting…`,helpPending:`Assisting`,copy:`Copy`,copied:`Copied`,noteHelp:`Assistance requested. The developer will find you by this device code.`,noteAuto:`Auto-allow is on: AI joins without asking. You can take over or end anytime.`,noteShare:`Share this device code with the developer. AI asks before joining, and you can take over or end anytime.`,help:`Request assistance`,cancelHelp:`Cancel request`,collapse:`Hide`,deviceCode:`Device code`,barViewing:`AI is viewing`,barAgent:`AI working`,barUser:`Your turn`,connectedFor:e=>`Connected · ${e}`,takeover:`Take over`,handback:`Hand back`,end:`End`,autoTitle:`Auto-allow AI`,autoOn:e=>`Joins without asking · ${e}`,autoOff:`Ask me each time AI wants to join`,lockTitle:`Lock screen while AI is connected`,lockOn:`Your taps and swipes are blocked while AI is connected`,lockOff:`You can still tap and scroll; try not to get in the AI's way`,lockedToast:`Screen will lock while AI is connected`,unlockedToast:`Screen won't lock while AI is connected`,autoOffToast:`Auto-allow is off. AI will ask before joining`,autoDialogTitle:`Turn on auto-allow?`,autoDialogText:`When AI asks to join this device, it joins right away with the access you pick below. You'll see a notice each time, can take over or end anytime, and can turn this off here.`,turnOn:`Turn on`,cancel:`Cancel`,autoOnToast:e=>`Auto-allow on · ${e}`,countdown:e=>`Auto-deny in ${e}s`,agentName:`AI assistant`,autoAllowedToast:(e,t)=>`Auto-allowed "${e}" · ${t}`,attachTitle:`AI wants to join`,attachText:e=>`"${e}" wants to view this page. Allow?`,confirmTitle:`Please confirm`,confirmText:e=>`AI wants to ${e}. Allow?`,allow:`Allow`,deny:`Deny`},action:dr,agent:ur},Fd={id:`zh`,name:`简体中文`,dir:`ltr`,ui:{levels:{observe:`仅查看`,interact:`查看并操作`,advanced:`高级(可执行脚本、读取存储)`},attachLevels:{observe:`仅查看`,interact:`查看并操作`,advanced:`高级(另可执行脚本、读取存储)`},state:{none:`空闲:没有 AI 接入`,observe:`AI 正在查看这个页面`,agent:`AI 正在操作,你的输入已暂停`,user:`你已接管,AI 已暂停`},link:{connecting:`连接中`,online:`在线`,offline:`离线`},connecting:`连接中…`,helpPending:`协助中`,copy:`复制`,copied:`已复制`,noteHelp:`已请求协助,开发同学会通过设备码找到你。`,noteAuto:`已开启自动允许:AI 接入时不再询问,你随时可以接管或结束。`,noteShare:`把设备码发给开发同学:AI 接入前会先征得你的同意,接入后你随时可以接管或结束。`,help:`请求协助`,cancelHelp:`取消请求`,collapse:`收起`,deviceCode:`设备码`,barViewing:`AI 查看中`,barAgent:`AI 操作中`,barUser:`你在操作`,connectedFor:e=>`已连接 · ${e}`,takeover:`接管`,handback:`交还 AI`,end:`结束`,autoTitle:`自动允许 AI 接入`,autoOn:e=>`不再询问,以「${e}」接入`,autoOff:`每次 AI 请求接入都先问你`,lockTitle:`AI 接入时锁定屏幕`,lockOn:`AI 接入期间你的点击和滑动会被拦住`,lockOff:`AI 接入期间你仍可以点和滑,注意别和 AI 抢操作`,lockedToast:`AI 接入期间会锁定屏幕`,unlockedToast:`AI 接入期间不再锁定屏幕`,autoOffToast:`已关闭自动允许,AI 接入前会先问你`,autoDialogTitle:`开启自动允许接入?`,autoDialogText:`开启后,AI 请求接入这台设备时不再弹窗询问,直接按下面选的权限接入。每次自动接入都会在屏幕上提示,你随时可以接管或结束,也可以在这里关掉。`,turnOn:`开启`,cancel:`取消`,autoOnToast:e=>`已开启自动允许接入 · ${e}`,countdown:e=>`${e} 秒后自动拒绝`,agentName:`AI 助手`,autoAllowedToast:(e,t)=>`已自动允许「${e}」接入 · ${t}`,attachTitle:`AI 请求接入`,attachText:e=>`「${e}」请求查看此页面,允许吗?`,confirmTitle:`需要你的确认`,confirmText:e=>`AI 想要${e},允许吗?`,allow:`允许`,deny:`拒绝`},action:{quote:e=>`「${e}」`,click:e=>`点击${e}`,enterActivate:e=>`按 Enter 触发${e}`,enterSubmit:e=>`按 Enter 提交${e}`},agent:{missingParam:e=>`缺少参数 ${e}`,notString:e=>`参数 ${e} 必须是字符串`,unknownMethod:e=>`未知方法:${e}`,needLevel:e=>`需要 ${e} 权限`,takenOver:`用户已接管控制,等待用户交还`,userDenied:`用户拒绝了该操作`,confirmBusy:`正在等待用户确认上一个操作`,unknownModifier:e=>`未知的修饰键:${e}`,unknownKey:e=>`未知的按键:${e}`,refNotInSnapshot:e=>`ref=${e} 不在最近一次快照里,请重新获取快照`,refDetached:e=>`ref=${e} 对应的元素已不在页面上,请重新获取快照`,queryNeedsCriteria:`至少需要 text、role、name 之一`,noSuchRecord:e=>`会话日志里没有 seq=${e} 的记录(可能已被清理)`,noSuchSession:e=>`这台设备上没有会话 ${e} 的日志(只保留最近 3 次启动)`,noSessionLog:`这台设备上还没有会话日志(项目可能关闭了记录,或页面用 run({ record: false }) 关掉了)`,sessionLogUnavailable:`这个页面用不了 IndexedDB,没有会话日志`,readOnly:e=>`${e} 是只读的`,isSelect:e=>`${e} 是下拉框,请用 rwd.select`,notFillable:e=>`${e} 不是输入框,不能填写`,notSelect:e=>`${e} 不是下拉框(select),请用 click 操作`,singleSelect:`该下拉框只能选一项`,noSuchOption:(e,t)=>`下拉框里没有选项「${e}」,可选:${t.join(`、`)}`,optionDisabled:e=>`选项「${e}」已禁用`,badUrl:e=>`无效的网址:${e}`,httpOnly:`只能打开 http(s) 网址`,textAppearTimeout:e=>`等待文字「${e}」出现超时`,textGoneTimeout:e=>`等待文字「${e}」消失超时`,badFunction:e=>`无法解析 function:${e}`,notAFunction:`function 必须是函数表达式,例如 "() => document.title"`,elementDetached:e=>`元素 ${e} 已不在页面上,请重新获取快照`,notActionable:(e,t)=>`元素 ${e} 不可操作:${t}`,notVisible:e=>`元素 ${e} 不可见`,reasonMoving:`元素位置一直在变化(可能在动画中)`,reasonOffscreen:`元素不在可视区域内`,reasonObscured:(e,t)=>`点击位置被 ${e} 遮挡(遮挡元素 ref=${t},可以直接 click 它,比如点遮罩关闭弹窗)`,overlayHeader:`[浮层] 下面这些元素盖在页面内容上方。点击被挡住时,可以直接点它们(比如点遮罩关闭弹窗):`,overlayMask:(e,t,n)=>`- 遮罩 ${e},覆盖视口 ${t}% [ref=${n}]`,overlayLayer:(e,t,n,r)=>`- 弹层 ${e}${t?`「${t}」`:``},覆盖视口 ${n}% [ref=${r}]`,reasonHidden:`元素不可见`,reasonDisabled:`元素已禁用`,storageUnavailable:e=>`${e}Storage 不可用`,badStorageArea:`参数 area 必须是 'local'、'session' 或 'cookie'`,requestFailed:`请求失败`,noSuchRequest:e=>`找不到请求 id=${e}(可能已被丢弃)`,netFailed:(e,t)=>`${e} → 失败(${t})`,wsFailed:e=>`WebSocket ${e} → 失败`,tapped:(e,t)=>`点击了${e}「${t}」`,tappedTag:(e,t)=>`点击了${e} ${t}`,roles:{button:`按钮`,link:`链接`,textbox:`输入框`,searchbox:`搜索框`,checkbox:`复选框`,radio:`单选框`,switch:`开关`,combobox:`下拉框`,listbox:`列表`,option:`选项`,tab:`标签页`,menuitem:`菜单项`,img:`图片`,heading:`标题`,cell:`单元格`,row:`行`,listitem:`列表项`},element:`元素`}},Id=[`en`,`zh`,`zh-TW`,`fr`,`es`,`ru`,`ar`,`ja`,`ko`,`de`,`pt`],Ld=[`ar`,`fa`,`he`,`ur`,`ps`,`sd`,`ug`,`yi`,`dv`,`ckb`],Rd={en:Pd,zh:Fd},zd={},Bd={},Vd={},Hd=[];function Ud(e){if(typeof e!=`string`)return``;let t=e.trim().replace(/_/g,`-`).split(`-`);return/^[a-z]{2,8}$/i.test(t[0])?t.map((e,t)=>t===0?e.toLowerCase():/^[a-z]{4}$/i.test(e)?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():/^([a-z]{2}|\d{3})$/i.test(e)?e.toUpperCase():e.toLowerCase()).join(`-`):``}function Wd(e){let t=Ud(e);if(!t)return[];let n=t.split(`-`),r=[];for(let e=n.length;e>0;e--)r.push(n.slice(0,e).join(`-`));return n[0]===`zh`&&(n.indexOf(`Hant`)>0||n.indexOf(`Hans`)<0&&/-(TW|HK|MO)\b/.test(t))&&r.indexOf(`zh-TW`)<0&&r.splice(r.length-1,0,`zh-TW`),r}function Gd(e){return!!Rd[e]||Id.indexOf(e)>=0}function Kd(e){for(let t of e)for(let e of Wd(t))if(Gd(e))return e;return`en`}function qd(){try{let e=navigator.languages&&navigator.languages.length?navigator.languages.slice():[];return navigator.language&&e.indexOf(navigator.language)<0&&e.unshift(navigator.language),e}catch(e){return[]}}function Jd(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Yd(e,t){if(!Jd(t)||!Jd(e))return e;let n={};for(let t in e)n[t]=e[t];for(let e in t){let r=t[e];r!==void 0&&(n[e]=Jd(r)&&Jd(n[e])?Yd(n[e],r):r)}return n}function Xd(){for(let e in Vd)delete Vd[e];for(let e of Hd.slice())e()}function Zd(e){let t=Vd[e];if(t)return t;let n={ui:Pd.ui,action:Pd.action,agent:Pd.agent},r=Wd(e).reverse();r[0]!==`en`&&r.unshift(`en`);for(let e of r){let t=Rd[e];t&&(n=Yd(n,{ui:t.ui,action:t.action,agent:t.agent}));for(let t of zd[e]||[])n=Yd(n,t)}return Vd[e]=n,n}function Qd(e){for(let t of Wd(e)){let e=Rd[t];if(e&&e.dir)return e.dir}return Ld.indexOf(e.split(`-`)[0])>=0?`rtl`:`ltr`}function $d(e){let t=Array.isArray(e)?e:[e],n=!1;for(let e of t){let t=e&&Ud(e.id);t&&(Rd[t]=t===e.id?e:P(P({},e),{},{id:t}),n=!0)}n&&Xd()}function ef(e){if(Jd(e)){for(let t in e){let n=Ud(t);n&&Jd(e[t])&&(zd[n]=zd[n]||[]).push(e[t])}Xd()}}function tf(e){return Hd.push(e),()=>{let t=Hd.indexOf(e);t>=0&&Hd.splice(t,1)}}function nf(e,t){let n=[];for(let r of Wd(e))Rd[r]||Id.indexOf(r)<0||(Bd[r]||(Bd[r]=Nd(r,t).then(e=>{e&&!Rd[r]&&$d(e)}).catch(()=>void 0).then(()=>{Rd[r]||delete Bd[r]})),n.push(Bd[r]));return Promise.all(n).then(()=>void 0)}function rf(e){return e===`zh`?`zh-CN`:e}var af=`en`;function of(e,t){af=Kd([e]),mr(Zd(af).agent),nf(af,t)}function sf(e){hr(Zd(e).action)}tf(()=>mr(Zd(af).agent));try{let e=window.__RWD_LOCALES__;Array.isArray(e)&&$d(e)}catch(e){}var cf=`Remote Debugger`,lf=`rwd:pill`,uf=`rwd:cursor`,df=`rwd:task-min`,ff=`rwd:auto`,pf=`rwd:lock`,Q=8,mf=400,hf=` --accent-rgb: var(--rwd-accent-rgb, 59, 130, 246);--accent: rgb(var(--accent-rgb));--danger-rgb: var(--rwd-danger-rgb, 239, 68, 68);--warning-rgb: var(--rwd-warning-rgb, 245, 158, 11);--success-rgb: var(--rwd-success-rgb, 34, 197, 94);--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif);--mono: var(--rwd-font-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace);--radius: var(--rwd-radius, 18px);--button-radius: var(--rwd-button-radius, 999px);`,gf=` :host(:lang(zh-TW)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "PingFang TC", "Helvetica Neue", "Microsoft JhengHei", sans-serif)}:host(:lang(ja)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Helvetica Neue", "Yu Gothic UI", Meiryo, sans-serif)}:host(:lang(ko)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Helvetica Neue", "Malgun Gothic", sans-serif)}`,_f=`<svg class="arrow" viewBox="0 0 26 26" aria-hidden="true">
|
|
38
|
+
`||e===`\r`){$l(Xl(`Enter`,!1),0);continue}let t=/[A-Z~!@#$%^&*()_+{}|:"<>?]/.test(e),n=e.length===1&&e!==` `?Xl(e,t):null;n?$l(n,t?8:0):Hl(e)}}var iu=[0,20,50,100,100,250,500];async function au(e,t={}){let n=Date.now()+(t.timeoutMs||5e3),r=``;for(let i=0;;i++){if(i){if(Date.now()>=n)break;await zc(iu[Math.min(i,iu.length-1)])}if(!e.isConnected)throw M(`not_found`,N().elementDetached(q(e)));if(r=Nc(()=>su(e)),r)continue;cu(e.getBoundingClientRect())||e.scrollIntoView({block:`center`,inline:`center`,behavior:`instant`});let a=e.getBoundingClientRect();if(await Bc(),!e.isConnected)continue;let o=e.getBoundingClientRect();if(!lu(a,o)){r=N().reasonMoving;continue}let s=du(o);if(!s.length){r=N().reasonOffscreen;continue}if(t.hitTest===!1)return s[0];let c=s.find(t=>fu(e,Jn(t.x,t.y)));if(c)return c;{let e=Jn(s[0].x,s[0].y);r=N().reasonObscured(q(e),el(e))}}throw M(`not_interactable`,N().notActionable(q(e),r))}function ou(e,t){let n=Jn(t.x,t.y);for(;n&&n.shadowRoot;){let e=n.shadowRoot.elementFromPoint(t.x,t.y);if(!e||e===n)break;n=e}return n&&fu(e,n)?n:e}function su(e){if(!qa(e).visible)return N().reasonHidden;gc();try{if(qs(e))return N().reasonDisabled}finally{_c()}return``}function cu(e){let t=e.left+e.width/2,n=e.top+e.height/2;return t>=0&&n>=0&&t<window.innerWidth&&n<window.innerHeight}function lu(e,t){return Math.abs(e.left-t.left)<1&&Math.abs(e.top-t.top)<1&&Math.abs(e.width-t.width)<1&&Math.abs(e.height-t.height)<1}var uu=[.5,.15,.85];function du(e){let t=Math.max(e.left,0),n=Math.min(e.right,window.innerWidth),r=Math.max(e.top,0),i=Math.min(e.bottom,window.innerHeight);if(n<=t||i<=r)return[];let a=[];for(let e of uu)for(let o of uu)a.push({x:t+(n-t)*o,y:r+(i-r)*e});return a}function fu(e,t){if(Lc(e,t))return!0;let n=tr(t,`label`);return!!(n&&n.control===e||e instanceof HTMLLabelElement&&e.control&&Lc(e.control,t))}var pu=navigator.maxTouchPoints>0||`ontouchstart`in window,mu={left:0,middle:1,right:2},hu=[1,4,2],gu=null;function _u(e,t,n={}){return P({bubbles:!0,cancelable:!0,composed:!0,view:window,clientX:e,clientY:t,screenX:e,screenY:t},n)}function J(e,t,n,r,i={}){if(typeof PointerEvent>`u`)return!0;let a=e===`pointerenter`||e===`pointerleave`;return t.dispatchEvent(new PointerEvent(e,P(P({},_u(n,r,i)),{},{bubbles:!a,cancelable:!a,pointerId:pu?2:1,pointerType:pu?`touch`:`mouse`,isPrimary:!0,width:1,height:1,pressure:i.buttons?.5:0})))}function Y(e,t,n,r,i={}){let a=e===`mouseenter`||e===`mouseleave`;return t.dispatchEvent(new MouseEvent(e,P(P({},_u(n,r,i)),{},{bubbles:!a,cancelable:!a})))}var vu=1;function yu(e,t,n,r){try{let i=new Touch({identifier:vu,target:t,clientX:n,clientY:r,pageX:n+window.scrollX,pageY:r+window.scrollY,screenX:n,screenY:r,radiusX:1,radiusY:1,rotationAngle:0,force:1}),a=e===`touchend`||e===`touchcancel`?[]:[i];return t.dispatchEvent(new TouchEvent(e,{bubbles:!0,cancelable:!0,composed:!0,view:window,touches:a,targetTouches:a,changedTouches:[i]}))}catch(e){return!0}}function bu(e,t){if(gu!==e){let n=gu;n&&n.isConnected&&(J(`pointerout`,n,t.x,t.y,{relatedTarget:e}),J(`pointerleave`,n,t.x,t.y,{relatedTarget:e}),Y(`mouseout`,n,t.x,t.y,{relatedTarget:e}),Y(`mouseleave`,n,t.x,t.y,{relatedTarget:e})),J(`pointerover`,e,t.x,t.y,{relatedTarget:n}),J(`pointerenter`,e,t.x,t.y,{relatedTarget:n}),Y(`mouseover`,e,t.x,t.y,{relatedTarget:n}),Y(`mouseenter`,e,t.x,t.y,{relatedTarget:n}),gu=e}J(`pointermove`,e,t.x,t.y),Y(`mousemove`,e,t.x,t.y)}var xu=`a[href], area[href], button, input, select, textarea, iframe, summary, [tabindex], [contenteditable]:not([contenteditable=false])`;function Su(e){let t=tr(e,xu),n=Rc();t?n!==t&&t.focus({preventScroll:!0}):n&&n!==document.body&&typeof n.blur==`function`&&n.blur()}function Cu(e,t,{button:n=`left`,clickCount:r=1}={}){let i=mu[n]===void 0?0:mu[n],a={button:i,buttons:hu[i]},o={button:i,buttons:0},s=Math.max(1,Math.min(3,r|0||1));if(pu&&i===0)for(let n=1;n<=s;n++){vu++,J(`pointerover`,e,t.x,t.y),J(`pointerenter`,e,t.x,t.y),J(`pointerdown`,e,t.x,t.y,a);let r=yu(`touchstart`,e,t.x,t.y);J(`pointerup`,e,t.x,t.y,o);let i=yu(`touchend`,e,t.x,t.y);J(`pointerout`,e,t.x,t.y),J(`pointerleave`,e,t.x,t.y),r&&i&&(gu!==e&&(Y(`mouseover`,e,t.x,t.y),gu=e),Y(`mousemove`,e,t.x,t.y),Y(`mousedown`,e,t.x,t.y,P(P({},a),{},{detail:n}))&&Su(e),Y(`mouseup`,e,t.x,t.y,P(P({},o),{},{detail:n})),Y(`click`,e,t.x,t.y,P(P({},o),{},{detail:n})))}else{bu(e,t);for(let n=1;n<=s;n++){let r=J(`pointerdown`,e,t.x,t.y,a);r&&Y(`mousedown`,e,t.x,t.y,P(P({},a),{},{detail:n}))&&Su(e),J(`pointerup`,e,t.x,t.y,o),r&&Y(`mouseup`,e,t.x,t.y,P(P({},o),{},{detail:n})),i===0?Y(`click`,e,t.x,t.y,P(P({},o),{},{detail:n})):i===1&&Y(`auxclick`,e,t.x,t.y,P(P({},o),{},{detail:n}))}i===2&&Y(`contextmenu`,e,t.x,t.y,{button:2,buttons:0})}s===2&&i===0&&Y(`dblclick`,e,t.x,t.y,{detail:2})}function wu(e,t){bu(e,t)}function Tu(e,t,n,r){try{e.dispatchEvent(new WheelEvent(`wheel`,P(P({},_u(t.x,t.y)),{},{deltaX:n,deltaY:r,deltaMode:0})))}catch(e){}}async function Eu(e,t,n,r){let i={button:0,buttons:1},a={button:0,buttons:0};vu++,bu(e,t),J(`pointerdown`,e,t.x,t.y,i),Y(`mousedown`,e,t.x,t.y,i),pu&&yu(`touchstart`,e,t.x,t.y);let o=tr(e,`[draggable=true], a[href], img`),s=null;if(o&&o.getAttribute(`draggable`)!==`false`)try{s=new DataTransfer}catch(e){s=null}s&&!Du(`dragstart`,o,t,s)&&(s=null);let c=e;for(let a=1;a<=5;a++){let l={x:t.x+(r.x-t.x)*a/5,y:t.y+(r.y-t.y)*a/5},u=a===5?n:Jn(l.x,l.y);s?(Du(`drag`,o,l,s),u!==c&&Du(`dragenter`,u,l,s),Du(`dragover`,u,l,s)):(bu(u,l),J(`pointermove`,u,l.x,l.y,i),Y(`mousemove`,u,l.x,l.y,i),pu&&yu(`touchmove`,e,l.x,l.y)),c=u,await Bc()}s?(Du(`dragover`,n,r,s)||Du(`drop`,n,r,s),Du(`dragend`,o,r,s)):(J(`pointerup`,n,r.x,r.y,a),Y(`mouseup`,n,r.x,r.y,a),pu&&yu(`touchend`,e,r.x,r.y))}function Du(e,t,n,r){try{return t.dispatchEvent(new DragEvent(e,P(P({},_u(n.x,n.y)),{},{dataTransfer:r})))}catch(e){return!0}}var Ou=[`rwd.click`,`rwd.fill`,`rwd.type`,`rwd.press`,`rwd.select`,`rwd.hover`,`rwd.scroll`,`rwd.drag`,`rwd.navigate`,`rwd.back`,`rwd.reload`];function ku(e,t){try{e.highlight&&e.highlight(t)}catch(e){}}function Au(e,t,n){let r=e||document.scrollingElement||document.documentElement,i=r.scrollLeft,a=r.scrollTop,o=(t,n)=>{e?e.scrollTo({left:t,top:n,behavior:`instant`}):window.scrollTo({left:t,top:n,behavior:`instant`})},s=Math.min(360,Math.max(160,Math.sqrt(t*t+n*n)*.4)),c=Date.now();return new Promise(e=>{let r=()=>{let l=Math.min(1,(Date.now()-c)/s),u=1-(1-l)**3;o(i+t*u,a+n*u),l<1?setTimeout(r,16):e()};r()})}async function ju(e,t,n,r){if(e.pointer)try{await e.pointer(t,n,r)}catch(e){}}async function Mu(e,t){if(!t||!e.confirm)return;let n=Rc();await e.confirm(t),n instanceof HTMLElement&&n.isConnected&&Rc()!==n&&n.focus({preventScroll:!0})}function Nu(e,t){if(typeof e!=`string`)throw M(`bad_request`,N().notString(t));return e}var Pu=/^(checkbox|radio|file|button|submit|reset|image|hidden|range|color)$/;function Fu(e,t){let n=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`);r&&r.set?r.set.call(e,t):e.value=t}function Iu(e){return e instanceof HTMLLabelElement&&e.control?e.control:e}function Lu(e){if(e=Iu(e),e instanceof HTMLInputElement&&!Pu.test(e.type)||e instanceof HTMLTextAreaElement){if(e.readOnly)throw M(`not_interactable`,N().readOnly(q(e)));return e}if(e instanceof HTMLElement&&e.isContentEditable)return e;throw e instanceof HTMLSelectElement?M(`bad_request`,N().isSelect(q(e))):M(`not_interactable`,N().notFillable(q(e)))}function Ru(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)try{let t=e.value.length;e.setSelectionRange(t,t)}catch(e){}}function zu(e){for(;e&&e!==document.body&&e!==document.documentElement;e=e.parentElement){let t=getComputedStyle(e),n=/(auto|scroll|overlay)/.test(t.overflowY)&&e.scrollHeight>e.clientHeight,r=/(auto|scroll|overlay)/.test(t.overflowX)&&e.scrollWidth>e.clientWidth;if(n||r)return e}return null}function Bu(){return document.body&&document.body.innerText||``}function Vu(e){setTimeout(e,50)}function Hu(e){let t=[],n=(e,r)=>{if(e===void 0||typeof e==`function`||typeof e==`symbol`)return null;if(typeof e==`bigint`)return String(e);if(typeof e==`number`)return isFinite(e)?e:String(e);if(typeof e!=`object`||!e)return e;if(typeof Element<`u`&&e instanceof Element)return q(e);if(e instanceof Date)return e.toISOString();if(e instanceof Error)return`${e.name}: ${e.message}`;if(t.indexOf(e)>=0||r>20)return`[Circular]`;t.push(e);let i;if(Array.isArray(e)||typeof NodeList<`u`&&e instanceof NodeList)i=Array.prototype.map.call(e,e=>n(e,r+1));else if(typeof e.toJSON==`function`)i=n(e.toJSON(),r+1);else{i={};for(let t of Object.keys(e)){let a=e[t];a!==void 0&&typeof a!=`function`&&typeof a!=`symbol`&&(i[t]=n(a,r+1))}}return t.pop(),i};return n(e,0)}var Uu={"rwd.ping":()=>({at:Date.now()}),"rwd.snapshot":()=>{let e=$c();return{url:location.href,title:document.title,snapshot:e}},"rwd.query":e=>rl(e),"rwd.click":async(e,t)=>{let n=nl(e.ref);await Mu(t,Cl(n));let r=await au(n,{hitTest:!0});return await ju(t,r,`click`,n),ku(t,n),Cu(ou(n,r),r,{button:e.button||`left`,clickCount:e.clickCount||1}),{}},"rwd.hover":async(e,t)=>{let n=nl(e.ref),r=await au(n,{hitTest:!0});return await ju(t,r,`hover`,n),ku(t,n),wu(ou(n,r),r),{}},"rwd.fill":async(e,t)=>{let n=Lu(nl(e.ref)),r=e.value===void 0||e.value===null?``:String(e.value);if(await ju(t,await au(n,{hitTest:!1}),`focus`,n),ku(t,n),n.focus({preventScroll:!0}),n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement){try{n.select()}catch(e){}n.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`insertText`,data:r}))&&(Fu(n,r),n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:r})),n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=window.getSelection();if(e){let t=document.createRange();t.selectNodeContents(n),e.removeAllRanges(),e.addRange(t)}let t=!1;try{t=document.execCommand(`insertText`,!1,r)}catch(e){t=!1}t||(n.textContent=r,n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:r})))}return{}},"rwd.type":async(e,t)=>{let n=Nu(e.text,`text`);if(e.ref!==void 0&&e.ref!==null){let n=Lu(nl(e.ref));await ju(t,await au(n,{hitTest:!1}),`focus`,n),ku(t,n),document.activeElement!==n&&n.focus({preventScroll:!0}),Ru(n)}return e.submit&&await Mu(t,wl()),ru(n),e.submit&&nu(`Enter`),{}},"rwd.press":async(e,t)=>{let n=Nu(e.key,`key`);return/(^|\+)Enter$/.test(n)&&await Mu(t,wl()),nu(n),{}},"rwd.select":async(e,t)=>{let n=Iu(nl(e.ref));if(!(n instanceof HTMLSelectElement))throw M(`bad_request`,N().notSelect(q(n)));let r=(Array.isArray(e.values)?e.values:[e.values]).filter(e=>e!=null).map(String);if(!r.length)throw M(`bad_request`,N().missingParam(`values`));if(r.length>1&&!n.multiple)throw M(`bad_request`,N().singleSelect);await ju(t,await au(n,{hitTest:!1}),`select`,n),ku(t,n);let i=Array.prototype.slice.call(n.options),a=[];for(let e of r){let t;for(let n of i)t||n.value!==e&&n.label!==e&&(n.textContent||``).trim()!==e||(t=n);if(!t){let t=i.map(e=>(e.textContent||e.value).trim());throw M(`not_found`,N().noSuchOption(e,t))}if(t.disabled)throw M(`not_interactable`,N().optionDisabled(e));a.push(t)}n.focus({preventScroll:!0});for(let e of i)e.selected=a.indexOf(e)>=0;return n.dispatchEvent(new Event(`input`,{bubbles:!0})),n.dispatchEvent(new Event(`change`,{bubbles:!0})),{selected:i.filter(e=>e.selected).map(e=>e.value)}},"rwd.scroll":async(e,t)=>{let n=Number(e.dx)||0,r=Number(e.dy)||0;if(e.ref===void 0||e.ref===null)return await Au(null,n,r),{};let i=nl(e.ref),a=await au(i,{hitTest:!1});return await ju(t,a,`scroll`,i),ku(t,i),Tu(i,a,n,r),await Au(zu(i),n,r),{}},"rwd.drag":async(e,t)=>{let n=nl(e.fromRef),r=nl(e.toRef),i=await au(n,{hitTest:!0});await ju(t,i,`drag`,n),ku(t,n);let a=await au(r,{hitTest:!1});return await Promise.all([Eu(ou(n,i),i,r,a),ju(t,a,`drop`,r)]),ku(t,r),{}},"rwd.navigate":e=>{let t=Nu(e.url,`url`),n;try{n=new URL(t,location.href)}catch(e){throw M(`bad_request`,N().badUrl(t))}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw M(`bad_request`,N().httpOnly);return Vu(()=>location.assign(n.href)),{}},"rwd.back":()=>(Vu(()=>history.back()),{}),"rwd.reload":()=>(Vu(()=>location.reload()),{}),"rwd.waitFor":async e=>{typeof e.timeMs==`number`&&e.timeMs>0&&await zc(Math.min(e.timeMs,6e4));let t=typeof e.text==`string`&&e.text?e.text:``,n=typeof e.textGone==`string`&&e.textGone?e.textGone:``;if(!t&&!n)return{};let r=typeof e.timeoutMs==`number`&&e.timeoutMs>0?e.timeoutMs:1e4,i=Date.now()+r;for(;;){let e=Bu();if((!t||e.indexOf(t)>=0)&&(!n||e.indexOf(n)<0))return{};if(Date.now()>=i)throw M(`timeout`,t?N().textAppearTimeout(t):N().textGoneTimeout(n));await zc(100)}},"rwd.screenshot":async e=>{let t=e.format===`png`||e.format===`webp`?e.format:`jpeg`,n=typeof e.quality==`number`?Math.max(1,Math.min(100,e.quality)):80,r;if(e.ref!==void 0&&e.ref!==null){let t=nl(e.ref);t.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`});let n=t.getBoundingClientRect();if(!n.width||!n.height)throw M(`not_interactable`,N().notVisible(q(t)));r={x:n.left+window.scrollX,y:n.top+window.scrollY,width:n.width,height:n.height,scale:1}}let i=await Qi({format:t,quality:t===`png`?void 0:n,clip:r,captureBeyondViewport:!r&&!!e.fullPage});return{data:i.data,mimeType:`image/`+t,source:i.source,width:i.width,height:i.height}},"rwd.console":e=>xi(e),"rwd.network":e=>Ei(e),"rwd.networkDetail":e=>Ri(e),"rwd.storage":e=>fl(e),"rwd.log":async e=>{let t=typeof e.session==`string`?e.session:void 0;if(e.op===`sessions`)return{sessions:await Gr()};if(e.op===`overview`)return await qr(t);let n=!!e.includeExcluded;return await Kr({session:t,kinds:Array.isArray(e.kinds)?e.kinds.filter(e=>typeof e==`string`):void 0,problems:!!e.problems,page:typeof e.page==`string`?e.page:void 0,text:typeof e.text==`string`?e.text:void 0,after:Number(e.after)||0,from:Number(e.from)||0,to:Number(e.to)||0,limit:Number(e.limit)||100,hide:n?void 0:t=>t.kind===`net`&&Li(t.data.url,e.exclude)})},"rwd.logDetail":e=>Jr(e.seq),"rwd.evaluate":async e=>{let t=Nu(e.function,`function`),n;try{n=(0,eval)(`(${t}\n)`)}catch(e){throw M(`bad_request`,N().badFunction(String(e&&e.message)))}if(typeof n!=`function`)throw M(`bad_request`,N().notAFunction);let r=Array.isArray(e.args)?e.args:[];return{value:Hu(await n.apply(window,r))}}};function Wu(e){return Object.prototype.hasOwnProperty.call(Uu,e)}async function Gu(e,t,n={}){if(!Wu(e))throw M(`bad_request`,N().unknownMethod(e));return await Uu[e](t&&typeof t==`object`?t:{},n)}var Ku=`rwd:device`,qu=`rwd:page`,Ju=`rwd:opener`,Yu=`rwd:lastTap`,Xu=`rwd:dtoken`,Zu=`rwd:resume`,Qu=`rwd:invite`,$u=`rwd_invite`,ed=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function td(e){let t=[],n=window.crypto;if(n&&typeof n.getRandomValues==`function`){let r=new Uint8Array(e);n.getRandomValues(r);for(let n=0;n<e;n++)t.push(r[n])}else for(let n=0;n<e;n++)t.push(Math.floor(Math.random()*256));return t}function nd(e){let t=``;for(;t.length<e;)for(let n of td(e))n<248&&t.length<e&&(t+=ed[n%62]);return t}function rd(){let e=window.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=td(16);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=t.map(e=>(e+256).toString(16).slice(1)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function X(e,t){try{return window[e].getItem(t)}catch(e){return null}}function Z(e,t,n){try{n===null?window[e].removeItem(t):window[e].setItem(t,n)}catch(e){}}function id(e){if(e)return X(`localStorage`,Ku)!==e&&Z(`localStorage`,Xu,null),Z(`localStorage`,Ku,e),e;let t=X(`localStorage`,Ku);return t||(t=rd(),Z(`localStorage`,Ku,t)),t}function ad(){try{let e=window.opener;if(e&&e!==window)return e.sessionStorage.getItem(qu)}catch(e){}return null}function od(e){let t=id(e),n=ad(),r=X(`sessionStorage`,qu);if(r&&n&&r===n&&(r=null),!r){r=nd(12);let e=n;if(!e)try{let t=JSON.parse(X(`localStorage`,Yu)||`null`);t&&typeof t.p==`string`&&Date.now()-t.t<5e3&&(e=t.p)}catch(e){}Z(`sessionStorage`,qu,r),Z(`sessionStorage`,Ju,e||``)}return{deviceId:t,pageId:r,openerId:X(`sessionStorage`,Ju)||n||null}}function sd(e){Z(`localStorage`,Yu,JSON.stringify({p:e,t:Date.now()}))}function cd(e){let t=window.BroadcastChannel;if(typeof t!=`function`)return Promise.resolve();let n=nd(8),r=!1,i=null,a=()=>{try{i=new t(`rwd:pages`)}catch(e){i=null;return}let a=i;a.onmessage=t=>{let i=t.data;i&&typeof i==`object`&&(i.t===`probe`&&i.page===e.pageId&&i.from!==n?a.postMessage({t:`taken`,page:i.page,to:i.from}):i.t===`taken`&&i.to===n&&(r=!0))}};return a(),i?(window.addEventListener(`pagehide`,()=>{i&&i.close(),i=null}),window.addEventListener(`pageshow`,e=>{e.persisted&&!i&&a()}),i.postMessage({t:`probe`,page:e.pageId,from:n}),new Promise(t=>setTimeout(()=>{r&&(e.openerId=e.pageId,e.pageId=nd(12),Z(`sessionStorage`,qu,e.pageId),Z(`sessionStorage`,Ju,e.openerId)),t()},60))):Promise.resolve()}function ld(e){let t=X(`localStorage`,Ku);t&&t!==e.deviceId?e.deviceId=t:(e.deviceId=rd(),Z(`localStorage`,Ku,e.deviceId),Z(`localStorage`,Xu,null))}function ud(e){try{let t=JSON.parse(X(`sessionStorage`,Zu)||`null`);if(t&&t.p===e&&typeof t.r==`string`)return t.r}catch(e){}return null}function dd(e,t){Z(`sessionStorage`,Zu,t?JSON.stringify({p:e,r:t}):null)}function fd(e){e.pageId=nd(12),Z(`sessionStorage`,qu,e.pageId),dd(e.pageId,null)}function pd(){try{let e=new URL(location.href),t=e.searchParams.get($u);t!==null&&(e.searchParams.delete($u),history.replaceState(history.state,``,e.href),t&&Z(`sessionStorage`,Qu,t))}catch(e){}return X(`sessionStorage`,Qu)}function md(){Z(`sessionStorage`,Qu,null)}var hd=3e4,gd=class{constructor(e){this.opts=e,this.attach=null,this.confirmation=null,this.channel=null;let t=window.BroadcastChannel;if(typeof t==`function`)try{this.channel=new t(`rwd:approval`),this.channel.onmessage=e=>{let t=e.data;t&&t.t===`decided`&&this.attach&&this.attach.info.requestId===t.requestId&&this.dropAttach()}}catch(e){this.channel=null}}pending(){let e=this.confirmation||this.attach;return e?P({},e.info):null}onAttachRequest(e){let t=typeof e.requestId==`string`?e.requestId:``;if(!t)return;this.dropAttach();let n=[];for(let t of Array.isArray(e.levels)?e.levels:[]){let e=gl(t);n.indexOf(e)<0&&n.push(e)}n.length||n.push(`observe`);let r=e.agent&&typeof e.agent==`object`?e.agent:{},i=this.opts.ui.t,a={kind:`attach`,requestId:t,agent:{name:String(r.name||i.agentName),keyHint:r.keyHint?String(r.keyHint):null},levels:n,expiresAt:Date.now()+(Number(e.expiresInSec)>0?Number(e.expiresInSec):30)*1e3},o={info:a,dialog:null,timer:setTimeout(()=>this.dropAttach(),a.expiresAt-Date.now()),finish:e=>{if(this.attach!==o)return;this.dropAttach();let r=e===null?null:n.indexOf(e)>=0?e:null;this.opts.send({t:`attach_decision`,requestId:t,level:r}),this.channel&&this.channel.postMessage({t:`decided`,requestId:t})}};this.attach=o;let s=this.opts.ui.autoLevel();if(s){let e=e=>[`observe`,`interact`,`advanced`].indexOf(e),t=n.filter(t=>e(t)<=e(s)),r=t.length?t[t.length-1]:n[0];o.finish(r),this.opts.ui.toast(i.autoAllowedToast(a.agent.name,i.attachLevels[r]))}else this.opts.native||(o.dialog=this.opts.ui.dialog({title:i.attachTitle,text:i.attachText(a.agent.name),hint:a.agent.keyHint?`API Key ${a.agent.keyHint}`:void 0,choices:n.map(e=>({value:e,label:i.attachLevels[e]})),choice:n[n.length-1],okText:i.allow,cancelText:i.deny,expiresAt:a.expiresAt,onDecide:(e,t)=>o.finish(e?t||n[n.length-1]:null)}))}onAttachCancel(e){this.attach&&this.attach.info.requestId===e&&this.dropAttach()}confirm(e){return this.confirmation?Promise.reject(new cr(`forbidden`,N().confirmBusy)):new Promise((t,n)=>{let r={kind:`confirm`,requestId:nd(12),action:e,expiresAt:Date.now()+hd},i={info:r,dialog:null,timer:setTimeout(()=>i.finish(null),hd),finish:e=>{this.confirmation===i&&(clearTimeout(i.timer),i.dialog&&i.dialog.close(),this.confirmation=null,e===`allow`?t():n(new cr(`forbidden`,N().userDenied)))}};if(this.confirmation=i,!this.opts.native){let t=this.opts.ui.t;i.dialog=this.opts.ui.dialog({title:t.confirmTitle,text:t.confirmText(e),okText:t.allow,cancelText:t.deny,expiresAt:r.expiresAt,onDecide:e=>i.finish(e?`allow`:null)})}})}cancelConfirm(){this.confirmation&&this.confirmation.finish(null)}decide(e,t){return this.attach&&this.attach.info.requestId===e?t!==null&&this.attach.info.levels.indexOf(t)<0?!1:(this.attach.finish(t),!0):this.confirmation&&this.confirmation.info.requestId===e?t!==null&&t!==`allow`?!1:(this.confirmation.finish(t),!0):!1}destroy(){this.dropAttach(),this.cancelConfirm(),this.channel&&this.channel.close(),this.channel=null}dropAttach(){let e=this.attach;e&&(this.attach=null,clearTimeout(e.timer),e.dialog&&e.dialog.close())}},_d=6e4,vd=6e4,yd=3,bd=100,xd=6e5,Sd=3e5,Cd=class{constructor(e){this.opts=e,this.ws=null,this.failures=0,this.attempt=0,this.polls=0,this.online=!1,this.stopped=!0,this.queue=[],this.state=`stopped`}start(){this.stopped&&(this.stopped=!1,this.connect())}stop(){this.stopped=!0,this.clearTimers(),this.stopPolling(),this.drop(),this.queue=[],this.setState(`stopped`)}restart(e=0){this.stopped||(this.clearTimers(),this.stopPolling(),this.drop(),this.timer=setTimeout(()=>this.connect(),e))}suspend(){this.clearTimers(),this.stopPolling(),this.drop()}resume(){!this.stopped&&!this.ws&&this.connect()}isOnline(){return this.online}send(e,t=!1){if(this.online&&this.ws&&this.ws.readyState===1)try{return this.ws.send(JSON.stringify(e)),!0}catch(e){}return t&&(this.queue.push(e),this.queue.length>bd&&this.queue.shift()),!1}setState(e){this.state!==e&&(this.state=e,this.opts.onState(e))}clearTimers(){clearTimeout(this.timer),clearTimeout(this.idleTimer)}drop(){let e=this.ws;if(this.ws=null,this.online=!1,e){e.onopen=e.onmessage=e.onclose=e.onerror=null;try{e.close(1e3)}catch(e){}}}connect(){if(this.stopped)return;this.clearTimers(),this.drop(),this.setState(`connecting`);let e;try{e=new(f())(this.opts.wsUrl)}catch(e){this.failed();return}this.ws=e;let t=!1,n=()=>{clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.ws===e&&(this.drop(),this.scheduleReconnect())},_d)};e.onopen=()=>{n();try{e.send(JSON.stringify(this.opts.hello()))}catch(e){}},e.onmessage=e=>{n();let r;try{r=JSON.parse(String(e.data))}catch(e){return}r&&typeof r==`object`&&(r.t===`welcome`?(t=!0,this.online=!0,this.failures=0,this.attempt=0,this.setState(`online`),this.opts.onMessage(r),this.flush()):r.t!==`hb`&&(r.t===`reconnect`?this.restart(Math.max(0,Number(r.afterMs)||0)):this.opts.onMessage(r)))},e.onclose=n=>{if(this.ws!==e||(this.ws=null,this.online=!1,clearTimeout(this.idleTimer),this.stopped))return;let r=n&&n.code;if(r===4401){let e=this.opts.onRejected();e===!1?this.backOff(`rejected`,xd):this.timer=setTimeout(()=>this.connect(),e)}else r===4429?this.backOff(`quota`,Sd):(r===4409?this.opts.onConflict():t||this.failures++,this.scheduleReconnect())},e.onerror=()=>{}}failed(){this.failures++,this.scheduleReconnect()}scheduleReconnect(){if(this.stopped)return;if(this.failures>=yd){this.startPolling();return}this.setState(`connecting`);let e=Math.min(3e4,1e3*2**this.attempt++),t=e/2+e/2*Math.random();clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),t)}backOff(e,t){this.setState(e),clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),t*(.75+Math.random()*.5))}flush(){let e=this.queue;this.queue=[];for(let t of e)this.send(t,!0)}startPolling(){this.setState(`polling`),this.pollTimer||(this.polls=0,this.poll(),this.pollTimer=setInterval(()=>this.poll(),vd))}stopPolling(){this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=void 0}retryWebSocket(){this.stopPolling(),this.failures=0,this.attempt=0,this.connect()}poll(){this.stopped||(this.polls++,this.polls>1&&this.polls%5==1?this.retryWebSocket():d&&d(this.opts.presenceUrl,{method:`POST`,headers:{"Content-Type":`text/plain;charset=UTF-8`},body:JSON.stringify(this.opts.presence()),credentials:`omit`,cache:`no-store`}).then(e=>e.ok?e.json():null).then(e=>{e&&!this.stopped&&this.pollTimer&&(this.opts.onPresence(e),e.connect&&this.retryWebSocket())}).catch(()=>{}))}};function wd(){return{url:location.href,title:document.title,visibility:document.visibilityState===`hidden`?`hidden`:`visible`}}var Td=`a, button, input, select, textarea, label, summary, [role=button], [role=link], [role=tab], [role=menuitem], [role=checkbox], [role=radio], [role=switch], [role=option], [onclick]`;function Ed(e){let t=tr(e,Td)||e,{role:n,name:r}=Fc(t),i=r;!i&&!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(i=rr(t)?A:j((t.textContent||``).replace(/\s+/g,` `).trim())),i.length>30&&(i=i.slice(0,30)+`…`);let a=N(),o=a.roles[n]||a.element;return i?a.tapped(o,i):a.tappedTag(o,q(t))}function Dd(e){let{role:t,name:n}=Fc(e);return n?`${t} "${n.length>30?n.slice(0,30)+`…`:n}"`:q(e)}function Od(e){if(rr(e))return A;if(e instanceof HTMLInputElement){if(e.type===`password`)return A;if(e.type===`checkbox`||e.type===`radio`)return e.checked?`checked`:`unchecked`}let t=j(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value:``);return t.length>200?t.slice(0,200)+`…`:t}function kd(e){let t=wd(),n,r=()=>{n=void 0;let r=wd();if(r.url===t.url&&r.title===t.title&&r.visibility===t.visibility)return;let i=t;t=r,r.url!==i.url&&R(`page`,{event:`nav`,url:j(r.url),from:j(i.url),title:j(r.title)}),r.visibility!==i.visibility&&(R(`page`,{event:`visibility`,state:r.visibility}),r.visibility===`hidden`&&Ir()),e.onChange(r)},i=()=>{n||(n=setTimeout(r,50))};for(let e of[`pushState`,`replaceState`]){let t=history[e];typeof t==`function`&&(history[e]=function(){let e=t.apply(this,arguments);return i(),e})}window.addEventListener(`popstate`,i),window.addEventListener(`hashchange`,i),document.addEventListener(`visibilitychange`,r);try{new MutationObserver(i).observe(document.head||document.documentElement,{subtree:!0,childList:!0,characterData:!0})}catch(e){}window.addEventListener(`click`,t=>{if(!t.isTrusted)return;let n=t.composedPath?t.composedPath()[0]:t.target;if(n&&n.nodeType===1&&!nr(n))try{let t=Ed(n);e.onTap(t,n),R(`action`,{event:`tap`,target:t,tag:q(n)},!0)}catch(e){}},!0),document.addEventListener(`change`,e=>{let t=e.target;if(e.isTrusted&&t&&t.nodeType===1&&!nr(t))try{R(`action`,{event:`input`,target:Dd(t),value:Od(t)},!0)}catch(e){}},!0),document.addEventListener(`submit`,e=>{let t=e.target;if(e.isTrusted&&t&&t.nodeType===1)try{R(`action`,{event:`submit`,target:Dd(t)},!0)}catch(e){}},!0);let a=new Map;return document.addEventListener(`scroll`,e=>{if(!e.isTrusted||!e.target)return;let t=e.target,n=a.get(t);n&&clearTimeout(n),a.set(t,setTimeout(()=>{a.delete(t);let e=t===document?document.scrollingElement:t;e&&!nr(e)&&R(`action`,{event:`scroll`,target:t===document?`page`:q(e),y:Math.round(e.scrollTop),x:Math.round(e.scrollLeft)})},600))},!0),{check:r}}var Ad=1e4,jd=``,Md=``;try{let e=document.currentScript;e&&e.src&&(jd=e.src.replace(/[^/]*([?#].*)?$/,``)),e&&(Md=e.nonce||e.getAttribute(`nonce`)||``)}catch(e){}function Nd(e){return new Promise((t,n)=>{let r=document.createElement(`script`),i,a=a=>{clearTimeout(i),r.remove(),a?t():n(Error(`failed to load ${e}`))};i=setTimeout(()=>a(!1),Ad),r.onload=()=>a(!0),r.onerror=()=>a(!1),r.async=!0,Md&&(r.nonce=Md),r.src=e,(document.head||document.documentElement).appendChild(r)})}function Pd(e,t){let n=[];if(jd&&n.push(`${jd}locales/${e}.js`),t){let r=`${t.replace(/\/+$/,``)}/locales/${e}.js`;n.indexOf(r)<0&&n.push(r)}let r=Promise.reject(Error(`no URL to load locale ${e} from`));for(let e of n)r=r.catch(()=>Nd(e));return r.then(()=>null)}var Fd={id:`en`,name:`English`,dir:`ltr`,ui:{levels:{observe:`View only`,interact:`View and interact`,advanced:`Advanced (run scripts, read storage)`},attachLevels:{observe:`View only`,interact:`View and interact`,advanced:`Advanced (also run scripts, read storage)`},state:{none:`Idle: no AI connected`,observe:`AI is viewing this page`,agent:`AI is in control; your input is paused`,user:`You've taken over; AI is paused`},link:{connecting:`Connecting`,online:`Online`,offline:`Offline`},connecting:`Connecting…`,helpPending:`Assisting`,copy:`Copy`,copied:`Copied`,noteHelp:`Assistance requested. The developer will find you by this device code.`,noteAuto:`Auto-allow is on: AI joins without asking. You can take over or end anytime.`,noteShare:`Share this device code with the developer. AI asks before joining, and you can take over or end anytime.`,help:`Request assistance`,cancelHelp:`Cancel request`,collapse:`Hide`,deviceCode:`Device code`,barViewing:`AI is viewing`,barAgent:`AI working`,barUser:`Your turn`,connectedFor:e=>`Connected · ${e}`,takeover:`Take over`,handback:`Hand back`,end:`End`,autoTitle:`Auto-allow AI`,autoOn:e=>`Joins without asking · ${e}`,autoOff:`Ask me each time AI wants to join`,lockTitle:`Lock screen while AI is connected`,lockOn:`Your taps and swipes are blocked while AI is connected`,lockOff:`You can still tap and scroll; try not to get in the AI's way`,lockedToast:`Screen will lock while AI is connected`,unlockedToast:`Screen won't lock while AI is connected`,autoOffToast:`Auto-allow is off. AI will ask before joining`,autoDialogTitle:`Turn on auto-allow?`,autoDialogText:`When AI asks to join this device, it joins right away with the access you pick below. You'll see a notice each time, can take over or end anytime, and can turn this off here.`,turnOn:`Turn on`,cancel:`Cancel`,autoOnToast:e=>`Auto-allow on · ${e}`,countdown:e=>`Auto-deny in ${e}s`,agentName:`AI assistant`,autoAllowedToast:(e,t)=>`Auto-allowed "${e}" · ${t}`,attachTitle:`AI wants to join`,attachText:e=>`"${e}" wants to view this page. Allow?`,confirmTitle:`Please confirm`,confirmText:e=>`AI wants to ${e}. Allow?`,allow:`Allow`,deny:`Deny`},action:dr,agent:ur},Id={id:`zh`,name:`简体中文`,dir:`ltr`,ui:{levels:{observe:`仅查看`,interact:`查看并操作`,advanced:`高级(可执行脚本、读取存储)`},attachLevels:{observe:`仅查看`,interact:`查看并操作`,advanced:`高级(另可执行脚本、读取存储)`},state:{none:`空闲:没有 AI 接入`,observe:`AI 正在查看这个页面`,agent:`AI 正在操作,你的输入已暂停`,user:`你已接管,AI 已暂停`},link:{connecting:`连接中`,online:`在线`,offline:`离线`},connecting:`连接中…`,helpPending:`协助中`,copy:`复制`,copied:`已复制`,noteHelp:`已请求协助,开发同学会通过设备码找到你。`,noteAuto:`已开启自动允许:AI 接入时不再询问,你随时可以接管或结束。`,noteShare:`把设备码发给开发同学:AI 接入前会先征得你的同意,接入后你随时可以接管或结束。`,help:`请求协助`,cancelHelp:`取消请求`,collapse:`收起`,deviceCode:`设备码`,barViewing:`AI 查看中`,barAgent:`AI 操作中`,barUser:`你在操作`,connectedFor:e=>`已连接 · ${e}`,takeover:`接管`,handback:`交还 AI`,end:`结束`,autoTitle:`自动允许 AI 接入`,autoOn:e=>`不再询问,以「${e}」接入`,autoOff:`每次 AI 请求接入都先问你`,lockTitle:`AI 接入时锁定屏幕`,lockOn:`AI 接入期间你的点击和滑动会被拦住`,lockOff:`AI 接入期间你仍可以点和滑,注意别和 AI 抢操作`,lockedToast:`AI 接入期间会锁定屏幕`,unlockedToast:`AI 接入期间不再锁定屏幕`,autoOffToast:`已关闭自动允许,AI 接入前会先问你`,autoDialogTitle:`开启自动允许接入?`,autoDialogText:`开启后,AI 请求接入这台设备时不再弹窗询问,直接按下面选的权限接入。每次自动接入都会在屏幕上提示,你随时可以接管或结束,也可以在这里关掉。`,turnOn:`开启`,cancel:`取消`,autoOnToast:e=>`已开启自动允许接入 · ${e}`,countdown:e=>`${e} 秒后自动拒绝`,agentName:`AI 助手`,autoAllowedToast:(e,t)=>`已自动允许「${e}」接入 · ${t}`,attachTitle:`AI 请求接入`,attachText:e=>`「${e}」请求查看此页面,允许吗?`,confirmTitle:`需要你的确认`,confirmText:e=>`AI 想要${e},允许吗?`,allow:`允许`,deny:`拒绝`},action:{quote:e=>`「${e}」`,click:e=>`点击${e}`,enterActivate:e=>`按 Enter 触发${e}`,enterSubmit:e=>`按 Enter 提交${e}`},agent:{missingParam:e=>`缺少参数 ${e}`,notString:e=>`参数 ${e} 必须是字符串`,unknownMethod:e=>`未知方法:${e}`,needLevel:e=>`需要 ${e} 权限`,takenOver:`用户已接管控制,等待用户交还`,userDenied:`用户拒绝了该操作`,confirmBusy:`正在等待用户确认上一个操作`,unknownModifier:e=>`未知的修饰键:${e}`,unknownKey:e=>`未知的按键:${e}`,refNotInSnapshot:e=>`ref=${e} 不在最近一次快照里,请重新获取快照`,refDetached:e=>`ref=${e} 对应的元素已不在页面上,请重新获取快照`,queryNeedsCriteria:`至少需要 text、role、name 之一`,noSuchRecord:e=>`会话日志里没有 seq=${e} 的记录(可能已被清理)`,noSuchSession:e=>`这台设备上没有会话 ${e} 的日志(只保留最近 3 次启动)`,noSessionLog:`这台设备上还没有会话日志(项目可能关闭了记录,或页面用 run({ record: false }) 关掉了)`,sessionLogUnavailable:`这个页面用不了 IndexedDB,没有会话日志`,readOnly:e=>`${e} 是只读的`,isSelect:e=>`${e} 是下拉框,请用 rwd.select`,notFillable:e=>`${e} 不是输入框,不能填写`,notSelect:e=>`${e} 不是下拉框(select),请用 click 操作`,singleSelect:`该下拉框只能选一项`,noSuchOption:(e,t)=>`下拉框里没有选项「${e}」,可选:${t.join(`、`)}`,optionDisabled:e=>`选项「${e}」已禁用`,badUrl:e=>`无效的网址:${e}`,httpOnly:`只能打开 http(s) 网址`,textAppearTimeout:e=>`等待文字「${e}」出现超时`,textGoneTimeout:e=>`等待文字「${e}」消失超时`,badFunction:e=>`无法解析 function:${e}`,notAFunction:`function 必须是函数表达式,例如 "() => document.title"`,elementDetached:e=>`元素 ${e} 已不在页面上,请重新获取快照`,notActionable:(e,t)=>`元素 ${e} 不可操作:${t}`,notVisible:e=>`元素 ${e} 不可见`,reasonMoving:`元素位置一直在变化(可能在动画中)`,reasonOffscreen:`元素不在可视区域内`,reasonObscured:(e,t)=>`点击位置被 ${e} 遮挡(遮挡元素 ref=${t},可以直接 click 它,比如点遮罩关闭弹窗)`,overlayHeader:`[浮层] 下面这些元素盖在页面内容上方。点击被挡住时,可以直接点它们(比如点遮罩关闭弹窗):`,overlayMask:(e,t,n)=>`- 遮罩 ${e},覆盖视口 ${t}% [ref=${n}]`,overlayLayer:(e,t,n,r)=>`- 弹层 ${e}${t?`「${t}」`:``},覆盖视口 ${n}% [ref=${r}]`,reasonHidden:`元素不可见`,reasonDisabled:`元素已禁用`,storageUnavailable:e=>`${e}Storage 不可用`,badStorageArea:`参数 area 必须是 'local'、'session' 或 'cookie'`,requestFailed:`请求失败`,noSuchRequest:e=>`找不到请求 id=${e}(可能已被丢弃)`,netFailed:(e,t)=>`${e} → 失败(${t})`,wsFailed:e=>`WebSocket ${e} → 失败`,tapped:(e,t)=>`点击了${e}「${t}」`,tappedTag:(e,t)=>`点击了${e} ${t}`,roles:{button:`按钮`,link:`链接`,textbox:`输入框`,searchbox:`搜索框`,checkbox:`复选框`,radio:`单选框`,switch:`开关`,combobox:`下拉框`,listbox:`列表`,option:`选项`,tab:`标签页`,menuitem:`菜单项`,img:`图片`,heading:`标题`,cell:`单元格`,row:`行`,listitem:`列表项`},element:`元素`}},Ld=[`en`,`zh`,`zh-TW`,`fr`,`es`,`ru`,`ar`,`ja`,`ko`,`de`,`pt`],Rd=[`ar`,`fa`,`he`,`ur`,`ps`,`sd`,`ug`,`yi`,`dv`,`ckb`],zd={en:Fd,zh:Id},Bd={},Vd={},Hd={},Ud=[];function Wd(e){if(typeof e!=`string`)return``;let t=e.trim().replace(/_/g,`-`).split(`-`);return/^[a-z]{2,8}$/i.test(t[0])?t.map((e,t)=>t===0?e.toLowerCase():/^[a-z]{4}$/i.test(e)?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():/^([a-z]{2}|\d{3})$/i.test(e)?e.toUpperCase():e.toLowerCase()).join(`-`):``}function Gd(e){let t=Wd(e);if(!t)return[];let n=t.split(`-`),r=[];for(let e=n.length;e>0;e--)r.push(n.slice(0,e).join(`-`));return n[0]===`zh`&&(n.indexOf(`Hant`)>0||n.indexOf(`Hans`)<0&&/-(TW|HK|MO)\b/.test(t))&&r.indexOf(`zh-TW`)<0&&r.splice(r.length-1,0,`zh-TW`),r}function Kd(e){return!!zd[e]||Ld.indexOf(e)>=0}function qd(e){for(let t of e)for(let e of Gd(t))if(Kd(e))return e;return`en`}function Jd(){try{let e=navigator.languages&&navigator.languages.length?navigator.languages.slice():[];return navigator.language&&e.indexOf(navigator.language)<0&&e.unshift(navigator.language),e}catch(e){return[]}}function Yd(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Xd(e,t){if(!Yd(t)||!Yd(e))return e;let n={};for(let t in e)n[t]=e[t];for(let e in t){let r=t[e];r!==void 0&&(n[e]=Yd(r)&&Yd(n[e])?Xd(n[e],r):r)}return n}function Zd(){for(let e in Hd)delete Hd[e];for(let e of Ud.slice())e()}function Qd(e){let t=Hd[e];if(t)return t;let n={ui:Fd.ui,action:Fd.action,agent:Fd.agent},r=Gd(e).reverse();r[0]!==`en`&&r.unshift(`en`);for(let e of r){let t=zd[e];t&&(n=Xd(n,{ui:t.ui,action:t.action,agent:t.agent}));for(let t of Bd[e]||[])n=Xd(n,t)}return Hd[e]=n,n}function $d(e){for(let t of Gd(e)){let e=zd[t];if(e&&e.dir)return e.dir}return Rd.indexOf(e.split(`-`)[0])>=0?`rtl`:`ltr`}function ef(e){let t=Array.isArray(e)?e:[e],n=!1;for(let e of t){let t=e&&Wd(e.id);t&&(zd[t]=t===e.id?e:P(P({},e),{},{id:t}),n=!0)}n&&Zd()}function tf(e){if(Yd(e)){for(let t in e){let n=Wd(t);n&&Yd(e[t])&&(Bd[n]=Bd[n]||[]).push(e[t])}Zd()}}function nf(e){return Ud.push(e),()=>{let t=Ud.indexOf(e);t>=0&&Ud.splice(t,1)}}function rf(e,t){let n=[];for(let r of Gd(e))zd[r]||Ld.indexOf(r)<0||(Vd[r]||(Vd[r]=Pd(r,t).then(e=>{e&&!zd[r]&&ef(e)}).catch(()=>void 0).then(()=>{zd[r]||delete Vd[r]})),n.push(Vd[r]));return Promise.all(n).then(()=>void 0)}function af(e){return e===`zh`?`zh-CN`:e}var of=`en`;function sf(e,t){of=qd([e]),mr(Qd(of).agent),rf(of,t)}function cf(e){hr(Qd(e).action)}nf(()=>mr(Qd(of).agent));try{let e=window.__RWD_LOCALES__;Array.isArray(e)&&ef(e)}catch(e){}var lf=`Remote Debugger`,uf=`rwd:pill`,df=`rwd:cursor`,ff=`rwd:task-min`,pf=`rwd:auto`,mf=`rwd:lock`,Q=8,hf=400,gf=` --accent-rgb: var(--rwd-accent-rgb, 59, 130, 246);--accent: rgb(var(--accent-rgb));--danger-rgb: var(--rwd-danger-rgb, 239, 68, 68);--warning-rgb: var(--rwd-warning-rgb, 245, 158, 11);--success-rgb: var(--rwd-success-rgb, 34, 197, 94);--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif);--mono: var(--rwd-font-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace);--radius: var(--rwd-radius, 18px);--button-radius: var(--rwd-button-radius, 999px);`,_f=` :host(:lang(zh-TW)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "PingFang TC", "Helvetica Neue", "Microsoft JhengHei", sans-serif)}:host(:lang(ja)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Helvetica Neue", "Yu Gothic UI", Meiryo, sans-serif)}:host(:lang(ko)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Helvetica Neue", "Malgun Gothic", sans-serif)}`,vf=`<svg class="arrow" viewBox="0 0 26 26" aria-hidden="true">
|
|
39
39
|
<path d="M3.2 1.6 L23.4 9.4 Q24.8 10 23.4 10.7 L14.6 14.6 L10.7 23.4 Q10 24.8 9.4 23.4 L1.6 3.2 Q1.1 1.1 3.2 1.6 Z"
|
|
40
40
|
fill="#0b0d12" stroke="#fff" stroke-width="2" stroke-linejoin="round"/>
|
|
41
|
-
</svg>`,vf=`<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="5" y="5" width="8.5" height="8.5" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M3.5 10.5V4a1.5 1.5 0 0 1 1.5-1.5h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>`,yf=`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8.4 6.8 11 12 5.6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,bf=` :host{all: initial;${hf}--ink: 255, 255, 255;--paper: 12, 14, 20;--fg: #fff;--solid-bg: #fff;--solid-fg: #0b0d12;--track: rgba(var(--ink), .2)}${gf}:host([data-theme=light]){--ink: 11, 13, 18;--paper: 255, 255, 255;--fg: #0b0d12;--solid-bg: #0b0d12;--solid-fg: #fff;--track: rgba(11, 13, 18, .16)}*{box-sizing: border-box}.glass{background: rgba(var(--paper), .9);color: var(--fg);border: 1px solid rgba(var(--ink), .1);box-shadow: 0 12px 32px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(var(--ink), .06);-webkit-backdrop-filter: blur(18px) saturate(1.5);backdrop-filter: blur(18px) saturate(1.5)}.win.glass, .dlg.glass, .task.glass{background: rgba(var(--paper), .96)}.pill, .bar, .btn{font: 500 12px/16px var(--font)}.pill{position: fixed;z-index: 3;top: 0;left: 0;display: flex;align-items: center;gap: 8px;max-width: calc(100vw - 16px);padding: 7px 12px 7px 8px;border-radius: 999px;white-space: nowrap;background: rgba(var(--paper), .55);color: var(--fg);border: 1px solid rgba(var(--ink), .14);box-shadow: 0 8px 24px rgba(0, 0, 0, .18);-webkit-backdrop-filter: blur(16px) saturate(1.6);backdrop-filter: blur(16px) saturate(1.6);pointer-events: auto;touch-action: none;cursor: pointer;user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .2, 1), background .2s ease}.pill:active{transform: scale(.97)}.pill.open{background: rgba(var(--paper), .85)}.pill.hidden{opacity: 0;transform: scale(.9);pointer-events: none;visibility: hidden;transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s}.pill.snap{transition: left .22s cubic-bezier(.2, .9, .2, 1), top .22s cubic-bezier(.2, .9, .2, 1), opacity .22s ease, transform .22s ease}.logo{position: relative;flex: none;width: 18px;height: 18px;border-radius: 6px;background: #0b0d12;box-shadow: inset 0 0 0 1px rgba(var(--ink), .18)}.logo .dot{position: absolute;left: 5px;top: 5px}.brand{font-weight: 650;letter-spacing: .2px}.win{position: fixed;z-index: 3;width: min(calc(100vw - 16px), 300px);padding: 14px;border-radius: var(--radius);font: 13px/18px var(--font);pointer-events: auto;opacity: 0;visibility: hidden;transform: scale(.92) translateY(6px);transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .24s}.win.open{opacity: 1;visibility: visible;transform: none;transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1)}.win .head{display: flex;align-items: center;gap: 8px}.win .name{font-weight: 700;font-size: 14px}.win .link{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;color: rgba(var(--ink), .6)}.win .k{margin-top: 14px;font: 600 10px/14px var(--mono);letter-spacing: 1px;text-transform: uppercase;color: rgba(var(--ink), .45)}.win .codebox{display: flex;align-items: center;gap: 10px;margin-top: 4px}.win .big{font: 700 24px/30px var(--mono);letter-spacing: 1.5px}.win .note{margin-top: 10px;font-size: 12px;line-height: 17px;color: rgba(var(--ink), .55)}.win .row{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 14px}.win .row .btn{flex: 1 0 0;min-width: max-content;text-align: center;white-space: nowrap}.code{font: 500 12px/16px var(--mono);letter-spacing: .5px;color: rgba(var(--ink), .7)}.pill{border-radius: calc(var(--radius) - 2px);padding: 7px 12px 7px 9px;gap: 9px}.pill .lines{display: flex;flex-direction: column;gap: 1px;min-width: 0}.pill .brand{font-size: 12px;line-height: 16px;cursor: pointer}.pill .copy, .pill .logo{cursor: pointer}.pill .copy{display: inline-flex;align-items: center;gap: 5px;margin: 0 -4px;padding: 1px 4px;border-radius: 6px;font: 600 12px/16px var(--mono);letter-spacing: .6px;color: rgba(var(--ink), .78);transition: background .15s ease, color .15s ease}.pill .copy:active{background: rgba(var(--ink), .14)}.pill .copy svg{width: 12px;height: 12px;opacity: .7}.pill .copy.done{color: rgb(var(--success-rgb))}.win .opts{margin-top: 12px;border-radius: calc(var(--radius) - 8px);background: rgba(var(--ink), .05);box-shadow: inset 0 0 0 1px rgba(var(--ink), .08)}.win .opt{display: flex;align-items: center;gap: 10px;padding: 8px 10px;cursor: pointer;-webkit-tap-highlight-color: transparent}.win .opt + .opt{border-top: 1px solid rgba(var(--ink), .08)}.win .opt .t{flex: 1;min-width: 0;font-size: 12px;line-height: 16px;font-weight: 600}.win .opt small{display: block;margin-top: 1px;font-size: 10.5px;line-height: 14px;font-weight: 400;color: rgba(var(--ink), .5)}.sw{position: relative;flex: none;width: 30px;height: 18px;border-radius: 999px;background: var(--track);transition: background .2s ease}.sw::after{content: "";position: absolute;top: 2px;left: 2px;width: 14px;height: 14px;border-radius: 50%;background: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, .3);transition: transform .22s cubic-bezier(.2, .9, .2, 1)}.sw.on{background: var(--accent)}.sw.on::after{transform: translateX(12px)}.toast{position: fixed;z-index: 4;left: 50%;bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-toast-bottom, 84px));max-width: calc(100vw - 32px);padding: 10px 16px;border-radius: var(--button-radius);font: 600 13px/18px var(--font);pointer-events: none;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;animation: rwd-toast 3.2s cubic-bezier(.2, .9, .2, 1) both}@keyframes rwd-toast{0%{opacity: 0;transform: translate(-50%, 12px) scale(.96)}8%, 88%{opacity: 1;transform: translate(-50%, 0)}100%{opacity: 0;transform: translate(-50%, 6px)}}.dot{position: relative;flex: none;width: 8px;height: 8px;border-radius: 50%;background: #6b7280}.online .dot{background: rgb(var(--success-rgb))}.observe .dot{background: var(--accent)}.agent .dot{background: var(--accent)}.observe .dot::after, .agent .dot::after, .task .now .mark::after{content: "";position: absolute;inset: -4px;border-radius: 50%;border: 2px solid var(--accent);animation: rwd-ping 1.4s cubic-bezier(.2, .6, .3, 1) infinite}.user .dot{background: rgb(var(--warning-rgb))}.btn{flex: none;margin: 0;padding: 7px 14px;border: 0;border-radius: var(--button-radius);font-weight: 600;letter-spacing: .2px;cursor: pointer;pointer-events: auto;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease}.btn:active{transform: scale(.96)}.btn.light{background: var(--solid-bg);color: var(--solid-fg)}.btn.accent{background: var(--accent);color: #fff}.btn.ghost{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.btn.stop{background: rgb(var(--danger-rgb));color: #fff;box-shadow: 0 6px 16px rgba(var(--danger-rgb), .35)}.btn.help{background: rgb(var(--warning-rgb));color: #0b0d12;padding: 4px 10px}.btn.help.on{background: rgba(var(--warning-rgb), .18);color: #fcd34d}.bar{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-bar-bottom, 14px));display: flex;align-items: center;gap: 12px;padding: 7px 7px 7px 18px;border-radius: var(--button-radius);white-space: nowrap;pointer-events: none;max-width: calc(100vw - 24px);user-select: none;-webkit-user-select: none;opacity: 0;visibility: hidden;transform: translate(-50%, 18px) scale(.96);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.observe .bar, .agent .bar, .user .bar{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.bar .status{display: flex;align-items: center;gap: 10px;min-width: 0;font-size: 14px;font-weight: 650;letter-spacing: .3px}.bar .text{display: flex;flex-direction: column;min-width: 0;overflow: hidden}.bar .head{display: flex;align-items: baseline;gap: 10px;min-width: 0}.bar .since{overflow: hidden;text-overflow: ellipsis;font-size: 12px;line-height: 16px;font-weight: 500;font-variant-numeric: tabular-nums;color: rgba(var(--ink), .55)}.bar .label{flex: none;max-width: 100%;overflow: hidden;text-overflow: ellipsis}.bar.stack{flex-wrap: wrap;justify-content: center;row-gap: 8px;width: calc(100vw - 24px);padding: 10px 7px 7px;border-radius: min(var(--button-radius), 26px)}.bar.stack .status{flex: 1 0 100%;justify-content: center}.bar.stack .acts{flex: 1 0 100%}.bar.stack .acts .btn{flex: 1}.bar .who{color: rgba(var(--ink), .5);font-weight: 500;overflow: hidden;text-overflow: ellipsis;max-width: 96px}.bar .acts{display: flex;gap: 8px}.bar .btn{min-width: 78px;min-height: 46px;padding: 12px 22px;font-size: 15px;line-height: 20px;font-weight: 700;text-align: center}.task{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);top: calc(env(safe-area-inset-top, 0px) + var(--rwd-task-top, 10px));width: min(calc(100vw - 24px), 380px);padding: 12px 14px 12px;border-radius: calc(var(--radius) - 2px);pointer-events: none;cursor: pointer;font: 13px/18px var(--font);user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;opacity: 0;visibility: hidden;transform: translate(-50%, -14px) scale(.97);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.task.on{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.task li{transition: color .25s ease}.task .mark{transition: background .25s ease, box-shadow .25s ease}.task .top{display: flex;align-items: center;gap: 8px}.task .tag{flex: none;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.task .agent{flex: 1;min-width: 0;color: rgba(var(--ink), .5);font-size: 12px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}.task .count{flex: none;font: 600 12px/16px var(--mono);color: rgba(var(--ink), .6)}.task .title{margin-top: 8px;font-size: 16px;line-height: 22px;font-weight: 700;letter-spacing: .2px}.task .track{margin-top: 8px;height: 3px;border-radius: 3px;background: rgba(var(--ink), .1);overflow: hidden}.task .fill{height: 100%;width: 0;background: var(--accent);box-shadow: 0 0 8px var(--accent);transition: width .35s cubic-bezier(.2, .9, .2, 1)}.task ol{list-style: none;margin: 10px -6px 0 0;padding: 0 6px 0 0;max-height: min(26vh, 134px);overflow-y: auto;overscroll-behavior: contain;-webkit-overflow-scrolling: touch;touch-action: pan-y;scrollbar-width: thin}.task ol.more{-webkit-mask-image: linear-gradient(#000 82%, transparent);mask-image: linear-gradient(#000 82%, transparent)}.task ol.more.end{-webkit-mask-image: none;mask-image: none}.task li{display: flex;align-items: flex-start;gap: 10px;padding: 4px 0;color: rgba(var(--ink), .42)}.task .mark{position: relative;flex: none;width: 16px;height: 16px;margin-top: 1px;border-radius: 50%;box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .25)}.task .done{color: rgba(var(--ink), .62)}.task .done .mark{background: var(--accent);box-shadow: none;color: #fff}.task .done .mark svg{width: 16px;height: 16px;display: block}.task .now{color: var(--fg);font-weight: 600}.task .now .mark{box-shadow: inset 0 0 0 2px var(--accent)}.task .now .mark::before{content: "";position: absolute;inset: 4px;border-radius: 50%;background: var(--accent)}.task.min ol{display: none}.task.min .title{font-size: 14px;line-height: 20px}.overlay{position: fixed;z-index: 1;top: 0;right: 0;bottom: 0;left: 0;display: none;background: transparent;pointer-events: auto;touch-action: none}.glow{position: fixed;z-index: 2;pointer-events: none;display: none;top: 0;right: 0;bottom: 0;left: 0}.observe.locked .overlay, .agent.locked .overlay{display: block}.observe .glow, .agent .glow{display: block;box-shadow: inset 0 0 0 5px rgba(var(--accent-rgb), .95), inset 0 0 36px 14px rgba(var(--accent-rgb), .8), inset 0 0 140px 56px rgba(var(--accent-rgb), .42);animation: rwd-glow 1.9s ease-in-out infinite}.user .glow{display: block;box-shadow: inset 0 0 0 3px rgba(var(--warning-rgb), .9), inset 0 0 18px 4px rgba(var(--warning-rgb), .3)}.cursor{position: fixed;z-index: 3;top: 0;left: 0;width: 0;height: 0;pointer-events: none;opacity: 0;will-change: transform;transition: opacity .2s ease}.cursor.on{opacity: 1}.cursor .arrow{position: absolute;left: -2px;top: -2px;width: 26px;height: 26px;overflow: visible;filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)) drop-shadow(0 0 12px rgba(var(--accent-rgb), .45));transform-origin: 2px 2px;transition: transform .09s ease-out}.cursor.press .arrow{transform: scale(.82)}.ripple{position: fixed;z-index: 3;width: 40px;height: 40px;margin: -20px 0 0 -20px;border-radius: 50%;border: 2px solid var(--accent);background: rgba(var(--accent-rgb), .16);pointer-events: none;animation: rwd-ripple .45s cubic-bezier(.2, .7, .3, 1) forwards}.hl{position: fixed;z-index: 2;pointer-events: none;border-radius: 6px;outline: 2px solid rgba(var(--accent-rgb), .9);outline-offset: 2px;background: rgba(var(--accent-rgb), .08);transition: opacity .25s ease}.scrim{position: fixed;z-index: 4;top: 0;right: 0;bottom: 0;left: 0;display: flex;align-items: center;justify-content: center;padding: 20px;background: rgba(4, 6, 10, .46);pointer-events: auto;touch-action: none;-webkit-backdrop-filter: blur(3px);backdrop-filter: blur(3px);animation: rwd-fade .2s ease both}.scrim.out{animation: rwd-fade-out .18s ease both;pointer-events: none}.dlg{width: 100%;max-width: 330px;padding: 18px 16px 14px;border-radius: calc(var(--radius) + 2px);font: 14px/20px var(--font);user-select: none;-webkit-user-select: none;animation: rwd-pop .26s cubic-bezier(.2, .9, .2, 1) both}.scrim.out .dlg{animation: rwd-pop-out .18s ease both}.dlg .tag{display: inline-block;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.dlg h3{margin: 10px 0 6px;font-size: 17px;line-height: 24px;font-weight: 700}.dlg p{margin: 0;word-break: break-word;color: rgba(var(--ink), .78)}.dlg .hint, .dlg .count{margin-top: 6px;color: rgba(var(--ink), .45);font-size: 12px;line-height: 16px}.choices{display: flex;flex-direction: column;gap: 6px;margin-top: 14px}.dlg button{margin: 0;font: inherit;color: inherit;cursor: pointer;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease}.dlg button:active{transform: scale(.97)}.choice{padding: 10px 12px;border: 0;border-radius: calc(var(--radius) - 6px);text-align: left;color: rgba(var(--ink), .85);background: rgba(var(--ink), .06);box-shadow: inset 0 0 0 1px rgba(var(--ink), .12)}.choice.on{color: var(--fg);background: rgba(var(--accent-rgb), .16);box-shadow: inset 0 0 0 1.5px var(--accent)}.dlg .acts{display: flex;gap: 8px;margin-top: 16px}.dlg .acts button{flex: 1;padding: 11px;border: 0;border-radius: calc(var(--radius) - 6px);font-weight: 650}.dlg .acts .deny{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.dlg .acts .allow{background: var(--accent);color: #fff;box-shadow: 0 6px 18px rgba(var(--accent-rgb), .4)}.dlg button[disabled]{opacity: .45}@keyframes rwd-ping{0%{transform: scale(.6);opacity: .9}100%{transform: scale(1.9);opacity: 0}}@keyframes rwd-glow{0%, 100%{opacity: .22}50%{opacity: 1}}@keyframes rwd-ripple{from{transform: scale(.25);opacity: 1}to{transform: scale(1.6);opacity: 0}}@keyframes rwd-fade{from{opacity: 0}to{opacity: 1}}@keyframes rwd-fade-out{from{opacity: 1}to{opacity: 0}}@keyframes rwd-pop{from{opacity: 0;transform: translateY(10px) scale(.94)}to{opacity: 1;transform: none}}@keyframes rwd-pop-out{from{opacity: 1;transform: none}to{opacity: 0;transform: translateY(6px) scale(.97)}}:host([dir=rtl]) .pill{padding: 7px 9px 7px 12px}:host([dir=rtl]) .win .link{margin-left: 0;margin-right: auto}:host([dir=rtl]) .bar{padding: 7px 18px 7px 7px}:host([dir=rtl]) .task ol{margin: 10px 0 0 -6px;padding: 0 0 0 6px}:host([dir=rtl]) .choice{text-align: right}:host([dir=rtl]) .sw::after{left: auto;right: 2px}:host([dir=rtl]) .sw.on::after{transform: translateX(-12px)}:host([dir=rtl]) .win .k{font-family: var(--font);letter-spacing: 0}:host([dir=rtl]) .btn, :host([dir=rtl]) .bar .status{letter-spacing: 0}.ltr{direction: ltr;unicode-bidi: isolate}@media (prefers-reduced-motion: reduce){.observe .glow, .agent .glow, .observe .dot::after, .agent .dot::after, .task .now .mark::after{animation: none}.observe .glow, .agent .glow{opacity: .9}.pill, .pill.snap, .hl, .win, .bar, .task, .scrim, .dlg{transition: none !important;animation: none !important}}`,xf=` :host{all: initial;display: block;color: inherit;${hf}}*{box-sizing: border-box}.panel{padding: 14px;font: 13px/18px var(--font);color: inherit}.head{display: flex;align-items: center;gap: 8px}.logo{position: relative;width: 22px;height: 22px;border-radius: 6px;flex: none;background: #0b0d12}.logo::after{content: "";position: absolute;inset: 7px;border-radius: 50%;background: var(--accent)}.name{font-weight: 600;font-size: 14px}.status{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;opacity: .8}.dot{width: 8px;height: 8px;border-radius: 50%;background: #8e8e93}.online .dot{background: rgb(var(--success-rgb))}.observe .dot, .agent .dot{background: var(--accent)}.user .dot{background: rgb(var(--warning-rgb))}.card{margin-top: 12px;padding: 12px;border-radius: 10px;border: 1px solid rgba(127, 127, 127, .25);background: rgba(127, 127, 127, .08)}.k{font-size: 12px;opacity: .65}.code{display: flex;align-items: center;gap: 10px;margin-top: 4px}.code b{font: 600 22px/28px var(--mono);letter-spacing: 1px}.state{margin-top: 10px;font-size: 13px}.hint{margin-top: 8px;font-size: 12px;opacity: .65}.acts{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 12px}button{margin: 0;padding: 7px 14px;border: 0;border-radius: 8px;font: 600 13px/18px var(--font);cursor: pointer;-webkit-tap-highlight-color: transparent}.primary{background: var(--accent);color: #fff}.ghost{background: rgba(127, 127, 127, .16);color: inherit}.warn{background: rgb(var(--warning-rgb));color: #0b0d12}.small{padding: 4px 10px;font-size: 12px}${gf}:host([dir=rtl]) .status{margin-left: 0;margin-right: auto}.ltr{direction: ltr;unicode-bidi: isolate}`,Sf=class{constructor(e){this.opts=e,this.winOpen=!1,this.cursorAt=null,this.panel=null,this.control=`none`,this.since=null,this.sinceEl=null,this.ticker=null,this.link=`connecting`,this.code=``,this.help=!1,this.agent=`AI`,this.task=null,this.taskKey=``,this.taskPct=0,this.dragged=!1,this.onClickBound=e=>this.onClick(e),this.dialogs=[],this.t=e.text;let t=document.createElement(`div`);t.id=`__rwd`,t.className=`__chobitsu-hide__`,t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`lang`,rf(e.lang)),t.setAttribute(`dir`,e.dir),t.style.cssText=`all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--rwd-z-index,2147483647);pointer-events:none;`,kf(t,e.style),this.host=t,this.root=t.attachShadow?t.attachShadow({mode:`open`}):t;let n=document.createElement(`style`);n.textContent=bf,this.frame=document.createElement(`div`),this.frame.innerHTML=`<div class="overlay" part="overlay"></div><div class="glow" part="glow"></div><div class="pill" part="pill" data-action="toggle" role="status"></div><div class="win glass" part="window" role="dialog"></div><div class="bar glass" part="bar" role="status"></div><div class="task glass" part="task" data-action="task" role="status"></div><div class="cursor" part="cursor">${_f}</div>`,this.pill=this.frame.querySelector(`.pill`),this.win=this.frame.querySelector(`.win`),this.bar=this.frame.querySelector(`.bar`),this.taskEl=this.frame.querySelector(`.task`),this.cursor=this.frame.querySelector(`.cursor`),this.root.appendChild(n),this.root.appendChild(this.frame),this.root.addEventListener(`click`,e=>this.onClick(e)),window.addEventListener(`load`,()=>this.render());try{window.matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>this.render())}catch(e){}this.taskEl.addEventListener(`click`,e=>this.onClick(e)),this.pill.addEventListener(`click`,e=>this.onClick(e)),this.bindDrag(),window.addEventListener(`resize`,()=>this.place()),this.render()}setText(e,t,n){if(this.t=e,this.opts.lang=t,this.opts.dir=n,this.host.setAttribute(`lang`,rf(t)),this.host.setAttribute(`dir`,n),this.panel){let e=this.panel.getRootNode().host;e&&(e.setAttribute(`lang`,rf(t)),e.setAttribute(`dir`,n))}this.render()}mount(){this.host.isConnected||document.documentElement.appendChild(this.host),this.place()}unmount(){this.host.remove(),this.setTicker(!1)}isOwnControl(e){let t=e.composedPath?e.composedPath():[];for(let e of[this.pill,this.win,this.bar,this.taskEl,this.panel])if(e&&t.indexOf(e)>=0)return!0;for(let e of this.dialogs)if(t.indexOf(e)>=0)return!0;return!1}autoLevel(){let e=X(`localStorage`,ff);return e===`observe`||e===`interact`||e===`advanced`?e:null}lockScreen(){let e=X(`localStorage`,pf);return e===null?this.opts.lockScreen:e===`1`}theme(){let e=this.opts.theme||`auto`;if(e===`light`||e===`dark`)return e;let t=window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;return e===`system`?t:Cf()||`light`}toast(e){let t=document.createElement(`div`);t.className=`toast glass`,t.setAttribute(`part`,`toast`),t.textContent=e,this.frame.appendChild(t),setTimeout(()=>t.remove(),3300)}setHelpButton(e){this.opts.helpButton!==e&&(this.opts.helpButton=e,this.render())}dock(e){let t=document.createElement(`div`);t.className=`__chobitsu-hide__`,t.setAttribute(`lang`,rf(this.opts.lang)),t.setAttribute(`dir`,this.opts.dir),kf(t,this.opts.style);let n=t.attachShadow?t.attachShadow({mode:`open`}):t,r=document.createElement(`style`);r.textContent=xf;let i=document.createElement(`div`);i.className=`panel`,n.appendChild(r),n.appendChild(i),n.addEventListener(`click`,e=>this.onClick(e)),e.appendChild(t),this.panel=i,this.render()}undock(){if(this.panel){let e=this.panel.getRootNode().host||this.panel;e.parentNode&&e.parentNode.removeChild(e)}this.panel=null,this.render()}dialog(e){let t=document.createElement(`div`);t.className=`scrim`;let n=document.createElement(`div`);n.className=`dlg glass`,n.setAttribute(`role`,`dialog`),n.setAttribute(`part`,`dialog`),t.appendChild(n);let r=(e,t,r,i=n)=>{let a=document.createElement(e);return t&&(a.className=t),a.textContent=r,i.appendChild(a),a};r(`span`,`tag`,cf.toUpperCase()),r(`h3`,``,e.title),r(`p`,``,e.text),e.hint&&r(`p`,`hint`,e.hint);let i=e.choice,a=[];if(e.choices&&e.choices.length){let t=r(`div`,`choices`,``);for(let n of e.choices){let e=r(`button`,`choice`,n.label,t);e.type=`button`,e.setAttribute(`data-choice`,n.value),a.push(e)}}let o=r(`p`,`count`,``),s=r(`div`,`acts`,``),c=r(`button`,`deny`,e.cancelText,s),l=r(`button`,`allow`,e.okText,s),u=[c,l].concat(a);for(let e of u)e.type=`button`,e.setAttribute(`part`,`button`),e.disabled=!0;let d=()=>{for(let e of a)e.className=e.getAttribute(`data-choice`)===i?`choice on`:`choice`;if(e.expiresAt===void 0)return;let t=Math.max(0,Math.ceil((e.expiresAt-Date.now())/1e3));o.textContent=this.t.countdown(t)};d();let f=setInterval(d,1e3);e.expiresAt===void 0&&o.remove();let p=setTimeout(()=>{for(let e of u)e.disabled=!1},mf),m=!0,h=()=>{if(!m)return;m=!1,clearInterval(f),clearTimeout(p);let e=this.dialogs.indexOf(t);e>=0&&this.dialogs.splice(e,1),t.classList.add(`out`),setTimeout(()=>t.remove(),190)};return t.addEventListener(`click`,t=>{if(t.stopPropagation(),!t.isTrusted||!m)return;let n=t.target,r=n&&n.closest?n.closest(`button`):null;r&&!r.disabled&&(r.hasAttribute(`data-choice`)?(i=r.getAttribute(`data-choice`)||void 0,d()):(h(),e.onDecide(r===l,i)))}),this.dialogs.push(t),this.frame.appendChild(t),{close:h}}setLink(e,t){this.link=e,t&&(this.code=t),this.render()}setControl(e,t,n){t&&(this.agent=t),this.control=e,this.since=e===`none`?null:n==null?this.since||Date.now():n,this.setTicker(this.since!=null),e===`agent`?this.showCursor():this.cursor.classList.remove(`on`),e===`none`&&(this.task=null),this.render()}setTask(e){this.task=e&&typeof e.title==`string`?e:null,this.task&&this.task.agent&&(this.agent=this.task.agent),this.render()}setHelp(e){this.help=e,this.render()}highlight(e){let t=e.getBoundingClientRect();if(!t.width&&!t.height)return;let n=document.createElement(`div`);n.className=`hl`,n.style.cssText=`left:${t.left}px;top:${t.top}px;width:${t.width}px;height:${t.height}px;`,this.frame.appendChild(n),setTimeout(()=>n.style.opacity=`0`,500),setTimeout(()=>n.remove(),800)}pointer(e,t,n){let r=this.cursor,i=!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),a=this.cursorAt;a&&r.classList.contains(`on`)||(a=a||{x:Math.min(window.innerWidth-24,e+30),y:Math.min(window.innerHeight-12,t+48)},this.placeCursor(a.x,a.y));let o=Math.sqrt((e-a.x)*(e-a.x)+(t-a.y)*(t-a.y)),s=i||o<2?0:Math.round(Math.min(240,Math.max(90,70+o*.35)));return r.style.transition=`transform ${s}ms cubic-bezier(.2, .9, .25, 1), opacity .2s ease`,r.style.transform=`translate3d(${e}px, ${t}px, 0)`,r.classList.add(`on`),this.saveCursor(e,t),new Promise(r=>{setTimeout(()=>{(n===`click`||n===`focus`||n===`select`||n===`drop`)&&this.tap(e,t),r()},s)})}tap(e,t){let n=this.cursor;n.classList.add(`press`),setTimeout(()=>n.classList.remove(`press`),90);let r=document.createElement(`div`);r.className=`ripple`,r.style.left=`${e}px`,r.style.top=`${t}px`,this.frame.appendChild(r),setTimeout(()=>r.remove(),600)}showCursor(){if(this.cursor.classList.contains(`on`))return;let e=this.cursorAt;if(!e)try{let t=JSON.parse(X(`sessionStorage`,uf)||`null`);t&&typeof t.x==`number`&&typeof t.y==`number`&&(e=t)}catch(e){}let t=window.innerWidth,n=window.innerHeight;e=e?{x:Math.min(t-12,Math.max(12,e.x)),y:Math.min(n-12,Math.max(12,e.y))}:{x:t*.5,y:n*.5},this.placeCursor(e.x,e.y),this.cursor.classList.add(`on`),this.saveCursor(e.x,e.y)}placeCursor(e,t){let n=this.cursor;n.style.transition=`none`,n.style.transform=`translate3d(${e}px, ${t}px, 0)`,n.offsetWidth}saveCursor(e,t){this.cursorAt={x:e,y:t},Z(`sessionStorage`,uf,JSON.stringify({x:Math.round(e),y:Math.round(t)}))}render(){this.host.setAttribute(`data-theme`,this.theme()),this.frame.className=`${this.control} ${this.link}${this.lockScreen()?` locked`:``}`;let e=(e,t,n,r,i)=>{let a=document.createElement(e);return t&&(a.className=t),n&&(a.textContent=n),i&&(a.setAttribute(`data-action`,i),a.type=`button`,e===`button`&&a.setAttribute(`part`,`button`),a.addEventListener(`click`,this.onClickBound)),r.appendChild(a),a},t=e=>{for(;e.firstChild;)e.removeChild(e.firstChild)},n=this.control===`none`&&!this.panel;n||(this.winOpen=!1);let r=this.t,i=this.pill;i.className=`pill ${this.control} ${this.link}${n?``:` hidden`}${this.winOpen?` open`:``}${i.classList.contains(`snap`)?` snap`:``}`,t(i),e(`span`,`dot`,``,e(`span`,`logo`,``,i,`toggle`));let a=e(`span`,`lines`,``,i);if(e(`span`,`brand`,cf,a,`toggle`),this.code){let t=e(`span`,`copy`,``,a,`copy`);e(`span`,`ltr`,this.code,t),this.help&&t.appendChild(document.createTextNode(` · ${r.helpPending}`)),t.insertAdjacentHTML(`beforeend`,vf)}else e(`span`,`code`,this.link===`online`?``:r.connecting,a);i.setAttribute(`aria-label`,i.textContent||``);let o=this.win;o.className=`win glass ${this.control} ${this.link}${this.winOpen?` open`:``}`,t(o);let s=e(`div`,`head`,``,o);e(`span`,`dot`,``,e(`span`,`logo`,``,s)),e(`span`,`name`,cf,s);let c=e(`span`,`link`,``,s);e(`span`,`dot`,``,c),e(`span`,``,r.link[this.link],c),e(`div`,`k`,r.deviceCode,o);let l=e(`div`,`codebox`,``,o);e(`span`,`big ltr`,this.code||`—`,l),this.code&&e(`button`,`btn ghost`,r.copy,l,`copy`),e(`div`,`note`,this.help?r.noteHelp:this.autoLevel()?r.noteAuto:r.noteShare,o),this.renderOptions(e,o);let u=e(`div`,`row`,``,o);this.opts.helpButton&&e(`button`,this.help?`btn ghost`:`btn accent`,this.help?r.cancelHelp:r.help,u,`help`),e(`button`,`btn ghost`,r.collapse,u,`toggle`);let d=this.bar;d.className=`bar glass`,t(d);let f=e(`span`,`status`,``,d);e(`span`,`dot`,``,f);let p=e(`span`,`text`,``,f),m=e(`span`,`head`,``,p),h=e(`span`,`acts`,``,d);switch(this.control){case`observe`:e(`span`,`label`,r.barViewing,m),e(`span`,`who`,this.agent,m),e(`button`,`btn light`,r.takeover,h,`takeover`),e(`button`,`btn stop`,r.end,h,`end`);break;case`agent`:e(`span`,`label`,r.barAgent,m),e(`button`,`btn light`,r.takeover,h,`takeover`),e(`button`,`btn stop`,r.end,h,`end`);break;case`user`:e(`span`,`label`,r.barUser,m),e(`button`,`btn accent`,r.handback,h,`handback`),e(`button`,`btn stop`,r.end,h,`end`)}this.sinceEl=this.control===`none`?null:e(`span`,`since`,``,p),this.tick(),d.setAttribute(`aria-label`,d.textContent||``),this.renderTask(e,t),this.renderPanel(e,t),this.place()}setTicker(e){e&&!this.ticker&&(this.ticker=setInterval(()=>this.tick(),1e3)),!e&&this.ticker&&(clearInterval(this.ticker),this.ticker=null)}tick(){let e=this.sinceEl;e&&(e.textContent=this.link===`online`?this.since==null?``:this.t.connectedFor(wf(Date.now()-this.since)):this.t.connecting)}renderOptions(e,t){let n=this.t,r=this.autoLevel(),i=this.lockScreen(),a=e(`div`,`opts`,``,t),o=(t,n,r,i)=>{let o=e(`div`,`opt`,``,a,t);o.setAttribute(`role`,`switch`),o.setAttribute(`aria-checked`,i?`true`:`false`),e(`small`,``,r,e(`span`,`t`,n,o)),e(`span`,i?`sw on`:`sw`,``,o)};o(`auto`,n.autoTitle,r?n.autoOn(n.levels[r]):n.autoOff,!!r),o(`lock`,n.lockTitle,i?n.lockOn:n.lockOff,i)}renderTask(e,t){let n=this.taskEl,r=this.task,i=!!r&&this.control!==`none`,a=X(`sessionStorage`,df)===`1`;if(n.className=`task glass${i?` on`:``}${a?` min`:``}`,!r||!i){this.taskKey=``;return}let o=JSON.stringify([r.title,r.steps,r.current,r.agent||this.agent,a]);if(o===this.taskKey)return;this.taskKey=o,t(n);let s=r.steps.length,c=Math.max(0,Math.min(r.current|0,s)),l=e(`div`,`top`,``,n);if(e(`span`,`tag`,`AGENT`,l),e(`span`,`agent`,r.agent||this.agent,l),s&&e(`span`,`count`,`${Math.min(c+1,s)}/${s}`,l),e(`div`,`title`,r.title,n),s){let t=e(`div`,`fill`,``,e(`div`,`track`,``,n)),i=Math.round(c/s*100);t.style.width=`${this.taskPct}%`,t.offsetWidth,t.style.width=`${i}%`,this.taskPct=i;let o=e(`ol`,``,``,n);r.steps.forEach((t,n)=>{let r=e(`li`,n<c?`done`:n===c?`now`:``,``,o),i=e(`span`,`mark`,``,r);n<c&&(i.innerHTML=yf),e(`span`,``,t,r)});let l=()=>o.classList.toggle(`end`,o.scrollTop+o.clientHeight>=o.scrollHeight-2);if(o.scrollHeight>o.clientHeight+2){o.classList.add(`more`);let e=o.querySelector(`.now`);e&&(o.scrollTop=Math.max(0,e.offsetTop-o.offsetTop-o.clientHeight/2+e.offsetHeight/2)),l(),o.addEventListener(`scroll`,l,{passive:!0})}a&&c<s&&e(`div`,`agent`,`${this.opts.dir===`rtl`?`←`:`→`} ${r.steps[c]}`,n)}}renderPanel(e,t){let n=this.panel;if(!n)return;let r=this.t;n.className=`panel ${this.control} ${this.link}`,t(n);let i=e(`div`,`head`,``,n);e(`span`,`logo`,``,i),e(`span`,`name`,cf,i);let a=e(`span`,`status`,``,i);e(`span`,`dot`,``,a),e(`span`,``,r.link[this.link],a);let o=e(`div`,`card`,``,n);e(`div`,`k`,r.deviceCode,o);let s=e(`div`,`code`,``,o);e(`b`,`ltr`,this.code||`—`,s),this.code&&e(`button`,`ghost small`,r.copy,s,`copy`),e(`div`,`state`,this.task&&this.control!==`none`?`${r.state[this.control]} · ${this.task.title}`:r.state[this.control],o),e(`div`,`hint`,r.noteShare,o);let c=e(`div`,`acts`,``,n);this.control===`agent`?(e(`button`,`primary`,r.takeover,c,`takeover`),e(`button`,`ghost`,r.end,c,`end`)):this.control===`user`?(e(`button`,`primary`,r.handback,c,`handback`),e(`button`,`ghost`,r.end,c,`end`)):this.control===`observe`&&(e(`button`,`primary`,r.takeover,c,`takeover`),e(`button`,`ghost`,r.end,c,`end`)),this.opts.helpButton&&this.control===`none`&&e(`button`,this.help?`ghost`:`warn`,this.help?r.cancelHelp:r.help,c,`help`)}onClick(e){if(!e.isTrusted||this.dragged)return;let t=e.target,n=t&&t.closest?t.closest(`[data-action]`):null;if(!n)return;e.preventDefault(),e.stopPropagation();let r=n.getAttribute(`data-action`);if(r===`help`)this.opts.onHelp(!this.help);else if(r===`auto`)this.toggleAuto();else if(r===`lock`){let e=!this.lockScreen();Z(`localStorage`,pf,e?`1`:`0`),this.toast(e?this.t.lockedToast:this.t.unlockedToast),this.opts.onSettings(),this.render()}else r===`toggle`?(this.winOpen=!this.winOpen,this.render()):r===`task`?(Z(`sessionStorage`,df,X(`sessionStorage`,df)===`1`?null:`1`),this.render()):r===`copy`?(Tf(this.code),n.classList.contains(`copy`)?(n.classList.add(`done`),n.textContent=this.t.copied,setTimeout(()=>this.render(),1200)):(n.textContent=this.t.copied,setTimeout(()=>n.textContent=this.t.copy,1500))):(r===`takeover`||r===`handback`||r===`end`)&&this.opts.onControl(r)}toggleAuto(){let e=this.t;this.autoLevel()?(Z(`localStorage`,ff,null),this.toast(e.autoOffToast),this.opts.onSettings(),this.render()):this.dialog({title:e.autoDialogTitle,text:e.autoDialogText,choices:[`observe`,`interact`].map(t=>({value:t,label:e.levels[t]})),choice:`interact`,okText:e.turnOn,cancelText:e.cancel,onDecide:(t,n)=>{if(!t)return;let r=n===`observe`?`observe`:`interact`;Z(`localStorage`,ff,r),this.toast(e.autoOnToast(e.levels[r])),this.opts.onSettings(),this.render()}})}fitBar(){let e=this.bar;e.classList.remove(`stack`);let t=e.querySelector(`.label`);t&&t.scrollWidth>t.clientWidth+1&&e.classList.add(`stack`)}savedPosition(){try{let e=JSON.parse(X(`localStorage`,lf)||`null`);if(e&&(e.side===`left`||e.side===`right`)&&typeof e.top==`number`)return e}catch(e){}let e=this.opts.style&&this.opts.style.pill;return{side:e&&(e.side===`left`||e.side===`right`)?e.side:this.opts.dir===`rtl`?`left`:`right`,top:e&&typeof e.top==`number`&&e.top>=0&&e.top<=1?e.top:.62}}place(){if(!this.host.isConnected)return;this.fitBar();let{side:e,top:t}=this.savedPosition(),n=this.pill.offsetWidth,r=this.pill.offsetHeight,i=Math.max(Q,window.innerHeight-r-Q),a=Math.min(i,Math.max(Q,t*window.innerHeight)),o=e===`left`?Q:Math.max(Q,window.innerWidth-n-Q);this.pill.style.left=`${o}px`,this.pill.style.top=`${a}px`;let s=this.win.offsetWidth,c=this.win.offsetHeight,l=a+r/2<window.innerHeight/2,u=e===`left`?Q:Math.max(Q,window.innerWidth-s-Q),d=l?Math.min(window.innerHeight-c-Q,a+r+8):Math.max(Q,a-c-8);this.win.style.left=`${u}px`,this.win.style.top=`${d}px`,this.win.style.transformOrigin=`${e===`left`?`left`:`right`} ${l?`top`:`bottom`}`}bindDrag(){this.t;let e=this.pill,t=null,n=!1;e.addEventListener(`pointerdown`,r=>{if(!r.isTrusted||r.target.closest(`button`))return;let i=e.getBoundingClientRect();t={x:r.clientX,y:r.clientY,left:i.left,top:i.top,id:r.pointerId},n=!1,this.dragged=!1,e.classList.remove(`snap`);try{e.setPointerCapture(r.pointerId)}catch(e){}}),e.addEventListener(`pointermove`,r=>{if(!t||r.pointerId!==t.id)return;let i=r.clientX-t.x,a=r.clientY-t.y;!n&&Math.abs(i)+Math.abs(a)<6||(n=!0,e.style.left=`${t.left+i}px`,e.style.top=`${t.top+a}px`)});let r=r=>{if(!t||r.pointerId!==t.id||(t=null,!n))return;n=!1,this.dragged=!0,setTimeout(()=>this.dragged=!1,0);let i=e.getBoundingClientRect(),a=i.left+i.width/2<window.innerWidth/2?`left`:`right`;Z(`localStorage`,lf,JSON.stringify({side:a,top:i.top/window.innerHeight})),e.classList.add(`snap`),this.place()};e.addEventListener(`pointerup`,r),e.addEventListener(`pointercancel`,r)}};function Cf(){for(let e of[document.body,document.documentElement]){if(!e)continue;let t=getComputedStyle(e).backgroundColor.match(/rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?/);if(!(!t||t[4]!==void 0&&Number(t[4])<.5))return(.2126*Number(t[1])+.7152*Number(t[2])+.0722*Number(t[3]))/255>.5?`light`:`dark`}return null}function wf(e){let t=Math.max(0,Math.floor(e/1e3)),n=e=>(e<10?`0`:``)+e,r=Math.floor(t/3600);return(r?r+`:`:``)+n(Math.floor(t/60)%60)+`:`+n(t%60)}function Tf(e){try{if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(e).catch(()=>Ef(e));return}}catch(e){}Ef(e)}function Ef(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;top:-1000px;opacity:0;`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch(e){}t.remove()}function Df(e){let t=e.trim();if(/^\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}$/.test(t))return t;try{let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return null;e.fillStyle=`#000`,e.fillStyle=t;let n=String(e.fillStyle);if(e.fillStyle=`#fff`,e.fillStyle=t,String(e.fillStyle)!==n)return null;let r=n.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(r)return[r[1],r[2],r[3]].map(e=>parseInt(e,16)).join(`, `);let i=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/);return i?`${i[1]}, ${i[2]}, ${i[3]}`:null}catch(e){return null}}function Of(e){return typeof e==`number`?`${e}px`:e}function kf(e,t){if(!t)return;let n=(t,n)=>{n&&e.style.setProperty(t,n)},r=(e,t)=>{typeof t==`string`&&n(e,Df(t))};r(`--rwd-accent-rgb`,t.accent),r(`--rwd-danger-rgb`,t.danger),r(`--rwd-warning-rgb`,t.warning),r(`--rwd-success-rgb`,t.success),typeof t.font==`string`&&n(`--rwd-font`,t.font),typeof t.monoFont==`string`&&n(`--rwd-font-mono`,t.monoFont);for(let[e,r]of[[`radius`,`--rwd-radius`],[`buttonRadius`,`--rwd-button-radius`],[`barBottom`,`--rwd-bar-bottom`],[`taskTop`,`--rwd-task-top`],[`toastBottom`,`--rwd-toast-bottom`]]){let i=t[e];(typeof i==`number`||typeof i==`string`)&&n(r,Of(i))}typeof t.zIndex==`number`&&n(`--rwd-z-index`,String(Math.round(t.zIndex)))}var Af=`https://cdn.jsdelivr.net/npm/eruda`;function jf(e,t){let n=e===!0?{}:e&&typeof e==`object`?e:{},r=e===!0||!!e&&typeof e==`object`,i=(e,i)=>typeof n[e]==`boolean`?n[e]:r&&e===`dock`?i:!!(t&&t[e]);return{dock:e!==!1&&i(`dock`,!0),load:e!==!1&&i(`load`,!1),src:typeof n.src==`string`&&n.src?n.src:Af,name:typeof n.name==`string`&&n.name?n.name:cf}}var Mf=class{constructor(e){this.ui=e,this.loading=!1,this.docked=null}apply(e){e.load&&this.load(e.src),e.dock?this.dock(e.name):this.undock()}load(e){let t=window;if(this.loading||t.eruda)return;this.loading=!0;let n=document.createElement(`script`);n.src=e,n.async=!0,n.onload=()=>{try{t.eruda&&!t.eruda._isInit&&t.eruda.init()}catch(e){}},n.onerror=()=>{this.loading=!1},(document.head||document.documentElement).appendChild(n)}dock(e){if(this.docked===e||this.timer)return;this.docked&&this.undock();let t=0;this.timer=setInterval(()=>{let n=window.eruda;if(++t>120&&this.stopWaiting(),!n||typeof n.add!=`function`||!n._isInit)return;this.stopWaiting();let r=this.ui;try{if(typeof n.get==`function`&&n.get(e))return;n.add({name:e,init(e){this._$el=e;let t=e&&typeof e.get==`function`?e.get(0):e&&e[0];t&&r.dock(t)},show(){return this._$el&&this._$el.show(),this},hide(){return this._$el&&this._$el.hide(),this},destroy(){r.undock()}}),this.docked=e}catch(e){}},500)}undock(){this.stopWaiting();let e=this.docked;if(e){this.docked=null;try{let t=window.eruda;t&&typeof t.remove==`function`&&t.remove(e)}catch(e){}this.ui.undock()}}stopWaiting(){this.timer&&clearInterval(this.timer),this.timer=void 0}},Nf=`pointerdown.pointerup.pointermove.pointerover.pointerout.pointerenter.pointerleave.pointercancel.touchstart.touchmove.touchend.touchcancel.mousedown.mouseup.mousemove.mouseover.mouseout.mouseenter.mouseleave.click.dblclick.auxclick.contextmenu.wheel.keydown.keypress.keyup.beforeinput.dragstart.drop.selectstart.gesturestart.gesturechange.gestureend`.split(`.`);function Pf(e){let t=!1,n=n=>{t&&n.isTrusted&&!e(n)&&(n.cancelable&&n.preventDefault(),n.stopImmediatePropagation())};for(let e of Nf)window.addEventListener(e,n,{capture:!0,passive:!1});return{set(e){if(e&&!t){let e=document.activeElement;e&&e!==document.body&&typeof e.blur==`function`&&e.blur()}t=e},get locked(){return t}}}var Ff=`rwd_launch`,If=300;async function Lf(e){let t=Bf(e)||Bf(await zf());return t?{id:t,source:`app`}:{id:Vf()||Hf(oi()),source:`cookie`}}function Rf(e,t){e.source===`cookie`&&t!==e.id&&Hf(t)}async function zf(){let e=window.RWDLaunchId;if(typeof e!=`function`)return e;try{return await Promise.race([Promise.resolve(e()),new Promise(e=>setTimeout(()=>e(null),If))])}catch(e){return null}}function Bf(e){return typeof e==`number`&&isFinite(e)&&(e=String(e)),typeof e==`string`&&/^[\w.:-]{4,128}$/.test(e)?e:``}function Vf(){try{let e=document.cookie.match(/(?:^|;\s*)rwd_launch=([\w-]{4,64})/);return e?e[1]:``}catch(e){return``}}function Hf(e){try{document.cookie=`${Ff}=${e}; path=/; SameSite=Lax`}catch(e){}return e}var Uf=`0.2.0`,Wf=`rwd:code`,Gf=`rwd:help`,Kf=`rwd:ctl`,qf=`rwd:cfg`,Jf=`rwd:alang`,Yf=12e4,Xf=8e3,$=null,Zf=null,Qf={},$f={start:0,count:0};function ep(e,t){if(!t)return;let n=Date.now(),r=e+`|`+t;if(!(Qf[r]&&n-Qf[r]<2e3)&&(Qf[r]=n,n-$f.start>1e4&&($f={start:n,count:0}),!(++$f.count>30))){for(let e in Qf)n-Qf[e]>1e4&&delete Qf[e];$&&$.transport.send({t:`event`,kind:e,summary:j(t),at:n},!0)}}of(X(`localStorage`,Jf)),_i(ep);function tp(e){return Kd([e.opts.lang].concat(qd()))}function np(e){e.lang=tp(e),sf(e.lang),e.ui.setText(Zd(e.lang).ui,e.lang,Qd(e.lang)),nf(e.lang,e.gatewayUrl)}tf(()=>{$&&np($)});var rp=null,ip=null;function ap(){return rp||(rp=Pf(e=>!!ip&&ip.isOwnControl(e))),rp}ap();var op=null;function sp(){op||(op=Od({onChange:e=>{$&&$.transport.send(P({t:`page`},e))},onTap:e=>{$&&sd($.identity.pageId),ep(`user_tap`,e)}}))}function cp(){let e=navigator.userAgent;return/iPhone|iPad|iPod/.test(e)||/Macintosh/.test(e)&&navigator.maxTouchPoints>1?`ios`:/Android/.test(e)?`android`:`web`}function lp(e){return{ua:navigator.userAgent,platform:cp(),screen:{w:window.screen?screen.width:window.innerWidth,h:window.screen?screen.height:window.innerHeight,dpr:window.devicePixelRatio||1},app:e.app&&e.app.name?{name:String(e.app.name),version:String(e.app.version||``)}:null}}function up(e,t){let n=new URL(e.replace(/\/+$/,``)+`/`,location.href);if(n.protocol!==`https:`&&n.protocol!==`http:`)throw Error(`gatewayUrl must be http(s)`);let r=new URL(`page`,n);return r.protocol=n.protocol===`https:`?`wss:`:`ws:`,r.searchParams.set(`key`,t),{wsUrl:r.href,presenceUrl:new URL(`presence`,n).href}}function dp(){return $?$.transport.state:`idle`}function fp(){return{deviceCode:$?$.deviceCode:null,status:dp()}}function pp(){if(!$)return;let e=$.waiters;$.waiters=[];for(let t of e)t(fp())}function mp(){try{let e=JSON.parse(X(`localStorage`,Kf)||`null`);if(e&&hp(e.s)&&Date.now()-e.at<Yf)return{state:e.s,since:typeof e.since==`number`?e.since:null}}catch(e){}return null}function hp(e){return e===`observe`||e===`agent`}function gp(e){ap().set(hp(e.control)&&e.ui.lockScreen())}function _p(e,t){e.level=t==null?null:gl(t)}function vp(e){return e&&e.agent&&typeof e.agent.name==`string`?e.agent.name:void 0}function yp(e,t,n,r){(t===`user`||t===`none`)&&e.approvals.cancelConfirm(),t===`none`&&(e.level=null),t!==e.control&&R(`control`,{state:t,agent:n||null},!0),t===`none`?e.attachedAt=null:typeof r==`number`&&r>=0?e.attachedAt=Date.now()-r:e.attachedAt==null&&(e.attachedAt=Date.now()),e.control=t,e.ui.setControl(t,n,e.attachedAt),gp(e),Z(`localStorage`,Kf,JSON.stringify({s:t,at:Date.now(),since:e.attachedAt}))}function bp(e){return e.level?e.level:e.control===`none`?null:`interact`}function xp(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Sp(e){return{helpButton:!!e.helpButton,maskSelectors:xp(e.maskSelectors),maskPatterns:Array.isArray(e.maskPatterns)?e.maskPatterns.filter(e=>e&&typeof e.regex==`string`).map(e=>({name:String(e.name||``),regex:e.regex})):[],confirmSelectors:xp(e.confirmSelectors),networkExclude:xp(e.networkExclude),sessionLog:e.sessionLog!==!1,eruda:e.eruda&&typeof e.eruda==`object`?{dock:!!e.eruda.dock,load:!!e.eruda.load}:null}}function Cp(e,t){e.config=t,$n(t?t.maskSelectors:[],t?t.maskPatterns:[]),bl(t?t.confirmSelectors:[]),Oi(xp(e.opts.networkExclude).concat(t?t.networkExclude:[])),t&&!t.sessionLog&&Fr(!0),e.ui.setHelpButton(!!e.opts.helpButton||!!t&&t.helpButton),e.ui.host.isConnected&&e.eruda.apply(jf(e.opts.eruda,t&&t.eruda))}function wp(e){return e.opts.deviceToken||X(`localStorage`,`rwd:dtoken`)||null}function Tp(e){return e===`online`?`online`:e===`polling`||e===`rejected`||e===`quota`?`offline`:`connecting`}async function Ep(e,t){let n;try{let r=hl(t.method),i=bp(e);if(r&&i&&!_l(i,r))throw new cr(`forbidden`,N().needLevel(r));if(e.control===`user`&&Ou.indexOf(t.method)>=0)throw new cr(`takeover`,N().takenOver);t.method===`rwd.click`&&sd(e.identity.pageId);let a=await Gu(t.method,t.params,{highlight:t=>e.ui.highlight(t),pointer:(t,n)=>e.ui.pointer(t.x,t.y,n),confirm:t=>e.approvals.confirm(t)});n={id:t.id,result:a===void 0?{}:a}}catch(e){n={id:t.id,error:lr(e)}}Dp(t.method,t.params,n),$===e&&e.transport.send(n)}function Dp(e,t,n){var r;if(Ou.indexOf(e)<0&&e!==`rwd.evaluate`)return;let i=t&&typeof t==`object`?t:{},a={method:e};for(let e of[`ref`,`fromRef`,`toRef`,`key`,`url`,`values`])i[e]!==void 0&&(a[e]=i[e]);(typeof i.value==`string`||typeof i.text==`string`)&&(a.text=j(String((r=i.value)==null?i.text:r)).slice(0,200)),n.error&&(a.error=`${n.error.code}: ${n.error.message}`),R(`agent`,a,!0)}function Op(e,t){if(typeof t.id==`number`&&typeof t.method==`string`)Ep(e,t);else switch(t.t){case`welcome`:if(typeof t.deviceToken==`string`&&t.deviceToken&&(e.deviceToken=t.deviceToken,Z(`localStorage`,Xu,t.deviceToken)),ud(e.identity.pageId,typeof t.resume==`string`?t.resume:null),typeof t.agentLang==`string`&&(of(t.agentLang,e.gatewayUrl),Z(`localStorage`,Jf,t.agentLang)),e.invite&&(e.invite=null,pd()),t.config&&typeof t.config==`object`){let n=Sp(t.config);Cp(e,n),Z(`localStorage`,qf,JSON.stringify(n))}t.deviceCode&&(e.deviceCode=String(t.deviceCode),Z(`localStorage`,Wf,e.deviceCode)),e.label=t.label||null,e.ui.setLink(`online`,e.deviceCode||void 0),_p(e,t.level==null?t.control&&t.control.level:t.level),yp(e,t.control&&t.control.state||`none`,vp(t.control),t.control&&t.control.attachedMs),e.ui.setTask(t.task||null),Rp(e,!!t.help),pp();break;case`task`:e.ui.setTask(t.task||null);break;case`control`:_p(e,t.level),yp(e,t.state||`none`,vp(t),t.attachedMs);break;case`attach_request`:e.approvals.onAttachRequest(t);break;case`attach_cancel`:e.approvals.onAttachCancel(String(t.requestId));break;case`help`:Rp(e,!!t.on)}}function kp(e,t,n={}){if(Zf)return Zf;if(typeof e!=`string`||!e)return Promise.reject(Error(`RemoteWebviewDebugger.run: gatewayUrl is required`));if(typeof t!=`string`||!t)return Promise.reject(Error(`RemoteWebviewDebugger.run: appKey is required`));let r;try{r=up(e,t)}catch(e){return Promise.reject(e)}let i=fd();sp();let a=od(n.deviceId);n.locales&&$d(n.locales),n.messages&&ef(n.messages);let o=Kd([n.lang].concat(qd()));sf(o);let s=new Sf({lang:o,dir:Qd(o),text:Zd(o).ui,style:n.style,helpButton:!!n.helpButton,lockScreen:n.lockScreen!==!1,theme:n.theme,onSettings:()=>{$&&gp($)},onHelp:e=>zp(e),onControl:e=>{$&&$.transport.send({t:`control`,action:e},!0)}});ip=s;let c={gatewayUrl:e,appKey:t,opts:P({},n),identity:a,lang:o,ui:s,deviceCode:X(`localStorage`,Wf),label:null,control:`none`,attachedAt:null,level:null,help:X(`localStorage`,Gf)===`1`,deviceToken:null,sentToken:null,invite:i,config:null,waiters:[],transport:null,approvals:null,eruda:new Mf(s)};c.deviceToken=wp(c),c.approvals=new hd({ui:s,native:!!n.nativeApproval,send:e=>c.transport.send(e,!0)}),Oi(xp(n.networkExclude));try{let e=JSON.parse(X(`localStorage`,qf)||`null`);e&&typeof e==`object`&&Cp(c,Sp(e))}catch(e){}n.record===!1?Fr(!1):(!c.config||c.config.sessionLog)&&(R(`page`,{event:`open`,url:j(location.href),title:j(document.title),referrer:j(document.referrer)}),Lf(n.launchId).then(e=>Pr(e,a.pageId).then(t=>Rf(e,t))).catch(()=>void 0)),c.transport=new Sd({wsUrl:r.wsUrl,presenceUrl:r.presenceUrl,hello:()=>(c.sentToken=c.deviceToken=wp(c),{t:`hello`,v:1,sdk:Uf,deviceId:c.identity.deviceId,pageId:c.identity.pageId,openerId:c.identity.openerId,userId:c.opts.userId==null?null:String(c.opts.userId),page:Cd(),device:lp(c.opts),help:c.help,deviceToken:c.sentToken,resume:ld(c.identity.pageId),invite:c.invite}),presence:()=>({key:c.appKey,deviceId:c.identity.deviceId,pageId:c.identity.pageId,page:Cd(),device:lp(c.opts),userId:c.opts.userId==null?null:String(c.opts.userId),help:c.help,deviceToken:wp(c)}),onMessage:e=>Op(c,e),onState:e=>{c.ui.setLink(Tp(e),c.deviceCode||void 0),e!==`online`&&c.approvals.cancelConfirm(),(e===`polling`||e===`stopped`||e===`rejected`||e===`quota`)&&c.control!==`none`&&yp(c,`none`),(e===`stopped`||e===`rejected`||e===`quota`)&&pp()},onRejected:()=>{let e=wp(c);return!!e&&e!==c.sentToken},onConflict:()=>dd(c.identity),onPresence:e=>{e.deviceCode&&(c.deviceCode=String(e.deviceCode),Z(`localStorage`,Wf,c.deviceCode),c.ui.setLink(`offline`,c.deviceCode)),pp()}}),$=c,s.setLink(`connecting`,c.deviceCode||void 0),s.setHelp(c.help),s.mount(),nf(o,e),c.eruda.apply(jf(c.opts.eruda,c.config&&c.config.eruda));let l=mp();return l&&(c.attachedAt=l.since,yp(c,l.state),setTimeout(()=>{$===c&&hp(c.control)&&!c.transport.isOnline()&&yp(c,`none`)},Xf)),Zf=new Promise(e=>{c.waiters.push(e),setTimeout(()=>pp(),Xf)}),cd(a).then(()=>{$===c&&c.transport.start()}),Zf}function Ap(e){$&&(R(`page`,{event:`hide`}),Ir(),$.transport.suspend())}function jp(e){$&&e.persisted&&$.transport.resume()}window.addEventListener(`pagehide`,Ap),window.addEventListener(`pageshow`,jp);function Mp(){let e=$;return{deviceCode:e?e.deviceCode:X(`localStorage`,Wf),status:dp(),control:e?e.control:`none`,help:e?e.help:!1,label:e?e.label:null,deviceId:e?e.identity.deviceId:null,pageId:e?e.identity.pageId:null,version:Uf,lang:e?e.lang:null,deviceToken:e?e.deviceToken:X(`localStorage`,Xu),level:e?bp(e):null,config:e?e.config:null,pending:e?e.approvals.pending():null,logSession:Lr()||null}}function Np(){let e=$;e&&($=null,Zf=null,ip=null,e.transport.stop(),e.approvals.destroy(),e.ui.unmount(),ap().set(!1),Pp(e))}function Pp(e){let t=e.waiters;e.waiters=[];for(let n of t)n({deviceCode:e.deviceCode,status:`stopped`})}function Fp(e){let t=$;t&&(t.opts.lang=e||void 0,np(t))}var Ip=Id.slice();function Lp(e){let t=$,n=e==null||e===``?null:String(e);t&&(t.opts.userId==null?null:String(t.opts.userId))!==n&&(t.opts.userId=n,t.transport.state!==`stopped`&&t.transport.restart())}function Rp(e,t){e.help=t,e.ui.setHelp(t),Z(`localStorage`,Gf,t?`1`:null)}function zp(e){let t=$;t&&(Rp(t,!!e),t.transport.send({t:`help`,on:t.help},!1))}function Bp(e=!0){zp(e)}function Vp(e,t){let n=$;return!n||!Up(n,e)||t!==`takeover`&&t!==`handback`&&t!==`end`?!1:(n.transport.send({t:`control`,action:t},!0),!0)}function Hp(e,t,n){let r=$;return!r||!Up(r,e)||typeof t!=`string`?!1:r.approvals.decide(t,n==null?null:String(n))}function Up(e,t){let n=e.opts.nativeKey;if(!n||typeof t!=`string`||t.length!==n.length)return!1;let r=0;for(let e=0;e<t.length;e++)r|=t.charCodeAt(e)^n.charCodeAt(e);return r===0}return e.builtinLocales=Ip,e.getStatus=Mp,e.status=Mp,e.help=Bp,e.nativeControl=Vp,e.nativeDecide=Hp,e.registerLocale=$d,e.run=kp,e.setLang=Fp,e.setUser=Lp,e.stop=Np,e.version=Uf,e})({});
|
|
41
|
+
</svg>`,yf=`<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="5" y="5" width="8.5" height="8.5" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M3.5 10.5V4a1.5 1.5 0 0 1 1.5-1.5h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>`,bf=`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8.4 6.8 11 12 5.6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,xf=` :host{all: initial;${gf}--ink: 255, 255, 255;--paper: 12, 14, 20;--fg: #fff;--solid-bg: #fff;--solid-fg: #0b0d12;--track: rgba(var(--ink), .2)}${_f}:host([data-theme=light]){--ink: 11, 13, 18;--paper: 255, 255, 255;--fg: #0b0d12;--solid-bg: #0b0d12;--solid-fg: #fff;--track: rgba(11, 13, 18, .16)}*{box-sizing: border-box}.glass{background: rgba(var(--paper), .9);color: var(--fg);border: 1px solid rgba(var(--ink), .1);box-shadow: 0 12px 32px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(var(--ink), .06);-webkit-backdrop-filter: blur(18px) saturate(1.5);backdrop-filter: blur(18px) saturate(1.5)}.win.glass, .dlg.glass, .task.glass{background: rgba(var(--paper), .96)}.pill, .bar, .btn{font: 500 12px/16px var(--font)}.pill{position: fixed;z-index: 3;top: 0;left: 0;display: flex;align-items: center;gap: 8px;max-width: calc(100vw - 16px);padding: 7px 12px 7px 8px;border-radius: 999px;white-space: nowrap;background: rgba(var(--paper), .55);color: var(--fg);border: 1px solid rgba(var(--ink), .14);box-shadow: 0 8px 24px rgba(0, 0, 0, .18);-webkit-backdrop-filter: blur(16px) saturate(1.6);backdrop-filter: blur(16px) saturate(1.6);pointer-events: auto;touch-action: none;cursor: pointer;user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .2, 1), background .2s ease}.pill:active{transform: scale(.97)}.pill.open{background: rgba(var(--paper), .85)}.pill.hidden{opacity: 0;transform: scale(.9);pointer-events: none;visibility: hidden;transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s}.pill.snap{transition: left .22s cubic-bezier(.2, .9, .2, 1), top .22s cubic-bezier(.2, .9, .2, 1), opacity .22s ease, transform .22s ease}.logo{position: relative;flex: none;width: 18px;height: 18px;border-radius: 6px;background: #0b0d12;box-shadow: inset 0 0 0 1px rgba(var(--ink), .18)}.logo .dot{position: absolute;left: 5px;top: 5px}.brand{font-weight: 650;letter-spacing: .2px}.win{position: fixed;z-index: 3;width: min(calc(100vw - 16px), 300px);padding: 14px;border-radius: var(--radius);font: 13px/18px var(--font);pointer-events: auto;opacity: 0;visibility: hidden;transform: scale(.92) translateY(6px);transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .24s}.win.open{opacity: 1;visibility: visible;transform: none;transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1)}.win .head{display: flex;align-items: center;gap: 8px}.win .name{font-weight: 700;font-size: 14px}.win .link{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;color: rgba(var(--ink), .6)}.win .k{margin-top: 14px;font: 600 10px/14px var(--mono);letter-spacing: 1px;text-transform: uppercase;color: rgba(var(--ink), .45)}.win .codebox{display: flex;align-items: center;gap: 10px;margin-top: 4px}.win .big{font: 700 24px/30px var(--mono);letter-spacing: 1.5px}.win .note{margin-top: 10px;font-size: 12px;line-height: 17px;color: rgba(var(--ink), .55)}.win .row{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 14px}.win .row .btn{flex: 1 0 0;min-width: max-content;text-align: center;white-space: nowrap}.code{font: 500 12px/16px var(--mono);letter-spacing: .5px;color: rgba(var(--ink), .7)}.pill{border-radius: calc(var(--radius) - 2px);padding: 7px 12px 7px 9px;gap: 9px}.pill .lines{display: flex;flex-direction: column;gap: 1px;min-width: 0}.pill .brand{font-size: 12px;line-height: 16px;cursor: pointer}.pill .copy, .pill .logo{cursor: pointer}.pill .copy{display: inline-flex;align-items: center;gap: 5px;margin: 0 -4px;padding: 1px 4px;border-radius: 6px;font: 600 12px/16px var(--mono);letter-spacing: .6px;color: rgba(var(--ink), .78);transition: background .15s ease, color .15s ease}.pill .copy:active{background: rgba(var(--ink), .14)}.pill .copy svg{width: 12px;height: 12px;opacity: .7}.pill .copy.done{color: rgb(var(--success-rgb))}.win .opts{margin-top: 12px;border-radius: calc(var(--radius) - 8px);background: rgba(var(--ink), .05);box-shadow: inset 0 0 0 1px rgba(var(--ink), .08)}.win .opt{display: flex;align-items: center;gap: 10px;padding: 8px 10px;cursor: pointer;-webkit-tap-highlight-color: transparent}.win .opt + .opt{border-top: 1px solid rgba(var(--ink), .08)}.win .opt .t{flex: 1;min-width: 0;font-size: 12px;line-height: 16px;font-weight: 600}.win .opt small{display: block;margin-top: 1px;font-size: 10.5px;line-height: 14px;font-weight: 400;color: rgba(var(--ink), .5)}.sw{position: relative;flex: none;width: 30px;height: 18px;border-radius: 999px;background: var(--track);transition: background .2s ease}.sw::after{content: "";position: absolute;top: 2px;left: 2px;width: 14px;height: 14px;border-radius: 50%;background: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, .3);transition: transform .22s cubic-bezier(.2, .9, .2, 1)}.sw.on{background: var(--accent)}.sw.on::after{transform: translateX(12px)}.toast{position: fixed;z-index: 4;left: 50%;bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-toast-bottom, 84px));max-width: calc(100vw - 32px);padding: 10px 16px;border-radius: var(--button-radius);font: 600 13px/18px var(--font);pointer-events: none;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;animation: rwd-toast 3.2s cubic-bezier(.2, .9, .2, 1) both}@keyframes rwd-toast{0%{opacity: 0;transform: translate(-50%, 12px) scale(.96)}8%, 88%{opacity: 1;transform: translate(-50%, 0)}100%{opacity: 0;transform: translate(-50%, 6px)}}.dot{position: relative;flex: none;width: 8px;height: 8px;border-radius: 50%;background: #6b7280}.online .dot{background: rgb(var(--success-rgb))}.observe .dot{background: var(--accent)}.agent .dot{background: var(--accent)}.observe .dot::after, .agent .dot::after, .task .now .mark::after{content: "";position: absolute;inset: -4px;border-radius: 50%;border: 2px solid var(--accent);animation: rwd-ping 1.4s cubic-bezier(.2, .6, .3, 1) infinite}.user .dot{background: rgb(var(--warning-rgb))}.btn{flex: none;margin: 0;padding: 7px 14px;border: 0;border-radius: var(--button-radius);font-weight: 600;letter-spacing: .2px;cursor: pointer;pointer-events: auto;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease}.btn:active{transform: scale(.96)}.btn.light{background: var(--solid-bg);color: var(--solid-fg)}.btn.accent{background: var(--accent);color: #fff}.btn.ghost{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.btn.stop{background: rgb(var(--danger-rgb));color: #fff;box-shadow: 0 6px 16px rgba(var(--danger-rgb), .35)}.btn.help{background: rgb(var(--warning-rgb));color: #0b0d12;padding: 4px 10px}.btn.help.on{background: rgba(var(--warning-rgb), .18);color: #fcd34d}.bar{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-bar-bottom, 14px));display: flex;align-items: center;gap: 12px;padding: 7px 7px 7px 18px;border-radius: var(--button-radius);white-space: nowrap;pointer-events: none;max-width: calc(100vw - 24px);user-select: none;-webkit-user-select: none;opacity: 0;visibility: hidden;transform: translate(-50%, 18px) scale(.96);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.observe .bar, .agent .bar, .user .bar{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.bar .status{display: flex;align-items: center;gap: 10px;min-width: 0;font-size: 14px;font-weight: 650;letter-spacing: .3px}.bar .text{display: flex;flex-direction: column;min-width: 0;overflow: hidden}.bar .head{display: flex;align-items: baseline;gap: 10px;min-width: 0}.bar .since{overflow: hidden;text-overflow: ellipsis;font-size: 12px;line-height: 16px;font-weight: 500;font-variant-numeric: tabular-nums;color: rgba(var(--ink), .55)}.bar .label{flex: none;max-width: 100%;overflow: hidden;text-overflow: ellipsis}.bar.stack{flex-wrap: wrap;justify-content: center;row-gap: 8px;width: calc(100vw - 24px);padding: 10px 7px 7px;border-radius: min(var(--button-radius), 26px)}.bar.stack .status{flex: 1 0 100%;justify-content: center}.bar.stack .acts{flex: 1 0 100%}.bar.stack .acts .btn{flex: 1}.bar .who{color: rgba(var(--ink), .5);font-weight: 500;overflow: hidden;text-overflow: ellipsis;max-width: 96px}.bar .acts{display: flex;gap: 8px}.bar .btn{min-width: 78px;min-height: 46px;padding: 12px 22px;font-size: 15px;line-height: 20px;font-weight: 700;text-align: center}.task{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);top: calc(env(safe-area-inset-top, 0px) + var(--rwd-task-top, 10px));width: min(calc(100vw - 24px), 380px);padding: 12px 14px 12px;border-radius: calc(var(--radius) - 2px);pointer-events: none;cursor: pointer;font: 13px/18px var(--font);user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;opacity: 0;visibility: hidden;transform: translate(-50%, -14px) scale(.97);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.task.on{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.task li{transition: color .25s ease}.task .mark{transition: background .25s ease, box-shadow .25s ease}.task .top{display: flex;align-items: center;gap: 8px}.task .tag{flex: none;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.task .agent{flex: 1;min-width: 0;color: rgba(var(--ink), .5);font-size: 12px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}.task .count{flex: none;font: 600 12px/16px var(--mono);color: rgba(var(--ink), .6)}.task .title{margin-top: 8px;font-size: 16px;line-height: 22px;font-weight: 700;letter-spacing: .2px}.task .track{margin-top: 8px;height: 3px;border-radius: 3px;background: rgba(var(--ink), .1);overflow: hidden}.task .fill{height: 100%;width: 0;background: var(--accent);box-shadow: 0 0 8px var(--accent);transition: width .35s cubic-bezier(.2, .9, .2, 1)}.task ol{list-style: none;margin: 4px -6px -6px -8px;padding: 6px 6px 6px 8px;max-height: min(26vh, 146px);overflow-y: auto;overscroll-behavior: contain;-webkit-overflow-scrolling: touch;touch-action: pan-y;scrollbar-width: thin}.task ol.more{-webkit-mask-image: linear-gradient(#000 82%, transparent);mask-image: linear-gradient(#000 82%, transparent)}.task ol.more.end{-webkit-mask-image: none;mask-image: none}.task li{display: flex;align-items: flex-start;gap: 10px;padding: 4px 0;color: rgba(var(--ink), .42)}.task .mark{position: relative;flex: none;width: 16px;height: 16px;margin-top: 1px;border-radius: 50%;box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .25)}.task .done{color: rgba(var(--ink), .62)}.task .done .mark{background: var(--accent);box-shadow: none;color: #fff}.task .done .mark svg{width: 16px;height: 16px;display: block}.task .now{color: var(--fg);font-weight: 600}.task .now .mark{box-shadow: inset 0 0 0 2px var(--accent)}.task .now .mark::before{content: "";position: absolute;inset: 4px;border-radius: 50%;background: var(--accent)}.task.min ol{display: none}.task.min .title{font-size: 14px;line-height: 20px}.overlay{position: fixed;z-index: 1;top: 0;right: 0;bottom: 0;left: 0;display: none;background: transparent;pointer-events: auto;touch-action: none}.glow{position: fixed;z-index: 2;pointer-events: none;display: none;top: 0;right: 0;bottom: 0;left: 0}.observe.locked .overlay, .agent.locked .overlay{display: block}.observe .glow, .agent .glow{display: block;box-shadow: inset 0 0 0 5px rgba(var(--accent-rgb), .95), inset 0 0 36px 14px rgba(var(--accent-rgb), .8), inset 0 0 140px 56px rgba(var(--accent-rgb), .42);animation: rwd-glow 1.9s ease-in-out infinite}.user .glow{display: block;box-shadow: inset 0 0 0 3px rgba(var(--warning-rgb), .9), inset 0 0 18px 4px rgba(var(--warning-rgb), .3)}.cursor{position: fixed;z-index: 3;top: 0;left: 0;width: 0;height: 0;pointer-events: none;opacity: 0;will-change: transform;transition: opacity .2s ease}.cursor.on{opacity: 1}.cursor .arrow{position: absolute;left: -2px;top: -2px;width: 26px;height: 26px;overflow: visible;filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)) drop-shadow(0 0 12px rgba(var(--accent-rgb), .45));transform-origin: 2px 2px;transition: transform .09s ease-out}.cursor.press .arrow{transform: scale(.82)}.ripple{position: fixed;z-index: 3;width: 40px;height: 40px;margin: -20px 0 0 -20px;border-radius: 50%;border: 2px solid var(--accent);background: rgba(var(--accent-rgb), .16);pointer-events: none;animation: rwd-ripple .45s cubic-bezier(.2, .7, .3, 1) forwards}.hl{position: fixed;z-index: 2;pointer-events: none;border-radius: 6px;outline: 2px solid rgba(var(--accent-rgb), .9);outline-offset: 2px;background: rgba(var(--accent-rgb), .08);transition: opacity .25s ease}.scrim{position: fixed;z-index: 4;top: 0;right: 0;bottom: 0;left: 0;display: flex;align-items: center;justify-content: center;padding: 20px;background: rgba(4, 6, 10, .46);pointer-events: auto;touch-action: none;-webkit-backdrop-filter: blur(3px);backdrop-filter: blur(3px);animation: rwd-fade .2s ease both}.scrim.out{animation: rwd-fade-out .18s ease both;pointer-events: none}.dlg{width: 100%;max-width: 330px;padding: 18px 16px 14px;border-radius: calc(var(--radius) + 2px);font: 14px/20px var(--font);user-select: none;-webkit-user-select: none;animation: rwd-pop .26s cubic-bezier(.2, .9, .2, 1) both}.scrim.out .dlg{animation: rwd-pop-out .18s ease both}.dlg .tag{display: inline-block;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.dlg h3{margin: 10px 0 6px;font-size: 17px;line-height: 24px;font-weight: 700}.dlg p{margin: 0;word-break: break-word;color: rgba(var(--ink), .78)}.dlg .hint, .dlg .count{margin-top: 6px;color: rgba(var(--ink), .45);font-size: 12px;line-height: 16px}.choices{display: flex;flex-direction: column;gap: 6px;margin-top: 14px}.dlg button{margin: 0;font: inherit;color: inherit;cursor: pointer;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease}.dlg button:active{transform: scale(.97)}.choice{padding: 10px 12px;border: 0;border-radius: calc(var(--radius) - 6px);text-align: left;color: rgba(var(--ink), .85);background: rgba(var(--ink), .06);box-shadow: inset 0 0 0 1px rgba(var(--ink), .12)}.choice.on{color: var(--fg);background: rgba(var(--accent-rgb), .16);box-shadow: inset 0 0 0 1.5px var(--accent)}.dlg .acts{display: flex;gap: 8px;margin-top: 16px}.dlg .acts button{flex: 1;padding: 11px;border: 0;border-radius: calc(var(--radius) - 6px);font-weight: 650}.dlg .acts .deny{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.dlg .acts .allow{background: var(--accent);color: #fff;box-shadow: 0 6px 18px rgba(var(--accent-rgb), .4)}.dlg button[disabled]{opacity: .45}@keyframes rwd-ping{0%{transform: scale(.6);opacity: .9}100%{transform: scale(1.9);opacity: 0}}@keyframes rwd-glow{0%, 100%{opacity: .22}50%{opacity: 1}}@keyframes rwd-ripple{from{transform: scale(.25);opacity: 1}to{transform: scale(1.6);opacity: 0}}@keyframes rwd-fade{from{opacity: 0}to{opacity: 1}}@keyframes rwd-fade-out{from{opacity: 1}to{opacity: 0}}@keyframes rwd-pop{from{opacity: 0;transform: translateY(10px) scale(.94)}to{opacity: 1;transform: none}}@keyframes rwd-pop-out{from{opacity: 1;transform: none}to{opacity: 0;transform: translateY(6px) scale(.97)}}:host([dir=rtl]) .pill{padding: 7px 9px 7px 12px}:host([dir=rtl]) .win .link{margin-left: 0;margin-right: auto}:host([dir=rtl]) .bar{padding: 7px 18px 7px 7px}:host([dir=rtl]) .task ol{margin: 4px -8px -6px -6px;padding: 6px 8px 6px 6px}:host([dir=rtl]) .choice{text-align: right}:host([dir=rtl]) .sw::after{left: auto;right: 2px}:host([dir=rtl]) .sw.on::after{transform: translateX(-12px)}:host([dir=rtl]) .win .k{font-family: var(--font);letter-spacing: 0}:host([dir=rtl]) .btn, :host([dir=rtl]) .bar .status{letter-spacing: 0}.ltr{direction: ltr;unicode-bidi: isolate}@media (prefers-reduced-motion: reduce){.observe .glow, .agent .glow, .observe .dot::after, .agent .dot::after, .task .now .mark::after{animation: none}.observe .glow, .agent .glow{opacity: .9}.pill, .pill.snap, .hl, .win, .bar, .task, .scrim, .dlg{transition: none !important;animation: none !important}}`,Sf=` :host{all: initial;display: block;color: inherit;${gf}}*{box-sizing: border-box}.panel{padding: 14px;font: 13px/18px var(--font);color: inherit}.head{display: flex;align-items: center;gap: 8px}.logo{position: relative;width: 22px;height: 22px;border-radius: 6px;flex: none;background: #0b0d12}.logo::after{content: "";position: absolute;inset: 7px;border-radius: 50%;background: var(--accent)}.name{font-weight: 600;font-size: 14px}.status{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;opacity: .8}.dot{width: 8px;height: 8px;border-radius: 50%;background: #8e8e93}.online .dot{background: rgb(var(--success-rgb))}.observe .dot, .agent .dot{background: var(--accent)}.user .dot{background: rgb(var(--warning-rgb))}.card{margin-top: 12px;padding: 12px;border-radius: 10px;border: 1px solid rgba(127, 127, 127, .25);background: rgba(127, 127, 127, .08)}.k{font-size: 12px;opacity: .65}.code{display: flex;align-items: center;gap: 10px;margin-top: 4px}.code b{font: 600 22px/28px var(--mono);letter-spacing: 1px}.state{margin-top: 10px;font-size: 13px}.hint{margin-top: 8px;font-size: 12px;opacity: .65}.acts{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 12px}button{margin: 0;padding: 7px 14px;border: 0;border-radius: 8px;font: 600 13px/18px var(--font);cursor: pointer;-webkit-tap-highlight-color: transparent}.primary{background: var(--accent);color: #fff}.ghost{background: rgba(127, 127, 127, .16);color: inherit}.warn{background: rgb(var(--warning-rgb));color: #0b0d12}.small{padding: 4px 10px;font-size: 12px}${_f}:host([dir=rtl]) .status{margin-left: 0;margin-right: auto}.ltr{direction: ltr;unicode-bidi: isolate}`,Cf=class{constructor(e){this.opts=e,this.winOpen=!1,this.cursorAt=null,this.panel=null,this.control=`none`,this.since=null,this.sinceEl=null,this.ticker=null,this.link=`connecting`,this.code=``,this.help=!1,this.agent=`AI`,this.task=null,this.taskKey=``,this.taskPct=0,this.dragged=!1,this.onClickBound=e=>this.onClick(e),this.dialogs=[],this.t=e.text;let t=document.createElement(`div`);t.id=`__rwd`,t.className=`__chobitsu-hide__`,t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`lang`,af(e.lang)),t.setAttribute(`dir`,e.dir),t.style.cssText=`all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--rwd-z-index,2147483647);pointer-events:none;`,Af(t,e.style),this.host=t,this.root=t.attachShadow?t.attachShadow({mode:`open`}):t;let n=document.createElement(`style`);n.textContent=xf,this.frame=document.createElement(`div`),this.frame.innerHTML=`<div class="overlay" part="overlay"></div><div class="glow" part="glow"></div><div class="pill" part="pill" data-action="toggle" role="status"></div><div class="win glass" part="window" role="dialog"></div><div class="bar glass" part="bar" role="status"></div><div class="task glass" part="task" data-action="task" role="status"></div><div class="cursor" part="cursor">${vf}</div>`,this.pill=this.frame.querySelector(`.pill`),this.win=this.frame.querySelector(`.win`),this.bar=this.frame.querySelector(`.bar`),this.taskEl=this.frame.querySelector(`.task`),this.cursor=this.frame.querySelector(`.cursor`),this.root.appendChild(n),this.root.appendChild(this.frame),this.root.addEventListener(`click`,e=>this.onClick(e)),window.addEventListener(`load`,()=>this.render());try{window.matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>this.render())}catch(e){}this.taskEl.addEventListener(`click`,e=>this.onClick(e)),this.pill.addEventListener(`click`,e=>this.onClick(e)),this.bindDrag(),window.addEventListener(`resize`,()=>this.place()),this.render()}setText(e,t,n){if(this.t=e,this.opts.lang=t,this.opts.dir=n,this.host.setAttribute(`lang`,af(t)),this.host.setAttribute(`dir`,n),this.panel){let e=this.panel.getRootNode().host;e&&(e.setAttribute(`lang`,af(t)),e.setAttribute(`dir`,n))}this.render()}mount(){this.host.isConnected||document.documentElement.appendChild(this.host),this.place()}unmount(){this.host.remove(),this.setTicker(!1)}isOwnControl(e){let t=e.composedPath?e.composedPath():[];for(let e of[this.pill,this.win,this.bar,this.taskEl,this.panel])if(e&&t.indexOf(e)>=0)return!0;for(let e of this.dialogs)if(t.indexOf(e)>=0)return!0;return!1}autoLevel(){let e=X(`localStorage`,pf);return e===`observe`||e===`interact`||e===`advanced`?e:null}lockScreen(){let e=X(`localStorage`,mf);return e===null?this.opts.lockScreen:e===`1`}theme(){let e=this.opts.theme||`auto`;if(e===`light`||e===`dark`)return e;let t=window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;return e===`system`?t:wf()||`light`}toast(e){let t=document.createElement(`div`);t.className=`toast glass`,t.setAttribute(`part`,`toast`),t.textContent=e,this.frame.appendChild(t),setTimeout(()=>t.remove(),3300)}setHelpButton(e){this.opts.helpButton!==e&&(this.opts.helpButton=e,this.render())}dock(e){let t=document.createElement(`div`);t.className=`__chobitsu-hide__`,t.setAttribute(`lang`,af(this.opts.lang)),t.setAttribute(`dir`,this.opts.dir),Af(t,this.opts.style);let n=t.attachShadow?t.attachShadow({mode:`open`}):t,r=document.createElement(`style`);r.textContent=Sf;let i=document.createElement(`div`);i.className=`panel`,n.appendChild(r),n.appendChild(i),n.addEventListener(`click`,e=>this.onClick(e)),e.appendChild(t),this.panel=i,this.render()}undock(){if(this.panel){let e=this.panel.getRootNode().host||this.panel;e.parentNode&&e.parentNode.removeChild(e)}this.panel=null,this.render()}dialog(e){let t=document.createElement(`div`);t.className=`scrim`;let n=document.createElement(`div`);n.className=`dlg glass`,n.setAttribute(`role`,`dialog`),n.setAttribute(`part`,`dialog`),t.appendChild(n);let r=(e,t,r,i=n)=>{let a=document.createElement(e);return t&&(a.className=t),a.textContent=r,i.appendChild(a),a};r(`span`,`tag`,lf.toUpperCase()),r(`h3`,``,e.title),r(`p`,``,e.text),e.hint&&r(`p`,`hint`,e.hint);let i=e.choice,a=[];if(e.choices&&e.choices.length){let t=r(`div`,`choices`,``);for(let n of e.choices){let e=r(`button`,`choice`,n.label,t);e.type=`button`,e.setAttribute(`data-choice`,n.value),a.push(e)}}let o=r(`p`,`count`,``),s=r(`div`,`acts`,``),c=r(`button`,`deny`,e.cancelText,s),l=r(`button`,`allow`,e.okText,s),u=[c,l].concat(a);for(let e of u)e.type=`button`,e.setAttribute(`part`,`button`),e.disabled=!0;let d=()=>{for(let e of a)e.className=e.getAttribute(`data-choice`)===i?`choice on`:`choice`;if(e.expiresAt===void 0)return;let t=Math.max(0,Math.ceil((e.expiresAt-Date.now())/1e3));o.textContent=this.t.countdown(t)};d();let f=setInterval(d,1e3);e.expiresAt===void 0&&o.remove();let p=setTimeout(()=>{for(let e of u)e.disabled=!1},hf),m=!0,h=()=>{if(!m)return;m=!1,clearInterval(f),clearTimeout(p);let e=this.dialogs.indexOf(t);e>=0&&this.dialogs.splice(e,1),t.classList.add(`out`),setTimeout(()=>t.remove(),190)};return t.addEventListener(`click`,t=>{if(t.stopPropagation(),!t.isTrusted||!m)return;let n=t.target,r=n&&n.closest?n.closest(`button`):null;r&&!r.disabled&&(r.hasAttribute(`data-choice`)?(i=r.getAttribute(`data-choice`)||void 0,d()):(h(),e.onDecide(r===l,i)))}),this.dialogs.push(t),this.frame.appendChild(t),{close:h}}setLink(e,t){this.link=e,t&&(this.code=t),this.render()}setControl(e,t,n){t&&(this.agent=t),this.control=e,this.since=e===`none`?null:n==null?this.since||Date.now():n,this.setTicker(this.since!=null),e===`agent`?this.showCursor():this.cursor.classList.remove(`on`),e===`none`&&(this.task=null),this.render()}setTask(e){this.task=e&&typeof e.title==`string`?e:null,this.task&&this.task.agent&&(this.agent=this.task.agent),this.render()}setHelp(e){this.help=e,this.render()}highlight(e){let t=e.getBoundingClientRect();if(!t.width&&!t.height)return;let n=document.createElement(`div`);n.className=`hl`,n.style.cssText=`left:${t.left}px;top:${t.top}px;width:${t.width}px;height:${t.height}px;`,this.frame.appendChild(n),setTimeout(()=>n.style.opacity=`0`,500),setTimeout(()=>n.remove(),800)}pointer(e,t,n){let r=this.cursor,i=!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),a=this.cursorAt;a&&r.classList.contains(`on`)||(a=a||{x:Math.min(window.innerWidth-24,e+30),y:Math.min(window.innerHeight-12,t+48)},this.placeCursor(a.x,a.y));let o=Math.sqrt((e-a.x)*(e-a.x)+(t-a.y)*(t-a.y)),s=i||o<2?0:Math.round(Math.min(240,Math.max(90,70+o*.35)));return r.style.transition=`transform ${s}ms cubic-bezier(.2, .9, .25, 1), opacity .2s ease`,r.style.transform=`translate3d(${e}px, ${t}px, 0)`,r.classList.add(`on`),this.saveCursor(e,t),new Promise(r=>{setTimeout(()=>{(n===`click`||n===`focus`||n===`select`||n===`drop`)&&this.tap(e,t),r()},s)})}tap(e,t){let n=this.cursor;n.classList.add(`press`),setTimeout(()=>n.classList.remove(`press`),90);let r=document.createElement(`div`);r.className=`ripple`,r.style.left=`${e}px`,r.style.top=`${t}px`,this.frame.appendChild(r),setTimeout(()=>r.remove(),600)}showCursor(){if(this.cursor.classList.contains(`on`))return;let e=this.cursorAt;if(!e)try{let t=JSON.parse(X(`sessionStorage`,df)||`null`);t&&typeof t.x==`number`&&typeof t.y==`number`&&(e=t)}catch(e){}let t=window.innerWidth,n=window.innerHeight;e=e?{x:Math.min(t-12,Math.max(12,e.x)),y:Math.min(n-12,Math.max(12,e.y))}:{x:t*.5,y:n*.5},this.placeCursor(e.x,e.y),this.cursor.classList.add(`on`),this.saveCursor(e.x,e.y)}placeCursor(e,t){let n=this.cursor;n.style.transition=`none`,n.style.transform=`translate3d(${e}px, ${t}px, 0)`,n.offsetWidth}saveCursor(e,t){this.cursorAt={x:e,y:t},Z(`sessionStorage`,df,JSON.stringify({x:Math.round(e),y:Math.round(t)}))}render(){this.host.setAttribute(`data-theme`,this.theme()),this.frame.className=`${this.control} ${this.link}${this.lockScreen()?` locked`:``}`;let e=(e,t,n,r,i)=>{let a=document.createElement(e);return t&&(a.className=t),n&&(a.textContent=n),i&&(a.setAttribute(`data-action`,i),a.type=`button`,e===`button`&&a.setAttribute(`part`,`button`),a.addEventListener(`click`,this.onClickBound)),r.appendChild(a),a},t=e=>{for(;e.firstChild;)e.removeChild(e.firstChild)},n=this.control===`none`&&!this.panel;n||(this.winOpen=!1);let r=this.t,i=this.pill;i.className=`pill ${this.control} ${this.link}${n?``:` hidden`}${this.winOpen?` open`:``}${i.classList.contains(`snap`)?` snap`:``}`,t(i),e(`span`,`dot`,``,e(`span`,`logo`,``,i,`toggle`));let a=e(`span`,`lines`,``,i);if(e(`span`,`brand`,lf,a,`toggle`),this.code){let t=e(`span`,`copy`,``,a,`copy`);e(`span`,`ltr`,this.code,t),this.help&&t.appendChild(document.createTextNode(` · ${r.helpPending}`)),t.insertAdjacentHTML(`beforeend`,yf)}else e(`span`,`code`,this.link===`online`?``:r.connecting,a);i.setAttribute(`aria-label`,i.textContent||``);let o=this.win;o.className=`win glass ${this.control} ${this.link}${this.winOpen?` open`:``}`,t(o);let s=e(`div`,`head`,``,o);e(`span`,`dot`,``,e(`span`,`logo`,``,s)),e(`span`,`name`,lf,s);let c=e(`span`,`link`,``,s);e(`span`,`dot`,``,c),e(`span`,``,r.link[this.link],c),e(`div`,`k`,r.deviceCode,o);let l=e(`div`,`codebox`,``,o);e(`span`,`big ltr`,this.code||`—`,l),this.code&&e(`button`,`btn ghost`,r.copy,l,`copy`),e(`div`,`note`,this.help?r.noteHelp:this.autoLevel()?r.noteAuto:r.noteShare,o),this.renderOptions(e,o);let u=e(`div`,`row`,``,o);this.opts.helpButton&&e(`button`,this.help?`btn ghost`:`btn accent`,this.help?r.cancelHelp:r.help,u,`help`),e(`button`,`btn ghost`,r.collapse,u,`toggle`);let d=this.bar;d.className=`bar glass`,t(d);let f=e(`span`,`status`,``,d);e(`span`,`dot`,``,f);let p=e(`span`,`text`,``,f),m=e(`span`,`head`,``,p),h=e(`span`,`acts`,``,d);switch(this.control){case`observe`:e(`span`,`label`,r.barViewing,m),e(`span`,`who`,this.agent,m),e(`button`,`btn light`,r.takeover,h,`takeover`),e(`button`,`btn stop`,r.end,h,`end`);break;case`agent`:e(`span`,`label`,r.barAgent,m),e(`button`,`btn light`,r.takeover,h,`takeover`),e(`button`,`btn stop`,r.end,h,`end`);break;case`user`:e(`span`,`label`,r.barUser,m),e(`button`,`btn accent`,r.handback,h,`handback`),e(`button`,`btn stop`,r.end,h,`end`)}this.sinceEl=this.control===`none`?null:e(`span`,`since`,``,p),this.tick(),d.setAttribute(`aria-label`,d.textContent||``),this.renderTask(e,t),this.renderPanel(e,t),this.place()}setTicker(e){e&&!this.ticker&&(this.ticker=setInterval(()=>this.tick(),1e3)),!e&&this.ticker&&(clearInterval(this.ticker),this.ticker=null)}tick(){let e=this.sinceEl;e&&(e.textContent=this.link===`online`?this.since==null?``:this.t.connectedFor(Tf(Date.now()-this.since)):this.t.connecting)}renderOptions(e,t){let n=this.t,r=this.autoLevel(),i=this.lockScreen(),a=e(`div`,`opts`,``,t),o=(t,n,r,i)=>{let o=e(`div`,`opt`,``,a,t);o.setAttribute(`role`,`switch`),o.setAttribute(`aria-checked`,i?`true`:`false`),e(`small`,``,r,e(`span`,`t`,n,o)),e(`span`,i?`sw on`:`sw`,``,o)};o(`auto`,n.autoTitle,r?n.autoOn(n.levels[r]):n.autoOff,!!r),o(`lock`,n.lockTitle,i?n.lockOn:n.lockOff,i)}renderTask(e,t){let n=this.taskEl,r=this.task,i=!!r&&this.control!==`none`,a=X(`sessionStorage`,ff)===`1`;if(n.className=`task glass${i?` on`:``}${a?` min`:``}`,!r||!i){this.taskKey=``;return}let o=JSON.stringify([r.title,r.steps,r.current,r.agent||this.agent,a]);if(o===this.taskKey)return;this.taskKey=o,t(n);let s=r.steps.length,c=Math.max(0,Math.min(r.current|0,s)),l=e(`div`,`top`,``,n);if(e(`span`,`tag`,`AGENT`,l),e(`span`,`agent`,r.agent||this.agent,l),s&&e(`span`,`count`,`${Math.min(c+1,s)}/${s}`,l),e(`div`,`title`,r.title,n),s){let t=e(`div`,`fill`,``,e(`div`,`track`,``,n)),i=Math.round(c/s*100);t.style.width=`${this.taskPct}%`,t.offsetWidth,t.style.width=`${i}%`,this.taskPct=i;let o=e(`ol`,``,``,n);r.steps.forEach((t,n)=>{let r=e(`li`,n<c?`done`:n===c?`now`:``,``,o),i=e(`span`,`mark`,``,r);n<c&&(i.innerHTML=bf),e(`span`,``,t,r)});let l=()=>o.classList.toggle(`end`,o.scrollTop+o.clientHeight>=o.scrollHeight-2);if(o.scrollHeight>o.clientHeight+2){o.classList.add(`more`);let e=o.querySelector(`.now`);e&&(o.scrollTop=Math.max(0,e.offsetTop-o.offsetTop-o.clientHeight/2+e.offsetHeight/2)),l(),o.addEventListener(`scroll`,l,{passive:!0})}a&&c<s&&e(`div`,`agent`,`${this.opts.dir===`rtl`?`←`:`→`} ${r.steps[c]}`,n)}}renderPanel(e,t){let n=this.panel;if(!n)return;let r=this.t;n.className=`panel ${this.control} ${this.link}`,t(n);let i=e(`div`,`head`,``,n);e(`span`,`logo`,``,i),e(`span`,`name`,lf,i);let a=e(`span`,`status`,``,i);e(`span`,`dot`,``,a),e(`span`,``,r.link[this.link],a);let o=e(`div`,`card`,``,n);e(`div`,`k`,r.deviceCode,o);let s=e(`div`,`code`,``,o);e(`b`,`ltr`,this.code||`—`,s),this.code&&e(`button`,`ghost small`,r.copy,s,`copy`),e(`div`,`state`,this.task&&this.control!==`none`?`${r.state[this.control]} · ${this.task.title}`:r.state[this.control],o),e(`div`,`hint`,r.noteShare,o);let c=e(`div`,`acts`,``,n);this.control===`agent`?(e(`button`,`primary`,r.takeover,c,`takeover`),e(`button`,`ghost`,r.end,c,`end`)):this.control===`user`?(e(`button`,`primary`,r.handback,c,`handback`),e(`button`,`ghost`,r.end,c,`end`)):this.control===`observe`&&(e(`button`,`primary`,r.takeover,c,`takeover`),e(`button`,`ghost`,r.end,c,`end`)),this.opts.helpButton&&this.control===`none`&&e(`button`,this.help?`ghost`:`warn`,this.help?r.cancelHelp:r.help,c,`help`)}onClick(e){if(!e.isTrusted||this.dragged)return;let t=e.target,n=t&&t.closest?t.closest(`[data-action]`):null;if(!n)return;e.preventDefault(),e.stopPropagation();let r=n.getAttribute(`data-action`);if(r===`help`)this.opts.onHelp(!this.help);else if(r===`auto`)this.toggleAuto();else if(r===`lock`){let e=!this.lockScreen();Z(`localStorage`,mf,e?`1`:`0`),this.toast(e?this.t.lockedToast:this.t.unlockedToast),this.opts.onSettings(),this.render()}else r===`toggle`?(this.winOpen=!this.winOpen,this.render()):r===`task`?(Z(`sessionStorage`,ff,X(`sessionStorage`,ff)===`1`?null:`1`),this.render()):r===`copy`?(Ef(this.code),n.classList.contains(`copy`)?(n.classList.add(`done`),n.textContent=this.t.copied,setTimeout(()=>this.render(),1200)):(n.textContent=this.t.copied,setTimeout(()=>n.textContent=this.t.copy,1500))):(r===`takeover`||r===`handback`||r===`end`)&&this.opts.onControl(r)}toggleAuto(){let e=this.t;this.autoLevel()?(Z(`localStorage`,pf,null),this.toast(e.autoOffToast),this.opts.onSettings(),this.render()):this.dialog({title:e.autoDialogTitle,text:e.autoDialogText,choices:[`observe`,`interact`].map(t=>({value:t,label:e.levels[t]})),choice:`interact`,okText:e.turnOn,cancelText:e.cancel,onDecide:(t,n)=>{if(!t)return;let r=n===`observe`?`observe`:`interact`;Z(`localStorage`,pf,r),this.toast(e.autoOnToast(e.levels[r])),this.opts.onSettings(),this.render()}})}fitBar(){let e=this.bar;e.classList.remove(`stack`);let t=e.querySelector(`.label`);t&&t.scrollWidth>t.clientWidth+1&&e.classList.add(`stack`)}savedPosition(){try{let e=JSON.parse(X(`localStorage`,uf)||`null`);if(e&&(e.side===`left`||e.side===`right`)&&typeof e.top==`number`)return e}catch(e){}let e=this.opts.style&&this.opts.style.pill;return{side:e&&(e.side===`left`||e.side===`right`)?e.side:this.opts.dir===`rtl`?`left`:`right`,top:e&&typeof e.top==`number`&&e.top>=0&&e.top<=1?e.top:.62}}place(){if(!this.host.isConnected)return;this.fitBar();let{side:e,top:t}=this.savedPosition(),n=this.pill.offsetWidth,r=this.pill.offsetHeight,i=Math.max(Q,window.innerHeight-r-Q),a=Math.min(i,Math.max(Q,t*window.innerHeight)),o=e===`left`?Q:Math.max(Q,window.innerWidth-n-Q);this.pill.style.left=`${o}px`,this.pill.style.top=`${a}px`;let s=this.win.offsetWidth,c=this.win.offsetHeight,l=a+r/2<window.innerHeight/2,u=e===`left`?Q:Math.max(Q,window.innerWidth-s-Q),d=l?Math.min(window.innerHeight-c-Q,a+r+8):Math.max(Q,a-c-8);this.win.style.left=`${u}px`,this.win.style.top=`${d}px`,this.win.style.transformOrigin=`${e===`left`?`left`:`right`} ${l?`top`:`bottom`}`}bindDrag(){this.t;let e=this.pill,t=null,n=!1;e.addEventListener(`pointerdown`,r=>{if(!r.isTrusted||r.target.closest(`button`))return;let i=e.getBoundingClientRect();t={x:r.clientX,y:r.clientY,left:i.left,top:i.top,id:r.pointerId},n=!1,this.dragged=!1,e.classList.remove(`snap`);try{e.setPointerCapture(r.pointerId)}catch(e){}}),e.addEventListener(`pointermove`,r=>{if(!t||r.pointerId!==t.id)return;let i=r.clientX-t.x,a=r.clientY-t.y;!n&&Math.abs(i)+Math.abs(a)<6||(n=!0,e.style.left=`${t.left+i}px`,e.style.top=`${t.top+a}px`)});let r=r=>{if(!t||r.pointerId!==t.id||(t=null,!n))return;n=!1,this.dragged=!0,setTimeout(()=>this.dragged=!1,0);let i=e.getBoundingClientRect(),a=i.left+i.width/2<window.innerWidth/2?`left`:`right`;Z(`localStorage`,uf,JSON.stringify({side:a,top:i.top/window.innerHeight})),e.classList.add(`snap`),this.place()};e.addEventListener(`pointerup`,r),e.addEventListener(`pointercancel`,r)}};function wf(){for(let e of[document.body,document.documentElement]){if(!e)continue;let t=getComputedStyle(e).backgroundColor.match(/rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?/);if(!(!t||t[4]!==void 0&&Number(t[4])<.5))return(.2126*Number(t[1])+.7152*Number(t[2])+.0722*Number(t[3]))/255>.5?`light`:`dark`}return null}function Tf(e){let t=Math.max(0,Math.floor(e/1e3)),n=e=>(e<10?`0`:``)+e,r=Math.floor(t/3600);return(r?r+`:`:``)+n(Math.floor(t/60)%60)+`:`+n(t%60)}function Ef(e){try{if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(e).catch(()=>Df(e));return}}catch(e){}Df(e)}function Df(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;top:-1000px;opacity:0;`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch(e){}t.remove()}function Of(e){let t=e.trim();if(/^\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}$/.test(t))return t;try{let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return null;e.fillStyle=`#000`,e.fillStyle=t;let n=String(e.fillStyle);if(e.fillStyle=`#fff`,e.fillStyle=t,String(e.fillStyle)!==n)return null;let r=n.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(r)return[r[1],r[2],r[3]].map(e=>parseInt(e,16)).join(`, `);let i=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/);return i?`${i[1]}, ${i[2]}, ${i[3]}`:null}catch(e){return null}}function kf(e){return typeof e==`number`?`${e}px`:e}function Af(e,t){if(!t)return;let n=(t,n)=>{n&&e.style.setProperty(t,n)},r=(e,t)=>{typeof t==`string`&&n(e,Of(t))};r(`--rwd-accent-rgb`,t.accent),r(`--rwd-danger-rgb`,t.danger),r(`--rwd-warning-rgb`,t.warning),r(`--rwd-success-rgb`,t.success),typeof t.font==`string`&&n(`--rwd-font`,t.font),typeof t.monoFont==`string`&&n(`--rwd-font-mono`,t.monoFont);for(let[e,r]of[[`radius`,`--rwd-radius`],[`buttonRadius`,`--rwd-button-radius`],[`barBottom`,`--rwd-bar-bottom`],[`taskTop`,`--rwd-task-top`],[`toastBottom`,`--rwd-toast-bottom`]]){let i=t[e];(typeof i==`number`||typeof i==`string`)&&n(r,kf(i))}typeof t.zIndex==`number`&&n(`--rwd-z-index`,String(Math.round(t.zIndex)))}var jf=`https://cdn.jsdelivr.net/npm/eruda`;function Mf(e,t){let n=e===!0?{}:e&&typeof e==`object`?e:{},r=e===!0||!!e&&typeof e==`object`,i=(e,i)=>typeof n[e]==`boolean`?n[e]:r&&e===`dock`?i:!!(t&&t[e]);return{dock:e!==!1&&i(`dock`,!0),load:e!==!1&&i(`load`,!1),src:typeof n.src==`string`&&n.src?n.src:jf,name:typeof n.name==`string`&&n.name?n.name:lf}}var Nf=class{constructor(e){this.ui=e,this.loading=!1,this.docked=null}apply(e){e.load&&this.load(e.src),e.dock?this.dock(e.name):this.undock()}load(e){let t=window;if(this.loading||t.eruda)return;this.loading=!0;let n=document.createElement(`script`);n.src=e,n.async=!0,n.onload=()=>{try{t.eruda&&!t.eruda._isInit&&t.eruda.init()}catch(e){}},n.onerror=()=>{this.loading=!1},(document.head||document.documentElement).appendChild(n)}dock(e){if(this.docked===e||this.timer)return;this.docked&&this.undock();let t=0;this.timer=setInterval(()=>{let n=window.eruda;if(++t>120&&this.stopWaiting(),!n||typeof n.add!=`function`||!n._isInit)return;this.stopWaiting();let r=this.ui;try{if(typeof n.get==`function`&&n.get(e))return;n.add({name:e,init(e){this._$el=e;let t=e&&typeof e.get==`function`?e.get(0):e&&e[0];t&&r.dock(t)},show(){return this._$el&&this._$el.show(),this},hide(){return this._$el&&this._$el.hide(),this},destroy(){r.undock()}}),this.docked=e}catch(e){}},500)}undock(){this.stopWaiting();let e=this.docked;if(e){this.docked=null;try{let t=window.eruda;t&&typeof t.remove==`function`&&t.remove(e)}catch(e){}this.ui.undock()}}stopWaiting(){this.timer&&clearInterval(this.timer),this.timer=void 0}},Pf=`pointerdown.pointerup.pointermove.pointerover.pointerout.pointerenter.pointerleave.pointercancel.touchstart.touchmove.touchend.touchcancel.mousedown.mouseup.mousemove.mouseover.mouseout.mouseenter.mouseleave.click.dblclick.auxclick.contextmenu.wheel.keydown.keypress.keyup.beforeinput.dragstart.drop.selectstart.gesturestart.gesturechange.gestureend`.split(`.`);function Ff(e){let t=!1,n=n=>{t&&n.isTrusted&&!e(n)&&(n.cancelable&&n.preventDefault(),n.stopImmediatePropagation())};for(let e of Pf)window.addEventListener(e,n,{capture:!0,passive:!1});return{set(e){if(e&&!t){let e=document.activeElement;e&&e!==document.body&&typeof e.blur==`function`&&e.blur()}t=e},get locked(){return t}}}var If=`rwd_launch`,Lf=300;async function Rf(e){let t=Vf(e)||Vf(await Bf());return t?{id:t,source:`app`}:{id:Hf()||Uf(oi()),source:`cookie`}}function zf(e,t){e.source===`cookie`&&t!==e.id&&Uf(t)}async function Bf(){let e=window.RWDLaunchId;if(typeof e!=`function`)return e;try{return await Promise.race([Promise.resolve(e()),new Promise(e=>setTimeout(()=>e(null),Lf))])}catch(e){return null}}function Vf(e){return typeof e==`number`&&isFinite(e)&&(e=String(e)),typeof e==`string`&&/^[\w.:-]{4,128}$/.test(e)?e:``}function Hf(){try{let e=document.cookie.match(/(?:^|;\s*)rwd_launch=([\w-]{4,64})/);return e?e[1]:``}catch(e){return``}}function Uf(e){try{document.cookie=`${If}=${e}; path=/; SameSite=Lax`}catch(e){}return e}var Wf=`0.2.1`,Gf=`rwd:code`,Kf=1500,qf=`rwd:help`,Jf=`rwd:ctl`,Yf=`rwd:cfg`,Xf=`rwd:alang`,Zf=12e4,Qf=8e3,$=null,$f=null,ep={},tp={start:0,count:0};function np(e,t){if(!t)return;let n=Date.now(),r=e+`|`+t;if(!(ep[r]&&n-ep[r]<2e3)&&(ep[r]=n,n-tp.start>1e4&&(tp={start:n,count:0}),!(++tp.count>30))){for(let e in ep)n-ep[e]>1e4&&delete ep[e];$&&$.transport.send({t:`event`,kind:e,summary:j(t),at:n},!0)}}sf(X(`localStorage`,Xf)),_i(np);function rp(e){return qd([e.opts.lang].concat(Jd()))}function ip(e){e.lang=rp(e),cf(e.lang),e.ui.setText(Qd(e.lang).ui,e.lang,$d(e.lang)),rf(e.lang,e.gatewayUrl)}nf(()=>{$&&ip($)});var ap=null,op=null;function sp(){return ap||(ap=Ff(e=>!!op&&op.isOwnControl(e))),ap}sp();var cp=null;function lp(){cp||(cp=kd({onChange:e=>{$&&$.transport.send(P({t:`page`},e))},onTap:e=>{$&&sd($.identity.pageId),np(`user_tap`,e)}}))}function up(){let e=navigator.userAgent;return/iPhone|iPad|iPod/.test(e)||/Macintosh/.test(e)&&navigator.maxTouchPoints>1?`ios`:/Android/.test(e)?`android`:`web`}function dp(e){return{ua:navigator.userAgent,platform:up(),screen:{w:window.screen?screen.width:window.innerWidth,h:window.screen?screen.height:window.innerHeight,dpr:window.devicePixelRatio||1},app:e.app&&e.app.name?{name:String(e.app.name),version:String(e.app.version||``)}:null}}function fp(e,t){let n=new URL(e.replace(/\/+$/,``)+`/`,location.href);if(n.protocol!==`https:`&&n.protocol!==`http:`)throw Error(`gatewayUrl must be http(s)`);let r=new URL(`page`,n);return r.protocol=n.protocol===`https:`?`wss:`:`ws:`,r.searchParams.set(`key`,t),{wsUrl:r.href,presenceUrl:new URL(`presence`,n).href}}function pp(){return $?$.transport.state:`idle`}function mp(){return{deviceCode:$?$.deviceCode:null,status:pp()}}function hp(){if(!$)return;let e=$.waiters;$.waiters=[];for(let t of e)t(mp())}function gp(){try{let e=JSON.parse(X(`localStorage`,Jf)||`null`);if(e&&_p(e.s)&&Date.now()-e.at<Zf)return{state:e.s,since:typeof e.since==`number`?e.since:null}}catch(e){}return null}function _p(e){return e===`observe`||e===`agent`}function vp(e){sp().set(_p(e.control)&&e.ui.lockScreen())}function yp(e,t){e.level=t==null?null:gl(t)}function bp(e){return e&&e.agent&&typeof e.agent.name==`string`?e.agent.name:void 0}function xp(e,t,n,r){(t===`user`||t===`none`)&&e.approvals.cancelConfirm(),t===`none`&&(e.level=null),t!==e.control&&R(`control`,{state:t,agent:n||null},!0),t===`none`?e.attachedAt=null:typeof r==`number`&&r>=0?e.attachedAt=Date.now()-r:e.attachedAt==null&&(e.attachedAt=Date.now()),e.control=t,e.ui.setControl(t,n,e.attachedAt),vp(e),Z(`localStorage`,Jf,JSON.stringify({s:t,at:Date.now(),since:e.attachedAt}))}function Sp(e){return e.level?e.level:e.control===`none`?null:`interact`}function Cp(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function wp(e){return{helpButton:!!e.helpButton,maskSelectors:Cp(e.maskSelectors),maskPatterns:Array.isArray(e.maskPatterns)?e.maskPatterns.filter(e=>e&&typeof e.regex==`string`).map(e=>({name:String(e.name||``),regex:e.regex})):[],confirmSelectors:Cp(e.confirmSelectors),networkExclude:Cp(e.networkExclude),sessionLog:e.sessionLog!==!1,eruda:e.eruda&&typeof e.eruda==`object`?{dock:!!e.eruda.dock,load:!!e.eruda.load}:null}}function Tp(e,t){e.config=t,$n(t?t.maskSelectors:[],t?t.maskPatterns:[]),bl(t?t.confirmSelectors:[]),Oi(Cp(e.opts.networkExclude).concat(t?t.networkExclude:[])),t&&!t.sessionLog&&Fr(!0),e.ui.setHelpButton(!!e.opts.helpButton||!!t&&t.helpButton),e.ui.host.isConnected&&e.eruda.apply(Mf(e.opts.eruda,t&&t.eruda))}function Ep(e){return e.opts.deviceToken||X(`localStorage`,`rwd:dtoken`)||null}function Dp(e){return e===`online`?`online`:e===`polling`||e===`rejected`||e===`quota`?`offline`:`connecting`}async function Op(e,t){let n;try{let r=hl(t.method),i=Sp(e);if(r&&i&&!_l(i,r))throw new cr(`forbidden`,N().needLevel(r));if(e.control===`user`&&Ou.indexOf(t.method)>=0)throw new cr(`takeover`,N().takenOver);t.method===`rwd.click`&&sd(e.identity.pageId);let a=await Gu(t.method,t.params,{highlight:t=>e.ui.highlight(t),pointer:(t,n)=>e.ui.pointer(t.x,t.y,n),confirm:t=>e.approvals.confirm(t)});n={id:t.id,result:a===void 0?{}:a}}catch(e){n={id:t.id,error:lr(e)}}kp(t.method,t.params,n),$===e&&e.transport.send(n)}function kp(e,t,n){var r;if(Ou.indexOf(e)<0&&e!==`rwd.evaluate`)return;let i=t&&typeof t==`object`?t:{},a={method:e};for(let e of[`ref`,`fromRef`,`toRef`,`key`,`url`,`values`])i[e]!==void 0&&(a[e]=i[e]);(typeof i.value==`string`||typeof i.text==`string`)&&(a.text=j(String((r=i.value)==null?i.text:r)).slice(0,200)),n.error&&(a.error=`${n.error.code}: ${n.error.message}`),R(`agent`,a,!0)}function Ap(e,t){if(typeof t.id==`number`&&typeof t.method==`string`)Op(e,t);else switch(t.t){case`welcome`:if(typeof t.deviceToken==`string`&&t.deviceToken&&(e.deviceToken=t.deviceToken,Z(`localStorage`,Xu,t.deviceToken)),dd(e.identity.pageId,typeof t.resume==`string`?t.resume:null),typeof t.agentLang==`string`&&(sf(t.agentLang,e.gatewayUrl),Z(`localStorage`,Xf,t.agentLang)),e.invite&&(e.invite=null,md()),t.config&&typeof t.config==`object`){let n=wp(t.config);Tp(e,n),Z(`localStorage`,Yf,JSON.stringify(n))}t.deviceCode&&(e.deviceCode=String(t.deviceCode),Z(`localStorage`,Gf,e.deviceCode)),e.label=t.label||null,e.ui.setLink(`online`,e.deviceCode||void 0),yp(e,t.level==null?t.control&&t.control.level:t.level),xp(e,t.control&&t.control.state||`none`,bp(t.control),t.control&&t.control.attachedMs),e.ui.setTask(t.task||null),Bp(e,!!t.help),hp();break;case`task`:e.ui.setTask(t.task||null);break;case`control`:yp(e,t.level),xp(e,t.state||`none`,bp(t),t.attachedMs);break;case`attach_request`:e.approvals.onAttachRequest(t);break;case`attach_cancel`:e.approvals.onAttachCancel(String(t.requestId));break;case`help`:Bp(e,!!t.on)}}function jp(e,t,n={}){if($f)return $f;if(typeof e!=`string`||!e)return Promise.reject(Error(`RemoteWebviewDebugger.run: gatewayUrl is required`));if(typeof t!=`string`||!t)return Promise.reject(Error(`RemoteWebviewDebugger.run: appKey is required`));let r;try{r=fp(e,t)}catch(e){return Promise.reject(e)}let i=pd();lp();let a=od(n.deviceId);n.locales&&ef(n.locales),n.messages&&tf(n.messages);let o=qd([n.lang].concat(Jd()));cf(o);let s=new Cf({lang:o,dir:$d(o),text:Qd(o).ui,style:n.style,helpButton:!!n.helpButton,lockScreen:n.lockScreen!==!1,theme:n.theme,onSettings:()=>{$&&vp($)},onHelp:e=>Vp(e),onControl:e=>{$&&$.transport.send({t:`control`,action:e},!0)}});op=s;let c={gatewayUrl:e,appKey:t,opts:P({},n),identity:a,lang:o,ui:s,deviceCode:X(`localStorage`,Gf),label:null,control:`none`,attachedAt:null,level:null,help:X(`localStorage`,qf)===`1`,deviceToken:null,sentToken:null,recoverDevice:!1,recoveries:0,invite:i,config:null,waiters:[],transport:null,approvals:null,eruda:new Nf(s)};c.deviceToken=Ep(c),c.approvals=new gd({ui:s,native:!!n.nativeApproval,send:e=>c.transport.send(e,!0)}),Oi(Cp(n.networkExclude));try{let e=JSON.parse(X(`localStorage`,Yf)||`null`);e&&typeof e==`object`&&Tp(c,wp(e))}catch(e){}n.record===!1?Fr(!1):(!c.config||c.config.sessionLog)&&(R(`page`,{event:`open`,url:j(location.href),title:j(document.title),referrer:j(document.referrer)}),Rf(n.launchId).then(e=>Pr(e,a.pageId).then(t=>zf(e,t))).catch(()=>void 0)),c.transport=new Cd({wsUrl:r.wsUrl,presenceUrl:r.presenceUrl,hello:()=>(c.recoverDevice&&(c.recoverDevice=!1,Ep(c)||(ld(c.identity),c.deviceCode=null,Z(`localStorage`,Gf,null))),c.sentToken=c.deviceToken=Ep(c),{t:`hello`,v:1,sdk:Wf,deviceId:c.identity.deviceId,pageId:c.identity.pageId,openerId:c.identity.openerId,userId:c.opts.userId==null?null:String(c.opts.userId),page:wd(),device:dp(c.opts),help:c.help,deviceToken:c.sentToken,resume:ud(c.identity.pageId),invite:c.invite}),presence:()=>({key:c.appKey,deviceId:c.identity.deviceId,pageId:c.identity.pageId,page:wd(),device:dp(c.opts),userId:c.opts.userId==null?null:String(c.opts.userId),help:c.help,deviceToken:Ep(c)}),onMessage:e=>Ap(c,e),onState:e=>{c.ui.setLink(Dp(e),c.deviceCode||void 0),e!==`online`&&c.approvals.cancelConfirm(),(e===`polling`||e===`stopped`||e===`rejected`||e===`quota`)&&c.control!==`none`&&xp(c,`none`),(e===`stopped`||e===`rejected`||e===`quota`)&&hp()},onRejected:()=>{let e=Ep(c);return e&&e!==c.sentToken?0:!e&&!c.opts.deviceId&&c.recoveries<2&&(c.recoveries++,c.recoverDevice=!0,Kf)},onConflict:()=>fd(c.identity),onPresence:e=>{e.deviceCode&&(c.deviceCode=String(e.deviceCode),Z(`localStorage`,Gf,c.deviceCode),c.ui.setLink(`offline`,c.deviceCode)),hp()}}),$=c,s.setLink(`connecting`,c.deviceCode||void 0),s.setHelp(c.help),s.mount(),rf(o,e),c.eruda.apply(Mf(c.opts.eruda,c.config&&c.config.eruda));let l=gp();return l&&(c.attachedAt=l.since,xp(c,l.state),setTimeout(()=>{$===c&&_p(c.control)&&!c.transport.isOnline()&&xp(c,`none`)},Qf)),$f=new Promise(e=>{c.waiters.push(e),setTimeout(()=>hp(),Qf)}),cd(a).then(()=>{$===c&&c.transport.start()}),$f}function Mp(e){$&&(R(`page`,{event:`hide`}),Ir(),$.transport.suspend())}function Np(e){$&&e.persisted&&$.transport.resume()}window.addEventListener(`pagehide`,Mp),window.addEventListener(`pageshow`,Np);function Pp(){let e=$;return{deviceCode:e?e.deviceCode:X(`localStorage`,Gf),status:pp(),control:e?e.control:`none`,help:e?e.help:!1,label:e?e.label:null,deviceId:e?e.identity.deviceId:null,pageId:e?e.identity.pageId:null,version:Wf,lang:e?e.lang:null,deviceToken:e?e.deviceToken:X(`localStorage`,Xu),level:e?Sp(e):null,config:e?e.config:null,pending:e?e.approvals.pending():null,logSession:Lr()||null}}function Fp(){let e=$;e&&($=null,$f=null,op=null,e.transport.stop(),e.approvals.destroy(),e.ui.unmount(),sp().set(!1),Ip(e))}function Ip(e){let t=e.waiters;e.waiters=[];for(let n of t)n({deviceCode:e.deviceCode,status:`stopped`})}function Lp(e){let t=$;t&&(t.opts.lang=e||void 0,ip(t))}var Rp=Ld.slice();function zp(e){let t=$,n=e==null||e===``?null:String(e);t&&(t.opts.userId==null?null:String(t.opts.userId))!==n&&(t.opts.userId=n,t.transport.state!==`stopped`&&t.transport.restart())}function Bp(e,t){e.help=t,e.ui.setHelp(t),Z(`localStorage`,qf,t?`1`:null)}function Vp(e){let t=$;t&&(Bp(t,!!e),t.transport.send({t:`help`,on:t.help},!1))}function Hp(e=!0){Vp(e)}function Up(e,t){let n=$;return!n||!Gp(n,e)||t!==`takeover`&&t!==`handback`&&t!==`end`?!1:(n.transport.send({t:`control`,action:t},!0),!0)}function Wp(e,t,n){let r=$;return!r||!Gp(r,e)||typeof t!=`string`?!1:r.approvals.decide(t,n==null?null:String(n))}function Gp(e,t){let n=e.opts.nativeKey;if(!n||typeof t!=`string`||t.length!==n.length)return!1;let r=0;for(let e=0;e<t.length;e++)r|=t.charCodeAt(e)^n.charCodeAt(e);return r===0}return e.builtinLocales=Rp,e.getStatus=Pp,e.status=Pp,e.help=Hp,e.nativeControl=Up,e.nativeDecide=Wp,e.registerLocale=ef,e.run=jp,e.setLang=Lp,e.setUser=zp,e.stop=Fp,e.version=Wf,e})({});
|
|
42
42
|
//# sourceMappingURL=sdk.js.map
|