var content=(function(){function e(e){return e}var t=-1,n=null,r=null;function i(){return window.innerHeight/2}function a(e){let t=0,n=1/0;for(let r=0;r<e.length;r+=1){let a=e[r].getBoundingClientRect(),o=a.top+a.height/2,s=Math.abs(o-i());s<n&&(n=s,t=r)}return t}function o(e,t,n){n?.style.removeProperty(`box-shadow`),n?.style.removeProperty(`border-left`),n?.style.removeProperty(`transition`),e.style.transition=`box-shadow 0.2s, border-left 0.2s`,e.style.borderLeft=`3px solid ${t}`,e.style.boxShadow=`inset 3px 0 0 ${t}`}function s(e){let t=document.createElement(`div`);t.style.cssText=`
    position: fixed;
    inset: 0;
    background: ${e};
    pointer-events: none;
    z-index: 99999;
    transition: opacity 0.3s;
  `,document.body.appendChild(t),requestAnimationFrame(()=>{t.style.opacity=`0`,t.addEventListener(`transitionend`,()=>t.remove(),{once:!0})})}function c(){return Array.from(document.querySelectorAll(`article[data-testid="tweet"]`))}function l(){return Array.from(document.querySelectorAll(`[class*="_content_"]`)).filter(e=>!!e.querySelector(`header`))}function u(e){let t=null,n=1/0;for(let r of e){let e=r.getBoundingClientRect(),a=Math.abs(e.top+e.height/2-i());a<n&&(n=a,t=r)}return t}var d=[{name:`Twitter / X`,hostnames:[`x.com`,`twitter.com`],goToNext(){let e=c();if(e.length===0)return;let r=a(e);(t<0||Math.abs(t-r)>2)&&(t=r);let i=Math.min(t+1,e.length-1);if(i===t)return;t=i;let s=e[t];s.scrollIntoView({behavior:`smooth`,block:`center`}),o(s,`rgb(29, 155, 240)`,n),n=s},highlightFirst(){let e=c();if(e.length===0)return;t=a(e);let r=e[t];r.scrollIntoView({behavior:`smooth`,block:`center`}),o(r,`rgb(29, 155, 240)`,n),n=r},flash(){s(`rgba(29, 155, 240, 0.1)`)}},{name:`即刻`,hostnames:[`web.okjike.com`],goToNext(){let e=l(),t=r&&document.contains(r)?r:u(e);if(!t)return;let n=e.indexOf(t);if(n>=0&&n<e.length-1){let t=e[n+1];t.scrollIntoView({behavior:`smooth`,block:`center`}),o(t,`#ffe411`,r),r=t;return}t.scrollIntoView({behavior:`smooth`,block:`start`}),window.setTimeout(()=>{let e=u(l());e&&e!==t&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),o(e,`#ffe411`,r),r=e)},600)},highlightFirst(){let e=u(l());e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),o(e,`#ffe411`,r),r=e)},flash(){s(`rgba(255, 228, 17, 0.1)`)}}];function f(){return d.find(e=>e.hostnames.includes(location.hostname))??null}var p=e({matches:[`*://x.com/*`,`*://twitter.com/*`,`*://web.okjike.com/*`],runAt:`document_idle`,main(){let e=f(),t=!1,n=0,r=document.createElement(`div`);r.id=`squat-panel`,r.innerHTML=`
      <div id="squat-panel-header">
        <span>🏋️ Squat to Scroll</span>
        <button id="squat-panel-toggle" title="Collapse">−</button>
      </div>
      <div id="squat-panel-body">
        <iframe
          id="squat-camera-iframe"
          allow="camera"
          style="width:100%;height:200px;border:none;border-radius:0 0 12px 12px;"
        ></iframe>
      </div>
      <div id="squat-counter">Squats: <strong>0</strong></div>
    `,r.style.cssText=`
      position: fixed;
      bottom: 20px;
      right: 20px;
      width: 260px;
      background: #15202b;
      border-radius: 16px;
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
      z-index: 100000;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      overflow: hidden;
      transition: all 0.3s ease;
      cursor: move;
    `;let i=document.createElement(`style`);i.textContent=`
      #squat-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 14px;
        color: #fff;
        font-weight: 600;
        font-size: 14px;
        background: #1d9bf0;
        user-select: none;
      }

      #squat-panel-toggle {
        background: none;
        border: none;
        color: #fff;
        font-size: 18px;
        cursor: pointer;
        padding: 0 4px;
        line-height: 1;
      }

      #squat-counter {
        padding: 8px 14px;
        color: #8899a6;
        font-size: 13px;
        text-align: center;
        border-top: 1px solid #253341;
      }

      #squat-counter strong {
        color: #1d9bf0;
        font-size: 18px;
      }

      #squat-panel.collapsed #squat-panel-body,
      #squat-panel.collapsed #squat-counter {
        display: none;
      }

      #squat-panel.collapsed {
        width: auto;
      }

      #squat-scroll-overlay {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(21, 32, 43, 0.95);
        color: #1d9bf0;
        padding: 20px 32px;
        border-radius: 16px;
        font: bold 18px/1.4 system-ui, sans-serif;
        z-index: 100001;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s;
      }

      #squat-scroll-overlay.show {
        opacity: 1;
      }
    `;let a=document.createElement(`div`);a.id=`squat-scroll-overlay`,a.textContent=`🏋️ Do a squat to scroll!`;let o;function s(){a.classList.add(`show`),window.clearTimeout(o),o=window.setTimeout(()=>{a.classList.remove(`show`)},1500)}let c={passive:!1,capture:!0};function l(e){t&&(e.preventDefault(),e.stopPropagation(),s())}function u(e){t&&[`ArrowDown`,`ArrowUp`,`PageDown`,`PageUp`,` `,`j`,`k`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),s())}function d(){window.addEventListener(`wheel`,l,c),window.addEventListener(`touchmove`,l,c),window.addEventListener(`keydown`,u,c)}function p(){window.removeEventListener(`wheel`,l,c),window.removeEventListener(`touchmove`,l,c),window.removeEventListener(`keydown`,u,c),a.classList.remove(`show`)}function m(){let e=r.querySelector(`#squat-counter strong`);e&&(e.textContent=String(n))}window.addEventListener(`message`,r=>{if(!t||!e)return;let i=r.data;i?.type===`GESTURE`&&i.gesture===`SQUAT_COMPLETED`&&(n=i.count,m(),e.goToNext(),e.flash()),i?.type===`SQUAT_STATE`&&(n=i.count,m())});let h=!1,g=0,_=0,v=()=>r.querySelector(`#squat-panel-header`),y=()=>r.querySelector(`#squat-panel-toggle`);function b(e){if(e.target?.id===`squat-panel-toggle`)return;h=!0;let t=r.getBoundingClientRect();g=e.clientX-t.left,_=e.clientY-t.top,document.addEventListener(`mousemove`,x),document.addEventListener(`mouseup`,S)}function x(e){h&&(r.style.left=`${e.clientX-g}px`,r.style.top=`${e.clientY-_}px`,r.style.right=`auto`,r.style.bottom=`auto`)}function S(){h=!1,document.removeEventListener(`mousemove`,x),document.removeEventListener(`mouseup`,S)}function C(){let e=y();e?.addEventListener(`click`,()=>{e.textContent=r.classList.toggle(`collapsed`)?`+`:`−`})}async function w(){if(t)return;t=!0,await chrome.storage.local.set({enabled:!0}),document.body.appendChild(i),document.body.appendChild(r),document.body.appendChild(a);let n=r.querySelector(`#squat-camera-iframe`);n&&(n.src=chrome.runtime.getURL(`/camera.html`)),v()?.addEventListener(`mousedown`,b),C(),d(),e?.highlightFirst()}async function T(){t&&(t=!1,await chrome.storage.local.set({enabled:!1}),p(),r.remove(),i.remove(),a.remove())}chrome.runtime.onMessage.addListener(e=>{if(e.type===`TOGGLE`)return(async()=>(t?await T():await w(),{enabled:t}))();if(e.type===`GET_STATE`)return Promise.resolve({supported:!0,enabled:t,squatCount:n})}),chrome.storage.local.get(`enabled`).then(e=>{e.enabled&&w()})}}),m={debug:(...e)=>([...e],void 0),log:(...e)=>([...e],void 0),warn:(...e)=>([...e],void 0),error:(...e)=>([...e],void 0)},h=globalThis.browser?.runtime?.id?globalThis.browser:globalThis.chrome,g=class e extends Event{static EVENT_NAME=_(`wxt:locationchange`);constructor(t,n){super(e.EVENT_NAME,{}),this.newUrl=t,this.oldUrl=n}};function _(e){return`${h?.runtime?.id}:content:${e}`}var v=typeof globalThis.navigation?.addEventListener==`function`;function y(e){let t,n=!1;return{run(){n||(n=!0,t=new URL(location.href),v?globalThis.navigation.addEventListener(`navigate`,e=>{let n=new URL(e.destination.url);n.href!==t.href&&(window.dispatchEvent(new g(n,t)),t=n)},{signal:e.signal}):e.setInterval(()=>{let e=new URL(location.href);e.href!==t.href&&(window.dispatchEvent(new g(e,t)),t=e)},1e3))}}}var b=class e{static SCRIPT_STARTED_MESSAGE_TYPE=_(`wxt:content-script-started`);id;abortController;locationWatcher=y(this);constructor(e,t){this.contentScriptName=e,this.options=t,this.id=Math.random().toString(36).slice(2),this.abortController=new AbortController,this.stopOldScripts(),this.listenForNewerScripts()}get signal(){return this.abortController.signal}abort(e){return this.abortController.abort(e)}get isInvalid(){return h.runtime?.id??this.notifyInvalidated(),this.signal.aborted}get isValid(){return!this.isInvalid}onInvalidated(e){return this.signal.addEventListener(`abort`,e),()=>this.signal.removeEventListener(`abort`,e)}block(){return new Promise(()=>{})}setInterval(e,t){let n=setInterval(()=>{this.isValid&&e()},t);return this.onInvalidated(()=>clearInterval(n)),n}setTimeout(e,t){let n=setTimeout(()=>{this.isValid&&e()},t);return this.onInvalidated(()=>clearTimeout(n)),n}requestAnimationFrame(e){let t=requestAnimationFrame((...t)=>{this.isValid&&e(...t)});return this.onInvalidated(()=>cancelAnimationFrame(t)),t}requestIdleCallback(e,t){let n=requestIdleCallback((...t)=>{this.signal.aborted||e(...t)},t);return this.onInvalidated(()=>cancelIdleCallback(n)),n}addEventListener(e,t,n,r){t===`wxt:locationchange`&&this.isValid&&this.locationWatcher.run(),e.addEventListener?.(t.startsWith(`wxt:`)?_(t):t,n,{...r,signal:this.signal})}notifyInvalidated(){this.abort(`Content script context invalidated`),m.debug(`Content script "${this.contentScriptName}" context invalidated`)}stopOldScripts(){document.dispatchEvent(new CustomEvent(e.SCRIPT_STARTED_MESSAGE_TYPE,{detail:{contentScriptName:this.contentScriptName,messageId:this.id}})),window.postMessage({type:e.SCRIPT_STARTED_MESSAGE_TYPE,contentScriptName:this.contentScriptName,messageId:this.id},`*`)}verifyScriptStartedEvent(e){let t=e.detail?.contentScriptName===this.contentScriptName,n=e.detail?.messageId===this.id;return t&&!n}listenForNewerScripts(){let t=e=>{!(e instanceof CustomEvent)||!this.verifyScriptStartedEvent(e)||this.notifyInvalidated()};document.addEventListener(e.SCRIPT_STARTED_MESSAGE_TYPE,t),this.onInvalidated(()=>document.removeEventListener(e.SCRIPT_STARTED_MESSAGE_TYPE,t))}},x={debug:(...e)=>([...e],void 0),log:(...e)=>([...e],void 0),warn:(...e)=>([...e],void 0),error:(...e)=>([...e],void 0)};return(async()=>{try{let{main:e,...t}=p;return await e(new b(`content`,t))}catch(e){throw x.error(`The content script "content" crashed on startup!`,e),e}})()})();
content;