// ==UserScript== // @name Strawpoll User Script React // @namespace strawpoll-userscript-react // @version 1.0.5 // @description Violent Monkey user script that provides a React modal to create and submit match polls on Reddit and Discord. // @author decho // @homepageURL https://github.com/barca-reddit/strawpoll-userscript-react // @downloadURL https://raw.githubusercontent.com/barca-reddit/strawpoll-userscript-react/master/dist/strawpoll.user.js // @icon https://cdn.discordapp.com/emojis/783962469000675328.webp // @resource css https://raw.githubusercontent.com/barca-reddit/strawpoll-userscript-react/master/dist/style.user.css // @match https://*.strawpoll.com/* // @exclude-match https://*.strawpoll.com/docs/api/* // @noframes // @grant GM.getResourceText // @grant GM.addStyle // @grant GM.listValues // @grant GM.getValue // @grant GM.setValue // @run-at document-start // ==/UserScript== "use strict";(()=>{var gd=Object.create;var mu=Object.defineProperty;var wd=Object.getOwnPropertyDescriptor;var kd=Object.getOwnPropertyNames;var Sd=Object.getPrototypeOf,Ed=Object.prototype.hasOwnProperty;var Qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of kd(t))!Ed.call(e,l)&&l!==n&&mu(e,l,{get:()=>t[l],enumerable:!(r=wd(t,l))||r.enumerable});return e};var I=(e,t,n)=>(n=e!=null?gd(Sd(e)):{},Pd(t||!e||!e.__esModule?mu(n,"default",{value:e,enumerable:!0}):n,e));var Cu=Qe(_=>{"use strict";var Sn=Symbol.for("react.element"),xd=Symbol.for("react.portal"),Cd=Symbol.for("react.fragment"),_d=Symbol.for("react.strict_mode"),Md=Symbol.for("react.profiler"),Nd=Symbol.for("react.provider"),Id=Symbol.for("react.context"),Ld=Symbol.for("react.forward_ref"),Rd=Symbol.for("react.suspense"),zd=Symbol.for("react.memo"),Td=Symbol.for("react.lazy"),hu=Symbol.iterator;function Dd(e){return e===null||typeof e!="object"?null:(e=hu&&e[hu]||e["@@iterator"],typeof e=="function"?e:null)}var gu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},wu=Object.assign,ku={};function $t(e,t,n){this.props=e,this.context=t,this.refs=ku,this.updater=n||gu}$t.prototype.isReactComponent={};$t.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};$t.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Su(){}Su.prototype=$t.prototype;function Kl(e,t,n){this.props=e,this.context=t,this.refs=ku,this.updater=n||gu}var Gl=Kl.prototype=new Su;Gl.constructor=Kl;wu(Gl,$t.prototype);Gl.isPureReactComponent=!0;var vu=Array.isArray,Eu=Object.prototype.hasOwnProperty,Yl={current:null},Pu={key:!0,ref:!0,__self:!0,__source:!0};function xu(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Eu.call(t,r)&&!Pu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1{"use strict";_u.exports=Cu()});var Fu=Qe(z=>{"use strict";function bl(e,t){var n=e.length;e.push(t);e:for(;0>>1,l=e[r];if(0>>1;rkr(u,n))skr(c,u)?(e[r]=c,e[s]=n,r=s):(e[r]=u,e[i]=n,r=i);else if(skr(c,n))e[r]=c,e[s]=n,r=s;else break e}}return t}function kr(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(Mu=performance,z.unstable_now=function(){return Mu.now()}):(Xl=Date,Nu=Xl.now(),z.unstable_now=function(){return Xl.now()-Nu});var Mu,Xl,Nu,Ve=[],rt=[],Vd=1,xe=null,re=3,Pr=!1,Mt=!1,Pn=!1,Ru=typeof setTimeout=="function"?setTimeout:null,zu=typeof clearTimeout=="function"?clearTimeout:null,Iu=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function eo(e){for(var t=Re(rt);t!==null;){if(t.callback===null)Er(rt);else if(t.startTime<=e)Er(rt),t.sortIndex=t.expirationTime,bl(Ve,t);else break;t=Re(rt)}}function to(e){if(Pn=!1,eo(e),!Mt)if(Re(Ve)!==null)Mt=!0,ro(no);else{var t=Re(rt);t!==null&&lo(to,t.startTime-e)}}function no(e,t){Mt=!1,Pn&&(Pn=!1,zu(xn),xn=-1),Pr=!0;var n=re;try{for(eo(t),xe=Re(Ve);xe!==null&&(!(xe.expirationTime>t)||e&&!Ou());){var r=xe.callback;if(typeof r=="function"){xe.callback=null,re=xe.priorityLevel;var l=r(xe.expirationTime<=t);t=z.unstable_now(),typeof l=="function"?xe.callback=l:xe===Re(Ve)&&Er(Ve),eo(t)}else Er(Ve);xe=Re(Ve)}if(xe!==null)var o=!0;else{var i=Re(rt);i!==null&&lo(to,i.startTime-t),o=!1}return o}finally{xe=null,re=n,Pr=!1}}var xr=!1,Sr=null,xn=-1,Tu=5,Du=-1;function Ou(){return!(z.unstable_now()-Due||125r?(e.sortIndex=n,bl(rt,e),Re(Ve)===null&&e===Re(rt)&&(Pn?(zu(xn),xn=-1):Pn=!0,lo(to,n-r))):(e.sortIndex=l,bl(Ve,e),Mt||Pr||(Mt=!0,ro(no))),e};z.unstable_shouldYield=Ou;z.unstable_wrapCallback=function(e){var t=re;return function(){var n=re;re=t;try{return e.apply(this,arguments)}finally{re=n}}}});var Au=Qe((e1,ju)=>{"use strict";ju.exports=Fu()});var $c=Qe(Ee=>{"use strict";var Qs=_t(),ke=Au();function v(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),No=Object.prototype.hasOwnProperty,Ud=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Vu={},Uu={};function Hd(e){return No.call(Uu,e)?!0:No.call(Vu,e)?!1:Ud.test(e)?Uu[e]=!0:(Vu[e]=!0,!1)}function Bd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Wd(e,t,n,r){if(t===null||typeof t>"u"||Bd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function de(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var ne={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ne[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ne[t]=new de(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ne[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ne[e]=new de(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ne[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ne[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ne[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ne[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ne[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var ki=/[\-:]([a-z])/g;function Si(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ki,Si);ne[t]=new de(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ki,Si);ne[t]=new de(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ki,Si);ne[t]=new de(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ne[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});ne.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ne[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ei(e,t,n,r){var l=ne.hasOwnProperty(t)?ne[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var s=` `+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{io=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Tn(e):""}function $d(e){switch(e.tag){case 5:return Tn(e.type);case 16:return Tn("Lazy");case 13:return Tn("Suspense");case 19:return Tn("SuspenseList");case 0:case 2:case 15:return e=uo(e.type,!1),e;case 11:return e=uo(e.type.render,!1),e;case 1:return e=uo(e.type,!0),e;default:return""}}function zo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Yt:return"Fragment";case Gt:return"Portal";case Io:return"Profiler";case Pi:return"StrictMode";case Lo:return"Suspense";case Ro:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ys:return(e.displayName||"Context")+".Consumer";case Gs:return(e._context.displayName||"Context")+".Provider";case xi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ci:return t=e.displayName||null,t!==null?t:zo(e.type)||"Memo";case ot:t=e._payload,e=e._init;try{return zo(e(t))}catch{}}return null}function Qd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return zo(t);case 8:return t===Pi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function wt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Xs(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kd(e){var t=Xs(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _r(e){e._valueTracker||(e._valueTracker=Kd(e))}function qs(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Xs(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function el(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function To(e,t){var n=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Bu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=wt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Js(e,t){t=t.checked,t!=null&&Ei(e,"checked",t,!1)}function Do(e,t){Js(e,t);var n=wt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Oo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Oo(e,t.type,wt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Wu(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Oo(e,t,n){(t!=="number"||el(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dn=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Mr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Gn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var jn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Gd=["Webkit","ms","Moz","O"];Object.keys(jn).forEach(function(e){Gd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),jn[t]=jn[e]})});function na(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||jn.hasOwnProperty(e)&&jn[e]?(""+t).trim():t+"px"}function ra(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=na(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Yd=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ao(e,t){if(t){if(Yd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(v(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(v(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(v(61))}if(t.style!=null&&typeof t.style!="object")throw Error(v(62))}}function Vo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Uo=null;function _i(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ho=null,un=null,sn=null;function Ku(e){if(e=dr(e)){if(typeof Ho!="function")throw Error(v(280));var t=e.stateNode;t&&(t=Nl(t),Ho(e.stateNode,e.type,t))}}function la(e){un?sn?sn.push(e):sn=[e]:un=e}function oa(){if(un){var e=un,t=sn;if(sn=un=null,Ku(e),t)for(e=0;e>>=0,e===0?32:31-(of(e)/uf|0)|0}var Nr=64,Ir=4194304;function On(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ll(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=On(u):(o&=i,o!==0&&(r=On(o)))}else i=n&~l,i!==0?r=On(i):o!==0&&(r=On(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Fe(t),e[t]=n}function df(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Vn),ts=String.fromCharCode(32),ns=!1;function Ca(e,t){switch(e){case"keyup":return Vf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _a(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function Hf(e,t){switch(e){case"compositionend":return _a(t);case"keypress":return t.which!==32?null:(ns=!0,ts);case"textInput":return e=t.data,e===ts&&ns?null:e;default:return null}}function Bf(e,t){if(Zt)return e==="compositionend"||!Di&&Ca(e,t)?(e=Pa(),Qr=Ri=at=null,Zt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=os(n)}}function La(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?La(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ra(){for(var e=window,t=el();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=el(e.document)}return t}function Oi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function qf(e){var t=Ra(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&La(n.ownerDocument.documentElement,n)){if(r!==null&&Oi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=is(n,o);var i=is(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Xt=null,Go=null,Hn=null,Yo=!1;function us(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yo||Xt==null||Xt!==el(r)||(r=Xt,"selectionStart"in r&&Oi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Hn&&bn(Hn,r)||(Hn=r,r=ul(Go,"onSelect"),0bt||(e.current=ei[bt],ei[bt]=null,bt--)}function T(e,t){bt++,ei[bt]=e.current,e.current=t}var kt={},ue=Et(kt),me=Et(!1),Ot=kt;function pn(e,t){var n=e.type.contextTypes;if(!n)return kt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function he(e){return e=e.childContextTypes,e!=null}function al(){F(me),F(ue)}function vs(e,t,n){if(ue.current!==kt)throw Error(v(168));T(ue,t),T(me,n)}function Ua(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(v(108,Qd(e)||"Unknown",l));return B({},n,r)}function cl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||kt,Ot=ue.current,T(ue,e),T(me,me.current),!0}function ys(e,t,n){var r=e.stateNode;if(!r)throw Error(v(169));n?(e=Ua(e,t,Ot),r.__reactInternalMemoizedMergedChildContext=e,F(me),F(ue),T(ue,e)):F(me),T(me,n)}var Ge=null,Il=!1,wo=!1;function Ha(e){Ge===null?Ge=[e]:Ge.push(e)}function up(e){Il=!0,Ha(e)}function Pt(){if(!wo&&Ge!==null){wo=!0;var e=0,t=L;try{var n=Ge;for(L=1;e>=i,l-=i,Ye=1<<32-Fe(t)+l|n<C?(q=x,x=null):q=x.sibling;var N=m(d,x,f[C],y);if(N===null){x===null&&(x=q);break}e&&x&&N.alternate===null&&t(d,x),a=o(N,a,C),k===null?w=N:k.sibling=N,k=N,x=q}if(C===f.length)return n(d,x),A&&Nt(d,C),w;if(x===null){for(;CC?(q=x,x=null):q=x.sibling;var nt=m(d,x,N.value,y);if(nt===null){x===null&&(x=q);break}e&&x&&nt.alternate===null&&t(d,x),a=o(nt,a,C),k===null?w=nt:k.sibling=nt,k=nt,x=q}if(N.done)return n(d,x),A&&Nt(d,C),w;if(x===null){for(;!N.done;C++,N=f.next())N=h(d,N.value,y),N!==null&&(a=o(N,a,C),k===null?w=N:k.sibling=N,k=N);return A&&Nt(d,C),w}for(x=r(d,x);!N.done;C++,N=f.next())N=g(x,d,C,N.value,y),N!==null&&(e&&N.alternate!==null&&x.delete(N.key===null?C:N.key),a=o(N,a,C),k===null?w=N:k.sibling=N,k=N);return e&&x.forEach(function(yd){return t(d,yd)}),A&&Nt(d,C),w}function R(d,a,f,y){if(typeof f=="object"&&f!==null&&f.type===Yt&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case Cr:e:{for(var w=f.key,k=a;k!==null;){if(k.key===w){if(w=f.type,w===Yt){if(k.tag===7){n(d,k.sibling),a=l(k,f.props.children),a.return=d,d=a;break e}}else if(k.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===ot&&xs(w)===k.type){n(d,k.sibling),a=l(k,f.props),a.ref=In(d,k,f),a.return=d,d=a;break e}n(d,k);break}else t(d,k);k=k.sibling}f.type===Yt?(a=Dt(f.props.children,d.mode,y,f.key),a.return=d,d=a):(y=br(f.type,f.key,f.props,null,d.mode,y),y.ref=In(d,a,f),y.return=d,d=y)}return i(d);case Gt:e:{for(k=f.key;a!==null;){if(a.key===k)if(a.tag===4&&a.stateNode.containerInfo===f.containerInfo&&a.stateNode.implementation===f.implementation){n(d,a.sibling),a=l(a,f.children||[]),a.return=d,d=a;break e}else{n(d,a);break}else t(d,a);a=a.sibling}a=Mo(f,d.mode,y),a.return=d,d=a}return i(d);case ot:return k=f._init,R(d,a,k(f._payload),y)}if(Dn(f))return S(d,a,f,y);if(Cn(f))return P(d,a,f,y);Ur(d,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,a!==null&&a.tag===6?(n(d,a.sibling),a=l(a,f),a.return=d,d=a):(n(d,a),a=_o(f,d.mode,y),a.return=d,d=a),i(d)):n(d,a)}return R}var hn=Za(!0),Xa=Za(!1),fr={},$e=Et(fr),rr=Et(fr),lr=Et(fr);function zt(e){if(e===fr)throw Error(v(174));return e}function $i(e,t){switch(T(lr,t),T(rr,e),T($e,fr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:jo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=jo(t,e)}F($e),T($e,t)}function vn(){F($e),F(rr),F(lr)}function qa(e){zt(lr.current);var t=zt($e.current),n=jo(t,e.type);t!==n&&(T(rr,e),T($e,n))}function Qi(e){rr.current===e&&(F($e),F(rr))}var U=Et(0);function vl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ko=[];function Ki(){for(var e=0;en?n:4,e(!0);var r=So.transition;So.transition={};try{e(!1),t()}finally{L=n,So.transition=r}}function pc(){return Le().memoizedState}function dp(e,t,n){var r=yt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e))hc(t,n);else if(n=Qa(e,t,n,r),n!==null){var l=ce();je(n,e,r,l),vc(n,t,r)}}function fp(e,t,n){var r=yt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,Ae(u,i)){var s=t.interleaved;s===null?(l.next=l,Bi(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=Qa(e,t,l,r),n!==null&&(l=ce(),je(n,e,r,l),vc(n,t,r))}}function mc(e){var t=e.alternate;return e===H||t!==null&&t===H}function hc(e,t){Bn=yl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vc(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ni(e,n)}}var gl={readContext:Ie,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useInsertionEffect:le,useLayoutEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useMutableSource:le,useSyncExternalStore:le,useId:le,unstable_isNewReconciler:!1},pp={readContext:Ie,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Ie,useEffect:_s,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Zr(4194308,4,sc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zr(4,2,e,t)},useMemo:function(e,t){var n=He();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=He();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=dp.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Cs,useDebugValue:qi,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Cs(!1),t=e[0];return e=cp.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=He();if(A){if(n===void 0)throw Error(v(407));n=n()}else{if(n=t(),b===null)throw Error(v(349));(jt&30)!==0||ec(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,_s(nc.bind(null,r,o,e),[e]),r.flags|=2048,ur(9,tc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=He(),t=b.identifierPrefix;if(A){var n=Ze,r=Ye;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=or++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Be]=t,e[nr]=r,Cc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Vo(n,r),n){case"dialog":O("cancel",e),O("close",e),l=r;break;case"iframe":case"object":case"embed":O("load",e),l=r;break;case"video":case"audio":for(l=0;lgn&&(t.flags|=128,r=!0,Ln(o,!1),t.lanes=4194304)}else{if(!r)if(e=vl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ln(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!A)return oe(t),null}else 2*$()-o.renderingStartTime>gn&&n!==1073741824&&(t.flags|=128,r=!0,Ln(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=$(),t.sibling=null,n=U.current,T(U,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return ru(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ye&1073741824)!==0&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(v(156,t.tag))}function Sp(e,t){switch(ji(t),t.tag){case 1:return he(t.type)&&al(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vn(),F(me),F(ue),Ki(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Qi(t),null;case 13:if(F(U),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(v(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(U),null;case 4:return vn(),null;case 10:return Hi(t.type._context),null;case 22:case 23:return ru(),null;case 24:return null;default:return null}}var Br=!1,ie=!1,Ep=typeof WeakSet=="function"?WeakSet:Set,E=null;function rn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){W(e,t,r)}else n.current=null}function fi(e,t,n){try{n()}catch(r){W(e,t,r)}}var Os=!1;function Pp(e,t){if(Zo=ol,e=Ra(),Oi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,c=0,p=0,h=e,m=null;t:for(;;){for(var g;h!==n||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(g=h.firstChild)!==null;)m=h,h=g;for(;;){if(h===e)break t;if(m===n&&++c===l&&(u=i),m===o&&++p===r&&(s=i),(g=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=g}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xo={focusedElem:e,selectionRange:n},ol=!1,E=t;E!==null;)if(t=E,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,E=e;else for(;E!==null;){t=E;try{var S=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var P=S.memoizedProps,R=S.memoizedState,d=t.stateNode,a=d.getSnapshotBeforeUpdate(t.elementType===t.type?P:Te(t.type,P),R);d.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(v(163))}}catch(y){W(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,E=e;break}E=t.return}return S=Os,Os=!1,S}function Wn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&fi(t,n,o)}l=l.next}while(l!==r)}}function zl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function pi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Nc(e){var t=e.alternate;t!==null&&(e.alternate=null,Nc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[nr],delete t[bo],delete t[op],delete t[ip])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ic(e){return e.tag===5||e.tag===3||e.tag===4}function Fs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ic(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function mi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sl));else if(r!==4&&(e=e.child,e!==null))for(mi(e,t,n),e=e.sibling;e!==null;)mi(e,t,n),e=e.sibling}function hi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(hi(e,t,n),e=e.sibling;e!==null;)hi(e,t,n),e=e.sibling}var ee=null,De=!1;function lt(e,t,n){for(n=n.child;n!==null;)Lc(e,t,n),n=n.sibling}function Lc(e,t,n){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(xl,n)}catch{}switch(n.tag){case 5:ie||rn(n,t);case 6:var r=ee,l=De;ee=null,lt(e,t,n),ee=r,De=l,ee!==null&&(De?(e=ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ee.removeChild(n.stateNode));break;case 18:ee!==null&&(De?(e=ee,n=n.stateNode,e.nodeType===8?go(e.parentNode,n):e.nodeType===1&&go(e,n),qn(e)):go(ee,n.stateNode));break;case 4:r=ee,l=De,ee=n.stateNode.containerInfo,De=!0,lt(e,t,n),ee=r,De=l;break;case 0:case 11:case 14:case 15:if(!ie&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&fi(n,t,i),l=l.next}while(l!==r)}lt(e,t,n);break;case 1:if(!ie&&(rn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){W(n,t,u)}lt(e,t,n);break;case 21:lt(e,t,n);break;case 22:n.mode&1?(ie=(r=ie)||n.memoizedState!==null,lt(e,t,n),ie=r):lt(e,t,n);break;default:lt(e,t,n)}}function js(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ep),t.forEach(function(r){var l=zp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=$()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cp(r/1960))-r,10e?16:e,ct===null)var r=!1;else{if(e=ct,ct=null,Sl=0,(M&6)!==0)throw Error(v(331));var l=M;for(M|=4,E=e.current;E!==null;){var o=E,i=o.child;if((E.flags&16)!==0){var u=o.deletions;if(u!==null){for(var s=0;s$()-tu?Tt(e,0):eu|=n),ve(e,t)}function Ac(e,t){t===0&&((e.mode&1)===0?t=1:(t=Ir,Ir<<=1,(Ir&130023424)===0&&(Ir=4194304)));var n=ce();e=be(e,t),e!==null&&(ar(e,t,n),ve(e,n))}function Rp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ac(e,n)}function zp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(v(314))}r!==null&&r.delete(t),Ac(e,n)}var Vc;Vc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)pe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return pe=!1,wp(e,t,n);pe=(e.flags&131072)!==0}else pe=!1,A&&(t.flags&1048576)!==0&&Ba(t,fl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Xr(e,t),e=t.pendingProps;var l=pn(t,ue.current);cn(t,n),l=Yi(null,t,r,e,l,n);var o=Zi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,he(r)?(o=!0,cl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Wi(t),l.updater=Ll,t.stateNode=l,l._reactInternals=t,oi(t,r,e,n),t=si(null,t,r,!0,o,n)):(t.tag=0,A&&o&&Fi(t),ae(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Xr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Dp(r),e=Te(r,e),l){case 0:t=ui(null,t,r,e,n);break e;case 1:t=zs(null,t,r,e,n);break e;case 11:t=Ls(null,t,r,e,n);break e;case 14:t=Rs(null,t,r,Te(r.type,e),n);break e}throw Error(v(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),ui(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),zs(e,t,r,l,n);case 3:e:{if(Ec(t),e===null)throw Error(v(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ka(e,t),hl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=yn(Error(v(423)),t),t=Ts(e,t,r,n,l);break e}else if(r!==l){l=yn(Error(v(424)),t),t=Ts(e,t,r,n,l);break e}else for(ge=mt(t.stateNode.containerInfo.firstChild),we=t,A=!0,Oe=null,n=Xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mn(),r===l){t=et(e,t,n);break e}ae(e,t,r,n)}t=t.child}return t;case 5:return qa(t),e===null&&ni(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,qo(r,l)?i=null:o!==null&&qo(r,o)&&(t.flags|=32),Sc(e,t),ae(e,t,i,n),t.child;case 6:return e===null&&ni(t),null;case 13:return Pc(e,t,n);case 4:return $i(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hn(t,null,r,n):ae(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),Ls(e,t,r,l,n);case 7:return ae(e,t,t.pendingProps,n),t.child;case 8:return ae(e,t,t.pendingProps.children,n),t.child;case 12:return ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,T(pl,r._currentValue),r._currentValue=i,o!==null)if(Ae(o.value,i)){if(o.children===l.children&&!me.current){t=et(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=Xe(-1,n&-n),s.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?s.next=s:(s.next=p.next,p.next=s),c.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ri(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(v(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ri(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ae(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,cn(t,n),l=Ie(l),r=r(l),t.flags|=1,ae(e,t,r,n),t.child;case 14:return r=t.type,l=Te(r,t.pendingProps),l=Te(r.type,l),Rs(e,t,r,l,n);case 15:return wc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),Xr(e,t),t.tag=1,he(r)?(e=!0,cl(t)):e=!1,cn(t,n),Ya(t,r,l),oi(t,r,l,n),si(null,t,r,!0,e,n);case 19:return xc(e,t,n);case 22:return kc(e,t,n)}throw Error(v(156,t.tag))};function Uc(e,t){return fa(e,t)}function Tp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Me(e,t,n,r){return new Tp(e,t,n,r)}function ou(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Dp(e){if(typeof e=="function")return ou(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xi)return 11;if(e===Ci)return 14}return 2}function gt(e,t){var n=e.alternate;return n===null?(n=Me(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function br(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")ou(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Yt:return Dt(n.children,l,o,t);case Pi:i=8,l|=8;break;case Io:return e=Me(12,n,t,l|2),e.elementType=Io,e.lanes=o,e;case Lo:return e=Me(13,n,t,l),e.elementType=Lo,e.lanes=o,e;case Ro:return e=Me(19,n,t,l),e.elementType=Ro,e.lanes=o,e;case Zs:return Dl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Gs:i=10;break e;case Ys:i=9;break e;case xi:i=11;break e;case Ci:i=14;break e;case ot:i=16,r=null;break e}throw Error(v(130,e==null?e:typeof e,""))}return t=Me(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Dt(e,t,n,r){return e=Me(7,e,r,t),e.lanes=n,e}function Dl(e,t,n,r){return e=Me(22,e,r,t),e.elementType=Zs,e.lanes=n,e.stateNode={isHidden:!1},e}function _o(e,t,n){return e=Me(6,e,null,t),e.lanes=n,e}function Mo(e,t,n){return t=Me(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Op(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ao(0),this.expirationTimes=ao(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ao(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function iu(e,t,n,r,l,o,i,u,s){return e=new Op(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Me(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wi(o),e}function Fp(e,t,n){var r=3{"use strict";function Qc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qc)}catch(e){console.error(e)}}Qc(),Kc.exports=$c()});var Yc=Qe(du=>{"use strict";var Gc=cu();du.createRoot=Gc.createRoot,du.hydrateRoot=Gc.hydrateRoot;var r1});var Xc=Qe(Ul=>{"use strict";var Hp=_t(),Bp=Symbol.for("react.element"),Wp=Symbol.for("react.fragment"),$p=Object.prototype.hasOwnProperty,Qp=Hp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Kp={key:!0,ref:!0,__self:!0,__source:!0};function Zc(e,t,n){var r,l={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)$p.call(t,r)&&!Kp.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:Bp,type:e,key:o,ref:i,props:l,_owner:Qp.current}}Ul.Fragment=Wp;Ul.jsx=Zc;Ul.jsxs=Zc});var j=Qe((a1,qc)=>{"use strict";qc.exports=Xc()});var hd=I(Yc(),1);var xt=class{static async getAll(){let t=await GM.listValues(),n=await Promise.all(t.map(async r=>({[r]:await GM.getValue(r)})));return Object.assign({},...n)}static async deleteAll(){let t=await GM.listValues();await Promise.all(t.map(async n=>await GM.deleteValue(n)))}static async setValues({items:t}){for(let[n,r]of Object.entries(t))await GM.setValue(n,r)}};var Vl=async e=>{typeof e>"u"&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches),e?document.getElementById("portal").classList.add("modal-dark"):document.getElementById("portal").classList.remove("modal-dark"),await xt.setValues({items:{darkMode:e}})};var Pe=I(_t(),1);var pr=I(j(),1),Bt=({text:e,form:t,loading:n,disabled:r,onClick:l})=>n?(0,pr.jsx)("button",{className:"button loading",disabled:!0,children:e&&(0,pr.jsx)("span",{children:e})}):(0,pr.jsx)("button",{className:"button",disabled:!!r,...t&&{form:t},...l&&{onClick:l},children:e&&(0,pr.jsx)("span",{children:e})});var mr=I(j(),1),Hl=({title:e,setVisible:t})=>(0,mr.jsxs)("header",{children:[(0,mr.jsx)("h2",{children:e}),(0,mr.jsx)(Ct,{type:"close",onClick:t})]});var V=I(j(),1),Ct=({type:e,loading:t,onClick:n})=>t?(0,V.jsx)("div",{className:"icon",children:Jc.loading}):(0,V.jsx)("div",{className:"icon",...n&&{onClick:n},children:Jc[e]}),Jc={close:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",children:(0,V.jsxs)("g",{fill:"currentColor",children:[(0,V.jsx)("path",{d:"M16.34 9.322a1 1 0 1 0-1.364-1.463l-2.926 2.728L9.322 7.66A1 1 0 0 0 7.86 9.024l2.728 2.926l-2.927 2.728a1 1 0 1 0 1.364 1.462l2.926-2.727l2.728 2.926a1 1 0 1 0 1.462-1.363l-2.727-2.926l2.926-2.728Z"}),(0,V.jsx)("path",{fillRule:"evenodd",d:"M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12Zm11 9a9 9 0 1 1 0-18a9 9 0 0 1 0 18Z",clipRule:"evenodd"})]})}),check:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",children:(0,V.jsx)("path",{fill:"currentColor",d:"m10.586 13.414l-2.829-2.828L6.343 12l4.243 4.243l7.07-7.071l-1.413-1.415l-5.657 5.657Z"})}),clipboard:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",children:(0,V.jsxs)("g",{fill:"currentColor",children:[(0,V.jsx)("path",{d:"M8 11a1 1 0 1 0 0 2h7.96a1 1 0 1 0 0-2H8Zm.04 4.066a1 1 0 1 0 0 2H16a1 1 0 1 0 0-2H8.04Z"}),(0,V.jsx)("path",{fillRule:"evenodd",d:"M5 3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5Zm2 2H5v14h14V5h-2v1a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3V5Zm2 0v1a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V5H9Z",clipRule:"evenodd"})]})}),link:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",children:(0,V.jsxs)("g",{fill:"currentColor",children:[(0,V.jsx)("path",{d:"m14.828 12l1.415 1.414l2.828-2.828a4 4 0 0 0-5.657-5.657l-2.828 2.828L12 9.172l2.828-2.829a2 2 0 1 1 2.829 2.829L14.828 12ZM12 14.829l1.414 1.414l-2.828 2.828a4 4 0 0 1-5.657-5.657l2.828-2.828L9.172 12l-2.829 2.829a2 2 0 1 0 2.829 2.828L12 14.828Z"}),(0,V.jsx)("path",{d:"M14.829 10.586a1 1 0 0 0-1.415-1.415l-4.242 4.243a1 1 0 1 0 1.414 1.414l4.242-4.242Z"})]})}),reddit:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 512 512",children:(0,V.jsx)("path",{fill:"currentColor",d:"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9c-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2c22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8c-9.7-10.1-23.4-16.3-38.4-16.3c-55.6 0-73.8 74.6-22.9 100.1c-1.8 7.9-2.6 16.3-2.6 24.7c0 83.8 94.4 151.7 210.3 151.7c116.4 0 210.8-67.9 210.8-151.7c0-8.4-.9-17.2-3.1-25.1c49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7c21.6 0 39.2 17.6 39.2 39.7c0 21.6-17.6 39.2-39.2 39.2c-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0c-4-3.5-4-9.7 0-13.7c3.5-3.5 9.7-3.5 13.2 0c27.8 28.5 120 29 149 0c3.5-3.5 9.7-3.5 13.2 0c4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2c0-22 17.6-39.7 39.2-39.7c22 0 39.7 17.6 39.7 39.7c-.1 21.5-17.7 39.2-39.7 39.2z"})}),discord:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 640 512",children:(0,V.jsx)("path",{fill:"currentColor",d:"M524.531 69.836a1.5 1.5 0 0 0-.764-.7A485.065 485.065 0 0 0 404.081 32.03a1.816 1.816 0 0 0-1.923.91a337.461 337.461 0 0 0-14.9 30.6a447.848 447.848 0 0 0-134.426 0a309.541 309.541 0 0 0-15.135-30.6a1.89 1.89 0 0 0-1.924-.91a483.689 483.689 0 0 0-119.688 37.107a1.712 1.712 0 0 0-.788.676C39.068 183.651 18.186 294.69 28.43 404.354a2.016 2.016 0 0 0 .765 1.375a487.666 487.666 0 0 0 146.825 74.189a1.9 1.9 0 0 0 2.063-.676A348.2 348.2 0 0 0 208.12 430.4a1.86 1.86 0 0 0-1.019-2.588a321.173 321.173 0 0 1-45.868-21.853a1.885 1.885 0 0 1-.185-3.126a251.047 251.047 0 0 0 9.109-7.137a1.819 1.819 0 0 1 1.9-.256c96.229 43.917 200.41 43.917 295.5 0a1.812 1.812 0 0 1 1.924.233a234.533 234.533 0 0 0 9.132 7.16a1.884 1.884 0 0 1-.162 3.126a301.407 301.407 0 0 1-45.89 21.83a1.875 1.875 0 0 0-1 2.611a391.055 391.055 0 0 0 30.014 48.815a1.864 1.864 0 0 0 2.063.7A486.048 486.048 0 0 0 610.7 405.729a1.882 1.882 0 0 0 .765-1.352c12.264-126.783-20.532-236.912-86.934-334.541ZM222.491 337.58c-28.972 0-52.844-26.587-52.844-59.239s23.409-59.241 52.844-59.241c29.665 0 53.306 26.82 52.843 59.239c0 32.654-23.41 59.241-52.843 59.241Zm195.38 0c-28.971 0-52.843-26.587-52.843-59.239s23.409-59.241 52.843-59.241c29.667 0 53.307 26.82 52.844 59.239c0 32.654-23.177 59.241-52.844 59.241Z"})}),loading:(0,V.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"animate-spin",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",children:(0,V.jsx)("path",{fill:"currentColor",d:"M2 12C2 6.477 6.477 2 12 2v3a7 7 0 0 0-7 7H2Z"})})};var bc=I(j(),1),Bl=({children:e})=>(0,bc.jsx)("main",{children:e});var ed=I(_t(),1);var X=I(j(),1),Gp=({player:e,setPlayers:t})=>{let n=r=>{t({id:r})};return(0,X.jsxs)("div",{className:`player ${e.selected?"selected":""}`,onClick:()=>n(e.id),children:[(0,X.jsx)("span",{className:"number",children:e.number}),(0,X.jsx)("img",{src:e.photo,alt:e.name}),(0,X.jsx)("span",{className:"name",children:e.name})]})},hr=({position:e,players:t,setPlayers:n})=>(0,X.jsxs)("section",{children:[(0,X.jsx)("h3",{children:e}),(0,X.jsx)("div",{className:"players",children:t.map(r=>(0,X.jsx)(Gp,{player:r,setPlayers:n},r.number))})]}),td=({children:e,poll:t,request:n,selectedCount:r,setPage:l,setPoll:o,setRequest:i})=>{let u=(0,ed.useRef)(null),s=async p=>{p.preventDefault(),t.titleEdited?await i({type:"strawpoll"}):(u.current?.setCustomValidity("Please edit the poll title."),u.current?.reportValidity())},c=p=>{u.current?.setCustomValidity(""),o({items:{title:p.currentTarget.value,titleEdited:!0}})};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"player-list",children:e}),(0,X.jsx)("footer",{children:(0,X.jsxs)("form",{id:"form-poll",children:[(0,X.jsx)("input",{ref:u,className:"big",type:"text",value:t.title,onInput:p=>c(p),required:!0}),(0,X.jsx)(Bt,{text:"Create Poll",disabled:r<11,onClick:s,...n?.state==="fetching"&&{loading:!0}}),(0,X.jsx)(Bt,{text:"Settings",onClick:()=>l({page:"settings"})})]})})]})};var nd=I(_t(),1);var Q=I(j(),1),rd=({poll:e,request:t,setRequest:n,resetPoll:r})=>{let[l,o]=(0,nd.useState)({poll:!1,clipboard:!1,discord:!1,reddit:!1}),i=async()=>{e.url&&await navigator.clipboard.writeText(e.url),o(c=>({...c,clipboard:!0})),setTimeout(()=>{o(c=>({...c,clipboard:!1}))},2e3)},u=async()=>{l.discord||(await n({type:"discord"}),o(c=>({...c,discord:!0})))},s=c=>{c==="poll"?window.open(e.url,"_blank","noreferrer"):c==="reddit"&&(window.open(`https://www.reddit.com/r/Barca/submit?title=${e.title}&url=${e.url}`,"_blank","noreferrer"),o(p=>({...p,reddit:!0})))};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{id:"area-results",children:[(0,Q.jsxs)("label",{children:[(0,Q.jsx)("span",{children:"Poll URL:"}),(0,Q.jsx)("input",{type:"text",value:e.url,readOnly:!0})]}),(0,Q.jsxs)("ul",{className:"icon-list",children:[(0,Q.jsx)("li",{"data-text":"Visit poll",children:(0,Q.jsx)(Ct,{type:l.poll?"check":"link",onClick:()=>s("poll")})}),(0,Q.jsx)("li",{"data-text":"Copy to clipboard",children:(0,Q.jsx)(Ct,{type:l.clipboard?"check":"clipboard",onClick:i})}),(0,Q.jsx)("li",{"data-text":"Post on Reddit",children:(0,Q.jsx)(Ct,{type:l.reddit?"check":"reddit",onClick:()=>s("reddit")})}),(0,Q.jsx)("li",{"data-text":"Post on Discord",children:t?.state==="fetching"?(0,Q.jsx)(Ct,{type:"loading"}):(0,Q.jsx)(Ct,{type:l.discord?"check":"discord",onClick:l.discord?()=>{}:u})})]})]}),(0,Q.jsx)("footer",{children:(0,Q.jsx)(Bt,{text:"Create another poll",onClick:r})})]})};var Wt=I(_t(),1);var D=I(j(),1),Yp=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,ld=({initialSettings:e,setPage:t,setSettings:n})=>{let[r,l]=(0,Wt.useState)(e.darkMode??Yp()),o=(0,Wt.useRef)(null),i=(0,Wt.useRef)(null),u=(0,Wt.useRef)(null),s=(0,Wt.useRef)(null),c=async h=>{if(o.current?.checkValidity()){h.preventDefault();let m={strawpollKey:i.current?.value,strawpollExpiry:u.current?.valueAsNumber,discordWebhook:s.current?.value,darkMode:r};await xt.setValues({items:m}),n({items:m}),t({page:"poll"})}},p=async h=>{let m=h.currentTarget.checked;await Vl(m),l(m),n({items:{darkMode:m}})};return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("div",{id:"script-info",children:[(0,D.jsx)("img",{src:GM.info.script.icon,alt:"Script logo"}),(0,D.jsx)("h1",{children:GM.info.script.name}),(0,D.jsxs)("h4",{children:[(0,D.jsxs)("a",{href:"https://github.com/barca-reddit/strawpoll-userscript-react/tags",rel:"noreferrer",target:"_blank",children:["v.",GM.info.script.version]}),` • ${GM.info.platform.browserName} (${GM.info.platform.browserVersion}) • ${GM.info.platform.os} (${GM.info.platform.arch})`]}),(0,D.jsx)("span",{children:GM.info.script.description})]}),(0,D.jsxs)("form",{id:"form-settings",ref:o,children:[(0,D.jsxs)("label",{children:[(0,D.jsx)("span",{children:"Strawpoll API key:"}),(0,D.jsx)("input",{type:"text",ref:i,defaultValue:e.strawpollKey??"",autoComplete:"off",spellCheck:"false",minLength:20,maxLength:40,pattern:".{20,40}",placeholder:"Enter your API key here...",required:!0})]}),(0,D.jsxs)("label",{children:[(0,D.jsx)("span",{children:"Discord Webhook URL:"}),(0,D.jsx)("input",{type:"text",ref:s,defaultValue:e.discordWebhook??"",autoComplete:"off",spellCheck:"false",minLength:20,pattern:".{20,}",placeholder:"Enter your Discord webook URL here...",required:!0})]}),(0,D.jsxs)("label",{children:[(0,D.jsx)("span",{children:"Poll expiry (hours):"}),(0,D.jsx)("input",{type:"number",ref:u,defaultValue:e.strawpollExpiry??72,min:"0",max:"168",step:"1",autoComplete:"off",required:!0})]}),(0,D.jsxs)("label",{children:[(0,D.jsx)("span",{children:"Dark mode:"}),(0,D.jsx)("input",{type:"checkbox",checked:r,onChange:h=>p(h)})]})]}),(0,D.jsx)("footer",{children:(0,D.jsx)(Bt,{text:"Save Settings",onClick:h=>c(h),form:"form-settings"})})]})};var od=I(cu(),1);var G=I(j(),1),id=({visible:e,page:t,poll:n,players:r,settings:l,request:o,setVisible:i,setPage:u,setPoll:s,setPlayers:c,setSettings:p,setRequest:h,resetPoll:m})=>(0,od.createPortal)((0,G.jsx)("div",{className:`modal-wrapper${e?" flex":" hidden"}`,onClick:i,children:(0,G.jsxs)("main",{className:"modal",onClick:g=>g.stopPropagation(),children:[t==="settings"&&(0,G.jsxs)(Wl,{children:[(0,G.jsx)(Hl,{title:"Script Settings",setVisible:i}),(0,G.jsx)(Bl,{children:(0,G.jsx)(ld,{initialSettings:l,setSettings:p,setPage:u})})]}),t==="poll"&&(0,G.jsxs)(Wl,{children:[(0,G.jsx)(Hl,{title:"Create Match Poll",setVisible:i}),(0,G.jsx)(Bl,{children:(0,G.jsxs)(td,{poll:n,request:o,setPage:u,setRequest:h,selectedCount:r.selectedCount,setPoll:s,children:[(0,G.jsx)(hr,{position:"Goalkeepers",players:r.byPosition.gk.map(g=>r.byId[g]),setPlayers:c}),(0,G.jsx)(hr,{position:"Defenders",players:r.byPosition.def.map(g=>r.byId[g]),setPlayers:c}),(0,G.jsx)(hr,{position:"Midfielders",players:r.byPosition.mid.map(g=>r.byId[g]),setPlayers:c}),(0,G.jsx)(hr,{position:"Forwards",players:r.byPosition.att.map(g=>r.byId[g]),setPlayers:c})]})})]}),t==="results"&&(0,G.jsxs)(Wl,{children:[(0,G.jsx)(Hl,{title:"Poll Results",setVisible:i}),(0,G.jsx)(Bl,{children:(0,G.jsx)(rd,{poll:n,request:o,setRequest:h,resetPoll:m})})]})]})}),document.getElementById("portal"));var $l=I(j(),1),Wl=({children:e})=>(0,$l.jsx)($l.Fragment,{children:e});var sd=I(j(),1),ud=({visible:e,setVisible:t})=>(0,sd.jsx)("div",{className:`modal-toggle ${e?"hidden":"flex"}`,onClick:t,children:"Create Match Poll"});var Zp=[{name:"Marc-André ter Stegen",number:1,position:"gk",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115376025940019/01-ter-stegen.png"},{name:"Iñaki Peña",number:26,position:"gk",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116290774282260/26-inaki.png"},{name:"Ander Astralaga",number:31,position:"gk",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116294033248307/31-astralaga.png"},{name:"Arnau Tenas",number:36,position:"gk",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116714986176532/36-arnau.png"},{name:"Héctor Bellerín",number:2,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115376411820072/02-bellerin.png"},{name:"Gerard Piqué",number:3,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115377309384714/03-pique.png"},{name:"Ronald Araújo",number:4,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115377632358431/04-araujo.png"},{name:"Andreas Christensen",number:15,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115910388654160/15-christensen.png"},{name:"Marcos Alonso",number:17,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115910925537310/17-alonso.png"},{name:"Jordi Alba",number:18,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115911290421248/18-alba.png"},{name:"Jules Koundé",number:23,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115913236594688/23-kounde.png"},{name:"Eric Garcia",number:24,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116290233204736/24-eric.png"},{name:"Álex Baldé",number:28,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116292544278618/28-balde.png"},{name:"Alex Valle",number:33,position:"def",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116294960189480/33-valle.png"},{name:"Sergio Busquets",number:5,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115378022432819/05-busquets.png"},{name:"Pedri",number:8,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115378869674014/08-pedri.png"},{name:"Franck Kessié",number:19,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115911684698152/19-kessie.png"},{name:"Sergi Roberto",number:20,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115912007667762/20-sergi.png"},{name:"Frenkie de Jong",number:21,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115912519352360/21-frenkie.png"},{name:"Marc Casado",number:29,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116293123080212/29-casado.png"},{name:"Gavi",number:30,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116293584465940/30-gavi.png"},{name:"Pablo Torre",number:32,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116294389760060/32-torre.png"},{name:"Álvaro Sanz",number:34,position:"mid",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116295572570153/34-sanz.png"},{name:"Ousmane Dembélé",number:7,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115378391519242/07-dembele.png"},{name:"Robert Lewandowski",number:9,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115379217813534/09-lewandowski.png"},{name:"Ansu Fati",number:10,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115379616251924/10-fati.png"},{name:"Ferran Torres",number:11,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115909625299035/11-ferran.png"},{name:"Memphis Depay",number:14,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115909944053790/14-memphis.png"},{name:"Raphinha",number:22,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023115912884265000/22-raphinha.png"},{name:"Ilias Akomach",number:27,position:"att",photo:"https://cdn.discordapp.com/attachments/784418814661623809/1023116292057743461/27-akomach.png"}],fu=Zp.reduce((e,t,n)=>(e.byId[n]={...t,id:n,selected:!1},e.byPosition[t.position].push(n),e),{byId:{},byPosition:{gk:[],def:[],mid:[],att:[]},selectedCount:0});var ad=async({url:e,body:t,key:n,toJson:r})=>{let l=await fetch(e,{method:"post",credentials:"omit",headers:{"Content-type":"application/json",...n&&{"X-API-Key":n}},body:JSON.stringify(t)});if(!l.ok||l.status>=300)throw l;return r?await l.json():l},cd=async(e,t,n)=>{let r=o=>{switch(o){case"gk":return 1;case"def":return 2;case"mid":return 3;case"att":return 4}},l=Object.values(t.byId).filter(o=>o.selected).map(o=>({...o,position:r(o.position)})).sort((o,i)=>o.number-i.number).sort((o,i)=>o.position-i.position).map(o=>({type:"text",value:o.name}));return await ad({url:"https://api.strawpoll.com/v3/polls",body:{title:e,type:"multiple_choice",poll_options:l,poll_config:{allow_other_option:!1,allow_vpn_users:!0,duplication_checking:"ip",...n.strawpollExpiry&&n.strawpollExpiry>0&&{deadline_at:Math.round((Date.now()+n.strawpollExpiry*36e5)/1e3)}}},key:n.strawpollKey,toJson:!0})},dd=async(e,t)=>await ad({url:e,body:{content:`**${t.title}** Please vote for your MOTM: ${t.url}`},toJson:!1});var vr=I(j(),1),fd=({initialSettings:e})=>{let[t,n]=(0,Pe.useState)(!1),[r,l]=(0,Pe.useState)("poll"),[o,i]=(0,Pe.useState)(e),[u,s]=(0,Pe.useState)(fu),[c,p]=(0,Pe.useState)(),[h,m]=(0,Pe.useState)({title:"[Poll] - MOTM vs Opponent (H/A)",titleEdited:!1}),g=(0,Pe.useRef)(!0),S=({items:w})=>{m(k=>({...k,...w}))},P=()=>{n(w=>!w)},R=({page:w})=>{l(w)},d=({items:w})=>{i(k=>({...k,...w}))},a=({id:w})=>{typeof w!="number"?s(fu):Number.isInteger(w)&&s(k=>({...k,byId:{...k.byId,[k.byId[w].id]:{...k.byId[w],selected:!k.byId[w].selected}},selectedCount:k.byId[w].selected?k.selectedCount-1:k.selectedCount+1}))},f=async({type:w})=>{if(!w)p(void 0);else try{if(p({state:"fetching"}),w==="strawpoll"){let k=await cd(h.title,u,o);if(!k.user)throw new Error("Error: Invalid API key");p({state:"complete",payload:k}),S({items:{url:k.url}}),R({page:"results"})}else if(w==="discord"){let k=await dd(o.discordWebhook,h);p({state:"complete",payload:k})}}catch(k){k instanceof Response&&(alert(`Error (${k.status}): ${k.statusText}`),p({state:"error",payload:k})),k instanceof Error&&(alert(k.message),p({state:"error",payload:k})),console.error(k)}},y=async()=>{await f({}),S({items:{title:"[Poll] - MOTM vs Opponent (H/A)",titleEdited:!1}}),a({}),R({page:"poll"})};return(0,Pe.useEffect)(()=>{if(g.current){["strawpollKey","strawpollExpiry","discordWebhook","darkMode"].some(w=>typeof o[w]>"u")&&R({page:"settings"}),g.current=!1;return}},[o]),(0,vr.jsxs)(Pe.StrictMode,{children:[(0,vr.jsx)(id,{visible:t,page:r,players:u,settings:o,request:c,poll:h,setPlayers:a,setPage:R,setPoll:S,setVisible:P,setSettings:d,setRequest:f,resetPoll:y}),(0,vr.jsx)(ud,{visible:t,setVisible:P})]})};var vd=I(j(),1),pd=({id:e})=>{let t=document.createElement("div");return t.setAttribute("id",e),t.setAttribute("class","user-script"),t},pu=new MutationObserver(async e=>{if(document.body){pu.disconnect(),await md();return}e.forEach(async t=>{t.addedNodes[0]===document.body&&(pu.disconnect(),await md())})});pu.observe(document.documentElement,{childList:!0});var md=async()=>{typeof GM.getResourceText<"u"&&await GM.addStyle(GM.getResourceText("css"));let e=await xt.getAll(),t=pd({id:"root"}),n=pd({id:"portal"});document.body.appendChild(t),document.body.appendChild(n),await Vl(e.darkMode),(0,hd.createRoot)(t).render((0,vd.jsx)(fd,{initialSettings:e}))};})(); /** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */