1import{e1 as Fe,d_ as Ei,dd as d,dc as i,F as Y,a9 as Xe,em as J,h as Ie,t as un,bh as oi,bb as fn,bL as mn,ch as pn,bg as gn,c9 as yn,eo as bn,ej as vn,e as xn,bv as kt,aN as Sn,c as ri,br as wn,bd as _n,el as Cn,e6 as En,ep as In,ek as kn,e5 as Pn,e8 as An,ed as Rn,dU as Tn,dq as Mn,b6 as Dn,P as On}from"./index--83fOlxX.js";import{b1 as M,e as I,aj as Me,ae as Ke,N as De,$ as Ii,a0 as q,aE as Te,v as Ze,n as Ft,g as ae,L as gt,A as Pt,a as ai,U as li,O as ki,ao as wt,ax as Ln,D as Nt,u as Wt,t as Pi,a9 as Ye,z as Ge,aa as Vt,y as qe,s as jt,r as Ht,M as Ai,a4 as Ri,Y as Be,Z as Ue,a1 as Ti,a6 as Mi,R as mt,af as At,P as Bn,a3 as Un,l as zn,w as Fn,bb as Di,m as Rt,i as Nn,bf as Oi,b as Wn,aC as si,p as Vn,aO as jn,aH as Hn}from"./ui-NzJGZCOf.js";import{E as $n,z as Kn,K as qn,g as ci,h as di,w as Yn,x as Gn,F as Xn,A as Qn,B as Jn}from"./index-CJRF5krZ.js";import{M as Je}from"./_baseIteratee-DLZas4sG.js";import{u as Zn}from"./useIsOnline-CnTLWmR0.js";import{h as eo}from"./object_hash-DqbOB-yV.js";import{P as to,R as io,a as no,S as oo,b as ro}from"./SubstitutionChart-BvxxWsc_.js";import{q as Ee,l as ao,e as lo,k as so,a as co,j as hi,m as ho,h as uo}from"./Helper-72nS2ijv.js";import{i as yt}from"./useDimensions-D6HVXcWw.js";import{H as ui,E as fo,l as mo,v as fi,K as po,a as mi,b as go,j as yo,i as _t,u as bo,M as Li,d as vo,B as lt,C as pi,J as Tt,I as Mt,L as xo,c as So,F as wo,w as _o,e as Re,x as ht,h as Co,A as Eo}from"./Helper-D1we6MMo.js";import{u as Io}from"./useSafeAreaInset-DQpKGBcu.js";import{A as ko}from"./Avatar-DA_rmJdn.js";import{c as gi}from"./createAvatar-CSWNX66E.js";import{k as Bi,a as Ui}from"./useTeamMembers-DMFj-t-R.js";import{P as Po,r as zi}from"./PositionToggles-BW3RBcww.js";import{P as Fi}from"./PlayingTimeTable-CzE1yHpg.js";import{R as Ao}from"./RotationPrintPreview-BinGUCai.js";import{C as Ni}from"./ConfirmationDialog-Bd7fAo1n.js";import{S as Ro,a as To}from"./ShareRotationDialog-D1MGh_y6.js";import{l as at,s as Ct,r as Mo}from"./rotationDbData-CeVFR5H8.js";import{f as Dt}from"./fetchRotation-D6xQLId-.js";import{u as Do,R as Oo,P as Lo}from"./useRotationPlayers-CKnwukfS.js";import{N as Bo}from"./FormNumberInput-CzQwJVqP.js";import{D as Uo}from"./index-vdnyNLeo.js";import{u as zo}from"./useTable-BBkMR8E8.js";import{I as Fo}from"./InlineNumberInput-BcNYMZoE.js";import"./media-CfhA99EZ.js";import"./editor-BBDzBLhk.js";import"./auth-Vr3hANQi.js";import"./utils-u20hAFju.js";import"./ResizeObserver.es-BS4_j6we.js";import"./redux-toolkit.modern-CcvBsmOD.js";import"./arrayQueryData-CO4m_tzW.js";import"./ScaleAdvancedPDFSelector-D7m1Ey_-.js";import"./label-Dkq85G0k.js";import"./PlatejsContextProvider-D0tJraC9.js";import"./use-debounce-callback-DD9Dwrj5.js";import"./DisplayOptionsSelector-dBjgURTG.js";import"./checkbox-Chgw39cA.js";import"./createLucideIcon-BBljSknj.js";import"./FontSizeSelectorV2-Cb4obnVy.js";import"./PDFGenerationContext-FFdAkLXI.js";import"./fetch-DBwU5uzv.js";import"./Scrollbar-DmvNz4Lf.js";import"./simplebar-react.esm-DfTctRp7.js";import"./index-BX-Rff7I.js";import"./ScrollRootContext-CkNS2d25.js";import"./FormProvider-hbZ5gvCG.js";import"./useTags-D071mfMh.js";import"./StatusLabel-RlBPQiFe.js";import"./Label-CJGVkcgn.js";import"./SavingTeamPicker-CUHNeVh-.js";import"./TeamAvatar-BoWFWCdD.js";import"./MyAvatar-BPuWNWEE.js";import"./PlaygroundSelect-Bb1fwXWd.js";import"./FolderPickerDialog-CHxQVfnG.js";import"./useTabs-mh-sJZ2W.js";import"./TableRowActionCheckbox-BYpoypk2.js";import"./formatTime-DtD0MVK8.js";import"./utils-lktSqjmV.js";import"./NumberInput-Cb-SSA2Y.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f31cea00-633c-42fa-baf8-36462ca0cfc6",t._sentryDebugIdIdentifier="sentry-dbid-f31cea00-633c-42fa-baf8-36462ca0cfc6")}catch{}})();const No=t=>{const e=Xe.c(12),{name:n,changeName:o}=t,[r,a]=M.useState(n);let c;e[0]!==o?(c=x=>{x.preventDefault(),o(x.target[0].value)},e[0]=o,e[1]=c):c=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=x=>a(x.target.value),e[2]=m):m=e[2];let f;e[3]!==o?(f=x=>{o(x.target.value)},e[3]=o,e[4]=f):f=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s={paddingLeft:"5px",marginLeft:"-5px",width:"100%",fontSize:16,outline:"none",lineHeight:1.6,border:"none",backgroundColor:"rgba(0,0,0,0.2)",color:"white",display:"inline-block"},e[5]=s):s=e[5];let g;e[6]!==f||e[7]!==r?(g=i("input",{onChange:m,value:r,onBlur:f,style:s}),e[6]=f,e[7]=r,e[8]=g):g=e[8];let p;
1return e[9]!==c||e[10]!==g?(p=i("form",{onSubmit:c,children:g}),e[9]=c,e[10]=g,e[11]=p):p=e[11],p},rt=35;function Wo(t){const[e,n]=M.useState("SHOW"),o=Fe(),r=Ei(t.edited);M.useEffect(()=>(yt("#player_"+t.id).on("tap",()=>{n("EDIT"),r.current||o(ui({id:t.id,newName:""}))}).draggable({onstart:()=>{o(fo())},onend:c,onmove:a}).on("move",function(s){var g=s.interaction;if(s.buttons!==0&&g.pointerIsDown&&!g.interacting()){document.getElementById("clone")!==null&&document.getElementById("clone").remove();let p=s.currentTarget.cloneNode(!0);document.body.appendChild(p),p.style.zIndex="10",p.style.width="120px",p.id="clone",p.style.height="35px",p.style.lineHeight="35px",p.style.position="absolute",p.style.left=s.clientX-60+"px",p.style.top=s.clientY-17.5+"px",document.body.appendChild(p),g.start({name:"drag"},s.interactable,p)}}),()=>{try{yt("#player_"+t.id).unset()}catch{console.error("error unsetting")}}),[]);const a=s=>{let g=document.getElementById("clone");if(g===null){s.interaction.stop();return}let p=(parseFloat(g.getAttribute("data-x"))||0)+s.dx,x=(parseFloat(g.getAttribute("data-y"))||0)+s.dy;g.style.filter="drop-shadow(rgb(51, 51, 51) 0px 0px 3px)",g.style.opacity="0.95",g.style.webkitTransform=g.style.transform="translate("+p+"px, "+x+"px)",g.setAttribute("data-x",p),g.setAttribute("data-y",x)},c=()=>{o(mo()),document.getElementById("clone").remove()},m=(s,g)=>{o(po({id:t.id,position:s,value:g}))},f=s=>{o(ui({id:t.id,newName:s})),n("SHOW")};return d(I,{sx:{width:200,"@media (min-width: 768px)":{width:"240px"},"@media (min-width: 1536px)":{width:"260px"},backgroundColor:"#f8f8f8"},children:[d(I,{style:{display:"flex",justifyItems:"flex-end",backgroundColor:t.color,height:rt},children:[i("div",{"data-type":"player","data-player-id":t.id,id:"player_"+t.id,title:"Drag into open playing time or click to edit name",style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",userSelect:"none",WebkitUserSelect:"none",height:rt,touchAction:"none",lineHeight:rt+"px",fontSize:16,cursor:"move",color:"white",backgroundColor:t.color,paddingLeft:10,fontWeight:"600"},children:e==="EDIT"?i(No,{name:t.name,changeName:f}):t.name}),i("div",{style:{fontSize:16,height:rt,lineHeight:rt+"px",backgroundColor:t.color,color:"white",paddingRight:10,paddingLeft:10,fontWeight:"bold",textAlign:"right"},children:i("span",{style:{cursor:"pointer"},onMouseEnter:()=>{o(fi(t.id))},onMouseLeave:()=>{o(fi(null))},children:Ee(t.time)})})]}),i("div",{style:{clear:"both",padding:10},children:d(Me,{direction:"row",children:[t.positionLabels.map((s,g)=>"positions"in t&&t.positions[g]?i(I,{onClick:()=>{m(g,!1)},title:"Click to toggle all positions of this player",sx:{userSelect:"none",lineHeight:1.8,display:"inline-block",borderRadius:.625,width:{xs:25,md:30},fontWeight:600,color:"white",marginRight:.625,fontSize:12,textAlign:"center",cursor:"pointer",backgroundColor:"rgb(136, 136, 136)"},children:s},t.id+"/"+g):i(I,{onClick:()=>{m(g,!0)},title:"Click to toggle all positions of this player",sx:{userSelect:"none",lineHeight:1.8,display:"inline-block",borderRadius:.625,width:{xs:25,md:30},fontWeight:600,color:"white",marginRight:.625,fontSize:12,textAlign:"center",cursor:"pointer",backgroundColor:"#dddddd"},children:s},t.id+"/"+g)),i(I,{sx:{flex:1}}),i("div",{style:{},children:i(Y,{icon:$n,onClick:()=>t.deletePlayer(t.id),style:{cursor:"pointer",color:"#dc3545",fontSize:20}})})]})})]})}/*! @license Rematrix v0.2.2 2 3 Copyright 2018 Fisssion LLC. 4 5 Permission is hereby granted, free of charge, to any person obtaining a copy 6 of this software and associated documentation files (the "Software"), to deal 7 in the Software without restriction, including without limitation the rights 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 copies of the Software, and to permit persons to whom the Software is 10 furnished to do so, subject to the following conditions: 11 12 The above copyright notice and this permission notice shall be included in 13 all copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 THE SOFTWARE. 22*/function Ot(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(t.length===16)return t;if(t.length===6){var e=tt();return e[0]=t[0],e[1]=t[1],e[4]=t[2],e[5]=t[3],e[12]=t[4],e[13]=t[5],e}throw new RangeError("Expected array with either 6 or 16 values.")}function tt(){for(var t=[],e=0;e<16;e++)e%5==0?t.push(1):t.push(0);return t}function Vo(t,e){for(var n=Ot(t),o=Ot(e),r=[],a=0;a<4;a++)for(var c=[n[a],n[a+4],n[a+8],n[a+12]],m=0;m<4;m++){var f=m*4,s=[o[f],o[f+1],o[f+2],o[f+3]],g=c[0]*s[0]+c[1]*s[1]+c[2]*s[2]+c[3]*s[3];r[a+f]=g}return r}function jo(t){if(typeof t=="string"){var e=t.match(/matrix(3d)?\(([^)]+)\)/);if(e){var n=e[2].split(", ").map(parseFloat);return Ot(n)}}return tt()}function Ho(t){var e=tt();return e[0]=t,e}function $o(t){var e=tt();return e[5]=t,e}function Ko(t){var e=tt();return e[12]=t,e}function qo(t){var e=tt();return e[13]=t,e}var pt=function(t){return typeof t=="number"},Wi=function(t){return typeof t=="function"},Vi=function(t){return Object.prototype.toString.call(t)==="[object Object]"},et=function(t){return Array.prototype.slice.apply(t)},ji=function(t){var e=t.reduce(function(n,o){return n[o]=(n[o]||0)+1,n},{});return Object.keys(e).filter(function(n){return e[n]>1})};
22function ze(t){return[].slice.call(arguments,1).forEach(function(e){if(e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}),t}var Lt,Bt=function(t,e,n){return t+(e-t)*n},Hi={__proto__:null,isNumber:pt,isFunction:Wi,isObject:Vi,toArray:et,getDuplicateValsAsStrings:ji,assign:ze,tweenProp:Bt},$t="data-flip-id",Kt="data-inverse-flip-id",qt="data-portal-key",Yo="data-exit-container",ut={__proto__:null,DATA_FLIP_ID:$t,DATA_INVERSE_FLIP_ID:Kt,DATA_FLIP_CONFIG:"data-flip-config",DATA_PORTAL_KEY:qt},Ut={noWobble:{stiffness:200,damping:26},gentle:{stiffness:120,damping:14},veryGentle:{stiffness:130,damping:17},wobbly:{stiffness:180,damping:12},stiff:{stiffness:260,damping:26}},yi=function(t){return Vi(t)?t:Object.keys(Ut).indexOf(t)>-1?Ut[t]:{}};typeof window<"u"&&(Lt=window.requestAnimationFrame);var Go=Lt=Lt||function(t){window.setTimeout(t,1e3/60)},Xo=Date.now(),Qo=typeof performance=="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()-Xo};function $i(t,e){var n=t.indexOf(e);n!==-1&&t.splice(n,1)}var Jo=function(){function t(){}return t.prototype.run=function(){var e=this;Go(function(){e.springSystem.loop(Qo())})},t}(),Et=function(){this.position=0,this.velocity=0},Zo=0,be=.001,er=function(){function t(n){this._id="s"+Zo++,this._springSystem=n,this.listeners=[],this._startValue=0,this._currentState=new Et,this._displacementFromRestThreshold=.001,this._endValue=0,this._overshootClampingEnabled=!1,this._previousState=new Et,this._restSpeedThreshold=.001,this._tempState=new Et,this._timeAccumulator=0,this._wasAtRest=!0,this._cachedSpringConfig={}}var e=t.prototype;return e.getId=function(){return this._id},e.destroy=function(){this.listeners=[],this._springSystem.deregisterSpring(this)},e.setSpringConfig=function(n){return this._springConfig=n,this},e.getCurrentValue=function(){return this._currentState.position},e.getDisplacementDistanceForState=function(n){return Math.abs(this._endValue-n.position)},e.setEndValue=function(n){if(n===this._endValue)return this;if(this.prevEndValue=n,this._endValue===n&&this.isAtRest())return this;this._startValue=this.getCurrentValue(),this._endValue=n,this._springSystem.activateSpring(this.getId());for(var o=0,r=this.listeners.length;o<r;o++){var a=this.listeners[o].onSpringEndStateChange;a&&a(this)}return this},e.setVelocity=function(n){return n===this._currentState.velocity||(this._currentState.velocity=n,this._springSystem.activateSpring(this.getId())),this},e.setCurrentValue=function(n){this._startValue=n,this._currentState.position=n;for(var o=0,r=this.listeners.length;o<r;o++){var a=this.listeners[o];a.onSpringUpdate&&a.onSpringUpdate(this)}return this},e.setAtRest=function(){return this._endValue=this._currentState.position,this._tempState.position=this._currentState.position,this._currentState.velocity=0,this},e.setOvershootClampingEnabled=function(n){return this._overshootClampingEnabled=n,this},e.isOvershooting=function(){var n=this._startValue,o=this._endValue;return this._springConfig.tension>0&&(n<o&&this.getCurrentValue()>o||n>o&&this.getCurrentValue()<o)},e.advance=function(n,o){var r=this.isAtRest();if(!r||!this._wasAtRest){var a=o;o>.064&&(a=.064),this._timeAccumulator+=a;for(var c,m,f,s,g,p,x=this._springConfig.tension,S=this._springConfig.friction,u=this._currentState.position,h=this._currentState.velocity,C=this._tempState.position,k=this._tempState.velocity;this._timeAccumulator>=be;)this._timeAccumulator-=be,this._timeAccumulator<be&&(this._previousState.position=u,this._previousState.velocity=h),m=x*(this._endValue-C)-S*h,s=x*(this._endValue-(C=u+(c=h)*be*.5))-S*(k=h+m*be*.5),p=x*(this._endValue-(C=u+(f=k)*be*.5))-S*(k=h+s*be*.5),C=u+(g=k)*be,u+=1/6*(c+2*(f+g)+(k=h+p*be))*be,h+=1/6*(m+2*(s+p)+(x*(this._endValue-C)-S*k))*be;this._tempState.position=C,this._tempState.velocity=k,this._currentState.position=u,this._currentState.velocity=h,this._timeAccumulator>0&&this._interpolate(this._timeAccumulator/be),(this.isAtRest()||this._overshootClampingEnabled&&this.isOvershooting())&&(this._springConfig.tension>0?(this._startValue=this._endValue,this._currentState.position=this._endValue):(this._endValue=this._currentState.position,this._startValue=this._endValue),this.setVelocity(0),r=!0);var O=!1;this._wasAtRest&&(this._wasAtRest=!1,O=!0);var y=!1;r&&(this._wasAtRest=!0,y=!0),this.notifyPositionUpdated(O,y)}},e.notifyPositionUpdated=function(n,o){var r=this;
22this.listeners.filter(Boolean).forEach(function(a){n&&a.onSpringActivate&&!r._onActivateCalled&&(a.onSpringActivate(r),r._onActivateCalled=!0),a.onSpringUpdate&&a.onSpringUpdate(r),o&&a.onSpringAtRest&&a.onSpringAtRest(r)})},e.systemShouldAdvance=function(){return!this.isAtRest()||!this.wasAtRest()},e.wasAtRest=function(){return this._wasAtRest},e.isAtRest=function(){return Math.abs(this._currentState.velocity)<this._restSpeedThreshold&&(this.getDisplacementDistanceForState(this._currentState)<=this._displacementFromRestThreshold||this._springConfig.tension===0)},e._interpolate=function(n){this._currentState.position=this._currentState.position*n+this._previousState.position*(1-n),this._currentState.velocity=this._currentState.velocity*n+this._previousState.velocity*(1-n)},e.addListener=function(n){return this.listeners.push(n),this},e.addOneTimeListener=function(n){var o=this;return Object.keys(n).forEach(function(r){var a;n[r]=(a=n[r],function(){a.apply(void 0,[].slice.call(arguments)),o.removeListener(n)})}),this.listeners.push(n),this},e.removeListener=function(n){return $i(this.listeners,n),this},t}(),Ki=function(){function t(n){this.looper=n||new Jo,this.looper.springSystem=this,this.listeners=[],this._activeSprings=[],this._idleSpringIndices=[],this._isIdle=!0,this._lastTimeMillis=-1,this._springRegistry={}}var e=t.prototype;return e.createSpring=function(n,o){return this.createSpringWithConfig({tension:n,friction:o})},e.createSpringWithConfig=function(n){var o=new er(this);return this.registerSpring(o),o.setSpringConfig(n),o},e.getIsIdle=function(){return this._isIdle},e.registerSpring=function(n){this._springRegistry[n.getId()]=n},e.deregisterSpring=function(n){$i(this._activeSprings,n),delete this._springRegistry[n.getId()]},e.advance=function(n,o){for(var r=this;this._idleSpringIndices.length>0;)this._idleSpringIndices.pop();for(this._activeSprings.filter(Boolean).forEach(function(c){c.systemShouldAdvance()?c.advance(n/1e3,o/1e3):r._idleSpringIndices.push(r._activeSprings.indexOf(c))});this._idleSpringIndices.length>0;){var a=this._idleSpringIndices.pop();a>=0&&this._activeSprings.splice(a,1)}},e.loop=function(n){var o;this._lastTimeMillis===-1&&(this._lastTimeMillis=n-1);var r=n-this._lastTimeMillis;this._lastTimeMillis=n;var a=0,c=this.listeners.length;for(a=0;a<c;a++)(o=this.listeners[a]).onBeforeIntegrate&&o.onBeforeIntegrate(this);for(this.advance(n,r),this._activeSprings.length===0&&(this._isIdle=!0,this._lastTimeMillis=-1),a=0;a<c;a++)(o=this.listeners[a]).onAfterIntegrate&&o.onAfterIntegrate(this);this._isIdle||this.looper.run()},e.activateSpring=function(n){var o=this._springRegistry[n];this._activeSprings.indexOf(o)===-1&&this._activeSprings.push(o),this.getIsIdle()&&(this._isIdle=!1,this.looper.run())},t}(),tr=new Ki,qi=function(t){var e=t.springConfig,n=e.overshootClamping,o=t.getOnUpdateFunc,r=t.onAnimationEnd,a=t.onSpringActivate,c=tr.createSpring(e.stiffness,e.damping);c.setOvershootClampingEnabled(!!n);var m={onSpringActivate:a,onSpringAtRest:function(){c.destroy(),r()},onSpringUpdate:o({spring:c,onAnimationEnd:r})};return c.addListener(m),c},bi=function(t){var e=qi(t);return e.setEndValue(1),e},vi=function(t,e){if(e===void 0&&(e={}),t&&t.length){e.reverse&&t.reverse();var n,o=typeof(n=e.speed)!="number"?1.1:1+Math.min(Math.max(5*n,0),5),r=1/Math.max(Math.min(t.length,100),10),a=t.map(function(c,m){var f=c.getOnUpdateFunc;return c.getOnUpdateFunc=function(s){var g=f(s);return function(p){var x=p.getCurrentValue();(x=x<.01?0:x>.99?1:x)>=r&&a[m+1]&&a[m+1](Math.max(Math.min(x*o,1),0)),g(p)}},c}).map(function(c){var m=qi(c);if(m)return m.setEndValue.bind(m)}).filter(Boolean);a[0]&&a[0](1)}},xi=function(t){return[0,1,4,5,12,13].map(function(e){return t[e]})},Si=function(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0};function wi(t){return JSON.parse(t.dataset.flipConfig||"{}")}var Yi=function(t,e){var n;return ze(t,((n={})[e[0]]=e[1],n))},Gi=function(t,e){return et(e?document.querySelectorAll("["+qt+'="'+e+'"]'):t.querySelectorAll("["+$t+"]"))},Xi=function(t){return t.map(function(e){return[e,e.getBoundingClientRect()]})},ir=function(t){var e=t.cachedOrderedFlipIds,n=e===void 0?[]:e,o=t.inProgressAnimations,r=o===void 0?{}:o,a=t.flippedElementPositionsBeforeUpdate,c=a===void 0?{}:a,m=t.flipCallbacks,f=m===void 0?{}:m,s=t.containerEl,g=t.applyTransformOrigin,p=t.spring,x=t.debug,S=t.portalKey,u=t.staggerConfig,h=u===void 0?{}:u,C=t.decisionData,k=C===void 0?{}:C,O=t.handleEnterUpdateDelete,y=t.onComplete,w=t.onStart;if(!window.matchMedia("(prefers-reduced-motion: reduce)").matches){var A,P=Xi(Gi((A={element:s,portalKey:S}).element,A.portalKey)).map(function(R){var L=R[0],$=R[1],T=window.getComputedStyle(L);return[L.dataset.flipId,{element:L,rect:$,opacity:parseFloat(T.opacity),transform:T.transform}]}).reduce(Yi,{}),b=function(R){var L=R.containerEl,$=R.portalKey;return $?function(T){return function(K){return et(document.querySelectorAll("["+qt+'="'+T+'"]'+K))}}($):L?function(T){var K=Math.random().toFixed(5);return T.dataset.flipperId=K,function(G){return et(T.querySelectorAll('[data-flipper-id="'+K+'"] '+G))}}(L):function(){return[]}}({containerEl:s,portalKey:S}),l=function(R){return function(L){return R("["+$t+'="'+L+'"]')[0]}}(b),E=function(R){return c[R]&&P[R]},F=Object.keys(c).concat(Object.keys(P)).filter(function(R){return!E(R)}),B={flipCallbacks:f,getElement:l,flippedElementPositionsBeforeUpdate:c,flippedElementPositionsAfterUpdate:P,inProgressAnimations:r,decisionData:k},N=function(R){var L,$=R.unflippedIds,T=R.flipCallbacks,K=R.getElement,G=R.flippedElementPositionsBeforeUpdate,_=R.flippedElementPositionsAfterUpdate,ee=R.inProgressAnimations,te=R.decisionData,le=$.filter(function(W){return _[W]}).filter(function(W){return T[W]&&T[W].onAppear}),ve=$.filter(function(W){return G[W]&&T[W]&&T[W].onExit}),he=new Promise(function(W){L=W}),ue=[],xe=0,ie=ve.map(function(W,fe){var re=G[W].domDataForExitAnimations,Z=re.element,me=re.parent,pe=re.childPosition,ne=pe.top,ke=pe.left,ge=pe.width,ye=pe.height;getComputedStyle(me).position==="static"&&(me.style.position="relative"),Z.style.transform="matrix(1, 0, 0, 1, 0, 0)",Z.style.position="absolute",Z.style.top=ne+"px",Z.style.left=ke+"px",Z.style.height=ye+"px",Z.style.width=ge+"px";var se=ue.filter(function(we){return we[0]===me})[0];se||(se=[me,document.createDocumentFragment()],ue.push(se)),se[1].appendChild(Z),xe+=1;var Se=function(){try{me.removeChild(Z)}catch{}finally{(xe-=1)==0&&L()}};return ee[W]={stop:Se},function(){return T[W].onExit(Z,fe,Se,te)}});return ue.forEach(function(W){W[0].appendChild(W[1])}),ie.length||L(),{hideEnteringElements:function(){le.forEach(function(W){var fe=K(W);fe&&(fe.style.opacity="0")})},animateEnteringElements:function(){le.forEach(function(W,fe){var re=K(W);re&&T[W].onAppear(re,fe,te)})},animateExitingElements:function(){return ie.forEach(function(W){return W()}),he}}}(ze({},B,{unflippedIds:F})),U=N.hideEnteringElements,z=N.animateEnteringElements,j=N.animateExitingElements,D=ze({},B,{containerEl:s,flippedIds:n.filter(E),applyTransformOrigin:g,spring:p,debug:x,staggerConfig:h,scopedSelector:b,onComplete:y});w&&w(s,k);var H=function(R){var L,$=R.flippedIds,T=R.flipCallbacks,K=R.inProgressAnimations,G=R.flippedElementPositionsBeforeUpdate,_=R.flippedElementPositionsAfterUpdate,ee=R.applyTransformOrigin,te=R.spring,le=R.getElement,ve=R.debug,he=R.staggerConfig,ue=he===void 0?{}:he,xe=R.decisionData,ie=xe===void 0?{}:xe,W=R.onComplete,fe=R.containerEl,re=new Promise(function(v){L=v});if(W&&re.then(function(){return W(fe,ie)}),!$.length)return function(){return L([]),re};var Z=[],me=le($[0]),pe=me?me.ownerDocument.querySelector("body"):document.querySelector("body");ji($);var ne=$.map(function(v){var V=G[v].rect,X=_[v].rect,_e=G[v].opacity,Ne=_[v].opacity,We=X.width<1||X.height<1,Q=_[v].element;if(!Si(V)&&!Si(X)||!Q)return!1;var Ve,Pe,Ae,ce=wi(Q),Ce=(Ae=(Pe=(Ve={flipperSpring:te,flippedSpring:ce.spring})===void 0?{}
22:Ve).flippedSpring,ze({},Ut.noWobble,yi(Pe.flipperSpring),yi(Ae))),Yt=ce.stagger===!0?"default":ce.stagger,nn={element:Q,id:v,stagger:Yt,springConfig:Ce};if(T[v]&&T[v].shouldFlip&&!T[v].shouldFlip(ie.previous,ie.current))return!1;var on=Math.abs(V.left-X.left)+Math.abs(V.top-X.top),rn=Math.abs(V.width-X.width)+Math.abs(V.height-X.height),an=Math.abs(Ne-_e);if(V.height===0&&X.height===0||V.width===0&&X.width===0||on<.5&&rn<.5&&an<.01)return!1;var Gt=jo(_[v].transform),je={matrix:Gt},Oe={matrix:[]},it=[Gt];ce.translate&&(it.push(Ko(V.left-X.left)),it.push(qo(V.top-X.top))),ce.scale&&(it.push(Ho(Math.max(V.width,1)/Math.max(X.width,1))),it.push($o(Math.max(V.height,1)/Math.max(X.height,1)))),ce.opacity&&(Oe.opacity=_e,je.opacity=Ne);var st=[];if(!T[v]||!T[v].shouldInvert||T[v].shouldInvert(ie.previous,ie.current)){var ln=function(oe,de){return et(oe.querySelectorAll("["+Kt+'="'+de+'"]'))}(Q,v);st=ln.map(function(oe){return[oe,wi(oe)]})}Oe.matrix=xi(it.reduce(Vo)),je.matrix=xi(je.matrix);var vt,Xt=function(oe){var de=oe.element,He=oe.invertedChildren,nt=oe.body;return function(Qe){var $e=Qe.matrix,ct=Qe.opacity,xt=Qe.forceMinVals;if(pt(ct)&&(de.style.opacity=ct+""),xt&&(de.style.minHeight="1px",de.style.minWidth="1px"),$e){var cn=function(ot){return"matrix("+ot.join(", ")+")"}($e);de.style.transform=cn,He&&function(ot){var dt=ot.matrix,dn=ot.body;ot.invertedChildren.forEach(function(Zt){var ei=Zt[0],ti=Zt[1];if(dn.contains(ei)){var ii=dt[0],ni=dt[3],hn=dt[5],Le={translateX:0,translateY:0,scaleX:1,scaleY:1},St="";ti.translate&&(Le.translateX=-dt[4]/ii,Le.translateY=-hn/ni,St+="translate("+Le.translateX+"px, "+Le.translateY+"px)"),ti.scale&&(Le.scaleX=1/ii,Le.scaleY=1/ni,St+=" scale("+Le.scaleX+", "+Le.scaleY+")"),ei.style.transform=St}})}({invertedChildren:He,matrix:$e,body:nt})}}}({element:Q,invertedChildren:st,body:pe});if(T[v]&&T[v].onComplete){var sn=T[v].onComplete;vt=function(){return sn(Q,ie)}}var Qt=pt(Oe.opacity)&&pt(je.opacity)&&Oe.opacity!==je.opacity,Jt=!1;return ze({},nn,{stagger:Yt,springConfig:Ce,getOnUpdateFunc:function(oe){var de=oe.spring,He=oe.onAnimationEnd;return K[v]={destroy:de.destroy.bind(de),onAnimationEnd:He},function(nt){T[v]&&T[v].onSpringUpdate&&T[v].onSpringUpdate(nt.getCurrentValue()),Jt||(Jt=!0,T[v]&&T[v].onStart&&T[v].onStart(Q,ie));var Qe=nt.getCurrentValue();if(pe.contains(Q)){var $e={matrix:[]};$e.matrix=Oe.matrix.map(function(ct,xt){return Bt(ct,je.matrix[xt],Qe)}),Qt&&($e.opacity=Bt(Oe.opacity,je.opacity,Qe)),Xt($e)}else nt.destroy()}},initializeFlip:function(){Xt({matrix:Oe.matrix,opacity:Qt?Oe.opacity:void 0,forceMinVals:We}),T[v]&&T[v].onStartImmediate&&T[v].onStartImmediate(Q,ie),ce.transformOrigin?Q.style.transformOrigin=ce.transformOrigin:ee&&(Q.style.transformOrigin="0 0"),st.forEach(function(oe){var de=oe[0],He=oe[1];He.transformOrigin?de.style.transformOrigin=He.transformOrigin:ee&&(de.style.transformOrigin="0 0")})},onAnimationEnd:function(oe){delete K[v],Wi(vt)&&vt(),Q.style.transform="",st.forEach(function(de){de[0].style.transform=""}),We&&Q&&(Q.style.minHeight="",Q.style.minWidth=""),oe||(Z.push(v),Z.length>=ne.length&&L(Z))},delayUntil:ce.delayUntil})}).filter(Boolean);if(ne.forEach(function(v){return(0,v.initializeFlip)()}),ve)return function(){};var ke=ne.filter(function(v){return v.delayUntil&&(V=v.delayUntil,ne.filter(function(X){return X.id===V}).length);var V}),ge={},ye={},se={};ke.forEach(function(v){v.stagger?(se[v.stagger]=!0,ye[v.delayUntil]?ye[v.delayUntil].push(v.stagger):ye[v.delayUntil]=[v.stagger]):ge[v.delayUntil]?ge[v.delayUntil].push(v):ge[v.delayUntil]=[v]});var Se=ne.filter(function(v){return v.stagger}).reduce(function(v,V){return v[V.stagger]?v[V.stagger].push(V):v[V.stagger]=[V],v},{}),we=ne.filter(function(v){return ke.indexOf(v)===-1});return we.forEach(function(v){v.onSpringActivate=function(){ge[v.id]&&ge[v.id].forEach(bi),ye[v.id]&&Object.keys(ye[v.id].reduce(function(V,X){var _e;return ze(V,((_e={})[X]=!0,_e))},{})).forEach(function(V){vi(Se[V],ue[V])})}}),function(){return ne.length||L([]),we.filter(function(v){return!v.stagger}).forEach(bi),Object.keys(Se).forEach(function(v){se[v]||vi(Se[v],ue[v])}),re}}(D);O?O({hideEnteringElements:U,animateEnteringElements:z,animateExitingElements:j,animateFlippedElements:H}):(U(),j().then(z),H())}},nr=function(t){var e=t.element,n=t.flipCallbacks,o=n===void 0?{}:n,r=t.inProgressAnimations,a=r===void 0?{}:r,c=Gi(e,t.portalKey),m=et(e.querySelectorAll("["+Kt+"]")),f={},s=[],g={};c.filter(function(S){return o&&o[S.dataset.flipId]&&o[S.dataset.flipId].onExit}
22).forEach(function(S){var u=S.parentNode;if(S.closest){var h=S.closest("["+Yo+"]");h&&(u=h)}var C=s.findIndex(function(k){return k[0]===u});C===-1&&(s.push([u,u.getBoundingClientRect()]),C=s.length-1),f[S.dataset.flipId]=s[C][1],g[S.dataset.flipId]=u});var p=Xi(c),x=p.map(function(S){var u=S[0],h=S[1],C={};if(o&&o[u.dataset.flipId]&&o[u.dataset.flipId].onExit){var k=f[u.dataset.flipId];ze(C,{element:u,parent:g[u.dataset.flipId],childPosition:{top:h.top-k.top,left:h.left-k.left,width:h.width,height:h.height}})}return[u.dataset.flipId,{rect:h,opacity:parseFloat(window.getComputedStyle(u).opacity||"1"),domDataForExitAnimations:C}]}).reduce(Yi,{});return function(S,u){Object.keys(S).forEach(function(h){S[h].destroy&&S[h].destroy(),S[h].onAnimationEnd&&S[h].onAnimationEnd(!0),delete S[h]}),u.forEach(function(h){h.style.transform="",h.style.opacity=""})}(a,c.concat(m)),{flippedElementPositions:x,cachedOrderedFlipIds:p.map(function(S){return S[0].dataset.flipId})}};new Ki;function bt(){return bt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},bt.apply(this,arguments)}function zt(t,e){return zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},zt(t,e)}function Qi(t,e){if(t==null)return{};var n,o,r={},a=Object.keys(t);for(o=0;o<a.length;o++)e.indexOf(n=a[o])>=0||(r[n]=t[n]);return r}var Ji=M.createContext({}),Zi=M.createContext("portal"),en=function(t){var e,n;function o(){for(var a,c=arguments.length,m=new Array(c),f=0;f<c;f++)m[f]=arguments[f];return(a=t.call.apply(t,[this].concat(m))||this).inProgressAnimations={},a.flipCallbacks={},a.el=void 0,a}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,zt(e,n);var r=o.prototype;return r.getSnapshotBeforeUpdate=function(a){return a.flipKey!==this.props.flipKey&&this.el?nr({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},r.componentDidUpdate=function(a,c,m){this.props.flipKey!==a.flipKey&&this.el&&ir({flippedElementPositionsBeforeUpdate:m.flippedElementPositions,cachedOrderedFlipIds:m.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:a.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},r.render=function(){var a=this,c=this.props,m=c.portalKey,f=Ke.createElement(Ji.Provider,{value:this.flipCallbacks},Ke.createElement(c.element,{className:c.className,ref:function(s){return a.el=s}},this.props.children));return m&&(f=Ke.createElement(Zi.Provider,{value:m},f)),f},o}(M.Component);en.defaultProps={applyTransformOrigin:!0,element:"div"};var or=["children","flipId","inverseFlipId","portalKey"],rr=["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"],_i=function(t){var e,n=t.children,o=t.flipId,r=t.inverseFlipId,a=t.portalKey,c=Qi(t,or),m=n,f=function(g){return typeof g=="function"}(m);if(!f)try{m=M.Children.only(n)}catch{throw new Error("Each Flipped component must wrap a single child")}c.scale||c.translate||c.opacity||Hi.assign(c,{translate:!0,scale:!0,opacity:!0});var s=((e={})[ut.DATA_FLIP_CONFIG]=JSON.stringify(c),e);return o!==void 0?s[ut.DATA_FLIP_ID]=String(o):r&&(s[ut.DATA_INVERSE_FLIP_ID]=String(r)),a!==void 0&&(s[ut.DATA_PORTAL_KEY]=a),f?m(s):M.cloneElement(m,s)},tn=function(t){var e=t.children,n=t.flipId,o=t.shouldFlip,r=t.shouldInvert,a=t.onAppear,c=t.onStart,m=t.onStartImmediate,f=t.onComplete,s=t.onExit,g=t.onSpringUpdate,p=Qi(t,rr);return e?p.inverseFlipId?Ke.createElement(_i,bt({},p),e):Ke.createElement(Zi.Consumer,null,function(x){return Ke.createElement(Ji.Consumer,null,function(S){return Hi.isObject(S)&&n&&(S[n]={shouldFlip:o,shouldInvert:r,onAppear:a,onStart:c,onStartImmediate:m,onComplete:f,onExit:s,onSpringUpdate:g}),Ke.createElement(_i,bt({flipId:n},p,{portalKey:x}),e)})}):null};tn.displayName="Flipped";function ar(){var O;const t=J(y=>y.rotation.data.present.minutes),e=J(y=>y.rotation.data.present.players),n=J(y=>
22y.rotation.editor.currentUnavailablePlayers),o=J(y=>y.rotation.data.present.positionLabels),r=Fe(),a=J(y=>{var w;return(w=y==null?void 0:y.reduxUser)==null?void 0:w.selectedTeamId}),[c,m]=M.useState(null),[f,s]=M.useState("root"),g=Bi({teamId:a,enabled:!!a&&!!c}),p=Ui((O=g.data)==null?void 0:O.data).filter(y=>!e.some(w=>w.teamMemberId===y.team_member_id)),x=()=>{m(null),s("root")},S=y=>{r(go(zi(y)))},u=y=>{r(yo(y))};M.useEffect(()=>(yt("#rotation_sidebar").dropzone({accept:"#clone",overlap:.01}),()=>{yt("#rotation_sidebar").unset()}),[]);let h=M.useMemo(()=>{const y=ao(e,t);return e.map(A=>{var b;let P=((b=y.find(l=>l.id===A.id))==null?void 0:b.time)??0;return{...A,time:P}}).sort((A,P)=>P.time-A.time)},[e,t]);const C=M.useMemo(()=>h.map(y=>y.id).join("-"),[h]),k=Io();return i(I,{id:"rotation_sidebar",sx:{marginLeft:3,marginTop:5,backgroundColor:"#fff","&":{"@media (max-width: 960px)":{marginLeft:0,padding:"none",zIndex:1,position:"fixed",left:0,bottom:0,width:"100%",boxShadow:"0px -2px 10px 0px rgba(55, 55, 55, 0.2)"}}},children:i(I,{id:"sticky_sidebar",sx:{position:"sticky",top:0},children:i(en,{flipKey:C,children:d(I,{sx:{height:"calc(100vh - 104px - var(--thg-safe-top, 0px))",marginLeft:-.625,paddingLeft:.625,position:"relative",overflowY:"scroll",paddingRight:1.25,marginRight:-1.25,WebkitOverflowScrolling:"touch","&::-webkit-scrollbar":{WebkitAppearance:"none"},"&::-webkit-scrollbar:vertical":{width:7},"&::-webkit-scrollbar:horizontal":{height:7},"&::-webkit-scrollbar-thumb":{borderRadius:.5,backgroundColor:"rgba(0, 0, 0, 0.2)",WebkitBoxShadow:"0 0 1px rgba(255, 255, 255, 0.5)"},"&":{"@media (max-width: 960px)":{backgroundColor:"#fff",marginLeft:0,height:"auto",display:"flex",overflowX:"scroll",width:"100%",padding:"10px 0px 25px 5px",marginBottom:k.bottom}}},children:[h.map(y=>{const w=n.includes(y.id);return i(tn,{flipId:y.id,children:i(I,{className:"player_"+y.id,sx:{marginBottom:2.5,boxShadow:"0px 4px 6px 0px rgba(55, 55, 55, 0.3)",opacity:w?.2:1,filter:w?"grayscale(100%)":"none",transition:"opacity 0.2s, filter 0.2s","&":{"@media (max-width: 960px)":{minWidth:200,margin:"0px 5px"}}},children:i(Wo,{positionLabels:o,greyedOut:w,deletePlayer:A=>u(A),...y,color:lo[y.colorId]},y.id)})},y.id)}),d(I,{onClick:()=>r(mi()),sx:{marginBottom:2.5,boxShadow:"0px 4px 6px 0px rgba(55, 55, 55, 0.3)",padding:1.25,backgroundColor:"rgb(248, 248, 248)",cursor:"pointer",display:"flex",alignItems:"center","&":{"@media (max-width: 960px)":{minWidth:200,margin:"0px 5px"}}},children:[i(Y,{icon:Kn,style:{color:"rgb(2, 116, 190)",fontSize:25,lineHeight:"25px",marginRight:5}}),i("div",{style:{flexGrow:1,fontWeight:600,fontSize:16,paddingLeft:5,lineHeight:"25px",paddingTop:10,paddingBottom:10},children:"Add Player"}),!!a&&i(De,{"aria-label":"Add player options",sx:{my:-1,mr:-.5},onClick:y=>{y.stopPropagation(),s("root"),m(y.currentTarget)},children:i(Ie,{icon:"eva:chevron-down-fill",width:24,height:24})})]},"add_player"),d(Ii,{anchorEl:c,open:!!c,onClose:x,slotProps:{paper:{sx:{minWidth:230,"& .MuiMenuItem-root":{px:1,typography:"body2",borderRadius:.75,"& > svg":{mr:2,width:20,height:20,flexShrink:0}}}}},children:[f==="root"&&[d(q,{onClick:()=>{r(mi()),x()},children:[i(Ie,{icon:"eva:person-add-outline"}),"New player"]},"new"),d(q,{onClick:()=>s("roster"),children:[i(Ie,{icon:"eva:people-outline"}),"From team roster"]},"roster")],f==="roster"&&[d(q,{onClick:()=>s("root"),children:[i(Ie,{icon:"eva:arrow-ios-back-fill"}),i(Te,{variant:"body2",color:"text.secondary",children:"Team roster"})]},"back"),i(Ze,{},"divider"),...g.isPending?[i(q,{disabled:!0,children:"Loading roster..."},"loading")]:p.length===0?[i(q,{disabled:!0,children:"All roster players are in the rotation"},"empty")]:p.map(y=>{var w;return i(q,{onClick:()=>S(y),children:d(Me,{direction:"row",spacing:1.5,alignItems:"center",sx:{minWidth:0},children:[i(ko,{src:y.account_picture||void 0,alt:y.display_name,color:y.account_picture?"default":gi(y.display_name).color,sx:{width:26,height:26,fontSize:12},children:gi(y.display_name).name}),d(Te,{variant:"body2",noWrap:!0,sx:{fontWeight:500,minWidth:0},children:[y.jersey_number?`#${y.jersey_number} `:"",y.display_name]}),(((w=y.positions)==null?void 0:w.length)??0)>0&&i(Po,{value:y.positions,readOnly:!0,subtle:!0,size:"small"})]})},y.team_member_id)})]]})]})})})})}const lr=(t,e,n)=>{let o=[];for(let r=1;r<=e;r++)o.push({start:(r-1)*n,end:r*n});return t.filter(r=>{var f,s;let a=Math.floor(r.start/n);if(a>=e)return r;let c=(f=o[a])==null?void 0:f.start,m=(s=o[a])==null?void 0:s.end;return r.start<c||r.end>m?r:null})};function sr(t){const e=J(l=>l.rotation.data.present),n=J(l=>
22l.rotation.editor),{periodLength:o,periods:r,minutes:a,players:c}=e;let m=Ee(so(a)),f=Ee(r*o*5);const s=M.useMemo(()=>co(a),[a]),g=lr(a,r,o),p=Fe();function x(l,E){if(E.type==="MOUSE_DOWN"){let{x:F,y:B}=E.payload;return{...l,hold:!0,selectionBoxOrigin:[F,B],selectionBoxTarget:[F,B],selectedMinutes:[],selectionRectangle:!1}}if(E.type==="MOUSE_MOVE"){let{x:F,y:B}=E.payload;return{...l,selectionBox:!0,selectionBoxTarget:[F,B]}}if(E.type==="MOUSE_UP")return{...l,selectionBox:!1,hold:!1,selectionRectangle:E.rectangle??!1,selectedMinutes:E.minutes??[]};if(E.type==="RESIZE")return{...l,...S,drawboardRect:E==null?void 0:E.rect};if(E.type==="RESET")return{...l,hold:!1,selectionBox:!1,selectionBoxOrigin:[0,0],selectionBoxTarget:[0,0],selectionRectangle:!1,selectedMinutes:[]};throw Error("Unknown action.")}const S={hold:!1,selectionBox:!1,selectionBoxOrigin:[0,0],selectionBoxTarget:[0,0],selectionRectangle:!1,selectedMinutes:[],drawboardRect:{x:0,y:0,width:0,height:0}},[u,h]=M.useReducer(x,S),C=Ei(u);M.useEffect(()=>{var l,E;return document.addEventListener("mouseup",A,!1),document.addEventListener("mousemove",w,!1),(l=document.getElementById("drawboard_bg"))==null||l.addEventListener("mousedown",y,!1),document.addEventListener("touchend",A,!1),document.addEventListener("touchmove",w,!1),(E=document.getElementById("drawboard_bg"))==null||E.addEventListener("touchstart",y,!1),document.addEventListener("keydown",k,!1),()=>{var F,B;document.removeEventListener("mouseup",A,!1),document.removeEventListener("mousemove",w,!1),(F=document.getElementById("drawboard_bg"))==null||F.removeEventListener("mousedown",y,!1),document.removeEventListener("touchend",A,!1),document.removeEventListener("touchmove",w,!1),(B=document.getElementById("drawboard_bg"))==null||B.removeEventListener("touchstart",y,!1),document.removeEventListener("keydown",k,!1)}},[]);const k=l=>{(l.key==="Delete"||l.key==="Backspace")&&C.current.selectedMinutes.length>0&&(p(_t(C.current.selectedMinutes)),h({type:"MOUSE_UP",rectangle:!1,minutes:[]}))};M.useEffect(()=>(O(),window.addEventListener("resize",O),()=>{window.removeEventListener("resize",O)}),[]);const O=()=>{const E=document.getElementById("drawboard_bg").getBoundingClientRect();h({type:"RESIZE",rect:E})},y=l=>{l.type==="touchstart"||l.type==="touchmove"||l.target.classList.contains("ignore_selection_box")||l.target.classList.contains("minute")||l.which===3||l.button===2||h({type:"MOUSE_DOWN",payload:{x:l.type==="touchstart"||l.type==="touchmove"?l.touches[0].pageX:l.pageX,y:(l.type==="touchstart"||l.type==="touchmove"?l.touches[0].pageY:l.pageY)-window.pageYOffset}})},w=l=>{if(!(l.type==="touchmove"||l.type==="touchstart")&&C.current.hold){let E=C.current.drawboardRect;(l.type==="touchstart"||l.type==="touchmove")&&l.preventDefault(),h({type:"MOUSE_MOVE",payload:{x:l.type==="touchstart"||l.type==="touchmove"?Math.max(E.left,Math.min(l.touches[0].pageX,E.right)):Math.max(E.left,Math.min(l.pageX,E.right)),y:l.type==="touchstart"||l.type==="touchmove"?Math.max(E.top,Math.min(l.touches[0].pageY,E.bottom)):Math.max(E.top,Math.min(l.pageY,E.bottom))}})}},A=l=>{l.type!=="touchend"&&(C.current.selectionBox?P():C.current.hold&&h({type:"MOUSE_UP"}))},P=()=>{let l=C.current.selectionBoxOrigin,E=C.current.selectionBoxTarget;const F=document.getElementsByClassName("minute");let B=[];for(let U=0;U<F.length;U++){let z=F[U];z.style.border="none";let j=z.getBoundingClientRect(),D=j.left,H=j.top,R=j.width,L=j.height;D<Math.max(l[0],E[0])&&D+R>Math.min(l[0],E[0])&&H<Math.max(l[1],E[1])&&H+L>Math.min(l[1],E[1])&&B.push(z)}let N=!1;if(B.length!==0){let U=1e4,z=1e4,j=0,D=0;for(let H=0;H<B.length;H++){let L=B[H].getBoundingClientRect();U=Math.min(U,L.left),z=Math.min(z,L.top),j=Math.max(j,L.left+L.width),D=Math.max(D,L.top+L.height)}N={x:U,y:z,width:j-U,height:D-z}}B.length===1?(p(bo(Number(B[0].dataset.minuteId))),h({type:"MOUSE_UP",rectangle:!1,minutes:[]})):h({type:"MOUSE_UP",rectangle:N,minutes:B.map(U=>Number(U.dataset.minuteId))})};let b=r===2?[1,2]:[1,2,3,4];return i(I,{id:"rotation_chart_wrapper",children:d(I,{sx:{display:"flex",flexDirection:"row"},children:[d(I,{"data-register":!0,id:"drawboard_bg",sx:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none",WebkitOverflowScrolling:"touch","&::-webkit-scrollbar":{WebkitAppearance:"none"},"&::-webkit-scrollbar:vertical":{width:"7px",display:"none"},"&::-webkit-scrollbar:horizontal":{height:"7px"},"&::-webkit-scrollbar-thumb":{borderRadius:"4px",backgroundColor:"rgba(0, 0, 0, 0.2)",WebkitBoxShadow:"0 0 1px rgba(255, 255, 255, 0.5)"},height:"calc(100vh - 104px - var(--thg-safe-top, 0px))",overflowY:"scroll",pt:5,pl:{xs:4,md:5},pr:{xs:0,sm:1,md:5},flex:1,pb:{xs:"200px",sm:0}},children:[u.selectionBox&&i("div",{id:t.uId+"_selection_box",style:{zIndex:100,position:"absolute",left:Math.min(u.selectionBoxOrigin[0],u.selectionBoxTarget[0]),top:Math.min(u.selectionBoxOrigin[1],u.selectionBoxTarget[1]),width:Math.abs(u.selectionBoxTarget[0]-u.selectionBoxOrigin[0]),height:Math.abs(u.selectionBoxTarget[1]-u.selectionBoxOrigin[1]),backgroundColor:"rgba(255,255,255,0.6)",border:"2px s
22olid rgb(10, 132, 255)"}}),u.selectionRectangle&&i(Ft,{onClickAway:()=>{h({type:"RESET"})},children:d(I,{children:[i("div",{className:"ignore_selection_box",id:"selection_rectangle",style:{zIndex:100,position:"absolute",left:u.selectionRectangle.x,top:u.selectionRectangle.y,width:u.selectionRectangle.width,height:u.selectionRectangle.height,backgroundColor:"rgba(255,255,255,0.3)",border:"2px solid #333"}}),i(ae,{className:"ignore_selection_box",sx:{zIndex:100,borderRadius:.5,width:90,position:"absolute",fontSize:12,left:u.selectionRectangle.x+u.selectionRectangle.width-90,top:u.selectionRectangle.y+u.selectionRectangle.height+5},size:"small",variant:"contained",color:"dark",startIcon:i(Ie,{sx:{fontSize:20},icon:"eva:trash-2-outline"}),onClick:()=>{h({type:"MOUSE_UP",rectangle:!1,minutes:[]}),p(_t(u.selectedMinutes))},children:"Delete"})]})}),i(gt,{sx:{mb:6},container:!0,rowSpacing:4,columnSpacing:4,children:b.map(l=>i(gt,{sx:{"& .positionLabel":{display:{lg:r===4&&(l==2||l==4)?"none":"block"}}},size:{xs:12,lg:r===4?6:12},children:d(I,{children:[i(to,{period:l,periods:r}),i(io,{start:0,end:o}),[0,1,2,3,4].map(E=>i(no,{dispatch:p,editor:n,rotation:e,period:l,start:o*(l-1),end:o*l,position:E},E))]})},l))}),(s.length>0||m!==f)&&d(Pt,{sx:{userSelect:"none"},style:{marginBottom:40,marginLeft:-35},severity:"error",children:[i(ai,{children:"Invalid Rotation:"}),d(li,{dense:!0,children:[m!==f&&d("li",{children:["Playing Time: ",m," / ",f]}),s.map((l,E)=>i("li",{children:`${hi(c,l.minuteA.id).name} is playing from ${Ee(l.start)} to ${Ee(l.end)} at both ${l.minuteA.position} and ${l.minuteB.position}.`},{index:E}))]})]}),g.length>0&&d(Pt,{sx:{userSelect:"none"},style:{marginBottom:40,marginLeft:-35},severity:"error",children:[i(ai,{children:"Invalid Playing Times:"}),i(li,{dense:!0,children:g.map((l,E)=>i("li",{children:`${hi(c,l.id).name} is playing from ${Ee(l.start)} to ${Ee(l.end)}`},{index:E}))}),i(ae,{sx:{mt:1,boxShadow:"none"},variant:"contained",color:"error",size:"small",onClick:()=>{p(_t(g.map(l=>l.minuteId)))},children:"Delete Playing Times"})]})]}),i(ar,{})]})})}function cr(t){const e=Xe.c(54),n=Fe(),[o,r]=M.useState(0),[a,c]=M.useState(!0),m=J(dr),{players:f,periods:s,title:g,periodLength:p,minutes:x,description:S,descriptionPlatejs:u,positionLabels:h}=m;let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={maxWidth:1200,margin:"auto",py:5},e[0]=C):C=e[0];let k;e[1]===Symbol.for("react.memo_cache_sentinel")?(k={flex:1,mb:2,pr:{lg:5}},e[1]=k):k=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={placeholder:"Untitled Play",sx:{}},e[2]=O):O=e[2];let y;e[3]!==n?(y=_=>n(Li(_.target.value)),e[3]=n,e[4]=y):y=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w={"&:focus-within":{backgroundColor:"grey.100"},borderBottom:0,fontWeight:600,fontSize:"2rem"},e[5]=w):w=e[5];let A;e[6]!==y||e[7]!==g?(A=i(I,{sx:k,children:i(ki,{inputProps:O,disableUnderline:!0,fullWidth:!0,onChange:y,sx:w,value:g})}),e[6]=y,e[7]=g,e[8]=A):A=e[8];let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P={mb:4},e[9]=P):P=e[9];let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=i(Te,{variant:"h6",sx:{my:3},children:"Description:"}),e[10]=b):b=e[10];let l,E;e[11]===Symbol.for("react.memo_cache_sentinel")?(l={enabled:!1},E={enabled:!1},e[11]=l,e[12]=E):(l=e[11],E=e[12]);const F=u??S;let B;e[13]!==n?(B=_=>{n(vo(_.value))},e[13]=n,e[14]=B):B=e[14];let N;e[15]!==F||e[16]!==B?(N=d(I,{sx:P,children:[b,i("div",{className:"border border-divider mt-5 mb-8 max-w-[882px] -mx-4 sm:-mx-0",children:i(un,{playNode:l,phaseNode:E,variant:"advancedPlayDescription",readOnly:!1,initialContent:F,onChange:B})})]}),e[15]=F,e[16]=B,e[17]=N):N=e[17];let U;e[18]===Symbol.for("react.memo_cache_sentinel")?(U={borderBottom:1,borderColor:"divider"},e[18]=U):U=e[18];let z,j,D,H;e[19]===Symbol.for("react.memo_cache_sentinel")?(z=(_,ee)=>{r(ee)},j=i(wt,{label:"Substitution Chart"}),D=i(wt,{label:"Playing Time"}),H=i(wt,{label:"Substitution Sheet"}),e[19]=z,e[20]=j,e[21]=D,e[22]=H):(z=e[19],j=e[20],D=e[21],H=e[22]);let R;e[23]!==o?(R=i(I,{sx:U,children:d(Ln,{value:o,onChange:z,children:[j,D,H]})}),e[23]=o,e[24]=R):R=e[24];let L;
22e[25]!==p||e[26]!==s||e[27]!==h||e[28]!==m||e[29]!==o?(L=o===0&&i(oo,{rotation:{data:m},periods:s,periodLength:p,positionLabels:h}),e[25]=p,e[26]=s,e[27]=h,e[28]=m,e[29]=o,e[30]=L):L=e[30];let $;e[31]!==x||e[32]!==p||e[33]!==s||e[34]!==f||e[35]!==o?($=o===1&&i(I,{sx:{mt:4},children:i(Fi,{periods:s,periodLength:p,players:f,minutes:x})}),e[31]=x,e[32]=p,e[33]=s,e[34]=f,e[35]=o,e[36]=$):$=e[36];let T;e[37]!==x||e[38]!==p||e[39]!==s||e[40]!==f||e[41]!==h||e[42]!==a||e[43]!==o?(T=o===2&&i(I,{sx:{mt:4},children:i(ro,{players:f,periods:s,minutes:x,periodLength:p,positionLabels:h,showSwitches:a,onChangeShowSwitches:_=>c(_)})}),e[37]=x,e[38]=p,e[39]=s,e[40]=f,e[41]=h,e[42]=a,e[43]=o,e[44]=T):T=e[44];let K;e[45]!==L||e[46]!==$||e[47]!==T?(K=d("div",{className:"min-h-[100dvh]",children:[L,$,T]}),e[45]=L,e[46]=$,e[47]=T,e[48]=K):K=e[48];let G;return e[49]!==N||e[50]!==R||e[51]!==K||e[52]!==A?(G=d(I,{sx:C,children:[A,N,R,K]}),e[49]=N,e[50]=R,e[51]=K,e[52]=A,e[53]=G):G=e[53],G}function dr(t){return t.rotation.data.present}function hr(){const t=Xe.c(25);let e=0,n=0;const o=[],r=J(ur);r.minutes.forEach(P=>{const b=r.players.filter(l=>l.id===P.id)[0];b.positions[P.position]?n=n+(P.end-P.start):(o.push({minute:P,player:b}),e=e+(P.end-P.start))});const a=e/(e+n)*100;let c,m;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={maxWidth:1200,margin:"auto",py:5},m={marginBottom:50},t[0]=c,t[1]=m):(c=t[0],m=t[1]);let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=i(I,{sx:{fontSize:18,fontWeight:600,marginBottom:2.5,color:"#3a3a3a"},children:"Playing Time By Player:"}),t[2]=f):f=t[2];let s;t[3]!==r.minutes||t[4]!==r.periodLength||t[5]!==r.periods||t[6]!==r.players?(s=d("div",{style:m,children:[f,i(Fi,{periods:r.periods,periodLength:r.periodLength,players:r.players,minutes:r.minutes})]}),t[3]=r.minutes,t[4]=r.periodLength,t[5]=r.periods,t[6]=r.players,t[7]=s):s=t[7];let g;t[8]===Symbol.for("react.memo_cache_sentinel")?(g={marginBottom:50},t[8]=g):g=t[8];let p,x,S;t[9]===Symbol.for("react.memo_cache_sentinel")?(p=i(I,{sx:{fontSize:18,fontWeight:600,marginBottom:2.5,color:"#3a3a3a"},children:"Players Playing Out of Position:"}),x={display:"flex"},S={position:"absolute",fontSize:16,lineHeight:"40px",color:"#3a3a3a",fontWeight:"600",paddingLeft:10},t[9]=p,t[10]=x,t[11]=S):(p=t[9],x=t[10],S=t[11]);let u;t[12]!==a?(u=Number.isNaN(a)?"0":a.toFixed(2),t[12]=a,t[13]=u):u=t[13];let h;t[14]!==u?(h=d("div",{style:S,children:[u,"% of minutes"]}),t[14]=u,t[15]=h):h=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C={marginTop:20,fontWeight:600,fontSize:16},t[16]=C):C=t[16];let k,O;t[17]===Symbol.for("react.memo_cache_sentinel")?(k={marginLeft:15,marginTop:20},O={listStyleType:"disc"},t[17]=k,t[18]=O):(k=t[17],O=t[18]);const y=o.map((P,b)=>{const l=ho(P.player.positions,r.positionLabels);return d("li",{style:{fontSize:14,marginBottom:8},children:[P.player.name," (",l,") plays as"," ",r.positionLabels[P.minute.position]," from"," ",Ee(P.minute.start)," to"," ",Ee(P.minute.end)]},b)});let w;t[19]!==O||t[20]!==y?(w=i("ul",{style:O,children:y}),t[19]=O,t[20]=y,t[21]=w):w=t[21];let A;return t[22]!==k||t[23]!==w?(A=i("div",{style:k,children:w}),t[22]=k,t[23]=w,t[24]=A):A=t[24],d(I,{sx:c,children:[s,d("div",{style:g,children:[p,i("div",{children:d("div",{style:x,children:[h,i("div",{style:{flex:e,backgroundColor:"#f8d7da",height:40}}),i("div",{style:{flex:n,height:40,backgroundColor:"#d4edda"},children:"Â "})]})}),d("div",{style:C,children:["Overall, ",Ee(e)," minutes are played by players out of position:"]}),A]})]})}function ur(t){return t.rotation.data.present}function fr(t){const e=Xe.c(24),[n,o]=M.useState(1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i(Wt,{children:"Distribute Playing Time Equally?"}),e[0]=r):r=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=i(Pi,{children:i(Pt,{severity:"error",children:"This will delete any current playing times."})}),e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={mt:3},e[2]=c):c=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=i(I,{sx:{fontWeight:600},children:"Pick Length of Stints:"}),e[3]=m):m=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f={mt:0},e[4]=f):f=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=O=>{o(O.target.value)},e[5]=s):s=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=i(Ge,{value:1,control:i(Ye,{}),label:"Long Stints"}),e[6]=g):g=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=i(Ge,{value:2,control:i(Ye,{}),label:"Short Stints"}),e[7]=p):p=e[7];let x;
22e[8]!==n?(x=d(jt,{dividers:!0,children:[a,d(I,{sx:c,children:[m,i(qe,{sx:f,children:d(Vt,{onChange:s,value:n,row:!0,"aria-labelledby":"demo-row-radio-buttons-group-label",name:"row-radio-buttons-group",children:[g,p]})})]})]}),e[8]=n,e[9]=x):x=e[9];let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S={boxShadow:"none"},e[10]=S):S=e[10];let u;e[11]!==t.close?(u=i(ae,{sx:S,variant:"outlined",color:"inherit",onClick:t.close,children:"Cancel"}),e[11]=t.close,e[12]=u):u=e[12];let h;e[13]!==t||e[14]!==n?(h=i(ae,{onClick:()=>{t.equalPlayingTime(n),t.close()},variant:"contained",children:"Continue"}),e[13]=t,e[14]=n,e[15]=h):h=e[15];let C;e[16]!==u||e[17]!==h?(C=d(Ht,{children:[u,h]}),e[16]=u,e[17]=h,e[18]=C):C=e[18];let k;return e[19]!==t.close||e[20]!==t.open||e[21]!==C||e[22]!==x?(k=d(Nt,{fullWidth:!0,maxWidth:"xs",open:t.open,onClose:t.close,children:[r,x,C]}),e[19]=t.close,e[20]=t.open,e[21]=C,e[22]=x,e[23]=k):k=e[23],k}const mr=({expanded:t,anchorRef:e,setExpanded:n,onMenuItemClick:o})=>i(Mi,{placement:"bottom-end",sx:{zIndex:3},open:t,anchorEl:e.current,transition:!0,disablePortal:!0,children:({TransitionProps:r})=>i(Ai,{...r,style:{transformOrigin:"right top"},children:i(Ri,{sx:{top:10,mt:"2px"},elevation:8,children:i(Ft,{onClickAway:()=>{n(!1)},children:d(Ti,{id:"split-button-menu",autoFocusItem:!0,children:[d(q,{sx:{minWidth:"20px",py:1},onClick:()=>{o("clone"),n(!1)},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:fn})}),i(Ue,{children:"Clone First Half"})]},1),d(q,{sx:{py:1},onClick:()=>{o("equalPlayingTime"),n(!1)},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:mn})}),i(Ue,{children:"Equal Playing Time"})]},2),i(Ze,{}),d(q,{onClick:()=>{o("link"),n(!1)},children:[i(Be,{sx:{mr:0},children:i(Y,{icon:pn})}),i(Ue,{children:"Share as Link"})]},3),i(Ze,{}),d(q,{onClick:()=>{n(!1),o("download")},sx:{py:1},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:gn})}),i(Ue,{children:"Download"})]},4),d(q,{onClick:()=>{n(!1),o("print")},sx:{py:1},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:yn})}),i(Ue,{children:"Print"})]},5)]})})})})});function pr(t){const e=M.useRef(),n=M.useRef(),[o,r]=M.useState(!1),[a,c]=M.useState(n),[m,f]=M.use
22State(!1),[s,g]=M.useState(!1),p=S=>{switch(S){case"download":t.showPrintPreview();break;case"clone":f(!0);break;case"equalPlayingTime":g(!0);break;case"link":t.showShareDialog();break;case"print":t.showPrintPreview();break}},x=S=>{c(S),r(!0)};return d(I,{sx:{display:"flex"},children:[i(Ni,{open:m,close:()=>f(!1),title:"Clone First Half?",description:"This will delete any playing times from the second half.",actions:i(ae,{onClick:()=>{t.cloneHalf(),f(!1)},variant:"contained",children:"Clone"})}),i(fr,{equalPlayingTime:S=>{t.equalPlayingTime(S)},open:s,close:()=>g(!1)}),i(De,{ref:e,onClick:()=>{t.isTrial?t.setShowSaveModal("save"):x(e)},color:"light",sx:{display:{xs:"inline-flex",sm:"none"}},children:i(Y,{icon:oi,style:{fontSize:20,aspectRatio:1}})}),i(ae,{sx:{display:{xs:"none",sm:"flex"}},onClick:()=>{t.isTrial?t.setShowSaveModal("save"):x(n)},size:"small",color:"light",variant:"outlined",ref:n,children:i(Y,{icon:oi,style:{fontSize:24,aspectRatio:1}})}),i(mr,{expanded:o,anchorRef:a,setExpanded:r,onMenuItemClick:p})]})}function gr(t){const e=Xe.c(94),n=Fe(),[o,r]=M.useState(!1),a=J(xr),c=J(vr),m=J(br),f=J(yr),s=t.open,g=t.onClose;let p,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{r(!1)},x=i(Wt,{children:"Are you sure you want to create a new rotation?"}),e[0]=p,e[1]=x):(p=e[0],x=e[1]);let S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=i(jt,{dividers:!0,children:i(Pi,{children:"The current rotation will be deleted. Make sure you have saved your work."})}),e[2]=S):S=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={boxShadow:"none"},e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=i(ae,{sx:u,variant:"outlined",onClick:()=>{r(!1)},children:"Cancel"}),e[4]=h):h=e[4];let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C={boxShadow:"none"},e[5]=C):C=e[5];let k;e[6]!==n||e[7]!==t?(k=d(Ht,{children:[h,i(ae,{sx:C,variant:"contained",onClick:()=>{n(lt()),n(pi()),r(!1),t.onNewRotation(),t.onClose()},children:"Create New Rotation"})]}),e[6]=n,e[7]=t,e[8]=k):k=e[8];let O;e[9]!==o||e[10]!==k?(O=d(Nt,{open:o,onClose:p,children:[x,S,k]}),e[9]=o,e[10]=k,e[11]=O):O=e[11];let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y={width:360},e[12]=y):y=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w={py:2,pr:1,pl:2.5},e[13]=w):w=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=i(Te,{variant:"subtitle1",sx:{flexGrow:1},children:"Settings"}),e[14]=A):A=e[14];let P;e[15]===Symbol.for("react.memo_cache_sentinel")?(P=i(Ie,{icon:"eva:close-fill",width:20,height:20}),e[15]=P):P=e[15];let b;e[16]!==t.onClose?(b=d(Me,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:w,children:[A,i(De,{onClick:t.onClose,children:P})]}),e[16]=t.onClose,e[17]=b):b=e[17];let l;e[18]===Symbol.for("react.memo_cache_sentinel")?(l=i(Ze,{sx:{borderStyle:"solid"}}),e[18]=l):l=e[18];let E,F;e[19]===Symbol.for("react.memo_cache_sentinel")?(E={px:3,py:2},F=i(Te,{variant:"subtitle2",children:"Length of Game"}),e[19]=E,e[20]=F):(E=e[19],F=e[20]);let B;e[21]===Symbol.for("react.memo_cache_sentinel")?(B={mt:2},e[21]=B):B=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=i(mt,{id:"periods-label",style:{fontSize:16},children:"Periods:"}),e[22]=N):N=e[22];let U;e[23]!==n?(U=Ce=>{n(Tt(Ce.target.value))},e[23]=n,e[24]=U):U=e[24];let z,j;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=i(q,{value:2,children:"2 Halves"}),j=i(q,{value:4,children:"4 Quarters"}),e[25]=z,e[26]=j):(z=e[25],j=e[26]);let D;e[27]!==f||e[28]!==U?(D=d(qe,{sx:B,children:[N,d(At,{label:"Periods",labelId:"periods-label",id:"periods",value:f,onChange:U,children:[z,j]})]}),e[27]=f,e[28]=U,e[29]=D):D=e[29];let H;e[30]===Symbol.for("react.memo_cache_sentinel")?(H={mt:2},e[30]=H):H=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=i(mt,{id:"period-length-label",style:{fontSize:16},children:"Length of Period (in min):"}),e[31]=R):R=e[31];let L;e[32]!==m?(L=Math.round(m/60),e[32]=m,e[33]=L):L=e[33];let $;e[34]!==n?($=Ce=>{n(Mt(Ce.target.value*60))},e[34]=n,e[35]=$):$=e[35];let T;e[36]===Symbol.for("react.memo_cache_sentinel")?(T=i(Bn,{position:"end",children:"min"}),e[36]=T):T=e[36];let K;e[37]!==L||e[38]!==$?(K=d(qe,{variant:"outlined",sx:H,children:[R,i(Un,{label:"Length of Perio
22d (in min)",id:"period-length",value:L,onChange:$,type:"number",endAdornment:T,labelWidth:180})]}),e[37]=L,e[38]=$,e[39]=K):K=e[39];let G;e[40]!==D||e[41]!==K?(G=d(Me,{sx:E,children:[F,D,K]}),e[40]=D,e[41]=K,e[42]=G):G=e[42];let _;e[43]===Symbol.for("react.memo_cache_sentinel")?(_=i(Ze,{sx:{borderStyle:"solid"}}),e[43]=_):_=e[43];let ee,te;e[44]===Symbol.for("react.memo_cache_sentinel")?(ee={px:3,py:2},te=i(Te,{variant:"subtitle2",children:"Snap to Grid"}),e[44]=ee,e[45]=te):(ee=e[44],te=e[45]);let le;e[46]===Symbol.for("react.memo_cache_sentinel")?(le={mt:2},e[46]=le):le=e[46];let ve;e[47]===Symbol.for("react.memo_cache_sentinel")?(ve=i(mt,{id:"periods-label",style:{fontSize:16},children:"Snap to"}),e[47]=ve):ve=e[47];let he;e[48]!==n?(he=Ce=>{n(xo(Ce.target.value))},e[48]=n,e[49]=he):he=e[49];let ue,xe,ie,W,fe,re;e[50]===Symbol.for("react.memo_cache_sentinel")?(ue=i(q,{value:1,children:"1 second"}),xe=i(q,{value:5,children:"5 seconds"}),ie=i(q,{value:10,children:"10 seconds"}),W=i(q,{value:15,children:"15 seconds"}),fe=i(q,{value:30,children:"30 seconds"}),re=i(q,{value:60,children:"60 seconds"}),e[50]=ue,e[51]=xe,e[52]=ie,e[53]=W,e[54]=fe,e[55]=re):(ue=e[50],xe=e[51],ie=e[52],W=e[53],fe=e[54],re=e[55]);let Z;e[56]!==c||e[57]!==he?(Z=d(qe,{sx:le,children:[ve,d(At,{label:"Snap to",labelId:"periods-label",id:"periods",value:c,onChange:he,children:[ue,xe,ie,W,fe,re]})]}),e[56]=c,e[57]=he,e[58]=Z):Z=e[58];let me;e[59]===Symbol.for("react.memo_cache_sentinel")?(me={mt:1},e[59]=me):me=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=d(Te,{variant:"caption",sx:me,children:["Hold"," ",i(zn,{sx:{mx:.5,".MuiChip-label":{px:0},borderRadius:1,p:1},label:"â§ Shift"})," ","when resizing to disable snapping"]}),e[60]=pe):pe=e[60];let ne;e[61]!==Z?(ne=d(Me,{sx:ee,children:[te,Z,pe]}),e[61]=Z,e[62]=ne):ne=e[62];let ke,ge;e[63]===Symbol.for("react.memo_cache_sentinel")?(ke={px:3,py:2},ge=i(Te,{variant:"subtitle2",children:"Position Labels"}),e[63]=ke,e[64]=ge):(ke=e[63],ge=e[64]);let ye;e[65]===Symbol.for("react.memo_cache_sentinel")?(ye={flexDirection:"row"},e[65]=ye):ye=e[65];let se;e[66]!==n?(se=Ce=>{n(So(Ce.target.value))},e[66]=n,e[67]=se):se=e[67];const Se=a[0]==="PG"?"text":"numbers";let we;e[68]===Symbol.for("react.memo_cache_sentinel")?(we=i(Ge,{value:"text",control:i(Ye,{sx:{py:.6}}),label:"PG, SG, SF, PF, C"}),e[68]=we):we=e[68];let v;e[69]===Symbol.for("react.memo_cache_sentinel")?(v=i(Ge,{value:"numbers",control:i(Ye,{sx:{py:.6}}),label:"1, 2, 3, 4, 5"}),e[69]=v):v=e[69];let V;e[70]!==se||e[71]!==Se?(V=d(Me,{spacing:1,sx:ke,children:[ge,i(qe,{children:d(Vt,{sx:ye,onChange:se,"aria-labelledby":"demo-radio-buttons-group-label",value:Se,name:"radio-buttons-group",children:[we,v]})})]}),e[70]=se,e[71]=Se,e[72]=V):V=e[72];let X;e[73]===Symbol.for("react.memo_cache_sentinel")?(X=i(Ze,{sx:{borderStyle:"solid"}}),e[73]=X):X=e[73];let _e,Ne;e[74]===Symbol.for("react.memo_cache_sentinel")?(_e={px:3,py:2},Ne=i(Te,{variant:"subtitle2",children:"Reset Editor"}),e[74]=_e,e[75]=Ne):(_e=e[74],Ne=e[75]);let We;e[76]===Symbol.for("react.memo_cache_sentinel")?(We={boxShadow:"none"},e[76]=We):We=e[76];let Q;e[77]!==n||e[78]!==t?(Q=i(I,{children:i(ae,{color:"error",sx:We,variant:"contained",onClick:()=>{n(lt()),n(pi()),r(!1),t.onNewRotation(),t.onClose()},children:"Create New Rotation"})}),e[77]=n,e[78]=t,e[79]=Q):Q=e[79];let Ve;e[80]===Symbol.for("react.memo_cache_sentinel")?(Ve=i(I,{sx:{fontSize:12,mt:2},children:"This will let you start new with a blank whiteboard."}),e[80]=Ve):Ve=e[80];let Pe;e[81]!==Q?(Pe=d(Me,{spacing:1,sx:_e,children:[Ne,Q,Ve]}),e[81]=Q,e[82]=Pe):Pe=e[82];let Ae;e[83]!==b||e[84]!==G||e[85]!==ne||e[86]!==V||e[87]!==Pe?(Ae=d(I,{sx:y,children:[b,l,G,_,ne,V,X,Pe]}),e[83]=b,e[84]=G,e[85]=ne,e[86]=V,e[87]=Pe,e[88]=Ae):Ae=e[88];let ce;return e[89]!==t.onClose||e[90]!==t.open||e[91]!==Ae||e[92]!==O?(ce=d(Fn,{open:s,onClose:g,anchor:"right",children:[O,Ae]}),e[89]=t.onClose,e[90]=t.open,e[91]=Ae,e[92]=O,e[93]=ce):ce=e[93],ce}function yr(t){return t.rotation.data.present.periods}function br(t){return t.rotation.data.present.periodLength}function vr(t){return t.rotation.editor.snapDistance}function xr(t){return t.rotation.data.present.positionLabels}const Ci=({expanded:t,anchorRef:e,setExpanded:n,setShowSaveModal:o,saveData:r})=>i(Mi,{placement:"bottom-end",sx:{zIndex:3},open:t,anchorEl:e.current,transition:!0,disablePortal:!0,children:({TransitionProps:a,placement:c})=>i(Ai,{...a,style:{transformOrigin:"right top"},children:i(Ri,{sx:{top:10,mt:"2px"},elevation:8,children:i(Ft,{onClickAway:()=>{n(!1)},children:d(Ti,{id:"split-button-menu",autoFocusItem:!0,children:[d(q,{onClick:()=>{n(!1),r()},sx:{py:1},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:kt})}
22),i(Ue,{children:"Quick Save"}),i(I,{sx:{fontSize:14}})]},0),d(q,{sx:{minWidth:"20px",py:1},onClick:()=>{o("save"),n(!1)},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:wn})}),i(Ue,{children:"Edit Name & Tags"})]},1),d(q,{sx:{py:1},onClick:()=>{o("copy"),n(!1)},selected:!1,children:[i(Be,{sx:{mr:0},children:i(Y,{icon:_n})}),i(Ue,{children:"Save as"})]},2)]})})})})});function Sr(t){const e=Xe.c(54),n=M.useRef(),[o,r]=M.useState(!1),a=Fe(),{enqueueSnackbar:c}=bn(),m=t.isTemplate??!1;let f;e[0]!==c?(f=w=>{c(xn.printError(w),{variant:"error"})},e[0]=c,e[1]=f):f=e[1];let s;e[2]!==a||e[3]!==c||e[4]!==t?(s=async w=>{var A;if(c("Rotation was saved successfully",{variant:"success"}),(A=w==null?void 0:w.data)!=null&&A.rotation_id)try{const P=await Dt(w.data.rotation_id);a(at(P))}catch(P){console.log(P)}t.onSave&&t.onSave()},e[2]=a,e[3]=c,e[4]=t,e[5]=s):s=e[5];let g;e[6]!==f||e[7]!==s?(g={onError:f,onSuccess:s},e[6]=f,e[7]=s,e[8]=g):g=e[8];const{mutate:p,showLoadingIndicator:x}=vn(g);let S;e[9]!==t||e[10]!==p?(S=async()=>{const w={data:t.rotation};if(t.dbData.rotation_id)return p({payload:w,rotation_id:t.dbData.rotation_id,method:"PUT"});t.setShowSaveModal("save")},e[9]=t,e[10]=p,e[11]=S):S=e[11];const u=S;let h;e[12]!==u?(h=w=>{const A=String.fromCharCode(w.which).toLowerCase();w.target.nodeName!=="INPUT"&&w.target.nodeName!=="TEXTAREA"&&(w.ctrlKey||w.metaKey)&&A==="s"&&(w.preventDefault(),u())},e[12]=u,e[13]=h):h=e[13];const C=h;let k;e[14]!==C?(k=()=>(document.addEventListener("keydown",C,!1),()=>{document.removeEventListener("keydown",C,!1)}),e[14]=C,e[15]=k):k=e[15];let O;if(e[16]===Symbol.for("react.memo_cache_sentinel")?(O=[],e[16]=O):O=e[16],M.useEffect(k,O),Di(wr)){let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w={display:{xs:"none",sm:"inline-flex"}},e[17]=w):w=e[17];let A;e[18]!==u?(A=()=>{u()},e[18]=u,e[19]=A):A=e[19];let P;e[20]!==x?(P=x?i(Rt,{size:17.5}):i(Y,{icon:kt,style:{aspectRatio:1,fontSize:24}}),e[20]=x,e[21]=P):P=e[21];let b;e[22]===Symbol.for("react.memo_cache_sentinel")?(b={paddingRight:1.25,borderColor:"#C4CDD5 !important"},e[22]=b):b=e[22];let l;e[23]!==A||e[24]!==P?(l=i(ae,{onClick:A,color:"light",size:"medium",variant:"contained",startIcon:P,sx:b,children:"Save"}),e[23]=A,e[24]=P,e[25]=l):l=e[25];let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E={minWidth:"35px !important"},e[26]=E):E=e[26];let F;e[27]!==t?(F=()=>{t.isTrial?t.setShowSaveModal("save"):r(!0)},e[27]=t,e[28]=F):F=e[28];let B;e[29]===Symbol.for("react.memo_cache_sentinel")?(B=i(Y,{icon:Sn}),e[29]=B):B=e[29];let N;e[30]!==F?(N=i(ae,{sx:E,color:"light",variant:"contained",ref:n,size:"small",onClick:F,children:B}),e[30]=F,e[31]=N):N=e[31];let U;e[32]!==l||e[33]!==N?(U=d(Nn,{sx:w,size:"medium",variant:"contained",children:[l,N]}),e[32]=l,e[33]=N,e[34]=U):U=e[34];let z;e[35]!==o||e[36]!==m||e[37]!==t.setShowSaveModal||e[38]!==u?(z=i(Ci,{isTemplate:m,expanded:o,anchorRef:n,setExpanded:r,setShowSaveModal:t.setShowSaveModal,saveData:u}),e[35]=o,e[36]=m,e[37]=t.setShowSaveModal,e[38]=u,e[39]=z):z=e[39];let j;return e[40]!==U||e[41]!==z?(j=d(ri,{children:[U,z]}),e[40]=U,e[41]=z,e[42]=j):j=e[42],j}else{let w;e[43]===Symbol.for("react.memo_cache_sentinel")?(w={display:"flex",alignItems:"center",justifyContent:"center"},e[43]=w):w=e[43];let A;e[44]!==t||e[45]!==x?(A=i(I,{sx:w,ref:n,children:x?i(I,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:41.5},children:i(Rt,{color:"light",size:20})}):i(De,{onClick:()=>{t.isTrial?t.setShowSaveModal("save"):r(!0)},color:"light",sx:{display:{xs:"inline-flex",sm:"none"}},children:i(Y,{style:{aspectRatio:1,fontSize:20},icon:kt})})}),e[44]=t,e[45]=x,e[46]=A):A=e[46];let P;e[47]!==o||e[48]!==t.setShowSaveModal||e[49]!==u?(P=i(Ci,{expanded:o,anchorRef:n,setExpanded:r,setShowSaveModal:t.setShowSaveModal,saveData:u}),e[47]=o,e[48]=t.setShowSaveModal,e[49]=u,e[50]=P):P=e[50];let b;return e[51]!==A||e[52]!==P?(b=d(ri,{children:[A,P]}),e[51]=A,e[52]=P,e[53]=b):b=e[53],b}}function wr(t){return t.breakpoints.up("sm")}function _r({close:t,open:e,trial:n=!1}){var j;const o=Fe(),r=J(D=>{var H;return(H=D==null?void 0:D.reduxUser)==null?void 0:H.selectedTeamId}),a=Bi({teamId:r,enabled:e&&!n&&!!r}),c=M.useMemo(()=>{var D;return Ui((D=a.data)==null?void 0:D.data)}
22,[a.data]),[m,f]=M.useState([]),s=J(D=>D.rotation.data.present.periods),g=J(D=>D.rotation.data.present.periodLength),[p,x]=M.useState(s),[S,u]=M.useState(g/60),h=Do(),{order:C,orderBy:k,selected:O,onSelectRow:y,onSelectAllRows:w,onSort:A}=zo({defaultOrderBy:"edit_date",defaultOrder:"desc"}),P=!n&&!!r,[b,l]=M.useState(P?"roster":"new"),E=new Map((((j=a.data)==null?void 0:j.data)??[]).map(D=>[D.team_member_id,D.account_picture])),[F,B]=M.useState(8),N=c.filter(D=>m.includes(D.team_member_id)).map(zi),U=((h==null?void 0:h.data)??[]).filter(D=>O.includes(D.id)),z=b==="roster"?N:U;return d(Nt,{fullWidth:!0,maxWidth:"sm",open:e,onClose:t,children:[i(Uo,{onClick:t,sx:{zIndex:1e4}}),i(Wt,{children:"Rotation Settings"}),d(jt,{sx:{mt:2,mb:0,pb:0},children:[d(Me,{direction:"row",gap:2,sx:{py:2},children:[d(qe,{sx:{width:160},children:[i(mt,{id:"periods-label",style:{fontSize:16},children:"Periods:"}),d(At,{label:"Periods",labelId:"periods-label",id:"periods",value:p,onChange:D=>{x(D.target.value)},children:[i(q,{value:2,children:"2 Halves"}),i(q,{value:4,children:"4 Quarters"})]})]}),i(qe,{variant:"outlined",children:i(Bo,{width:40,height:46,min:0,max:99,value:S,onChange:(D,H)=>{u(H)},type:"number",unit:"min",labelWidth:180})})]}),i(I,{sx:{fontWeight:600,mt:2,mb:1},children:"Pick Players"}),d(Vt,{sx:{flexDirection:"row"},onChange:D=>{l(D.target.value)},"aria-labelledby":"demo-radio-buttons-group-label",value:b,name:"radio-buttons-group",children:[P&&i(Ge,{value:"roster",label:" Import players from team roster",control:i(Ye,{}),sx:{display:"flex",fontSize:14,alignItems:"center"}}),i(Ge,{value:"new",control:i(Ye,{}),sx:{mt:P?{xs:1,sm:0}:0},label:i(Me,{direction:"column",children:d(I,{sx:{display:"flex",fontSize:14,alignItems:"center"},children:["New rotation with",i(Fo,{sx:{mx:2},width:40,min:0,max:99,disabled:b!=="new",value:F,onChange:(D,H)=>{B(H)},type:"number"})," ","players"]})})}),!n&&i(Ge,{value:"import",label:" Import previously used players",control:i(Ye,{}),sx:{mt:{xs:1,sm:0},display:"flex",fontSize:14,alignItems:"center"}})]}),!n&&b==="roster"&&i(Oo,{players:c,selectedPlayerIds:m,onSelectionChange:f,isLoading:a.isPending}),!n&&b==="import"&&i(Lo,{players:(h==null?void 0:h.data)??[],selected:O,onSelectRow:y,onSelectAllRows:w,order:C,orderBy:k,onSort:A,accountPictureByTeamMemberId:E,isLoading:h.showLoadingIndicator})]}),d(Ht,{children:[i(ae,{sx:{boxShadow:"none"},variant:"outlined",color:"inherit",onClick:t,children:"Cancel"}),d(ae,{sx:{boxShadow:"none"},variant:"contained",color:"primary",onClick:()=>{b==="new"?(o(lt()),o(Tt(p)),o(Mt(S*60)),o(wo(F))):(o(lt()),o(Tt(p)),o(Mt(S*60)),z.length>0&&o(_o(z))),t()},children:["Continue"," ",b==="new"||z.length===0?"":`(${z.length})`]})]})]})}const Cr=t=>eo.sha1(t),ft=t=>Cr(t),It=jn("div",{target:"er1byft0"})(t=>{const e=Oi();return{"&:hover":{backgroundColor:t.active?void 0:Hn(e.palette.info.lighter,.1)},position:"relative",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:t.active?3:"inherit",marginLeft:-1,cursor:"pointer",textAlign:"center",fontWeight:600,width:80,borderColor:e.palette.info.lighter,backgroundColor:t.active?e.palette.info.lighter:"transparent",color:t.active?e.palette.info.darker:e.palette.grey[100],[e.breakpoints.down("md")]:{display:t.active?"flex":"none",width:100},[e.breakpoints.only("xs")]:{display:t.active?"flex":"none",width:90}}},"");function Er(t){const e=Cn(),{mixpanel:n}
22=En(),[o,r]=M.useState(!1),[a,c]=M.useState(!1),[m,f]=M.useState(!1),[s,g]=M.useState(!1),[p,x]=M.useState("FINISHED"),[S,u]=M.useState(!1),h=J(_=>_.rotation.editor.tabIndex),C=J(_=>_.rotation.data.present),k=J(_=>_.rotation.dbData),O=J(_=>_.rotation.data.past),y=J(_=>_.rotation.data.future),[w,A]=M.useState(null),P=!!w,b=Fe(),l=In(),E=Oi(),[F]=kn(),B=_=>{A(_.currentTarget)},N=()=>{A(null)},U=Pn(),z=An(),{isOnline:j}=Zn(),D=Rn(),H=M.useCallback(()=>{const _=l.getState().rotation.data.present;b(Ct(ft(_)))},[b,l]);M.useEffect(()=>(n.track("Open Rotation Editor"),n.time_event("Close Rotation Editor"),(async()=>{let _=F.get("id"),ee=F.get("copy");if(_==="new"){u(!0);const le=F.get("folder_id"),ve=le?Number(le):null,he=Number.isFinite(ve)?ve:null;b(lt()),b(Mo({folder_id:he})),b(Re(0)),b(Je.clearHistory());{const ue=l.getState().rotation.data.present;b(Ct(ft(ue)))}}else if(_){x("FETCHING");var te;j?te=await Dt(_):te=D.getQueryData(["rotation",Number(_)]),ee?(b(ht({...te,data:{...te.data,title:"Copy of "+te.title}})),b(at({})),b(Re(0))):(b(ht(te)),b(at(te)),b(Re(0))),b(Je.clearHistory());{const le=l.getState().rotation.data.present;b(Ct(ft(le)))}}z({pathname:window.location.pathname},{replace:!0,state:U.state}),x("FINISHED")})(),()=>{n.track("Close Rotation Editor")}),[]);const R=Di("(max-width:900px)"),L=M.useMemo(()=>ft(C),[C]),$=M.useMemo(()=>{if(p!=="FINISHED")return!1;const _=k.hash;return _==null||_===!1?!1:_!==L},[p,k.hash,L]),T=Tn($),K=()=>{var ee;const _=((ee=U.state)==null?void 0:ee.returnTo)??On.rotations.rotations;z(_,{replace:!0,state:{fromEditor:!0}})},G=_=>{_.target.nodeName!=="INPUT"&&_.target.nodeName!=="TEXTAREA"&&_.keyCode===90&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),_.shiftKey?b(Je.redo()):b(Je.undo()))};return M.useEffect(()=>(window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}),[]),d(I,{children:[i(Ao,{rotation:{...k,data:C},button:s,open:s,onClose:()=>{g(!1)}}),i(Ni,{open:T.state==="blocked",close:()=>
22T.state==="blocked"&&T.reset(),title:"Unsaved Changes!",description:"The changes you made are not saved and will be lost if you leave without saving.",actions:i(ae,{onClick:()=>T.state==="blocked"&&T.proceed(),color:"error",variant:"contained",children:"Ok"})}),i(_r,{open:S,close:()=>u(!1)}),i(Ro,{onSave:async({data:_})=>{if(Mn.isOnline()){if(_.rotation_id){let ee=await Dt(_.rotation_id);b(at(ee)),b(ht(ee))}}else b(at(_)),b(ht(_));H()},dbData:k,rotation:C,isOpen:o,showSaveModal:o,close:()=>r(!1),createNewHash:H}),i(To,{dbData:k,rotation:C,open:a,onClose:()=>{c(!1)}}),i(Wn,{position:"fixed",sx:{px:{xs:1,md:2},pt:"var(--thg-safe-top, 0px)",pb:0,my:0,boxShadow:0},children:i(I,{children:d(si,{sx:{height:{xs:"56px",md:"64px"}},disableGutters:!0,children:[d(I,{sx:{my:0,display:"flex",alignItems:"center",height:"100%"},children:[R?i(De,{onClick:K,sx:{p:{xs:.5,sm:1},mr:{xs:1,md:2}},variant:"outlined",color:"light",children:i(Ie,{sx:{fontSize:30},icon:"eva:close-outline"})}):i(ae,{onClick:K,sx:{minWidth:"auto",mr:3,ml:1,whiteSpace:"nowrap"},startIcon:i(Y,{icon:qn}),variant:"outlined",color:"light",children:"Close"}),d("div",{style:{height:"100%",display:"flex",alignItems:"center",marginBottom:0,color:"var(--grey-700)"},children:[i(It,{sx:{width:100},id:"tab_draw",active:h===0,onClick:_=>{R&&B(_),b(Re(0))},children:d(I,{sx:{display:"flex",justifyContent:"flex-start ",alignItems:"center",gap:1,ml:{xs:-2,md:0}},children:[d(I,{children:[i(I,{children:i(Y,{icon:ci})}),i(I,{sx:{fontSize:13},children:"Editor"})]}),i(Ie,{sx:{position:"absolute",bottom:"calc(50% - 10px)",right:5,backgroundColor:"white",[E.breakpoints.up("md")]:{display:"none"},padding:0,color:E.palette.info.darker},icon:"eva:arrow-ios-downward-outline",width:20,height:20})]})}),i(It,{id:"tab_notes",active:h===1,onClick:_=>{R&&B(_),b(Re(1))},children:d(I,{sx:{display:"flex",justifyContent:"flex-start ",alignItems:"center",gap:1,ml:{xs:-2,md:0}},children:[d(I,{children:[i(I,{children:i(Y,{icon:di})}),i(I,{sx:{fontSize:13},children:"Analysis"})]}),i(Ie,{sx:{position:"absolute",bottom:"calc(50% - 10px)",right:5,backgroundColor:"white",[E.breakpoints.up("md")]:{display:"none"},padding:0,color:E.palette.info.darker},icon:"eva:arrow-ios-downward-outline",width:20,height:20})]})}),i(It,{id:"tab_preview",active:h===2,onClick:_=>{R&&B(_),b(Re(2))},children:d(I,{sx:{display:"flex",justifyContent:"flex-start ",alignItems:"center",gap:1,ml:{xs:-2,md:0}},children:[d(I,{children:[i(I,{children:i(Y,{icon:Yn})}),i(I,{sx:{fontSize:13},children:"Preview"})]}),i(Ie,{sx:{position:"absolute",bottom:"calc(50% - 10px)",right:5,backgroundColor:"white",[E.breakpoints.up("md")]:{display:"none"},padding:0,color:E.palette.info.darker},icon:"eva:arrow-ios-downward-outline",width:20,height:20})]})}),d(Ii,{anchorEl:w,open:P,onClose:N,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:[d(q,{selected:h===0,onClick:()=>{b(Re(0)),N()},children:[i(Y,{icon:ci,style:{width:30,marginRight:10}}),"Editor"]}),d(q,{selected:h===1,onClick:()=>{b(Re(1)),N()},children:[i(Y,{icon:di,style:{width:30,marginRight:10}}),"Analysis"]}),d(q,{selected:h===2,onClick:()=>{b(Re(2)),N()},children:[i(Y,{icon:Gn,style:{width:30,marginRight:10}}),"Preview"]})]})]})]}),i(I,{sx:{display:{lg:"none"},flexGrow:1}}),i(I,{sx:_=>({flex:1,px:2,textAlign:"center",display:{xs:"none",lg:"block"}}),children:i(I,{sx:{maxWidth:800,margin:"auto"},children:i(ki,{inputProps:{placeholder:"Untitled Rotation",sx:{textAlign:"center","&::placeholder":{color:"#fff",opacity:.6},"&::selection":{backgroundColor:"rgba(0, 0, 0, 0.2)",color:"white"},"&::-moz-selection":{backgroundColor:"rgba(0, 0, 0, 0.2)",color:"white"}}},fullWidth:!0,disableUnderline:!0,onChange:_=>b(Li(_.target.value)),sx:{backgroundColor:"rgba(255,255,255,0.1)",fontWeight:700,fontSize:"1.2rem",color:"white",width:"100%",paddingLeft:1},value:C.title})})}),d(I,{sx:{display:"flex",justifyContent:"flex-end",gap:{xs:1,sm:2}},children:[d(I,{sx:{display:"flex"},children:[i(De,{disabled:h!==0||O.length===0,color:"light",onClick:()=>{b(Je.undo())},children:i(Y,{style:{fontSize:20,aspectRatio:1},icon:Xn})}),i(De,{disabled:h!==0||y.length===0,color:"light",onClick:()=>{b(Je.redo())},title:"redo",children:i(Y,{style:{fontSize:20,aspectRatio:1},icon:Qn})})]}),i(pr,{showPrintPreview:()=>{g(!0)},equalPlayingTime:_=>{b(Eo(uo(C.players,C.periods,C.periodLength,_)))},showShareDialog:()=>{c(!0)},cloneHalf:()=>{b(Co())}}),i(Sr,{onSave:H,rotation:C,dbData:k,setShowSaveModal:r}),d(I,{sx:{display:"flex",alignItems:"center",gap:1},children:[i(De,{sx:{"@media (max-width:420px) ":{display:"none"}},color:"light",onClick:()=>{try{window.HelpWidget("open")}catch{console.log("HelpWidget not found")}},children:i(Y,{icon:Dn})}),i(De,{color:"light",onClick:()=>{f(!0)},sx:{fontSize:{xs:20,sm:24}},children:i(Y,{icon:Jn})})]})]})]})})}),i(si,{sx:{height:{xs:"56px",md:"64px"},mt:"var(--thg-safe-top, 0px)"}}),d(Vn,{maxWidth:!1,sx:{flex:1},children:[i(gr,{onNewRotation:()=>{u(!0)},open:m,onClose:()=>f(!1)}),i(gt,{sx:{height:"100%"},container:!0,spacing:3,children:i(gt,{sx:{height:"100%",display:"flex",flexDirection:"column"},size:12,children:p==="FINISHED"?d(I,{style:{flex:1},children:[(h??0)===0&&i(sr,{selectedTeam:e}),(h??0)===1&&i(hr,{}),(h??0)===2&&i(cr,{})]}):d(I,{style:{flex:1,display:"flex",flexDirection:"column",paddingTop:"20vh",alignItems:"center"},children:[i(I,{style:{display:"block"},children:i(Rt,{})}),"Loading Rotation"]})})})]})]})}function Da(){const t=Xe.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i(Er,{}),t[0]=e):e=t[0],e}export{Da as default}; 23//# sourceMappingURL=_auth.dashboard_.rotation-editor-D4eBfxNr.js.map
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.