(()=>{"use strict";const t={kNone:-1,kLeft:0,kCenter:1,kRight:2,kBack:3,kForward:4,isContextMenuButton:t=>2===t,isNavigationButton:t=>3===t||4===t,isNoModifierPressed:t=>!(t.altKey||t.shiftKey||t.ctrlKey||t.metaKey),setWebviewPointerEvents:(t,e)=>{const n=t?"":"none",o=e.getElementsByTagName("WEBVIEW");for(const t of o)t.style.pointerEvents=n}};function e(e){const n=e.target.closest?.("a");!n||!n.href||n.href.startsWith("#")||e.button!==t.kLeft||e.altKey||e.ctrlKey||e.shiftKey||(function(t){t.preventDefault(),t.stopPropagation()}(e),function(t,e){e?console.log(`${t} ${e}`):console.log(t)}("LINK_CLICKED",n.href))}function n(t){if("chrome-extension://mpognobbkildjkofajifpdfhcoklimli"!==t.origin)return;const e={type:"",style:{},content:"",...t.data};switch(e.type){case"SET_STYLE":!function(t){const e=document.getElementById("theme"),n="vertical-rl"===t.writingMode;e&&(e.innerHTML=`\n  body {\n    background-color: ${t["--colorBg"]};\n    color: ${t["--colorFg"]};\n    font-family: ${t.fontFamily};\n    font-size: ${t.fontSize+"em"};\n    line-height: ${String(t.lineHeight)};\n    writing-mode: ${n?t.writingMode:"unset"};\n    max-width: ${n?"unset":t.width+"ch"};\n    height: ${n?t.width+"ch":"unset"};\n  }\n  a {\n    color: ${t["--colorHighlightBg"]}\n  }`,document.body?.className&&(document.body.className=n?"vertical":"horizontal"))}(e.style);break;case"SET_CONTENT":!function(t){const e=document.body;e&&(e.innerHTML=t)}(e.content)}}window.addEventListener("message",n),window.addEventListener("click",e)})();