(function(){function e(e,t){try{const n=window.webkit;delete window["webkit"];window.webkit.messageHandlers[e].postMessage(t);window.webkit=n}catch(e){}}function t(){const e=new Uint32Array(4);window.crypto.getRandomValues(e);return e.reduce(((e="",t)=>e+t.toString(16).padStart(8,"0")),"")}class n{registeredApis={};frameId=t();registerApi(e,t){if(this.registeredApis[e]!==undefined){throw new Error(`API ${e} already registered.`)}this.registeredApis[e]=t}getRegisteredApi(e){return this.registeredApis[e]}getFrameId(){if(!this.frameId){this.frameId=t()}return this.frameId}registerFrame(){e("FrameBecameAvailable",{crwFrameId:this.getFrameId()})}}if(!window.__gCrWeb){window.__gCrWeb=new n}const i=window.__gCrWeb;const r=window.__gCrWeb;let o=null;const s=[];function f(e){const t=e.getAttribute("autocomplete");const n=t?.includes("webauthn");return(e instanceof HTMLInputElement||e instanceof HTMLFormElement)&&!n}function l(e){return window.innerHeight>0&&window.innerWidth>0&&i.fill.isVisibleNode(e)}function a(t){let n=null;let s="";let f="";let l=null;if(o instanceof HTMLInputElement){n=o;s=o.type;f=o.value;l=o.form}else if(o instanceof HTMLFormElement){l=o}const a={frameID:r.getFrameId(),formName:i.form.getFormIdentifier(l),formRendererID:i.fill.getUniqueID(l),fieldIdentifier:i.form.getFieldIdentifier(n),fieldRendererID:i.fill.getUniqueID(n),fieldType:s,type:"focus",value:f,hasUserGesture:t};e("BottomSheetMessage",a)}function u(e){if(!e.target||!(e.target instanceof HTMLElement)||e.target!==document.activeElement){return}if(e.target instanceof HTMLInputElement&&e.target.value.trim()){return}if(l(e.target)){e.target.blur();o=e.target;a(e.isTrusted)}}function d(e){for(const t of e){const e=i.fill.getElementByUniqueID(t);const n=s.indexOf(e);if(n>-1){e.removeEventListener("focus",u,true);s.splice(n,1)}}}function c(e,t){let n=null;const r=[];for(const o of e){const e=i.fill.getElementByUniqueID(o);if(e&&f(e)&&!s.find((t=>t===e))){const o=document.activeElement===e;if(t||!o||!i.autofill_form_features.isAutofillFixPaymentSheetSpamEnabled()){r.push(e)}if(o){if(e.value.trim()!==""){return}if(t){n=e}}}}for(const e of r){e.addEventListener("focus",u,true);s.push(e)}if(n&&l(n)){n.blur();o=n;a(false)}}function m(){o?.focus();o=null}function g(e,t){d(e);if(t){m()}}i.bottomSheet={attachListeners:c,detachListeners:g,refocusLastBlurredElement:m}})();