(function(){function e(e,n){try{const t=window.webkit;delete window["webkit"];window.webkit.messageHandlers[e].postMessage(n);window.webkit=t}catch(e){}}function n(e){return encodeURIComponent(e).replace("%20","+")}function t(e){if(e instanceof HTMLButtonElement){return e}if(e instanceof HTMLInputElement&&e.type==="submit"){return e}return null}function o(e){return e.name}function r(e){return e.disabled}function i(e){return e instanceof HTMLInputElement&&(e.type==="radio"||e.type==="checkbox")}let c=null;function u(e){if(c&&c.form===e){return c}for(const n of e.elements){const e=t(n);if(e){return e}}return null}const f=new Set(["email","search","tel","text","url","number"]);function s(e){if(i(e)){const n=e;return n.checked===n.defaultChecked}if(e instanceof HTMLSelectElement){for(const n of e.options){if(n.selected!==n.defaultSelected){return false}}}return true}function a(e){let n=undefined;for(const t of e.elements){if(r(t)||!o(t)){continue}if(!s(t)||t instanceof HTMLTextAreaElement){return}if(t instanceof HTMLInputElement){if(t.type==="file"||t.type==="password"){return}if(f.has(t.type)){if(n){return}n=t}}}return n}function l(e){if(!(e instanceof HTMLFormElement)){return}if(e.target&&e.target!=="_self"){return}if(e.method&&e.method.toLowerCase()!=="get"){return}const c=a(e);if(!c){return}const f=u(e);const s=[];for(const u of e.elements){const e=o(u);if(r(u)||!e){continue}const a=t(u);if(a){if(a===f){let t=a.value;if(a instanceof HTMLInputElement&&!t){t="Submit"}s.push(n(e)+"="+n(t))}continue}if(u===c){s.push(n(e)+"={searchTerms}")}else{if(i(u)&&!u.checked){continue}const t=u.value;s.push(n(e)+"="+n(t))}}const l=new URL(e.action);return l.origin+l.pathname+"?"+s.join("&")}document.addEventListener("click",(function(e){if(e.defaultPrevented){return}const n=e.target;if(!(n instanceof Element)){return}const o=t(n);if(!o){return}c=o;setTimeout((function(){if(c===n){c=null}}),0)}));document.addEventListener("submit",(function(n){if(n.defaultPrevented||!(n.target instanceof Element)){return}const t=l(n.target);if(t){e("SearchEngineMessage",{command:"searchableUrl",url:t})}}),false);function d(){const n=document.getElementsByTagName("link");for(const t of n){if(t.type==="application/opensearchdescription+xml"){e("SearchEngineMessage",{command:"openSearch",pageUrl:document.URL,osddUrl:t.href});return}}}if(document.readyState==="complete"){d()}else{window.addEventListener("load",d)}})();