Advertisement
Guest User

smileyface.js

a guest
Nov 18th, 2019
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}if(Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t,n=Object(e),r=1;r<arguments.length;r++)if(null!=(t=arguments[r])){t=Object(t);var o=Object.keys(Object(t)),i=0;for(o.length;void 0>i;i++){var a=o[i],s=Object.getOwnPropertyDescriptor(t,a);void 0!==s&&s.enumerable&&(n[a]=t[a])}}return n}}),String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{enumerable:!1,value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,n=this.filter((function(n,r){return n==e&&r>t}));return 0<n.length}}),Array.prototype.fill||Object.defineProperty(Array.prototype,"fill",{value:function(e){for(var t=[],n=0;n<this.value;n++)t.push(e);return t}}),!u)var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0987654321!@#$%^&*()",u=function(e){for(var t=[],n=0;128>n;n++)t.push(c[Math.floor(Math.random()*c.length)]);return"IESymbol("+t.join("")+(e||"")+")"};function d(e){return u(e)}d.$Symbol=function(){return u}.bind(window)();var h,m=d(),p=function(){function e(n){t(this,e),this._relientObjects=[],this.relatedNodes=[],this._value=n}return r(e,[{key:"hasRelatedNodes",value:function(){return 0<this.relatedNodes.length}},{key:"addRelient",value:function(e){this._relientObjects.push(e)}},{key:d.$Symbol.iterator,value:function(){return regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:case"end":return e.stop()}}),e)}))(this._value)}},{key:"value",get:function(){return this._value},set:function(e){var t=this;this._value=e,e&&e.constructor===Array?(this.relatedNodes=[],e.forEach((function(e){e.isVElement&&t.relatedNodes.push(e)}))):e&&e.isVElement&&(this.relatedNodes=[e]);for(var n=0;n<this._relientObjects.length;n++)this._relientObjects[n].setRelientStateDirty(this)}},{key:m,get:function(){return!0}}]),e}();h||(h=requestAnimationFrame);var f=[],g={timeout:500},v=h||requestAnimationFrame;function b(){var e=f.shift();if(e)for(e.rerender();f[0];)(e=f.shift()).rerender()}var y=d(),w=function(){function e(n){if(t(this,e),this.WARNIFINRENDER=0,this._initialized=!1,this._relient=[],this.isSvg=!1,this.props=n,!this.renderFunctionExists())throw new Error("Components must define a render function")}return r(e,[{key:"renderFunctionExists",value:function(){return this.render instanceof Function}},{key:"renderInternal",value:function(){if(!this._initialized){for(var e=Object.keys(this),t=0;t<e.length;t++)this[e[t]]&&this[e[t]][m]&&this[e[t]].addRelient(this);this._initialized=!0}this.WARNIFINRENDER++;var n=this.render();return this.WARNIFINRENDER--,this._element?this._element.diff(n,!0):this._element=n,this._element.element(this.isSvg)}},{key:"element",value:function(){return this._element?this._element.element(this.isSvg):this.renderInternal()}},{key:"render",value:function(){}},{key:"rerender",value:function(){return this.WARNIFINRENDER&&console.warn("rerender initiated from within the render call, this should be avoided if posible"),10<this.WARNIFINRENDER?(console.error("rerender error: rerender is being called within render several times in a row, this most likeally means that there is an issue."),null):this.renderInternal()}},{key:"addRelient",value:function(e){this._relient.includes(e)||this._relient.push(e)}},{key:"setRelientStateDirty",value:function(){f.includes(this)||f.push(this),v(b,g)}},{key:"setIsSvg",value:function(e){this.isSvg=e}},{key:m,get:function(){return!0}}]),e}();w.prototype[y]=!0;var k,x=[],S=k=new(function(){function e(){t(this,e),this.funcs={log:console.log.bind(console,"%c ians-fw %c log %c ","background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff","background: gray; padding: 1px; border-radius: 0 3px 3px 0;  color: #fff","background:transparent"),error:console.log.bind(console,"%c ians-fw %c error %c ","background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff","background: rgb(190, 0, 0); padding: 1px; border-radius: 0 3px 3px 0;  color: #fff","background:transparent"),warn:console.log.bind(console,"%c ians-fw %c warn %c ","background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff","background: rgb(207, 162, 0); padding: 1px; border-radius: 0 3px 3px 0;  color: #fff","background:transparent")},this._enabled=!1,x.push(this)}return r(e,[{key:"log",value:function(){var e;this._enabled&&(e=this.funcs).log.apply(e,arguments)}},{key:"error",value:function(){var e;this._enabled&&(e=this.funcs).error.apply(e,arguments)}},{key:"warn",value:function(){var e;this._enabled&&(e=this.funcs).warn.apply(e,arguments)}},{key:"createInternalInstance",value:function(){return this.createInstance("fw2gulp INTERNAL ")}},{key:"createInstance",value:function(t){var n=new e;return n.funcs={log:console.log.bind(console,"%c ".concat(t," %c log %c "),"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff","background: gray; padding: 1px; border-radius: 0 3px 3px 0;  color: #fff","background:transparent"),error:console.log.bind(console,"%c ".concat(t," %c error %c "),"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff","background: rgb(190, 0, 0); padding: 1px; border-radius: 0 3px 3px 0;  color: #fff","background:transparent"),warn:console.log.bind(console,"%c ".concat(t," %c warn %c "),"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff","background: rgb(207, 162, 0); padding: 1px; border-radius: 0 3px 3px 0;  color: #fff","background:transparent")},n}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,x.forEach((function(t){return t._enabled=e}))}}]),e}());function N(t){for(var n,r=[],o=Object.keys(t),i=0;i<o.length;i++)t[n=o[i]]&&t[n][m]?r.push(t[n]):"object"===e(t[n])&&r.push.apply(r,l(N(t[n])));return r}Object.defineProperty(window||globalThis||new Function("this")(),"FW2VERBOSE",{value:k});var O=new Map;function _(e,t){O.set(e,{hooks:[]})}function j(e,t){O.get(e).hooks.forEach((function(e){e(t)}))}function E(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var o=n[r],i=t[o];i&&i[m]?e[o]=i.value:(Object.isSealed(e)||Object.isFrozen(e))&&(e[o]=i)}}_("domrenderstart"),_("domrenderend"),_("vdomcreate"),S.createInternalInstance().enabled=!0;var I=function(){function e(n){t(this,e),this.references=new Map,this.initializer=n,this._elements=[],this._elements instanceof Array||(this._elements=[this._elements]),this.render()}return r(e,[{key:"render",value:function(){for(var e,t=0;t<this._elements.length;t++)(e=this._elements[t]._element).parentElement.removeChild(e);this._elements=this.initializer();for(var n,r=0;r<this._elements.length;r++){n=l(this._elements[r].references.keys());for(var o=0;o<n.length;o++)this.references.has(n[o])||this.references.set(n[o],[]),this.references.get(n[o]).push(this._elements[r]),n[o].addRelient(this)}}},{key:"setRelientStateDirty",value:function(){return null}}]),e}();var R=function(){function n(e,r,o){t(this,n),this.childrefs=[],this.references=new Map;var i=function e(t){for(var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],r=0;r<t.length;r++)t[r]instanceof Array?e(t[r],n):n.push(t[r]);return n}(o);this.type=e,this.props=r||{},this.children=i,this.states=[],this.isSvg="svg"===this.type}return r(n,[{key:"element",value:function(e){return this._element||this.render(e||this.isSvg),this._element}},{key:"setIsSvg",value:function(){var t=this,n=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this.isSvg||n?(this.isSvg=n,this.children.forEach((function(r){r.setIsSvg&&r.isSvg===!n?r.setIsSvg(t.isSvg):"object"===e(r)&&Object.getPrototypeOf(r)===w&&r.setIsSvg(t.isSvg)})),this.isSvg):n}},{key:"render",value:function(t){j("domrenderstart",this),t=this.setIsSvg(t||this.isSvg),this._element=t?document.createElementNS("http://www.w3.org/2000/svg",this.type):document.createElement(this.type);for(var r,o=0;o<this.children.length;o++)if(r=n.resolve(this.children[o]),this.children[o]&&this.children[o][m])this.states.push(this.children[o]),this.references.has(this.children[o])||this.references.set(this.children[o],[]),this.references.get(this.children[o]).push(r),this._element.appendChild(r);else if(this.children[o]instanceof Function){this.childrefs[o]=new I(this.children[o]);for(var i=this.childrefs[o]._elements,a=0;a<i.length;a++)this._element.appendChild(i[a]._element)}else r&&this._element.appendChild(r);var s=Object.keys(this.props);if(this.props)for(var l,c=0;c<s.length;c++)if(l=s[c],this.props[l]&&this.props[l][m])this.states.push(this.props[l]),this.references.has(this.props[l])||this.references.set(this.props[l],[]),this.references.get(this.props[l]).push(l);else if("object"===e(this.props[l]))for(var u=N(this.props[l]),d=0;d<u.length;d++)u[d].addRelient(this),this.states.push(u[d]),this.references.has(u[d])||this.references.set(u[d],[]),this.references.get(u[d]).push(l);for(var h,p=0;p<s.length;p++)if(h=s[p],this.props[h]&&this.props[h][m])this._element[h]=this.props[h].value;else if("object"==e(this.props[h]))"children"!=h&&E(this._element[h],this.props[h]);else try{"on"==h.substr(0,2)?this._element.addEventListener(h.substr(2),this.props[h]):(this._element[h]=this.props[h],t&&this._element.setAttribute(h,this.props[h]))}catch(e){this._element.setAttribute(h,this.props[h])}for(var f=0;f<this.states.length;f++)this.states[f].addRelient(this)}},{key:"setRelientStateDirty",value:function(e){for(var t=this,n=this.references.get(e),r=function(r){var o=n[r];o instanceof Text?o.textContent=e.value:o instanceof HTMLSpanElement&&o.hasAttribute("is-state-wrapper")?(e.hasRelatedNodes()&&e.relatedNodes.forEach((function(t){e.relatedNodes.includes(t)||t.element().remove()})),e.value.forEach((function(e){o.appendChild(e.element())}))):"string"==typeof o&&(t.props[o]&&t.props[o][m]?t.element()[o]=t.props[o].value:t.props[o]instanceof Object&&E(t.element()[o],t.props[o]))},o=0;o<n.length;o++)r(o);j("domrenderend",this)}},{key:"diff",value:function(t){var n=this;if(void 0===t)return this.element().parentElement.removeChild(this.element());if(!function t(n,r){if(n===r)return!0;if(!(n instanceof Object&&r instanceof Object))return!1;if(n.constructor!==r.constructor)return!1;for(var o in n)if(n.hasOwnProperty(o)){if(!r.hasOwnProperty(o))return!1;if(n[o]!==r[o]){if("object"!==e(n[o]))return!1;if(!t(n[o],r[o]))return!1}}for(o in r)if(r.hasOwnProperty(o)&&!n.hasOwnProperty(o))return!1;return!0}(this.props,t.props))for(var r=Object.keys(this.props),o=Object.keys(t.props),i=0;i<Math.max(r.length,o.length);i++){var a=r[i],s=o[i];"children"===s||(a&&s?this.props[a]!=t.props[a]&&(this.element()[a]=t.props[a]):a?!s&&delete this.element()[a]:this.element()[s]=t.props[s])}if(this.props=t.props,t.children.length!=this.children.length){var l=this.element().parentElement;l&&(l.insertBefore(t.element(),this.element()),l.removeChild(this.element()),this._element=t.element(),this.children=t.children)}else this.children.forEach((function(e,r){if(e&&e.diff&&"string"!=typeof t.children[r])e.diff(t.children[r]);else if(e!=t.children[r]){var o=n.element().parentElement;o&&t.element()&&n.element()!=t._element&&(o.insertBefore(t.element(),n.element()),o.removeChild(n.element()),n._element=t.element(),n.children=t.children)}}))}},{key:"isVElement",get:function(){return!0}}],[{key:"resolve",value:function(t){if(t instanceof n)return t.element();if(null!=t&&t[m]){if(t.value&&t.value.constructor===Array){var r=document.createElement("span");r.setAttribute("is-state-wrapper","true");for(var o=0;o<t.value.length;o++)r.appendChild(n.resolve(t.value[o]));return r}return t[y]?t.renderInternal():document.createTextNode(t.value)}return null!=t&&"object"===e(t)&&Object.getPrototypeOf(t)instanceof w?t.element():null==t?void 0:document.createTextNode(null==t?" ":t)}}]),n}();var D=document.createElement("style");D.setAttribute("fw-style","true"),document.head?document.head.appendChild(D):document.addEventListener("load",(function(){document.head.appendChild(D)}));var A=0;var C={dom:function(e,t){for(var n,r=arguments.length,o=Array(2<r?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return j("vdomcreate",n="function"==typeof e?Object.getPrototypeOf(e)===w?new e(Object.assign(Object.assign({},t||{}),{children:o})):e(Object.assign(Object.assign({},t||{}),{children:o})):new R(e,t,o)),n},StatefulData:function(e){return new p(e)},stateJoin:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=[],o=(l=!0,(s=m)in(a={get value(){for(var e="",n=0;n<t.length;n++)t[n]&&t[n][m]?e+=t[n].value:t[n]&&(e+=t[n]);return e},addRelient:function(e){r.push(e)},setRelientStateDirty:function(){r.forEach((function(e){e.setRelientStateDirty&&e.setRelientStateDirty(o)}))}})?Object.defineProperty(a,s,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[s]=l,a),i=0;i<t.length;i++)t[i]&&t[i][m]&&t[i].addRelient(o);var a,s,l;return o},css:function(e){for(var t=arguments.length,n=Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=function(e,t){if("string"==typeof e)return e;for(var n="",r=0;r<e.length;r++)n+=e[r]||"",n+=t[r]||"";return n}(e,n);D.innerHTML+="/*".concat(A++,"*/").concat(o).replace(/\n/g,"")},Component:w,verbose:S},P=new URL("assets/normalize-a385b6c4.css",import.meta.url);function L(e){return C.dom("table",{className:"overlay-host",hidden:e.visible},C.dom("tr",null,C.dom("th",null,C.dom("div",{className:"overlay-reset"},e.children))))}C.css("\n.overlay-host{\n    width:100vw;\n    height:100vh;\n    background-color:#3333;\n    position:fixed;\n    top:0px;\n    left:0px;\n}\n.overlay-reset{\n    display:block;\n    background-color:white;\n    border-radius:1em;\n    width:fit-content;\n    padding:1em;\n    margin:auto;\n}\n");var T="localhost:3001",M="localhost:3002",F={page:C.StatefulData("select-use"),user:{name:C.StatefulData("")},editor:{currentGame:C.StatefulData({})}},z=new WebSocket("ws://"+T),q=new WebSocket("ws://"+M),G={},J=new Map;if(localStorage.getItem("SESSION"))try{J=new Map(JSON.parse(localStorage.getItem("SESSION")))}catch(e){}function V(e){return new Promise((function(t){G[e]=function(n){delete G[e],t(n)}}))}function W(){function e(){return Math.floor(16777215*Math.random()).toString(16).padStart(6,"0")}return e()+"-"+e()+"-"+e()}function U(e,t){return Object.assign(Object.assign({},e),{$ENDPOINT:t,authtoken:J.get("auth-token")||null})}q.onmessage=z.onmessage=function(e){var t=JSON.parse(e.data),n=t.token;G[n]&&G[n](t)};var X={mygames:function(e){var t=e.auth,n=e.user,r=e.token,o=void 0===r?W():r;return q.send(JSON.stringify(U({auth:t,user:n,token:o},"mygames"))),V(o)},lobbies:function(){var e=W();return q.send(JSON.stringify(U({token:e},"lobbies"))),V(e)},editor:{create:function(e){var t=e.owner,n=e.name,r=e.token,o=void 0===r?W():r;return q.send(JSON.stringify(U({owner:t,name:n,token:o},"editorCreate"))),V(o)}}},H={login:function(e){var t=e.username,n=e.password,r=e.token,o=void 0===r?W():r;return z.send(JSON.stringify(U({username:t,password:n,token:o},"login"))),V(o).then((function(e){J.set("auth-token",e.auth),J.set("user-token",e.user),J.set("user-name",t),localStorage.setItem("SESSION",JSON.stringify(l(J.entries()))),window.location.replace(window.location)}))},logout:function(){var e=W();return localStorage.removeItem("SESSION"),z.send(JSON.stringify(U({token:e},"logout"))),V(e).then((function(){window.location.replace(window.location)}))},util:{loggedIn:function(){return!!J.get("auth-token")},getToken:function(){return J.get("auth-token")}}};J.has("user-name")&&(F.user.name.value=J.get("user-name"));var B=Object.freeze({__proto__:null,state:F,game:X,auth:H});function $(){var e,t,n=(e=["\n.editor-host {\n    display: grid;\n    grid-template-columns: repeat(5, 1fr);\n    grid-template-rows: 32px repeat(4, 1fr);\n    grid-column-gap: 0px;\n    grid-row-gap: 0px;\n    width:100vw;\n    height:calc(100vh - 32px);\n}\n.editor-toolbar-host {\n    grid-area: 1 / 1 / 2 / 6;\n    border-bottom:2px solid black;\n}\n.editor-player-inspector {\n    grid-area: 2 / 1 / 5 / 2;\n    border-right:2px solid black;\n}\n.editor-inspector-host {\n    grid-area: 2 / 5 / 5 / 6;\n    border-left:2px solid black;\n}\n.editor-interaction-inspector {\n    grid-area: 2 / 2 / 5 / 5;\n}\n.editor-card-list {\n    grid-area: 5 / 1 / 6 / 6;\n    border-top:2px solid black;\n}\n.editor-pane-title{\n    margin:0px;\n}\n.editor-card-display-host{\n    height:150px;\n    overflow-x:scroll;\n    overflow-y:hidden;\n}\n.editor-card-display-item{\n    height:100px;\n    width:100px;\n    background-color:red;\n    margin:5px;\n    border-radius:1em;\n    display:inline-block;\n}\n.editor-card-list-cards{\n    width:max-content;\n}\n.editor-inspector-table{\n    width:100%;\n}\n.editor-inspector-host{\n    overflow-y: scroll;\n    overflow-x: visible;\n}\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return $=function(){return n},n}C.css($());var Y=function(e){function n(e){var r;return t(this,n),(r=s(this,i(n).call(this,e))).game=e.game,r.cards=e.cards,r.scroll=0,r}return o(n,C.Component),r(n,[{key:"render",value:function(){var e=this;return C.dom("div",{className:"editor-card-display-host",onscroll:function(t){e.scroll=t.target.scrollLeft,console.log(e.scroll)}},C.dom("div",{className:"editor-card-list-cards",style:"left:-"+this.scroll+"px;"},this.cards.value.map((function(t){var n=t.name||"no name";return 9<n.length&&(n=n.substr(0,6)+"..."),C.dom("a",{className:"editor-card-display-item",onclick:function(){e.game.inspectedcard.value=t}},n)})),C.dom("div",{className:"editor-card-display-item"},C.dom("button",{onclick:function(){e.cards.value=[].concat(l(e.cards.value),[{name:"",_manditory:["name"],a:1,b:2,c:3,d:4,e:5,f:6,g:7,h:9,j:10,aa:11,ab:12,ac:13,ad:14}])}},"new"))))}}]),n}(),K=function(e){function n(e){var r;return t(this,n),(r=s(this,i(n).call(this,e))).game=e.game,r.card=r.props.card,r.overlaynotvisible=C.StatefulData(!0),r}return o(n,C.Component),r(n,[{key:"render",value:function(){var e=this,t=Object.keys(this.card.value).sort();return C.dom("div",null,C.dom("table",{className:"editor-inspector-table"},t.map((function(t){return"_manditory"!==t&&e.card.value._manditory?C.dom("tr",null,C.dom("th",null,'"',t,'"'),C.dom("th",null,C.dom("input",{value:e.card.value[t],type:"number"==typeof e.card.value?"number":"text",onchange:function(n){e.card.value[t]=n.target.value,e.game.cards.value=e.game.cards.value}})),C.dom("th",null,e.card.value._manditory.includes(t)?C.dom("button",{disabled:!0},"X"):C.dom("button",{onclick:function(){delete e.card.value[t],e.card.value=e.card.value}},"X"))):""})),C.dom("tr",null,C.dom("th",null,C.dom("button",{onclick:function(){e.overlaynotvisible.value=!1}},"+"),C.dom(L,{visible:this.overlaynotvisible},C.dom("div",{className:"login-form"},C.dom("div",{className:"login-overlay-banner"},C.dom("span",null,"add property"),C.dom("button",{onclick:function(){e.overlaynotvisible.value=!0}},"X")),C.dom("hr",null),C.dom("form",{onsubmit:function(t){t.preventDefault();var n=document.querySelector("#attribute-name").value,r=document.querySelector("#attribute-type").value;e.card.value[n]="number"===r?0:"",e.card.value=e.card.value,e.overlaynotvisible.value=!0}},C.dom("label",null,"name"),C.dom("input",{id:"attribute-name",placeholder:"attribute name"}),C.dom("br",null),C.dom("label",null,"type"),C.dom("select",{id:"attribute-type",value:"text"},C.dom("option",{value:"text"},"string"),C.dom("option",{value:"number"},"number")),C.dom("br",null),C.dom("input",{type:"submit"}))))))))}}]),n}();function Q(){var e={cards:C.StatefulData([]),inspectedcard:C.StatefulData({}),triggers:{updatedcard:C.StatefulData(0)}};return C.dom("div",{className:"editor-host"},C.dom("div",{className:"editor-toolbar-host"}),C.dom("div",{className:"editor-player-inspector"},C.dom("p",{className:"editor-pane-title"},"Player Inspector"),C.dom("hr",null)),C.dom("div",{className:"editor-inspector-host"},C.dom("p",{className:"editor-pane-title"},"Inspector"),C.dom("hr",null),C.dom(K,{card:e.inspectedcard,game:e})),C.dom("div",{className:"editor-interaction-inspector"},C.dom("p",{className:"editor-pane-title"},"Interactions"),C.dom("hr",null)),C.dom("div",{className:"editor-card-list"},C.dom("span",{className:"editor-pane-title"},"Cards"),C.dom("hr",null),C.dom(Y,{cards:e.cards,game:e})))}var Z=new URL("assets/play-6eb29077.svg",import.meta.url),ee=new URL("assets/wrench-b766aee9.svg",import.meta.url),te=new URL("assets/new-4a00ea94.svg",import.meta.url);function ne(e){var t=e.item,n=t.title,r=t.id;return C.dom("div",{className:"edit-list-item"},C.dom("h3",null,n),C.dom("p",null,"id:",r),C.dom("a",{className:"icon-button"},C.dom("img",{src:Z.href,width:"50",height:"50"})),C.dom("a",{className:"icon-button",onclick:function(){F.editor.currentGame.value=e.item,F.page.value="game-editor"}},C.dom("img",{src:ee.href,width:"50",height:"50"})))}function re(e){console.log(e.item);var t=e.item,n=t.players,r=t.game,o=t.title,i=t.id;return C.dom("div",{className:"edit-list-item"},C.dom("h3",null,o,"(",n.current,"/",n.max,")"),C.dom("p",null,"game:",r),C.dom("p",null,"id:",i),C.dom("a",{className:"icon-button",onclick:function(){alert("you clicked a button")}},C.dom("img",{src:Z.href,width:"50",height:"50"})))}C.css(".select-use{\n    display:flex;\n    flex-wrap:wrap;\n    justify-content:space-evenly;\n    height: calc(100vh - 32px);\n}\n.select-item{\n    flex-direction: row;\n    border-radius:100%;\n    width:300px;\n    height:300px;\n    align-items:center;\n    text-align:center;\n    margin-top: calc(calc(100vh - 32px) / 2 - 100px);\n    cursor: pointer;\n}\n.select-item>div{\n    transition:0.4s;\n}\n.select-item:hover{\n    background-color:#fff1;\n    box-shadow: 0px 0px 200px 200px #fff1;\n    transition:0.2s;\n}\n.select-item:hover>div{\n    transform:scale(1.2);\n    transition:0.4s;\n}\n.content-host{\n    background-color:gray;\n}\n.edit-list-title{\n    margin:0px;\n}\n.edit-list-host{\n    padding-top:2em;\n}\n.edit-list-wrapper{\n    display: flex;\n    flex-direction: row;\n    flex-wrap: wrap;\n    justify-content: flex-start;\n}\n.edit-list-item{\n    order:1;\n    width:200px;\n    height:200px;\n    margin:1em;\n    background-color:#555;\n    border-radius:1em;\n    text-align:center;\n}\n.create-game,.icon-button{\n    cursor:pointer;\n}\n.create-game-icon{\n    width:100px;\n    height:100px;\n    transform:translate(0px,50px);\n    transition:0.5s;\n}\n.edit-list-item:hover>.create-game-icon{\n    transform:translate(0px,50px) scale(1.5);\n    transition:0.5s;\n}\n.icon-button:hover>img{\n    transition:0.5s;\n    translate:scale(1.2);\n}");var oe=function(e){function n(e){var r;return t(this,n),(r=s(this,i(n).call(this,e))).page=F.page,r.games=C.StatefulData([]),r.lastquery=-5e4,r.createGameOverlayVisible=C.StatefulData(!0),r.newgamename=C.StatefulData(""),r}return o(n,C.Component),r(n,[{key:"render",value:function(){var e=this;return console.log(performance.now()-5e3,this.lastquery),performance.now()-5e3>=this.lastquery&&("game-edit"===this.page.value&&(X.mygames({}).then((function(t){e.games.value=t.games,e.lastquery=performance.now()+5e3})),console.log("TEST")),"game-play"===this.page.value&&X.lobbies().then((function(t){e.games.value=t.lobbies,e.lastquery=performance.now()+5e3}))),C.dom("div",{className:"content-host"},"select-use"===this.page.value?C.dom("div",{className:"select-use"},C.dom("a",{onclick:function(){F.page.value="game-play"},className:"select-item"},C.dom("div",null,C.dom("img",{src:Z.href}))),H.util.loggedIn()?C.dom("a",{onclick:function(){F.page.value="game-edit"},className:"select-item"},C.dom("div",null,C.dom("img",{src:ee.href}))):""):"","game-edit"===this.page.value?C.dom("div",{className:"edit-list-host"},C.dom("h1",{className:"edit-list-title"},"Your games"),C.dom("hr",null),C.dom("div",{className:"edit-list-wrapper"},this.games.value.map((function(e){return C.dom(ne,{item:e})})),C.dom("a",{className:"edit-list-item create-game",onclick:function(){e.createGameOverlayVisible.value=!1}},C.dom("img",{className:"create-game-icon",src:te.href}),C.dom(L,{visible:this.createGameOverlayVisible},C.dom("div",{className:"login-form"},C.dom("div",{className:"login-overlay-banner"},C.dom("span",null,"Create game"),C.dom("button",{onclick:function(){e.createGameOverlayVisible.value=!0}},"X")),C.dom("hr",null),C.dom("form",{onsubmit:function(t){t.preventDefault(),console.log(t),X.editor.create({name:e.newgamename.value,owner:H.util.getToken()}).then((function(t){return console.log(t),t.error?alert(t.message):(F.editor.currentGame.value=t,void(e.createGameOverlayVisible.value=!0))}))}},C.dom("label",{for:"project-name"},"project name"),C.dom("br",null),C.dom("input",{type:"text",placeholder:"username",id:"project-name",onchange:function(t){e.newgamename.value=t.target.value}}),C.dom("br",null),C.dom("input",{type:"submit"}))))))):"","game-play"===this.page.value?C.dom("div",{className:"edit-list-host"},C.dom("h1",{className:"edit-list-title"},"Lobbies"),C.dom("hr",null),C.dom("div",{className:"edit-list-wrapper"},this.games.value.map((function(e){return C.dom(re,{item:e})})))):"","game-editor"===this.page.value?C.dom(Q,null):"")}}]),n}();function ie(){var e=C.StatefulData(!0),t=C.StatefulData(""),n=C.StatefulData("");return C.dom("div",{className:"login-host"},C.dom("span",{className:"user-name-display"},F.user.name),C.dom("button",{className:"login-button",onclick:function(){H.util.loggedIn()?H.logout():e.value=!1}},H.util.loggedIn()?"Logout":"Login"),C.dom(L,{visible:e},C.dom("div",{className:"login-form"},C.dom("div",{className:"login-overlay-banner"},C.dom("span",null,"Login/Sign Up"),C.dom("button",{onclick:function(){e.value=!0}},"X")),C.dom("hr",null),C.dom("form",{onsubmit:function(r){r.preventDefault(),console.log(r),H.login({username:t.value,password:n.value}).then((function(){e.value=!0}))}},C.dom("label",{for:"login-username"},"username"),C.dom("br",null),C.dom("input",{type:"text",placeholder:"username",id:"login-username",onchange:function(e){t.value=e.target.value,console.log("u",t.value)}}),C.dom("br",null),C.dom("label",{for:"login-password"},"password"),C.dom("br",null),C.dom("input",{type:"password",placeholder:"password",id:"login-password",onchange:function(e){n.value=e.target.value,console.log("p",n.value)}}),C.dom("br",null),C.dom("input",{type:"submit"})))))}function ae(){return C.dom("div",{className:"title-host"},C.dom("a",{onclick:function(){F.page.value="select-use"}},C.dom("h3",{className:"title"},"myCardGame")))}C.css(".header-host{\n    display: flex;\n    padding-left:12px;\n    background: #212121;\n    color: white;\n    height:32px;\n}\n.login-host{\n    text-align: right;\n}\n.title-host{\n    flex: 2;\n}\n.login-button{\n    width:100px;\n    height:32px;\n}\n.login-overlay-banner{\n    width:100%;\n}\n.title{\n    color:white;\n    margin:0px;\n}\n.login-form{\n    color:black;\n}\n.user-name-display{\n    padding-right:1em;\n}");var se=C.dom("div",null,C.dom((function(){return C.dom("link",{rel:"stylesheet",href:P.href})}),null),C.dom((function(){return C.dom("div",{className:"header-host"},C.dom(ae,null),C.dom(ie,null))}),null),C.dom(oe,null)),le=se.element.bind(se);Object.defineProperty(window,"fw",{value:C}),Object.defineProperty(window,"app",{value:se}),console.log(B),document.body?document.body.appendChild(le()):document.addEventListener("DOMContentLoaded",(function(){document.body.appendChild(le())})),R.prototype.toString=function(){return this._element?this._element.outerHTML:this.element().outerHTML};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement