PageSourceSearch

https://app.trypolarbear.com/assets/StudyOverlayChrome-CbT-9TD9.js

js trypolarbear.com collected 2026-10-04 23:24:25 UTC 59,232 bytes, 10 lines download raw bytes

vendor: 4,103 bytes, lines 1-8
1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a1068a-f723-7313-bd67-4f9cf381e221")}catch(e){}}();import{j as a,ac as cn,aa as un,v as dn,ad as fn,ae as hn,af as pn,J as gn,ag as xn}from"./ui-mYohRvpx.js";import{r as C}from"./vendor-WF4PsUl_.js";import{g as Se}from"./index-DSpwt0cg.js";import{u as Xi}from"./index-C7Wu0DsO.js";import{c as ae,C as mn,D as yn,a as bn,b as wn,d as vn,e as _n,S as xt,f as Sn,B as qe,u as Tn,T as Vt,g as Qt,h as Ut}from"./main-BuFXTOj5.js";import{A as Xt,m as wt}from"./motion-B-fsB7B9.js";import{u as Nn}from"./useUserStudySession-Bpvebimh.js";import{u as jn,c as vi,S as _i}from"./study-overlay-commands-BiKio-bb.js";import{u as En}from"./useStudyGoalsQuery-BVVRljLo.js";import{f as oi}from"./format-duration-DI9j0NLF.js";import{S as Si}from"./useStudyGoals-PoIPFzPZ.js";import{L as Bi,b as Fi}from"./router-CHD5ebUU.js";import{u as Ii,a as Cn,b as kn}from"./useStudyRoomsQuery-DHg34d8D.js";import{i as At,l as Pn,u as Dn,a as Mn,b as Rn,m as On,g as An,R as Ln}from"./RoomBackgroundPicker-WuEDjhTE.js";import{g as Yn}from"./room-backgrounds-Cdj3FzGO.js";import{A as Xn,a as Bn}from"./avatar-t7di9CXR.js";import"./supabase-QYtBhu3e.js";import"./tldraw-CnXIE9Mk.js";import"./radix-ByKTZOWt.js";import"./analytics-Cr0S8IWA.js";import"./query-BDyhWc0a.js";import"./forms-C2WokjyS.js";import"./user-session-store-DFBUdIRP.js";import"./useStudyRoomsClient-Boab5BOV.js";/*!
2 * matrix 3.15.0
3 * https://gsap.com
4 *
5 * Copyright 2008-2026, GreenSock. All rights reserved.
6 * Subject to the terms at https://gsap.com/standard-license
7 * @author: Jack Doyle, [email protected]
8*/var Re,Qe,di,Bt,ft,Dt,Lt,mt,Ne="transform",ri=Ne+"Origin",Hi,zi=function(e){var n=e.ownerDocument||e;for(!(Ne in e.style)&&("msTransform"in e.style)&&(Ne="msTransform",ri=Ne+"Origin");n.parentNode&&(n=n.parentNode););if(Qe=window,Lt=new Ke,n){Re=n,di=n.documentElement,Bt=n.body,mt=Re.createElementNS("http://www.w3.org/2000/svg","g"),mt.style.transform="none";var i=n.createElement("div"),o=n.createElement("div"),l=n&&(n.body||n.firstElementChild);l&&l.appendChild&&(l.appendChild(i),i.appendChild(o),i.style.position="static",i.style.transform="translate3d(0,0,1px)",Hi=o.offsetParent!==i,l.removeChild(i))}return n},Fn=function(e){for(var n,i;e&&e!==Bt;)i=e._gsap,i&&i.uncache&&i.get(e,"x"),i&&!i.scaleX&&!i.scaleY&&i.renderTransform&&(i.scaleX=i.scaleY=1e-4,i.renderTransform(1,i),n?n.push(i):n=[i]),e=e.parentNode;return n},Gi=[],Wi=[],In=function(){return Qe.pageYOffset||Re.scrollTop||di.scrollTop||Bt.scrollTop||0},Hn=function(){return Qe.pageXOffset||Re.scrollLeft||di.scrollLeft||Bt.scrollLeft||0},fi=function(e){return e.ownerSVGElement||((e.tagName+"").toLowerCase()==="svg"?e:null)},zn=function r(e){if(Qe.getComputedStyle(e).position==="fixed")return!0;if(e=e.parentNode,e&&e.nodeType===1)return r(e)},Kt=function r(e,n){if(e.parentNode&&(Re||zi(e))){var i=fi(e),o=i?i.getAttribute("xmlns")||"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",l=i?n?"rect":"g":"div",d=n!==2?0:100,u=n===3?100:0,p={position:"absolute",display:"block",pointerEvents:"none",margin:"0",padding:"0"},f=Re.createElementNS?Re.createElementNS(o.replace(/^https/,"http"),l):Re.createElement(l);return n&&(i?(Dt||(Dt=r(e)),f.setAttribute("width",.01),f.setAttribute("height",.01),f.setAttribute("transform","translate("+d+","+u+")"),f.setAttribute("fill","transparent"),Dt.appendChild(f)):(ft||(ft=r(e),Object.assign(ft.style,p)),Object.assign(f.style,p,{width:"0.1px",height:"0.1px",top:u+"px",left:d+"px"}),ft.appendChild(f))),f}throw"Need document and parent."},Gn=function(e){for(var n=new Ke,i=0;i<e.numberOfItems;i++)n.multiply(e.getItem(i).matrix);return n},Wn=function(e){var n=e.getCTM(),i;return n||(i=e.style[Ne],e.style[Ne]="none",e.appendChild(mt),n=mt.getCTM(),e.removeChild(mt),i?e.style[Ne]=i:e.style.removeProperty(Ne.replace(/([A-Z])/g,"-$1").toLowerCase())),n||Lt.clone()}
8,$n=function(e,n){var i=fi(e),o=e===i,l=i?Gi:Wi,d=e.parentNode,u=d&&!i&&d.shadowRoot&&d.shadowRoot.appendChild?d.shadowRoot:d,p,f,g,v,y,t;if(e===Qe)return e;if(l.length||l.push(Kt(e,1),Kt(e,2),Kt(e,3)),p=i?Dt:ft,i)o?(g=Wn(e),v=-g.e/g.a,y=-g.f/g.d,f=Lt):e.getBBox?(g=e.getBBox(),f=e.transform?e.transform.baseVal:{},f=f.numberOfItems?f.numberOfItems>1?Gn(f):f.getItem(0).matrix:Lt,v=f.a*g.x+f.c*g.y,y=f.b*g.x+f.d*g.y):(f=new Ke,v=y=0),(o||!e.getBoundingClientRect().width?i:d).appendChild(p),p.setAttribute("transform","matrix("+f.a+","+f.b+","+f.c+","+f.d+","+(f.e+v)+","+(f.f+y)+")");else{if(v=y=0,Hi)for(f=e.offsetParent,g=e;g&&(g=g.parentNode)&&g!==f&&g.parentNode;)(Qe.getComputedStyle(g)[Ne]+"").length>4&&(v=g.offsetLeft,y=g.offsetTop,g=0);if(t=Qe.getComputedStyle(e),t.position!=="absolute"&&t.position!=="fixed")for(f=e.offsetParent;d&&d!==f;)v+=d.scrollLeft||0,y+=d.scrollTop||0,d=d.parentNode;g=p.style,g.top=e.offsetTop-y+"px",g.left=e.offsetLeft-v+"px",g[Ne]=t[Ne],g[ri]=t[ri],g.position=t.position==="fixed"?"fixed":"absolute",u.appendChild(p)}return p},Zt=function(e,n,i,o,l,d,u){return e.a=n,e.b=i,e.c=o,e.d=l,e.e=d,e.f=u,e},Ke=function(){function r(n,i,o,l,d,u){n===void 0&&(n=1),i===void 0&&(i=0),o===void 0&&(o=0),l===void 0&&(l=1),d===void 0&&(d=0),u===void 0&&(u=0),Zt(this,n,i,o,l,d,u)}var e=r.prototype;return e.inverse=function(){var i=this.a,o=this.b,l=this.c,d=this.d,u=this.e,p=this.f,f=i*d-o*l||1e-10;return Zt(this,d/f,-o/f,-l/f,i/f,(l*p-d*u)/f,-(i*p-o*u)/f)},e.multiply=function(i){var o=this.a,l=this.b,d=this.c,u=this.d,p=this.e,f=this.f,g=i.a,v=i.c,y=i.b,t=i.d,w=i.e,E=i.f;return Zt(this,g*o+y*d,g*l+y*u,v*o+t*d,v*l+t*u,p+w*o+E*d,f+w*l+E*u)},e.clone=function(){return new r(this.a,this.b,this.c,this.d,this.e,this.f)},e.equals=function(i){var o=this.a,l=this.b,d=this.c,u=this.d,p=this.e,f=this.f;return o===i.a&&l===i.b&&d===i.c&&u===i.d&&p===i.e&&f===i.f},e.apply=function(i,o){o===void 0&&(o={});var l=i.x,d=i.y,u=this.a,p=this.b,f=this.c,g=this.d,v=this.e,y=this.f;return o.x=l*u+d*f+v||0,o.y=l*p+d*g+y||0,o},r}();function $e(r,e,n,i){if(!r||!r.parentNode||(Re||zi(r)).documentElement===r)return new Ke;var o=Fn(r),l=fi(r),d=l?Gi:Wi,u=$n(r),p=d[0].getBoundingClientRect(),f=d[1].getBoundingClientRect(),g=d[2].getBoundingClientRect(),v=u.parentNode,y=zn(r),t=new Ke((f.left-p.left)/100,(f.top-p.top)/100,(g.left-p.left)/100,(g.top-p.top)/100,p.left+(y?0:Hn()),p.top+(y?0:In()));if(v.removeChild(u),o)for(p=o.length;p--;)f=o[p],f.scaleX=f.scaleY=0,f.renderTransform(1,f);return e?t.inverse():t}function Ti(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Vn(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var M,I,he,je,Oe,Jt,Me,si,ht,Fe,$i,li,vt,hi,pt,fe,gt,Mt,Vi,ai,Yt=0,Qi=function(){return typeof window<"u"},Ui=function(){return M||Qi()&&(M=window.gsap)&&M.registerPlugin&&M},Be=function(e){return typeof e=="function"},yt=function(e){return typeof e=="object"},Te=function(e){return typeof e>"u"},Rt=function(){return!1},bt="transform",ci="transformOrigin",re=function(e){return Math.round(e*1e4)/1e4},dt=Array.isArray,Et=function(e,n){var i=he.createElementNS?he.createElementNS("http://www.w3.org/1999/xhtml".replace(/^https/,"http"),e):he.createElement(e);return i.style?i:he.createElement(e)},Ni=180/Math.PI,Ge=1e20,Qn=new Ke,Xe=Date.now||function(){return new Date().getTime()},Ue=[],et={},Un=0,Kn=/^(?:a|input|textarea|button|select)$/i,ji=0,Ze={},De={},Ki=function(e,n){var i={},o;for(o in e)i[o]=n?e[o]*n:e[o];return i},Zn=function(e,n){for(var i in n)i in e||(e[i]=n[i]);return e},Ei=function r(e,n){for(var i=e.length,o;i--;)n?e[i].style.touchAction=n:e[i].style.removeProperty("touch-action"),o=e[i].children,o&&o.length&&r(o,n)},Zi=function(){return Ue.forEach(function(e){return e()})},Jn=function(e){Ue.push(e),Ue.length===1&&M.ticker.add(Zi)},Ci=function(){return!Ue.length&&M.ticker.remove(Zi)},ki=function(e){for(var n=Ue.length;n--;)Ue[n]===e&&Ue.splice(n,1);M.to(Ci,{overwrite:!0,delay:15,duration:0,onComplete:Ci,data:"_draggable"})},qn=function(e,n){for(var i in n)i in e||(e[i]=n[i]);return e},q=function(e,n,i,o){if(e.addEventListener){var l=vt[n];o=o||($i?{passive:!1}:null),e.addEventListener(l||n,i,o),l&&n!==l&&e.addEventListener(n,i,o)}},K=function(e,n,i,o){if(e.removeEventListener){var l=vt[n];e.removeEventListener(l||n,i,o),l&&n!==l&&e.removeEventListener(n,i,o)}},ye=function(e){e.preventDefault&&e.preventDefault(),e.preventManipulation&&e.preventManipulation()},eo=function(e,n){for(var i=e.length;i--;)if(e[i].identifier===n)return!0},to=function r(e){hi=e.touches&&Yt<e.touches.length,K(e.target,"touchend",r)},Pi=function(e){hi=e.touches&&Yt<e.touches.length,q(e.target,"touchend",to)},tt=function(e){return I.pageYOffset||e.scrollTop||e.documentElement.scrollTop||e.body.scrollTop||0},it=function(e){return I.pageXOffset||e.scrollLeft||e.documentElement.scrollLeft||e.body.scrollLeft||0},Di=function r(e,n){q(e,"scroll",n),nt(e.parentNode)||r(e.parentNode,n)},Mi=function r(e,n){K(e,"scroll",n),nt(e.parentNode)||r(e.parentNode,n)},nt=function(e){return!e||e===je||e.nodeType===9||e===he.body||e===I||!e.nodeType||!e.parentNode},Ri=function(e,n){var i=n==="x"?"Width":"Height",o="scroll"+i,l="client"+i;return Math.max(0,nt(e)?Math.max(je[o],Oe[o])-(I["inner"+i]||je[l]||Oe[l]):e[o]-e[l])},qt=function r(e,n){var i=Ri(e,"x"),o=Ri(e,"y");nt(e)?e=De:r(e.parentNode,n),e._gsMaxScrollX=i,e._gsMaxScrollY=o,n||(e._gsScrollX=e.scrollLeft||0,e._gsScrollY=e.scrollTop||0)},ei=function(e,n,i){var o=e.style;o&&(Te(o[n])&&(n=ht(n,e)||n),i==null?o.removeProperty&&o.removeProperty(n.replace(/([A-Z])/g,"-$1").toLowerCase()):o[n]=i)},_t=function(e){return I.getComputedStyle(e instanceof Element?e:e.host||(e.parentNode||{}).host||e)},We={},Je=function(e){if(e===I)return We.left=We.top=0,We.width=We.right=je.clientWidth||e.innerWidth||Oe.clientWidth||0,We.height=We.bottom=(e.innerHe
8ight||0)-20<je.clientHeight?je.clientHeight:e.innerHeight||Oe.clientHeight||0,We;var n=e.ownerDocument||he,i=Te(e.pageX)?!e.nodeType&&!Te(e.left)&&!Te(e.top)?e:Fe(e)[0].getBoundingClientRect():{left:e.pageX-it(n),top:e.pageY-tt(n),right:e.pageX-it(n)+1,bottom:e.pageY-tt(n)+1};return Te(i.right)&&!Te(i.width)?(i.right=i.left+i.width,i.bottom=i.top+i.height):Te(i.width)&&(i={width:i.right-i.left,height:i.bottom-i.top,right:i.right,left:i.left,bottom:i.bottom,top:i.top}),i},V=function(e,n,i){var o=e.vars,l=o[i],d=e._listeners[n],u;return Be(l)&&(u=l.apply(o.callbackScope||e,o[i+"Params"]||[e.pointerEvent])),d&&e.dispatchEvent(n)===!1&&(u=!1),u},Oi=function(e,n){var i=Fe(e)[0],o,l,d;return!i.nodeType&&i!==I?Te(e.left)?(l=e.min||e.minX||e.minRotation||0,o=e.min||e.minY||0,{left:l,top:o,width:(e.max||e.maxX||e.maxRotation||0)-l,height:(e.max||e.maxY||0)-o}):(d={x:0,y:0},{left:e.left-d.x,top:e.top-d.y,width:e.width,height:e.height}):io(i,n)},be={},io=function(e,n){n=Fe(n)[0];var i=e.getBBox&&e.ownerSVGElement,o=e.ownerDocument||he,l,d,u,p,f,g,v,y,t,w,E,B,L;if(e===I)u=tt(o),l=it(o),d=l+(o.documentElement.clientWidth||e.innerWidth||o.body.clientWidth||0),p=u+((e.innerHeight||0)-20<o.documentElement.clientHeight?o.documentElement.clientHeight:e.innerHeight||o.body.clientHeight||0);else{if(n===I||Te(n))return e.getBoundingClientRect();l=u=0,i?(w=e.getBBox(),E=w.width,B=w.height):(e.viewBox&&(w=e.viewBox.baseVal)&&(l=w.x||0,u=w.y||0,E=w.width,B=w.height),E||(L=_t(e),w=L.boxSizing==="border-box",E=(parseFloat(L.width)||e.clientWidth||0)+(w?0:parseFloat(L.borderLeftWidth)+parseFloat(L.borderRightWidth)),B=(parseFloat(L.height)||e.clientHeight||0)+(w?0:parseFloat(L.borderTopWidth)+parseFloat(L.borderBottomWidth)))),d=E,p=B}return e===n?{left:l,top:u,width:d-l,height:p-u}:(f=$e(n,!0).multiply($e(e)),g=f.apply({x:l,y:u}),v=f.apply({x:d,y:u}),y=f.apply({x:d,y:p}),t=f.apply({x:l,y:p}),l=Math.min(g.x,v.x,y.x,t.x),u=Math.min(g.y,v.y,y.y,t.y),{left:l,top:u,width:Math.max(g.x,v.x,y.x,t.x)-l,height:Math.max(g.y,v.y,y.y,t.y)-u})},ti=function(e,n,i,o,l,d){var u={},p,f,g;if(n)if(l!==1&&n instanceof Array){if(u.end=p=[],g=n.length,yt(n[0]))for(f=0;f<g;f++)p[f]=Ki(n[f],l);else for(f=0;f<g;f++)p[f]=n[f]*l;i+=1.1,o-=1.1}else Be(n)?u.end=function(v){var y=n.call(e,v),t,w;if(l!==1)if(yt(y)){t={};for(w in y)t[w]=y[w]*l;y=t}else y*=l;return y}:u.end=n;return(i||i===0)&&(u.max=i),(o||o===0)&&(u.min=o),d&&(u.velocity=0),u},no=function r(e){var n;return!e||!e.getAttribute||e===Oe?!1:(n=e.getAttribute("data-clickable"))==="true"||n!=="false"&&(Kn.test(e.nodeName+"")||e.getAttribute("contentEditable")==="true")?!0:r(e.parentNode)},Ct=function(e,n){for(var i=e.length,o;i--;)o=e[i],o.ondragstart=o.onselectstart=n?null:Rt,M.set(o,{lazy:!0,userSelect:n?"text":"none"})},oo=function r(e){if(_t(e).position==="fixed")return!0;if(e=e.parentNode,e&&e.nodeType===1)return r(e)},Ji,ui,ro=function(e,n){e=M.utils.toArray(e)[0],n=n||{};var i=document.createElement("div"),o=i.style,l=e.firstChild,d=0,u=0,p=e.scrollTop,f=e.scrollLeft,g=e.scrollWidth,v=e.scrollHeight,y=0,t=0,w=0,E,B,L,pe,we,ce;Ji&&n.force3D!==!1?(we="translate3d(",ce="px,0px)"):bt&&(we="translate(",ce="px)"),this.scrollTop=function(_,F){if(!arguments.length)return-this.top();this.top(-_,F)},this.scrollLeft=function(_,F){if(!arguments.length)return-this.left();this.left(-_,F)},this.left=function(_,F){if(!arguments.length)return-(e.scrollLeft+u);var O=e.scrollLeft-f,S=u;if((O>2||O<-2)&&!F){f=e.scrollLeft,M.killTweensOf(this,{left:1,scrollLeft:1}),this.left(-f),n.onKill&&n.onKill();return}_=-_,_<0?(u=_-.5|0,_=0):_>t?(u=_-t|0,_=t):u=0,(u||S)&&(this._skip||(o[bt]=we+-u+"px,"+-d+ce),u+y>=0&&(o.paddingRight=u+y+"px")),e.scrollLeft=_|0,f=e.scrollLeft},this.top=function(_,F){if(!arguments.length)return-(e.scrollTop+d);var O=e.scrollTop-p,S=d;if((O>2||O<-2)&&!F){p=e.scrollTop,M.killTweensOf(this,{top:1,scrollTop:1}),this.top(-p),n.onKill&&n.onKill();return}_=-_,_<0?(d=_-.5|0,_=0):_>w?(d=_-w|0,_=w):d=0,(d||S)&&(this._skip||(o[bt]=we+-u+"px,"+-d+ce)),e.scrollTop=_|0,p=e.scrollTop},this.maxScrollTop=function(){return w},this.maxScrollLeft=function(){return t},this.disable=function(){for(l=i.firstChild;l;)pe=l.nextSibling,e.appendChild(l),l=pe;e===i.parentNode&&e.removeChild(i)},this.enable=function(){if(l=e.firstChild,l!==i){for(;l;)pe=l.nextSibling,i.appendChild(l),l=pe;e.appendChild(i),this.calibrate()}},this.calibrate=function(_){var F=e.clientWidth===E,O,S,A;p=e.scrollTop,f=e.scrollLeft,!(F&&e.clientHeight===B&&i.offsetHeight===L&&g===e.scrollWidth&&v===e.scrollHeight&&!_)&&((d||u)&&(S=this.left(),A=this.top(),this.left(-e.scrollLeft),this.top(-e.scrollTop)),O=_t(e),(!F||_)&&(o.display="block",o.width="auto",o.paddingRight="0px",y=Math.max(0,e.scrollWidth-e.clientWidth),y&&(y+=parseFloat(O.paddingLeft)+(ui?parseFloat(O.paddingRight):0))),o.display="inline-block",o.position="relative",o.overflow="visible",o.verticalAlign="top",o.boxSizing="content-box",o.width="100%",o.paddingRight=y+"px",ui&&(o.paddingBottom=O.paddingBottom),E=e.clientWidth,B=e.clientHeight,g=e.scrollWidth,v=e.scrollHeight,t=e.scrollWidth-E,w=e.scrollHeight-B,L=i.offsetHeight,o.display="block",(S||A)&&(this.left(S),this.top(A)))},this.content=i,this.element=e,this._skip=!1,this.enable()},ii=function(e){if(Qi()&&document.body){var n=window&&window.navigator;I=window,he=document,je=he.documentElement,Oe=he.body,Jt=Et("div"),Mt=!!window.PointerEvent,Me=Et("div"),Me.style.cssText="visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;cursor:grab",gt=Me.style.cursor==="grab"?"grab":"move",pt=n&&n.userAgent.toLowerCase().indexOf("android")!==-1,li="ontouchstart"in je&&"orientation"in I||n&&(n.MaxTouchPoints>
80||n.msMaxTouchPoints>0),ui=function(){var i=Et("div"),o=Et("div"),l=o.style,d=Oe,u;return l.display="inline-block",l.position="relative",i.style.cssText="width:90px;height:40px;padding:10px;overflow:auto;visibility:hidden",i.appendChild(o),d.appendChild(i),u=o.offsetHeight+18>i.scrollHeight,d.removeChild(i),u}(),vt=function(i){for(var o=i.split(","),l=("onpointerdown"in Jt?"pointerdown,pointermove,pointerup,pointercancel":"onmspointerdown"in Jt?"MSPointerDown,MSPointerMove,MSPointerUp,MSPointerCancel":i).split(","),d={},u=4;--u>-1;)d[o[u]]=l[u],d[l[u]]=o[u];try{je.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){$i=1}}))}catch{}return d}("touchstart,touchmove,touchend,touchcancel"),q(he,"touchcancel",Rt),q(I,"touchmove",Rt),Oe&&Oe.addEventListener("touchstart",Rt),q(he,"contextmenu",function(){for(var i in et)et[i].isPressed&&et[i].endDrag()}),M=si=Ui()}M?(fe=M.plugins.inertia,Vi=M.core.context||function(){},ht=M.utils.checkPrefix,bt=ht(bt),ci=ht(ci),Fe=M.utils.toArray,ai=M.core.getStyleSaver,Ji=!!ht("perspective")):e&&console.warn("Please gsap.registerPlugin(Draggable)")},so=function(){function r(n){this._listeners={},this.target=n||this}var e=r.prototype;return e.addEventListener=function(i,o){var l=this._listeners[i]||(this._listeners[i]=[]);~l.indexOf(o)||l.push(o)},e.removeEventListener=function(i,o){var l=this._listeners[i],d=l&&l.indexOf(o);d>=0&&l.splice(d,1)},e.dispatchEvent=function(i){var o=this,l;return(this._listeners[i]||[]).forEach(function(d){return d.call(o,{type:i,target:o.target})===!1&&(l=!1)}),l},r}(),ot=function(r){Vn(e,r);function e(n,i){var o;o=r.call(this)||this,si||ii(1),n=Fe(n)[0],o.styles=ai&&ai(n,"transform,left,top"),fe||(fe=M.plugins.inertia),o.vars=i=Ki(i||{}),o.target=n,o.x=o.y=o.rotation=0,o.dragResistance=parseFloat(i.dragResistance)||0,o.edgeResistance=isNaN(i.edgeResistance)?1:parseFloat(i.edgeResistance)||0,o.lockAxis=i.lockAxis,o.autoScroll=i.autoScroll||0,o.lockedAxis=null,o.allowEventDefault=!!i.allowEventDefault,M.getProperty(n,"x");var l=(i.type||"x,y").toLowerCase(),d=~l.indexOf("x")||~l.indexOf("y"),u=l.indexOf("rotation")!==-1,p=u?"rotation":d?"x":"left",f=d?"y":"top",g=!!(~l.indexOf("x")||~l.indexOf("left")||l==="scroll"),v=!!(~l.indexOf("y")||~l.indexOf("top")||l==="scroll"),y=i.minimumMovement||2,t=Ti(o),w=Fe(i.trigger||i.handle||n),E={},B=0,L=!1,pe=i.autoScrollMarginTop||40,we=i.autoScrollMarginRight||40,ce=i.autoScrollMarginBottom||40,_=i.autoScrollMarginLeft||40,F=i.clickableTest||no,O=0,S=n._gsap||M.core.getCache(n),A=oo(n),ee=function(s,h){return parseFloat(S.get(n,s,h))},P=n.ownerDocument||he,se,j,le,Z,G,W,Ee,rt,ke,H,z,J,Q,St,ge,st,te,Ft,Ae,Le,Ie,lt,ie,D,pi,xe,ve,It,Ht,gi,ue,xi,Tt,mi=function(s){return ye(s),s.stopImmediatePropagation&&s.stopImmediatePropagation(),!1},Ce=function N(s){if(t.autoScroll&&t.isDragging&&(L||te)){var h=n,c=t.autoScroll*15,x,m,b,k,T,Y,R,X;for(L=!1,De.scrollTop=I.pageYOffset!=null?I.pageYOffset:P.documentElement.scrollTop!=null?P.documentElement.scrollTop:P.body.scrollTop,De.scrollLeft=I.pageXOffset!=null?I.pageXOffset:P.documentElement.scrollLeft!=null?P.documentElement.scrollLeft:P.body.scrollLeft,k=t.pointerX-De.scrollLeft,T=t.pointerY-De.scrollTop;h&&!m;)m=nt(h.parentNode),x=m?De:h.parentNode,b=m?{bottom:Math.max(je.clientHeight,I.innerHeight||0),right:Math.max(je.clientWidth,I.innerWidth||0),left:0,top:0}:x.getBoundingClientRect(),Y=R=0,v&&(X=x._gsMaxScrollY-x.scrollTop,X<0?R=X:T>b.bottom-ce&&X?(L=!0,R=Math.min(X,c*(1-Math.max(0,b.bottom-T)/ce)|0)):T<b.top+pe&&x.scrollTop&&(L=!0,R=-Math.min(x.scrollTop,c*(1-Math.max(0,T-b.top)/pe)|0)),R&&(x.scrollTop+=R)),g&&(X=x._gsMaxScrollX-x.scrollLeft,X<0?Y=X:k>b.right-we&&X?(L=!0,Y=Math.min(X,c*(1-Math.max(0,b.right-k)/we)|0)):k<b.left+_&&x.scrollLeft&&(L=!0,Y=-Math.min(x.scrollLeft,c*(1-Math.max(0,k-b.left)/_)|0)),Y&&(x.scrollLeft+=Y)),m&&(Y||R)&&(I.scrollTo(x.scrollLeft,x.scrollTop),ut(t.pointerX+Y,t.pointerY+R)),h=x}if(te){var $=t.x,oe=t.y;u?(t.deltaX=$-parseFloat(S.rotation),t.rotation=$,S.rotation=$+"deg",S.renderTransform(1,S)):j?(v&&(t.deltaY=oe-j.top(),j.top(oe)),g&&(t.deltaX=$-j.left(),j.left($))):d?(v&&(t.deltaY=oe-parseFloat(S.y),S.y=oe+"px"),g&&(t.deltaX=$-parseFloat(S.x),S.x=$+"px"),S.renderTransform(1,S)):(v&&(t.deltaY=oe-parseFloat(n.style.top||0),n.style.top=oe+"px"),g&&(t.deltaX=$-parseFloat(n.style.left||0),n.style.left=$+"px")),rt&&!s&&!It&&(It=!0,V(t,"drag","onDrag")===!1&&(g&&(t.x-=t.deltaX),v&&(t.y-=t.deltaY),N(!0)),It=!1)}te=!1},He=function(s,h){var c=t.x,x=t.y,m,b;n._gsap||(S=M.core.getCache(n)),S.uncache&&M.getProperty(n,"x"),d?(t.x=parseFloat(S.x),t.y=parseFloat(S.y)):u?t.x=t.rotation=re(parseFloat(S.rotation)):j?(t.y=j.top(),t.x=j.left()):(t.y=parseFloat(n.style.top||(b=_t(n))&&b.top)||0,t.x=parseFloat(n.style.left||(b||{}).left)||0),(Ae||Le||Ie)&&!h&&(t.isDragging||t.isThrowing)&&(Ie&&(Ze.x=t.x,Ze.y=t.y,m=Ie(Ze),m.x!==t.x&&(t.x=m.x,te=!0),m.y!==t.y&&(t.y=m.y,te=!0)),Ae&&(m=Ae(t.x),m!==t.x&&(t.x=m,u&&(t.rotation=m),te=!0)),Le&&(m=Le(t.y),m!==t.y&&(t.y=m),te=!0)),te&&Ce(!0),s||(t.deltaX=t.x-c,t.deltaY=t.y-x,V(t,"throwupdate","onThrowUpdate"))},zt=function(s,h,c,x){return h==null&&(h=-Ge),c==null&&(c=Ge),Be(s)?function(m){var b=t.isPressed?1-t.edgeResistance:1;return s.call(t,(m>c?c+(m-c)*b:m<h?h+(m-h)*b:m)*x)*x}:dt(s)?function(m){for(var b=s.length,k=0,T=Ge,Y,R;--b>-1;)Y=s[b],R=Y-m,R<0&&(R=-R),R<T&&Y>=h&&Y<=c&&(k=b,T=R);return s[k]}:isNaN(s)?function(m){return m}:function(){return s*x}},rn=function(s,h,c,x,m,b,k){return b=b&&b<Ge?b*b:Ge,Be(s)?function(T){var Y=t.isPressed?1-t.edgeResistance:1,R=T.x,X=T.y,$,oe,Pe;return T.x=R=R>c?c+(R-c)*Y:R<h?h+(R-h)*Y:R,T.y=X=X>m?m+(X-m)*Y:X<x?x+(X-x)*Y:X,$=s.call(t,T),$!==T&&(T.x=$.x,T.y=$.y),k!==1&&(T.x*=k,T.y*=k),b<Ge&&(oe=T.x-R,Pe=T.y-X,oe*oe+Pe*Pe>b&&(T.x=R,T.y=X)),T}:dt(s)?function(T){for(var Y=s.length,R=0,X=Ge,$,oe,Pe,me;--Y>-1;)Pe=s[Y],$=Pe.x-T.x,oe=Pe.y-T.y,me=$*$+oe*oe,me<X&&(R=Y,X=me);return X<=b?s[R]:T}:function(T){return T}},Gt=function(){var s,h,c,x;Ee=!1,j?(j.calibrate(),t.minX=z=-j.maxScrollLeft(),t.minY=Q=-j.maxScrollTop(),t.maxX=H=t.maxY=J=0,Ee=!0):i.bounds&&(s=Oi(i.bounds,n.parentNode),u?(t.minX=z=s.left,t.maxX=H=s.left+s.width,t.minY=Q=t.maxY=J=0):!Te(i.bounds.maxX)||!Te(i.bounds.maxY)?(s=i.bounds,t.minX=z=s.minX,t.minY=Q=s.minY,t.maxX=H=s.maxX,t.maxY=J=s.maxY):(h=Oi(n,n.parentNode),t.minX=z=Math.round(ee(p,"px")+s.left-h.left),t.minY=Q=Math.round(ee(f,"px")+s.top-h.top),t.maxX=H=Math.round(z+(s.width-h.width)),t.maxY=J=Math.round(Q+(s.height-h.height))),z>H&&(t.minX=H,t.maxX=H=z,z=t.minX),Q>J&&(t.minY=J,t.maxY=J=Q,Q=t.minY),u&&(t.minRotation=z,t.maxRotation=H),Ee=!0),i.liveSnap&&(c=i.liveSnap===!0?i.snap||{}:i.liveSnap,x=dt(c)||Be(c),u?(Ae=zt(x?c:c.rotation,z,H,1),Le=null):c.points?Ie=rn(x?c:c.points,z,H,Q,J,c.radius,j?-1:1):(g&&(Ae=zt(x?c:c.x||c.left||c.scrollLeft,z,H,j?-1:1)),v&&(Le=zt(x?c:c.y||c.top||c.scrollTop,Q,J,j?-1:1))))},sn=function(){t.isThrowing=!1,V(t,"throwcomplete","onThrowComplete")},ln=function(){t.isThrowing=!1},Wt=function(s,h){var c,x,m,b;s&&fe?(s===!0&&(c=i.snap||i.liveSnap||{},x=dt(c)||Be(c),s={resistance:(i.throwResistance||i.resistance||1e3)/(u?10:1)},u?s.rotation=ti(t,x?c:c.rotation,H,z,1,h):(g&&(s[p]=ti(t,x?c:c.points||c.x||c.left,H,z,j?-1:1,h||t.lockedAxis==="x")),v&&(s[f]=ti(t,x?c:c.points||c.y||c.top,J,Q,j?-1:1,h||t.lockedAxis==="y")),(c.points||dt(c)&&yt(c[0]))&&(s.linkedProps=p+","+f,s.radius=c.radius))),t.isThrowing=!0,b=isNaN(i.overshootTolerance)?i.edgeResistance===1?0:1-t.edgeResistance+.2:i.overshootTolerance,s.duration||(s.duration={max:Math.max(i.minDuration||0,"maxDuration"in i?i.maxDuration:2),min:isNaN(i.minDuration)?b===0||yt(s)&&s.resistance>1e3?0:.5:i.minDuration,overshoot:b}),t.tween=m=M.to(j||n,{inertia:s,data:"_draggable",inherit:!1,onComplete:sn,onInterrupt:ln,onUp
8date:i.fastMode?V:He,onUpdateParams:i.fastMode?[t,"onthrowupdate","onThrowUpdate"]:c&&c.radius?[!1,!0]:[]}),i.fastMode||(j&&(j._skip=!0),m.render(1e9,!0,!0),He(!0,!0),t.endX=t.x,t.endY=t.y,u&&(t.endRotation=t.x),m.play(0),He(!0,!0),j&&(j._skip=!1))):Ee&&t.applyBounds()},yi=function(s){var h=D,c;D=$e(n.parentNode,!0),s&&t.isPressed&&!D.equals(h||new Ke)&&(c=h.inverse().apply({x:le,y:Z}),D.apply(c,c),le=c.x,Z=c.y),D.equals(Qn)&&(D=null)},Nt=function(){var s=1-t.edgeResistance,h=A?it(P):0,c=A?tt(P):0,x,m,b;d&&(S.x=ee(p,"px")+"px",S.y=ee(f,"px")+"px",S.renderTransform()),yi(!1),be.x=t.pointerX-h,be.y=t.pointerY-c,D&&D.apply(be,be),le=be.x,Z=be.y,te&&(ut(t.pointerX,t.pointerY),Ce(!0)),xi=$e(n),j?(Gt(),W=j.top(),G=j.left()):(at()?(He(!0,!0),Gt()):t.applyBounds(),u?(x=n.ownerSVGElement?[S.xOrigin-n.getBBox().x,S.yOrigin-n.getBBox().y]:(_t(n)[ci]||"0 0").split(" "),st=t.rotationOrigin=$e(n).apply({x:parseFloat(x[0])||0,y:parseFloat(x[1])||0}),He(!0,!0),m=t.pointerX-st.x-h,b=st.y-t.pointerY+c,G=t.x,W=t.y=Math.atan2(b,m)*Ni):(W=ee(f,"px"),G=ee(p,"px"))),Ee&&s&&(G>H?G=H+(G-H)/s:G<z&&(G=z-(z-G)/s),u||(W>J?W=J+(W-J)/s:W<Q&&(W=Q-(Q-W)/s))),t.startX=G=re(G),t.startY=W=re(W)},at=function(){return t.tween&&t.tween.isActive()},an=function(){Me.parentNode&&!at()&&!t.isDragging&&Me.parentNode.removeChild(Me)},ct=function(s,h){var c;if(!se||t.isPressed||!s||(s.type==="mousedown"||s.type==="pointerdown")&&!h&&Xe()-O<30&&vt[t.pointerEvent.type]){ue&&s&&se&&ye(s);return}if(pi=at(),Tt=!1,t.pointerEvent=s,vt[s.type]?(ie=~s.type.indexOf("touch")?s.currentTarget||s.target:P,q(ie,"touchend",_e),q(ie,"touchmove",ze),q(ie,"touchcancel",_e),q(P,"touchstart",Pi)):(ie=null,q(P,"mousemove",ze)),ve=null,(!Mt||!ie)&&(q(P,"mouseup",_e),s&&s.target&&q(s.target,"mouseup",_e)),lt=F.call(t,s.target)&&i.dragClickables===!1&&!h,lt){q(s.target,"change",_e),V(t,"pressInit","onPressInit"),V(t,"press","onPress"),Ct(w,!0),ue=!1;return}if(xe=!ie||g===v||t.vars.allowNativeTouchScrolling===!1||t.vars.allowContextMenu&&s&&(s.ctrlKey||s.which>2)?!1:g?"y":"x",ue=!xe&&!t.allowEventDefault,ue&&(ye(s),q(I,"touchforcechange",ye)),s.changedTouches?(s=St=s.changedTouches[0],ge=s.identifier):s.pointerId?ge=s.pointerId:St=ge=null,Yt++,Jn(Ce),Z=t.pointerY=s.pageY,le=t.pointerX=s.pageX,V(t,"pressInit","onPressInit"),(xe||t.autoScroll)&&qt(n.parentNode),n.parentNode&&t.autoScroll&&!j&&!u&&n.parentNode._gsMaxScrollX&&!Me.parentNode&&!n.getBBox&&(Me.style.width=n.parentNode.scrollWidth+"px",n.parentNode.appendChild(Me)),Nt(),t.tween&&t.tween.kill(),t.isThrowing=!1,M.killTweensOf(j||n,E,!0),j&&M.killTweensOf(n,{scrollTo:1},!0),t.tween=t.lockedAxis=null,(i.zIndexBoost||!u&&!j&&i.zIndexBoost!==!1)&&(n.style.zIndex=e.zIndex++),t.isPressed=!0,rt=!!(i.onDrag||t._listeners.drag),ke=!!(i.onMove||t._listeners.move),i.cursor!==!1||i.activeCursor)for(c=w.length;--c>-1;)M.set(w[c],{cursor:i.activeCursor||i.cursor||(gt==="grab"?"grabbing":gt)});V(t,"press","onPress"),fe&&fe.track(j||n,d?"x,y":u?"rotation":"top,left")},ze=function(s){var h=s,c,x,m,b,k,T;if(!se||hi||!t.isPressed||!s){ue&&s&&se&&ye(s);return}if(t.pointerEvent=s,c=s.changedTouches,c){if(s=c[0],s!==St&&s.identifier!==ge){for(b=c.length;--b>-1&&(s=c[b]).identifier!==ge&&s.target!==n;);if(b<0)return}}else if(s.pointerId&&ge&&s.pointerId!==ge)return;if(ie&&xe&&!ve&&(be.x=s.pageX-(A?it(P):0),be.y=s.pageY-(A?tt(P):0),D&&D.apply(be,be),x=be.x,m=be.y,k=Math.abs(x-le),T=Math.abs(m-Z),(k!==T&&(k>y||T>y)||pt&&xe===ve)&&(ve=k>T&&g?"x":"y",xe&&ve!==xe&&q(I,"touchforcechange",ye),t.vars.lockAxisOnTouchScroll!==!1&&g&&v&&(t.lockedAxis=ve==="x"?"y":"x",Be(t.vars.onLockAxis)&&t.vars.onLockAxis.call(t,h)),pt&&xe===ve))){_e(h);return}!t.allowEventDefault&&(!xe||ve&&xe!==ve)&&h.cancelable!==!1?(ye(h),ue=!0):ue&&(ue=!1),t.autoScroll&&(L=!0),ut(s.pageX,s.pageY,ke)},ut=function(s,h,c){var x=1-t.dragResistance,m=1-t.edgeResistance,b=t.pointerX,k=t.pointerY,T=W,Y=t.x,R=t.y,X=t.endX,$=t.endY,oe=t.endRotation,Pe=te,me,Ye,ne,U,$t,de;t.pointerX=s,t.pointerY=h,A&&(s-=it(P),h-=tt(P)),u?(U=re(Math.atan2(st.y-h,s-st.x)*Ni),$t=t.y-U,$t>180?(W-=360,t.y=U):$t<-180&&(W+=360,t.y=U),D&&(de=s*D.a+h*D.c+D.e,h=s*D.b+h*D.d+D.f,s=de),t.x!==G||Math.max(Math.abs(le-s),Math.abs(Z-h))>
8y?(t.y=U,ne=re(G+(W-U)*x)):ne=G):(D&&(de=s*D.a+h*D.c+D.e,h=s*D.b+h*D.d+D.f,s=de),Ye=h-Z,me=s-le,Ye<y&&Ye>-y&&(Ye=0),me<y&&me>-y&&(me=0),(t.lockAxis||t.lockedAxis)&&(me||Ye)&&(de=t.lockedAxis,de||(t.lockedAxis=de=g&&Math.abs(me)>Math.abs(Ye)?"y":v?"x":null,de&&Be(t.vars.onLockAxis)&&t.vars.onLockAxis.call(t,t.pointerEvent)),de==="y"?Ye=0:de==="x"&&(me=0)),ne=re(G+me*x),U=re(W+Ye*x)),(Ae||Le||Ie)&&(t.x!==ne||t.y!==U&&!u)&&(Ie&&(Ze.x=ne,Ze.y=U,de=Ie(Ze),ne=re(de.x),U=re(de.y)),Ae&&(ne=re(Ae(ne))),Le&&(U=re(Le(U)))),Ee&&(ne>H?ne=H+Math.round((ne-H)*m):ne<z&&(ne=z+Math.round((ne-z)*m)),u||(U>J?U=Math.round(J+(U-J)*m):U<Q&&(U=Math.round(Q+(U-Q)*m)))),(t.x!==ne||t.y!==U&&!u)&&(u?(t.endRotation=t.x=t.endX=re(ne),te=!0):(v&&(t.y=t.endY=U,te=!0),g&&(t.x=t.endX=ne,te=!0)),!c||V(t,"move","onMove")!==!1?!t.isDragging&&t.isPressed&&(t.isDragging=Tt=!0,V(t,"dragstart","onDragStart")):(t.pointerX=b,t.pointerY=k,W=T,t.x=Y,t.y=R,t.endX=X,t.endY=$,t.endRotation=oe,te=Pe))},_e=function N(s,h){if(!se||!t.isPressed||s&&ge!=null&&!h&&(s.pointerId&&s.pointerId!==ge&&s.target!==n||s.changedTouches&&!eo(s.changedTouches,ge))){ue&&s&&se&&ye(s);return}t.isPressed=!1;var c=s,x=t.isDragging,m=t.vars.allowContextMenu&&s&&(s.ctrlKey||s.which>2),b=M.delayedCall(.001,an),k,T,Y,R,X;if(ie?(K(ie,"touchend",N),K(ie,"touchmove",ze),K(ie,"touchcancel",N),K(P,"touchstart",Pi)):K(P,"mousemove",ze),K(I,"touchforcechange",ye),(!Mt||!ie)&&(K(P,"mouseup",N),s&&s.target&&K(s.target,"mouseup",N)),te=!1,x&&(B=ji=Xe(),t.isDragging=!1),ki(Ce),lt&&!m){s&&(K(s.target,"change",N),t.pointerEvent=c),Ct(w,!1),V(t,"release","onRelease"),V(t,"click","onClick"),lt=!1;return}for(T=w.length;--T>-1;)ei(w[T],"cursor",i.cursor||(i.cursor!==!1?gt:null));if(Yt--,s){if(k=s.changedTouches,k&&(s=k[0],s!==St&&s.identifier!==ge)){for(T=k.length;--T>-1&&(s=k[T]).identifier!==ge&&s.target!==n;);if(T<0&&!h)return}t.pointerEvent=c,t.pointerX=s.pageX,t.pointerY=s.pageY}return m&&c?(ye(c),ue=!0,V(t,"release","onRelease")):c&&!x?(ue=!1,pi&&(i.snap||i.bounds)&&Wt(i.inertia||i.throwProps),V(t,"release","onRelease"),(!pt||c.type!=="touchmove")&&c.type.indexOf("cancel")===-1&&(V(t,"click","onClick"),Xe()-O<300&&V(t,"doubleclick","onDoubleClick"),R=c.target||n,O=Xe(),X=function(){O!==Ht&&t.enabled()&&!t.isPressed&&!c.defaultPrevented&&(R.click?R.click():P.createEvent&&(Y=P.createEvent("MouseEvents"),Y.initMouseEvent("click",!0,!0,I,1,t.pointerEvent.screenX,t.pointerEvent.screenY,t.pointerX,t.pointerY,!1,!1,!1,!1,0,null),R.dispatchEvent(Y)))},!pt&&!c.defaultPrevented&&M.delayedCall(.05,X))):(Wt(i.inertia||i.throwProps),!t.allowEventDefault&&c&&(i.dragClickables!==!1||!F.call(t,c.target))&&x&&(!xe||ve&&xe===ve)&&c.cancelable!==!1?(ue=!0,ye(c)):ue=!1,V(t,"release","onRelease")),at()&&b.duration(t.tween.duration()),x&&V(t,"dragend","onDragEnd"),!0},jt=function(s){if(s&&t.isDragging&&!j){var h=s.target||n.parentNode,c=h.scrollLeft-h._gsScrollX,x=h.scrollTop-h._gsScrollY;(c||x)&&(D?(le-=c*D.a+x*D.c,Z-=x*D.d+c*D.b):(le-=c,Z-=x),h._gsScrollX+=c,h._gsScrollY+=x,ut(t.pointerX,t.pointerY))}},bi=function(s){var h=Xe(),c=h-O<100,x=h-B<50,m=c&&Ht===O,b=t.pointerEvent&&t.pointerEvent.defaultPrevented,k=c&&gi===O,T=s.isTrusted||s.isTrusted==null&&c&&m;if((m||x&&t.vars.suppressClickOnDrag!==!1)&&s.stopImmediatePropagation&&s.stopImmediatePropagation(),c&&!(t.pointerEvent&&t.pointerEvent.defaultPrevented)&&(!m||T&&!k)){T&&m&&(gi=O),Ht=O;return}(t.isPressed||x||c)&&(!T||!s.detail||!c||b)&&ye(s),!c&&!x&&!Tt&&(s&&s.target&&(t.pointerEvent=s),V(t,"click","onClick"))},wi=function(s){return D?{x:s.x*D.a+s.y*D.c+D.e,y:s.x*D.b+s.y*D.d+D.f}:{x:s.x,y:s.y}};return Ft=e.get(n),Ft&&Ft.kill(),o.startDrag=function(N,s){var h,c,x,m;ct(N||t.pointerEvent,!0),s&&!t.hitTest(N||t.pointerEvent)&&(h=Je(N||t.pointerEvent),c=Je(n),x=wi({x:h.left+h.width/2,y:h.top+h.height/2}),m=wi({x:c.left+c.width/2,y:c.top+c.height/2}),le-=x.x-m.x,Z-=x.y-m.y),t.isDragging||(t.isDragging=Tt=!0,V(t,"dragstart","onDragStart"))},o.drag=ze,o.endDrag=function(N){return _e(N||t.pointerEvent,!0)},o.timeSinceDrag=function(){return t.isDragging?0:(Xe()-B)/1e3},o.timeSinceClick=function(){return(Xe()-O)/1e3},o.hitTest=function(N,s){return e.hitTest(t.target,N,s)},o.getDirection=function(N,s){var h=N==="velocity"&&fe?N:yt(N)&&!u?"element":"start",c,x,m,b,k,T;return h==="element"&&(k=Je(t.target),T=Je(N)),c=h==="start"?t.x-G:h==="velocity"?fe.getVelocity(n,p):k.left+k.width/2-(T.left+T.width/2),u?c<0?"counter-clockwise":"clockwise":(s=s||2,x=h==="start"?t.y-W:h==="velocity"?fe.getVelocity(n,f):k.top+k.height/2-(T.top+T.height/2),m=Math.abs(c/x),b=m<1/s?"":c<0?"left":"right",m<s&&(b!==""&&(b+="-"),b+=x<0?"up":"down"),b)},o.applyBounds=function(N,s){var h,c,x,m,b,k;if(N&&i.bounds!==N)return i.bounds=N,t.update(!0,s);if(He(!0),Gt(),Ee&&!at()){if(h=t.x,c=t.y,h>
8H?h=H:h<z&&(h=z),c>J?c=J:c<Q&&(c=Q),(t.x!==h||t.y!==c)&&(x=!0,t.x=t.endX=h,u?t.endRotation=h:t.y=t.endY=c,te=!0,Ce(!0),t.autoScroll&&!t.isDragging))for(qt(n.parentNode),m=n,De.scrollTop=I.pageYOffset!=null?I.pageYOffset:P.documentElement.scrollTop!=null?P.documentElement.scrollTop:P.body.scrollTop,De.scrollLeft=I.pageXOffset!=null?I.pageXOffset:P.documentElement.scrollLeft!=null?P.documentElement.scrollLeft:P.body.scrollLeft;m&&!k;)k=nt(m.parentNode),b=k?De:m.parentNode,v&&b.scrollTop>b._gsMaxScrollY&&(b.scrollTop=b._gsMaxScrollY),g&&b.scrollLeft>b._gsMaxScrollX&&(b.scrollLeft=b._gsMaxScrollX),m=b;t.isThrowing&&(x||t.endX>H||t.endX<z||t.endY>J||t.endY<Q)&&Wt(i.inertia||i.throwProps,x)}return t},o.update=function(N,s,h){if(s&&t.isPressed){if(u)t.x=t.y=re(parseFloat(S.rotation));else{var c=$e(n),x=xi.apply({x:t.x-G,y:t.y-W}),m=$e(n.parentNode,!0);m.apply({x:c.e-x.x,y:c.f-x.y},x),t.x=re(t.x-(x.x-m.e)),t.y=re(t.y-(x.y-m.f))}Ce(!0),Nt()}var b=t.x,k=t.y;return yi(!s),N?t.applyBounds():(te&&h&&Ce(!0),He(!0)),s&&(ut(t.pointerX,t.pointerY),te&&Ce(!0)),t.isPressed&&!s&&(g&&Math.abs(b-t.x)>.01||v&&Math.abs(k-t.y)>.01&&!u)&&Nt(),t.autoScroll&&(qt(n.parentNode,t.isDragging),L=t.isDragging,Ce(!0),Mi(n,jt),Di(n,jt)),t},o.enable=function(N){var s={lazy:!0},h,c,x;if(i.cursor!==!1&&(s.cursor=i.cursor||gt),M.utils.checkPrefix("touchCallout")&&(s.touchCallout="none"),N!=="soft"){for(Ei(w,g===v?"none":i.allowNativeTouchScrolling&&n.scrollHeight===n.clientHeight==(n.scrollWidth===n.clientHeight)||i.allowEventDefault?"manipulation":g?"pan-y":"pan-x"),c=w.length;--c>-1;)x=w[c],Mt||q(x,"mousedown",ct),q(x,"touchstart",ct),q(x,"click",bi,!0),M.set(x,s),x.getBBox&&x.ownerSVGElement&&g!==v&&M.set(x.ownerSVGElement,{touchAction:i.allowNativeTouchScrolling||i.allowEventDefault?"manipulation":g?"pan-y":"pan-x"}),i.allowContextMenu||q(x,"contextmenu",mi);Ct(w,!1)}return Di(n,jt),se=!0,fe&&N!=="soft"&&fe.track(j||n,d?"x,y":u?"rotation":"top,left"),n._gsDragID=h=n._gsDragID||"d"+Un++,et[h]=t,j&&(j.enable(),j.element._gsDragID=h),(i.bounds||u)&&Nt(),i.bounds&&t.applyBounds(),t},o.disable=function(N){for(var s=t.isDragging,h=w.length,c;--h>-1;)ei(w[h],"cursor",null);if(N!=="soft"){for(Ei(w,null),h=w.length;--h>-1;)c=w[h],ei(c,"touchCallout",null),K(c,"mousedown",ct),K(c,"touchstart",ct),K(c,"click",bi,!0),K(c,"contextmenu",mi);Ct(w,!0),ie&&(K(ie,"touchcancel",_e),K(ie,"touchend",_e),K(ie,"touchmove",ze)),K(P,"mouseup",_e),K(P,"mousemove",ze)}return Mi(n,jt),se=!1,fe&&N!=="soft"&&(fe.untrack(j||n,d?"x,y":u?"rotation":"top,left"),t.tween&&t.tween.kill()),j&&j.disable(),ki(Ce),t.isDragging=t.isPressed=lt=!1,s&&V(t,"dragend","onDragEnd"),t},o.enabled=function(N,s){return arguments.length?N?t.enable(s):t.disable(s):se},o.kill=function(){return t.isThrowing=!1,t.tween&&t.tween.kill(),t.disable(),M.set(w,{clearProps:"userSelect"}),delete et[n._gsDragID],t},o.revert=function(){this.kill(),this.styles&&this.styles.revert()},~l.indexOf("scroll")&&(j=o.scrollProxy=new ro(n,Zn({onKill:function(){t.isPressed&&_e(null)}},i)),n.style.overflowY=v&&!li?"auto":"hidden",n.style.overflowX=g&&!li?"auto":"hidden",n=j.content),u?E.rotation=1:(g&&(E[p]=1),v&&(E[f]=1)),S.force3D="force3D"in i?i.force3D:!0,Vi(Ti(o)),o.enable(),o}return e.register=function(i){M=i,ii()},e.create=function(i,o){return si||ii(!0),Fe(i).map(function(l){return new e(l,o)})},e.get=function(i){return et[(Fe(i)[0]||{})._gsDragID]},e.timeSinceDrag=function(){return(Xe()-ji)/1e3},e.hitTest=function(i,o,l){if(i===o)return!1;var d=Je(i),u=Je(o),p=d.top,f=d.left,g=d.right,v=d.bottom,y=d.width,t=d.height,w=u.left>g||u.right<f||u.top>v||u.bottom<p,E,B,L;return w||!l?!w:(L=(l+"").indexOf("%")!==-1,l=parseFloat(l)||0,E={left:Math.max(f,u.left),top:Math.max(p,u.top)},E.width=Math.min(g,u.right)-E.left,E.height=Math.min(v,u.bottom)-E.top,E.width<0||E.height<0?!1:L?(l*=.01,B=E.width*E.height,B>=y*t*l||B>=u.width*u.height*l):E.width>l&&E.height>l)},e}(so);qn(ot.prototype,{pointerX:0,pointerY:0,startX:0,startY:0,deltaX:0,deltaY:0,isDragging:!1,isPressed:!1});ot.zIndex=1e3;ot.version="3.15.0";Ui()&&M.registerPlugin(ot);const lo=[{id:"timer",label:"Timer"},{id:"rooms",label:"Rooms"}];function ao({isOpen:r,activeTab:e,onToggleOpen:n,onSelectTab:i,onClose:o}){return a.jsxs("div",{role:"toolbar","aria-label":"Study overlay",className:"flex items-center gap-1 rounded-full bg-background p-1 shadow-md shadow-black/5 dark:shadow-black/30",children:[a.jsx("span",{className:"select-none pl-3 pr-1 text-sm font-extrabold tracking-tight text-foreground",children:"STUDY"}),a.jsx(Xt,{initial:!1,children:r&&a.jsx(wt.div,{initial:{width:0,opacity:0}
8,animate:{width:"auto",opacity:1},exit:{width:0,opacity:0},transition:{duration:.25,ease:[.4,0,.2,1]},className:"flex items-center gap-1 overflow-hidden",children:lo.map((l,d)=>{const u=e===l.id;return a.jsx(wt.button,{type:"button",onClick:()=>i(l.id),"aria-pressed":u,initial:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.85},transition:{duration:.18,delay:.08+d*.04},className:ae("h-9 rounded-full px-4 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",u?"bg-zinc-200 text-foreground dark:bg-zinc-800":"bg-muted text-foreground"),children:l.label},l.id)})},"tabs")}),a.jsxs("button",{type:"button",onClick:r?o:n,"aria-label":r?"Close study overlay":"Open study overlay",className:"relative flex h-9 w-9 shrink-0 flex-col items-center justify-center gap-[2px] rounded-full bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[a.jsx("span",{"aria-hidden":"true",className:ae("h-[2px] w-[14px] origin-center rounded-full bg-foreground transition-transform duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",r&&"translate-y-[2px] rotate-45")}),a.jsx("span",{"aria-hidden":"true",className:ae("h-[2px] w-[14px] origin-center rounded-full bg-foreground transition-transform duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",r&&"-translate-y-[2px] -rotate-45")})]})]})}function co(r,e){if(!r)return null;const n=r.goal_id?e==null?void 0:e.find(i=>i.id===r.goal_id):void 0;return(n==null?void 0:n.name)??r.subject??null}function uo(r,e){if(!(r!=null&&r.goal_id))return null;const n=e==null?void 0:e.find(i=>i.id===r.goal_id);return(n==null?void 0:n.color_idx)??null}function fo(){var f;const r=Nn(),e=jn(),n=r.session,i=n!=null,{data:o}=En({enabled:i}),l=co(n,o==null?void 0:o.goals)??"your goal",d=uo(n,o==null?void 0:o.goals),u=d!=null?Si[d%Si.length].text:"text-muted-foreground",p=C.useCallback(()=>{r.stop()},[r]);return a.jsxs("div",{className:"space-y-4 p-5",children:[a.jsx(ho,{display:oi(e.secondsToday),isLive:e.isCurrentlyActive,notRecordingMessage:((f=e.studyTimeNotRecording)==null?void 0:f.message)??null}),a.jsx("div",{className:"-mx-5 border-t border-border"}),i?a.jsx(po,{display:oi(r.elapsedSeconds),goalName:l,onStop:p,stopColorClass:u,isLegacy:r.isLegacy}):a.jsx(go,{})]})}function ho({display:r,isLive:e,notRecordingMessage:n}){const i=n!=null;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:ae("inline-block h-2.5 w-2.5 shrink-0 rounded-full",i?"bg-amber-500":e?"bg-green-500":"bg-muted-foreground/40"),"aria-hidden":"true"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Active Study Time today"}),a.jsx("p",{className:"font-mono text-xl font-bold tabular-nums text-foreground",children:r}),i?a.jsxs("p",{className:"mt-0.5 text-xs text-amber-600",role:"status",children:["Not recording — ",n]}):a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Auto-tracked visible + interacting time today"})]})]})}function po({display:r,goalName:e,onStop:n,stopColorClass:i,isLegacy:o}){return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Studying"}),a.jsx("p",{className:"line-clamp-2 break-words text-base font-bold text-foreground",children:e})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx("button",{type:"button",onClick:n,"aria-label":"Stop study session",className:ae("rounded-md p-1 outline-none transition-opacity hover:opacity-60 focus-visible:ring-2 focus-visible:ring-ring",i),children:a.jsx(cn,{className:"h-5 w-5",fill:"currentColor","aria-hidden":"true"})}),a.jsx("span",{className:"font-mono text-xl font-bold tabular-nums text-foreground",children:r})]})]}),o&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Session started on a previous version."}),a.jsx("div",{className:"text-right",children:a.jsx(Bi,{to:"/study-rooms",className:"text-xs font-medium text-primary underline-offset-4 hover:underline",children:"Change study goal →"})})]})}function go(){return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"No Active Study Goal"}),a.jsx(Bi,{to:"/study-rooms",className:"inline-block text-sm font-medium text-primary underline-offset-4 hover:underline",children:"Start a session in Study Rooms →"})]})}function xo({member:r,nowMs:e,leaderboardGeneratedAt:n,isSelf:i,onCover:o=!1}){var g;const l=At(r.presence,e),d=r.total_active_seconds+Pn(r.presence,n,e),u=!!(r.display_name||r.avatar_url),p=i?`${r.display_name??"You"} (you)`:r.display_name??r.user_id.slice(0,6),f=(((g=r.display_name)==null?void 0:g.slice(0,2))??r.user_id.slice(0,2)).toUpperCase();return a.jsxs("div",{className:ae("flex w-16 shrink-0 flex-col items-center gap-1",!l&&!i&&"opacity-70"),children:[a.jsxs("div",{className:ae("relative",o&&"rounded-full bg-background"),children:[u?a.jsx(mn,{customizations:r.snowbie_customizations,baseSnowbieUrl:r.avatar_url??"/polarbear_icon.png",tier:r.user_tier,currentLevel:r.current_level,size:"md",className:"h-14 w-14"}):a.jsx(Xn,{className:"h-14 w-14",children:a.jsx(Bn,{className:"text-sm",children:f})}),a.jsx("span",{className:ae("absolute bottom-0 right-0 z-30 h-3 w-3 rounded-full border-2 border-background",l?"bg-green-500":"bg-muted-foreground
8/40"),"aria-hidden":"true"})]}),a.jsx("span",{className:ae("w-full truncate text-center text-xs font-semibold",o&&"rounded bg-background px-1",i?"text-emerald-600 dark:text-emerald-400":"text-foreground"),title:p,children:p}),a.jsx("span",{className:ae("font-mono text-[11px] tabular-nums",o&&"rounded bg-background px-1.5",i?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground"),children:oi(d)})]})}function mo({count:r,currentIndex:e,onChange:n}){if(r<=1)return null;const i=o=>{const l=(e+o+r)%r;n(l)};return a.jsxs("div",{className:"flex items-center justify-center gap-3 pt-1",children:[a.jsx("button",{type:"button","aria-label":"Previous room",onClick:()=>i(-1),className:"rounded-md p-1 text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(un,{className:"h-4 w-4"})}),a.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:r},(o,l)=>a.jsx("button",{type:"button","aria-label":`Go to room ${l+1}`,"aria-current":l===e?"true":void 0,onClick:()=>n(l),className:ae("h-1.5 w-1.5 rounded-full transition-colors",l===e?"bg-foreground":"bg-muted-foreground/30")},l))}),a.jsx("button",{type:"button","aria-label":"Next room",onClick:()=>i(1),className:"rounded-md p-1 text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(dn,{className:"h-4 w-4"})})]})}const Ve=5;function yo({open:r,onOpenChange:e,memberRoomIds:n,pinnedIds:i,onSave:o}){const[l,d]=C.useState(i);C.useEffect(()=>{if(!r)return;if(i.filter(w=>n.includes(w)).length>0){d(i);return}const t=i.filter(w=>!n.includes(w));d([...n.slice(0,Ve),...t])},[r,i,n]);const u=Ii({filter:"mine"}),p=C.useMemo(()=>{var t;const y=new Map;for(const w of((t=u.data)==null?void 0:t.rooms)??[])y.set(w.id,w);return y},[u.data]),f=l.filter(y=>n.includes(y)).length,g=f>=Ve,v=y=>{d(t=>t.includes(y)?t.filter(E=>E!==y):t.filter(E=>n.includes(E)).length<Ve?[...t,y]:t)};return a.jsx(yn,{open:r,onOpenChange:e,children:a.jsxs(bn,{className:"sm:max-w-md",children:[a.jsxs(wn,{children:[a.jsx(vn,{children:"Rooms to show"}),a.jsxs(_n,{children:["Pick up to ",Ve," of your study rooms to cycle through in the study overlay."]})]}),a.jsx("ul",{className:"flex max-h-80 flex-col gap-2 overflow-y-auto py-1 pr-1",children:u.isPending?Array.from({length:Math.min(Math.max(n.length,1),4)}).map((y,t)=>a.jsx("li",{children:a.jsx(xt,{className:"h-[70px] w-full rounded-lg"})},t)):n.map(y=>{const t=l.includes(y);return a.jsx("li",{children:a.jsx(bo,{roomId:y,room:p.get(y),checked:t,disabled:!t&&g,onToggle:()=>v(y)})},y)})}),g&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Maximum of ",Ve," rooms selected."]}),a.jsxs(Sn,{children:[a.jsx(qe,{variant:"ghost",onClick:()=>e(!1),children:"Cancel"}),a.jsx(qe,{disabled:f===0,onClick:()=>{o(l),e(!1)},children:"Save"})]})]})})}function bo({roomId:r,room:e,checked:n,disabled:i,onToggle:o}){const l=(e==null?void 0:e.name)??`Room ${r.slice(0,6)}`,d=(e==null?void 0:e.visibility)==="private",u=d?fn:hn;return a.jsxs("button",{type:"button","aria-pressed":n,disabled:i,onClick:o,className:ae("w-full rounded-lg border-2 p-3 text-left transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n?"border-primary bg-primary/5":"border-border hover:bg-muted",i&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:l}),e&&a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground",title:d?"Private room":"Public room",children:[a.jsx(u,{className:"h-3.5 w-3.5"}),d?"Private":"Public"]})]}),e&&a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:[a.jsxs("span",{children:[a.jsxs("span",{className:"font-medium text-foreground",children:[e.member_count,"/",e.max_members]})," ",e.member_count===1?"member":"members"]}),e.owner_display_name&&a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsxs("span",{className:"truncate",children:["by"," ",a.jsx("span",{className:"font-medium text-foreground",children:e.owner_display_name})]})]})]})]})}const wo="polarbear.pinned-study-rooms.";function qi(r){return`${wo}${r}`}function Ai(r){try{const e=window.localStorage.getItem(qi(r));if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(i=>typeof i=="string"):[]}catch{return[]}}function vo(r){const[e,n]=C.useState(()=>r?Ai(r):[]);C.useEffect(()=>{n(r?Ai(r):[])},[r]);const i=C.useCallback(o=>
8{if(n(o),!!r)try{window.localStorage.setItem(qi(r),JSON.stringify(o))}catch{}},[r]);return{pinnedIds:e,setPinnedIds:i,isReady:!0}}const _o=138;function So(r,e){if(r.length===0)return[];const n=e.filter(i=>r.includes(i));return n.length>0?n.slice(0,Ve):r.slice(0,Ve)}function To(r,e,n){return[...r].sort((i,o)=>{if(i.user_id===e)return-1;if(o.user_id===e)return 1;const l=At(i.presence,n)?1:0,d=At(o.presence,n)?1:0;return l!==d?d-l:o.total_active_seconds-i.total_active_seconds})}function No({suppressed:r=!1}){const{user:e}=Tn(),n=Ii({filter:"mine"}),i=C.useMemo(()=>{var o;return((o=n.data)==null?void 0:o.rooms.map(l=>l.id))??[]},[n.data]);return n.isPending?a.jsx(Ot,{children:a.jsx(xt,{className:"h-[120px] w-full rounded-md"})}):n.error&&!n.data?a.jsx(Ot,{children:a.jsx("p",{className:"py-3 text-center text-xs text-muted-foreground",children:"Couldn't load your study rooms. Try refreshing in a moment."})}):i.length===0?a.jsx(Ot,{children:a.jsx(Co,{})}):a.jsx(jo,{memberRoomIds:i,selfUserId:e==null?void 0:e.id,suppressed:r})}function jo({memberRoomIds:r,selfUserId:e,suppressed:n}){var Ee,rt;const i=Fi(),{pinnedIds:o,setPinnedIds:l}=vo(e),d=C.useMemo(()=>So(r,o),[r,o]),[u,p]=C.useState(0);C.useEffect(()=>{u>=d.length&&p(0)},[d.length,u]);const[f,g]=C.useState(!1),[v,y]=C.useState(!1),t=d[u]??null,w=Cn(t),E=Dn(t,"daily"),B=(Ee=w.data)==null?void 0:Ee.room,L=!!B&&B.owner_id===e,{backgroundId:pe,setBackgroundId:we}=Mn(t,B==null?void 0:B.cover_id),ce=Yn(pe).src,_=ce!=null,F=_?"rounded-md bg-background px-3 py-1.5":void 0,O=E.leaderboard==null,S=kn(O&&t?t:null,"daily"),A=C.useMemo(()=>E.leaderboard??(S.data?{top:S.data.top,period_start:S.data.period_start,generated_at:new Date(S.dataUpdatedAt).toISOString()}:null),[E.leaderboard,S.data,S.dataUpdatedAt]),ee=Rn(),P=C.useMemo(()=>On(A,E.members),[A,E.members]),se=C.useMemo(()=>An((A==null?void 0:A.generated_at)??null),[A]),j=C.useMemo(()=>To(P,e,ee),[P,e,ee]),le=j.filter(ke=>At(ke.presence,ee)).length,Z=w.isPending||E.status==="pending"&&!E.error,G=r.length>1,W=(rt=w.data)==null?void 0:rt.room.name;return a.jsxs(a.Fragment,{children:[a.jsxs(Ot,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"truncate text-sm font-bold text-foreground",children:W?`Studying in ${W}`:Z?"Studying in…":"Studying"}),a.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:le===1?"1 member studying":`${le} members studying`})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t&&L&&a.jsxs(Vt,{children:[a.jsx(Qt,{asChild:!0,children:a.jsx(qe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>y(!0),"aria-label":"Change cover",children:a.jsx(pn,{className:"h-3.5 w-3.5"})})}),a.jsx(Ut,{children:"Change cover"})]}),G&&a.jsxs(Vt,{children:[a.jsx(Qt,{asChild:!0,children:a.jsx(qe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(!0),"aria-label":"Choose which rooms to show",children:a.jsx(gn,{className:"h-3.5 w-3.5"})})}),a.jsx(Ut,{children:"Choose which rooms to show"})]}),t&&a.jsxs(Vt,{children:[a.jsx(Qt,{asChild:!0,children:a.jsx(qe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>i(`/study-rooms/${t}`),"aria-label":"View leaderboard",children:a.jsx(xn,{className:"h-3.5 w-3.5"})})}),a.jsx(Ut,{children:"View leaderboard"})]})]})]}),a.jsxs("div",{className:"relative -mx-4 mt-2 overflow-hidden border-y border-border",children:[ce&&a.jsx("img",{src:ce,alt:"","aria-hidden":"true",className:"absolute inset-0 h-full w-full object-cover"}),a.jsx("div",{className:"relative z-10 overflow-y-auto px-4 pt-5 pb-1",style:{height:_o},children:Z?a.jsx("div",{className:"flex flex-wrap items-start gap-3",children:Array.from({length:5}).map((ke,H)=>a.jsx(Eo,{},H))}):E.error?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("p",{className:ae("text-xs text-muted-foreground",F),children:"Couldn't load presence for this room."})}):j.length===0?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("p",{className:ae("text-xs text-muted-foreground",F),children:"No one is studying right now."})}):a.jsx("div",{className:"flex flex-wrap items-start gap-3",children:j.map(ke=>a.jsx(xo,{member:ke,nowMs:ee,leaderboardGeneratedAt:se,isSelf:ke.user_id===e,onCover:_},ke.user_id))})})]}),a.jsx(mo,{count:d.length,currentIndex:u,onChange:p})]}),a.jsx(yo,{open:f&&!n,onOpenChange:g,memberRoomIds:r,pinnedIds:o,onSave:l}
8),t&&L&&a.jsx(Ln,{open:v&&!n,onOpenChange:y,value:pe,onChange:we})]})}function Ot({children:r}){return a.jsx("div",{className:"p-4",children:r})}function Eo(){return a.jsxs("div",{className:"flex w-16 shrink-0 flex-col items-center gap-1",children:[a.jsx(xt,{className:"h-14 w-14 rounded-full"}),a.jsx(xt,{className:"h-3 w-12"}),a.jsx(xt,{className:"h-3 w-8"})]})}function Co(){const r=Fi();return a.jsxs("div",{className:"flex flex-col items-center gap-2 py-3 text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"You're not in any study rooms yet"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Join a room to see who else is studying with you in real time."}),a.jsx(qe,{size:"sm",variant:"outline",className:"mt-1 h-7 text-xs",onClick:()=>r("/study-rooms"),children:"Browse rooms"})]})}const en="polarbear.study-overlay.v1",tn="polarbear.study-overlay.auto-opened.v1",nn="polarbear.study-overlay.dragged.v1",ko="rooms",kt={isOpen:!1,activeTab:null,position:null};function on(){if(typeof window>"u")return kt;try{const r=window.localStorage.getItem(en);if(!r)return kt;const e=JSON.parse(r);if(!e||typeof e!="object")return kt;const n=e.activeTab==="timer"||e.activeTab==="rooms"?e.activeTab:null,i=e.position&&typeof e.position.x=="number"&&typeof e.position.y=="number"?{x:e.position.x,y:e.position.y}:null;return{isOpen:!1,activeTab:n,position:i}}catch{return kt}}function Po(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(tn)==="1"}catch{return!0}}function Do(){if(!(typeof window>"u"))try{window.localStorage.setItem(tn,"1")}catch{}}function Mo(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(nn)==="1"?!0:on().position!=null}catch{return!0}}function Ro(){if(!(typeof window>"u"))try{window.localStorage.setItem(nn,"1")}catch{}}function Oo(r){if(!(typeof window>"u"))try{window.localStorage.setItem(en,JSON.stringify(r))}catch{}}function Ao(){const[r,e]=C.useState(()=>on()),[n,i]=C.useState(()=>Mo());C.useEffect(()=>{Oo(r)},[r]),C.useEffect(()=>{Po()||(Do(),e(p=>({...p,isOpen:!0,activeTab:p.activeTab??ko})))},[]),C.useEffect(()=>{if(typeof window>"u")return;const p=()=>{e(g=>g.isOpen&&g.activeTab==="timer"?g:{...g,isOpen:!0,activeTab:"timer"})};vi()&&p();const f=()=>{vi(),p()};return window.addEventListener(_i,f),()=>window.removeEventListener(_i,f)},[]);const o=C.useCallback(p=>{e(f=>f.isOpen===p?f:{...f,isOpen:p})},[]),l=C.useCallback(p=>{e(f=>f.activeTab===p?f:{...f,activeTab:p})},[]),d=C.useCallback(()=>{Ro(),i(p=>p||!0)},[]),u=C.useCallback(p=>{e(f=>f.position==null&&p==null||f.position!=null&&p!=null&&f.position.x===p.x&&f.position.y===p.y?f:{...f,position:p})},[]);return{state:r,hasDragged:n,setIsOpen:o,setActiveTab:l,setPosition:u,markDragged:d}}typeof window<"u"&&Se.registerPlugin(Xi,ot);const Pt=200,Li=50,Yi=16,Lo=16;function ni(r,e){if(r==null||typeof window>"u")return null;const n=Yi,i=Li-window.innerWidth+Yi,o=window.innerHeight-e-Li;return{x:Math.min(n,Math.max(i,r.x)),y:Math.min(o,Math.max(0,r.y))}}function cr({dockTopPx:r=Lo,suppressed:e=!1}={}){const{state:n,hasDragged:i,setIsOpen:o,setActiveTab:l,setPosition:d,markDragged:u}=Ao(),p=C.useRef(null),f=C.useRef(null),g=C.useRef(null),v=C.useRef(null),y=C.useRef(d);y.current=d;const t=C.useRef(u);t.current=u;const w=C.useRef(r);w.current=r;const E=C.useRef(n.position),[B,L]=C.useState({width:0,height:0});C.useEffect(()=>{const _=g.current;if(!_)return;const F=new ResizeObserver(([O])=>{const S=Math.round(O.contentRect.width),A=Math.round(O.contentRect.height);L(ee=>ee.width===S&&ee.height===A?ee:{width:S,height:A})});return F.observe(_),()=>F.disconnect()},[]),Xi(()=>{const _=p.current,F=f.current,O=g.current;if(!_||!F||!O)return;const S=ni(E.current,r),A=E.current;S!=null&&A!=null&&(S.x!==A.x||S.y!==A.y)&&y.current(S),Se.set(_,{x:(S==null?void 0:S.x)??0,y:(S==null?void 0:S.y)??0}),Se.set(F,{opacity:0});const ee=ot.create(_,{type:"x,y",bounds:window,cursor:"grab",activeCursor:"grabbing",trigger:O,zIndexBoost:!1,onDragStart(){t.current()},onDrag(){const se=Math.abs(this.x)<Pt&&Math.abs(this.y)<Pt;Se.to(F,{opacity:se?1:0,duration:.12,overwrite:!0})},onDragEnd(){var G;if(Se.to(F,{opacity:0,duration:.12,overwrite:!0}),Math.abs(this.x)<Pt&&Math.abs(this.y)<Pt){Se.to(_,{x:0,y:0,duration:.3,ease:"power2.out",onComplete:()=>y.current(null)});return}const j={x:this.x,y:this.y},Z=ni(j,w.current)??j;(Z.x!==j.x||Z.y!==j.y)&&(Se.set(_,{x:Z.x,y:Z.y}
8),(G=v.current)==null||G.update()),y.current(Z)}}),P=Array.isArray(ee)?ee[0]:null;return v.current=P,()=>{P==null||P.kill(),v.current=null}},{dependencies:[]}),C.useEffect(()=>{const _=p.current;!_||!v.current||n.position==null&&(Se.set(_,{x:0,y:0}),v.current.update())},[n.position]),C.useEffect(()=>{const _=v.current;_&&_.update()},[n.isOpen,n.activeTab,B.width,B.height]),C.useEffect(()=>{const _=p.current,F=v.current;if(!_||!F)return;const O=Number(Se.getProperty(_,"x"))||0,S=Number(Se.getProperty(_,"y"))||0,A=ni({x:O,y:S},r);A!=null&&(A.x!==O||A.y!==S)&&(Se.set(_,{x:A.x,y:A.y}),y.current(A),F.update())},[r]);const pe=n.isOpen&&n.activeTab!=null,we=_=>{l(n.activeTab===_?null:_)},ce=()=>{o(!1),l(null)};return a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:f,"aria-hidden":"true",className:"pointer-events-none fixed right-4 z-[39] rounded-full border border-dashed border-black/50 dark:border-white/50",style:{top:r,width:B.width||void 0,height:B.height||void 0,opacity:0}}),a.jsxs("div",{ref:p,className:"pointer-events-auto fixed right-4 z-chrome select-none",style:{top:r},children:[a.jsx("div",{ref:g,className:"cursor-grab active:cursor-grabbing",children:a.jsx(ao,{isOpen:n.isOpen,activeTab:n.activeTab,onToggleOpen:()=>o(!n.isOpen),onSelectTab:we,onClose:ce})}),a.jsx(Xt,{children:!i&&!pe&&a.jsx(wt.span,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},exit:{opacity:0,y:-2},transition:{duration:.3,ease:"easeOut"},"aria-hidden":"true",className:"pointer-events-none absolute right-2 top-full mt-1.5 whitespace-nowrap text-right text-xs italic text-muted-foreground",children:"Drag me anywhere"},"drag-hint")}),a.jsx("div",{className:"absolute right-0 top-full mt-2",children:a.jsx(Yo,{activeTab:n.isOpen?n.activeTab:null,suppressed:e})})]})]})}function Yo({activeTab:r,suppressed:e}){return a.jsx(Xt,{initial:!1,children:r&&a.jsx(Xo,{activeTab:r,suppressed:e})})}function Xo({activeTab:r,suppressed:e}){const n=C.useRef(null),[i,o]=C.useState(0);return C.useEffect(()=>{const l=n.current;if(!l)return;const d=new ResizeObserver(([u])=>{o(Math.ceil(u.contentRect.height))});return d.observe(l),()=>d.disconnect()},[]),a.jsx(wt.div,{initial:{height:0},animate:{height:i},exit:{height:0},transition:{duration:.28,ease:[.4,0,.2,1]},className:"w-[420px] overflow-hidden rounded-2xl border border-border bg-background shadow-lg shadow-black/10 dark:shadow-black/40",children:a.jsx("div",{ref:n,className:"relative",children:a.jsx(Xt,{mode:"popLayout",initial:!1,children:a.jsx(wt.div,{initial:{opacity:0}
8,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeOut"},children:r==="timer"?a.jsx(fo,{}):a.jsx(No,{suppressed:e})},r)})})})}export{cr as StudyOverlayChrome};
9
10//# chunkId=01a1068a-f723-7313-bd67-4f9cf381e221

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.