Files
openchamber-android-native/third_party/mygo/internal/bridge/bridge.js
T

2 lines
13 KiB
JavaScript
Raw Normal View History

// Code generated by `bun run build` from packages/bridge. DO NOT EDIT.
(()=>{var ae=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function V(e,t){let n={},o=e?.closest("input,textarea")??null,s=o&&!(o.type&&ae.has(o.type.toLowerCase()));if(s&&!o.readOnly&&!o.disabled)n.e=!0;else if(e?.isContentEditable)n.e=!0;if(s&&o.type?.toLowerCase()!=="password"){let c=o.selectionStart??0,b=o.selectionEnd??0;if(b>c)t=(o.value??"").slice(c,b)}else if(s)t="";if(t)n.s=t;if(!e)return n;let a=e.closest("a[href],area[href]");if(a){let c=typeof a.href==="string"?a.href:a.href?.baseVal??"";if(c)n.l=c;let b=(a.innerText??a.textContent??"").trim();if(b)n.lt=b}let u=e.closest("img");if(u){let c=u.currentSrc||u.src;if(c)n.i=c}let m=e.closest("video,audio");if(m){let c=m.currentSrc||m.src;if(c)n.m=c}return n}var C=null,N=null,W=()=>typeof CSS<"u"&&("highlights"in CSS)&&typeof Highlight<"u";function ce(e,t){let n=[];if(!e||!document.body)return n;let o=t?e:e.toLowerCase(),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode(a){let u=a.parentElement;if(!u||/^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE|TEXTAREA)$/.test(u.tagName))return NodeFilter.FILTER_REJECT;return u.getClientRects().length?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});for(let a=s.nextNode();a;a=s.nextNode()){let u=t?a.nodeValue:a.nodeValue.toLowerCase();for(let m=u.indexOf(o);m>=0;m=u.indexOf(o,m+o.length)){let c=document.createRange();c.setStart(a,m),c.setEnd(a,m+o.length),n.push(c)}}return n}function de(){if(N||!("adoptedStyleSheets"in document))return;N=new CSSStyleSheet,N.replaceSync("::highlight(mygo-find){background-color:#fdeb62;color:#000}::highlight(mygo-find-active){background-color:#ff9632;color:#000}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,N]}function q(e,t={}){let n=!!t.matchCase;if(!t.next||!C||C.text!==e||C.matchCase!==n)C={text:e,matchCase:n,ranges:ce(e,n),active:-1};let o=C.ranges.length;if(o===0)return H(),{matches:0,active:0};C.active=C.active<0?t.backward?o-1:0:(C.active+(t.backward?o-1:1))%o;let s=C.ranges[C.active];if(W())de(),CSS.highlights.set("mygo-find",new Highlight(...C.ranges)),CSS.highlights.set("mygo-find-active",new Highlight(s));else{let a=getSelection();a?.removeAllRanges(),a?.addRange(s)}return s.startContainer.parentElement?.scrollIntoView({block:"center",inline:"nearest"}),{matches:o,active:C.active+1}}function H(){if(C&&!W())getSelection()?.removeAllRanges();if(C=null,W())CSS.highlights.delete("mygo-find"),CSS.highlights.delete("mygo-find-active")}function ue(e,t){let n=["width:max-content"];if(e.minWidth>0)n.push(`min-width:${Math.max(e.minWidth-t,0)}px`);if(e.maxWidth>0)n.push(`max-width:${Math.max(e.maxWidth-t,0)}px`);if(e.minHeight>0)n.push(`min-height:${e.minHeight}px`);return`:where(:root){${n.join(";")}}`}function B(e){let t=null;return(n)=>{if(t&&t.w===n.w&&t.h===n.h&&t.sw===n.sw&&t.sh===n.sh)return;t=n,e(n)}}function J(e,t,n){let o=B(n),s=0,a=!1,u=!1,m=()=>t(ue(e,s)),c=(b)=>{let p=document.documentElement;if(!p)return;let h=document.scrollingElement??p,y=Math.max(innerWidth-h.clientWidth,0),O=Math.max(innerHeight-h.clientHeight,0),x=p.getBoundingClientRect(),r=e.maxHeight>0&&x.height>e.maxHeight?y:0;if(r!==s){if(s=r,!b)m(),x=p.getBoundingClientRect();else if(!u)u=!0,requestAnimationFrame(()=>{u=!1,m()})}let S=document.body,E=!!S&&S.scrollWidth>S.clientWidth;o({w:x.width,h:x.height,sw:y,sh:E?O:0})};return m(),{start(){if(a)return;if(a=!0,c(!1),typeof ResizeObserver<"u"&&document.documentElement)new ResizeObserver(()=>c(!0)).observe(document.documentElement);addEventListener("resize",()=>c(!1))},setLimits(b){if(e=b,m(),a)c(!1)},again(){if(o=B(n),a)c(!1)}}}var j=(e)=>setTimeout(()=>{throw e});function Y(e){if(e.reason!==void 0)return e.reason;return Error("mygo: the call was aborted")}class D extends Error{method;constructor(e,t){super(t);this.method=e;this.name="CallError"}}function X(e,t){let n=Math.random().toString(36).slice(2)+Date.now().toString(36),o=new Map,s=new Map,a={accent:null,reduceMotion:!1,reduceTransparency:!1,highContrast:!1,textScale:1},u=0,m=new Map,c=new WeakMap,b=0,p=e.locale||"en",h=e.dir==="rt