From dbf8a4c9fe4cce00cdbc272bef5efd90d6953505 Mon Sep 17 00:00:00 2001 From: Chris Fregly Date: Wed, 13 Sep 2023 14:58:43 -0700 Subject: [PATCH] fix points view --- dist/index.mjs | 2 +- dist/index.umd.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/components/GamePage/GamePage.jsx | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/index.mjs b/dist/index.mjs index 959dd47..76886db 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1736,7 +1736,7 @@ const jn = it((e, t) => { className: `text-xs flex items-center justify-center font-bold cursor-pointer mr-1 w-6 h-6 rounded-full border-4 border-${x}-500 ${o && f && f[o.Name] === x ? `bg-${f[o.Name]}-500` : ""}`, onClick: () => D(x) }, - s && ["LongestPath", "MostCrossings"].includes(s.MoreData.Variant) ? s.MoreData.Points[x] : "" + s && s.MoreData && s.MoreData.Points ? s.MoreData.Points[x] : "" )) : null), /* @__PURE__ */ l.createElement("div", { className: `font-extrabold ${s && f && o && f[o.Name] && s.Winners.length === 0 ? `text-${s.Turn}-500` : "text-zinc-100"} ${s && o && f && f[o.Name] === s.Turn && s.Winners.length === 0 ? "animate-pulse" : ""}` }, s && f && o && f[o.Name] ? s.Message : /* @__PURE__ */ l.createElement("div", { className: "flex items-center animate-pulse" }, /* @__PURE__ */ l.createElement(Pn, { className: "mr-1" }), /* @__PURE__ */ l.createElement("div", null, "select a team")))), /* @__PURE__ */ l.createElement("div", { className: "h-full flex flex-col justify-center items-center grow" }, d), /* @__PURE__ */ l.createElement("hr", { className: "w-full mb-2" }), /* @__PURE__ */ l.createElement("div", { className: "w-full flex justify-between items-center" }, /* @__PURE__ */ l.createElement("div", { className: `leading-4 text-2xl font-black text-${n.color} cursor-pointer` }, /* @__PURE__ */ l.createElement("a", { href: `${window.location.protocol}//${window.location.host}` }, /* @__PURE__ */ l.createElement("span", { className: `font-['${n.font}']` }, n.key), /* @__PURE__ */ l.createElement("span", { className: "ml-1 text-[0.5rem] md:text-xs text-zinc-100" }, s && s.MoreData && s.MoreData.Variant ? s.MoreData.Variant : ""))), /* @__PURE__ */ l.createElement("div", { className: "flex" }, /* @__PURE__ */ l.createElement("div", { className: "flex" }, /* @__PURE__ */ l.createElement("div", { className: `px-3 py-1 font-bold cursor-pointer flex items-center justify-center text-xs bg-zinc-600 mr-2 ${s && s.Winners.length > 0 ? "animate-pulse" : ""}`, onClick: () => Z() }, "new game")), /* @__PURE__ */ l.createElement("div", { className: "italic text-xs bg-blue-500 py-1 px-2" }, /* @__PURE__ */ l.createElement("a", { href: "https://quibbble.com" }, "more ", /* @__PURE__ */ l.createElement("span", { className: "font-['lobster'] text-sm not-italic" }, "quibbble"), " games")))))); }); export { diff --git a/dist/index.umd.js b/dist/index.umd.js index 29088ab..b42a79d 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,3 +1,3 @@ (function(O,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom"],a):(O=typeof globalThis<"u"?globalThis:O||self,a(O.boardgame={},O.React,O.reactRouterDom))})(this,function(O,a,M){"use strict";const Pn="";function Z(){return a.createElement("div",{className:"flex flex-col items-center w-full font-light text-sm"},a.createElement("div",{className:"flex"},a.createElement("a",{href:"mailto:hello@quibbble.com"},a.createElement("p",null,"Contact")),a.createElement("p",{className:"mx-2 md:mx-4"},"/"),a.createElement("a",{href:"https://www.buymeacoffee.com/quibbble",target:"_blank",rel:"noreferrer"},a.createElement("p",null,"Support")),a.createElement("p",{className:"mx-2 md:mx-4"},"/"),a.createElement("a",{href:"https://discord.gg/VKvjutuhUp",target:"_blank",rel:"noreferrer"},a.createElement("p",null,"Discord")),a.createElement("p",{className:"mx-2 md:mx-4"},"/"),a.createElement("a",{href:"https://status.quibbble.com",target:"_blank",rel:"noreferrer"},a.createElement("p",null,"Status")),a.createElement("p",{className:"mx-2 md:mx-4"},"/"),a.createElement("a",{href:"https://github.com/quibbble",target:"_blank",rel:"noreferrer"},a.createElement("p",null,"Code"))),a.createElement("p",{className:"mt-2 italic"},"Made with 🤍 by ",a.createElement("a",{className:"underline",href:"https://chrisfregly.com",target:"_blank",rel:"noreferrer"},"Chris Fregly")))}function ye(e,t){return function(){return e.apply(t,arguments)}}const{toString:nt}=Object.prototype,{getPrototypeOf:ee}=Object,I=(e=>t=>{const n=nt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),A=e=>(e=e.toLowerCase(),t=>I(t)===e),H=e=>t=>typeof t===e,{isArray:_}=Array,L=H("undefined");function rt(e){return e!==null&&!L(e)&&e.constructor!==null&&!L(e.constructor)&&S(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ee=A("ArrayBuffer");function st(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ee(e.buffer),t}const ot=H("string"),S=H("function"),we=H("number"),q=e=>e!==null&&typeof e=="object",it=e=>e===!0||e===!1,V=e=>{if(I(e)!=="object")return!1;const t=ee(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},at=A("Date"),lt=A("File"),ct=A("Blob"),ut=A("FileList"),ft=e=>q(e)&&S(e.pipe),dt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||S(e.append)&&((t=I(e))==="formdata"||t==="object"&&S(e.toString)&&e.toString()==="[object FormData]"))},mt=A("URLSearchParams"),pt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function U(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),_(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const ge=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Ne=e=>!L(e)&&e!==ge;function te(){const{caseless:e}=Ne(this)&&this||{},t={},n=(r,s)=>{const i=e&&xe(t,s)||s;V(t[i])&&V(r)?t[i]=te(t[i],r):V(r)?t[i]=te({},r):_(r)?t[i]=r.slice():t[i]=r};for(let r=0,s=arguments.length;r(U(t,(s,i)=>{n&&S(s)?e[i]=ye(s,n):e[i]=s},{allOwnKeys:r}),e),bt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),yt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Et=(e,t,n,r)=>{let s,i,o;const u={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!u[o]&&(t[o]=e[o],u[o]=!0);e=n!==!1&&ee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},wt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},xt=e=>{if(!e)return null;if(_(e))return e;let t=e.length;if(!we(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},gt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ee(Uint8Array)),Nt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},St=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ot=A("HTMLFormElement"),Tt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Se=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),At=A("RegExp"),Oe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};U(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Ct=e=>{Oe(e,(t,n)=>{if(S(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(S(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Pt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return _(e)?r(e):r(String(e).split(t)),n},vt=()=>{},kt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),ne="abcdefghijklmnopqrstuvwxyz",Te="0123456789",Ae={DIGIT:Te,ALPHA:ne,ALPHA_DIGIT:ne+ne.toUpperCase()+Te},Dt=(e=16,t=Ae.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Ft(e){return!!(e&&S(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const _t=e=>{const t=new Array(10),n=(r,s)=>{if(q(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const i=_(r)?[]:{};return U(r,(o,u)=>{const p=n(o,s+1);!L(p)&&(i[u]=p)}),t[s]=void 0,i}}return r};return n(e,0)},jt=A("AsyncFunction"),l={isArray:_,isArrayBuffer:Ee,isBuffer:rt,isFormData:dt,isArrayBufferView:st,isString:ot,isNumber:we,isBoolean:it,isObject:q,isPlainObject:V,isUndefined:L,isDate:at,isFile:lt,isBlob:ct,isRegExp:At,isFunction:S,isStream:ft,isURLSearchParams:mt,isTypedArray:gt,isFileList:ut,forEach:U,merge:te,extend:ht,trim:pt,stripBOM:bt,inherits:yt,toFlatObject:Et,kindOf:I,kindOfTest:A,endsWith:wt,toArray:xt,forEachEntry:Nt,matchAll:St,isHTMLForm:Ot,hasOwnProperty:Se,hasOwnProp:Se,reduceDescriptors:Oe,freezeMethods:Ct,toObjectSet:Pt,toCamelCase:Tt,noop:vt,toFiniteNumber:kt,findKey:xe,global:ge,isContextDefined:Ne,ALPHABET:Ae,generateString:Dt,isSpecCompliantForm:Ft,toJSONObject:_t,isAsyncFn:jt,isThenable:e=>e&&(q(e)||S(e))&&S(e.then)&&S(e.catch)};function b(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}l.inherits(b,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:l.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ce=b.prototype,Pe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Pe[e]={value:e}}),Object.defineProperties(b,Pe),Object.defineProperty(Ce,"isAxiosError",{value:!0}),b.from=(e,t,n,r,s,i)=>{const o=Object.create(Ce);return l.toFlatObject(e,o,function(p){return p!==Error.prototype},u=>u!=="isAxiosError"),b.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const Bt=null;function re(e){return l.isPlainObject(e)||l.isArray(e)}function ve(e){return l.endsWith(e,"[]")?e.slice(0,-2):e}function ke(e,t,n){return e?e.concat(t).map(function(s,i){return s=ve(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Lt(e){return l.isArray(e)&&!e.some(re)}const Ut=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function J(e,t,n){if(!l.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,g){return!l.isUndefined(g[h])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&l.isSpecCompliantForm(t);if(!l.isFunction(s))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(l.isDate(m))return m.toISOString();if(!p&&l.isBlob(m))throw new b("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(m)||l.isTypedArray(m)?p&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function f(m,h,g){let N=m;if(m&&!g&&typeof m=="object"){if(l.endsWith(h,"{}"))h=r?h:h.slice(0,-2),m=JSON.stringify(m);else if(l.isArray(m)&&Lt(m)||(l.isFileList(m)||l.endsWith(h,"[]"))&&(N=l.toArray(m)))return h=ve(h),N.forEach(function(F,he){!(l.isUndefined(F)||F===null)&&t.append(o===!0?ke([h],he,i):o===null?h:h+"[]",c(F))}),!1}return re(m)?!0:(t.append(ke(g,h,i),c(m)),!1)}const d=[],y=Object.assign(Ut,{defaultVisitor:f,convertValue:c,isVisitable:re});function E(m,h){if(!l.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+h.join("."));d.push(m),l.forEach(m,function(N,v){(!(l.isUndefined(N)||N===null)&&s.call(t,N,l.isString(v)?v.trim():v,h,y))===!0&&E(N,h?h.concat(v):[v])}),d.pop()}}if(!l.isObject(e))throw new TypeError("data must be an object");return E(e),t}function De(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function se(e,t){this._pairs=[],e&&J(e,this,t)}const Fe=se.prototype;Fe.append=function(t,n){this._pairs.push([t,n])},Fe.toString=function(t){const n=t?function(r){return t.call(this,r,De)}:De;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function $t(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _e(e,t,n){if(!t)return e;const r=n&&n.encode||$t,s=n&&n.serialize;let i;if(s?i=s(t,n):i=l.isURLSearchParams(t)?t.toString():new se(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class zt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){l.forEach(this.handlers,function(r){r!==null&&t(r)})}}const je=zt,Be={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mt=typeof URLSearchParams<"u"?URLSearchParams:se,It=typeof FormData<"u"?FormData:null,Ht=typeof Blob<"u"?Blob:null,qt=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Vt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),T={isBrowser:!0,classes:{URLSearchParams:Mt,FormData:It,Blob:Ht},isStandardBrowserEnv:qt,isStandardBrowserWebWorkerEnv:Vt,protocols:["http","https","file","blob","url","data"]};function Jt(e,t){return J(e,new T.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return T.isNode&&l.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Rt(e){return l.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Gt(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&l.isArray(s)?s.length:o,p?(l.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!u):((!s[o]||!l.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&l.isArray(s[o])&&(s[o]=Gt(s[o])),!u)}if(l.isFormData(e)&&l.isFunction(e.entries)){const n={};return l.forEachEntry(e,(r,s)=>{t(Rt(r),s,n,0)}),n}return null}function Wt(e,t,n){if(l.isString(e))try{return(t||JSON.parse)(e),l.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const oe={transitional:Be,adapter:T.isNode?"http":"xhr",transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=l.isObject(t);if(i&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return s&&s?JSON.stringify(Le(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Jt(t,this.formSerializer).toString();if((u=l.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return J(u?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Wt(t)):t}],transformResponse:[function(t){const n=this.transitional||oe.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&l.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(u){if(o)throw u.name==="SyntaxError"?b.from(u,b.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:T.classes.FormData,Blob:T.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],e=>{oe.headers[e]={}});const ie=oe,Kt=l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Xt=e=>{const t={};let n,r,s;return e&&e.split(` `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Kt[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ue=Symbol("internals");function $(e){return e&&String(e).trim().toLowerCase()}function R(e){return e===!1||e==null?e:l.isArray(e)?e.map(R):String(e)}function Qt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Yt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ae(e,t,n,r,s){if(l.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!l.isString(t)){if(l.isString(r))return t.indexOf(r)!==-1;if(l.isRegExp(r))return r.test(t)}}function Zt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function en(e,t){const n=l.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}class G{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(u,p,c){const f=$(p);if(!f)throw new Error("header name must be a non-empty string");const d=l.findKey(s,f);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||p]=R(u))}const o=(u,p)=>l.forEach(u,(c,f)=>i(c,f,p));return l.isPlainObject(t)||t instanceof this.constructor?o(t,n):l.isString(t)&&(t=t.trim())&&!Yt(t)?o(Xt(t),n):t!=null&&i(n,t,r),this}get(t,n){if(t=$(t),t){const r=l.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Qt(s);if(l.isFunction(n))return n.call(this,s,r);if(l.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=$(t),t){const r=l.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ae(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=$(o),o){const u=l.findKey(r,o);u&&(!n||ae(r,r[u],u,n))&&(delete r[u],s=!0)}}return l.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||ae(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return l.forEach(this,(s,i)=>{const o=l.findKey(r,i);if(o){n[o]=R(s),delete n[i];return}const u=t?Zt(i):String(i).trim();u!==i&&delete n[i],n[u]=R(s),r[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return l.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&l.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const u=$(o);r[u]||(en(s,o),r[u]=!0)}return l.isArray(t)?t.forEach(i):i(t),this}}G.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(G.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),l.freezeMethods(G);const P=G;function le(e,t){const n=this||ie,r=t||n,s=P.from(r.headers);let i=r.data;return l.forEach(e,function(u){i=u.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function $e(e){return!!(e&&e.__CANCEL__)}function z(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}l.inherits(z,b,{__CANCEL__:!0});function tn(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const nn=T.isStandardBrowserEnv?function(){return{write:function(n,r,s,i,o,u){const p=[];p.push(n+"="+encodeURIComponent(r)),l.isNumber(s)&&p.push("expires="+new Date(s).toGMTString()),l.isString(i)&&p.push("path="+i),l.isString(o)&&p.push("domain="+o),u===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function rn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function sn(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function ze(e,t){return e&&!rn(t)?sn(e,t):t}const on=T.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(i){let o=i;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(o){const u=l.isString(o)?s(o):o;return u.protocol===r.protocol&&u.host===r.host}}():function(){return function(){return!0}}();function an(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function ln(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const c=Date.now(),f=r[i];o||(o=c),n[s]=p,r[s]=c;let d=i,y=0;for(;d!==s;)y+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o{const i=s.loaded,o=s.lengthComputable?s.total:void 0,u=i-n,p=r(u),c=i<=o;n=i;const f={loaded:i,total:o,progress:o?i/o:void 0,bytes:u,rate:p||void 0,estimated:p&&o&&c?(o-i)/p:void 0,event:s};f[t?"download":"upload"]=!0,e(f)}}const W={http:Bt,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let s=e.data;const i=P.from(e.headers).normalize(),o=e.responseType;let u;function p(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}l.isFormData(s)&&(T.isStandardBrowserEnv||T.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const E=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(E+":"+m))}const f=ze(e.baseURL,e.url);c.open(e.method.toUpperCase(),_e(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!c)return;const E=P.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),h={data:!o||o==="text"||o==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:E,config:e,request:c};tn(function(N){n(N),p()},function(N){r(N),p()},h),c=null}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){c&&(r(new b("Request aborted",b.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new b("Network Error",b.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let m=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const h=e.transitional||Be;e.timeoutErrorMessage&&(m=e.timeoutErrorMessage),r(new b(m,h.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,c)),c=null},T.isStandardBrowserEnv){const E=(e.withCredentials||on(f))&&e.xsrfCookieName&&nn.read(e.xsrfCookieName);E&&i.set(e.xsrfHeaderName,E)}s===void 0&&i.setContentType(null),"setRequestHeader"in c&&l.forEach(i.toJSON(),function(m,h){c.setRequestHeader(h,m)}),l.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",Me(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",Me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(u=E=>{c&&(r(!E||E.type?new z(null,e,c):E),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u)));const y=an(f);if(y&&T.protocols.indexOf(y)===-1){r(new b("Unsupported protocol "+y+":",b.ERR_BAD_REQUEST,e));return}c.send(s||null)})}};l.forEach(W,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ie={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let s=0;se instanceof P?e.toJSON():e;function j(e,t){t=t||{};const n={};function r(c,f,d){return l.isPlainObject(c)&&l.isPlainObject(f)?l.merge.call({caseless:d},c,f):l.isPlainObject(f)?l.merge({},f):l.isArray(f)?f.slice():f}function s(c,f,d){if(l.isUndefined(f)){if(!l.isUndefined(c))return r(void 0,c,d)}else return r(c,f,d)}function i(c,f){if(!l.isUndefined(f))return r(void 0,f)}function o(c,f){if(l.isUndefined(f)){if(!l.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function u(c,f,d){if(d in t)return r(c,f);if(d in e)return r(void 0,c)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(c,f)=>s(qe(c),qe(f),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(f){const d=p[f]||s,y=d(e[f],t[f],f);l.isUndefined(y)&&d!==u||(n[f]=y)}),n}const Ve="1.5.0",ue={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ue[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Je={};ue.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Ve+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,u)=>{if(t===!1)throw new b(s(o," has been removed"+(n?" in "+n:"")),b.ERR_DEPRECATED);return n&&!Je[o]&&(Je[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,u):!0}};function cn(e,t,n){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const u=e[i],p=u===void 0||o(u,i,e);if(p!==!0)throw new b("option "+i+" must be "+p,b.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new b("Unknown option "+i,b.ERR_BAD_OPTION)}}const fe={assertOptions:cn,validators:ue},k=fe.validators;class K{constructor(t){this.defaults=t,this.interceptors={request:new je,response:new je}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=j(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),s!=null&&(l.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:k.function,serialize:k.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&l.merge(i.common,i[n.method]);i&&l.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=P.concat(o,i);const u=[];let p=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(p=p&&h.synchronous,u.unshift(h.fulfilled,h.rejected))});const c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let f,d=0,y;if(!p){const m=[He.bind(this),void 0];for(m.unshift.apply(m,u),m.push.apply(m,c),y=m.length,f=Promise.resolve(n);d{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(u=>{r.subscribe(u),i=u}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,u){r.reason||(r.reason=new z(i,o,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new de(function(s){t=s}),cancel:t}}}const un=de;function fn(e){return function(n){return e.apply(null,n)}}function dn(e){return l.isObject(e)&&e.isAxiosError===!0}const me={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(me).forEach(([e,t])=>{me[t]=e});const mn=me;function Re(e){const t=new X(e),n=ye(X.prototype.request,t);return l.extend(n,X.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Re(j(e,s))},n}const w=Re(ie);w.Axios=X,w.CanceledError=z,w.CancelToken=un,w.isCancel=$e,w.VERSION=Ve,w.toFormData=J,w.AxiosError=b,w.Cancel=w.CanceledError,w.all=function(t){return Promise.all(t)},w.spread=fn,w.isAxiosError=dn,w.mergeConfig=j,w.AxiosHeaders=P,w.formToJSON=e=>Le(l.isHTMLForm(e)?new FormData(e):e),w.getAdapter=Ie.getAdapter,w.HttpStatusCode=mn,w.default=w;const Q=w;Q.defaults.withCredentials=!0;const pn=async(e,t,n,r,s)=>{let i={method:"POST",url:`${e}/game/create`,headers:{"Content-Type":"application/json"},data:JSON.stringify({GameKey:t,GameID:n,Teams:r,TurnLength:null,MoreOptions:{Seed:Date.now(),Variant:s}})};return Q(i).catch(o=>o.response).then(o=>o.status)},hn=async(e,t,n)=>{let r={method:"GET",url:`${e}/game/snapshot?GameKey=${t}&GameID=${n}`};return Q(r).catch(s=>s.response)},Ge=async e=>{let t={method:"GET",url:`${e}/health`};return Q(t).catch(n=>n.response)};function bn({config:e}){const t=M.useNavigate();return setInterval(function(){async function n(){let r=await Ge(e.host);r&&r.status===200&&t("/")}n()},5e3),a.createElement("div",{className:"flex flex-col items-center my-8 md:my-12"},a.createElement("div",{className:"w-full flex flex-col items-center mt-48"},a.createElement("p",{className:"font-black text-4xl italic"},"We'll be right back!"),a.createElement("p",{className:"mb-1 font-thin"},a.createElement("span",{className:`text-3xl font-black font-['${e.font}'] text-${e.color} mr-1`},e.key)," is down for maintenance")),a.createElement("div",{className:"absolute bottom-8 md:bottom-12"},a.createElement(Z,null)))}const We=["slim","earthy","ablaze","hot","magnificent","cold","jagged","lucky","warm","highfalutin","similar","salty","confident","fuzzy","aquatic","strict","fast","petite","excited","efficient","slow","nervous","narrow","loose","dark","gaping","lowly","rural","savory","amusing","small","sore","mature","sordid","rhetorical","soft","strange","significant","savory","sneaky","little","absorbing","nonchalant","happy","fluffy","hard","giant","beneficial","polite","voracious"],Ke=["childhood","restaurant","elevator","clarinet","school","cat","dog","horse","town","medicine","committee","video","hair","home","cow","music","worker","bottle","food","juice","chair","bench","tuba","vehicle","car","city","assistant","nature","device","lamp","cup","lab","room","population","bed","guitar","bird","painting","dad","piano","bank","error","horn","friend","employee","computer","midnight","card","sun","fan"],pe={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};var Xe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Qe=a.createContext&&a.createContext(Xe),D=globalThis&&globalThis.__assign||function(){return D=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?Object.keys(e.variants)[0]:null),[p,c]=a.useState(!1);a.useEffect(()=>{async function d(){let y=await Ge(e.host);(!y||y.status!==200)&&t("/status/down")}d()},[history]);async function f(d){d.preventDefault();let y=await pn(e.host,e.key,n,s,o);(y===201||y===400)&&t(`/${n}`)}return a.createElement("div",null,a.createElement("div",{className:"flex flex-col items-center m-8 md:m-12"},p?a.createElement("div",{className:"absolute w-full h-full top-0 bg-zinc-500 bg-opacity-50 flex items-center justify-center fade-in"},a.createElement("div",{className:"px-4 py-4 bg-zinc-800 mx-2"},a.createElement("p",{className:"font-bold text-center mb-1"},a.createElement("span",{className:`text-3xl font-black font-['${e.font}'] text-${e.color} mr-1`},e.key)," variants"),Object.keys(e.variants).map(d=>a.createElement("p",{key:d,className:"text-sm"},a.createElement("span",{className:"font-bold"},d,":")," ",e.variants[d])),a.createElement("button",{className:"w-full bg-red-500 mt-2",onClick:()=>c(!1)},"close"))):a.createElement(a.Fragment,null),a.createElement("div",{className:"w-full max-w-2xl"},a.createElement("div",{className:"flex flex-col items-center fade-in"},a.createElement("div",{className:` text-5xl font-black font-['${e.font}'] text-${e.color} mb-1 cursor-pointer`},a.createElement("a",{href:`${window.location.protocol}//${window.location.host}`},e.key)),a.createElement("div",{className:"font-thin mb-3"},"Play ",e.minTeams===e.maxTeams?`${pe[e.minTeams]}`:`${pe[e.minTeams]} to ${pe[e.maxTeams]}`," player ",e.key," online against friends. To create a game or join an existing one, enter a game ID and click 'Go'."),a.createElement("form",{className:"w-full flex mb-2",onSubmit:f},a.createElement("input",{className:"w-10/12 p-2 text-zinc-100 bg-zinc-800 rounded-none border border-zinc-100 text-3xl font-medium box-border focus:outline-dashed outline-blue-500 outline-2",autoFocus:!0,type:"text",value:n,onChange:d=>r(d.target.value)}),a.createElement("button",{className:"w-2/12 font-bold grow-0 bg-blue-500"},"Go")),a.createElement("div",{className:"flex w-full justify-between flex-wrap"},a.createElement("div",{className:"italic text-xs bg-blue-500 py-1 px-2 order-2 md:order-1"},a.createElement("a",{href:"https://quibbble.com"},"more ",a.createElement("span",{className:"font-['lobster'] text-sm not-italic"},"quibbble")," games")),a.createElement("div",{className:"flex items-center order-1 md:order-2 mb-2 md:mb-0"},o?a.createElement(a.Fragment,null,a.createElement(wn,{className:"mr-1 text-xl cursor-pointer",onClick:()=>c(!0)}),a.createElement("div",{className:"mr-1 font-black text-blue-500"},"VARIANT"),a.createElement("select",{className:"mr-1 bg-zinc-800 text-xs h-6 border font-bold border-zinc-100 focus:outline-none",id:"players",onChange:d=>u(d.target.value.replace(/\s/g,""))},Object.keys(e.variants).map(d=>a.createElement("option",{key:d,value:d},d)))):null,e.minTeams!==e.maxTeams?a.createElement(a.Fragment,null,a.createElement("div",{className:"mx-1 font-black text-blue-500"},"PLAYERS"),a.createElement("select",{className:"bg-zinc-800 text-xs h-6 border font-bold border-zinc-100 focus:outline-none",id:"players",onChange:d=>i(parseInt(d.target.value))},Array(e.maxTeams-e.minTeams+1).fill().map((d,y)=>e.minTeams+y).map(d=>a.createElement("option",{key:d,value:d},d)))):null)))),a.createElement("div",{className:"absolute bottom-8 md:bottom-12"},a.createElement(Z,null))))}function gn(e){return Ze({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"}}]})(e)}function Nn({isConn:e}){const[t,n]=a.useState(0);return a.useEffect(()=>{e?setTimeout(()=>n(r=>r-1),1500):n(0)},[e,n]),a.createElement("div",{className:`flex items-center ${e?"cursor-pointer":""}`},t?null:a.createElement("div",{className:"px-1"},e?"connected":"reconnecting"),a.createElement("div",{onClick:()=>{e&&(n(0),setTimeout(()=>n(t-1),1500))},className:`rounded-full w-2 h-2 ${e?"bg-green-500":"bg-orange-500"}`},e?null:a.createElement("div",{className:"rounded-full w-2 h-2 bg-orange-500 animate-ping"})))}const Sn=a.forwardRef((e,t)=>{const{config:n,ws:r,game:s,setGame:i,network:o,setNetwork:u,chat:p,setChat:c,connected:f,setConnected:d,error:y,setError:E,children:m}=e,{gameID:h}=M.useParams(),g=M.useNavigate(),[N,v]=a.useState(!0);a.useEffect(()=>{f&&o&&f[o.Name]&&sessionStorage.setItem(h,f[o.Name])},[o,f,h]),a.useEffect(()=>{const x=async be=>{if(be<=0){g("/");return}let tt=await hn(n.host,n.key,h);if(!tt){g("/status/down");return}if(tt.status!==200){g("/");return}r.current=new WebSocket(`${n.websocket}/game/join?GameKey=${n.key}&GameID=${h}`),r.current.onopen=()=>{v(!0);let B=sessionStorage.getItem(h);B&&F(B)},r.current.onclose=()=>{v(!1),setTimeout(function(){x(be-1)},1e3+(3-be)*500)},r.current.onmessage=async B=>{let C=JSON.parse(B.data);C.Type==="Game"?i(C.Payload):C.Type==="Network"?u(C.Payload):C.Type==="Chat"?c(Cn=>Cn.concat([C.Payload])):C.Type==="Connected"?d(C.Payload):C.Type==="Error"&&E(C.Payload)},r.current.onerror=B=>{console.error("Socket encountered error: ",B.message,"Closing socket"),r.current.close()}};x(3)},[r,h,history]);const F=x=>{r.current&&r.current.send(JSON.stringify({ActionType:"SetTeam",MoreDetails:{Team:x}}))},he=()=>{if(!r.current)return;const x=s&&s.MoreData&&s.MoreData.Variant?s.MoreData.Variant:"";r.current.send(JSON.stringify({ActionType:"Reset",MoreDetails:{MoreOptions:{Seed:Date.now(),Variant:x}}}))},[On,Tn]=a.useState(!0);a.useEffect(()=>{const x=()=>Tn(!On);return window.addEventListener("resize",x),An=>window.removeEventListener("resize",x)});const[Y,et]=a.useState(0);return a.useEffect(()=>{Y>0&&setTimeout(()=>et(Y-1),1e3)},[Y]),a.createElement("div",{className:"min-h-screen flex flex-col items-center p-2 md:p-4"},a.createElement("div",{ref:t,className:`h-full w-full ${n.gamePageMaxWidth} flex flex-col items-center grow`},a.createElement("div",{className:"flex justify-between items-center relative w-full mb-1 justfy-self-start font-thin text-sm"},a.createElement("div",null,"Share this link: ",a.createElement("span",{className:"underline cursor-pointer",onClick:()=>{et(1),navigator.clipboard.writeText(`${window.location.protocol}//${window.location.host}/${h}`)}},`${window.location.protocol}//${window.location.host}/${h}`),Y>0?a.createElement("div",{className:"absolute mt-2 w-full flex justify-center"},a.createElement("div",{className:"absolute top-[-12px] w-6 overflow-hidden inline-block"},a.createElement("div",{className:" h-4 w-4 bg-zinc-600 rotate-45 transform origin-bottom-left"})),a.createElement("div",{className:"font-bold text-xs text-center bg-zinc-600 px-2 py-1"},"copied!")):null),a.createElement("div",{className:"px-1"},a.createElement(Nn,{isConn:N}))),a.createElement("hr",{className:"w-full mb-2"}),a.createElement("div",{className:"flex w-full justify-between items-center mb-4"},a.createElement("div",{className:"flex"},s?s.Teams.map(x=>a.createElement("div",{key:x,className:`text-xs flex items-center justify-center font-bold cursor-pointer mr-1 w-6 h-6 rounded-full border-4 border-${x}-500 ${o&&f&&f[o.Name]===x?`bg-${f[o.Name]}-500`:""}`,onClick:()=>F(x)},s&&["LongestPath","MostCrossings"].includes(s.MoreData.Variant)?s.MoreData.Points[x]:"")):null),a.createElement("div",{className:`font-extrabold ${s&&f&&o&&f[o.Name]&&s.Winners.length===0?`text-${s.Turn}-500`:"text-zinc-100"} ${s&&o&&f&&f[o.Name]===s.Turn&&s.Winners.length===0?"animate-pulse":""}`},s&&f&&o&&f[o.Name]?s.Message:a.createElement("div",{className:"flex items-center animate-pulse"},a.createElement(gn,{className:"mr-1"}),a.createElement("div",null,"select a team")))),a.createElement("div",{className:"h-full flex flex-col justify-center items-center grow"},m),a.createElement("hr",{className:"w-full mb-2"}),a.createElement("div",{className:"w-full flex justify-between items-center"},a.createElement("div",{className:`leading-4 text-2xl font-black text-${n.color} cursor-pointer`},a.createElement("a",{href:`${window.location.protocol}//${window.location.host}`},a.createElement("span",{className:`font-['${n.font}']`},n.key),a.createElement("span",{className:"ml-1 text-[0.5rem] md:text-xs text-zinc-100"},s&&s.MoreData&&s.MoreData.Variant?s.MoreData.Variant:""))),a.createElement("div",{className:"flex"},a.createElement("div",{className:"flex"},a.createElement("div",{className:`px-3 py-1 font-bold cursor-pointer flex items-center justify-center text-xs bg-zinc-600 mr-2 ${s&&s.Winners.length>0?"animate-pulse":""}`,onClick:()=>he()},"new game")),a.createElement("div",{className:"italic text-xs bg-blue-500 py-1 px-2"},a.createElement("a",{href:"https://quibbble.com"},"more ",a.createElement("span",{className:"font-['lobster'] text-sm not-italic"},"quibbble")," games"))))))});O.DownPage=bn,O.Footer=Z,O.GamePage=Sn,O.HomePage=xn,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}); +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const u=$(o);r[u]||(en(s,o),r[u]=!0)}return l.isArray(t)?t.forEach(i):i(t),this}}G.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(G.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),l.freezeMethods(G);const P=G;function le(e,t){const n=this||ie,r=t||n,s=P.from(r.headers);let i=r.data;return l.forEach(e,function(u){i=u.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function $e(e){return!!(e&&e.__CANCEL__)}function z(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}l.inherits(z,b,{__CANCEL__:!0});function tn(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const nn=T.isStandardBrowserEnv?function(){return{write:function(n,r,s,i,o,u){const p=[];p.push(n+"="+encodeURIComponent(r)),l.isNumber(s)&&p.push("expires="+new Date(s).toGMTString()),l.isString(i)&&p.push("path="+i),l.isString(o)&&p.push("domain="+o),u===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function rn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function sn(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function ze(e,t){return e&&!rn(t)?sn(e,t):t}const on=T.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(i){let o=i;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(o){const u=l.isString(o)?s(o):o;return u.protocol===r.protocol&&u.host===r.host}}():function(){return function(){return!0}}();function an(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function ln(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const c=Date.now(),f=r[i];o||(o=c),n[s]=p,r[s]=c;let d=i,y=0;for(;d!==s;)y+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o{const i=s.loaded,o=s.lengthComputable?s.total:void 0,u=i-n,p=r(u),c=i<=o;n=i;const f={loaded:i,total:o,progress:o?i/o:void 0,bytes:u,rate:p||void 0,estimated:p&&o&&c?(o-i)/p:void 0,event:s};f[t?"download":"upload"]=!0,e(f)}}const W={http:Bt,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let s=e.data;const i=P.from(e.headers).normalize(),o=e.responseType;let u;function p(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}l.isFormData(s)&&(T.isStandardBrowserEnv||T.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const E=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(E+":"+m))}const f=ze(e.baseURL,e.url);c.open(e.method.toUpperCase(),_e(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!c)return;const E=P.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),h={data:!o||o==="text"||o==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:E,config:e,request:c};tn(function(N){n(N),p()},function(N){r(N),p()},h),c=null}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){c&&(r(new b("Request aborted",b.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new b("Network Error",b.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let m=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const h=e.transitional||Be;e.timeoutErrorMessage&&(m=e.timeoutErrorMessage),r(new b(m,h.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,c)),c=null},T.isStandardBrowserEnv){const E=(e.withCredentials||on(f))&&e.xsrfCookieName&&nn.read(e.xsrfCookieName);E&&i.set(e.xsrfHeaderName,E)}s===void 0&&i.setContentType(null),"setRequestHeader"in c&&l.forEach(i.toJSON(),function(m,h){c.setRequestHeader(h,m)}),l.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",Me(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",Me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(u=E=>{c&&(r(!E||E.type?new z(null,e,c):E),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u)));const y=an(f);if(y&&T.protocols.indexOf(y)===-1){r(new b("Unsupported protocol "+y+":",b.ERR_BAD_REQUEST,e));return}c.send(s||null)})}};l.forEach(W,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ie={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let s=0;se instanceof P?e.toJSON():e;function j(e,t){t=t||{};const n={};function r(c,f,d){return l.isPlainObject(c)&&l.isPlainObject(f)?l.merge.call({caseless:d},c,f):l.isPlainObject(f)?l.merge({},f):l.isArray(f)?f.slice():f}function s(c,f,d){if(l.isUndefined(f)){if(!l.isUndefined(c))return r(void 0,c,d)}else return r(c,f,d)}function i(c,f){if(!l.isUndefined(f))return r(void 0,f)}function o(c,f){if(l.isUndefined(f)){if(!l.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function u(c,f,d){if(d in t)return r(c,f);if(d in e)return r(void 0,c)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(c,f)=>s(qe(c),qe(f),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(f){const d=p[f]||s,y=d(e[f],t[f],f);l.isUndefined(y)&&d!==u||(n[f]=y)}),n}const Ve="1.5.0",ue={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ue[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Je={};ue.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Ve+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,u)=>{if(t===!1)throw new b(s(o," has been removed"+(n?" in "+n:"")),b.ERR_DEPRECATED);return n&&!Je[o]&&(Je[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,u):!0}};function cn(e,t,n){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const u=e[i],p=u===void 0||o(u,i,e);if(p!==!0)throw new b("option "+i+" must be "+p,b.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new b("Unknown option "+i,b.ERR_BAD_OPTION)}}const fe={assertOptions:cn,validators:ue},k=fe.validators;class K{constructor(t){this.defaults=t,this.interceptors={request:new je,response:new je}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=j(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),s!=null&&(l.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:k.function,serialize:k.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&l.merge(i.common,i[n.method]);i&&l.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=P.concat(o,i);const u=[];let p=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(p=p&&h.synchronous,u.unshift(h.fulfilled,h.rejected))});const c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let f,d=0,y;if(!p){const m=[He.bind(this),void 0];for(m.unshift.apply(m,u),m.push.apply(m,c),y=m.length,f=Promise.resolve(n);d{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(u=>{r.subscribe(u),i=u}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,u){r.reason||(r.reason=new z(i,o,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new de(function(s){t=s}),cancel:t}}}const un=de;function fn(e){return function(n){return e.apply(null,n)}}function dn(e){return l.isObject(e)&&e.isAxiosError===!0}const me={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(me).forEach(([e,t])=>{me[t]=e});const mn=me;function Re(e){const t=new X(e),n=ye(X.prototype.request,t);return l.extend(n,X.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Re(j(e,s))},n}const w=Re(ie);w.Axios=X,w.CanceledError=z,w.CancelToken=un,w.isCancel=$e,w.VERSION=Ve,w.toFormData=J,w.AxiosError=b,w.Cancel=w.CanceledError,w.all=function(t){return Promise.all(t)},w.spread=fn,w.isAxiosError=dn,w.mergeConfig=j,w.AxiosHeaders=P,w.formToJSON=e=>Le(l.isHTMLForm(e)?new FormData(e):e),w.getAdapter=Ie.getAdapter,w.HttpStatusCode=mn,w.default=w;const Q=w;Q.defaults.withCredentials=!0;const pn=async(e,t,n,r,s)=>{let i={method:"POST",url:`${e}/game/create`,headers:{"Content-Type":"application/json"},data:JSON.stringify({GameKey:t,GameID:n,Teams:r,TurnLength:null,MoreOptions:{Seed:Date.now(),Variant:s}})};return Q(i).catch(o=>o.response).then(o=>o.status)},hn=async(e,t,n)=>{let r={method:"GET",url:`${e}/game/snapshot?GameKey=${t}&GameID=${n}`};return Q(r).catch(s=>s.response)},Ge=async e=>{let t={method:"GET",url:`${e}/health`};return Q(t).catch(n=>n.response)};function bn({config:e}){const t=M.useNavigate();return setInterval(function(){async function n(){let r=await Ge(e.host);r&&r.status===200&&t("/")}n()},5e3),a.createElement("div",{className:"flex flex-col items-center my-8 md:my-12"},a.createElement("div",{className:"w-full flex flex-col items-center mt-48"},a.createElement("p",{className:"font-black text-4xl italic"},"We'll be right back!"),a.createElement("p",{className:"mb-1 font-thin"},a.createElement("span",{className:`text-3xl font-black font-['${e.font}'] text-${e.color} mr-1`},e.key)," is down for maintenance")),a.createElement("div",{className:"absolute bottom-8 md:bottom-12"},a.createElement(Z,null)))}const We=["slim","earthy","ablaze","hot","magnificent","cold","jagged","lucky","warm","highfalutin","similar","salty","confident","fuzzy","aquatic","strict","fast","petite","excited","efficient","slow","nervous","narrow","loose","dark","gaping","lowly","rural","savory","amusing","small","sore","mature","sordid","rhetorical","soft","strange","significant","savory","sneaky","little","absorbing","nonchalant","happy","fluffy","hard","giant","beneficial","polite","voracious"],Ke=["childhood","restaurant","elevator","clarinet","school","cat","dog","horse","town","medicine","committee","video","hair","home","cow","music","worker","bottle","food","juice","chair","bench","tuba","vehicle","car","city","assistant","nature","device","lamp","cup","lab","room","population","bed","guitar","bird","painting","dad","piano","bank","error","horn","friend","employee","computer","midnight","card","sun","fan"],pe={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};var Xe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Qe=a.createContext&&a.createContext(Xe),D=globalThis&&globalThis.__assign||function(){return D=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?Object.keys(e.variants)[0]:null),[p,c]=a.useState(!1);a.useEffect(()=>{async function d(){let y=await Ge(e.host);(!y||y.status!==200)&&t("/status/down")}d()},[history]);async function f(d){d.preventDefault();let y=await pn(e.host,e.key,n,s,o);(y===201||y===400)&&t(`/${n}`)}return a.createElement("div",null,a.createElement("div",{className:"flex flex-col items-center m-8 md:m-12"},p?a.createElement("div",{className:"absolute w-full h-full top-0 bg-zinc-500 bg-opacity-50 flex items-center justify-center fade-in"},a.createElement("div",{className:"px-4 py-4 bg-zinc-800 mx-2"},a.createElement("p",{className:"font-bold text-center mb-1"},a.createElement("span",{className:`text-3xl font-black font-['${e.font}'] text-${e.color} mr-1`},e.key)," variants"),Object.keys(e.variants).map(d=>a.createElement("p",{key:d,className:"text-sm"},a.createElement("span",{className:"font-bold"},d,":")," ",e.variants[d])),a.createElement("button",{className:"w-full bg-red-500 mt-2",onClick:()=>c(!1)},"close"))):a.createElement(a.Fragment,null),a.createElement("div",{className:"w-full max-w-2xl"},a.createElement("div",{className:"flex flex-col items-center fade-in"},a.createElement("div",{className:` text-5xl font-black font-['${e.font}'] text-${e.color} mb-1 cursor-pointer`},a.createElement("a",{href:`${window.location.protocol}//${window.location.host}`},e.key)),a.createElement("div",{className:"font-thin mb-3"},"Play ",e.minTeams===e.maxTeams?`${pe[e.minTeams]}`:`${pe[e.minTeams]} to ${pe[e.maxTeams]}`," player ",e.key," online against friends. To create a game or join an existing one, enter a game ID and click 'Go'."),a.createElement("form",{className:"w-full flex mb-2",onSubmit:f},a.createElement("input",{className:"w-10/12 p-2 text-zinc-100 bg-zinc-800 rounded-none border border-zinc-100 text-3xl font-medium box-border focus:outline-dashed outline-blue-500 outline-2",autoFocus:!0,type:"text",value:n,onChange:d=>r(d.target.value)}),a.createElement("button",{className:"w-2/12 font-bold grow-0 bg-blue-500"},"Go")),a.createElement("div",{className:"flex w-full justify-between flex-wrap"},a.createElement("div",{className:"italic text-xs bg-blue-500 py-1 px-2 order-2 md:order-1"},a.createElement("a",{href:"https://quibbble.com"},"more ",a.createElement("span",{className:"font-['lobster'] text-sm not-italic"},"quibbble")," games")),a.createElement("div",{className:"flex items-center order-1 md:order-2 mb-2 md:mb-0"},o?a.createElement(a.Fragment,null,a.createElement(wn,{className:"mr-1 text-xl cursor-pointer",onClick:()=>c(!0)}),a.createElement("div",{className:"mr-1 font-black text-blue-500"},"VARIANT"),a.createElement("select",{className:"mr-1 bg-zinc-800 text-xs h-6 border font-bold border-zinc-100 focus:outline-none",id:"players",onChange:d=>u(d.target.value.replace(/\s/g,""))},Object.keys(e.variants).map(d=>a.createElement("option",{key:d,value:d},d)))):null,e.minTeams!==e.maxTeams?a.createElement(a.Fragment,null,a.createElement("div",{className:"mx-1 font-black text-blue-500"},"PLAYERS"),a.createElement("select",{className:"bg-zinc-800 text-xs h-6 border font-bold border-zinc-100 focus:outline-none",id:"players",onChange:d=>i(parseInt(d.target.value))},Array(e.maxTeams-e.minTeams+1).fill().map((d,y)=>e.minTeams+y).map(d=>a.createElement("option",{key:d,value:d},d)))):null)))),a.createElement("div",{className:"absolute bottom-8 md:bottom-12"},a.createElement(Z,null))))}function gn(e){return Ze({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"}}]})(e)}function Nn({isConn:e}){const[t,n]=a.useState(0);return a.useEffect(()=>{e?setTimeout(()=>n(r=>r-1),1500):n(0)},[e,n]),a.createElement("div",{className:`flex items-center ${e?"cursor-pointer":""}`},t?null:a.createElement("div",{className:"px-1"},e?"connected":"reconnecting"),a.createElement("div",{onClick:()=>{e&&(n(0),setTimeout(()=>n(t-1),1500))},className:`rounded-full w-2 h-2 ${e?"bg-green-500":"bg-orange-500"}`},e?null:a.createElement("div",{className:"rounded-full w-2 h-2 bg-orange-500 animate-ping"})))}const Sn=a.forwardRef((e,t)=>{const{config:n,ws:r,game:s,setGame:i,network:o,setNetwork:u,chat:p,setChat:c,connected:f,setConnected:d,error:y,setError:E,children:m}=e,{gameID:h}=M.useParams(),g=M.useNavigate(),[N,v]=a.useState(!0);a.useEffect(()=>{f&&o&&f[o.Name]&&sessionStorage.setItem(h,f[o.Name])},[o,f,h]),a.useEffect(()=>{const x=async be=>{if(be<=0){g("/");return}let tt=await hn(n.host,n.key,h);if(!tt){g("/status/down");return}if(tt.status!==200){g("/");return}r.current=new WebSocket(`${n.websocket}/game/join?GameKey=${n.key}&GameID=${h}`),r.current.onopen=()=>{v(!0);let B=sessionStorage.getItem(h);B&&F(B)},r.current.onclose=()=>{v(!1),setTimeout(function(){x(be-1)},1e3+(3-be)*500)},r.current.onmessage=async B=>{let C=JSON.parse(B.data);C.Type==="Game"?i(C.Payload):C.Type==="Network"?u(C.Payload):C.Type==="Chat"?c(Cn=>Cn.concat([C.Payload])):C.Type==="Connected"?d(C.Payload):C.Type==="Error"&&E(C.Payload)},r.current.onerror=B=>{console.error("Socket encountered error: ",B.message,"Closing socket"),r.current.close()}};x(3)},[r,h,history]);const F=x=>{r.current&&r.current.send(JSON.stringify({ActionType:"SetTeam",MoreDetails:{Team:x}}))},he=()=>{if(!r.current)return;const x=s&&s.MoreData&&s.MoreData.Variant?s.MoreData.Variant:"";r.current.send(JSON.stringify({ActionType:"Reset",MoreDetails:{MoreOptions:{Seed:Date.now(),Variant:x}}}))},[On,Tn]=a.useState(!0);a.useEffect(()=>{const x=()=>Tn(!On);return window.addEventListener("resize",x),An=>window.removeEventListener("resize",x)});const[Y,et]=a.useState(0);return a.useEffect(()=>{Y>0&&setTimeout(()=>et(Y-1),1e3)},[Y]),a.createElement("div",{className:"min-h-screen flex flex-col items-center p-2 md:p-4"},a.createElement("div",{ref:t,className:`h-full w-full ${n.gamePageMaxWidth} flex flex-col items-center grow`},a.createElement("div",{className:"flex justify-between items-center relative w-full mb-1 justfy-self-start font-thin text-sm"},a.createElement("div",null,"Share this link: ",a.createElement("span",{className:"underline cursor-pointer",onClick:()=>{et(1),navigator.clipboard.writeText(`${window.location.protocol}//${window.location.host}/${h}`)}},`${window.location.protocol}//${window.location.host}/${h}`),Y>0?a.createElement("div",{className:"absolute mt-2 w-full flex justify-center"},a.createElement("div",{className:"absolute top-[-12px] w-6 overflow-hidden inline-block"},a.createElement("div",{className:" h-4 w-4 bg-zinc-600 rotate-45 transform origin-bottom-left"})),a.createElement("div",{className:"font-bold text-xs text-center bg-zinc-600 px-2 py-1"},"copied!")):null),a.createElement("div",{className:"px-1"},a.createElement(Nn,{isConn:N}))),a.createElement("hr",{className:"w-full mb-2"}),a.createElement("div",{className:"flex w-full justify-between items-center mb-4"},a.createElement("div",{className:"flex"},s?s.Teams.map(x=>a.createElement("div",{key:x,className:`text-xs flex items-center justify-center font-bold cursor-pointer mr-1 w-6 h-6 rounded-full border-4 border-${x}-500 ${o&&f&&f[o.Name]===x?`bg-${f[o.Name]}-500`:""}`,onClick:()=>F(x)},s&&s.MoreData&&s.MoreData.Points?s.MoreData.Points[x]:"")):null),a.createElement("div",{className:`font-extrabold ${s&&f&&o&&f[o.Name]&&s.Winners.length===0?`text-${s.Turn}-500`:"text-zinc-100"} ${s&&o&&f&&f[o.Name]===s.Turn&&s.Winners.length===0?"animate-pulse":""}`},s&&f&&o&&f[o.Name]?s.Message:a.createElement("div",{className:"flex items-center animate-pulse"},a.createElement(gn,{className:"mr-1"}),a.createElement("div",null,"select a team")))),a.createElement("div",{className:"h-full flex flex-col justify-center items-center grow"},m),a.createElement("hr",{className:"w-full mb-2"}),a.createElement("div",{className:"w-full flex justify-between items-center"},a.createElement("div",{className:`leading-4 text-2xl font-black text-${n.color} cursor-pointer`},a.createElement("a",{href:`${window.location.protocol}//${window.location.host}`},a.createElement("span",{className:`font-['${n.font}']`},n.key),a.createElement("span",{className:"ml-1 text-[0.5rem] md:text-xs text-zinc-100"},s&&s.MoreData&&s.MoreData.Variant?s.MoreData.Variant:""))),a.createElement("div",{className:"flex"},a.createElement("div",{className:"flex"},a.createElement("div",{className:`px-3 py-1 font-bold cursor-pointer flex items-center justify-center text-xs bg-zinc-600 mr-2 ${s&&s.Winners.length>0?"animate-pulse":""}`,onClick:()=>he()},"new game")),a.createElement("div",{className:"italic text-xs bg-blue-500 py-1 px-2"},a.createElement("a",{href:"https://quibbble.com"},"more ",a.createElement("span",{className:"font-['lobster'] text-sm not-italic"},"quibbble")," games"))))))});O.DownPage=bn,O.Footer=Z,O.GamePage=Sn,O.HomePage=xn,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}); diff --git a/package-lock.json b/package-lock.json index aba5651..6aff8ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@quibbble/boardgame", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@quibbble/boardgame", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", diff --git a/package.json b/package.json index be9ae25..df41ea7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@quibbble/boardgame", "private": false, - "version": "1.0.2", + "version": "1.0.3", "description": "React component library for Quibbble boardgames.", "main": "dist/index.umd.js", "module": "dist/index.mjs", diff --git a/src/components/GamePage/GamePage.jsx b/src/components/GamePage/GamePage.jsx index b25e89e..8c713f5 100644 --- a/src/components/GamePage/GamePage.jsx +++ b/src/components/GamePage/GamePage.jsx @@ -132,7 +132,7 @@ export const GamePage = forwardRef((props, ref) => {
setTeam(el) }> - { game && ["LongestPath", "MostCrossings"].includes(game.MoreData.Variant) ? game.MoreData.Points[el] : "" } + { game && game.MoreData && game.MoreData.Points ? game.MoreData.Points[el] : "" }
) : null } @@ -148,8 +148,8 @@ export const GamePage = forwardRef((props, ref) => { - {/* Individual game logic goes here */}
+ {/* unique game components go here */} { children }