diff --git a/modules/chess/pkg/ui/assets/index-6558d890.js b/modules/chess/pkg/ui/assets/index-6558d890.js deleted file mode 100644 index 8e187413..00000000 --- a/modules/chess/pkg/ui/assets/index-6558d890.js +++ /dev/null @@ -1,87 +0,0 @@ -var wh=Object.defineProperty;var kh=(e,t,n)=>t in e?wh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ze=(e,t,n)=>(kh(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function wc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kc={exports:{}},di={},Ec={exports:{}},z={};/** - * @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. - */var Vr=Symbol.for("react.element"),Eh=Symbol.for("react.portal"),Ch=Symbol.for("react.fragment"),xh=Symbol.for("react.strict_mode"),_h=Symbol.for("react.profiler"),Oh=Symbol.for("react.provider"),Th=Symbol.for("react.context"),Dh=Symbol.for("react.forward_ref"),Ph=Symbol.for("react.suspense"),Ih=Symbol.for("react.memo"),jh=Symbol.for("react.lazy"),ju=Symbol.iterator;function Lh(e){return e===null||typeof e!="object"?null:(e=ju&&e[ju]||e["@@iterator"],typeof e=="function"?e:null)}var Cc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xc=Object.assign,_c={};function Xn(e,t,n){this.props=e,this.context=t,this.refs=_c,this.updater=n||Cc}Xn.prototype.isReactComponent={};Xn.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")};Xn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Oc(){}Oc.prototype=Xn.prototype;function _l(e,t,n){this.props=e,this.context=t,this.refs=_c,this.updater=n||Cc}var Ol=_l.prototype=new Oc;Ol.constructor=_l;xc(Ol,Xn.prototype);Ol.isPureReactComponent=!0;var Lu=Array.isArray,Tc=Object.prototype.hasOwnProperty,Tl={current:null},Dc={key:!0,ref:!0,__self:!0,__source:!0};function Pc(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Tc.call(t,r)&&!Dc.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1>>1,Y=D[U];if(0>>1;Uo(_t,R))Xeo(ze,_t)?(D[U]=ze,D[Xe]=R,U=Xe):(D[U]=_t,D[b]=R,U=b);else if(Xeo(ze,R))D[U]=ze,D[Xe]=R,U=Xe;else break e}}return L}function o(D,L){var R=D.sortIndex-L.sortIndex;return R!==0?R:D.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],a=[],h=1,m=null,d=3,g=!1,v=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(D){for(var L=n(a);L!==null;){if(L.callback===null)r(a);else if(L.startTime<=D)r(a),L.sortIndex=L.expirationTime,t(u,L);else break;L=n(a)}}function k(D){if(y=!1,f(D),!v)if(n(u)!==null)v=!0,tn(x);else{var L=n(a);L!==null&&nn(k,L.startTime-D)}}function x(D,L){v=!1,y&&(y=!1,p(T),T=-1),g=!0;var R=d;try{for(f(L),m=n(u);m!==null&&(!(m.expirationTime>L)||D&&!ne());){var U=m.callback;if(typeof U=="function"){m.callback=null,d=m.priorityLevel;var Y=U(m.expirationTime<=L);L=e.unstable_now(),typeof Y=="function"?m.callback=Y:m===n(u)&&r(u),f(L)}else r(u);m=n(u)}if(m!==null)var lt=!0;else{var b=n(a);b!==null&&nn(k,b.startTime-L),lt=!1}return lt}finally{m=null,d=R,g=!1}}var _=!1,O=null,T=-1,j=5,I=-1;function ne(){return!(e.unstable_now()-ID||125U?(D.sortIndex=R,t(a,D),n(u)===null&&D===n(a)&&(y?(p(T),T=-1):y=!0,nn(k,R-U))):(D.sortIndex=Y,t(u,D),v||g||(v=!0,tn(x))),D},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(D){var L=d;return function(){var R=d;d=L;try{return D.apply(this,arguments)}finally{d=R}}}})(Nc);Lc.exports=Nc;var Wh=Lc.exports;/** - * @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. - */var Mc=C,Re=Wh;function E(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"),Os=Object.prototype.hasOwnProperty,qh=/^[: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]*$/,Mu={},Ru={};function Qh(e){return Os.call(Ru,e)?!0:Os.call(Mu,e)?!1:qh.test(e)?Ru[e]=!0:(Mu[e]=!0,!1)}function Kh(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 Vh(e,t,n,r){if(t===null||typeof t>"u"||Kh(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 Ee(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var de={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){de[e]=new Ee(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];de[t]=new Ee(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){de[e]=new Ee(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){de[e]=new Ee(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){de[e]=new Ee(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){de[e]=new Ee(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){de[e]=new Ee(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){de[e]=new Ee(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){de[e]=new Ee(e,5,!1,e.toLowerCase(),null,!1,!1)});var Pl=/[\-:]([a-z])/g;function Il(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(Pl,Il);de[t]=new Ee(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(Pl,Il);de[t]=new Ee(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(Pl,Il);de[t]=new Ee(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){de[e]=new Ee(e,1,!1,e.toLowerCase(),null,!1,!1)});de.xlinkHref=new Ee("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){de[e]=new Ee(e,1,!1,e.toLowerCase(),null,!0,!0)});function jl(e,t,n,r){var o=de.hasOwnProperty(t)?de[t]:null;(o!==null?o.type!==0:r||!(2l||o[s]!==i[l]){var u=` -`+o[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{Wi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?fr(e):""}function Gh(e){switch(e.tag){case 5:return fr(e.type);case 16:return fr("Lazy");case 13:return fr("Suspense");case 19:return fr("SuspenseList");case 0:case 2:case 15:return e=qi(e.type,!1),e;case 11:return e=qi(e.type.render,!1),e;case 1:return e=qi(e.type,!0),e;default:return""}}function Is(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 On:return"Fragment";case _n:return"Portal";case Ts:return"Profiler";case Ll:return"StrictMode";case Ds:return"Suspense";case Ps:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case bc:return(e.displayName||"Context")+".Consumer";case Ac:return(e._context.displayName||"Context")+".Provider";case Nl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ml:return t=e.displayName||null,t!==null?t:Is(e.type)||"Memo";case Lt:t=e._payload,e=e._init;try{return Is(e(t))}catch{}}return null}function Yh(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 Is(t);case 8:return t===Ll?"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 Gt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xh(e){var t=$c(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 o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function so(e){e._valueTracker||(e._valueTracker=Xh(e))}function Fc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$c(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Fo(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 js(e,t){var n=t.checked;return G({},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=Gt(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 Uc(e,t){t=t.checked,t!=null&&jl(e,"checked",t,!1)}function Ls(e,t){Uc(e,t);var n=Gt(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")?Ns(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ns(e,t.type,Gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function zu(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 Ns(e,t,n){(t!=="number"||Fo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var hr=Array.isArray;function bn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=lo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var vr={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},Jh=["Webkit","ms","Moz","O"];Object.keys(vr).forEach(function(e){Jh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vr[t]=vr[e]})});function qc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||vr.hasOwnProperty(e)&&vr[e]?(""+t).trim():t+"px"}function Qc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=qc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Zh=G({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 As(e,t){if(t){if(Zh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(E(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(E(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(E(61))}if(t.style!=null&&typeof t.style!="object")throw Error(E(62))}}function bs(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 zs=null;function Rl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var $s=null,zn=null,$n=null;function Uu(e){if(e=Xr(e)){if(typeof $s!="function")throw Error(E(280));var t=e.stateNode;t&&(t=mi(t),$s(e.stateNode,e.type,t))}}function Kc(e){zn?$n?$n.push(e):$n=[e]:zn=e}function Vc(){if(zn){var e=zn,t=$n;if($n=zn=null,Uu(e),t)for(e=0;e>>=0,e===0?32:31-(cp(e)/dp|0)|0}var uo=64,ao=4194304;function pr(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 Wo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=pr(l):(i&=s,i!==0&&(r=pr(i)))}else s=n&~o,s!==0?r=pr(s):i!==0&&(r=pr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Gr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ot(t),e[t]=n}function gp(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=Sr),Yu=String.fromCharCode(32),Xu=!1;function pd(e,t){switch(e){case"keyup":return Bp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tn=!1;function qp(e,t){switch(e){case"compositionend":return gd(t);case"keypress":return t.which!==32?null:(Xu=!0,Yu);case"textInput":return e=t.data,e===Yu&&Xu?null:e;default:return null}}function Qp(e,t){if(Tn)return e==="compositionend"||!Bl&&pd(e,t)?(e=fd(),Po=Fl=zt=null,Tn=!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=ta(n)}}function Sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wd(){for(var e=window,t=Fo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Fo(e.document)}return t}function Wl(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 t0(e){var t=wd(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Sd(n.ownerDocument.documentElement,n)){if(r!==null&&Wl(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 o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=na(n,i);var s=na(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,Dn=null,qs=null,kr=null,Qs=!1;function ra(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qs||Dn==null||Dn!==Fo(r)||(r=Dn,"selectionStart"in r&&Wl(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}),kr&&Rr(kr,r)||(kr=r,r=Ko(qs,"onSelect"),0jn||(e.current=Js[jn],Js[jn]=null,jn--)}function H(e,t){jn++,Js[jn]=e.current,e.current=t}var Yt={},ve=Jt(Yt),_e=Jt(!1),fn=Yt;function Wn(e,t){var n=e.type.contextTypes;if(!n)return Yt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Oe(e){return e=e.childContextTypes,e!=null}function Go(){q(_e),q(ve)}function ca(e,t,n){if(ve.current!==Yt)throw Error(E(168));H(ve,t),H(_e,n)}function Pd(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(E(108,Yh(e)||"Unknown",o));return G({},n,r)}function Yo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yt,fn=ve.current,H(ve,e),H(_e,_e.current),!0}function da(e,t,n){var r=e.stateNode;if(!r)throw Error(E(169));n?(e=Pd(e,t,fn),r.__reactInternalMemoizedMergedChildContext=e,q(_e),q(ve),H(ve,e)):q(_e),H(_e,n)}var gt=null,vi=!1,is=!1;function Id(e){gt===null?gt=[e]:gt.push(e)}function h0(e){vi=!0,Id(e)}function Zt(){if(!is&>!==null){is=!0;var e=0,t=F;try{var n=gt;for(F=1;e>=s,o-=s,mt=1<<32-ot(t)+o|n<T?(j=O,O=null):j=O.sibling;var I=d(p,O,f[T],k);if(I===null){O===null&&(O=j);break}e&&O&&I.alternate===null&&t(p,O),c=i(I,c,T),_===null?x=I:_.sibling=I,_=I,O=j}if(T===f.length)return n(p,O),Q&&rn(p,T),x;if(O===null){for(;TT?(j=O,O=null):j=O.sibling;var ne=d(p,O,I.value,k);if(ne===null){O===null&&(O=j);break}e&&O&&ne.alternate===null&&t(p,O),c=i(ne,c,T),_===null?x=ne:_.sibling=ne,_=ne,O=j}if(I.done)return n(p,O),Q&&rn(p,T),x;if(O===null){for(;!I.done;T++,I=f.next())I=m(p,I.value,k),I!==null&&(c=i(I,c,T),_===null?x=I:_.sibling=I,_=I);return Q&&rn(p,T),x}for(O=r(p,O);!I.done;T++,I=f.next())I=g(O,p,T,I.value,k),I!==null&&(e&&I.alternate!==null&&O.delete(I.key===null?T:I.key),c=i(I,c,T),_===null?x=I:_.sibling=I,_=I);return e&&O.forEach(function(fe){return t(p,fe)}),Q&&rn(p,T),x}function w(p,c,f,k){if(typeof f=="object"&&f!==null&&f.type===On&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case io:e:{for(var x=f.key,_=c;_!==null;){if(_.key===x){if(x=f.type,x===On){if(_.tag===7){n(p,_.sibling),c=o(_,f.props.children),c.return=p,p=c;break e}}else if(_.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Lt&&ya(x)===_.type){n(p,_.sibling),c=o(_,f.props),c.ref=sr(p,_,f),c.return=p,p=c;break e}n(p,_);break}else t(p,_);_=_.sibling}f.type===On?(c=cn(f.props.children,p.mode,k,f.key),c.return=p,p=c):(k=bo(f.type,f.key,f.props,null,p.mode,k),k.ref=sr(p,c,f),k.return=p,p=k)}return s(p);case _n:e:{for(_=f.key;c!==null;){if(c.key===_)if(c.tag===4&&c.stateNode.containerInfo===f.containerInfo&&c.stateNode.implementation===f.implementation){n(p,c.sibling),c=o(c,f.children||[]),c.return=p,p=c;break e}else{n(p,c);break}else t(p,c);c=c.sibling}c=hs(f,p.mode,k),c.return=p,p=c}return s(p);case Lt:return _=f._init,w(p,c,_(f._payload),k)}if(hr(f))return v(p,c,f,k);if(tr(f))return y(p,c,f,k);vo(p,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,c!==null&&c.tag===6?(n(p,c.sibling),c=o(c,f),c.return=p,p=c):(n(p,c),c=fs(f,p.mode,k),c.return=p,p=c),s(p)):n(p,c)}return w}var Qn=zd(!0),$d=zd(!1),Jr={},ft=Jt(Jr),$r=Jt(Jr),Fr=Jt(Jr);function un(e){if(e===Jr)throw Error(E(174));return e}function Zl(e,t){switch(H(Fr,t),H($r,e),H(ft,Jr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Rs(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Rs(t,e)}q(ft),H(ft,t)}function Kn(){q(ft),q($r),q(Fr)}function Fd(e){un(Fr.current);var t=un(ft.current),n=Rs(t,e.type);t!==n&&(H($r,e),H(ft,n))}function eu(e){$r.current===e&&(q(ft),q($r))}var K=Jt(0);function ni(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)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 ss=[];function tu(){for(var e=0;en?n:4,e(!0);var r=ls.transition;ls.transition={};try{e(!1),t()}finally{F=n,ls.transition=r}}function nf(){return Ye().memoizedState}function v0(e,t,n){var r=Qt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},rf(e))of(t,n);else if(n=Md(e,t,n,r),n!==null){var o=we();it(n,e,r,o),sf(n,t,r)}}function y0(e,t,n){var r=Qt(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(rf(e))of(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,st(l,s)){var u=t.interleaved;u===null?(o.next=o,Xl(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=Md(e,t,o,r),n!==null&&(o=we(),it(n,e,r,o),sf(n,t,r))}}function rf(e){var t=e.alternate;return e===V||t!==null&&t===V}function of(e,t){Er=ri=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sf(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bl(e,n)}}var oi={readContext:Ge,useCallback:he,useContext:he,useEffect:he,useImperativeHandle:he,useInsertionEffect:he,useLayoutEffect:he,useMemo:he,useReducer:he,useRef:he,useState:he,useDebugValue:he,useDeferredValue:he,useTransition:he,useMutableSource:he,useSyncExternalStore:he,useId:he,unstable_isNewReconciler:!1},S0={readContext:Ge,useCallback:function(e,t){return at().memoizedState=[e,t===void 0?null:t],e},useContext:Ge,useEffect:wa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,No(4194308,4,Xd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return No(4194308,4,e,t)},useInsertionEffect:function(e,t){return No(4,2,e,t)},useMemo:function(e,t){var n=at();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=at();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=v0.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=at();return e={current:e},t.memoizedState=e},useState:Sa,useDebugValue:su,useDeferredValue:function(e){return at().memoizedState=e},useTransition:function(){var e=Sa(!1),t=e[0];return e=m0.bind(null,e[1]),at().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=V,o=at();if(Q){if(n===void 0)throw Error(E(407));n=n()}else{if(n=t(),le===null)throw Error(E(349));pn&30||Bd(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,wa(qd.bind(null,r,i,e),[e]),r.flags|=2048,Br(9,Wd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=at(),t=le.identifierPrefix;if(Q){var n=vt,r=mt;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ur++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ct]=t,e[zr]=r,gf(e,t,!1,!1),t.stateNode=e;e:{switch(s=bs(n,r),n){case"dialog":W("cancel",e),W("close",e),o=r;break;case"iframe":case"object":case"embed":W("load",e),o=r;break;case"video":case"audio":for(o=0;oGn&&(t.flags|=128,r=!0,lr(i,!1),t.lanes=4194304)}else{if(!r)if(e=ni(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),lr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Q)return pe(t),null}else 2*J()-i.renderingStartTime>Gn&&n!==1073741824&&(t.flags|=128,r=!0,lr(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=J(),t.sibling=null,n=K.current,H(K,r?n&1|2:n&1),t):(pe(t),null);case 22:case 23:return fu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Le&1073741824&&(pe(t),t.subtreeFlags&6&&(t.flags|=8192)):pe(t),null;case 24:return null;case 25:return null}throw Error(E(156,t.tag))}function T0(e,t){switch(Ql(t),t.tag){case 1:return Oe(t.type)&&Go(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(),q(_e),q(ve),tu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return eu(t),null;case 13:if(q(K),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(E(340));qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(K),null;case 4:return Kn(),null;case 10:return Yl(t.type._context),null;case 22:case 23:return fu(),null;case 24:return null;default:return null}}var So=!1,me=!1,D0=typeof WeakSet=="function"?WeakSet:Set,P=null;function Rn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){X(e,t,r)}else n.current=null}function cl(e,t,n){try{n()}catch(r){X(e,t,r)}}var Pa=!1;function P0(e,t){if(Ks=qo,e=wd(),Wl(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 o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,u=-1,a=0,h=0,m=e,d=null;t:for(;;){for(var g;m!==n||o!==0&&m.nodeType!==3||(l=s+o),m!==i||r!==0&&m.nodeType!==3||(u=s+r),m.nodeType===3&&(s+=m.nodeValue.length),(g=m.firstChild)!==null;)d=m,m=g;for(;;){if(m===e)break t;if(d===n&&++a===o&&(l=s),d===i&&++h===r&&(u=s),(g=m.nextSibling)!==null)break;m=d,d=m.parentNode}m=g}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Vs={focusedElem:e,selectionRange:n},qo=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,w=v.memoizedState,p=t.stateNode,c=p.getSnapshotBeforeUpdate(t.elementType===t.type?y:tt(t.type,y),w);p.__reactInternalSnapshotBeforeUpdate=c}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(E(163))}}catch(k){X(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return v=Pa,Pa=!1,v}function Cr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&cl(t,n,i)}o=o.next}while(o!==r)}}function wi(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 dl(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 yf(e){var t=e.alternate;t!==null&&(e.alternate=null,yf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ct],delete t[zr],delete t[Xs],delete t[d0],delete t[f0])),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 Sf(e){return e.tag===5||e.tag===3||e.tag===4}function Ia(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Sf(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 fl(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=Vo));else if(r!==4&&(e=e.child,e!==null))for(fl(e,t,n),e=e.sibling;e!==null;)fl(e,t,n),e=e.sibling}function hl(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(hl(e,t,n),e=e.sibling;e!==null;)hl(e,t,n),e=e.sibling}var ae=null,nt=!1;function Pt(e,t,n){for(n=n.child;n!==null;)wf(e,t,n),n=n.sibling}function wf(e,t,n){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(fi,n)}catch{}switch(n.tag){case 5:me||Rn(n,t);case 6:var r=ae,o=nt;ae=null,Pt(e,t,n),ae=r,nt=o,ae!==null&&(nt?(e=ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ae.removeChild(n.stateNode));break;case 18:ae!==null&&(nt?(e=ae,n=n.stateNode,e.nodeType===8?os(e.parentNode,n):e.nodeType===1&&os(e,n),Nr(e)):os(ae,n.stateNode));break;case 4:r=ae,o=nt,ae=n.stateNode.containerInfo,nt=!0,Pt(e,t,n),ae=r,nt=o;break;case 0:case 11:case 14:case 15:if(!me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&cl(n,t,s),o=o.next}while(o!==r)}Pt(e,t,n);break;case 1:if(!me&&(Rn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){X(n,t,l)}Pt(e,t,n);break;case 21:Pt(e,t,n);break;case 22:n.mode&1?(me=(r=me)||n.memoizedState!==null,Pt(e,t,n),me=r):Pt(e,t,n);break;default:Pt(e,t,n)}}function ja(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new D0),t.forEach(function(r){var o=z0.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function et(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*j0(r/1960))-r,10e?16:e,$t===null)var r=!1;else{if(e=$t,$t=null,li=0,$&6)throw Error(E(331));var o=$;for($|=4,P=e.current;P!==null;){var i=P,s=i.child;if(P.flags&16){var l=i.deletions;if(l!==null){for(var u=0;uJ()-cu?an(e,0):au|=n),Te(e,t)}function Df(e,t){t===0&&(e.mode&1?(t=ao,ao<<=1,!(ao&130023424)&&(ao=4194304)):t=1);var n=we();e=kt(e,t),e!==null&&(Gr(e,t,n),Te(e,n))}function b0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Df(e,n)}function z0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(E(314))}r!==null&&r.delete(t),Df(e,n)}var Pf;Pf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_e.current)xe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return xe=!1,_0(e,t,n);xe=!!(e.flags&131072)}else xe=!1,Q&&t.flags&1048576&&jd(t,Jo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Mo(e,t),e=t.pendingProps;var o=Wn(t,ve.current);Un(t,n),o=ru(null,t,r,e,o,n);var i=ou();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oe(r)?(i=!0,Yo(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Jl(t),o.updater=yi,t.stateNode=o,o._reactInternals=t,rl(t,r,e,n),t=sl(null,t,r,!0,i,n)):(t.tag=0,Q&&i&&ql(t),Se(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Mo(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=F0(r),e=tt(r,e),o){case 0:t=il(null,t,r,e,n);break e;case 1:t=Oa(null,t,r,e,n);break e;case 11:t=xa(null,t,r,e,n);break e;case 14:t=_a(null,t,r,tt(r.type,e),n);break e}throw Error(E(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:tt(r,o),il(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:tt(r,o),Oa(e,t,r,o,n);case 3:e:{if(ff(t),e===null)throw Error(E(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Rd(e,t),ti(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Vn(Error(E(423)),t),t=Ta(e,t,r,n,o);break e}else if(r!==o){o=Vn(Error(E(424)),t),t=Ta(e,t,r,n,o);break e}else for(Ne=Bt(t.stateNode.containerInfo.firstChild),Me=t,Q=!0,rt=null,n=$d(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qn(),r===o){t=Et(e,t,n);break e}Se(e,t,r,n)}t=t.child}return t;case 5:return Fd(t),e===null&&el(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Gs(r,o)?s=null:i!==null&&Gs(r,i)&&(t.flags|=32),df(e,t),Se(e,t,s,n),t.child;case 6:return e===null&&el(t),null;case 13:return hf(e,t,n);case 4:return Zl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qn(t,null,r,n):Se(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:tt(r,o),xa(e,t,r,o,n);case 7:return Se(e,t,t.pendingProps,n),t.child;case 8:return Se(e,t,t.pendingProps.children,n),t.child;case 12:return Se(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,H(Zo,r._currentValue),r._currentValue=s,i!==null)if(st(i.value,s)){if(i.children===o.children&&!_e.current){t=Et(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=yt(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var h=a.pending;h===null?u.next=u:(u.next=h.next,h.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),tl(i.return,n,t),l.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(E(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),tl(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Se(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Un(t,n),o=Ge(o),r=r(o),t.flags|=1,Se(e,t,r,n),t.child;case 14:return r=t.type,o=tt(r,t.pendingProps),o=tt(r.type,o),_a(e,t,r,o,n);case 15:return af(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:tt(r,o),Mo(e,t),t.tag=1,Oe(r)?(e=!0,Yo(t)):e=!1,Un(t,n),bd(t,r,o),rl(t,r,o,n),sl(null,t,r,!0,e,n);case 19:return pf(e,t,n);case 22:return cf(e,t,n)}throw Error(E(156,t.tag))};function If(e,t){return td(e,t)}function $0(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 Ke(e,t,n,r){return new $0(e,t,n,r)}function pu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function F0(e){if(typeof e=="function")return pu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Nl)return 11;if(e===Ml)return 14}return 2}function Kt(e,t){var n=e.alternate;return n===null?(n=Ke(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 bo(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")pu(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case On:return cn(n.children,o,i,t);case Ll:s=8,o|=8;break;case Ts:return e=Ke(12,n,t,o|2),e.elementType=Ts,e.lanes=i,e;case Ds:return e=Ke(13,n,t,o),e.elementType=Ds,e.lanes=i,e;case Ps:return e=Ke(19,n,t,o),e.elementType=Ps,e.lanes=i,e;case zc:return Ei(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ac:s=10;break e;case bc:s=9;break e;case Nl:s=11;break e;case Ml:s=14;break e;case Lt:s=16,r=null;break e}throw Error(E(130,e==null?e:typeof e,""))}return t=Ke(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function cn(e,t,n,r){return e=Ke(7,e,r,t),e.lanes=n,e}function Ei(e,t,n,r){return e=Ke(22,e,r,t),e.elementType=zc,e.lanes=n,e.stateNode={isHidden:!1},e}function fs(e,t,n){return e=Ke(6,e,null,t),e.lanes=n,e}function hs(e,t,n){return t=Ke(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function U0(e,t,n,r,o){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=Ki(0),this.expirationTimes=Ki(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ki(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function gu(e,t,n,r,o,i,s,l,u){return e=new U0(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ke(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jl(i),e}function H0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mf)}catch(e){console.error(e)}}Mf(),jc.exports=Ae;var K0=jc.exports,$a=K0;_s.createRoot=$a.createRoot,_s.hydrateRoot=$a.hydrateRoot;/** - * @license - * Copyright (c) 2023, Jeff Hlywa (jhlywa@gmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */const ge="w",Be="b",oe="p",yl="n",zo="b",mr="r",Mt="q",ie="k",ps="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",Ie=-1,V0={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},N={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},A={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},gs={b:[16,32,17,15],w:[-16,-32,-17,-15]},Fa={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},G0=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],Y0=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],X0={p:1,n:2,b:4,r:8,q:16,k:32},J0="pnbrqkPNBRQK",Ua=[yl,zo,mr,Mt],Z0=7,eg=6,tg=1,ng=0,Eo={[ie]:N.KSIDE_CASTLE,[Mt]:N.QSIDE_CASTLE},It={w:[{square:A.a1,flag:N.QSIDE_CASTLE},{square:A.h1,flag:N.KSIDE_CASTLE}],b:[{square:A.a8,flag:N.QSIDE_CASTLE},{square:A.h8,flag:N.KSIDE_CASTLE}]},rg={b:tg,w:eg},og=["1-0","0-1","1/2-1/2","*"];function dn(e){return e>>4}function qr(e){return e&15}function Rf(e){return"0123456789".indexOf(e)!==-1}function je(e){const t=qr(e),n=dn(e);return"abcdefgh".substring(t,t+1)+"87654321".substring(n,n+1)}function ar(e){return e===ge?Be:ge}function ig(e){const t=e.split(/\s+/);if(t.length!==6)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};const n=parseInt(t[5],10);if(isNaN(n)||n<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};const r=parseInt(t[4],10);if(isNaN(r)||r<0)return{ok:!1,error:"Invalid FEN: half move counter number must be a non-negative integer"};if(!/^(-|[abcdefgh][36])$/.test(t[3]))return{ok:!1,error:"Invalid FEN: en-passant square is invalid"};if(/[^kKqQ-]/.test(t[2]))return{ok:!1,error:"Invalid FEN: castling availability is invalid"};if(!/^(w|b)$/.test(t[1]))return{ok:!1,error:"Invalid FEN: side-to-move is invalid"};const o=t[0].split("/");if(o.length!==8)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let s=0;s1)return{ok:!1,error:`Invalid FEN: too many ${s} kings`}}return{ok:!0}}function sg(e,t){const n=e.from,r=e.to,o=e.piece;let i=0,s=0,l=0;for(let u=0,a=t.length;u0?s>0&&l>0?je(n):l>0?je(n).charAt(1):je(n).charAt(0):""}function jt(e,t,n,r,o,i=void 0,s=N.NORMAL){const l=dn(r);if(o===oe&&(l===Z0||l===ng))for(let u=0;u="a"&&t<="h"?e.match(/[a-h]\d.*[a-h]\d/)?void 0:oe:(t=t.toLowerCase(),t==="o"?ie:t)}function ms(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}class lg{constructor(t=ps){Ze(this,"_board",new Array(128));Ze(this,"_turn",ge);Ze(this,"_header",{});Ze(this,"_kings",{w:Ie,b:Ie});Ze(this,"_epSquare",-1);Ze(this,"_halfMoves",0);Ze(this,"_moveNumber",0);Ze(this,"_history",[]);Ze(this,"_comments",{});Ze(this,"_castling",{w:0,b:0});this.load(t)}clear(t=!1){this._board=new Array(128),this._kings={w:Ie,b:Ie},this._turn=ge,this._castling={w:0,b:0},this._epSquare=Ie,this._halfMoves=0,this._moveNumber=1,this._history=[],this._comments={},this._header=t?this._header:{},this._updateSetup(this.fen())}removeHeader(t){t in this._header&&delete this._header[t]}load(t,n=!1){let r=t.split(/\s+/);if(r.length>=2&&r.length<6){const u=["-","-","0","1"];t=r.concat(u.slice(-(6-r.length))).join(" ")}r=t.split(/\s+/);const{ok:o,error:i}=ig(t);if(!o)throw new Error(i);const s=r[0];let l=0;this.clear(n);for(let u=0;u-1&&(this._castling.w|=N.KSIDE_CASTLE),r[2].indexOf("Q")>-1&&(this._castling.w|=N.QSIDE_CASTLE),r[2].indexOf("k")>-1&&(this._castling.b|=N.KSIDE_CASTLE),r[2].indexOf("q")>-1&&(this._castling.b|=N.QSIDE_CASTLE),this._epSquare=r[3]==="-"?Ie:A[r[3]],this._halfMoves=parseInt(r[4],10),this._moveNumber=parseInt(r[5],10),this._updateSetup(this.fen())}fen(){var i,s;let t=0,n="";for(let l=A.a8;l<=A.h1;l++){if(this._board[l]){t>0&&(n+=t,t=0);const{color:u,type:a}=this._board[l];n+=u===ge?a.toUpperCase():a.toLowerCase()}else t++;l+1&136&&(t>0&&(n+=t),l!==A.h1&&(n+="/"),t=0,l+=8)}let r="";this._castling[ge]&N.KSIDE_CASTLE&&(r+="K"),this._castling[ge]&N.QSIDE_CASTLE&&(r+="Q"),this._castling[Be]&N.KSIDE_CASTLE&&(r+="k"),this._castling[Be]&N.QSIDE_CASTLE&&(r+="q"),r=r||"-";let o="-";if(this._epSquare!==Ie){const l=this._epSquare+(this._turn===ge?16:-16),u=[l+1,l-1];for(const a of u){if(a&136)continue;const h=this._turn;if(((i=this._board[a])==null?void 0:i.color)===h&&((s=this._board[a])==null?void 0:s.type)===oe){this._makeMove({color:h,from:a,to:this._epSquare,piece:oe,captured:oe,flags:N.EP_CAPTURE});const m=!this._isKingAttacked(h);if(this._undoMove(),m){o=je(this._epSquare);break}}}}return[n,this._turn,r,o,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(t){this._history.length>0||(t!==ps?(this._header.SetUp="1",this._header.FEN=t):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load(ps)}get(t){return this._board[A[t]]||!1}put({type:t,color:n},r){if(J0.indexOf(t.toLowerCase())===-1||!(r in A))return!1;const o=A[r];return t==ie&&!(this._kings[n]==Ie||this._kings[n]==o)?!1:(this._board[o]={type:t,color:n},t===ie&&(this._kings[n]=o),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0)}remove(t){const n=this.get(t);return delete this._board[A[t]],n&&n.type===ie&&(this._kings[n.color]=Ie),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),n}_updateCastlingRights(){var r,o,i,s,l,u,a,h,m,d,g,v;const t=((r=this._board[A.e1])==null?void 0:r.type)===ie&&((o=this._board[A.e1])==null?void 0:o.color)===ge,n=((i=this._board[A.e8])==null?void 0:i.type)===ie&&((s=this._board[A.e8])==null?void 0:s.color)===Be;(!t||((l=this._board[A.a1])==null?void 0:l.type)!==mr||((u=this._board[A.a1])==null?void 0:u.color)!==ge)&&(this._castling.w&=~N.QSIDE_CASTLE),(!t||((a=this._board[A.h1])==null?void 0:a.type)!==mr||((h=this._board[A.h1])==null?void 0:h.color)!==ge)&&(this._castling.w&=~N.KSIDE_CASTLE),(!n||((m=this._board[A.a8])==null?void 0:m.type)!==mr||((d=this._board[A.a8])==null?void 0:d.color)!==Be)&&(this._castling.b&=~N.QSIDE_CASTLE),(!n||((g=this._board[A.h8])==null?void 0:g.type)!==mr||((v=this._board[A.h8])==null?void 0:v.color)!==Be)&&(this._castling.b&=~N.KSIDE_CASTLE)}_updateEnPassantSquare(){var i,s;if(this._epSquare===Ie)return;const t=this._epSquare+(this._turn===ge?-16:16),n=this._epSquare+(this._turn===ge?16:-16),r=[n+1,n-1];if(this._board[t]!==null||this._board[this._epSquare]!==null||((i=this._board[n])==null?void 0:i.color)!==ar(this._turn)||((s=this._board[n])==null?void 0:s.type)!==oe){this._epSquare=Ie;return}const o=l=>{var u,a;return!(l&136)&&((u=this._board[l])==null?void 0:u.color)===this._turn&&((a=this._board[l])==null?void 0:a.type)===oe};r.some(o)||(this._epSquare=Ie)}_attacked(t,n){for(let r=A.a8;r<=A.h1;r++){if(r&136){r+=7;continue}if(this._board[r]===void 0||this._board[r].color!==t)continue;const o=this._board[r],i=r-n;if(i===0)continue;const s=i+119;if(G0[s]&X0[o.type]){if(o.type===oe){if(i>0){if(o.color===ge)return!0}else if(o.color===Be)return!0;continue}if(o.type==="n"||o.type==="k")return!0;const l=Y0[s];let u=r+l,a=!1;for(;u!==n;){if(this._board[u]!=null){a=!0;break}u+=l}if(!a)return!0}}return!1}_isKingAttacked(t){const n=this._kings[t];return n===-1?!1:this._attacked(ar(t),n)}isAttacked(t,n){return this._attacked(n,A[t])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&this._moves().length===0}isStalemate(){return!this.isCheck()&&this._moves().length===0}isInsufficientMaterial(){const t={b:0,n:0,r:0,q:0,k:0,p:0},n=[];let r=0,o=0;for(let i=A.a8;i<=A.h1;i++){if(o=(o+1)%2,i&136){i+=7;continue}const s=this._board[i];s&&(t[s.type]=s.type in t?t[s.type]+1:1,s.type===zo&&n.push(o),r++)}if(r===2)return!0;if(r===3&&(t[zo]===1||t[yl]===1))return!0;if(r===t[zo]+2){let i=0;const s=n.length;for(let l=0;l=3&&(r=!0);const i=t.pop();if(i)this._makeMove(i);else break}return r}isDraw(){return this._halfMoves>=100||this.isStalemate()||this.isInsufficientMaterial()||this.isThreefoldRepetition()}isGameOver(){return this.isCheckmate()||this.isStalemate()||this.isDraw()}moves({verbose:t=!1,square:n=void 0,piece:r=void 0}={}){const o=this._moves({square:n,piece:r});return t?o.map(i=>this._makePretty(i)):o.map(i=>this._moveToSan(i,o))}_moves({legal:t=!0,piece:n=void 0,square:r=void 0}={}){var g;const o=r?r.toLowerCase():void 0,i=n==null?void 0:n.toLowerCase(),s=[],l=this._turn,u=ar(l);let a=A.a8,h=A.h1,m=!1;if(o)if(o in A)a=h=A[o],m=!0;else return[];for(let v=a;v<=h;v++){if(v&136){v+=7;continue}if(!this._board[v]||this._board[v].color===u)continue;const{type:y}=this._board[v];let w;if(y===oe){if(i&&i!==y)continue;w=v+gs[l][0],this._board[w]||(jt(s,l,v,w,oe),w=v+gs[l][1],rg[l]===dn(v)&&!this._board[w]&&jt(s,l,v,w,oe,void 0,N.BIG_PAWN));for(let p=2;p<4;p++)w=v+gs[l][p],!(w&136)&&(((g=this._board[w])==null?void 0:g.color)===u?jt(s,l,v,w,oe,this._board[w].type,N.CAPTURE):w===this._epSquare&&jt(s,l,v,w,oe,oe,N.EP_CAPTURE))}else{if(i&&i!==y)continue;for(let p=0,c=Fa[y].length;p{const g=this._comments[this.fen()];if(typeof g<"u"){const v=d.length>0?" ":"";d=`${d}${v}{${g}}`}return d},s=[];for(;this._history.length>0;)s.push(this._undoMove());const l=[];let u="";for(s.length===0&&l.push(i(""));s.length>0;){u=i(u);const d=s.pop();if(!d)break;if(!this._history.length&&d.color==="b"){const g=`${this._moveNumber}. ...`;u=u?`${u} ${g}`:g}else d.color==="w"&&(u.length&&l.push(u),u=this._moveNumber+".");u=u+" "+this._moveToSan(d,this._moves({legal:!0})),this._makeMove(d)}if(u.length&&l.push(i(u)),typeof this._header.Result<"u"&&l.push(this._header.Result),n===0)return r.join("")+l.join(" ");const a=function(){return r.length>0&&r[r.length-1]===" "?(r.pop(),!0):!1},h=function(d,g){for(const v of g.split(" "))if(v){if(d+v.length>n){for(;a();)d--;r.push(t),d=0}r.push(v),d+=v.length,r.push(" "),d++}return a()&&d--,d};let m=0;for(let d=0;dn&&l[d].includes("{")){m=h(m,l[d]);continue}m+l[d].length>n&&d!==0?(r[r.length-1]===" "&&r.pop(),r.push(t),m=0):d!==0&&(r.push(" "),m++),r.push(l[d]),m+=l[d].length}return r.join("")}header(...t){for(let n=0;n0&&(k[_]=O)}return k}t=t.trim();const l=new RegExp("^(\\[((?:"+o(r)+")|.)*\\])((?:\\s*"+o(r)+"){2}|(?:\\s*"+o(r)+")*$)").exec(t),u=l&&l.length>=2?l[1]:"";this.reset();const a=i(u);let h="";for(const f in a)f.toLowerCase()==="fen"&&(h=a[f]),this.header(f,a[f]);if(!n)h&&this.load(h,!0);else if(a.SetUp==="1"){if(!("FEN"in a))throw new Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(a.FEN,!0)}function m(f){return Array.from(f).map(function(k){return k.charCodeAt(0)<128?k.charCodeAt(0).toString(16):encodeURIComponent(k).replace(/%/g,"").toLowerCase()}).join("")}function d(f){return f.length==0?"":decodeURIComponent("%"+(f.match(/.{1,2}/g)||[]).join("%"))}const g=function(f){return f=f.replace(new RegExp(o(r),"g")," "),`{${m(f.slice(1,f.length-1))}}`},v=function(f){if(f.startsWith("{")&&f.endsWith("}"))return d(f.slice(1,f.length-1))};let y=t.replace(u,"").replace(new RegExp(`({[^}]*})+?|;([^${o(r)}]*)`,"g"),function(f,k,x){return k!==void 0?g(k):" "+g(`{${x.slice(1)}}`)}).replace(new RegExp(o(r),"g")," ");const w=/(\([^()]+\))+?/g;for(;w.test(y);)y=y.replace(w,"");y=y.replace(/\d+\.(\.\.)?/g,""),y=y.replace(/\.\.\./g,""),y=y.replace(/\$\d+/g,"");let p=y.trim().split(new RegExp(/\s+/));p=p.filter(f=>f!=="");let c="";for(let f=0;f-1)c=p[f];else throw new Error(`Invalid move in PGN: ${p[f]}`);else c="",this._makeMove(x)}c&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",c)}_moveToSan(t,n){let r="";if(t.flags&N.KSIDE_CASTLE)r="O-O";else if(t.flags&N.QSIDE_CASTLE)r="O-O-O";else{if(t.piece!==oe){const o=sg(t,n);r+=t.piece.toUpperCase()+o}t.flags&(N.CAPTURE|N.EP_CAPTURE)&&(t.piece===oe&&(r+=je(t.from)[0]),r+="x"),r+=je(t.to),t.promotion&&(r+="="+t.promotion.toUpperCase())}return this._makeMove(t),this.isCheck()&&(this.isCheckmate()?r+="#":r+="+"),this._undoMove(),r}_moveFromSan(t,n=!1){const r=ms(t);let o=Ha(r),i=this._moves({legal:!0,piece:o});for(let d=0,g=i.length;d0?r+=this.perft(t-1):r++),this._undoMove();return r}_makePretty(t){const{color:n,piece:r,from:o,to:i,flags:s,captured:l,promotion:u}=t;let a="";for(const g in N)N[g]&s&&(a+=V0[g]);const h=je(o),m=je(i),d={color:n,piece:r,from:h,to:m,san:this._moveToSan(t,this._moves({legal:!0})),flags:a,lan:h+m,before:this.fen(),after:""};return this._makeMove(t),d.after=this.fen(),this._undoMove(),l&&(d.captured=l),u&&(d.promotion=u,d.lan+=u),d}turn(){return this._turn}board(){const t=[];let n=[];for(let r=A.a8;r<=A.h1;r++)this._board[r]==null?n.push(null):n.push({square:je(r),type:this._board[r].type,color:this._board[r].color}),r+1&136&&(t.push(n),n=[],r+=8);return t}squareColor(t){if(t in A){const n=A[t];return(dn(n)+qr(n))%2===0?"light":"dark"}return null}history({verbose:t=!1}={}){const n=[],r=[];for(;this._history.length>0;)n.push(this._undoMove());for(;;){const o=n.pop();if(!o)break;t?r.push(this._makePretty(o)):r.push(this._moveToSan(o,this._moves())),this._makeMove(o)}return r}_pruneComments(){const t=[],n={},r=o=>{o in this._comments&&(n[o]=this._comments[o])};for(;this._history.length>0;)t.push(this._undoMove());for(r(this.fen());;){const o=t.pop();if(!o)break;this._makeMove(o),r(this.fen())}this._comments=n}getComment(){return this._comments[this.fen()]}setComment(t){this._comments[this.fen()]=t.replace("{","[").replace("}","]")}deleteComment(){const t=this._comments[this.fen()];return delete this._comments[this.fen()],t}getComments(){return this._pruneComments(),Object.keys(this._comments).map(t=>({fen:t,comment:this._comments[t]}))}deleteComments(){return this._pruneComments(),Object.keys(this._comments).map(t=>{const n=this._comments[t];return delete this._comments[t],{fen:t,comment:n}})}setCastlingRights(t,n){for(const o of[ie,Mt])n[o]!==void 0&&(n[o]?this._castling[t]|=Eo[o]:this._castling[t]&=~Eo[o]);this._updateCastlingRights();const r=this.getCastlingRights(t);return(n[ie]===void 0||n[ie]===r[ie])&&(n[Mt]===void 0||n[Mt]===r[Mt])}getCastlingRights(t){return{[ie]:(this._castling[t]&Eo[ie])!==0,[Mt]:(this._castling[t]&Eo[Mt])!==0}}moveNumber(){return this._moveNumber}}const Af=C.createContext({dragDropManager:void 0});function He(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Ba=typeof Symbol=="function"&&Symbol.observable||"@@observable",vs=function(){return Math.random().toString(36).substring(7).split("").join(".")},Wa={INIT:"@@redux/INIT"+vs(),REPLACE:"@@redux/REPLACE"+vs(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vs()}};function bf(e,t,n){var r;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(He(0));if(typeof t=="function"&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!="function")throw new Error(He(1));return n(bf)(e,t)}if(typeof e!="function")throw new Error(He(2));var o=e,i=t,s=[],l=s,u=!1;function a(){l===s&&(l=s.slice())}function h(){if(u)throw new Error(He(3));return i}function m(g){if(typeof g!="function")throw new Error(He(4));if(u)throw new Error(He(5));var v=!0;return a(),l.push(g),function(){if(v){if(u)throw new Error(He(6));v=!1,a();var y=l.indexOf(g);l.splice(y,1),s=null}}}function d(g){if(!function(w){if(typeof w!="object"||w===null)return!1;for(var p=w;Object.getPrototypeOf(p)!==null;)p=Object.getPrototypeOf(p);return Object.getPrototypeOf(w)===p}(g))throw new Error(He(7));if(g.type===void 0)throw new Error(He(8));if(u)throw new Error(He(9));try{u=!0,i=o(i,g)}finally{u=!1}for(var v=s=l,y=0;y=0;y--)if(g.canDragSource(d[y])){v=d[y];break}return v}(t,s);if(u==null)return void e.dispatch(ug);let a=null;if(o){if(!i)throw new Error("getSourceClientOffset must be defined");(function(d){M(typeof d=="function","When clientOffset is provided, getSourceClientOffset must be a function.")})(i),a=i(u)}e.dispatch(qa(o,a));const h=l.getSource(u).beginDrag(s,u);if(h==null)return;(function(d){M(zf(d),"Item must be an object.")})(h),l.pinSource(u);const m=l.getSourceType(u);return{type:wu,payload:{itemType:m,item:h,sourceId:u,clientOffset:o||null,sourceClientOffset:a||null,isSourcePublic:!!r}}}}function cg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dg(e){for(var t=1;t{const l=function(a,h,m,d){const g=m.getTarget(a);let v=g?g.drop(d,a):void 0;return function(y){M(y===void 0||zf(y),"Drop result must either be an object or undefined.")}(v),v===void 0&&(v=h===0?{}:d.getDropResult()),v}(i,s,r,n),u={type:ku,payload:{dropResult:dg({},t,l)}};e.dispatch(u)})}}function hg(e){return function(){const t=e.getMonitor(),n=e.getRegistry();(function(o){M(o.isDragging(),"Cannot call endDrag while not dragging.")})(t);const r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Eu}}}function Sl(e,t){return t===null?e===null:Array.isArray(e)?e.some(n=>n===t):e===t}function pg(e){return function(t,{clientOffset:n}={}){(function(s){M(Array.isArray(s),"Expected targetIds to be an array.")})(t);const r=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(s,l,u){for(let a=s.length-1;a>=0;a--){const h=s[a];Sl(l.getTargetType(h),u)||s.splice(a,1)}}(r,i,o.getItemType()),function(s,l,u){M(l.isDragging(),"Cannot call hover while not dragging."),M(!l.didDrop(),"Cannot call hover after drop.");for(let a=0;a{const s=r[i];var l;return o[i]=(l=s,(...u)=>{const a=l.apply(t,u);a!==void 0&&n(a)}),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,n){this.isSetUp=!1,this.handleRefCountChange=()=>{const r=this.store.getState().refCount>0;this.backend&&(r&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!r&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}}function Qa(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Or=[],Cu=[];Or.__IS_NONE__=!0,Cu.__IS_ALL__=!0;class vg{subscribeToStateChange(t,n={}){const{handlerIds:r}=n;M(typeof t=="function","listener must be a function."),M(r===void 0||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let o=this.store.getState().stateId;return this.store.subscribe(()=>{const i=this.store.getState(),s=i.stateId;try{s===o||s===o+1&&!function(u,a){return u!==Or&&(u===Cu||a===void 0||(h=u,a.filter(m=>h.indexOf(m)>-1)).length>0);var h}(i.dirtyHandlerIds,r)||t()}finally{o=s}})}subscribeToOffsetChange(t){M(typeof t=="function","listener must be a function.");let n=this.store.getState().dragOffset;return this.store.subscribe(()=>{const r=this.store.getState().dragOffset;r!==n&&(n=r,t())})}canDragSource(t){if(!t)return!1;const n=this.registry.getSource(t);return M(n,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()&&n.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const n=this.registry.getTarget(t);return M(n,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop()?!1:Sl(this.registry.getTargetType(t),this.getItemType())&&n.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const n=this.registry.getSource(t,!0);return M(n,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic()?!1:this.registry.getSourceType(t)===this.getItemType()&&n.isDragging(this,t)}isOverTarget(t,n={shallow:!1}){if(!t)return!1;const{shallow:r}=n;if(!this.isDragging())return!1;const o=this.registry.getTargetType(t),i=this.getItemType();if(i&&!Sl(o,i))return!1;const s=this.getTargetIds();if(!s.length)return!1;const l=s.indexOf(t);return r?l===s.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(t){const{clientOffset:n,initialClientOffset:r,initialSourceClientOffset:o}=t;return n&&r&&o?Qa((s=o,{x:(i=n).x+s.x,y:i.y+s.y}),r):null;var i,s}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(t){const{clientOffset:n,initialClientOffset:r}=t;return n&&r?Qa(n,r):null}(this.store.getState().dragOffset)}constructor(t,n){this.store=t,this.registry=n}}const Ka=typeof global<"u"?global:self,Va=Ka.MutationObserver||Ka.WebKitMutationObserver;function Ff(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const yg=typeof Va=="function"?function(e){let t=1;const n=new Va(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:Ff;class Sg{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}const Uf=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.indexthis.capacity){for(let n=0,r=e.length-this.index;n{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=yg(this.flush),this.requestErrorThrow=Ff(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},wg=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new Sg(this.onError,r=>t[t.length]=r);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(Uf.registerPendingError),xu="dnd-core/ADD_SOURCE",_u="dnd-core/ADD_TARGET",Ou="dnd-core/REMOVE_SOURCE",Di="dnd-core/REMOVE_TARGET";function wl(e,t){t&&Array.isArray(e)?e.forEach(n=>wl(n,!1)):M(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var Qe;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Qe||(Qe={}));let kg=0;function Eg(e){const t=(kg++).toString();switch(e){case Qe.SOURCE:return`S${t}`;case Qe.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function Ga(e){switch(e[0]){case"S":return Qe.SOURCE;case"T":return Qe.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Ya(e,t){const n=e.entries();let r=!1;do{const{done:o,value:[,i]}=n.next();if(i===t)return!0;r=!!o}while(!r);return!1}class Cg{addSource(t,n){wl(t),function(o){M(typeof o.canDrag=="function","Expected canDrag to be a function."),M(typeof o.beginDrag=="function","Expected beginDrag to be a function."),M(typeof o.endDrag=="function","Expected endDrag to be a function.")}(n);const r=this.addHandler(Qe.SOURCE,t,n);return this.store.dispatch(function(o){return{type:xu,payload:{sourceId:o}}}(r)),r}addTarget(t,n){wl(t,!0),function(o){M(typeof o.canDrop=="function","Expected canDrop to be a function."),M(typeof o.hover=="function","Expected hover to be a function."),M(typeof o.drop=="function","Expected beginDrag to be a function.")}(n);const r=this.addHandler(Qe.TARGET,t,n);return this.store.dispatch(function(o){return{type:_u,payload:{targetId:o}}}(r)),r}containsHandler(t){return Ya(this.dragSources,t)||Ya(this.dropTargets,t)}getSource(t,n=!1){return M(this.isSourceId(t),"Expected a valid source ID."),n&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return M(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return M(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return M(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Ga(t)===Qe.SOURCE}isTargetId(t){return Ga(t)===Qe.TARGET}removeSource(t){var n;M(this.getSource(t),"Expected an existing source."),this.store.dispatch(function(r){return{type:Ou,payload:{sourceId:r}}}(t)),n=()=>{this.dragSources.delete(t),this.types.delete(t)},Uf.enqueueTask(wg.create(n))}removeTarget(t){M(this.getTarget(t),"Expected an existing target."),this.store.dispatch(function(n){return{type:Di,payload:{targetId:n}}}(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const n=this.getSource(t);M(n,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=n}unpinSource(){M(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,n,r){const o=Eg(t);return this.types.set(o,n),t===Qe.SOURCE?this.dragSources.set(o,r):t===Qe.TARGET&&this.dropTargets.set(o,r),o}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const xg=(e,t)=>e===t;function _g(e=Or,t){switch(t.type){case Ti:break;case xu:case _u:case Di:case Ou:return Or;default:return Cu}const{targetIds:n=[],prevTargetIds:r=[]}=t.payload,o=function(l,u){const a=new Map,h=d=>{a.set(d,a.has(d)?a.get(d)+1:1)};l.forEach(h),u.forEach(h);const m=[];return a.forEach((d,g)=>{d===1&&m.push(g)}),m}(n,r);if(!(o.length>0||!function(l,u,a=xg){if(l.length!==u.length)return!1;for(let h=0;hi!==o))});case ku:return xn({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Eu:return xn({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var r,o}function jg(e=0,t){switch(t.type){case xu:case _u:return e+1;case Ou:case Di:return e-1;default:return e}}function Lg(e=0){return e+1}function Ng(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mg(e){for(var t=1;ti&&i[s]?i[s]:o||null,n))})}),dragOffset:Tg(e.dragOffset,t),refCount:jg(e.refCount,t),dragOperation:Ig(e.dragOperation,t),stateId:Lg(e.stateId)};var n,r,o}function Ag(e,t=void 0,n={},r=!1){const o=function(u){const a=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return bf(Rg,u&&a&&a({name:"dnd-core",instanceId:"dnd-core"}))}(r),i=new vg(o,new Cg(o)),s=new mg(o,i),l=e(s,t,n);return s.receiveBackend(l),s}function bg(e,t){if(e==null)return{};var n,r,o=function(s,l){if(s==null)return{};var u,a,h={},m=Object.keys(s);for(a=0;a=0||(h[u]=s[u]);return h}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}let Ja=0;const Co=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var zg=C.memo(function(e){var{children:t}=e,n=bg(e,["children"]);const[r,o]=function(i){if("manager"in i)return[{dragDropManager:i.manager},!1];const s=function(u,a=Za(),h,m){const d=a;return d[Co]||(d[Co]={dragDropManager:Ag(u,a,h,m)}),d[Co]}(i.backend,i.context,i.options,i.debugMode),l=!i.context;return[s,l]}(n);return C.useEffect(()=>{if(o){const i=Za();return++Ja,()=>{--Ja==0&&(i[Co]=null)}}},[]),S.jsx(Af.Provider,{value:r,children:t})});function Za(){return typeof global<"u"?global:window}var $g=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;o--!=0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;o--!=0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!=0;){var s=i[o];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n};const vn=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Hf(e,t,n){const[r,o]=C.useState(()=>t(e)),i=C.useCallback(()=>{const s=t(e);$g(r,s)||(o(s),n&&n())},[r,e,n]);return vn(i),[r,i]}function Bf(e,t,n){return function(r,o,i){const[s,l]=Hf(r,o,i);return vn(function(){const u=r.getHandlerId();if(u!=null)return r.subscribeToStateChange(l,{handlerIds:[u]})},[r,l]),s}(t,e||(()=>({})),()=>n.reconnect())}function Wf(e,t){const n=[...t||[]];return t==null&&typeof e!="function"&&n.push(e),C.useMemo(()=>typeof e=="function"?e():e,n)}function Fg(e){return C.useMemo(()=>e.hooks.dragSource(),[e])}function Ug(e){return C.useMemo(()=>e.hooks.dragPreview(),[e])}let ys=!1,Ss=!1;class Hg{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){M(!ys,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ys=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{ys=!1}}isDragging(){if(!this.sourceId)return!1;M(!Ss,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Ss=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ss=!1}}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,n){return this.internalMonitor.isOverTarget(t,n)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let ws=!1;class Bg{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}canDrop(){if(!this.targetId)return!1;M(!ws,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return ws=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ws=!1}}isOver(t){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function kl(e,t,n,r){let o=n?n.call(r,e,t):void 0;if(o!==void 0)return!!o;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let u=0;u{if(!C.isValidElement(t)){const o=t;return e(o,n),o}const r=t;return function(o){if(typeof o.type=="string")return;const i=o.type.displayName||o.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${i} into a
, or turn it into a drag source or a drop target itself.`)}(r),function(o,i){const s=o.ref;return M(typeof s!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),C.cloneElement(o,s?{ref:l=>{ec(s,l),ec(i,l)}}:{ref:i})}(r,n?o=>e(o,n):e)}}function qf(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const o=Wg(r);t[n]=()=>o}}),t}function ec(e,t){typeof e=="function"?e(t):e.current=t}class qg{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return n&&this.disconnectDragSource(),this.handlerId?t?(n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),n):(this.lastConnectedDragSource=t,n):n}reconnectDragPreview(t=!1){const n=this.dragPreview,r=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(n?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions)):this.lastConnectedDragPreview=n)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!kl(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!kl(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=qf({dragSource:(n,r)=>{this.clearDragSource(),this.dragSourceOptions=r||null,El(n)?this.dragSourceRef=n:this.dragSourceNode=n,this.reconnectDragSource()},dragPreview:(n,r)=>{this.clearDragPreview(),this.dragPreviewOptions=r||null,El(n)?this.dragPreviewRef=n:this.dragPreviewNode=n,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class Qg{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const n=this.dropTarget;this.handlerId&&(n?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions)):this.lastConnectedDropTarget=n)}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!kl(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=qf({dropTarget:(n,r)=>{this.clearDropTarget(),this.dropTargetOptions=r,El(n)?this.dropTargetRef=n:this.dropTargetNode=n,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function yn(){const{dragDropManager:e}=C.useContext(Af);return M(e!=null,"Expected drag drop context"),e}class Kg{beginDrag(){const t=this.spec,n=this.monitor;let r=null;return r=typeof t.item=="object"?t.item:typeof t.item=="function"?t.item(n):{},r??null}canDrag(){const t=this.spec,n=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag!="function"||t.canDrag(n)}isDragging(t,n){const r=this.spec,o=this.monitor,{isDragging:i}=r;return i?i(o):n===t.getSourceId()}endDrag(){const t=this.spec,n=this.monitor,r=this.connector,{end:o}=t;o&&o(n.getItem(),n),r.reconnect()}constructor(t,n,r){this.spec=t,this.monitor=n,this.connector=r}}function Vg(e,t,n){const r=yn(),o=function(s,l,u){const a=C.useMemo(()=>new Kg(s,l,u),[l,u]);return C.useEffect(()=>{a.spec=s},[s]),a}(e,t,n),i=function(s){return C.useMemo(()=>{const l=s.type;return M(l!=null,"spec.type must be defined"),l},[s])}(e);vn(function(){if(i!=null){const[s,l]=function(u,a,h){const m=h.getRegistry(),d=m.addSource(u,a);return[d,()=>m.removeSource(d)]}(i,o,r);return t.receiveHandlerId(s),n.receiveHandlerId(s),l}},[r,t,n,o,i])}function Gg(e,t){const n=Wf(e,t);M(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=function(){const i=yn();return C.useMemo(()=>new Hg(i),[i])}(),o=function(i,s){const l=yn(),u=C.useMemo(()=>new qg(l.getBackend()),[l]);return vn(()=>(u.dragSourceOptions=i||null,u.reconnect(),()=>u.disconnectDragSource()),[u,i]),vn(()=>(u.dragPreviewOptions=s||null,u.reconnect(),()=>u.disconnectDragPreview()),[u,s]),u}(n.options,n.previewOptions);return Vg(n,r,o),[Bf(n.collect,r,o),Fg(o),Ug(o)]}function Yg(e){return C.useMemo(()=>e.hooks.dropTarget(),[e])}class Xg{canDrop(){const t=this.spec,n=this.monitor;return!t.canDrop||t.canDrop(n.getItem(),n)}hover(){const t=this.spec,n=this.monitor;t.hover&&t.hover(n.getItem(),n)}drop(){const t=this.spec,n=this.monitor;if(t.drop)return t.drop(n.getItem(),n)}constructor(t,n){this.spec=t,this.monitor=n}}function Jg(e,t,n){const r=yn(),o=function(s,l){const u=C.useMemo(()=>new Xg(s,l),[l]);return C.useEffect(()=>{u.spec=s},[s]),u}(e,t),i=function(s){const{accept:l}=s;return C.useMemo(()=>(M(s.accept!=null,"accept must be defined"),Array.isArray(l)?l:[l]),[l])}(e);vn(function(){const[s,l]=function(u,a,h){const m=h.getRegistry(),d=m.addTarget(u,a);return[d,()=>m.removeTarget(d)]}(i,o,r);return t.receiveHandlerId(s),n.receiveHandlerId(s),l},[r,t,o,n,i.map(s=>s.toString()).join("|")])}function Zg(e,t){const n=Wf(e,t),r=function(){const i=yn();return C.useMemo(()=>new Bg(i),[i])}(),o=function(i){const s=yn(),l=C.useMemo(()=>new Qg(s.getBackend()),[s]);return vn(()=>(l.dropTargetOptions=i||null,l.reconnect(),()=>l.disconnectDropTarget()),[i]),l}(n.options);return Jg(n,r,o),[Bf(n.collect,r,o),Yg(o)]}function Qf(e){let t=null;return()=>(t==null&&(t=e()),t)}class e1{enter(t){const n=this.entered.length;return this.entered=function(r,o){const i=new Set,s=u=>i.add(u);r.forEach(s),o.forEach(s);const l=[];return i.forEach(u=>l.push(u)),l}(this.entered.filter(r=>this.isNodeInDocument(r)&&(!r.contains||r.contains(t))),[t]),n===0&&this.entered.length>0}leave(t){const n=this.entered.length;var r,o;return this.entered=(r=this.entered.filter(this.isNodeInDocument),o=t,r.filter(i=>i!==o)),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class t1{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null)})})}loadDataTransfer(t){if(t){const n={};Object.keys(this.config.exposeProperties).forEach(r=>{const o=this.config.exposeProperties[r];o!=null&&(n[r]={value:o(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,n){return n===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const Kf="__NATIVE_FILE__",Vf="__NATIVE_URL__",Gf="__NATIVE_TEXT__",Yf="__NATIVE_HTML__";var tc=Object.freeze({__proto__:null,FILE:Kf,HTML:Yf,TEXT:Gf,URL:Vf});function ks(e,t,n){const r=t.reduce((o,i)=>o||e.getData(i),"");return r??n}const Cl={[Kf]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Yf]:{exposeProperties:{html:(e,t)=>ks(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[Vf]:{exposeProperties:{urls:(e,t)=>ks(e,t,"").split(` -`),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[Gf]:{exposeProperties:{text:(e,t)=>ks(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Es(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Cl).filter(n=>{const r=Cl[n];return!!(r!=null&&r.matchesTypes)&&r.matchesTypes.some(o=>t.indexOf(o)>-1)})[0]||null}const n1=Qf(()=>/firefox/i.test(navigator.userAgent)),nc=Qf(()=>!!window.safari);class rc{interpolate(t){const{xs:n,ys:r,c1s:o,c2s:i,c3s:s}=this;let l=n.length-1;if(t===n[l])return r[l];let u,a=0,h=s.length-1;for(;a<=h;){u=Math.floor(.5*(a+h));const g=n[u];if(gt))return r[u];h=u-1}}l=Math.max(0,h);const m=t-n[l],d=m*m;return r[l]+o[l]*m+i[l]*d+s[l]*m*d}constructor(t,n){const{length:r}=t,o=[];for(let g=0;gt[g]{let f=new rc([0,.5,1],[a.y,a.y/m*y,a.y+y-m]).interpolate(g);return nc()&&i&&(f+=(window.devicePixelRatio-1)*y),f})()}}let _o;function i1(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oc(e){for(var t=1;t{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,n,r){this.sourceNodes.set(t,n),this.sourceNodeOptions.set(t,r);const o=s=>this.handleDragStart(s,t),i=s=>this.handleSelectStart(s);return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",i),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",i),n.setAttribute("draggable","false")}}connectDropTarget(t,n){const r=s=>this.handleDragEnter(s,t),o=s=>this.handleDragOver(s,t),i=s=>this.handleDrop(s,t);return n.addEventListener("dragenter",r),n.addEventListener("dragover",o),n.addEventListener("drop",i),()=>{n.removeEventListener("dragenter",r),n.removeEventListener("dragover",o),n.removeEventListener("drop",i)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(t);return oc({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId();return oc({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(t)||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(tc).some(n=>tc[n]===t)}beginDragNativeItem(t,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,o){const i=Cl[r];if(!i)throw new Error(`native type ${r} has no configuration`);const s=new t1(i);return s.loadDataTransfer(o),s}(t,n),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t,this.mouseMoveTimeoutTimer=setTimeout(()=>{var n;return(n=this.rootElement)===null||n===void 0?void 0:n.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){var t;return this.currentDragSourceNode=null,this.rootElement&&((t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,n){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}handleDragEnter(t,n){this.dragEnterTargetIds.unshift(n)}handleDragOver(t,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}handleDrop(t,n){this.dropTargetIds.unshift(n)}constructor(t,n,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=o=>{const i=this.sourceNodes.get(o);return i&&Xf(i)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=o=>!!(o&&this.document&&this.document.body&&this.document.body.contains(o)),this.endDragIfSourceWasRemovedFromDOM=()=>{const o=this.currentDragSourceNode;o==null||this.isNodeInDocument(o)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=o=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(o||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=o=>{if(o.defaultPrevented)return;const{dragStartSourceIds:i}=this;this.dragStartSourceIds=null;const s=xo(o);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(i||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:s});const{dataTransfer:l}=o,u=Es(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const h=this.monitor.getSourceId(),m=this.sourceNodes.get(h),d=this.sourcePreviewNodes.get(h)||m;if(d){const{anchorX:g,anchorY:v,offsetX:y,offsetY:w}=this.getCurrentSourcePreviewNodeOptions(),p=o1(m,d,s,{anchorX:g,anchorY:v},{offsetX:y,offsetY:w});l.setDragImage(d,p.x,p.y)}}try{l==null||l.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(o.target);const{captureDraggingState:a}=this.getCurrentSourcePreviewNodeOptions();a?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(u)this.beginDragNativeItem(u);else{if(l&&!l.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=o=>{var i;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&((i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(o.dataTransfer)),!this.enterLeaveCounter.enter(o.target)||this.monitor.isDragging())return;const{dataTransfer:s}=o,l=Es(s);l&&this.beginDragNativeItem(l,s)},this.handleTopDragEnter=o=>{const{dragEnterTargetIds:i}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=o.altKey,i.length>0&&this.actions.hover(i,{clientOffset:xo(o)}),i.some(s=>this.monitor.canDropOnTarget(s))&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=o=>{var i;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&((i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(o.dataTransfer))},this.handleTopDragOver=o=>{const{dragOverTargetIds:i}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return o.preventDefault(),void(o.dataTransfer&&(o.dataTransfer.dropEffect="none"));this.altKeyPressed=o.altKey,this.lastClientOffset=xo(o),this.scheduleHover(i),(i||[]).some(s=>this.monitor.canDropOnTarget(s))?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=o=>{this.isDraggingNativeItem()&&o.preventDefault(),this.enterLeaveCounter.leave(o.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=o=>{var i;this.dropTargetIds=[],this.isDraggingNativeItem()?(o.preventDefault(),(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(o.dataTransfer)):Es(o.dataTransfer)&&o.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=o=>{const{dropTargetIds:i}=this;this.dropTargetIds=[],this.actions.hover(i,{clientOffset:xo(o)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=o=>{const i=o.target;typeof i.dragDrop=="function"&&(i.tagName==="INPUT"||i.tagName==="SELECT"||i.tagName==="TEXTAREA"||i.isContentEditable||(o.preventDefault(),i.dragDrop()))},this.options=new class{get window(){return this.globalContext?this.globalContext:typeof window<"u"?window:void 0}get document(){var o;return!((o=this.globalContext)===null||o===void 0)&&o.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var o;return((o=this.optionsArgs)===null||o===void 0?void 0:o.rootElement)||this.window}constructor(o,i){this.ownerDocument=null,this.globalContext=o,this.optionsArgs=i}}(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new e1(this.isNodeInDocument)}}const l1=function(e,t,n){return new s1(e,t,n)};var Vt;(function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"})(Vt||(Vt={}));class u1{get delay(){var t;return(t=this.args.delay)!==null&&t!==void 0?t:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var t;return(t=this.args.ignoreContextMenu)!==null&&t!==void 0&&t}get enableHoverOutsideTarget(){var t;return(t=this.args.enableHoverOutsideTarget)!==null&&t!==void 0&&t}get enableKeyboardEvents(){var t;return(t=this.args.enableKeyboardEvents)!==null&&t!==void 0&&t}get enableMouseEvents(){var t;return(t=this.args.enableMouseEvents)!==null&&t!==void 0&&t}get enableTouchEvents(){var t;return(t=this.args.enableTouchEvents)===null||t===void 0||t}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var t,n,r,o;return(o=(r=(t=this.args)===null||t===void 0?void 0:t.delayTouchStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&o!==void 0?o:0}get delayMouseStart(){var t,n,r,o;return(o=(r=(t=this.args)===null||t===void 0?void 0:t.delayMouseStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&o!==void 0?o:0}get window(){return this.context&&this.context.window?this.context.window:typeof window<"u"?window:void 0}get document(){var t;return!((t=this.context)===null||t===void 0)&&t.document?this.context.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.args)===null||t===void 0?void 0:t.rootElement)||this.document}constructor(t,n){this.args=t,this.context=n}}const a1=1,c1=0;function Cs(e){return e.button===void 0||e.button===c1}function Jf(e){return!!e.targetTouches}function ci(e,t){return Jf(e)?function(n,r){return n.targetTouches.length===1?ci(n.targetTouches[0]):r&&n.touches.length===1&&n.touches[0].target===r.target?ci(n.touches[0]):void 0}(e,t):{x:e.clientX,y:e.clientY}}const ic=(()=>{let e=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get:()=>(e=!0,!0)}))}catch{}return e})(),cr={[Vt.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Vt.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Vt.keyboard]:{keydown:"keydown"}};class Tr{profile(){var t;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((t=this.dragOverTargetIds)===null||t===void 0?void 0:t.length)||0}}get document(){return this.options.document}setup(){const t=this.options.rootElement;t&&(M(!Tr.isSetUp,"Cannot have two Touch backends at the same time."),Tr.isSetUp=!0,this.addEventListener(t,"start",this.getTopMoveStartHandler()),this.addEventListener(t,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(t,"move",this.handleTopMove),this.addEventListener(t,"move",this.handleTopMoveCapture,!0),this.addEventListener(t,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(t,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(t,"keydown",this.handleCancelOnEscape,!0))}teardown(){const t=this.options.rootElement;t&&(Tr.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(t,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(t,"start",this.handleTopMoveStart),this.removeEventListener(t,"move",this.handleTopMoveCapture,!0),this.removeEventListener(t,"move",this.handleTopMove),this.removeEventListener(t,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(t,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(t,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(t,n,r,o=!1){const i=ic?{capture:o,passive:!1}:o;this.listenerTypes.forEach(function(s){const l=cr[s][n];l&&t.addEventListener(l,r,i)})}removeEventListener(t,n,r,o=!1){const i=ic?{capture:o,passive:!1}:o;this.listenerTypes.forEach(function(s){const l=cr[s][n];l&&t.removeEventListener(l,r,i)})}connectDragSource(t,n){const r=this.handleMoveStart.bind(this,t);return this.sourceNodes.set(t,n),this.addEventListener(n,"start",r),()=>{this.sourceNodes.delete(t),this.removeEventListener(n,"start",r)}}connectDragPreview(t,n,r){return this.sourcePreviewNodeOptions.set(t,r),this.sourcePreviewNodes.set(t,n),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDropTarget(t,n){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const o=i=>{if(!this.document||!r||!this.monitor.isDragging())return;let s;switch(i.type){case cr.mouse.move:s={x:i.clientX,y:i.clientY};break;case cr.touch.move:var l,u;s={x:((l=i.touches[0])===null||l===void 0?void 0:l.clientX)||0,y:((u=i.touches[0])===null||u===void 0?void 0:u.clientY)||0}}const a=s!=null?this.document.elementFromPoint(s.x,s.y):void 0,h=a&&n.contains(a);return a===n||h?this.handleMove(i,t):void 0};return this.addEventListener(this.document.body,"move",o),this.targetNodes.set(t,n),()=>{this.document&&(this.targetNodes.delete(t),this.removeEventListener(this.document.body,"move",o))}}getTopMoveStartHandler(){return this.options.delayTouchStart||this.options.delayMouseStart?this.handleTopMoveStartDelay:this.handleTopMoveStart}installSourceNodeRemovalObserver(t){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=t,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{t&&!t.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),t&&t.parentElement&&this.draggedSourceNodeRemovalObserver.observe(t.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(t,n,r){this.getSourceClientOffset=o=>{const i=this.sourceNodes.get(o);return i&&function(s){const l=s.nodeType===1?s:s.parentElement;if(!l)return;const{top:u,left:a}=l.getBoundingClientRect();return{x:a,y:u}}(i)},this.handleTopMoveStartCapture=o=>{Cs(o)&&(this.moveStartSourceIds=[])},this.handleMoveStart=o=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(o)},this.handleTopMoveStart=o=>{if(!Cs(o))return;const i=ci(o);i&&(Jf(o)&&(this.lastTargetTouchFallback=o.targetTouches[0]),this._mouseClientOffset=i),this.waitingForDelay=!1},this.handleTopMoveStartDelay=o=>{if(!Cs(o))return;const i=o.type===cr.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,o),i),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(o,i)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(i)},this.handleTopMove=o=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:i,dragOverTargetIds:s}=this,l=this.options.enableHoverOutsideTarget,u=ci(o,this.lastTargetTouchFallback);if(!u)return;if(this._isScrolling||!this.monitor.isDragging()&&function(c,f,k,x,_){if(!_)return!1;const O=180*Math.atan2(x-f,k-c)/Math.PI+180;for(let T=0;T<_.length;++T){const j=_[T];if(j&&(j.start==null||O>=j.start)&&(j.end==null||O<=j.end))return!0}return!1}(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,u.x,u.y,this.options.scrollAngleRanges))return void(this._isScrolling=!0);var a,h,m,d;if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&i&&(a=this._mouseClientOffset.x||0,h=this._mouseClientOffset.y||0,m=u.x,d=u.y,Math.sqrt(Math.pow(Math.abs(m-a),2)+Math.pow(Math.abs(d-h),2))>(this.options.touchSlop?this.options.touchSlop:0))&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(i,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const g=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(g),this.actions.publishDragSource(),o.cancelable&&o.preventDefault();const v=(s||[]).map(c=>this.targetNodes.get(c)).filter(c=>!!c),y=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(u.x,u.y,v):this.document.elementsFromPoint(u.x,u.y),w=[];for(const c in y){if(!y.hasOwnProperty(c))continue;let f=y[c];for(f!=null&&w.push(f);f;)f=f.parentElement,f&&w.indexOf(f)===-1&&w.push(f)}const p=w.filter(c=>v.indexOf(c)>-1).map(c=>this._getDropTargetId(c)).filter(c=>!!c).filter((c,f,k)=>k.indexOf(c)===f);if(l)for(const c in this.targetNodes){const f=this.targetNodes.get(c);if(g&&f&&f.contains(g)&&p.indexOf(c)===-1){p.unshift(c);break}}p.reverse(),this.actions.hover(p,{clientOffset:u})},this._getDropTargetId=o=>{const i=this.targetNodes.keys();let s=i.next();for(;s.done===!1;){const l=s.value;if(o===this.targetNodes.get(l))return l;s=i.next()}},this.handleTopMoveEndCapture=o=>{this._isScrolling=!1,this.lastTargetTouchFallback=void 0,function(i){return i.buttons===void 0||(i.buttons&a1)==0}(o)&&(this.monitor.isDragging()&&!this.monitor.didDrop()?(o.cancelable&&o.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()):this.moveStartSourceIds=void 0)},this.handleCancelOnEscape=o=>{o.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new u1(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Vt.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Vt.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Vt.keyboard)}}const d1=function(e,t={},n={}){return new Tr(e,t,n)},Qr="abcdefgh".split(""),$o={a8:"bR",b8:"bN",c8:"bB",d8:"bQ",e8:"bK",f8:"bB",g8:"bN",h8:"bR",a7:"bP",b7:"bP",c7:"bP",d7:"bP",e7:"bP",f7:"bP",g7:"bP",h7:"bP",a2:"wP",b2:"wP",c2:"wP",d2:"wP",e2:"wP",f2:"wP",g2:"wP",h2:"wP",a1:"wR",b1:"wN",c1:"wB",d1:"wQ",e1:"wK",f1:"wB",g1:"wN",h1:"wR"},f1={a:0,b:1,c:2,d:3,e:4,f:5,g:6,h:7},h1={a:7,b:6,c:5,d:4,e:3,f:2,g:1,h:0},p1=[7,6,5,4,3,2,1,0],g1=[0,1,2,3,4,5,6,7],sc={wP:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsx("path",{d:"m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z",style:{opacity:"1",fill:"#ffffff",fillOpacity:"1",fillRule:"nonzero",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}})})),wR:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"#ffffff",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 34,14 L 31,17 L 14,17 L 11,14"}),S.jsx("path",{d:"M 31,17 L 31,29.5 L 14,29.5 L 14,17",style:{strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5"}),S.jsx("path",{d:"M 11,14 L 34,14",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}})]}))})),wN:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18",style:{fill:"#ffffff",stroke:"#000000"}}),S.jsx("path",{d:"M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10",style:{fill:"#ffffff",stroke:"#000000"}}),S.jsx("path",{d:"M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z",transform:"matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)",style:{fill:"#000000",stroke:"#000000"}})]}))})),wB:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillRule:"evenodd",fillOpacity:"1",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsxs("g",Object.assign({style:{fill:"#ffffff",stroke:"#000000",strokeLinecap:"butt"}},{children:[S.jsx("path",{d:"M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"}),S.jsx("path",{d:"M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"}),S.jsx("path",{d:"M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"})]})),S.jsx("path",{d:"M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}})]}))})),wQ:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"#ffffff",stroke:"#000000",strokeWidth:"1.5",strokeLinejoin:"round"}},{children:[S.jsx("path",{d:"M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"}),S.jsx("path",{d:"M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 11,36 11,36 C 9.5,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"}),S.jsx("path",{d:"M 11.5,30 C 15,29 30,29 33.5,30",style:{fill:"none"}}),S.jsx("path",{d:"M 12,33.5 C 18,32.5 27,32.5 33,33.5",style:{fill:"none"}}),S.jsx("circle",{cx:"6",cy:"12",r:"2"}),S.jsx("circle",{cx:"14",cy:"9",r:"2"}),S.jsx("circle",{cx:"22.5",cy:"8",r:"2"}),S.jsx("circle",{cx:"31",cy:"9",r:"2"}),S.jsx("circle",{cx:"39",cy:"12",r:"2"})]}))})),wK:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22.5,11.63 L 22.5,6",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 20,8 L 25,8",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25",style:{fill:"#ffffff",stroke:"#000000",strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37",style:{fill:"#ffffff",stroke:"#000000"}}),S.jsx("path",{d:"M 12.5,30 C 18,27 27,27 32.5,30",style:{fill:"none",stroke:"#000000"}}),S.jsx("path",{d:"M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5",style:{fill:"none",stroke:"#000000"}}),S.jsx("path",{d:"M 12.5,37 C 18,34 27,34 32.5,37",style:{fill:"none",stroke:"#000000"}})]}))})),bP:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsx("path",{d:"m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z",style:{opacity:"1",fill:"#000000",fillOpacity:"1",fillRule:"nonzero",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}})})),bR:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"#000000",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z ",style:{strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12,35.5 L 33,35.5 L 33,35.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 13,31.5 L 32,31.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 14,29.5 L 31,29.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 14,16.5 L 31,16.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 11,14 L 34,14",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}})]}))})),bN:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z",style:{fill:"#ffffff",stroke:"#ffffff"}}),S.jsx("path",{d:"M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z",transform:"matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)",style:{fill:"#ffffff",stroke:"#ffffff"}}),S.jsx("path",{d:"M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z ",style:{fill:"#ffffff",stroke:"none"}})]}))})),bB:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillRule:"evenodd",fillOpacity:"1",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsxs("g",Object.assign({style:{fill:"#000000",stroke:"#000000",strokeLinecap:"butt"}},{children:[S.jsx("path",{d:"M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"}),S.jsx("path",{d:"M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"}),S.jsx("path",{d:"M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"})]})),S.jsx("path",{d:"M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18",style:{fill:"none",stroke:"#ffffff",strokeLinejoin:"miter"}})]}))})),bQ:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"#000000",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}},{children:[S.jsx("path",{d:"M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z",style:{strokeLinecap:"butt",fill:"#000000"}}),S.jsx("path",{d:"m 9,26 c 0,2 1.5,2 2.5,4 1,1.5 1,1 0.5,3.5 -1.5,1 -1,2.5 -1,2.5 -1.5,1.5 0,2.5 0,2.5 6.5,1 16.5,1 23,0 0,0 1.5,-1 0,-2.5 0,0 0.5,-1.5 -1,-2.5 -0.5,-2.5 -0.5,-2 0.5,-3.5 1,-2 2.5,-2 2.5,-4 -8.5,-1.5 -18.5,-1.5 -27,0 z"}),S.jsx("path",{d:"M 11.5,30 C 15,29 30,29 33.5,30"}),S.jsx("path",{d:"m 12,33.5 c 6,-1 15,-1 21,0"}),S.jsx("circle",{cx:"6",cy:"12",r:"2"}),S.jsx("circle",{cx:"14",cy:"9",r:"2"}),S.jsx("circle",{cx:"22.5",cy:"8",r:"2"}),S.jsx("circle",{cx:"31",cy:"9",r:"2"}),S.jsx("circle",{cx:"39",cy:"12",r:"2"}),S.jsx("path",{d:"M 11,38.5 A 35,35 1 0 0 34,38.5",style:{fill:"none",stroke:"#000000",strokeLinecap:"butt"}}),S.jsxs("g",Object.assign({style:{fill:"none",stroke:"#ffffff"}},{children:[S.jsx("path",{d:"M 11,29 A 35,35 1 0 1 34,29"}),S.jsx("path",{d:"M 12.5,31.5 L 32.5,31.5"}),S.jsx("path",{d:"M 11.5,34.5 A 35,35 1 0 0 33.5,34.5"}),S.jsx("path",{d:"M 10.5,37.5 A 35,35 1 0 0 34.5,37.5"})]}))]}))})),bK:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22.5,11.63 L 22.5,6",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"},id:"path6570"}),S.jsx("path",{d:"M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25",style:{fill:"#000000",fillOpacity:"1",strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 20,8 L 25,8",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.5,26.6 L 22.5,24.5 C 20,18 10.85,14 6.97,19.85 C 4.5,25.5 13,29.5 13,29.5",style:{fill:"none",stroke:"#ffffff"}}),S.jsx("path",{d:"M 12.5,30 C 18,27 27,27 32.5,30 M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5 M 12.5,37 C 18,34 27,34 32.5,37",style:{fill:"none",stroke:"#ffffff"}})]}))}))};function xl(e,t,n){const r=t/8,o=e==="white"?p1:g1;return{x:(e==="white"?f1:h1)[n[0]]*r+r/2,y:o[parseInt(n[1],10)-1]*r+r/2}}function lc(e){let t=!1;return Object.keys($o).forEach(n=>{e[n]!==$o[n]&&(t=!0)}),Object.keys(e).forEach(n=>{$o[n]!==e[n]&&(t=!0)}),t}function uc(e){return e==="start"?$o:typeof e=="string"?function(t){if(!function(i){i=i.replace(/ .+$/,""),i=function(l){return l.replace(/8/g,"11111111").replace(/7/g,"1111111").replace(/6/g,"111111").replace(/5/g,"11111").replace(/4/g,"1111").replace(/3/g,"111").replace(/2/g,"11")}(i);const s=i.split("/");if(s.length!==8)return!1;for(let l=0;l<8;l++)if(s[l].length!==8||s[l].search(/[^kqrnbpKQRNBP1]/)!==-1)return!1;return!0}(t))return{};const n=(t=t.replace(/ .+$/,"")).split("/"),r={};let o=8;for(let i=0;i<8;i++){const s=n[i].split("");let l=0;for(let u=0;uC.useContext(Zf),v1=C.forwardRef(({animationDuration:e=300,areArrowsAllowed:t=!0,arePiecesDraggable:n=!0,arePremovesAllowed:r=!1,boardOrientation:o="white",boardWidth:i,children:s,clearPremovesOnRightClick:l=!0,customArrows:u,customArrowColor:a="rgb(255,170,0)",customBoardStyle:h,customDarkSquareStyle:m={backgroundColor:"#B58863"},customDropSquareStyle:d={boxShadow:"inset 0 0 1px 6px rgba(255,255,255,0.75)"},customLightSquareStyle:g={backgroundColor:"#F0D9B5"},customPieces:v,customPremoveDarkSquareStyle:y={backgroundColor:"#A42323"},customPremoveLightSquareStyle:w={backgroundColor:"#BD2828"},customSquare:p="div",customSquareStyles:c,dropOffBoardAction:f="snapback",id:k=0,isDraggablePiece:x=()=>!0,getPositionObject:_=()=>{},onArrowsChange:O=()=>{},onDragOverSquare:T=()=>{},onMouseOutSquare:j=()=>{},onMouseOverSquare:I=()=>{},onPieceClick:ne=()=>{},onPieceDragBegin:fe=()=>{},onPieceDragEnd:ye=()=>{},onPieceDrop:De=()=>!0,onPromotionCheck:en=(ze,Ot,Zr)=>(Zr==="wP"&&ze[1]==="7"&&Ot[1]==="8"||Zr==="bP"&&ze[1]==="2"&&Ot[1]==="1")&&Math.abs(ze.charCodeAt(0)-Ot.charCodeAt(0))<=1,onPromotionPieceSelect:tn,onSquareClick:nn=()=>{},onSquareRightClick:D=()=>{},position:L="start",promotionDialogVariant:R="default",promotionToSquare:U=null,showBoardNotation:Y=!0,showPromotionDialog:lt=!1,snapToCursor:b=!0,autoPromoteToQueen:_t=!1},Xe)=>{const[ze,Ot]=C.useState(uc(L)),[Zr,sh]=C.useState({removed:{},added:{}}),[Ii,kn]=C.useState(void 0),[lh,ji]=C.useState(lt&&!_t),[uh,Tu]=C.useState(null),[ah,Li]=C.useState(U),[Du,Ni]=C.useState([]),Tt=C.useRef(Du),[Mi,eo]=C.useState(),[ch,dh]=C.useState(Object.assign(Object.assign({},sc),v)),[fh,Ri]=C.useState(!1),[Ai,hh]=C.useState(),[to,no]=C.useState(!1);C.useImperativeHandle(Xe,()=>({clearPremoves(B=!0){ro(B)}})),C.useEffect(()=>{dh(Object.assign(Object.assign({},sc),v))},[v]),C.useEffect(()=>{ji(lt),Li(U)},[U,lt]),C.useEffect(()=>{var B,re,ue;$i();const $e=uc(L),Je=function(Ue,Dt){const er={removed:{},added:{}};return Object.keys(Ue).forEach(Pe=>{Dt[Pe]!==Ue[Pe]&&(er.removed[Pe]=Ue[Pe])}),Object.keys(Dt).forEach(Pe=>{Ue[Pe]!==Dt[Pe]&&(er.added[Pe]=Dt[Pe])}),er}(ze,$e),Fe=((B=Object.keys(Je.added))===null||B===void 0?void 0:B.length)<=2?(ue=(re=Object.entries(Je.added))===null||re===void 0?void 0:re[0])===null||ue===void 0?void 0:ue[1][0]:void 0;if(to)Ot($e),no(!1),r&&zi(Fe),Ai&&clearTimeout(Ai);else if(fh)Ot($e),no(!1),r&&zi(Fe);else{lc($e)&&Ii!==void 0?kn(Fe):lc($e)?kn(void 0):kn("b"),sh(Je),no(!0);const Ue=setTimeout(()=>{Ot($e),no(!1),r&&zi(Fe)},e);hh(Ue)}return Ri(!1),_($e),bi(),()=>{clearTimeout(Ai)}},[L]);const{arrows:ph,newArrow:gh,clearArrows:bi,drawNewArrow:mh,onArrowDrawEnd:vh}=((B,re=!0,ue,$e)=>{const[Je,Fe]=C.useState([]),[Ue,Dt]=C.useState([]),[er,Pe]=C.useState();C.useEffect(()=>{Array.isArray(B)&&Fe(B==null?void 0:B.filter(ht=>ht[0]!==ht[1]))},[B]),C.useEffect(()=>{ue==null||ue(Ue)},[Ue]);const Pu=[...Ue,...Je];return{arrows:Pu,newArrow:er,clearArrows:function(){Dt([]),Pe(void 0)},drawNewArrow:(ht,En)=>{re&&Pe([ht,En,$e])},setArrows:Dt,onArrowDrawEnd:(ht,En)=>{if(ht===En)return;let Iu;const Sh=[ht,En,$e];Iu=Pu.every(([Fi,Ui])=>!(Fi===ht&&Ui===En))?[...Ue,Sh]:Ue.filter(([Fi,Ui])=>!(Fi===ht&&Ui===En)),Pe(void 0),Dt(Iu)}}})(u,t,O,a);function zi(B){if(Tt.current.length===0)return;const re=Tt.current[0];if(re.piece[0]!==void 0&&re.piece[0]!==B&&De.length)if(kn(re.piece[0]),Ri(!0),De(re.sourceSq,re.targetSq,re.piece)){const ue=[...Tt.current];ue.shift(),Tt.current=ue,Ni([...ue])}else ro()}function ro(B=!0){B&&kn(void 0),Tt.current=[],Ni([])}function $i(){Tu(null),Li(null),ji(!1)}const yh={animationDuration:e,arePiecesDraggable:n,arePremovesAllowed:r,boardOrientation:o,boardWidth:i,customArrowColor:a,customBoardStyle:h,customDarkSquareStyle:m,customDropSquareStyle:d,customLightSquareStyle:g,customPremoveDarkSquareStyle:y,customPremoveLightSquareStyle:w,customSquare:p,customSquareStyles:c,id:k,isDraggablePiece:x,onDragOverSquare:T,onMouseOutSquare:j,onMouseOverSquare:I,onPieceClick:ne,onPieceDragBegin:fe,onPieceDragEnd:ye,onPieceDrop:De,onPromotionCheck:en,onPromotionPieceSelect:tn,onSquareClick:nn,showBoardNotation:Y,snapToCursor:b,promotionDialogVariant:R,arrows:ph,newArrow:gh,onArrowDrawEnd:vh,chessPieces:ch,clearArrows:bi,drawNewArrow:mh,clearCurrentRightClickDown:function(){eo(void 0)},currentPosition:ze,handleSetPosition:function(B,re,ue,$e){if(B===re)return;if(bi(),r&&to||r&&(Ii===ue[0]||Tt.current.filter(Fe=>Fe.piece[0]===ue[0]).length>0)){const Fe=[...Tt.current];return Fe.push({sourceSq:B,targetSq:re,piece:ue}),Tt.current=Fe,Ni([...Fe]),void $i()}if(!r&&to)return;const Je=Object.assign({},ze);Ri(!!$e),kn(ue[0]),De.length?De(B,re,ue)||ro():(f!=="trash"||re||delete Je[B],delete Je[B],Je[re]=ue,Ot(Je)),$i(),_(Je)},isWaitingForAnimation:to,lastPieceColour:Ii,onRightClickDown:function(B){eo(B)},onRightClickUp:function(B){if(Mi){if(Mi===B)return eo(void 0),l&&ro(!1),void D(B)}else eo(void 0)},positionDifferences:Zr,promoteFromSquare:uh,promoteToSquare:ah,premoves:Du,setPromoteFromSquare:Tu,setPromoteToSquare:Li,setShowPromoteDialog:ji,showPromoteDialog:lh,autoPromoteToQueen:_t,currentRightClickDown:Mi};return S.jsx(Zf.Provider,Object.assign({value:yh},{children:s}))});function y1({row:e,col:t}){const{boardOrientation:n,boardWidth:r,customDarkSquareStyle:o,customLightSquareStyle:i}=xt(),s=i.backgroundColor,l=o.backgroundColor,u=t===0,a=e===7;function h(){return n==="white"?8-e:e+1}function m(){return n==="black"?Qr[7-t]:Qr[t]}return u&&a?S.jsxs(S.Fragment,{children:[S.jsx("div",Object.assign({style:Object.assign(Object.assign({zIndex:3,position:"absolute"},{color:s}),cc(r))},{children:h()})),S.jsx("div",Object.assign({style:Object.assign(Object.assign({zIndex:3,position:"absolute"},{color:s}),ac(r))},{children:m()}))]}):a?S.jsx("div",Object.assign({style:Object.assign(Object.assign({userSelect:"none",zIndex:3,position:"absolute"},{color:t%2!=0?l:s}),ac(r))},{children:m()})):u?S.jsx("div",Object.assign({style:Object.assign(Object.assign({userSelect:"none",zIndex:3,position:"absolute"},{color:e%2==0?l:s}),cc(r))},{children:h()})):null}const ac=e=>({alignSelf:"flex-end",paddingLeft:e/8-e/48,fontSize:e/48}),cc=e=>({alignSelf:"flex-start",paddingRight:e/8-e/48,fontSize:e/48});function dc({isPremovedPiece:e=!1,piece:t,square:n,squares:r}){const{animationDuration:o,arePiecesDraggable:i,arePremovesAllowed:s,boardWidth:l,boardOrientation:u,chessPieces:a,currentPosition:h,id:m,isDraggablePiece:d,isWaitingForAnimation:g,onPieceClick:v,onPieceDragBegin:y,onPieceDragEnd:w,positionDifferences:p,premoves:c}=xt(),[f,k]=C.useState({opacity:1,zIndex:5,touchAction:"none",cursor:i&&d({piece:t,sourceSquare:n})?"-webkit-grab":"default"}),[{canDrag:x,isDragging:_},O,T]=Gg(()=>({type:"piece",item:()=>(y(t,n),{piece:t,square:n,id:m}),end:()=>w(t,n),collect:j=>({canDrag:d({piece:t,sourceSquare:n}),isDragging:!!j.isDragging()})}),[t,n,h,m]);return T((_o||(_o=new Image,_o.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),_o),{captureDraggingState:!0}),C.useEffect(()=>{k(j=>Object.assign(Object.assign({},j),{opacity:_?0:1}))},[_]),C.useEffect(()=>{if(!s)return;let j=!1;!e&&c.find(I=>I.targetSq===n)&&(j=!0),c.find(I=>I.sourceSq===n&&I.piece===t)&&(j=!0),k(I=>Object.assign(Object.assign({},I),{display:j?"none":"unset"}))},[h,c]),C.useEffect(()=>{var j;const I=(j=p.removed)===null||j===void 0?void 0:j[n];if(!p.added)return;const ne=Object.entries(p.added).find(([fe,ye])=>ye===I||(I==null?void 0:I[1])==="P"&&(fe[1]==="1"||fe[1]==="8"));if(g&&I&&ne&&!e){const fe=n,ye=ne[0];if(fe&&ye){const De=l/8;k(en=>Object.assign(Object.assign({},en),{transform:`translate(${(u==="black"?-1:1)*(ye.charCodeAt(0)-fe.charCodeAt(0))*De}px, ${(u==="black"?-1:1)*(Number(fe[1])-Number(ye[1]))*De}px)`,transition:`transform ${o}ms`,zIndex:6}))}}},[p]),C.useEffect(()=>{const{sourceSq:j}={sourceSq:r[n]};j&&k(I=>Object.assign(Object.assign({},I),{transform:"translate(0px, 0px)",transition:"transform 0ms"}))},[h]),C.useEffect(()=>{k(j=>Object.assign(Object.assign({},j),{cursor:i&&d({piece:t,sourceSquare:n})?"-webkit-grab":"default"}))},[n,h,i]),S.jsx("div",Object.assign({ref:i&&x?O:null,onClick:()=>v(t),"data-piece":t,style:f},{children:typeof a[t]=="function"?a[t]({squareWidth:l/8,isDragging:_,square:n}):S.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:l/8,height:l/8},{children:S.jsx("g",{children:a[t]})}))}))}function S1({square:e,squareColor:t,setSquares:n,squareHasPremove:r,children:o}){const i=C.useRef(null),{autoPromoteToQueen:s,boardWidth:l,boardOrientation:u,clearArrows:a,currentPosition:h,currentRightClickDown:m,customBoardStyle:d,customDarkSquareStyle:g,customDropSquareStyle:v,customLightSquareStyle:y,customPremoveDarkSquareStyle:w,customPremoveLightSquareStyle:p,customSquare:c,customSquareStyles:f,drawNewArrow:k,handleSetPosition:x,isWaitingForAnimation:_,lastPieceColour:O,onArrowDrawEnd:T,onDragOverSquare:j,onMouseOutSquare:I,onMouseOverSquare:ne,onPieceDrop:fe,onPromotionCheck:ye,onRightClickDown:De,onRightClickUp:en,onSquareClick:tn,setPromoteFromSquare:nn,setPromoteToSquare:D,setShowPromoteDialog:L}=xt(),[{isOver:R},U]=Zg(()=>({accept:"piece",drop:Y,collect:b=>({isOver:!!b.isOver()})}),[e,h,fe,_,O]);function Y(b){ye(b.square,e,b.piece)?s?x(b.square,e,b.piece[0]==="w"?"wQ":"bQ"):(nn(b.square),D(e),L(!0)):x(b.square,e,b.piece,!0)}C.useEffect(()=>{if(i.current){const{x:b,y:_t}=i.current.getBoundingClientRect();n(Xe=>Object.assign(Object.assign({},Xe),{[e]:{x:b,y:_t}}))}},[l,u]);const lt=Object.assign(Object.assign(Object.assign(Object.assign({},w1(e,u,d)),t==="black"?g:y),r&&(t==="black"?w:p)),R&&v);return S.jsx("div",Object.assign({ref:U,style:lt,"data-square-color":t,"data-square":e,onMouseOver:b=>{b.buttons===2&&m&&k(m,e),b.relatedTarget&&b.currentTarget.contains(b.relatedTarget)||ne(e)},onMouseOut:b=>{b.relatedTarget&&b.currentTarget.contains(b.relatedTarget)||I(e)},onMouseDown:b=>{b.button===2&&De(e)},onMouseUp:b=>{b.button===2&&(m&&T(m,e),en(e))},onDragEnter:()=>j(e),onClick:()=>{tn(e),a()},onContextMenu:b=>{b.preventDefault()}},{children:S.jsx(c,typeof c=="string"?Object.assign({ref:i,style:Object.assign(Object.assign(Object.assign({},hc(l)),fc),!r&&(f==null?void 0:f[e]))},{children:o}):Object.assign({ref:i,square:e,squareColor:t,style:Object.assign(Object.assign(Object.assign({},hc(l)),fc),!r&&(f==null?void 0:f[e]))},{children:o}))}))}const fc={display:"flex",justifyContent:"center"},hc=e=>({width:e/8,height:e/8}),w1=(e,t,n)=>n!=null&&n.borderRadius?e==="a1"?t==="white"?{borderBottomLeftRadius:n.borderRadius}:{borderTopRightRadius:n.borderRadius}:e==="a8"?t==="white"?{borderTopLeftRadius:n.borderRadius}:{borderBottomRightRadius:n.borderRadius}:e==="h1"?t==="white"?{borderBottomRightRadius:n.borderRadius}:{borderTopLeftRadius:n.borderRadius}:e==="h8"?t==="white"?{borderTopRightRadius:n.borderRadius}:{borderBottomLeftRadius:n.borderRadius}:{}:{};function k1(){const[e,t]=C.useState({}),{boardOrientation:n,boardWidth:r,currentPosition:o,id:i,premoves:s,showBoardNotation:l}=xt();return S.jsx("div",Object.assign({"data-boardid":i},{children:[...Array(8)].map((u,a)=>S.jsx("div",Object.assign({style:{display:"flex",flexWrap:"nowrap",width:r}},{children:[...Array(8)].map((h,m)=>{const d=n==="black"?Qr[7-m]+(a+1):Qr[m]+(8-a),g=m%2==a%2?"white":"black",v=s.find(w=>w.sourceSq===d||w.targetSq===d),y=s.find(w=>w.targetSq===d);return S.jsxs(S1,Object.assign({square:d,squareColor:g,setSquares:t,squareHasPremove:!!v},{children:[o[d]&&S.jsx(dc,{piece:o[d],square:d,squares:e}),y&&S.jsx(dc,{isPremovedPiece:!0,piece:y.piece,square:d,squares:e}),l&&S.jsx(y1,{row:a,col:m})]}),`${m}${a}`)})}),a.toString()))}))}const E1=()=>{const{arrows:e,newArrow:t,boardOrientation:n,boardWidth:r,customArrowColor:o}=xt(),i=[...e,t].filter(Boolean);return S.jsx("svg",Object.assign({width:r,height:r,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none",zIndex:"10"}},{children:i.map((s,l)=>{const[u,a,h]=s;if(u===a)return null;const m=xl(n,r,u),d=xl(n,r,a);let g=r/32;const v=l===e.length;e.some(f=>f[0]!==u&&f[1]===a)&&!v&&(g=r/16);const y=d.x-m.x,w=d.y-m.y,p=Math.hypot(w,y),c={x:m.x+y*(p-g)/p,y:m.y+w*(p-g)/p};return S.jsxs(C.Fragment,{children:[S.jsx("marker",Object.assign({id:`arrowhead-${l}`,markerWidth:"2",markerHeight:"2.5",refX:"1.25",refY:"1.25",orient:"auto"},{children:S.jsx("polygon",{points:"0.3 0, 2 1.25, 0.3 2.5",fill:h??o})})),S.jsx("line",{x1:m.x,y1:m.y,x2:c.x,y2:c.y,opacity:v?"0.5":"0.65",stroke:h??o,strokeWidth:v?.9*r/40:r/40,markerEnd:`url(#arrowhead-${l})`})]},`${u}-${a}${v?"-active":""}`)})}))};function C1({option:e}){const[t,n]=C.useState(!1),{boardWidth:r,chessPieces:o,customDarkSquareStyle:i,customLightSquareStyle:s,handleSetPosition:l,onPromotionPieceSelect:u,promoteFromSquare:a,promoteToSquare:h,promotionDialogVariant:m}=xt(),d=()=>{switch(e[1]){case"Q":return i.backgroundColor;case"R":return s.backgroundColor;case"N":return m==="default"?s.backgroundColor:i.backgroundColor;case"B":return m==="default"?i.backgroundColor:s.backgroundColor}};return S.jsx("div",Object.assign({onClick:()=>{u!=null&&u.length?u(e):l(a,h,e,!0)},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),"data-piece":e,style:{cursor:"pointer",backgroundColor:t?d():`${d()}aa`,borderRadius:"4px",transition:"all 0.1s ease-out"}},{children:typeof o[e]=="function"?S.jsx("div",Object.assign({style:{transition:"all 0.1s ease-out",transform:t?"scale(1)":"scale(0.85)"}},{children:o[e]({squareWidth:r/8,isDragging:!1})})):S.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:r/8,height:r/8,style:{transition:"all 0.1s ease-out",transform:t?"scale(1)":"scale(0.85)"}},{children:S.jsx("g",{children:o[e]})}))}))}function x1(){const{boardOrientation:e,boardWidth:t,promotionDialogVariant:n,promoteToSquare:r}=xt(),o=(r==null?void 0:r[1])==="1"?"b":"w",i=[`${o??"w"}Q`,`${o??"w"}R`,`${o??"w"}N`,`${o??"w"}B`],s={default:{display:"grid",gridTemplateColumns:"1fr 1fr",transform:`translate(${-t/8}px, ${-t/8}px)`},vertical:{transform:`translate(${-t/16}px, ${-t/16}px)`},modal:{display:"flex",justifyContent:"center",alignItems:"center",transform:`translate(0px, ${3*t/8}px)`,width:"100%",height:t/4+"px",top:0,backgroundColor:"white",left:0}},l=xl(e,t,r||"a8");return S.jsx("div",Object.assign({style:Object.assign({position:"absolute",top:`${l==null?void 0:l.y}px`,left:`${l==null?void 0:l.x}px`,zIndex:1e3},s[n]),title:"Choose promotion piece"},{children:i.map(u=>S.jsx(C1,{option:u},u))}))}const _1={whiteKing:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",style:{shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"crisp-edges"},viewBox:"0 0 4210 12970",x:"0px",y:"0px",fillRule:"evenodd",clipRule:"evenodd",width:"250",height:"250"},{children:S.jsx("g",{children:S.jsx("path",{style:{fill:"black",fillRule:"nonzero"},d:"M2105 0c169,0 286,160 249,315l200 0c-172,266 -231,479 -256,792 315,-24 530,-86 792,-255l0 897c-265,-171 -479,-231 -792,-256 18,234 75,495 185,682l339 0c233,0 369,269 225,456l545 0 -595 1916c130,94 158,275 59,402 465,0 416,568 51,568l-334 0 465 2867 332 0c250,0 381,306 199,485 162,63 273,220 273,399l0 633 168 0 0 475c-1403,0 -2807,0 -4210,0l0 -475 167 0 0 -633c0,-179 112,-336 274,-399 -181,-178 -52,-485 199,-485l332 0 465 -2867 -335 0c-353,0 -418,-568 51,-568 -98,-127 -70,-308 59,-402l-594 -1916c181,0 363,0 545,0 -144,-187 -9,-456 225,-456l339 0c110,-187 167,-448 185,-682 -315,25 -530,87 -793,256l0 -897c266,171 480,231 793,255 -25,-315 -87,-529 -256,-792l199 0c-36,-155 81,-315 250,-315zm-1994 10012l0 253 3988 0 0 -253c-1330,0 -2659,0 -3988,0zm484 -1060c-174,0 -316,142 -316,316l0 633 3652 0 0 -633c0,-174 -142,-316 -316,-316 -1007,0 -2013,0 -3020,0zm45 -457c-230,0 -225,345 0,345l2930 0c230,0 225,-345 0,-345 -977,0 -1953,0 -2930,0zm2020 -2978l-1111 0 -465 2867 2041 0 -465 -2867zm-1558 -456c-229,0 -224,345 0,345 669,0 1337,0 2005,0 230,0 225,-345 0,-345 -668,0 -1336,0 -2005,0zm1730 -457l-1454 0c-229,0 -224,345 0,345l1454 0c229,0 224,-345 0,-345zm-2064 -1862l544 1751c529,0 1057,0 1586,0l544 -1751c-892,0 -1783,0 -2674,0zm1085 -567l504 0c-126,-247 -163,-526 -177,-800 273,15 553,52 800,177l0 -504c-247,126 -527,163 -800,177 14,-273 51,-552 177,-799 -168,0 -336,0 -504,0 125,247 162,526 177,799 -274,-14 -553,-51 -800,-177l0 504c247,-125 527,-162 800,-177 -15,274 -52,553 -177,800zm969 111l-1434 0c-230,0 -225,345 0,345l1434 0c230,0 225,-345 0,-345zm-717 -2175c-105,0 -175,109 -133,204l266 0c42,-96 -30,-205 -133,-204z"})})}))};function O1({children:e}){try{return S.jsx(S.Fragment,{children:e})}catch(t){return console.log(t),S.jsx(eh,{showError:!0})}}function eh({showError:e=!1}){return S.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column"}},{children:[S.jsx("div",Object.assign({style:{width:250,height:250,transform:"rotate(90deg)"}},{children:_1.whiteKing})),e&&S.jsx("h1",{children:"Something went wrong"})]}))}function T1(){const e=C.useRef(null),{boardWidth:t,clearCurrentRightClickDown:n,onPromotionPieceSelect:r,setShowPromoteDialog:o,showPromoteDialog:i,customBoardStyle:s}=xt();return C.useEffect(()=>{function l(u){e.current&&!e.current.contains(u.target)&&n()}return document.addEventListener("mouseup",l),()=>{document.removeEventListener("mouseup",l)}},[]),t?S.jsx("div",Object.assign({style:{perspective:"1000px"}},{children:S.jsxs("div",Object.assign({ref:e,style:Object.assign(Object.assign({position:"relative"},D1(t)),s)},{children:[S.jsx(k1,{}),S.jsx(E1,{}),i&&S.jsxs(S.Fragment,{children:[S.jsx("div",{onClick:()=>{o(!1),r==null||r()},style:{position:"absolute",top:"0",left:"0",zIndex:"100",backgroundColor:"rgba(22,21,18,.7)",width:t,height:t}}),S.jsx(x1,{})]})]}))})):S.jsx(eh,{})}const D1=e=>({cursor:"default",height:e,width:e});function P1(){const{boardWidth:e,chessPieces:t,id:n,snapToCursor:r}=xt(),o=function(h){const m=yn().getMonitor(),[d,g]=Hf(m,h);return C.useEffect(()=>m.subscribeToOffsetChange(g)),C.useEffect(()=>m.subscribeToStateChange(g)),d}(h=>({item:h.getItem(),clientOffset:h.getClientOffset(),sourceClientOffset:h.getSourceClientOffset(),isDragging:h.isDragging()})),{isDragging:i,item:s,clientOffset:l,sourceClientOffset:u}=o,a=C.useCallback((h,m)=>{if(!h||!m)return{display:"none"};let{x:d,y:g}=r?h:m;if(r){const y=e/8/2;d-=y,g-=y}const v=`translate(${d}px, ${g}px)`;return{transform:v,WebkitTransform:v,touchAction:"none"}},[e,r]);return i&&s.id===n?S.jsx("div",Object.assign({style:{position:"fixed",pointerEvents:"none",zIndex:10,left:0,top:0}},{children:S.jsx("div",Object.assign({style:a(l,u)},{children:typeof t[s.piece]=="function"?t[s.piece]({squareWidth:e/8,isDragging:!0}):S.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:e/8,height:e/8},{children:S.jsx("g",{children:t[s.piece]})}))}))})):null}const I1=C.forwardRef((e,t)=>{const{customDndBackend:n,customDndBackendOptions:r}=e,o=function(y,w){var p={};for(var c in y)Object.prototype.hasOwnProperty.call(y,c)&&w.indexOf(c)<0&&(p[c]=y[c]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(c=Object.getOwnPropertySymbols(y);f{h("ontouchstart"in window),u(!0),s(window)},[]),C.useEffect(()=>{var y;if(e.boardWidth===void 0&&(!((y=g.current)===null||y===void 0)&&y.offsetWidth)){const w=new ResizeObserver(()=>{var p;d((p=g.current)===null||p===void 0?void 0:p.offsetWidth)});return w.observe(g.current),()=>{w.disconnect()}}},[g.current,i]);const v=n||(a?d1:l1);return l&&i?S.jsx(O1,{children:S.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",width:"100%"}},{children:[S.jsx("div",{ref:g,style:{width:"100%"}}),S.jsx(zg,Object.assign({backend:v,context:i,options:n?r:void 0},{children:m&&S.jsxs(v1,Object.assign({boardWidth:m},o,{ref:t},{children:[S.jsx(P1,{}),S.jsx(T1,{})]}))}))]}))}):null});var pc=globalThis&&globalThis.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function l(h){try{a(r.next(h))}catch(m){s(m)}}function u(h){try{a(r.throw(h))}catch(m){s(m)}}function a(h){h.done?i(h.value):o(h.value).then(l,u)}a((r=r.apply(e,t||[])).next())})};const j1=e=>{const[t,n,r]=e.split(":");return{process_name:t,package_name:n,publisher_node:r}};function dr(e){const t=document.cookie.split(";");for(let n=0;nnull,onOpen:s=()=>null,onClose:l=()=>null,onError:u=()=>null}){this._encrypt=a=>null,this._decrypt=a=>{},this.send=({data:a})=>{dr(`uqbar-auth_${this.nodeId}`),dr(`uqbar-ws-auth_${this.nodeId}`),this._ws.send(gc(a))},this.fetchJson=(a,h)=>pc(this,void 0,void 0,function*(){return console.log("Fetching JSON:",a),yield(yield fetch(a,h)).json()}),this._secret=void 0,this.processId=j1(n),this.channelId=r,this.nodeId=t,this._ws=new WebSocket(o),this._ws.onmessage=a=>pc(this,void 0,void 0,function*(){i(a.data,this)}),this._ws.onopen=a=>{console.log(`${t}`,dr(`uqbar-auth_${t}`),dr(`uqbar-ws-auth_${t}`)),this._ws.send(gc({auth_token:dr(`uqbar-auth_${t}`),target_process:n,encrypted:!1})),s(a,this)},this._ws.onclose=l,this._ws.onerror=u}}const mc=e=>{let t;const n=new Set,r=(u,a)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const m=t;t=a??typeof h!="object"?h:Object.assign({},t,h),n.forEach(d=>d(t,m))}},o=()=>t,l={setState:r,getState:o,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{n.clear()}};return t=e(r,o,l),l},N1=e=>e?mc(e):mc;var th={exports:{}},nh={},rh={exports:{}},oh={};/** - * @license React - * use-sync-external-store-shim.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. - */var Yn=C;function M1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var R1=typeof Object.is=="function"?Object.is:M1,A1=Yn.useState,b1=Yn.useEffect,z1=Yn.useLayoutEffect,$1=Yn.useDebugValue;function F1(e,t){var n=t(),r=A1({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return z1(function(){o.value=n,o.getSnapshot=t,xs(o)&&i({inst:o})},[e,n,t]),b1(function(){return xs(o)&&i({inst:o}),e(function(){xs(o)&&i({inst:o})})},[e]),$1(n),n}function xs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!R1(e,n)}catch{return!0}}function U1(e,t){return t()}var H1=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?U1:F1;oh.useSyncExternalStore=Yn.useSyncExternalStore!==void 0?Yn.useSyncExternalStore:H1;rh.exports=oh;var B1=rh.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.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. - */var Pi=C,W1=B1;function q1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Q1=typeof Object.is=="function"?Object.is:q1,K1=W1.useSyncExternalStore,V1=Pi.useRef,G1=Pi.useEffect,Y1=Pi.useMemo,X1=Pi.useDebugValue;nh.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=V1(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=Y1(function(){function u(g){if(!a){if(a=!0,h=g,g=r(g),o!==void 0&&s.hasValue){var v=s.value;if(o(v,g))return m=v}return m=g}if(v=m,Q1(h,g))return v;var y=r(g);return o!==void 0&&o(v,y)?v:(h=g,m=y)}var a=!1,h,m,d=n===void 0?null:n;return[function(){return u(t())},d===null?void 0:function(){return u(d())}]},[t,n,r,o]);var l=K1(e,i[0],i[1]);return G1(function(){s.hasValue=!0,s.value=l},[l]),X1(l),l};th.exports=nh;var J1=th.exports;const Z1=wc(J1),{useSyncExternalStoreWithSelector:em}=Z1;function tm(e,t=e.getState,n){const r=em(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return C.useDebugValue(r),r}const vc=e=>{const t=typeof e=="function"?N1(e):e,n=(r,o)=>tm(t,r,o);return Object.assign(n,t),n},nm=e=>e?vc(e):vc;function ih(e,t){let n;try{n=e()}catch{return}return{getItem:o=>{var i;const s=u=>u===null?null:JSON.parse(u,t==null?void 0:t.reviver),l=(i=n.getItem(o))!=null?i:null;return l instanceof Promise?l.then(s):s(l)},setItem:(o,i)=>n.setItem(o,JSON.stringify(i,t==null?void 0:t.replacer)),removeItem:o=>n.removeItem(o)}}const Kr=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Kr(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Kr(r)(n)}}}},rm=(e,t)=>(n,r,o)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:w=>w,version:0,merge:(w,p)=>({...p,...w}),...t},s=!1;const l=new Set,u=new Set;let a;try{a=i.getStorage()}catch{}if(!a)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...w)},r,o);const h=Kr(i.serialize),m=()=>{const w=i.partialize({...r()});let p;const c=h({state:w,version:i.version}).then(f=>a.setItem(i.name,f)).catch(f=>{p=f});if(p)throw p;return c},d=o.setState;o.setState=(w,p)=>{d(w,p),m()};const g=e((...w)=>{n(...w),m()},r,o);let v;const y=()=>{var w;if(!a)return;s=!1,l.forEach(c=>c(r()));const p=((w=i.onRehydrateStorage)==null?void 0:w.call(i,r()))||void 0;return Kr(a.getItem.bind(a))(i.name).then(c=>{if(c)return i.deserialize(c)}).then(c=>{if(c)if(typeof c.version=="number"&&c.version!==i.version){if(i.migrate)return i.migrate(c.state,c.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return c.state}).then(c=>{var f;return v=i.merge(c,(f=r())!=null?f:g),n(v,!0),m()}).then(()=>{p==null||p(v,void 0),s=!0,u.forEach(c=>c(v))}).catch(c=>{p==null||p(void 0,c)})};return o.persist={setOptions:w=>{i={...i,...w},w.getStorage&&(a=w.getStorage())},clearStorage:()=>{a==null||a.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>y(),hasHydrated:()=>s,onHydrate:w=>(l.add(w),()=>{l.delete(w)}),onFinishHydration:w=>(u.add(w),()=>{u.delete(w)})},y(),v||g},om=(e,t)=>(n,r,o)=>{let i={storage:ih(()=>localStorage),partialize:y=>y,version:0,merge:(y,w)=>({...w,...y}),...t},s=!1;const l=new Set,u=new Set;let a=i.storage;if(!a)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...y)},r,o);const h=()=>{const y=i.partialize({...r()});return a.setItem(i.name,{state:y,version:i.version})},m=o.setState;o.setState=(y,w)=>{m(y,w),h()};const d=e((...y)=>{n(...y),h()},r,o);let g;const v=()=>{var y,w;if(!a)return;s=!1,l.forEach(c=>{var f;return c((f=r())!=null?f:d)});const p=((w=i.onRehydrateStorage)==null?void 0:w.call(i,(y=r())!=null?y:d))||void 0;return Kr(a.getItem.bind(a))(i.name).then(c=>{if(c)if(typeof c.version=="number"&&c.version!==i.version){if(i.migrate)return i.migrate(c.state,c.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return c.state}).then(c=>{var f;return g=i.merge(c,(f=r())!=null?f:d),n(g,!0),h()}).then(()=>{p==null||p(g,void 0),g=r(),s=!0,u.forEach(c=>c(g))}).catch(c=>{p==null||p(void 0,c)})};return o.persist={setOptions:y=>{i={...i,...y},y.storage&&(a=y.storage)},clearStorage:()=>{a==null||a.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>v(),hasHydrated:()=>s,onHydrate:y=>(l.add(y),()=>{l.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},i.skipHydration||v(),g||d},im=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?rm(e,t):om(e,t),sm=im,lm=nm()(sm((e,t)=>({games:{},handleWsMessage:n=>{if(typeof n=="string")try{const{kind:r,data:o}=JSON.parse(n);r==="game_update"&&e({games:{...t().games,[o.id]:o}})}catch(r){console.error("Error parsing WebSocket message",r)}else{const r=new FileReader;r.onload=function(o){var i;if(typeof((i=o==null?void 0:o.target)==null?void 0:i.result)=="string")try{const{kind:s,data:l}=JSON.parse(o.target.result);s==="game_update"&&e({games:{...t().games,[l.id]:l}})}catch(s){console.error("Error parsing WebSocket message",s)}},r.readAsText(n)}},set:e}),{name:"chess",storage:ih(()=>localStorage)}));let yc=!1;const Sc=(e,t)=>(e.turns||0)%2===0?t===e.white:t===e.black,bt="/chess:chess:nectar";window.our&&(window.our.process=bt==null?void 0:bt.replace("/",""));const um=void 0;function am(){const{games:e,handleWsMessage:t,set:n}=lm(),[r,o]=C.useState("new"),[i,s]=C.useState(""),l=C.useMemo(()=>e[r]?{...e[r],game:new lg(e[r].board)}:void 0,[e,r]),u=C.useMemo(()=>((l==null?void 0:l.turns)||0)%2===0?`${l==null?void 0:l.white} (white)`:`${l==null?void 0:l.black} (black)`,[l]);C.useEffect(()=>{yc||(yc=!0,new L1({uri:um,nodeId:window.our.node,processId:window.our.process,onMessage:t})),fetch(`${bt}/games`).then(g=>g.json()).then(g=>{n({games:g})}).catch(console.error)},[]);const a=C.useCallback(async g=>{g.preventDefault();try{const v=await fetch(`${bt}/games`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:i})}).then(w=>{if(w.status===409)throw e[i]?o(i):alert("Game already exists, please refresh the page and select it."),new Error("Game already exists");if(w.status===503)throw alert(`${i} may be offline, please confirm it is online and try again.`),new Error("Player offline");if(w.status===400)throw alert("Please enter a valid player ID"),new Error("Invalid player ID");if(w.status>399)throw alert("There was an error creating the game. Please try again."),new Error("Error creating game");return w.json()}),y={...e};y[v.id]=v,n({games:y}),o(i),s("")}catch(v){console.error(v)}},[e,i,s,n]),h=C.useCallback((g,v)=>{if(!l||!Sc(l,window.our.node))return!1;const y={from:g,to:v,promotion:"q"},w={...l};if(w.game.move(y)===null)return!1;w.board=w.game.fen();const c={...e};return c[l.id]=w,n({games:c}),fetch(`${bt}/games`,{method:"PUT",body:JSON.stringify({id:l.id,move:g+v})}).then(f=>f.json()).then(f=>{const k={...e};k[l.id]=f,n({games:k})}).catch(f=>{console.error(f),alert("There was an error making your move. Please try again");const k={...e},x={...l};x.game.undo(),k[l.id]=x,n({games:k})}),!0},[l,e,n]),m=C.useCallback(g=>{g.preventDefault(),g.stopPropagation(),l&&window.confirm("Are you sure you want to resign this game?")&&fetch(`${bt}/games?id=${l.id}`,{method:"DELETE"}).then(v=>v.json()).then(v=>{const y={...e};y[l.id]=v,n({games:y})}).catch(v=>{console.error(v),alert("There was an error resigning the game. Please try again")})},[l]),d=C.useCallback(async g=>{if(g.preventDefault(),g.stopPropagation(),!!l)try{const v=await fetch(`${bt}/games`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l.id})}).then(w=>w.json()),y={...e};y[v.id]=v,n({games:y})}catch(v){console.error(v),alert("You could not create the game. Please make sure your current game with this player (if any) has ended and try again.")}},[l]);return S.jsx("div",{className:"flex flex-col justify-center items-center",children:S.jsxs("div",{className:"flex flex-col justify-center",style:{maxHeight:"100vh",maxWidth:"800px",width:"100%",position:"relative"},children:[S.jsx("a",{href:"/",className:"absolute top-6 left-0 m-4",style:{fontSize:24,color:"white"},onClick:g=>{g.preventDefault(),window.history.back()},children:"◀ Back"}),S.jsx("h1",{className:"m-4",children:"Chess by Uqbar"}),S.jsxs("div",{className:"flex flex-row justify-center items-center h-screen border rounded",children:[Object.keys(e).length>0&&S.jsxs("div",{className:"flex flex-col border-r",style:{width:"25%",height:"100%"},children:[S.jsx("h3",{className:"m-2",children:"Games"}),S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-2 px-4 m-2 rounded",onClick:()=>o("new"),children:"New"}),S.jsx("div",{className:"flex flex-col overflow-scroll",children:Object.values(e).map(g=>S.jsx("div",{onClick:()=>o(g==null?void 0:g.id),className:`game-entry m-2 ${r!==(g==null?void 0:g.id)&&Sc(g,window.our.node)?"is-turn":""} ${r===(g==null?void 0:g.id)?"selected":""} ${g!=null&&g.ended?"ended":""}`,children:g==null?void 0:g.id},g==null?void 0:g.id))})]}),S.jsx("div",{className:"flex flex-col justify-center items-center",style:{width:"75%"},children:r==="new"||!l?S.jsxs(S.Fragment,{children:[S.jsx("h2",{className:"mb-2",children:"Start New Game"}),S.jsx("h4",{className:"mb-2",children:"(game creator will be white)"}),S.jsxs("form",{onSubmit:a,className:"flex flex-col justify-center mb-40",style:{maxWidth:400},children:[S.jsx("label",{className:"mb-2",style:{alignSelf:"flex-start",fontWeight:"600"},children:"Player ID"}),S.jsx("input",{className:"border rounded p-2 mb-2",style:{color:"black"},type:"text",placeholder:"Player ID",value:i,onChange:g=>s(g.target.value)}),S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-2 px-4 rounded",type:"submit",children:"Start Game"})]})]}):S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex flex-row justify-between items-center w-full px-4 pb-2",children:[S.jsx("h3",{children:r}),S.jsx("h4",{children:l!=null&&l.ended?"Game Ended":`Turn: ${u}`}),l!=null&&l.ended?S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-1 px-4 rounded",onClick:d,children:"Rematch"}):S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-1 px-4 rounded",onClick:m,children:"Resign"})]}),S.jsx(I1,{position:l==null?void 0:l.game.fen(),onPieceDrop:h,boardOrientation:(l==null?void 0:l.white)===window.our.node?"white":"black"})]})})]})]})})}_s.createRoot(document.getElementById("root")).render(S.jsx(bh.StrictMode,{children:S.jsx(am,{})})); diff --git a/modules/chess/pkg/ui/assets/index-9cf353a0.css b/modules/chess/pkg/ui/assets/index-9cf353a0.css new file mode 100644 index 00000000..501f7333 --- /dev/null +++ b/modules/chess/pkg/ui/assets/index-9cf353a0.css @@ -0,0 +1 @@ +#root{max-width:1280px;margin:0 auto;text-align:center;width:100%}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.top-6{top:1.5rem}.m-2{margin:.5rem}.m-4{margin:1rem}.mb-2{margin-bottom:.5rem}.mb-40{margin-bottom:10rem}.flex{display:flex}.h-screen{height:100vh}.w-full{width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.overflow-scroll{overflow:scroll}.rounded{border-radius:.25rem}.border{border-width:1px}.border-r{border-right-width:1px}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.font-bold{font-weight:700}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;width:100%;--uq-vlightpurple: #d9dcfc;--uq-lightpurple: #c7cafa;--uq-purple: #727bf2;--uq-darkpurple: #5761ef;--midnightpurp: #0a1170;--forgottenpurp: #45475e;--uq-lightpink: #f3ced2;--uq-pink: #dd7c8a;--uq-darkpink: #cd3c52;--blush: #d55d6f;--celeste: #adebe5;--lturq: #6bdbd0;--turq: #3acfc0;--celadon: #21897e;--deep-jungle: #14524c;--old-mint: #659792;--washed-gray: rgba(0, 0, 0, .03);--light-gray: rgba(0, 0, 0, .1);--medium-gray: rgba(0, 0, 0, .2);--dark-gray: rgba(0, 0, 0, .5);--charcoal: #333}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;min-width:320px;min-height:100vh;color:#fff;background-color:var(--midnightpurp)}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}h1,h2,h3,h4,h5,h6{font-weight:600}h1{font-size:3em}h2{font-size:2em}h3{font-size:1.5em}h4{font-size:1.25em}h5{font-size:1em}@keyframes colorChange{0%,to{background-color:var(--uq-purple)}50%{background-color:var(--uq-pink)}}.game-entry{width:calc(100% - 1em);cursor:pointer;color:#fff;background-color:var(--uq-purple);padding:.5em;border-radius:.25em}.game-entry.is-turn{animation:colorChange 3s infinite}.game-entry.selected{background-color:var(--uq-darkpink)}.game-entry.is-ended{background-color:#d3d3d3;color:gray}.game-entry:hover{background-color:var(--uq-pink)}.hover\:bg-green-800:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))} diff --git a/modules/chess/pkg/ui/assets/index-b1380f22.css b/modules/chess/pkg/ui/assets/index-b1380f22.css deleted file mode 100644 index 9ac42996..00000000 --- a/modules/chess/pkg/ui/assets/index-b1380f22.css +++ /dev/null @@ -1 +0,0 @@ -#root{max-width:1280px;margin:0 auto;text-align:center;width:100%}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.relative{position:relative}.left-0{left:0px}.top-6{top:1.5rem}.m-2{margin:.5rem}.m-4{margin:1rem}.mb-2{margin-bottom:.5rem}.mb-40{margin-bottom:10rem}.flex{display:flex}.h-screen{height:100vh}.w-full{width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.overflow-scroll{overflow:scroll}.rounded{border-radius:.25rem}.border{border-width:1px}.border-r{border-right-width:1px}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.font-bold{font-weight:700}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;width:100%;--uq-vlightpurple: #d9dcfc;--uq-lightpurple: #c7cafa;--uq-purple: #727bf2;--uq-darkpurple: #5761ef;--midnightpurp: #0a1170;--forgottenpurp: #45475e;--uq-lightpink: #f3ced2;--uq-pink: #dd7c8a;--uq-darkpink: #cd3c52;--blush: #d55d6f;--celeste: #adebe5;--lturq: #6bdbd0;--turq: #3acfc0;--celadon: #21897e;--deep-jungle: #14524c;--old-mint: #659792;--washed-gray: rgba(0, 0, 0, .03);--light-gray: rgba(0, 0, 0, .1);--medium-gray: rgba(0, 0, 0, .2);--dark-gray: rgba(0, 0, 0, .5);--charcoal: #333}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;min-width:320px;min-height:100vh;color:#fff;background-color:var(--midnightpurp)}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}h1,h2,h3,h4,h5,h6{font-weight:600}h1{font-size:3em}h2{font-size:2em}h3{font-size:1.5em}h4{font-size:1.25em}h5{font-size:1em}@keyframes colorChange{0%,to{background-color:var(--uq-purple)}50%{background-color:var(--uq-pink)}}.game-entry{width:calc(100% - 1em);cursor:pointer;color:#fff;background-color:var(--uq-purple);padding:.5em;border-radius:.25em}.game-entry.is-turn{animation:colorChange 3s infinite}.game-entry.selected{background-color:var(--uq-darkpink)}.game-entry.is-ended{background-color:#d3d3d3;color:gray}.game-entry:hover{background-color:var(--uq-pink)}.hover\:bg-green-800:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))} diff --git a/modules/chess/pkg/ui/assets/index-c34c1996.js b/modules/chess/pkg/ui/assets/index-c34c1996.js new file mode 100644 index 00000000..007d57c1 --- /dev/null +++ b/modules/chess/pkg/ui/assets/index-c34c1996.js @@ -0,0 +1,87 @@ +var mh=Object.defineProperty;var vh=(e,t,n)=>t in e?mh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ze=(e,t,n)=>(vh(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function uc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ac={exports:{}},so={},cc={exports:{}},b={};/** + * @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. + */var Wr=Symbol.for("react.element"),yh=Symbol.for("react.portal"),Sh=Symbol.for("react.fragment"),wh=Symbol.for("react.strict_mode"),Eh=Symbol.for("react.profiler"),Ch=Symbol.for("react.provider"),kh=Symbol.for("react.context"),_h=Symbol.for("react.forward_ref"),xh=Symbol.for("react.suspense"),Oh=Symbol.for("react.memo"),Th=Symbol.for("react.lazy"),ku=Symbol.iterator;function Dh(e){return e===null||typeof e!="object"?null:(e=ku&&e[ku]||e["@@iterator"],typeof e=="function"?e:null)}var dc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},fc=Object.assign,hc={};function Kn(e,t,n){this.props=e,this.context=t,this.refs=hc,this.updater=n||dc}Kn.prototype.isReactComponent={};Kn.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")};Kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function pc(){}pc.prototype=Kn.prototype;function El(e,t,n){this.props=e,this.context=t,this.refs=hc,this.updater=n||dc}var Cl=El.prototype=new pc;Cl.constructor=El;fc(Cl,Kn.prototype);Cl.isPureReactComponent=!0;var _u=Array.isArray,gc=Object.prototype.hasOwnProperty,kl={current:null},mc={key:!0,ref:!0,__self:!0,__source:!0};function vc(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)gc.call(t,r)&&!mc.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,X=D[H];if(0>>1;Hi(ft,j))Gei(vn,ft)?(D[H]=vn,D[Ge]=j,H=Ge):(D[H]=ft,D[A]=j,H=A);else if(Gei(vn,j))D[H]=vn,D[Ge]=j,H=Ge;else break e}}return N}function i(D,N){var j=D.sortIndex-N.sortIndex;return j!==0?j:D.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],a=[],g=1,p=null,f=3,y=!1,m=!1,v=!1,E=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(D){for(var N=n(a);N!==null;){if(N.callback===null)r(a);else if(N.startTime<=D)r(a),N.sortIndex=N.expirationTime,t(u,N);else break;N=n(a)}}function w(D){if(v=!1,h(D),!m)if(n(u)!==null)m=!0,Ee(k);else{var N=n(a);N!==null&&dt(w,N.startTime-D)}}function k(D,N){m=!1,v&&(v=!1,d(T),T=-1),y=!0;var j=f;try{for(h(N),p=n(u);p!==null&&(!(p.expirationTime>N)||D&&!$());){var H=p.callback;if(typeof H=="function"){p.callback=null,f=p.priorityLevel;var X=H(p.expirationTime<=N);N=e.unstable_now(),typeof X=="function"?p.callback=X:p===n(u)&&r(u),h(N)}else r(u);p=n(u)}if(p!==null)var ot=!0;else{var A=n(a);A!==null&&dt(w,A.startTime-N),ot=!1}return ot}finally{p=null,f=j,y=!1}}var O=!1,x=null,T=-1,z=5,M=-1;function $(){return!(e.unstable_now()-MD||125H?(D.sortIndex=j,t(a,D),n(u)===null&&D===n(a)&&(v?(d(T),T=-1):v=!0,dt(w,j-H))):(D.sortIndex=X,t(u,D),m||y||(m=!0,Ee(k))),D},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(D){var N=f;return function(){var j=f;f=N;try{return D.apply(this,arguments)}finally{f=j}}}})(Cc);Ec.exports=Cc;var Fh=Ec.exports;/** + * @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. + */var kc=C,je=Fh;function _(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"),Cs=Object.prototype.hasOwnProperty,$h=/^[: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]*$/,Ou={},Tu={};function Uh(e){return Cs.call(Tu,e)?!0:Cs.call(Ou,e)?!1:$h.test(e)?Tu[e]=!0:(Ou[e]=!0,!1)}function Hh(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 Wh(e,t,n,r){if(t===null||typeof t>"u"||Hh(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 we(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ce[e]=new we(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ce[t]=new we(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ce[e]=new we(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ce[e]=new we(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){ce[e]=new we(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ce[e]=new we(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ce[e]=new we(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ce[e]=new we(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ce[e]=new we(e,5,!1,e.toLowerCase(),null,!1,!1)});var xl=/[\-:]([a-z])/g;function Ol(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(xl,Ol);ce[t]=new we(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(xl,Ol);ce[t]=new we(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(xl,Ol);ce[t]=new we(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ce[e]=new we(e,1,!1,e.toLowerCase(),null,!1,!1)});ce.xlinkHref=new we("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ce[e]=new we(e,1,!1,e.toLowerCase(),null,!0,!0)});function Tl(e,t,n,r){var i=ce.hasOwnProperty(t)?ce[t]:null;(i!==null?i.type!==0:r||!(2l||i[s]!==o[l]){var u=` +`+i[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{$o=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?lr(e):""}function Bh(e){switch(e.tag){case 5:return lr(e.type);case 16:return lr("Lazy");case 13:return lr("Suspense");case 19:return lr("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 Os(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 Cn:return"Fragment";case En:return"Portal";case ks:return"Profiler";case Dl:return"StrictMode";case _s:return"Suspense";case xs:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Oc:return(e.displayName||"Context")+".Consumer";case xc:return(e._context.displayName||"Context")+".Provider";case Pl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Nl:return t=e.displayName||null,t!==null?t:Os(e.type)||"Memo";case Nt:t=e._payload,e=e._init;try{return Os(e(t))}catch{}}return null}function Vh(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 Os(t);case 8:return t===Dl?"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 Kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Dc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Qh(e){var t=Dc(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 i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ni(e){e._valueTracker||(e._valueTracker=Qh(e))}function Pc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Dc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Mi(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 Ts(e,t){var n=t.checked;return Y({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Kt(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 Nc(e,t){t=t.checked,t!=null&&Tl(e,"checked",t,!1)}function Ds(e,t){Nc(e,t);var n=Kt(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")?Ps(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ps(e,t.type,Kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nu(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 Ps(e,t,n){(t!=="number"||Mi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ur=Array.isArray;function jn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=ri.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _r(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fr={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},Kh=["Webkit","ms","Moz","O"];Object.keys(fr).forEach(function(e){Kh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fr[t]=fr[e]})});function Rc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fr.hasOwnProperty(e)&&fr[e]?(""+t).trim():t+"px"}function Mc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Rc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var qh=Y({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 Ls(e,t){if(t){if(qh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(_(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(_(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(_(61))}if(t.style!=null&&typeof t.style!="object")throw Error(_(62))}}function js(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 Rs=null;function Il(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ms=null,Rn=null,Mn=null;function ju(e){if(e=Qr(e)){if(typeof Ms!="function")throw Error(_(280));var t=e.stateNode;t&&(t=fo(t),Ms(e.stateNode,e.type,t))}}function Ac(e){Rn?Mn?Mn.push(e):Mn=[e]:Rn=e}function bc(){if(Rn){var e=Rn,t=Mn;if(Mn=Rn=null,ju(e),t)for(e=0;e>>=0,e===0?32:31-(op(e)/sp|0)|0}var ii=64,oi=4194304;function ar(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 Fi(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~i;l!==0?r=ar(l):(o&=s,o!==0&&(r=ar(o)))}else s=n&~i,s!==0?r=ar(s):o!==0&&(r=ar(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-nt(t),e[t]=n}function cp(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=pr),Hu=String.fromCharCode(32),Wu=!1;function rd(e,t){switch(e){case"keyup":return zp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function id(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var kn=!1;function $p(e,t){switch(e){case"compositionend":return id(t);case"keypress":return t.which!==32?null:(Wu=!0,Hu);case"textInput":return e=t.data,e===Hu&&Wu?null:e;default:return null}}function Up(e,t){if(kn)return e==="compositionend"||!Fl&&rd(e,t)?(e=td(),ki=Al=At=null,kn=!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=Ku(n)}}function ud(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ud(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ad(){for(var e=window,t=Mi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mi(e.document)}return t}function $l(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 Yp(e){var t=ad(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ud(n.ownerDocument.documentElement,n)){if(r!==null&&$l(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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=qu(n,o);var s=qu(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,_n=null,Us=null,mr=null,Hs=!1;function Gu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hs||_n==null||_n!==Mi(r)||(r=_n,"selectionStart"in r&&$l(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}),mr&&Nr(mr,r)||(mr=r,r=Hi(Us,"onSelect"),0Tn||(e.current=qs[Tn],qs[Tn]=null,Tn--)}function W(e,t){Tn++,qs[Tn]=e.current,e.current=t}var qt={},me=Yt(qt),xe=Yt(!1),un=qt;function $n(e,t){var n=e.type.contextTypes;if(!n)return qt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Oe(e){return e=e.childContextTypes,e!=null}function Bi(){V(xe),V(me)}function na(e,t,n){if(me.current!==qt)throw Error(_(168));W(me,t),W(xe,n)}function yd(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(_(108,Vh(e)||"Unknown",i));return Y({},n,r)}function Vi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qt,un=me.current,W(me,e),W(xe,xe.current),!0}function ra(e,t,n){var r=e.stateNode;if(!r)throw Error(_(169));n?(e=yd(e,t,un),r.__reactInternalMemoizedMergedChildContext=e,V(xe),V(me),W(me,e)):V(xe),W(xe,n)}var gt=null,ho=!1,ts=!1;function Sd(e){gt===null?gt=[e]:gt.push(e)}function ug(e){ho=!0,Sd(e)}function Xt(){if(!ts&>!==null){ts=!0;var e=0,t=U;try{var n=gt;for(U=1;e>=s,i-=s,mt=1<<32-nt(t)+i|n<T?(z=x,x=null):z=x.sibling;var M=f(d,x,h[T],w);if(M===null){x===null&&(x=z);break}e&&x&&M.alternate===null&&t(d,x),c=o(M,c,T),O===null?k=M:O.sibling=M,O=M,x=z}if(T===h.length)return n(d,x),Q&&Zt(d,T),k;if(x===null){for(;TT?(z=x,x=null):z=x.sibling;var $=f(d,x,M.value,w);if($===null){x===null&&(x=z);break}e&&x&&$.alternate===null&&t(d,x),c=o($,c,T),O===null?k=$:O.sibling=$,O=$,x=z}if(M.done)return n(d,x),Q&&Zt(d,T),k;if(x===null){for(;!M.done;T++,M=h.next())M=p(d,M.value,w),M!==null&&(c=o(M,c,T),O===null?k=M:O.sibling=M,O=M);return Q&&Zt(d,T),k}for(x=r(d,x);!M.done;T++,M=h.next())M=y(x,d,T,M.value,w),M!==null&&(e&&M.alternate!==null&&x.delete(M.key===null?T:M.key),c=o(M,c,T),O===null?k=M:O.sibling=M,O=M);return e&&x.forEach(function(K){return t(d,K)}),Q&&Zt(d,T),k}function E(d,c,h,w){if(typeof h=="object"&&h!==null&&h.type===Cn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case ti:e:{for(var k=h.key,O=c;O!==null;){if(O.key===k){if(k=h.type,k===Cn){if(O.tag===7){n(d,O.sibling),c=i(O,h.props.children),c.return=d,d=c;break e}}else if(O.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Nt&&ca(k)===O.type){n(d,O.sibling),c=i(O,h.props),c.ref=tr(d,O,h),c.return=d,d=c;break e}n(d,O);break}else t(d,O);O=O.sibling}h.type===Cn?(c=sn(h.props.children,d.mode,w,h.key),c.return=d,d=c):(w=Ii(h.type,h.key,h.props,null,d.mode,w),w.ref=tr(d,c,h),w.return=d,d=w)}return s(d);case En:e:{for(O=h.key;c!==null;){if(c.key===O)if(c.tag===4&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){n(d,c.sibling),c=i(c,h.children||[]),c.return=d,d=c;break e}else{n(d,c);break}else t(d,c);c=c.sibling}c=as(h,d.mode,w),c.return=d,d=c}return s(d);case Nt:return O=h._init,E(d,c,O(h._payload),w)}if(ur(h))return m(d,c,h,w);if(Yn(h))return v(d,c,h,w);fi(d,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,c!==null&&c.tag===6?(n(d,c.sibling),c=i(c,h),c.return=d,d=c):(n(d,c),c=us(h,d.mode,w),c.return=d,d=c),s(d)):n(d,c)}return E}var Hn=Td(!0),Dd=Td(!1),Kr={},ct=Yt(Kr),Rr=Yt(Kr),Mr=Yt(Kr);function rn(e){if(e===Kr)throw Error(_(174));return e}function Gl(e,t){switch(W(Mr,t),W(Rr,e),W(ct,Kr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Is(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Is(t,e)}V(ct),W(ct,t)}function Wn(){V(ct),V(Rr),V(Mr)}function Pd(e){rn(Mr.current);var t=rn(ct.current),n=Is(t,e.type);t!==n&&(W(Rr,e),W(ct,n))}function Yl(e){Rr.current===e&&(V(ct),V(Rr))}var q=Yt(0);function Xi(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)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 ns=[];function Xl(){for(var e=0;en?n:4,e(!0);var r=rs.transition;rs.transition={};try{e(!1),t()}finally{U=n,rs.transition=r}}function Vd(){return Ke().memoizedState}function fg(e,t,n){var r=Bt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qd(e))Kd(t,n);else if(n=kd(e,t,n,r),n!==null){var i=ye();rt(n,e,r,i),qd(n,t,r)}}function hg(e,t,n){var r=Bt(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qd(e))Kd(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,l=o(s,n);if(i.hasEagerState=!0,i.eagerState=l,it(l,s)){var u=t.interleaved;u===null?(i.next=i,Kl(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=kd(e,t,i,r),n!==null&&(i=ye(),rt(n,e,r,i),qd(n,t,r))}}function Qd(e){var t=e.alternate;return e===G||t!==null&&t===G}function Kd(e,t){vr=Ji=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jl(e,n)}}var Zi={readContext:Qe,useCallback:fe,useContext:fe,useEffect:fe,useImperativeHandle:fe,useInsertionEffect:fe,useLayoutEffect:fe,useMemo:fe,useReducer:fe,useRef:fe,useState:fe,useDebugValue:fe,useDeferredValue:fe,useTransition:fe,useMutableSource:fe,useSyncExternalStore:fe,useId:fe,unstable_isNewReconciler:!1},pg={readContext:Qe,useCallback:function(e,t){return lt().memoizedState=[e,t===void 0?null:t],e},useContext:Qe,useEffect:fa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ti(4194308,4,$d.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ti(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ti(4,2,e,t)},useMemo:function(e,t){var n=lt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=lt();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=fg.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=lt();return e={current:e},t.memoizedState=e},useState:da,useDebugValue:nu,useDeferredValue:function(e){return lt().memoizedState=e},useTransition:function(){var e=da(!1),t=e[0];return e=dg.bind(null,e[1]),lt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=G,i=lt();if(Q){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),le===null)throw Error(_(349));cn&30||Ld(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,fa(Rd.bind(null,r,o,e),[e]),r.flags|=2048,zr(9,jd.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=lt(),t=le.identifierPrefix;if(Q){var n=vt,r=mt;n=(r&~(1<<32-nt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ar++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ut]=t,e[jr]=r,rf(e,t,!1,!1),t.stateNode=e;e:{switch(s=js(n,r),n){case"dialog":B("cancel",e),B("close",e),i=r;break;case"iframe":case"object":case"embed":B("load",e),i=r;break;case"video":case"audio":for(i=0;iVn&&(t.flags|=128,r=!0,nr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Xi(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),nr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Q)return he(t),null}else 2*Z()-o.renderingStartTime>Vn&&n!==1073741824&&(t.flags|=128,r=!0,nr(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Z(),t.sibling=null,n=q.current,W(q,r?n&1|2:n&1),t):(he(t),null);case 22:case 23:return uu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ne&1073741824&&(he(t),t.subtreeFlags&6&&(t.flags|=8192)):he(t),null;case 24:return null;case 25:return null}throw Error(_(156,t.tag))}function Cg(e,t){switch(Hl(t),t.tag){case 1:return Oe(t.type)&&Bi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wn(),V(xe),V(me),Xl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yl(t),null;case 13:if(V(q),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_(340));Un()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(q),null;case 4:return Wn(),null;case 10:return Ql(t.type._context),null;case 22:case 23:return uu(),null;case 24:return null;default:return null}}var pi=!1,ge=!1,kg=typeof WeakSet=="function"?WeakSet:Set,P=null;function In(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){J(e,t,r)}else n.current=null}function sl(e,t,n){try{n()}catch(r){J(e,t,r)}}var Ea=!1;function _g(e,t){if(Ws=$i,e=ad(),$l(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 i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,l=-1,u=-1,a=0,g=0,p=e,f=null;t:for(;;){for(var y;p!==n||i!==0&&p.nodeType!==3||(l=s+i),p!==o||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(y=p.firstChild)!==null;)f=p,p=y;for(;;){if(p===e)break t;if(f===n&&++a===i&&(l=s),f===o&&++g===r&&(u=s),(y=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=y}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bs={focusedElem:e,selectionRange:n},$i=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,E=m.memoizedState,d=t.stateNode,c=d.getSnapshotBeforeUpdate(t.elementType===t.type?v:Ze(t.type,v),E);d.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_(163))}}catch(w){J(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return m=Ea,Ea=!1,m}function yr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&sl(t,n,o)}i=i.next}while(i!==r)}}function mo(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 ll(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 lf(e){var t=e.alternate;t!==null&&(e.alternate=null,lf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ut],delete t[jr],delete t[Ks],delete t[sg],delete t[lg])),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 uf(e){return e.tag===5||e.tag===3||e.tag===4}function Ca(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uf(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 ul(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=Wi));else if(r!==4&&(e=e.child,e!==null))for(ul(e,t,n),e=e.sibling;e!==null;)ul(e,t,n),e=e.sibling}function al(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(al(e,t,n),e=e.sibling;e!==null;)al(e,t,n),e=e.sibling}var ue=null,et=!1;function Tt(e,t,n){for(n=n.child;n!==null;)af(e,t,n),n=n.sibling}function af(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(lo,n)}catch{}switch(n.tag){case 5:ge||In(n,t);case 6:var r=ue,i=et;ue=null,Tt(e,t,n),ue=r,et=i,ue!==null&&(et?(e=ue,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ue.removeChild(n.stateNode));break;case 18:ue!==null&&(et?(e=ue,n=n.stateNode,e.nodeType===8?es(e.parentNode,n):e.nodeType===1&&es(e,n),Dr(e)):es(ue,n.stateNode));break;case 4:r=ue,i=et,ue=n.stateNode.containerInfo,et=!0,Tt(e,t,n),ue=r,et=i;break;case 0:case 11:case 14:case 15:if(!ge&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&sl(n,t,s),i=i.next}while(i!==r)}Tt(e,t,n);break;case 1:if(!ge&&(In(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){J(n,t,l)}Tt(e,t,n);break;case 21:Tt(e,t,n);break;case 22:n.mode&1?(ge=(r=ge)||n.memoizedState!==null,Tt(e,t,n),ge=r):Tt(e,t,n);break;default:Tt(e,t,n)}}function ka(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new kg),t.forEach(function(r){var i=jg.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Je(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Og(r/1960))-r,10e?16:e,bt===null)var r=!1;else{if(e=bt,bt=null,no=0,F&6)throw Error(_(331));var i=F;for(F|=4,P=e.current;P!==null;){var o=P,s=o.child;if(P.flags&16){var l=o.deletions;if(l!==null){for(var u=0;uZ()-su?on(e,0):ou|=n),Te(e,t)}function vf(e,t){t===0&&(e.mode&1?(t=oi,oi<<=1,!(oi&130023424)&&(oi=4194304)):t=1);var n=ye();e=Et(e,t),e!==null&&(Br(e,t,n),Te(e,n))}function Lg(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vf(e,n)}function jg(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(_(314))}r!==null&&r.delete(t),vf(e,n)}var yf;yf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||xe.current)_e=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return _e=!1,wg(e,t,n);_e=!!(e.flags&131072)}else _e=!1,Q&&t.flags&1048576&&wd(t,Ki,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Di(e,t),e=t.pendingProps;var i=$n(t,me.current);bn(t,n),i=Zl(null,t,r,e,i,n);var o=eu();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oe(r)?(o=!0,Vi(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ql(t),i.updater=po,t.stateNode=i,i._reactInternals=t,Zs(t,r,e,n),t=nl(null,t,r,!0,o,n)):(t.tag=0,Q&&o&&Ul(t),ve(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Di(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Mg(r),e=Ze(r,e),i){case 0:t=tl(null,t,r,e,n);break e;case 1:t=ya(null,t,r,e,n);break e;case 11:t=ma(null,t,r,e,n);break e;case 14:t=va(null,t,r,Ze(r.type,e),n);break e}throw Error(_(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ze(r,i),tl(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ze(r,i),ya(e,t,r,i,n);case 3:e:{if(ef(t),e===null)throw Error(_(387));r=t.pendingProps,o=t.memoizedState,i=o.element,_d(e,t),Yi(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Bn(Error(_(423)),t),t=Sa(e,t,r,n,i);break e}else if(r!==i){i=Bn(Error(_(424)),t),t=Sa(e,t,r,n,i);break e}else for(Ie=Ut(t.stateNode.containerInfo.firstChild),Le=t,Q=!0,tt=null,n=Dd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Un(),r===i){t=Ct(e,t,n);break e}ve(e,t,r,n)}t=t.child}return t;case 5:return Pd(t),e===null&&Ys(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,Vs(r,i)?s=null:o!==null&&Vs(r,o)&&(t.flags|=32),Zd(e,t),ve(e,t,s,n),t.child;case 6:return e===null&&Ys(t),null;case 13:return tf(e,t,n);case 4:return Gl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hn(t,null,r,n):ve(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ze(r,i),ma(e,t,r,i,n);case 7:return ve(e,t,t.pendingProps,n),t.child;case 8:return ve(e,t,t.pendingProps.children,n),t.child;case 12:return ve(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,W(qi,r._currentValue),r._currentValue=s,o!==null)if(it(o.value,s)){if(o.children===i.children&&!xe.current){t=Ct(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(o.tag===1){u=yt(-1,n&-n),u.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var g=a.pending;g===null?u.next=u:(u.next=g.next,g.next=u),a.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Xs(o.return,n,t),l.lanes|=n;break}u=u.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(_(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Xs(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ve(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,bn(t,n),i=Qe(i),r=r(i),t.flags|=1,ve(e,t,r,n),t.child;case 14:return r=t.type,i=Ze(r,t.pendingProps),i=Ze(r.type,i),va(e,t,r,i,n);case 15:return Xd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ze(r,i),Di(e,t),t.tag=1,Oe(r)?(e=!0,Vi(t)):e=!1,bn(t,n),Od(t,r,i),Zs(t,r,i,n),nl(null,t,r,!0,e,n);case 19:return nf(e,t,n);case 22:return Jd(e,t,n)}throw Error(_(156,t.tag))};function Sf(e,t){return Bc(e,t)}function Rg(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 Be(e,t,n,r){return new Rg(e,t,n,r)}function cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Mg(e){if(typeof e=="function")return cu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pl)return 11;if(e===Nl)return 14}return 2}function Vt(e,t){var n=e.alternate;return n===null?(n=Be(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 Ii(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")cu(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Cn:return sn(n.children,i,o,t);case Dl:s=8,i|=8;break;case ks:return e=Be(12,n,t,i|2),e.elementType=ks,e.lanes=o,e;case _s:return e=Be(13,n,t,i),e.elementType=_s,e.lanes=o,e;case xs:return e=Be(19,n,t,i),e.elementType=xs,e.lanes=o,e;case Tc:return yo(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xc:s=10;break e;case Oc:s=9;break e;case Pl:s=11;break e;case Nl:s=14;break e;case Nt:s=16,r=null;break e}throw Error(_(130,e==null?e:typeof e,""))}return t=Be(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function sn(e,t,n,r){return e=Be(7,e,r,t),e.lanes=n,e}function yo(e,t,n,r){return e=Be(22,e,r,t),e.elementType=Tc,e.lanes=n,e.stateNode={isHidden:!1},e}function us(e,t,n){return e=Be(6,e,null,t),e.lanes=n,e}function as(e,t,n){return t=Be(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Ag(e,t,n,r,i){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=Wo(0),this.expirationTimes=Wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function du(e,t,n,r,i,o,s,l,u){return e=new Ag(e,t,n,l,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Be(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ql(o),e}function bg(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kf)}catch(e){console.error(e)}}kf(),wc.exports=Re;var Hg=wc.exports,Ia=Hg;Es.createRoot=Ia.createRoot,Es.hydrateRoot=Ia.hydrateRoot;/** + * @license + * Copyright (c) 2023, Jeff Hlywa (jhlywa@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */const pe="w",$e="b",oe="p",pl="n",Li="b",dr="r",Lt="q",ne="k",cs="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",Ce=-1,Wg={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},I={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},R={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},ds={b:[16,32,17,15],w:[-16,-32,-17,-15]},La={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},Bg=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],Vg=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],Qg={p:1,n:2,b:4,r:8,q:16,k:32},Kg="pnbrqkPNBRQK",ja=[pl,Li,dr,Lt],qg=7,Gg=6,Yg=1,Xg=0,vi={[ne]:I.KSIDE_CASTLE,[Lt]:I.QSIDE_CASTLE},Dt={w:[{square:R.a1,flag:I.QSIDE_CASTLE},{square:R.h1,flag:I.KSIDE_CASTLE}],b:[{square:R.a8,flag:I.QSIDE_CASTLE},{square:R.h8,flag:I.KSIDE_CASTLE}]},Jg={b:Yg,w:Gg},Zg=["1-0","0-1","1/2-1/2","*"];function ln(e){return e>>4}function $r(e){return e&15}function _f(e){return"0123456789".indexOf(e)!==-1}function Pe(e){const t=$r(e),n=ln(e);return"abcdefgh".substring(t,t+1)+"87654321".substring(n,n+1)}function ir(e){return e===pe?$e:pe}function e0(e){const t=e.split(/\s+/);if(t.length!==6)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};const n=parseInt(t[5],10);if(isNaN(n)||n<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};const r=parseInt(t[4],10);if(isNaN(r)||r<0)return{ok:!1,error:"Invalid FEN: half move counter number must be a non-negative integer"};if(!/^(-|[abcdefgh][36])$/.test(t[3]))return{ok:!1,error:"Invalid FEN: en-passant square is invalid"};if(/[^kKqQ-]/.test(t[2]))return{ok:!1,error:"Invalid FEN: castling availability is invalid"};if(!/^(w|b)$/.test(t[1]))return{ok:!1,error:"Invalid FEN: side-to-move is invalid"};const i=t[0].split("/");if(i.length!==8)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let s=0;s1)return{ok:!1,error:`Invalid FEN: too many ${s} kings`}}return Array.from(i[0]+i[7]).some(s=>s.toUpperCase()==="P")?{ok:!1,error:"Invalid FEN: some pawns are on the edge rows"}:{ok:!0}}function t0(e,t){const n=e.from,r=e.to,i=e.piece;let o=0,s=0,l=0;for(let u=0,a=t.length;u0?s>0&&l>0?Pe(n):l>0?Pe(n).charAt(1):Pe(n).charAt(0):""}function Pt(e,t,n,r,i,o=void 0,s=I.NORMAL){const l=ln(r);if(i===oe&&(l===qg||l===Xg))for(let u=0;u="a"&&t<="h"?e.match(/[a-h]\d.*[a-h]\d/)?void 0:oe:(t=t.toLowerCase(),t==="o"?ne:t)}function fs(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function Ma(e){return e.split(" ").slice(0,4).join(" ")}class n0{constructor(t=cs){ze(this,"_board",new Array(128));ze(this,"_turn",pe);ze(this,"_header",{});ze(this,"_kings",{w:Ce,b:Ce});ze(this,"_epSquare",-1);ze(this,"_halfMoves",0);ze(this,"_moveNumber",0);ze(this,"_history",[]);ze(this,"_comments",{});ze(this,"_castling",{w:0,b:0});ze(this,"_positionCounts",{});this.load(t)}clear({preserveHeaders:t=!1}={}){this._board=new Array(128),this._kings={w:Ce,b:Ce},this._turn=pe,this._castling={w:0,b:0},this._epSquare=Ce,this._halfMoves=0,this._moveNumber=1,this._history=[],this._comments={},this._header=t?this._header:{},delete this._header.SetUp,delete this._header.FEN,this._positionCounts=new Proxy({},{get:(n,r)=>r==="length"?Object.keys(n).length:(n==null?void 0:n[Ma(r)])||0,set:(n,r,i)=>{const o=Ma(r);return i===0?delete n[o]:n[o]=i,!0}})}removeHeader(t){t in this._header&&delete this._header[t]}load(t,{skipValidation:n=!1,preserveHeaders:r=!1}={}){let i=t.split(/\s+/);if(i.length>=2&&i.length<6){const l=["-","-","0","1"];t=i.concat(l.slice(-(6-i.length))).join(" ")}if(i=t.split(/\s+/),!n){const{ok:l,error:u}=e0(t);if(!l)throw new Error(u)}const o=i[0];let s=0;this.clear({preserveHeaders:r});for(let l=0;l-1&&(this._castling.w|=I.KSIDE_CASTLE),i[2].indexOf("Q")>-1&&(this._castling.w|=I.QSIDE_CASTLE),i[2].indexOf("k")>-1&&(this._castling.b|=I.KSIDE_CASTLE),i[2].indexOf("q")>-1&&(this._castling.b|=I.QSIDE_CASTLE),this._epSquare=i[3]==="-"?Ce:R[i[3]],this._halfMoves=parseInt(i[4],10),this._moveNumber=parseInt(i[5],10),this._updateSetup(t),this._positionCounts[t]++}fen(){var o,s;let t=0,n="";for(let l=R.a8;l<=R.h1;l++){if(this._board[l]){t>0&&(n+=t,t=0);const{color:u,type:a}=this._board[l];n+=u===pe?a.toUpperCase():a.toLowerCase()}else t++;l+1&136&&(t>0&&(n+=t),l!==R.h1&&(n+="/"),t=0,l+=8)}let r="";this._castling[pe]&I.KSIDE_CASTLE&&(r+="K"),this._castling[pe]&I.QSIDE_CASTLE&&(r+="Q"),this._castling[$e]&I.KSIDE_CASTLE&&(r+="k"),this._castling[$e]&I.QSIDE_CASTLE&&(r+="q"),r=r||"-";let i="-";if(this._epSquare!==Ce){const l=this._epSquare+(this._turn===pe?16:-16),u=[l+1,l-1];for(const a of u){if(a&136)continue;const g=this._turn;if(((o=this._board[a])==null?void 0:o.color)===g&&((s=this._board[a])==null?void 0:s.type)===oe){this._makeMove({color:g,from:a,to:this._epSquare,piece:oe,captured:oe,flags:I.EP_CAPTURE});const p=!this._isKingAttacked(g);if(this._undoMove(),p){i=Pe(this._epSquare);break}}}}return[n,this._turn,r,i,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(t){this._history.length>0||(t!==cs?(this._header.SetUp="1",this._header.FEN=t):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load(cs)}get(t){return this._board[R[t]]||!1}put({type:t,color:n},r){return this._put({type:t,color:n},r)?(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0):!1}_put({type:t,color:n},r){if(Kg.indexOf(t.toLowerCase())===-1||!(r in R))return!1;const i=R[r];if(t==ne&&!(this._kings[n]==Ce||this._kings[n]==i))return!1;const o=this._board[i];return o&&o.type===ne&&(this._kings[o.color]=Ce),this._board[i]={type:t,color:n},t===ne&&(this._kings[n]=i),!0}remove(t){const n=this.get(t);return delete this._board[R[t]],n&&n.type===ne&&(this._kings[n.color]=Ce),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),n}_updateCastlingRights(){var r,i,o,s,l,u,a,g,p,f,y,m;const t=((r=this._board[R.e1])==null?void 0:r.type)===ne&&((i=this._board[R.e1])==null?void 0:i.color)===pe,n=((o=this._board[R.e8])==null?void 0:o.type)===ne&&((s=this._board[R.e8])==null?void 0:s.color)===$e;(!t||((l=this._board[R.a1])==null?void 0:l.type)!==dr||((u=this._board[R.a1])==null?void 0:u.color)!==pe)&&(this._castling.w&=~I.QSIDE_CASTLE),(!t||((a=this._board[R.h1])==null?void 0:a.type)!==dr||((g=this._board[R.h1])==null?void 0:g.color)!==pe)&&(this._castling.w&=~I.KSIDE_CASTLE),(!n||((p=this._board[R.a8])==null?void 0:p.type)!==dr||((f=this._board[R.a8])==null?void 0:f.color)!==$e)&&(this._castling.b&=~I.QSIDE_CASTLE),(!n||((y=this._board[R.h8])==null?void 0:y.type)!==dr||((m=this._board[R.h8])==null?void 0:m.color)!==$e)&&(this._castling.b&=~I.KSIDE_CASTLE)}_updateEnPassantSquare(){var o,s;if(this._epSquare===Ce)return;const t=this._epSquare+(this._turn===pe?-16:16),n=this._epSquare+(this._turn===pe?16:-16),r=[n+1,n-1];if(this._board[t]!==null||this._board[this._epSquare]!==null||((o=this._board[n])==null?void 0:o.color)!==ir(this._turn)||((s=this._board[n])==null?void 0:s.type)!==oe){this._epSquare=Ce;return}const i=l=>{var u,a;return!(l&136)&&((u=this._board[l])==null?void 0:u.color)===this._turn&&((a=this._board[l])==null?void 0:a.type)===oe};r.some(i)||(this._epSquare=Ce)}_attacked(t,n){for(let r=R.a8;r<=R.h1;r++){if(r&136){r+=7;continue}if(this._board[r]===void 0||this._board[r].color!==t)continue;const i=this._board[r],o=r-n;if(o===0)continue;const s=o+119;if(Bg[s]&Qg[i.type]){if(i.type===oe){if(o>0){if(i.color===pe)return!0}else if(i.color===$e)return!0;continue}if(i.type==="n"||i.type==="k")return!0;const l=Vg[s];let u=r+l,a=!1;for(;u!==n;){if(this._board[u]!=null){a=!0;break}u+=l}if(!a)return!0}}return!1}_isKingAttacked(t){const n=this._kings[t];return n===-1?!1:this._attacked(ir(t),n)}isAttacked(t,n){return this._attacked(n,R[t])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&this._moves().length===0}isStalemate(){return!this.isCheck()&&this._moves().length===0}isInsufficientMaterial(){const t={b:0,n:0,r:0,q:0,k:0,p:0},n=[];let r=0,i=0;for(let o=R.a8;o<=R.h1;o++){if(i=(i+1)%2,o&136){o+=7;continue}const s=this._board[o];s&&(t[s.type]=s.type in t?t[s.type]+1:1,s.type===Li&&n.push(i),r++)}if(r===2)return!0;if(r===3&&(t[Li]===1||t[pl]===1))return!0;if(r===t[Li]+2){let o=0;const s=n.length;for(let l=0;l=3}isDraw(){return this._halfMoves>=100||this.isStalemate()||this.isInsufficientMaterial()||this.isThreefoldRepetition()}isGameOver(){return this.isCheckmate()||this.isStalemate()||this.isDraw()}moves({verbose:t=!1,square:n=void 0,piece:r=void 0}={}){const i=this._moves({square:n,piece:r});return t?i.map(o=>this._makePretty(o)):i.map(o=>this._moveToSan(o,i))}_moves({legal:t=!0,piece:n=void 0,square:r=void 0}={}){var y;const i=r?r.toLowerCase():void 0,o=n==null?void 0:n.toLowerCase(),s=[],l=this._turn,u=ir(l);let a=R.a8,g=R.h1,p=!1;if(i)if(i in R)a=g=R[i],p=!0;else return[];for(let m=a;m<=g;m++){if(m&136){m+=7;continue}if(!this._board[m]||this._board[m].color===u)continue;const{type:v}=this._board[m];let E;if(v===oe){if(o&&o!==v)continue;E=m+ds[l][0],this._board[E]||(Pt(s,l,m,E,oe),E=m+ds[l][1],Jg[l]===ln(m)&&!this._board[E]&&Pt(s,l,m,E,oe,void 0,I.BIG_PAWN));for(let d=2;d<4;d++)E=m+ds[l][d],!(E&136)&&(((y=this._board[E])==null?void 0:y.color)===u?Pt(s,l,m,E,oe,this._board[E].type,I.CAPTURE):E===this._epSquare&&Pt(s,l,m,E,oe,oe,I.EP_CAPTURE))}else{if(o&&o!==v)continue;for(let d=0,c=La[v].length;d{const y=this._comments[this.fen()];if(typeof y<"u"){const m=f.length>0?" ":"";f=`${f}${m}{${y}}`}return f},s=[];for(;this._history.length>0;)s.push(this._undoMove());const l=[];let u="";for(s.length===0&&l.push(o(""));s.length>0;){u=o(u);const f=s.pop();if(!f)break;if(!this._history.length&&f.color==="b"){const y=`${this._moveNumber}. ...`;u=u?`${u} ${y}`:y}else f.color==="w"&&(u.length&&l.push(u),u=this._moveNumber+".");u=u+" "+this._moveToSan(f,this._moves({legal:!0})),this._makeMove(f)}if(u.length&&l.push(o(u)),typeof this._header.Result<"u"&&l.push(this._header.Result),n===0)return r.join("")+l.join(" ");const a=function(){return r.length>0&&r[r.length-1]===" "?(r.pop(),!0):!1},g=function(f,y){for(const m of y.split(" "))if(m){if(f+m.length>n){for(;a();)f--;r.push(t),f=0}r.push(m),f+=m.length,r.push(" "),f++}return a()&&f--,f};let p=0;for(let f=0;fn&&l[f].includes("{")){p=g(p,l[f]);continue}p+l[f].length>n&&f!==0?(r[r.length-1]===" "&&r.pop(),r.push(t),p=0):f!==0&&(r.push(" "),p++),r.push(l[f]),p+=l[f].length}return r.join("")}header(...t){for(let n=0;n0&&(w[O]=x)}return w}t=t.trim();const l=new RegExp("^(\\[((?:"+i(r)+")|.)*\\])((?:\\s*"+i(r)+"){2}|(?:\\s*"+i(r)+")*$)").exec(t),u=l&&l.length>=2?l[1]:"";this.reset();const a=o(u);let g="";for(const h in a)h.toLowerCase()==="fen"&&(g=a[h]),this.header(h,a[h]);if(!n)g&&this.load(g,{preserveHeaders:!0});else if(a.SetUp==="1"){if(!("FEN"in a))throw new Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(a.FEN,{preserveHeaders:!0})}function p(h){return Array.from(h).map(function(w){return w.charCodeAt(0)<128?w.charCodeAt(0).toString(16):encodeURIComponent(w).replace(/%/g,"").toLowerCase()}).join("")}function f(h){return h.length==0?"":decodeURIComponent("%"+(h.match(/.{1,2}/g)||[]).join("%"))}const y=function(h){return h=h.replace(new RegExp(i(r),"g")," "),`{${p(h.slice(1,h.length-1))}}`},m=function(h){if(h.startsWith("{")&&h.endsWith("}"))return f(h.slice(1,h.length-1))};let v=t.replace(u,"").replace(new RegExp(`({[^}]*})+?|;([^${i(r)}]*)`,"g"),function(h,w,k){return w!==void 0?y(w):" "+y(`{${k.slice(1)}}`)}).replace(new RegExp(i(r),"g")," ");const E=/(\([^()]+\))+?/g;for(;E.test(v);)v=v.replace(E,"");v=v.replace(/\d+\.(\.\.)?/g,""),v=v.replace(/\.\.\./g,""),v=v.replace(/\$\d+/g,"");let d=v.trim().split(new RegExp(/\s+/));d=d.filter(h=>h!=="");let c="";for(let h=0;h-1)c=d[h];else throw new Error(`Invalid move in PGN: ${d[h]}`);else c="",this._makeMove(k),this._positionCounts[this.fen()]++}c&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",c)}_moveToSan(t,n){let r="";if(t.flags&I.KSIDE_CASTLE)r="O-O";else if(t.flags&I.QSIDE_CASTLE)r="O-O-O";else{if(t.piece!==oe){const i=t0(t,n);r+=t.piece.toUpperCase()+i}t.flags&(I.CAPTURE|I.EP_CAPTURE)&&(t.piece===oe&&(r+=Pe(t.from)[0]),r+="x"),r+=Pe(t.to),t.promotion&&(r+="="+t.promotion.toUpperCase())}return this._makeMove(t),this.isCheck()&&(this.isCheckmate()?r+="#":r+="+"),this._undoMove(),r}_moveFromSan(t,n=!1){const r=fs(t);let i=Ra(r),o=this._moves({legal:!0,piece:i});for(let f=0,y=o.length;f0?r+=this.perft(t-1):r++),this._undoMove();return r}_makePretty(t){const{color:n,piece:r,from:i,to:o,flags:s,captured:l,promotion:u}=t;let a="";for(const y in I)I[y]&s&&(a+=Wg[y]);const g=Pe(i),p=Pe(o),f={color:n,piece:r,from:g,to:p,san:this._moveToSan(t,this._moves({legal:!0})),flags:a,lan:g+p,before:this.fen(),after:""};return this._makeMove(t),f.after=this.fen(),this._undoMove(),l&&(f.captured=l),u&&(f.promotion=u,f.lan+=u),f}turn(){return this._turn}board(){const t=[];let n=[];for(let r=R.a8;r<=R.h1;r++)this._board[r]==null?n.push(null):n.push({square:Pe(r),type:this._board[r].type,color:this._board[r].color}),r+1&136&&(t.push(n),n=[],r+=8);return t}squareColor(t){if(t in R){const n=R[t];return(ln(n)+$r(n))%2===0?"light":"dark"}return null}history({verbose:t=!1}={}){const n=[],r=[];for(;this._history.length>0;)n.push(this._undoMove());for(;;){const i=n.pop();if(!i)break;t?r.push(this._makePretty(i)):r.push(this._moveToSan(i,this._moves())),this._makeMove(i)}return r}_pruneComments(){const t=[],n={},r=i=>{i in this._comments&&(n[i]=this._comments[i])};for(;this._history.length>0;)t.push(this._undoMove());for(r(this.fen());;){const i=t.pop();if(!i)break;this._makeMove(i),r(this.fen())}this._comments=n}getComment(){return this._comments[this.fen()]}setComment(t){this._comments[this.fen()]=t.replace("{","[").replace("}","]")}deleteComment(){const t=this._comments[this.fen()];return delete this._comments[this.fen()],t}getComments(){return this._pruneComments(),Object.keys(this._comments).map(t=>({fen:t,comment:this._comments[t]}))}deleteComments(){return this._pruneComments(),Object.keys(this._comments).map(t=>{const n=this._comments[t];return delete this._comments[t],{fen:t,comment:n}})}setCastlingRights(t,n){for(const i of[ne,Lt])n[i]!==void 0&&(n[i]?this._castling[t]|=vi[i]:this._castling[t]&=~vi[i]);this._updateCastlingRights();const r=this.getCastlingRights(t);return(n[ne]===void 0||n[ne]===r[ne])&&(n[Lt]===void 0||n[Lt]===r[Lt])}getCastlingRights(t){return{[ne]:(this._castling[t]&vi[ne])!==0,[Lt]:(this._castling[t]&vi[Lt])!==0}}moveNumber(){return this._moveNumber}}function r0(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Fe(1));return n(Of)(e,t)}if(typeof e!="function")throw new Error(Fe(2));var i=e,o=t,s=[],l=s,u=!1;function a(){l===s&&(l=s.slice())}function g(){if(u)throw new Error(Fe(3));return o}function p(v){if(typeof v!="function")throw new Error(Fe(4));if(u)throw new Error(Fe(5));var E=!0;return a(),l.push(v),function(){if(E){if(u)throw new Error(Fe(6));E=!1,a();var c=l.indexOf(v);l.splice(c,1),s=null}}}function f(v){if(!i0(v))throw new Error(Fe(7));if(typeof v.type>"u")throw new Error(Fe(8));if(u)throw new Error(Fe(9));try{u=!0,o=i(o,v)}finally{u=!1}for(var E=s=l,d=0;dr&&r[i]?r[i]:n||null,e)}function l0(e,t){return e.filter(n=>n!==t)}function Tf(e){return typeof e=="object"}function u0(e,t){const n=new Map,r=o=>{n.set(o,n.has(o)?n.get(o)+1:1)};e.forEach(r),t.forEach(r);const i=[];return n.forEach((o,s)=>{o===1&&i.push(s)}),i}function a0(e,t){return e.filter(n=>t.indexOf(n)>-1)}const gu="dnd-core/INIT_COORDS",ko="dnd-core/BEGIN_DRAG",mu="dnd-core/PUBLISH_DRAG_SOURCE",_o="dnd-core/HOVER",xo="dnd-core/DROP",Oo="dnd-core/END_DRAG";function za(e,t){return{type:gu,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const c0={type:gu,payload:{clientOffset:null,sourceClientOffset:null}};function d0(e){return function(n=[],r={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:s}=r,l=e.getMonitor(),u=e.getRegistry();e.dispatch(za(o)),f0(n,l,u);const a=g0(n,l);if(a==null){e.dispatch(c0);return}let g=null;if(o){if(!s)throw new Error("getSourceClientOffset must be defined");h0(s),g=s(a)}e.dispatch(za(o,g));const f=u.getSource(a).beginDrag(l,a);if(f==null)return;p0(f),u.pinSource(a);const y=u.getSourceType(a);return{type:ko,payload:{itemType:y,item:f,sourceId:a,clientOffset:o||null,sourceClientOffset:g||null,isSourcePublic:!!i}}}}function f0(e,t,n){L(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(r){L(n.getSource(r),"Expected sourceIds to be registered.")})}function h0(e){L(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function p0(e){L(Tf(e),"Item must be an object.")}function g0(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function m0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v0(e){for(var t=1;t{const u=w0(s,l,i,r),a={type:xo,payload:{dropResult:v0({},n,u)}};e.dispatch(a)})}}function S0(e){L(e.isDragging(),"Cannot call drop while not dragging."),L(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function w0(e,t,n,r){const i=n.getTarget(e);let o=i?i.drop(r,e):void 0;return E0(o),typeof o>"u"&&(o=t===0?{}:r.getDropResult()),o}function E0(e){L(typeof e>"u"||Tf(e),"Drop result must either be an object or undefined.")}function C0(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function k0(e){return function(){const n=e.getMonitor(),r=e.getRegistry();_0(n);const i=n.getSourceId();return i!=null&&(r.getSource(i,!0).endDrag(n,i),r.unpinSource()),{type:Oo}}}function _0(e){L(e.isDragging(),"Cannot call endDrag while not dragging.")}function gl(e,t){return t===null?e===null:Array.isArray(e)?e.some(n=>n===t):e===t}function x0(e){return function(n,{clientOffset:r}={}){O0(n);const i=n.slice(0),o=e.getMonitor(),s=e.getRegistry(),l=o.getItemType();return D0(i,s,l),T0(i,o,s),P0(i,o,s),{type:_o,payload:{targetIds:i,clientOffset:r||null}}}}function O0(e){L(Array.isArray(e),"Expected targetIds to be an array.")}function T0(e,t,n){L(t.isDragging(),"Cannot call hover while not dragging."),L(!t.didDrop(),"Cannot call hover after drop.");for(let r=0;r=0;r--){const i=e[r],o=t.getTargetType(i);gl(o,n)||e.splice(r,1)}}function P0(e,t,n){e.forEach(function(r){n.getTarget(r).hover(t,r)})}function N0(e){return function(){if(e.getMonitor().isDragging())return{type:mu}}}function I0(e){return{beginDrag:d0(e),publishDragSource:N0(e),hover:x0(e),drop:y0(e),endDrag:k0(e)}}class L0{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:n}=this.store;function r(o){return(...s)=>{const l=o.apply(t,s);typeof l<"u"&&n(l)}}const i=I0(this);return Object.keys(i).reduce((o,s)=>{const l=i[s];return o[s]=r(l),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,n){this.isSetUp=!1,this.handleRefCountChange=()=>{const r=this.store.getState().refCount>0;this.backend&&(r&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!r&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}}function j0(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Df(e,t){return{x:e.x-t.x,y:e.y-t.y}}function R0(e){const{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:Df(j0(t,r),n)}function M0(e){const{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:Df(t,n)}const Er=[],vu=[];Er.__IS_NONE__=!0;vu.__IS_ALL__=!0;function A0(e,t){return e===Er?!1:e===vu||typeof t>"u"?!0:a0(t,e).length>0}class b0{subscribeToStateChange(t,n={}){const{handlerIds:r}=n;L(typeof t=="function","listener must be a function."),L(typeof r>"u"||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const s=this.store.getState(),l=s.stateId;try{l===i||l===i+1&&!A0(s.dirtyHandlerIds,r)||t()}finally{i=l}};return this.store.subscribe(o)}subscribeToOffsetChange(t){L(typeof t=="function","listener must be a function.");let n=this.store.getState().dragOffset;const r=()=>{const i=this.store.getState().dragOffset;i!==n&&(n=i,t())};return this.store.subscribe(r)}canDragSource(t){if(!t)return!1;const n=this.registry.getSource(t);return L(n,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:n.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const n=this.registry.getTarget(t);if(L(n,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const r=this.registry.getTargetType(t),i=this.getItemType();return gl(r,i)&&n.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const n=this.registry.getSource(t,!0);if(L(n,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const r=this.registry.getSourceType(t),i=this.getItemType();return r!==i?!1:n.isDragging(this,t)}isOverTarget(t,n={shallow:!1}){if(!t)return!1;const{shallow:r}=n;if(!this.isDragging())return!1;const i=this.registry.getTargetType(t),o=this.getItemType();if(o&&!gl(i,o))return!1;const s=this.getTargetIds();if(!s.length)return!1;const l=s.indexOf(t);return r?l===s.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return R0(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return M0(this.store.getState().dragOffset)}constructor(t,n){this.store=t,this.registry=n}}const Fa=typeof global<"u"?global:self,Pf=Fa.MutationObserver||Fa.WebKitMutationObserver;function Nf(e){return function(){const n=setTimeout(i,0),r=setInterval(i,50);function i(){clearTimeout(n),clearInterval(r),e()}}}function z0(e){let t=1;const n=new Pf(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}const F0=typeof Pf=="function"?z0:Nf;class $0{enqueueTask(t){const{queue:n,requestFlush:r}=this;n.length||(r(),this.flushing=!0),n[n.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let r=0,i=t.length-this.index;r{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=F0(this.flush),this.requestErrorThrow=Nf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class U0{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}class H0{create(t){const n=this.freeTasks,r=n.length?n.pop():new U0(this.onError,i=>n[n.length]=i);return r.task=t,r}constructor(t){this.onError=t,this.freeTasks=[]}}const If=new $0,W0=new H0(If.registerPendingError);function B0(e){If.enqueueTask(W0.create(e))}const yu="dnd-core/ADD_SOURCE",Su="dnd-core/ADD_TARGET",wu="dnd-core/REMOVE_SOURCE",To="dnd-core/REMOVE_TARGET";function V0(e){return{type:yu,payload:{sourceId:e}}}function Q0(e){return{type:Su,payload:{targetId:e}}}function K0(e){return{type:wu,payload:{sourceId:e}}}function q0(e){return{type:To,payload:{targetId:e}}}function G0(e){L(typeof e.canDrag=="function","Expected canDrag to be a function."),L(typeof e.beginDrag=="function","Expected beginDrag to be a function."),L(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Y0(e){L(typeof e.canDrop=="function","Expected canDrop to be a function."),L(typeof e.hover=="function","Expected hover to be a function."),L(typeof e.drop=="function","Expected beginDrag to be a function.")}function ml(e,t){if(t&&Array.isArray(e)){e.forEach(n=>ml(n,!1));return}L(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var We;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(We||(We={}));let X0=0;function J0(){return X0++}function Z0(e){const t=J0().toString();switch(e){case We.SOURCE:return`S${t}`;case We.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function $a(e){switch(e[0]){case"S":return We.SOURCE;case"T":return We.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Ua(e,t){const n=e.entries();let r=!1;do{const{done:i,value:[,o]}=n.next();if(o===t)return!0;r=!!i}while(!r);return!1}class e1{addSource(t,n){ml(t),G0(n);const r=this.addHandler(We.SOURCE,t,n);return this.store.dispatch(V0(r)),r}addTarget(t,n){ml(t,!0),Y0(n);const r=this.addHandler(We.TARGET,t,n);return this.store.dispatch(Q0(r)),r}containsHandler(t){return Ua(this.dragSources,t)||Ua(this.dropTargets,t)}getSource(t,n=!1){return L(this.isSourceId(t),"Expected a valid source ID."),n&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return L(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return L(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return L(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return $a(t)===We.SOURCE}isTargetId(t){return $a(t)===We.TARGET}removeSource(t){L(this.getSource(t),"Expected an existing source."),this.store.dispatch(K0(t)),B0(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){L(this.getTarget(t),"Expected an existing target."),this.store.dispatch(q0(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const n=this.getSource(t);L(n,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=n}unpinSource(){L(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,n,r){const i=Z0(t);return this.types.set(i,n),t===We.SOURCE?this.dragSources.set(i,r):t===We.TARGET&&this.dropTargets.set(i,r),i}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const t1=(e,t)=>e===t;function n1(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function r1(e,t,n=t1){if(e.length!==t.length)return!1;for(let r=0;r0||!r1(n,r)))return Er;const s=r[r.length-1],l=n[n.length-1];return s!==l&&(s&&i.push(s),l&&i.push(l)),i}function o1(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s1(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function S1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o=0)&&(n[i]=e[i]);return n}let Wa=0;const ji=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var w1=C.memo(function(t){var{children:n}=t,r=y1(t,["children"]);const[i,o]=E1(r);return C.useEffect(()=>{if(o){const s=Lf();return++Wa,()=>{--Wa===0&&(s[ji]=null)}}},[]),S.jsx(xf.Provider,{value:i,children:n})});function E1(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=C1(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}function C1(e,t=Lf(),n,r){const i=t;return i[ji]||(i[ji]={dragDropManager:m1(e,t,n,r)}),i[ji]}function Lf(){return typeof global<"u"?global:window}var k1=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const hn=typeof window<"u"?C.useLayoutEffect:C.useEffect;function jf(e,t,n){const[r,i]=C.useState(()=>t(e)),o=C.useCallback(()=>{const s=t(e);k1(r,s)||(i(s),n&&n())},[r,e,n]);return hn(o),[r,o]}function _1(e,t,n){const[r,i]=jf(e,t,n);return hn(function(){const s=e.getHandlerId();if(s!=null)return e.subscribeToStateChange(i,{handlerIds:[s]})},[e,i]),r}function Rf(e,t,n){return _1(t,e||(()=>({})),()=>n.reconnect())}function Mf(e,t){const n=[...t||[]];return t==null&&typeof e!="function"&&n.push(e),C.useMemo(()=>typeof e=="function"?e():e,n)}function x1(e){return C.useMemo(()=>e.hooks.dragSource(),[e])}function O1(e){return C.useMemo(()=>e.hooks.dragPreview(),[e])}let ps=!1,gs=!1;class T1{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){L(!ps,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ps=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{ps=!1}}isDragging(){if(!this.sourceId)return!1;L(!gs,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return gs=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{gs=!1}}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,n){return this.internalMonitor.isOverTarget(t,n)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let ms=!1;class D1{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}canDrop(){if(!this.targetId)return!1;L(!ms,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return ms=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ms=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function P1(e,t,n){const r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function N1(e,t,n){const r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function vl(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let u=0;u, or turn it into a drag source or a drop target itself.`)}function L1(e){return(t=null,n=null)=>{if(!C.isValidElement(t)){const o=t;return e(o,n),o}const r=t;return I1(r),j1(r,n?o=>e(o,n):e)}}function Af(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const i=L1(r);t[n]=()=>i}}),t}function Ba(e,t){typeof e=="function"?e(t):e.current=t}function j1(e,t){const n=e.ref;return L(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?C.cloneElement(e,{ref:r=>{Ba(n,r),Ba(t,r)}}):C.cloneElement(e,{ref:t})}class R1{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return n&&this.disconnectDragSource(),this.handlerId?t?(n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),n):(this.lastConnectedDragSource=t,n):n}reconnectDragPreview(t=!1){const n=this.dragPreview,r=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),!!this.handlerId){if(!n){this.lastConnectedDragPreview=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!vl(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!vl(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=Af({dragSource:(n,r)=>{this.clearDragSource(),this.dragSourceOptions=r||null,yl(n)?this.dragSourceRef=n:this.dragSourceNode=n,this.reconnectDragSource()},dragPreview:(n,r)=>{this.clearDragPreview(),this.dragPreviewOptions=r||null,yl(n)?this.dragPreviewRef=n:this.dragPreviewNode=n,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class M1{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!vl(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=Af({dropTarget:(n,r)=>{this.clearDropTarget(),this.dropTargetOptions=r,yl(n)?this.dropTargetRef=n:this.dropTargetNode=n,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function mn(){const{dragDropManager:e}=C.useContext(xf);return L(e!=null,"Expected drag drop context"),e}function A1(e,t){const n=mn(),r=C.useMemo(()=>new R1(n.getBackend()),[n]);return hn(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),hn(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function b1(){const e=mn();return C.useMemo(()=>new T1(e),[e])}class z1{beginDrag(){const t=this.spec,n=this.monitor;let r=null;return typeof t.item=="object"?r=t.item:typeof t.item=="function"?r=t.item(n):r={},r??null}canDrag(){const t=this.spec,n=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(n):!0}isDragging(t,n){const r=this.spec,i=this.monitor,{isDragging:o}=r;return o?o(i):n===t.getSourceId()}endDrag(){const t=this.spec,n=this.monitor,r=this.connector,{end:i}=t;i&&i(n.getItem(),n),r.reconnect()}constructor(t,n,r){this.spec=t,this.monitor=n,this.connector=r}}function F1(e,t,n){const r=C.useMemo(()=>new z1(e,t,n),[t,n]);return C.useEffect(()=>{r.spec=e},[e]),r}function $1(e){return C.useMemo(()=>{const t=e.type;return L(t!=null,"spec.type must be defined"),t},[e])}function U1(e,t,n){const r=mn(),i=F1(e,t,n),o=$1(e);hn(function(){if(o!=null){const[l,u]=N1(o,i,r);return t.receiveHandlerId(l),n.receiveHandlerId(l),u}},[r,t,n,i,o])}function H1(e,t){const n=Mf(e,t);L(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=b1(),i=A1(n.options,n.previewOptions);return U1(n,r,i),[Rf(n.collect,r,i),x1(i),O1(i)]}function W1(e){const n=mn().getMonitor(),[r,i]=jf(n,e);return C.useEffect(()=>n.subscribeToOffsetChange(i)),C.useEffect(()=>n.subscribeToStateChange(i)),r}function B1(e){return C.useMemo(()=>e.hooks.dropTarget(),[e])}function V1(e){const t=mn(),n=C.useMemo(()=>new M1(t.getBackend()),[t]);return hn(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Q1(){const e=mn();return C.useMemo(()=>new D1(e),[e])}function K1(e){const{accept:t}=e;return C.useMemo(()=>(L(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class q1{canDrop(){const t=this.spec,n=this.monitor;return t.canDrop?t.canDrop(n.getItem(),n):!0}hover(){const t=this.spec,n=this.monitor;t.hover&&t.hover(n.getItem(),n)}drop(){const t=this.spec,n=this.monitor;if(t.drop)return t.drop(n.getItem(),n)}constructor(t,n){this.spec=t,this.monitor=n}}function G1(e,t){const n=C.useMemo(()=>new q1(e,t),[t]);return C.useEffect(()=>{n.spec=e},[e]),n}function Y1(e,t,n){const r=mn(),i=G1(e,t),o=K1(e);hn(function(){const[l,u]=P1(o,i,r);return t.receiveHandlerId(l),n.receiveHandlerId(l),u},[r,t,i,n,o.map(s=>s.toString()).join("|")])}function X1(e,t){const n=Mf(e,t),r=Q1(),i=V1(n.options);return Y1(n,r,i),[Rf(n.collect,r,i),B1(i)]}function bf(e){let t=null;return()=>(t==null&&(t=e()),t)}function J1(e,t){return e.filter(n=>n!==t)}function Z1(e,t){const n=new Set,r=o=>n.add(o);e.forEach(r),t.forEach(r);const i=[];return n.forEach(o=>i.push(o)),i}class em{enter(t){const n=this.entered.length,r=i=>this.isNodeInDocument(i)&&(!i.contains||i.contains(t));return this.entered=Z1(this.entered.filter(r),[t]),n===0&&this.entered.length>0}leave(t){const n=this.entered.length;return this.entered=J1(this.entered.filter(this.isNodeInDocument),t),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class tm{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const n={};Object.keys(this.config.exposeProperties).forEach(r=>{const i=this.config.exposeProperties[r];i!=null&&(n[r]={value:i(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,n){return n===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const zf="__NATIVE_FILE__",Ff="__NATIVE_URL__",$f="__NATIVE_TEXT__",Uf="__NATIVE_HTML__";var Va=Object.freeze({__proto__:null,FILE:zf,HTML:Uf,TEXT:$f,URL:Ff});function vs(e,t,n){const r=t.reduce((i,o)=>i||e.getData(o),"");return r??n}const Sl={[zf]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Uf]:{exposeProperties:{html:(e,t)=>vs(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[Ff]:{exposeProperties:{urls:(e,t)=>vs(e,t,"").split(` +`),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[$f]:{exposeProperties:{text:(e,t)=>vs(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function nm(e,t){const n=Sl[e];if(!n)throw new Error(`native type ${e} has no configuration`);const r=new tm(n);return r.loadDataTransfer(t),r}function ys(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Sl).filter(n=>{const r=Sl[n];return r!=null&&r.matchesTypes?r.matchesTypes.some(i=>t.indexOf(i)>-1):!1})[0]||null}const rm=bf(()=>/firefox/i.test(navigator.userAgent)),Hf=bf(()=>!!window.safari);class Qa{interpolate(t){const{xs:n,ys:r,c1s:i,c2s:o,c3s:s}=this;let l=n.length-1;if(t===n[l])return r[l];let u=0,a=s.length-1,g;for(;u<=a;){g=Math.floor(.5*(u+a));const y=n[g];if(yt)a=g-1;else return r[g]}l=Math.max(0,a);const p=t-n[l],f=p*p;return r[l]+i[l]*p+o[l]*f+s[l]*p*f}constructor(t,n){const{length:r}=t,i=[];for(let y=0;yt[y]{let O=new Qa([0,.5,1],[u.y,u.y/g*m,u.y+m-g]).interpolate(f);return Hf()&&o&&(O+=(window.devicePixelRatio-1)*m),O},E=()=>new Qa([0,.5,1],[u.x,u.x/a*y,u.x+y-a]).interpolate(p),{offsetX:d,offsetY:c}=i,h=d===0||d,w=c===0||c;return{x:h?d:E(),y:w?c:v()}}let um=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,n){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=n}};function am(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ka(e){for(var t=1;t{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,n,r){this.sourceNodes.set(t,n),this.sourceNodeOptions.set(t,r);const i=s=>this.handleDragStart(s,t),o=s=>this.handleSelectStart(s);return n.setAttribute("draggable","true"),n.addEventListener("dragstart",i),n.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),n.removeEventListener("dragstart",i),n.removeEventListener("selectstart",o),n.setAttribute("draggable","false")}}connectDropTarget(t,n){const r=s=>this.handleDragEnter(s,t),i=s=>this.handleDragOver(s,t),o=s=>this.handleDrop(s,t);return n.addEventListener("dragenter",r),n.addEventListener("dragover",i),n.addEventListener("drop",o),()=>{n.removeEventListener("dragenter",r),n.removeEventListener("dragover",i),n.removeEventListener("drop",o)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(t);return Ka({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(t);return Ka({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(Va).some(n=>Va[n]===t)}beginDragNativeItem(t,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=nm(t,n),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const n=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var r;return(r=this.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},n)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,n){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}handleDragEnter(t,n){this.dragEnterTargetIds.unshift(n)}handleDragOver(t,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}handleDrop(t,n){this.dropTargetIds.unshift(n)}constructor(t,n,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&Wf(o)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=i=>!!(i&&this.document&&this.document.body&&this.document.body.contains(i)),this.endDragIfSourceWasRemovedFromDOM=()=>{const i=this.currentDragSourceNode;i==null||this.isNodeInDocument(i)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=i=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(i||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=i=>{if(i.defaultPrevented)return;const{dragStartSourceIds:o}=this;this.dragStartSourceIds=null;const s=yi(i);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:s});const{dataTransfer:l}=i,u=ys(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const g=this.monitor.getSourceId(),p=this.sourceNodes.get(g),f=this.sourcePreviewNodes.get(g)||p;if(f){const{anchorX:y,anchorY:m,offsetX:v,offsetY:E}=this.getCurrentSourcePreviewNodeOptions(),h=lm(p,f,s,{anchorX:y,anchorY:m},{offsetX:v,offsetY:E});l.setDragImage(f,h.x,h.y)}}try{l==null||l.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(i.target);const{captureDraggingState:a}=this.getCurrentSourcePreviewNodeOptions();a?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(u)this.beginDragNativeItem(u);else{if(l&&!l.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=i=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}if(!this.enterLeaveCounter.enter(i.target)||this.monitor.isDragging())return;const{dataTransfer:l}=i,u=ys(l);u&&this.beginDragNativeItem(u,l)},this.handleTopDragEnter=i=>{const{dragEnterTargetIds:o}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=i.altKey,o.length>0&&this.actions.hover(o,{clientOffset:yi(i)}),o.some(l=>this.monitor.canDropOnTarget(l))&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=i=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}},this.handleTopDragOver=i=>{const{dragOverTargetIds:o}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}this.altKeyPressed=i.altKey,this.lastClientOffset=yi(i),this.scheduleHover(o),(o||[]).some(l=>this.monitor.canDropOnTarget(l))?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=i=>{this.isDraggingNativeItem()&&i.preventDefault(),this.enterLeaveCounter.leave(i.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=i=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var o;i.preventDefault(),(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else ys(i.dataTransfer)&&i.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=i=>{const{dropTargetIds:o}=this;this.dropTargetIds=[],this.actions.hover(o,{clientOffset:yi(i)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=i=>{const o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))},this.options=new um(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new em(this.isNodeInDocument)}}let Si;function dm(){return Si||(Si=new Image,Si.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Si}const fm=function(t,n,r){return new cm(t,n,r)};var Qt;(function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"})(Qt||(Qt={}));class hm{get delay(){var t;return(t=this.args.delay)!==null&&t!==void 0?t:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var t;return(t=this.args.ignoreContextMenu)!==null&&t!==void 0?t:!1}get enableHoverOutsideTarget(){var t;return(t=this.args.enableHoverOutsideTarget)!==null&&t!==void 0?t:!1}get enableKeyboardEvents(){var t;return(t=this.args.enableKeyboardEvents)!==null&&t!==void 0?t:!1}get enableMouseEvents(){var t;return(t=this.args.enableMouseEvents)!==null&&t!==void 0?t:!1}get enableTouchEvents(){var t;return(t=this.args.enableTouchEvents)!==null&&t!==void 0?t:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var t,n,r,i;return(i=(r=(t=this.args)===null||t===void 0?void 0:t.delayTouchStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get delayMouseStart(){var t,n,r,i;return(i=(r=(t=this.args)===null||t===void 0?void 0:t.delayMouseStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var t;if(!((t=this.context)===null||t===void 0)&&t.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var t;return((t=this.args)===null||t===void 0?void 0:t.rootElement)||this.document}constructor(t,n){this.args=t,this.context=n}}function pm(e,t,n,r){return Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(r-t),2))}function gm(e,t,n,r,i){if(!i)return!1;const o=Math.atan2(r-t,n-e)*180/Math.PI+180;for(let s=0;s=l.start)&&(l.end==null||o<=l.end))return!0}return!1}const mm={Left:1,Right:2,Center:4},vm={Left:0,Center:1,Right:2};function Ss(e){return e.button===void 0||e.button===vm.Left}function ym(e){return e.buttons===void 0||(e.buttons&mm.Left)===0}function Bf(e){return!!e.targetTouches}const Sm=1;function wm(e){const t=e.nodeType===Sm?e:e.parentElement;if(!t)return;const{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function Em(e,t){if(e.targetTouches.length===1)return oo(e.targetTouches[0]);if(t&&e.touches.length===1&&e.touches[0].target===t.target)return oo(e.touches[0])}function oo(e,t){return Bf(e)?Em(e,t):{x:e.clientX,y:e.clientY}}const qa=(()=>{let e=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return e=!0,!0}}))}catch{}return e})(),or={[Qt.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Qt.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Qt.keyboard]:{keydown:"keydown"}};class Cr{profile(){var t;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((t=this.dragOverTargetIds)===null||t===void 0?void 0:t.length)||0}}get document(){return this.options.document}setup(){const t=this.options.rootElement;t&&(L(!Cr.isSetUp,"Cannot have two Touch backends at the same time."),Cr.isSetUp=!0,this.addEventListener(t,"start",this.getTopMoveStartHandler()),this.addEventListener(t,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(t,"move",this.handleTopMove),this.addEventListener(t,"move",this.handleTopMoveCapture,!0),this.addEventListener(t,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(t,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(t,"keydown",this.handleCancelOnEscape,!0))}teardown(){const t=this.options.rootElement;t&&(Cr.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(t,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(t,"start",this.handleTopMoveStart),this.removeEventListener(t,"move",this.handleTopMoveCapture,!0),this.removeEventListener(t,"move",this.handleTopMove),this.removeEventListener(t,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(t,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(t,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(t,n,r,i=!1){const o=qa?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(s){const l=or[s][n];l&&t.addEventListener(l,r,o)})}removeEventListener(t,n,r,i=!1){const o=qa?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(s){const l=or[s][n];l&&t.removeEventListener(l,r,o)})}connectDragSource(t,n){const r=this.handleMoveStart.bind(this,t);return this.sourceNodes.set(t,n),this.addEventListener(n,"start",r),()=>{this.sourceNodes.delete(t),this.removeEventListener(n,"start",r)}}connectDragPreview(t,n,r){return this.sourcePreviewNodeOptions.set(t,r),this.sourcePreviewNodes.set(t,n),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDropTarget(t,n){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const i=o=>{if(!this.document||!r||!this.monitor.isDragging())return;let s;switch(o.type){case or.mouse.move:s={x:o.clientX,y:o.clientY};break;case or.touch.move:var l,u;s={x:((l=o.touches[0])===null||l===void 0?void 0:l.clientX)||0,y:((u=o.touches[0])===null||u===void 0?void 0:u.clientY)||0};break}const a=s!=null?this.document.elementFromPoint(s.x,s.y):void 0,g=a&&n.contains(a);if(a===n||g)return this.handleMove(o,t)};return this.addEventListener(this.document.body,"move",i),this.targetNodes.set(t,n),()=>{this.document&&(this.targetNodes.delete(t),this.removeEventListener(this.document.body,"move",i))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(t){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=t,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{t&&!t.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!t||!t.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(t.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(t,n,r){this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&wm(o)},this.handleTopMoveStartCapture=i=>{Ss(i)&&(this.moveStartSourceIds=[])},this.handleMoveStart=i=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(i)},this.handleTopMoveStart=i=>{if(!Ss(i))return;const o=oo(i);o&&(Bf(i)&&(this.lastTargetTouchFallback=i.targetTouches[0]),this._mouseClientOffset=o),this.waitingForDelay=!1},this.handleTopMoveStartDelay=i=>{if(!Ss(i))return;const o=i.type===or.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,i),o),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(i,o)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(o)},this.handleTopMove=i=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:o,dragOverTargetIds:s}=this,l=this.options.enableHoverOutsideTarget,u=oo(i,this.lastTargetTouchFallback);if(!u)return;if(this._isScrolling||!this.monitor.isDragging()&&gm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,u.x,u.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&o&&pm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,u.x,u.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(o,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const a=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(a),this.actions.publishDragSource(),i.cancelable&&i.preventDefault();const g=(s||[]).map(m=>this.targetNodes.get(m)).filter(m=>!!m),p=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(u.x,u.y,g):this.document.elementsFromPoint(u.x,u.y),f=[];for(const m in p){if(!p.hasOwnProperty(m))continue;let v=p[m];for(v!=null&&f.push(v);v;)v=v.parentElement,v&&f.indexOf(v)===-1&&f.push(v)}const y=f.filter(m=>g.indexOf(m)>-1).map(m=>this._getDropTargetId(m)).filter(m=>!!m).filter((m,v,E)=>E.indexOf(m)===v);if(l)for(const m in this.targetNodes){const v=this.targetNodes.get(m);if(a&&v&&v.contains(a)&&y.indexOf(m)===-1){y.unshift(m);break}}y.reverse(),this.actions.hover(y,{clientOffset:u})},this._getDropTargetId=i=>{const o=this.targetNodes.keys();let s=o.next();for(;s.done===!1;){const l=s.value;if(i===this.targetNodes.get(l))return l;s=o.next()}},this.handleTopMoveEndCapture=i=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!ym(i)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}i.cancelable&&i.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=i=>{i.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new hm(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Qt.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Qt.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Qt.keyboard)}}const Cm=function(t,n={},r={}){return new Cr(t,n,r)},Ur="abcdefgh".split(""),Ri={a8:"bR",b8:"bN",c8:"bB",d8:"bQ",e8:"bK",f8:"bB",g8:"bN",h8:"bR",a7:"bP",b7:"bP",c7:"bP",d7:"bP",e7:"bP",f7:"bP",g7:"bP",h7:"bP",a2:"wP",b2:"wP",c2:"wP",d2:"wP",e2:"wP",f2:"wP",g2:"wP",h2:"wP",a1:"wR",b1:"wN",c1:"wB",d1:"wQ",e1:"wK",f1:"wB",g1:"wN",h1:"wR"},km={a:0,b:1,c:2,d:3,e:4,f:5,g:6,h:7},_m={a:7,b:6,c:5,d:4,e:3,f:2,g:1,h:0},xm=[7,6,5,4,3,2,1,0],Om=[0,1,2,3,4,5,6,7],Ga={wP:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsx("path",{d:"m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z",style:{opacity:"1",fill:"#ffffff",fillOpacity:"1",fillRule:"nonzero",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}})})),wR:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"#ffffff",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 34,14 L 31,17 L 14,17 L 11,14"}),S.jsx("path",{d:"M 31,17 L 31,29.5 L 14,29.5 L 14,17",style:{strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5"}),S.jsx("path",{d:"M 11,14 L 34,14",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}})]}))})),wN:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18",style:{fill:"#ffffff",stroke:"#000000"}}),S.jsx("path",{d:"M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10",style:{fill:"#ffffff",stroke:"#000000"}}),S.jsx("path",{d:"M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z",transform:"matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)",style:{fill:"#000000",stroke:"#000000"}})]}))})),wB:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillRule:"evenodd",fillOpacity:"1",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsxs("g",Object.assign({style:{fill:"#ffffff",stroke:"#000000",strokeLinecap:"butt"}},{children:[S.jsx("path",{d:"M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"}),S.jsx("path",{d:"M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"}),S.jsx("path",{d:"M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"})]})),S.jsx("path",{d:"M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}})]}))})),wQ:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"#ffffff",stroke:"#000000",strokeWidth:"1.5",strokeLinejoin:"round"}},{children:[S.jsx("path",{d:"M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"}),S.jsx("path",{d:"M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 11,36 11,36 C 9.5,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"}),S.jsx("path",{d:"M 11.5,30 C 15,29 30,29 33.5,30",style:{fill:"none"}}),S.jsx("path",{d:"M 12,33.5 C 18,32.5 27,32.5 33,33.5",style:{fill:"none"}}),S.jsx("circle",{cx:"6",cy:"12",r:"2"}),S.jsx("circle",{cx:"14",cy:"9",r:"2"}),S.jsx("circle",{cx:"22.5",cy:"8",r:"2"}),S.jsx("circle",{cx:"31",cy:"9",r:"2"}),S.jsx("circle",{cx:"39",cy:"12",r:"2"})]}))})),wK:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22.5,11.63 L 22.5,6",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 20,8 L 25,8",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25",style:{fill:"#ffffff",stroke:"#000000",strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37",style:{fill:"#ffffff",stroke:"#000000"}}),S.jsx("path",{d:"M 12.5,30 C 18,27 27,27 32.5,30",style:{fill:"none",stroke:"#000000"}}),S.jsx("path",{d:"M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5",style:{fill:"none",stroke:"#000000"}}),S.jsx("path",{d:"M 12.5,37 C 18,34 27,34 32.5,37",style:{fill:"none",stroke:"#000000"}})]}))})),bP:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsx("path",{d:"m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z",style:{opacity:"1",fill:"#000000",fillOpacity:"1",fillRule:"nonzero",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}})})),bR:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"#000000",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z ",style:{strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z ",style:{strokeLinecap:"butt"}}),S.jsx("path",{d:"M 12,35.5 L 33,35.5 L 33,35.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 13,31.5 L 32,31.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 14,29.5 L 31,29.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 14,16.5 L 31,16.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 11,14 L 34,14",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}})]}))})),bN:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z",style:{fill:"#ffffff",stroke:"#ffffff"}}),S.jsx("path",{d:"M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z",transform:"matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)",style:{fill:"#ffffff",stroke:"#ffffff"}}),S.jsx("path",{d:"M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z ",style:{fill:"#ffffff",stroke:"none"}})]}))})),bB:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillRule:"evenodd",fillOpacity:"1",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsxs("g",Object.assign({style:{fill:"#000000",stroke:"#000000",strokeLinecap:"butt"}},{children:[S.jsx("path",{d:"M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"}),S.jsx("path",{d:"M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"}),S.jsx("path",{d:"M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"})]})),S.jsx("path",{d:"M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18",style:{fill:"none",stroke:"#ffffff",strokeLinejoin:"miter"}})]}))})),bQ:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"#000000",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}},{children:[S.jsx("path",{d:"M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z",style:{strokeLinecap:"butt",fill:"#000000"}}),S.jsx("path",{d:"m 9,26 c 0,2 1.5,2 2.5,4 1,1.5 1,1 0.5,3.5 -1.5,1 -1,2.5 -1,2.5 -1.5,1.5 0,2.5 0,2.5 6.5,1 16.5,1 23,0 0,0 1.5,-1 0,-2.5 0,0 0.5,-1.5 -1,-2.5 -0.5,-2.5 -0.5,-2 0.5,-3.5 1,-2 2.5,-2 2.5,-4 -8.5,-1.5 -18.5,-1.5 -27,0 z"}),S.jsx("path",{d:"M 11.5,30 C 15,29 30,29 33.5,30"}),S.jsx("path",{d:"m 12,33.5 c 6,-1 15,-1 21,0"}),S.jsx("circle",{cx:"6",cy:"12",r:"2"}),S.jsx("circle",{cx:"14",cy:"9",r:"2"}),S.jsx("circle",{cx:"22.5",cy:"8",r:"2"}),S.jsx("circle",{cx:"31",cy:"9",r:"2"}),S.jsx("circle",{cx:"39",cy:"12",r:"2"}),S.jsx("path",{d:"M 11,38.5 A 35,35 1 0 0 34,38.5",style:{fill:"none",stroke:"#000000",strokeLinecap:"butt"}}),S.jsxs("g",Object.assign({style:{fill:"none",stroke:"#ffffff"}},{children:[S.jsx("path",{d:"M 11,29 A 35,35 1 0 1 34,29"}),S.jsx("path",{d:"M 12.5,31.5 L 32.5,31.5"}),S.jsx("path",{d:"M 11.5,34.5 A 35,35 1 0 0 33.5,34.5"}),S.jsx("path",{d:"M 10.5,37.5 A 35,35 1 0 0 34.5,37.5"})]}))]}))})),bK:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:S.jsxs("g",Object.assign({style:{fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[S.jsx("path",{d:"M 22.5,11.63 L 22.5,6",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"},id:"path6570"}),S.jsx("path",{d:"M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25",style:{fill:"#000000",fillOpacity:"1",strokeLinecap:"butt",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37",style:{fill:"#000000",stroke:"#000000"}}),S.jsx("path",{d:"M 20,8 L 25,8",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),S.jsx("path",{d:"M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.5,26.6 L 22.5,24.5 C 20,18 10.85,14 6.97,19.85 C 4.5,25.5 13,29.5 13,29.5",style:{fill:"none",stroke:"#ffffff"}}),S.jsx("path",{d:"M 12.5,30 C 18,27 27,27 32.5,30 M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5 M 12.5,37 C 18,34 27,34 32.5,37",style:{fill:"none",stroke:"#ffffff"}})]}))}))};function wl(e,t,n){const r=t/8,i=e==="white"?km:_m,o=e==="white"?xm:Om,s=i[n[0]]*r+r/2,l=o[parseInt(n[1],10)-1]*r+r/2;return{x:s,y:l}}function Ya(e){let t=!1;return Object.keys(Ri).forEach(n=>{e[n]!==Ri[n]&&(t=!0)}),Object.keys(e).forEach(n=>{Ri[n]!==e[n]&&(t=!0)}),t}function Tm(e,t){const n={removed:{},added:{}};return Object.keys(e).forEach(r=>{t[r]!==e[r]&&(n.removed[r]=e[r])}),Object.keys(t).forEach(r=>{e[r]!==t[r]&&(n.added[r]=t[r])}),n}function Xa(e){return e==="start"?Ri:typeof e=="string"?Dm(e):e}function Dm(e){if(!Pm(e))return{};e=e.replace(/ .+$/,"");const t=e.split("/"),n={};let r=8;for(let i=0;i<8;i++){const o=t[i].split("");let s=0;for(let l=0;l{const[i,o]=C.useState([]),[s,l]=C.useState([]),[u,a]=C.useState();C.useEffect(()=>{Array.isArray(e)&&o(e==null?void 0:e.filter(m=>m[0]!==m[1]))},[e]),C.useEffect(()=>{n==null||n(s)},[s]);function g(){l([]),a(void 0)}const p=(m,v)=>{t&&a([m,v,r])},f=[...s,...i];return{arrows:f,newArrow:u,clearArrows:g,drawNewArrow:p,setArrows:l,onArrowDrawEnd:(m,v)=>{if(m===v||!t)return;let E;const d=[m,v,r];f.every(([h,w])=>!(h===m&&w===v))?E=[...s,d]:E=s.filter(([h,w])=>!(h===m&&w===v)),a(void 0),l(E)}}},Vf=C.createContext({}),_t=()=>C.useContext(Vf),jm=C.forwardRef(({allowDragOutsideBoard:e=!0,animationDuration:t=300,areArrowsAllowed:n=!0,arePiecesDraggable:r=!0,arePremovesAllowed:i=!1,autoPromoteToQueen:o=!1,boardOrientation:s="white",boardWidth:l,children:u,clearPremovesOnRightClick:a=!0,customArrows:g,customArrowColor:p="rgb(255,170,0)",customBoardStyle:f,customDarkSquareStyle:y={backgroundColor:"#B58863"},customDropSquareStyle:m={boxShadow:"inset 0 0 1px 6px rgba(255,255,255,0.75)"},customLightSquareStyle:v={backgroundColor:"#F0D9B5"},customPieces:E,customPremoveDarkSquareStyle:d={backgroundColor:"#A42323"},customPremoveLightSquareStyle:c={backgroundColor:"#BD2828"},customSquare:h="div",customSquareStyles:w,dropOffBoardAction:k="snapback",id:O=0,isDraggablePiece:x=()=>!0,getPositionObject:T=()=>{},onArrowsChange:z=()=>{},onDragOverSquare:M=()=>{},onMouseOutSquare:$=()=>{},onMouseOverSquare:K=()=>{},onPieceClick:Ae=()=>{},onPieceDragBegin:be=()=>{},onPieceDragEnd:qe=()=>{},onPieceDrop:Ee=()=>!0,onPromotionCheck:dt=(Jt,xt,qr)=>(qr==="wP"&&Jt[1]==="7"&&xt[1]==="8"||qr==="bP"&&Jt[1]==="2"&&xt[1]==="1")&&Math.abs(Jt.charCodeAt(0)-xt.charCodeAt(0))<=1,onPromotionPieceSelect:D,onSquareClick:N=()=>{},onSquareRightClick:j=()=>{},position:H="start",promotionDialogVariant:X="default",promotionToSquare:ot=null,showBoardNotation:A=!0,showPromotionDialog:ft=!1,snapToCursor:Ge=!0},vn)=>{const[Jt,xt]=C.useState(Xa(H)),[qr,Jf]=C.useState({removed:{},added:{}}),[Po,yn]=C.useState(void 0),[Zf,No]=C.useState(ft&&!o),[eh,Eu]=C.useState(null),[th,Io]=C.useState(ot),[Cu,Lo]=C.useState([]),Ot=C.useRef(Cu),[jo,Gr]=C.useState(),[nh,rh]=C.useState(Object.assign(Object.assign({},Ga),E)),[ih,Yr]=C.useState(!1),[Ro,oh]=C.useState(),[Xr,Jr]=C.useState(!1);C.useImperativeHandle(vn,()=>({clearPremoves(ee=!0){Zr(ee)}})),C.useEffect(()=>{rh(Object.assign(Object.assign({},Ga),E))},[E]),C.useEffect(()=>{No(ft),Io(ot)},[ot,ft]),C.useEffect(()=>{var ee,de,Ye;bo();const De=Xa(H),ht=Tm(Jt,De),Xe=((ee=Object.keys(ht.added))===null||ee===void 0?void 0:ee.length)<=2?(Ye=(de=Object.entries(ht.added))===null||de===void 0?void 0:de[0])===null||Ye===void 0?void 0:Ye[1][0]:void 0;if(Xr)xt(De),Jr(!1),i&&Ao(Xe),Ro&&clearTimeout(Ro);else if(ih)xt(De),Jr(!1),i&&Ao(Xe);else{Ya(De)&&Po!==void 0?yn(Xe):Ya(De)?yn(void 0):yn("b"),Jf(ht),Jr(!0);const gh=setTimeout(()=>{xt(De),Jr(!1),i&&Ao(Xe)},t);oh(gh)}return Yr(!1),T(De),Mo(),()=>{clearTimeout(Ro)}},[H]);const{arrows:sh,newArrow:lh,clearArrows:Mo,drawNewArrow:uh,onArrowDrawEnd:ah}=Lm(g,n,z,p);function ch(ee,de,Ye,De){if(ee===de)return;if(Mo(),i&&Xr||i&&(Po===Ye[0]||Ot.current.filter(Xe=>Xe.piece[0]===Ye[0]).length>0)){const Xe=[...Ot.current];Xe.push({sourceSq:ee,targetSq:de,piece:Ye}),Ot.current=Xe,Lo([...Xe]),bo();return}if(!i&&Xr)return;const ht=Object.assign({},Jt);Yr(!!De),yn(Ye[0]),Ee.length?Ee(ee,de,Ye)||(Zr(),Yr(!1)):(k==="trash"&&!de&&delete ht[ee],delete ht[ee],ht[de]=Ye,xt(ht)),bo(),T(ht)}function Ao(ee){if(Ot.current.length===0)return;const de=Ot.current[0];if(de.piece[0]!==void 0&&de.piece[0]!==ee&&Ee.length)if(yn(de.piece[0]),Yr(!0),Ee(de.sourceSq,de.targetSq,de.piece)){const De=[...Ot.current];De.shift(),Ot.current=De,Lo([...De])}else Zr()}function Zr(ee=!0){ee&&yn(void 0),Ot.current=[],Lo([])}function bo(){Eu(null),Io(null),No(!1)}function dh(ee){Gr(ee)}function fh(ee){if(jo){if(jo===ee){Gr(void 0),a&&Zr(!1),j(ee);return}}else Gr(void 0)}function hh(){Gr(void 0)}const ph={animationDuration:t,arePiecesDraggable:r,arePremovesAllowed:i,boardOrientation:s,boardWidth:l,customArrowColor:p,customBoardStyle:f,customDarkSquareStyle:y,customDropSquareStyle:m,customLightSquareStyle:v,customPremoveDarkSquareStyle:d,customPremoveLightSquareStyle:c,customSquare:h,customSquareStyles:w,id:O,isDraggablePiece:x,onDragOverSquare:M,onMouseOutSquare:$,onMouseOverSquare:K,onPieceClick:Ae,onPieceDragBegin:be,onPieceDragEnd:qe,onPieceDrop:Ee,onPromotionCheck:dt,onPromotionPieceSelect:D,onSquareClick:N,showBoardNotation:A,snapToCursor:Ge,promotionDialogVariant:X,allowDragOutsideBoard:e,arrows:sh,newArrow:lh,onArrowDrawEnd:ah,chessPieces:nh,clearArrows:Mo,drawNewArrow:uh,clearCurrentRightClickDown:hh,currentPosition:Jt,handleSetPosition:ch,isWaitingForAnimation:Xr,lastPieceColour:Po,onRightClickDown:dh,onRightClickUp:fh,positionDifferences:qr,promoteFromSquare:eh,promoteToSquare:th,premoves:Cu,setPromoteFromSquare:Eu,setPromoteToSquare:Io,setShowPromoteDialog:No,showPromoteDialog:Zf,autoPromoteToQueen:o,currentRightClickDown:jo};return S.jsx(Vf.Provider,Object.assign({value:ph},{children:u}))});function Rm({row:e,col:t}){const{boardOrientation:n,boardWidth:r,customDarkSquareStyle:i,customLightSquareStyle:o}=_t(),s=o.backgroundColor,l=i.backgroundColor,u=t===0,a=e===7,g=u&&a;function p(){return n==="white"?8-e:e+1}function f(){return n==="black"?Ur[7-t]:Ur[t]}function y(){return S.jsxs(S.Fragment,{children:[S.jsx("div",Object.assign({style:Object.assign(Object.assign({zIndex:3,position:"absolute"},{color:s}),Za(r))},{children:p()})),S.jsx("div",Object.assign({style:Object.assign(Object.assign({zIndex:3,position:"absolute"},{color:s}),Ja(r))},{children:f()}))]})}function m(){return S.jsx("div",Object.assign({style:Object.assign(Object.assign({userSelect:"none",zIndex:3,position:"absolute"},{color:t%2!==0?l:s}),Ja(r))},{children:f()}))}function v(){return S.jsx("div",Object.assign({style:Object.assign(Object.assign({userSelect:"none",zIndex:3,position:"absolute"},n==="black"?{color:e%2===0?l:s}:{color:e%2===0?l:s}),Za(r))},{children:p()}))}return g?y():a?m():u?v():null}const Ja=e=>({alignSelf:"flex-end",paddingLeft:e/8-e/48,fontSize:e/48}),Za=e=>({alignSelf:"flex-start",paddingRight:e/8-e/48,fontSize:e/48});function ec({isPremovedPiece:e=!1,piece:t,square:n,squares:r}){const{animationDuration:i,arePiecesDraggable:o,arePremovesAllowed:s,boardWidth:l,boardOrientation:u,chessPieces:a,currentPosition:g,id:p,isDraggablePiece:f,isWaitingForAnimation:y,onPieceClick:m,onPieceDragBegin:v,onPieceDragEnd:E,positionDifferences:d,premoves:c,onPromotionCheck:h}=_t(),[w,k]=C.useState({opacity:1,zIndex:5,touchAction:"none",cursor:o&&f({piece:t,sourceSquare:n})?"-webkit-grab":"default"}),[{canDrag:O,isDragging:x},T,z]=H1(()=>({type:"piece",item:()=>(v(t,n),{piece:t,square:n,id:p}),end:()=>E(t,n),collect:$=>({canDrag:f({piece:t,sourceSquare:n}),isDragging:!!$.isDragging()})}),[t,n,g,p]);z(dm(),{captureDraggingState:!0}),C.useEffect(()=>{k($=>Object.assign(Object.assign({},$),{opacity:x?0:1}))},[x]),C.useEffect(()=>{if(!s)return;let $=!1;!e&&c.find(K=>K.targetSq===n)&&($=!0),c.find(K=>K.sourceSq===n&&K.piece===t)&&($=!0),k(K=>Object.assign(Object.assign({},K),{display:$?"none":"unset"}))},[g,c]),C.useEffect(()=>{var $;const K=($=d.removed)===null||$===void 0?void 0:$[n];if(!d.added||!K)return;const Ae=Object.entries(d.added).find(([be,qe])=>qe===K||h(n,be,K));if(y&&K&&Ae&&!e){const be=n,qe=Ae[0];if(be&&qe){const Ee=l/8;k(dt=>Object.assign(Object.assign({},dt),{transform:`translate(${(u==="black"?-1:1)*(qe.charCodeAt(0)-be.charCodeAt(0))*Ee}px, ${(u==="black"?-1:1)*(Number(be[1])-Number(qe[1]))*Ee}px)`,transition:`transform ${i}ms`,zIndex:6}))}}},[d]),C.useEffect(()=>{const{sourceSq:$}=M();$&&k(K=>Object.assign(Object.assign({},K),{transform:"translate(0px, 0px)",transition:"transform 0ms"}))},[g]),C.useEffect(()=>{k($=>Object.assign(Object.assign({},$),{cursor:o&&f({piece:t,sourceSquare:n})?"-webkit-grab":"default"}))},[n,g,o]);function M(){return{sourceSq:r[n]}}return S.jsx("div",Object.assign({ref:o&&O?T:null,onClick:()=>m(t),"data-piece":t,style:w},{children:typeof a[t]=="function"?a[t]({squareWidth:l/8,isDragging:x,square:n}):S.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:l/8,height:l/8},{children:S.jsx("g",{children:a[t]})}))}))}function Mm({square:e,squareColor:t,setSquares:n,squareHasPremove:r,children:i}){const o=C.useRef(null),{autoPromoteToQueen:s,boardWidth:l,boardOrientation:u,clearArrows:a,currentPosition:g,currentRightClickDown:p,customBoardStyle:f,customDarkSquareStyle:y,customDropSquareStyle:m,customLightSquareStyle:v,customPremoveDarkSquareStyle:E,customPremoveLightSquareStyle:d,customSquare:c,customSquareStyles:h,drawNewArrow:w,handleSetPosition:k,isWaitingForAnimation:O,lastPieceColour:x,onArrowDrawEnd:T,onDragOverSquare:z,onMouseOutSquare:M,onMouseOverSquare:$,onPieceDrop:K,onPromotionCheck:Ae,onRightClickDown:be,onRightClickUp:qe,onSquareClick:Ee,setPromoteFromSquare:dt,setPromoteToSquare:D,setShowPromoteDialog:N}=_t(),[{isOver:j},H]=X1(()=>({accept:"piece",drop:X,collect:A=>({isOver:!!A.isOver()})}),[e,g,K,O,x]);function X(A){Ae(A.square,e,A.piece)?s?k(A.square,e,A.piece[0]==="w"?"wQ":"bQ"):(dt(A.square),D(e),N(!0)):k(A.square,e,A.piece,!0)}C.useEffect(()=>{if(o.current){const{x:A,y:ft}=o.current.getBoundingClientRect();n(Ge=>Object.assign(Object.assign({},Ge),{[e]:{x:A,y:ft}}))}},[l,u]);const ot=Object.assign(Object.assign(Object.assign(Object.assign({},Am(e,u,f)),t==="black"?y:v),r&&(t==="black"?E:d)),j&&m);return S.jsx("div",Object.assign({ref:H,style:ot,"data-square-color":t,"data-square":e,onMouseOver:A=>{A.buttons===2&&p&&w(p,e),!(A.relatedTarget&&A.currentTarget.contains(A.relatedTarget))&&$(e)},onMouseOut:A=>{A.relatedTarget&&A.currentTarget.contains(A.relatedTarget)||M(e)},onMouseDown:A=>{A.button===2&&be(e)},onMouseUp:A=>{A.button===2&&(p&&T(p,e),qe(e))},onDragEnter:()=>z(e),onClick:()=>{Ee(e),a()},onContextMenu:A=>{A.preventDefault()}},{children:typeof c=="string"?S.jsx(c,Object.assign({ref:o,style:Object.assign(Object.assign(Object.assign({},nc(l)),tc),!r&&(h==null?void 0:h[e]))},{children:i})):S.jsx(c,Object.assign({ref:o,square:e,squareColor:t,style:Object.assign(Object.assign(Object.assign({},nc(l)),tc),!r&&(h==null?void 0:h[e]))},{children:i}))}))}const tc={display:"flex",justifyContent:"center"},nc=e=>({width:e/8,height:e/8}),Am=(e,t,n)=>n!=null&&n.borderRadius?e==="a1"?t==="white"?{borderBottomLeftRadius:n.borderRadius}:{borderTopRightRadius:n.borderRadius}:e==="a8"?t==="white"?{borderTopLeftRadius:n.borderRadius}:{borderBottomRightRadius:n.borderRadius}:e==="h1"?t==="white"?{borderBottomRightRadius:n.borderRadius}:{borderTopLeftRadius:n.borderRadius}:e==="h8"?t==="white"?{borderTopRightRadius:n.borderRadius}:{borderBottomLeftRadius:n.borderRadius}:{}:{};function bm(){const[e,t]=C.useState({}),{boardOrientation:n,boardWidth:r,currentPosition:i,id:o,premoves:s,showBoardNotation:l}=_t();return S.jsx("div",Object.assign({"data-boardid":o},{children:[...Array(8)].map((u,a)=>S.jsx("div",Object.assign({style:{display:"flex",flexWrap:"nowrap",width:r}},{children:[...Array(8)].map((g,p)=>{const f=n==="black"?Ur[7-p]+(a+1):Ur[p]+(8-a),y=p%2===a%2?"white":"black",m=s.find(E=>E.sourceSq===f||E.targetSq===f),v=s.find(E=>E.targetSq===f);return S.jsxs(Mm,Object.assign({square:f,squareColor:y,setSquares:t,squareHasPremove:!!m},{children:[i[f]&&S.jsx(ec,{piece:i[f],square:f,squares:e}),v&&S.jsx(ec,{isPremovedPiece:!0,piece:v.piece,square:f,squares:e}),l&&S.jsx(Rm,{row:a,col:p})]}),`${p}${a}`)})}),a.toString()))}))}const zm=()=>{const{arrows:e,newArrow:t,boardOrientation:n,boardWidth:r,customArrowColor:i}=_t(),o=[...e,t].filter(Boolean);return S.jsx("svg",Object.assign({width:r,height:r,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none",zIndex:"10"}},{children:o.map((s,l)=>{const[u,a,g]=s;if(u===a)return null;const p=wl(n,r,u),f=wl(n,r,a);let y=r/32;const m=l===e.length;e.some(h=>h[0]!==u&&h[1]===a)&&!m&&(y=r/16);const v=f.x-p.x,E=f.y-p.y,d=Math.hypot(E,v),c={x:p.x+v*(d-y)/d,y:p.y+E*(d-y)/d};return S.jsxs(C.Fragment,{children:[S.jsx("marker",Object.assign({id:`arrowhead-${l}`,markerWidth:"2",markerHeight:"2.5",refX:"1.25",refY:"1.25",orient:"auto"},{children:S.jsx("polygon",{points:"0.3 0, 2 1.25, 0.3 2.5",fill:g??i})})),S.jsx("line",{x1:p.x,y1:p.y,x2:c.x,y2:c.y,opacity:m?"0.5":"0.65",stroke:g??i,strokeWidth:m?.9*r/40:r/40,markerEnd:`url(#arrowhead-${l})`})]},`${u}-${a}${m?"-active":""}`)})}))};function Fm({option:e}){const[t,n]=C.useState(!1),{boardWidth:r,chessPieces:i,customDarkSquareStyle:o,customLightSquareStyle:s,handleSetPosition:l,onPromotionPieceSelect:u,promoteFromSquare:a,promoteToSquare:g,promotionDialogVariant:p}=_t(),f=()=>{switch(e[1]){case"Q":return o.backgroundColor;case"R":return s.backgroundColor;case"N":return p==="default"?s.backgroundColor:o.backgroundColor;case"B":return p==="default"?o.backgroundColor:s.backgroundColor}};return S.jsx("div",Object.assign({onClick:()=>{u!=null&&u.length?u(e):l(a,g,e,!0)},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),"data-piece":e,style:{cursor:"pointer",backgroundColor:t?f():`${f()}aa`,borderRadius:"4px",transition:"all 0.1s ease-out"}},{children:typeof i[e]=="function"?S.jsx("div",Object.assign({style:{transition:"all 0.1s ease-out",transform:t?"scale(1)":"scale(0.85)"}},{children:i[e]({squareWidth:r/8,isDragging:!1})})):S.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:r/8,height:r/8,style:{transition:"all 0.1s ease-out",transform:t?"scale(1)":"scale(0.85)"}},{children:S.jsx("g",{children:i[e]})}))}))}function $m(){const{boardOrientation:e,boardWidth:t,promotionDialogVariant:n,promoteToSquare:r}=_t(),i=(r==null?void 0:r[1])==="1"?"b":"w",o=[`${i??"w"}Q`,`${i??"w"}R`,`${i??"w"}N`,`${i??"w"}B`],s={default:{display:"grid",gridTemplateColumns:"1fr 1fr",transform:`translate(${-t/8}px, ${-t/8}px)`},vertical:{transform:`translate(${-t/16}px, ${-t/16}px)`},modal:{display:"flex",justifyContent:"center",alignItems:"center",transform:`translate(0px, ${3*t/8}px)`,width:"100%",height:`${t/4}px`,top:0,backgroundColor:"white",left:0}},l=wl(e,t,r||"a8");return S.jsx("div",Object.assign({style:Object.assign({position:"absolute",top:`${l==null?void 0:l.y}px`,left:`${l==null?void 0:l.x}px`,zIndex:1e3},s[n]),title:"Choose promotion piece"},{children:o.map(u=>S.jsx(Fm,{option:u},u))}))}const Um={whiteKing:S.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",style:{shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"crisp-edges"},viewBox:"0 0 4210 12970",x:"0px",y:"0px",fillRule:"evenodd",clipRule:"evenodd",width:"250",height:"250"},{children:S.jsx("g",{children:S.jsx("path",{style:{fill:"black",fillRule:"nonzero"},d:"M2105 0c169,0 286,160 249,315l200 0c-172,266 -231,479 -256,792 315,-24 530,-86 792,-255l0 897c-265,-171 -479,-231 -792,-256 18,234 75,495 185,682l339 0c233,0 369,269 225,456l545 0 -595 1916c130,94 158,275 59,402 465,0 416,568 51,568l-334 0 465 2867 332 0c250,0 381,306 199,485 162,63 273,220 273,399l0 633 168 0 0 475c-1403,0 -2807,0 -4210,0l0 -475 167 0 0 -633c0,-179 112,-336 274,-399 -181,-178 -52,-485 199,-485l332 0 465 -2867 -335 0c-353,0 -418,-568 51,-568 -98,-127 -70,-308 59,-402l-594 -1916c181,0 363,0 545,0 -144,-187 -9,-456 225,-456l339 0c110,-187 167,-448 185,-682 -315,25 -530,87 -793,256l0 -897c266,171 480,231 793,255 -25,-315 -87,-529 -256,-792l199 0c-36,-155 81,-315 250,-315zm-1994 10012l0 253 3988 0 0 -253c-1330,0 -2659,0 -3988,0zm484 -1060c-174,0 -316,142 -316,316l0 633 3652 0 0 -633c0,-174 -142,-316 -316,-316 -1007,0 -2013,0 -3020,0zm45 -457c-230,0 -225,345 0,345l2930 0c230,0 225,-345 0,-345 -977,0 -1953,0 -2930,0zm2020 -2978l-1111 0 -465 2867 2041 0 -465 -2867zm-1558 -456c-229,0 -224,345 0,345 669,0 1337,0 2005,0 230,0 225,-345 0,-345 -668,0 -1336,0 -2005,0zm1730 -457l-1454 0c-229,0 -224,345 0,345l1454 0c229,0 224,-345 0,-345zm-2064 -1862l544 1751c529,0 1057,0 1586,0l544 -1751c-892,0 -1783,0 -2674,0zm1085 -567l504 0c-126,-247 -163,-526 -177,-800 273,15 553,52 800,177l0 -504c-247,126 -527,163 -800,177 14,-273 51,-552 177,-799 -168,0 -336,0 -504,0 125,247 162,526 177,799 -274,-14 -553,-51 -800,-177l0 504c247,-125 527,-162 800,-177 -15,274 -52,553 -177,800zm969 111l-1434 0c-230,0 -225,345 0,345l1434 0c230,0 225,-345 0,-345zm-717 -2175c-105,0 -175,109 -133,204l266 0c42,-96 -30,-205 -133,-204z"})})}))};function Hm({children:e}){try{return S.jsx(S.Fragment,{children:e})}catch(t){return console.log(t),S.jsx(Qf,{showError:!0})}}function Qf({showError:e=!1}){return S.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column"}},{children:[S.jsx("div",Object.assign({style:{width:250,height:250,transform:"rotate(90deg)"}},{children:Um.whiteKing})),e&&S.jsx("h1",{children:"Something went wrong"})]}))}function Wm(){const e=C.useRef(null),{boardWidth:t,clearCurrentRightClickDown:n,onPromotionPieceSelect:r,setShowPromoteDialog:i,showPromoteDialog:o,customBoardStyle:s}=_t();return C.useEffect(()=>{function l(u){e.current&&!e.current.contains(u.target)&&n()}return document.addEventListener("mouseup",l),()=>{document.removeEventListener("mouseup",l)}},[]),t?S.jsx("div",Object.assign({style:{perspective:"1000px"}},{children:S.jsxs("div",Object.assign({ref:e,style:Object.assign(Object.assign({position:"relative"},Bm(t)),s)},{children:[S.jsx(bm,{}),S.jsx(zm,{}),o&&S.jsxs(S.Fragment,{children:[S.jsx("div",{onClick:()=>{i(!1),r==null||r()},style:{position:"absolute",top:"0",left:"0",zIndex:"100",backgroundColor:"rgba(22,21,18,.7)",width:t,height:t}}),S.jsx($m,{})]})]}))})):S.jsx(Qf,{})}const Bm=e=>({cursor:"default",height:e,width:e});function Vm({boardContainer:e}){const{boardWidth:t,chessPieces:n,id:r,snapToCursor:i,allowDragOutsideBoard:o}=_t(),s=W1(f=>({item:f.getItem(),clientOffset:f.getClientOffset(),sourceClientOffset:f.getSourceClientOffset(),isDragging:f.isDragging()})),{isDragging:l,item:u,clientOffset:a,sourceClientOffset:g}=s,p=C.useCallback((f,y)=>{if(!f||!y)return{display:"none"};let{x:m,y:v}=i?f:y;const E=t/8/2;if(i&&(m-=E,v-=E),!o){const{left:c,top:h}=e,w=c-E,k=h-E,O=c+t-E,x=h+t-E;m=Math.max(w,Math.min(m,O)),v=Math.max(k,Math.min(v,x))}const d=`translate(${m}px, ${v}px)`;return{transform:d,WebkitTransform:d,touchAction:"none"}},[t,o,i,e]);return l&&u.id===r?S.jsx("div",Object.assign({style:{position:"fixed",pointerEvents:"none",zIndex:10,left:0,top:0}},{children:S.jsx("div",Object.assign({style:p(a,g)},{children:typeof n[u.piece]=="function"?n[u.piece]({squareWidth:t/8,isDragging:!0}):S.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:t/8,height:t/8},{children:S.jsx("g",{children:n[u.piece]})}))}))})):null}const Qm=C.forwardRef((e,t)=>{const{customDndBackend:n,customDndBackendOptions:r}=e,i=r0(e,["customDndBackend","customDndBackendOptions"]),[o,s]=C.useState(),[l,u]=C.useState(!1),[a,g]=C.useState(!1),[p,f]=C.useState(e.boardWidth),y=C.useRef(null),m=C.useRef(null),[v,E]=C.useState({left:0,top:0}),d=C.useMemo(()=>{var h;return(h=y.current)===null||h===void 0?void 0:h.getBoundingClientRect()},[y.current]);C.useEffect(()=>{E({left:d!=null&&d.left?d==null?void 0:d.left:0,top:d!=null&&d.top?d==null?void 0:d.top:0})},[d]),C.useEffect(()=>{g("ontouchstart"in window),u(!0),s(window)},[]),C.useEffect(()=>{var h;if(e.boardWidth===void 0&&(!((h=y.current)===null||h===void 0)&&h.offsetWidth)){const w=new ResizeObserver(()=>{var k;f((k=y.current)===null||k===void 0?void 0:k.offsetWidth)});return w.observe(y.current),()=>{w.disconnect()}}},[y.current,o]);const c=n||(a?Cm:fm);return l&&o?S.jsx(Hm,{children:S.jsxs("div",Object.assign({ref:m,style:{display:"flex",flexDirection:"column",width:"100%"}},{children:[S.jsx("div",{ref:y,style:{width:"100%"}}),S.jsx(w1,Object.assign({backend:c,context:o,options:n?r:void 0},{children:p&&S.jsxs(jm,Object.assign({boardWidth:p},i,{ref:t},{children:[S.jsx(Vm,{boardContainer:v}),S.jsx(Wm,{})]}))}))]}))}):null});var rc=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(g){try{a(r.next(g))}catch(p){s(p)}}function u(g){try{a(r.throw(g))}catch(p){s(p)}}function a(g){g.done?o(g.value):i(g.value).then(l,u)}a((r=r.apply(e,t||[])).next())})};const Km=e=>{const[t,n,r]=e.split(":");return{process_name:t,package_name:n,publisher_node:r}};function sr(e){const t=document.cookie.split(";");for(let n=0;nnull,onOpen:s=()=>null,onClose:l=()=>null,onError:u=()=>null}){this._encrypt=a=>null,this._decrypt=a=>{},this.send=({data:a})=>{sr(`kinode-auth_${this.nodeId}`),sr(`kinode-ws-auth_${this.nodeId}`),this._ws.send(ic(a))},this.fetchJson=(a,g)=>rc(this,void 0,void 0,function*(){return console.log("Fetching JSON:",a),yield(yield fetch(a,g)).json()}),this._secret=void 0,this.processId=Km(n),this.channelId=r,this.nodeId=t,this._ws=new WebSocket(i),this._ws.onmessage=a=>rc(this,void 0,void 0,function*(){o(a.data,this)}),this._ws.onopen=a=>{console.log(`${t}`,sr(`kinode-auth_${t}`),sr(`kinode-ws-auth_${t}`)),this._ws.send(ic({auth_token:sr(`kinode-auth_${t}`),target_process:n,encrypted:!1})),s(a,this)},this._ws.onclose=l,this._ws.onerror=u}}const oc=e=>{let t;const n=new Set,r=(u,a)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const p=t;t=a??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(f=>f(t,p))}},i=()=>t,l={setState:r,getState:i,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{n.clear()}};return t=e(r,i,l),l},Gm=e=>e?oc(e):oc;var Kf={exports:{}},qf={},Gf={exports:{}},Yf={};/** + * @license React + * use-sync-external-store-shim.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. + */var Qn=C;function Ym(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xm=typeof Object.is=="function"?Object.is:Ym,Jm=Qn.useState,Zm=Qn.useEffect,ev=Qn.useLayoutEffect,tv=Qn.useDebugValue;function nv(e,t){var n=t(),r=Jm({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return ev(function(){i.value=n,i.getSnapshot=t,ws(i)&&o({inst:i})},[e,n,t]),Zm(function(){return ws(i)&&o({inst:i}),e(function(){ws(i)&&o({inst:i})})},[e]),tv(n),n}function ws(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xm(e,n)}catch{return!0}}function rv(e,t){return t()}var iv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rv:nv;Yf.useSyncExternalStore=Qn.useSyncExternalStore!==void 0?Qn.useSyncExternalStore:iv;Gf.exports=Yf;var ov=Gf.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.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. + */var Do=C,sv=ov;function lv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uv=typeof Object.is=="function"?Object.is:lv,av=sv.useSyncExternalStore,cv=Do.useRef,dv=Do.useEffect,fv=Do.useMemo,hv=Do.useDebugValue;qf.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=cv(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=fv(function(){function u(y){if(!a){if(a=!0,g=y,y=r(y),i!==void 0&&s.hasValue){var m=s.value;if(i(m,y))return p=m}return p=y}if(m=p,uv(g,y))return m;var v=r(y);return i!==void 0&&i(m,v)?m:(g=y,p=v)}var a=!1,g,p,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,i]);var l=av(e,o[0],o[1]);return dv(function(){s.hasValue=!0,s.value=l},[l]),hv(l),l};Kf.exports=qf;var pv=Kf.exports;const gv=uc(pv),{useDebugValue:mv}=yc,{useSyncExternalStoreWithSelector:vv}=gv;function yv(e,t=e.getState,n){const r=vv(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return mv(r),r}const sc=e=>{const t=typeof e=="function"?Gm(e):e,n=(r,i)=>yv(t,r,i);return Object.assign(n,t),n},Sv=e=>e?sc(e):sc;function Xf(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const s=u=>u===null?null:JSON.parse(u,t==null?void 0:t.reviver),l=(o=n.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,t==null?void 0:t.replacer)),removeItem:i=>n.removeItem(i)}}const Hr=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Hr(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Hr(r)(n)}}}},wv=(e,t)=>(n,r,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:E=>E,version:0,merge:(E,d)=>({...d,...E}),...t},s=!1;const l=new Set,u=new Set;let a;try{a=o.getStorage()}catch{}if(!a)return e((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...E)},r,i);const g=Hr(o.serialize),p=()=>{const E=o.partialize({...r()});let d;const c=g({state:E,version:o.version}).then(h=>a.setItem(o.name,h)).catch(h=>{d=h});if(d)throw d;return c},f=i.setState;i.setState=(E,d)=>{f(E,d),p()};const y=e((...E)=>{n(...E),p()},r,i);let m;const v=()=>{var E;if(!a)return;s=!1,l.forEach(c=>c(r()));const d=((E=o.onRehydrateStorage)==null?void 0:E.call(o,r()))||void 0;return Hr(a.getItem.bind(a))(o.name).then(c=>{if(c)return o.deserialize(c)}).then(c=>{if(c)if(typeof c.version=="number"&&c.version!==o.version){if(o.migrate)return o.migrate(c.state,c.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return c.state}).then(c=>{var h;return m=o.merge(c,(h=r())!=null?h:y),n(m,!0),p()}).then(()=>{d==null||d(m,void 0),s=!0,u.forEach(c=>c(m))}).catch(c=>{d==null||d(void 0,c)})};return i.persist={setOptions:E=>{o={...o,...E},E.getStorage&&(a=E.getStorage())},clearStorage:()=>{a==null||a.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>v(),hasHydrated:()=>s,onHydrate:E=>(l.add(E),()=>{l.delete(E)}),onFinishHydration:E=>(u.add(E),()=>{u.delete(E)})},v(),m||y},Ev=(e,t)=>(n,r,i)=>{let o={storage:Xf(()=>localStorage),partialize:v=>v,version:0,merge:(v,E)=>({...E,...v}),...t},s=!1;const l=new Set,u=new Set;let a=o.storage;if(!a)return e((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...v)},r,i);const g=()=>{const v=o.partialize({...r()});return a.setItem(o.name,{state:v,version:o.version})},p=i.setState;i.setState=(v,E)=>{p(v,E),g()};const f=e((...v)=>{n(...v),g()},r,i);let y;const m=()=>{var v,E;if(!a)return;s=!1,l.forEach(c=>{var h;return c((h=r())!=null?h:f)});const d=((E=o.onRehydrateStorage)==null?void 0:E.call(o,(v=r())!=null?v:f))||void 0;return Hr(a.getItem.bind(a))(o.name).then(c=>{if(c)if(typeof c.version=="number"&&c.version!==o.version){if(o.migrate)return o.migrate(c.state,c.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return c.state}).then(c=>{var h;return y=o.merge(c,(h=r())!=null?h:f),n(y,!0),g()}).then(()=>{d==null||d(y,void 0),y=r(),s=!0,u.forEach(c=>c(y))}).catch(c=>{d==null||d(void 0,c)})};return i.persist={setOptions:v=>{o={...o,...v},v.storage&&(a=v.storage)},clearStorage:()=>{a==null||a.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:v=>(l.add(v),()=>{l.delete(v)}),onFinishHydration:v=>(u.add(v),()=>{u.delete(v)})},o.skipHydration||m(),y||f},Cv=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?wv(e,t):Ev(e,t),kv=Cv,_v=Sv()(kv((e,t)=>({games:{},handleWsMessage:n=>{if(typeof n=="string")try{const{kind:r,data:i}=JSON.parse(n);r==="game_update"&&e({games:{...t().games,[i.id]:i}})}catch(r){console.error("Error parsing WebSocket message",r)}else{const r=new FileReader;r.onload=function(i){var o;if(typeof((o=i==null?void 0:i.target)==null?void 0:o.result)=="string")try{const{kind:s,data:l}=JSON.parse(i.target.result);s==="game_update"&&e({games:{...t().games,[l.id]:l}})}catch(s){console.error("Error parsing WebSocket message",s)}},r.readAsText(n)}},set:e}),{name:"chess",storage:Xf(()=>localStorage)}));const Mt="/chess:chess:sys";window.our&&(window.our.process=Mt==null?void 0:Mt.replace("/",""));const lc=(e,t)=>(e.turns||0)%2===0?t===e.white:t===e.black,xv=void 0;function Ov(){const{games:e,handleWsMessage:t,set:n}=_v(),[r,i]=C.useState("new"),[o,s]=C.useState(""),l=C.useRef(null),[u,a]=C.useState(560-20),g=new ResizeObserver(d=>{for(let c of d)a(Math.min(c.contentRect.width,c.contentRect.height)-16)});l.current&&g.observe(l.current);const p=C.useMemo(()=>e[r]?{...e[r],game:new n0(e[r].board)}:void 0,[e,r]),f=C.useMemo(()=>((p==null?void 0:p.turns)||0)%2===0?`${p==null?void 0:p.white} (white)`:`${p==null?void 0:p.black} (black)`,[p]);C.useEffect(()=>{new qm({uri:xv,nodeId:window.our.node,processId:window.our.process,onMessage:t}),fetch(`${Mt}/games`).then(d=>d.json()).then(d=>{n({games:d})}).catch(console.error)},[]);const y=C.useCallback(async d=>{d.preventDefault();try{const c=await fetch(`${Mt}/games`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:o})}).then(w=>{if(w.status===409)throw e[o]?i(o):alert("Game already exists, please refresh the page and select it."),new Error("Game already exists");if(w.status===503)throw alert(`${o} may be offline, please confirm it is online and try again.`),new Error("Player offline");if(w.status===400)throw alert("Please enter a valid player ID"),new Error("Invalid player ID");if(w.status>399)throw alert("There was an error creating the game. Please try again."),new Error("Error creating game");return w.json()}),h={...e};h[c.id]=c,n({games:h}),i(o),s("")}catch(c){console.error(c)}},[e,o,s,n]),m=C.useCallback((d,c)=>{if(!p||!lc(p,window.our.node))return!1;const h={from:d,to:c,promotion:"q"},w={...p};if(w.game.move(h)===null)return!1;w.board=w.game.fen();const O={...e};return O[p.id]=w,n({games:O}),fetch(`${Mt}/games`,{method:"PUT",body:JSON.stringify({id:p.id,move:d+c})}).then(x=>x.json()).then(x=>{const T={...e};T[p.id]=x,n({games:T})}).catch(x=>{console.error(x),alert("There was an error making your move. Please try again");const T={...e},z={...p};z.game.undo(),T[p.id]=z,n({games:T})}),!0},[p,e,n]),v=C.useCallback(d=>{d.preventDefault(),d.stopPropagation(),p&&window.confirm("Are you sure you want to resign this game?")&&fetch(`${Mt}/games?id=${p.id}`,{method:"DELETE"}).then(c=>c.json()).then(c=>{const h={...e};h[p.id]=c,n({games:h})}).catch(c=>{console.error(c),alert("There was an error resigning the game. Please try again")})},[p]),E=C.useCallback(async d=>{if(d.preventDefault(),d.stopPropagation(),!!p)try{const c=await fetch(`${Mt}/games`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p.id})}).then(w=>w.json()),h={...e};h[c.id]=c,n({games:h})}catch(c){console.error(c),alert("You could not create the game. Please make sure your current game with this player (if any) has ended and try again.")}},[p]);return S.jsx("div",{className:"flex flex-col justify-center items-center",children:S.jsxs("div",{className:"flex flex-col justify-center",style:{maxHeight:"100vh",maxWidth:"800px",width:"100%",position:"relative"},children:[S.jsx("a",{href:"/",className:"absolute top-6 left-0 m-4",style:{fontSize:24,color:"white"},onClick:d=>{d.preventDefault(),window.history.back()},children:"◀ Back"}),S.jsx("h1",{className:"m-4",children:"Chess by Uqbar"}),S.jsxs("div",{className:"flex flex-row justify-center items-center h-screen border rounded",children:[Object.keys(e).length>0&&S.jsxs("div",{className:"flex flex-col border-r",style:{width:"25%",height:"100%"},children:[S.jsx("h3",{className:"m-2",children:"Games"}),S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-2 px-4 m-2 rounded",onClick:()=>i("new"),children:"New"}),S.jsx("div",{className:"flex flex-col overflow-scroll",children:Object.values(e).map(d=>S.jsx("div",{onClick:()=>i(d==null?void 0:d.id),className:`game-entry m-2 ${r!==(d==null?void 0:d.id)&&lc(d,window.our.node)?"is-turn":""} ${r===(d==null?void 0:d.id)?"selected":""} ${d!=null&&d.ended?"ended":""}`,children:d==null?void 0:d.id},d==null?void 0:d.id))})]}),S.jsx("div",{className:"flex flex-col justify-center items-center",style:{width:"75%"},ref:l,children:r==="new"||!p?S.jsxs(S.Fragment,{children:[S.jsx("h2",{className:"mb-2",children:"Start New Game"}),S.jsx("h4",{className:"mb-2",children:"(game creator will be white)"}),S.jsxs("form",{onSubmit:y,className:"flex flex-col justify-center mb-40",style:{maxWidth:400},children:[S.jsx("label",{className:"mb-2",style:{alignSelf:"flex-start",fontWeight:"600"},children:"Player ID"}),S.jsx("input",{className:"border rounded p-2 mb-2",style:{color:"black"},type:"text",placeholder:"Player ID",value:o,onChange:d=>s(d.target.value)}),S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-2 px-4 rounded",type:"submit",children:"Start Game"})]})]}):S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex flex-row justify-between items-center w-full px-4 pb-2",children:[S.jsx("h3",{children:r}),S.jsx("h4",{children:p!=null&&p.ended?"Game Ended":`Turn: ${f}`}),p!=null&&p.ended?S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-1 px-4 rounded",onClick:E,children:"Rematch"}):S.jsx("button",{className:"bg-green-600 hover:bg-green-800 text-white font-bold py-1 px-4 rounded",onClick:v,children:"Resign"})]}),S.jsx(Qm,{boardWidth:u,position:p==null?void 0:p.game.fen(),onPieceDrop:m,boardOrientation:(p==null?void 0:p.white)===window.our.node?"white":"black"})]})})]})]})})}Es.createRoot(document.getElementById("root")).render(S.jsx(yc.StrictMode,{children:S.jsx(Ov,{})})); diff --git a/modules/chess/pkg/ui/index.html b/modules/chess/pkg/ui/index.html index 7fa680cf..6aa364d1 100644 --- a/modules/chess/pkg/ui/index.html +++ b/modules/chess/pkg/ui/index.html @@ -9,8 +9,8 @@ Chess - - + +
diff --git a/modules/homepage/homepage/src/home.html b/modules/homepage/homepage/src/home.html index ee76f452..db84261c 100644 --- a/modules/homepage/homepage/src/home.html +++ b/modules/homepage/homepage/src/home.html @@ -207,7 +207,7 @@

Apps:

- Chess + Chess