bit-office 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- <!DOCTYPE html><!--Ini5NsYvSy_jIXndBUoc4--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-1075fa19d83199c2.js"/><script src="/_next/static/chunks/4d67e943-e6a0fd3b5c397505.js" async=""></script><script src="/_next/static/chunks/977-26ddf708be8caf79.js" async=""></script><script src="/_next/static/chunks/main-app-4f4b0701adf58469.js" async=""></script><meta name="robots" content="noindex"/><meta name="theme-color" content="#1a1a2e"/><title>404: This page could not be found.</title><title>Bit Office</title><meta name="description" content="Control your AI agents from anywhere"/><link rel="manifest" href="/manifest.json"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body style="margin:0;background-color:#1a1a2e;color:#fff;font-family:system-ui, sans-serif"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script>
1
+ <!DOCTYPE html><!--KVUUasWqYxW6SNCIo9Tbn--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-131b3d260a3d9ce4.js"/><script src="/_next/static/chunks/4d67e943-e6a0fd3b5c397505.js" async=""></script><script src="/_next/static/chunks/977-26ddf708be8caf79.js" async=""></script><script src="/_next/static/chunks/main-app-4f4b0701adf58469.js" async=""></script><meta name="robots" content="noindex"/><meta name="theme-color" content="#1a1a2e"/><title>404: This page could not be found.</title><title>Bit Office</title><meta name="description" content="Control your AI agents from anywhere"/><link rel="manifest" href="/manifest.json"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body style="margin:0;background-color:#1a1a2e;color:#fff;font-family:system-ui, sans-serif"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script>
2
2
  if ('serviceWorker' in navigator && location.hostname === 'localhost') {
3
3
  navigator.serviceWorker.getRegistrations().then(function(regs) {
4
4
  for (var r of regs) r.unregister();
5
5
  });
6
6
  }
7
- </script><script src="/_next/static/chunks/webpack-1075fa19d83199c2.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[9653,[],\"\"]\n3:I[1329,[],\"\"]\n4:I[9096,[],\"OutletBoundary\"]\n6:I[913,[],\"AsyncMetadataOutlet\"]\n8:I[9096,[],\"ViewportBoundary\"]\na:I[9096,[],\"MetadataBoundary\"]\nb:\"$Sreact.suspense\"\nd:I[5719,[],\"\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"Ini5NsYvSy_jIXndBUoc4\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"meta\",null,{\"name\":\"theme-color\",\"content\":\"#1a1a2e\"}],[\"$\",\"meta\",null,{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\"}]]}],[\"$\",\"body\",null,{\"style\":{\"margin\":0,\"backgroundColor\":\"#1a1a2e\",\"color\":\"#fff\",\"fontFamily\":\"system-ui, sans-serif\"},\"children\":[[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n if ('serviceWorker' in navigator \u0026\u0026 location.hostname === 'localhost') {\\n navigator.serviceWorker.getRegistrations().then(function(regs) {\\n for (var r of regs) r.unregister();\\n });\\n }\\n \"}}]]}]]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$L5\",[\"$\",\"$L6\",null,{\"promise\":\"$@7\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],null],[\"$\",\"$La\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$b\",null,{\"fallback\":null,\"children\":\"$Lc\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,"7:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"Bit Office\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Control your AI agents from anywhere\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.json\",\"crossOrigin\":\"$undefined\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"c:\"$7:metadata\"\n"])</script></body></html>
7
+ </script><script src="/_next/static/chunks/webpack-131b3d260a3d9ce4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[9653,[],\"\"]\n3:I[1329,[],\"\"]\n4:I[9096,[],\"OutletBoundary\"]\n6:I[913,[],\"AsyncMetadataOutlet\"]\n8:I[9096,[],\"ViewportBoundary\"]\na:I[9096,[],\"MetadataBoundary\"]\nb:\"$Sreact.suspense\"\nd:I[5719,[],\"\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"KVUUasWqYxW6SNCIo9Tbn\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"meta\",null,{\"name\":\"theme-color\",\"content\":\"#1a1a2e\"}],[\"$\",\"meta\",null,{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\"}]]}],[\"$\",\"body\",null,{\"style\":{\"margin\":0,\"backgroundColor\":\"#1a1a2e\",\"color\":\"#fff\",\"fontFamily\":\"system-ui, sans-serif\"},\"children\":[[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n if ('serviceWorker' in navigator \u0026\u0026 location.hostname === 'localhost') {\\n navigator.serviceWorker.getRegistrations().then(function(regs) {\\n for (var r of regs) r.unregister();\\n });\\n }\\n \"}}]]}]]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$L5\",[\"$\",\"$L6\",null,{\"promise\":\"$@7\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],null],[\"$\",\"$La\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$b\",null,{\"fallback\":null,\"children\":\"$Lc\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,"7:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"Bit Office\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Control your AI agents from anywhere\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.json\",\"crossOrigin\":\"$undefined\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"c:\"$7:metadata\"\n"])</script></body></html>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[904],{5702:(e,t,r)=>{r.d(t,{Y:()=>i,k:()=>a});let l=new Map,n=new WeakMap;function i(e){let t=n.get(e);if(t)return t;let r=e.length,l=e[0].length,i=[];for(let e=0;e<r+2;e++)i.push(Array(l+2).fill(""));for(let t=0;t<r;t++)for(let r=0;r<l;r++){if(""===e[t][r])continue;let l=t+1,n=r+1;""===i[l-1][n]&&(i[l-1][n]="#FFFFFF"),""===i[l+1][n]&&(i[l+1][n]="#FFFFFF"),""===i[l][n-1]&&(i[l][n-1]="#FFFFFF"),""===i[l][n+1]&&(i[l][n+1]="#FFFFFF")}for(let t=0;t<r;t++)for(let r=0;r<l;r++)""!==e[t][r]&&(i[t+1][r+1]="");return n.set(e,i),i}function a(e,t){let r=l.get(t);r||(r=new WeakMap,l.set(t,r));let n=r.get(e);if(n)return n;let i=e.length,a=e[0].length,o=document.createElement("canvas");o.width=a*t,o.height=i*t;let s=o.getContext("2d");s.imageSmoothingEnabled=!1;for(let r=0;r<i;r++)for(let l=0;l<a;l++){let n=e[r][l];""!==n&&(s.fillStyle=n,s.fillRect(l*t,r*t,t,t))}return r.set(e,o),o}},6904:(e,t,r)=>{r.r(t),r.d(t,{default:()=>M});var l=r(206),n=r(1406),i=r(8474),a=r(5195);function o(e,t,r,l){let n=r.length,i=n>0?r[0].length:0;if(t<0||t>=n||e<0||e>=i)return!1;let o=r[t][e];return!(o===a.nb.WALL||o===a.nb.VOID||l.has("".concat(e,",").concat(t)))}function s(e,t){let r=e.length,l=r>0?e[0].length:0,n=[];for(let i=0;i<r;i++)for(let r=0;r<l;r++)o(r,i,e,t)&&n.push({col:r,row:i});return n}function u(e,t,r,l,n,i){if(e===r&&t===l)return[];let a=(e,t)=>"".concat(e,",").concat(t),s=a(e,t),u=a(r,l);if(!o(r,l,n,i))return[];let c=new Set;c.add(s);let f=new Map,h=[{col:e,row:t}],d=[{dc:0,dr:-1},{dc:0,dr:1},{dc:-1,dr:0},{dc:1,dr:0}];for(;h.length>0;){let e=h.shift(),t=a(e.col,e.row);if(t===u){let e=[],t=u;for(;t!==s;){let[r,l]=t.split(",").map(Number);e.unshift({col:r,row:l}),t=f.get(t)}return e}for(let r of d){let l=e.col+r.dc,s=e.row+r.dr,u=a(l,s);!c.has(u)&&o(l,s,n,i)&&(c.add(u),f.set(u,t),h.push({col:l,row:s}))}}return[]}var c=r(2243);let f=new Set(["Read","Grep","Glob","WebFetch","WebSearch"]);function h(e,t){return{x:e*a.dn+a.dn/2,y:t*a.dn+a.dn/2}}function d(e,t,r,l){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=l?l.seatCol:1,o=l?l.seatRow:1,s=h(i,o);return{id:e,state:a.Lp.TYPE,dir:l?l.facingDir:a.OP.DOWN,x:s.x,y:s.y,tileCol:i,tileRow:o,path:[],moveProgress:0,currentTool:null,palette:t,hueShift:n,frame:0,frameTimer:0,wanderTimer:0,wanderCount:0,wanderLimit:m(c.Rb,c.he),isActive:!0,seatId:r,bubbleType:null,bubbleTimer:0,seatTimer:0,isSubagent:!1,parentAgentId:null,matrixEffect:null,matrixEffectTimer:0,matrixEffectSeeds:[]}}function g(e,t){return e+Math.random()*(t-e)}function m(e,t){return e+Math.floor(Math.random()*(t-e+1))}function b(e,t,r){return(7*e+13*t+31*Math.floor(r*c.vU)&255)<c.gB}function w(){let e=[];for(let t=0;t<c.W3;t++)e.push(Math.random());return e}var p=r(9631),T=r(9892);class y{setLayout(e){for(let t of(this.layout=e,this.tileMap=(0,p.MB)(e),this.seats=(0,p.CW)(e.furniture),this.blockedTiles=(0,p.AI)(e.furniture),this.furniture=(0,p.Co)(e.furniture),this.walkableTiles=s(this.tileMap,this.blockedTiles),this.characters.values()))if(t.seatId){let e=this.seats.get(t.seatId);if(e)e.assigned=!0;else{t.seatId=null;let e=this.findFreeSeat();e&&(this.seats.get(e).assigned=!0,t.seatId=e)}}this.rebuildFurnitureInstances()}addCharacter(e,t,r){let l;if(this.agentIdToCharId.has(e))return;let n=this.nextCharId++;this.agentIdToCharId.set(e,n),this.charIdToAgentId.set(n,e);let{palette:i,hueShift:o}=void 0!==r?{palette:r,hueShift:0}:this.pickDiversePalette(),s=this.findFreeSeat();if(s){let e=this.seats.get(s);e.assigned=!0,l=d(n,i,s,e,o)}else{let e=this.walkableTiles.length>0?this.walkableTiles[Math.floor(Math.random()*this.walkableTiles.length)]:{col:1,row:1};(l=d(n,i,null,null,o)).x=e.col*a.dn+a.dn/2,l.y=e.row*a.dn+a.dn/2,l.tileCol=e.col,l.tileRow=e.row}l.matrixEffect="spawn",l.matrixEffectTimer=0,l.matrixEffectSeeds=w(),this.characters.set(n,l)}removeCharacter(e){let t=this.agentIdToCharId.get(e);if(void 0===t)return;let r=this.characters.get(t);if(r&&"despawn"!==r.matrixEffect){if(r.seatId){let e=this.seats.get(r.seatId);e&&(e.assigned=!1)}this.selectedCharId===t&&(this.selectedCharId=null),r.matrixEffect="despawn",r.matrixEffectTimer=0,r.matrixEffectSeeds=w(),r.bubbleType=null}}updateCharacterStatus(e,t){let r=this.agentIdToCharId.get(e);if(void 0===r)return;let l=this.characters.get(r);if(!l)return;let n=l.isActive,i="working"===t||"waiting_approval"===t;l.isActive=i,!i&&n?(l.seatTimer=-1,l.path=[],l.moveProgress=0,this.rebuildFurnitureInstances()):i&&!n&&this.rebuildFurnitureInstances()}selectCharacter(e){if(null===e){this.selectedCharId=null;return}let t=this.agentIdToCharId.get(e);this.selectedCharId=null!=t?t:null}showBubble(e,t){let r=this.agentIdToCharId.get(e);if(void 0===r)return;let l=this.characters.get(r);l&&("permission"===t||"working"===t?(l.bubbleType=t,l.bubbleTimer=0):(l.bubbleType="waiting",l.bubbleTimer=c.WK))}clearBubble(e){let t=this.agentIdToCharId.get(e);if(void 0===t)return;let r=this.characters.get(t);r&&("permission"===r.bubbleType||"working"===r.bubbleType?(r.bubbleType=null,r.bubbleTimer=0):"waiting"===r.bubbleType&&(r.bubbleTimer=Math.min(r.bubbleTimer,c.M_)))}getCharacters(){return Array.from(this.characters.values())}getLayout(){return this.layout}getSelectedCharId(){return this.selectedCharId}getHoveredCharId(){return this.hoveredCharId}getAgentId(e){var t;return null!=(t=this.charIdToAgentId.get(e))?t:null}getAgentAtPixel(e,t){for(let l of this.getCharacters().sort((e,t)=>t.y-e.y)){if("despawn"===l.matrixEffect)continue;let n=l.state===a.Lp.TYPE?c.iE:0,i=l.y+n,o=l.x-c.Ns,s=l.x+c.Ns,u=i-c.o3;if(e>=o&&e<=s&&t>=u&&t<=i){var r;return null!=(r=this.charIdToAgentId.get(l.id))?r:null}}return null}setHoveredCharAtPixel(e,t){for(let r of this.getCharacters().sort((e,t)=>t.y-e.y)){if("despawn"===r.matrixEffect)continue;let l=r.state===a.Lp.TYPE?c.iE:0,n=r.y+l,i=r.x-c.Ns,o=r.x+c.Ns,s=n-c.o3;if(e>=i&&e<=o&&t>=s&&t<=n){this.hoveredCharId=r.id;return}}this.hoveredCharId=null}update(e){let t=[];for(let r of this.characters.values()){if(r.matrixEffect){r.matrixEffectTimer+=e,r.matrixEffectTimer>=a.Pz&&("spawn"===r.matrixEffect?(r.matrixEffect=null,r.matrixEffectTimer=0,r.matrixEffectSeeds=[]):t.push(r.id));continue}this.withOwnSeatUnblocked(r,()=>(function(e,t,r,l,n,i){switch(e.frameTimer+=t,e.state){case a.Lp.TYPE:if(e.frameTimer>=c.S3&&(e.frameTimer-=c.S3,e.frame=(e.frame+1)%2),!e.isActive){if(e.seatTimer>0){e.seatTimer-=t;break}e.seatTimer=0,e.state=a.Lp.IDLE,e.frame=0,e.frameTimer=0,e.wanderTimer=g(c.wj,c.k8),e.wanderCount=0,e.wanderLimit=m(c.Rb,c.he)}break;case a.Lp.IDLE:if(e.frame=0,e.seatTimer<0&&(e.seatTimer=0),e.isActive){if(!e.seatId){e.state=a.Lp.TYPE,e.frame=0,e.frameTimer=0;break}let t=l.get(e.seatId);if(t){let r=u(e.tileCol,e.tileRow,t.seatCol,t.seatRow,n,i);r.length>0?(e.path=r,e.moveProgress=0,e.state=a.Lp.WALK):(e.state=a.Lp.TYPE,e.dir=t.facingDir),e.frame=0,e.frameTimer=0}break}if(e.wanderTimer-=t,e.wanderTimer<=0){if(e.wanderCount>=e.wanderLimit&&e.seatId){let t=l.get(e.seatId);if(t){let r=u(e.tileCol,e.tileRow,t.seatCol,t.seatRow,n,i);if(r.length>0){e.path=r,e.moveProgress=0,e.state=a.Lp.WALK,e.frame=0,e.frameTimer=0;break}}}if(r.length>0){let t=r[Math.floor(Math.random()*r.length)],l=u(e.tileCol,e.tileRow,t.col,t.row,n,i);l.length>0&&(e.path=l,e.moveProgress=0,e.state=a.Lp.WALK,e.frame=0,e.frameTimer=0,e.wanderCount++)}e.wanderTimer=g(c.wj,c.k8)}break;case a.Lp.WALK:{if(e.frameTimer>=c.lY&&(e.frameTimer-=c.lY,e.frame=(e.frame+1)%4),0===e.path.length){let t=h(e.tileCol,e.tileRow);if(e.x=t.x,e.y=t.y,e.isActive)if(e.seatId){let t=l.get(e.seatId);t&&e.tileCol===t.seatCol&&e.tileRow===t.seatRow?(e.state=a.Lp.TYPE,e.dir=t.facingDir):e.state=a.Lp.IDLE}else e.state=a.Lp.TYPE;else{if(e.seatId){let t=l.get(e.seatId);if(t&&e.tileCol===t.seatCol&&e.tileRow===t.seatRow){e.state=a.Lp.TYPE,e.dir=t.facingDir,e.seatTimer<0?e.seatTimer=0:e.seatTimer=g(c.Ot,c.Ww),e.wanderCount=0,e.wanderLimit=m(c.Rb,c.he),e.frame=0,e.frameTimer=0;break}}e.state=a.Lp.IDLE,e.wanderTimer=g(c.wj,c.k8)}e.frame=0,e.frameTimer=0;break}let r=e.path[0];e.dir=function(e,t,r,l){let n=r-e;return n>0?a.OP.RIGHT:n<0?a.OP.LEFT:l-t>0?a.OP.DOWN:a.OP.UP}(e.tileCol,e.tileRow,r.col,r.row),e.moveProgress+=c.XE/a.dn*t;let o=h(e.tileCol,e.tileRow),s=h(r.col,r.row),f=Math.min(e.moveProgress,1);if(e.x=o.x+(s.x-o.x)*f,e.y=o.y+(s.y-o.y)*f,e.moveProgress>=1&&(e.tileCol=r.col,e.tileRow=r.row,e.x=s.x,e.y=s.y,e.path.shift(),e.moveProgress=0),e.isActive&&e.seatId){let t=l.get(e.seatId);if(t){let r=e.path[e.path.length-1];if(!r||r.col!==t.seatCol||r.row!==t.seatRow){let r=u(e.tileCol,e.tileRow,t.seatCol,t.seatRow,n,i);r.length>0&&(e.path=r,e.moveProgress=0)}}}}}})(r,e,this.walkableTiles,this.seats,this.tileMap,this.blockedTiles)),"waiting"===r.bubbleType&&(r.bubbleTimer-=e,r.bubbleTimer<=0&&(r.bubbleType=null,r.bubbleTimer=0))}for(let e of t){let t=this.charIdToAgentId.get(e);this.characters.delete(e),t&&(this.agentIdToCharId.delete(t),this.charIdToAgentId.delete(e))}}findFreeSeat(){for(let[e,t]of this.seats)if(!t.assigned)return e;return null}pickDiversePalette(){let e=Array(c.ic).fill(0);for(let t of this.characters.values())!t.isSubagent&&e[t.palette]++;let t=Math.min(...e),r=[];for(let l=0;l<c.ic;l++)e[l]===t&&r.push(l);let l=r[Math.floor(Math.random()*r.length)],n=0;return t>0&&(n=c.qt+Math.floor(Math.random()*c.p7)),{palette:l,hueShift:n}}ownSeatKey(e){if(!e.seatId)return null;let t=this.seats.get(e.seatId);return t?"".concat(t.seatCol,",").concat(t.seatRow):null}withOwnSeatUnblocked(e,t){let r=this.ownSeatKey(e);r&&this.blockedTiles.delete(r);let l=t();return r&&this.blockedTiles.add(r),l}rebuildFurnitureInstances(){let e=new Set;for(let t of this.characters.values()){if(!t.isActive||!t.seatId)continue;let r=this.seats.get(t.seatId);if(!r)continue;let l=r.facingDir===a.OP.RIGHT?1:r.facingDir===a.OP.LEFT?-1:0,n=r.facingDir===a.OP.DOWN?1:r.facingDir===a.OP.UP?-1:0;for(let t=1;t<=c.Xo;t++)e.add("".concat(r.seatCol+l*t,",").concat(r.seatRow+n*t));for(let t=1;t<=c.ou;t++){let i=r.seatCol+l*t,a=r.seatRow+n*t;0!==l?(e.add("".concat(i,",").concat(a-1)),e.add("".concat(i,",").concat(a+1))):(e.add("".concat(i-1,",").concat(a)),e.add("".concat(i+1,",").concat(a)))}}if(0===e.size){this.furniture=(0,p.Co)(this.layout.furniture);return}let t=this.layout.furniture.map(t=>{let r=(0,T.Um)(t.type);if(!r)return t;for(let l=0;l<r.footprintH;l++)for(let n=0;n<r.footprintW;n++)if(e.has("".concat(t.col+n,",").concat(t.row+l))){let e=(0,T.xr)(t.type);if(e!==t.type)return{...t,type:e};return t}return t});this.furniture=(0,p.Co)(t)}constructor(e){this.characters=new Map,this.selectedCharId=null,this.hoveredCharId=null,this.agentIdToCharId=new Map,this.charIdToAgentId=new Map,this.nextCharId=1,this.layout=e||(0,p.kr)(),this.tileMap=(0,p.MB)(this.layout),this.seats=(0,p.CW)(this.layout.furniture),this.blockedTiles=(0,p.AI)(this.layout.furniture),this.furniture=(0,p.Co)(this.layout.furniture),this.walkableTiles=s(this.tileMap,this.blockedTiles)}}var C=r(5702),v=r(2988),I=r(4777),x=r(5055),R=r(4296),k=r(1204);function M(e){let{onAgentClick:t,selectedAgent:r,editMode:o,editorRef:s,onTileClick:u,onTileRightClick:h,onGhostMove:d,onDragStart:g,onDragMove:m,onDragEnd:w,onDeleteBtnClick:p,onRotateBtnClick:M,stateRef:E,onAssetsLoaded:S,zoomRef:P,panRef:L}=e,A=(0,n.useRef)(null),Y=(0,n.useRef)(null),F=(0,n.useRef)(new Set),[B,W]=(0,n.useState)(!1),D=(0,n.useRef)(null),X=(0,n.useRef)(t);X.current=t;let U=(0,n.useRef)(o);U.current=o;let O=(0,n.useRef)(!1),z=(0,n.useRef)({x:0,y:0,panX:0,panY:0}),H=(0,n.useRef)({offsetX:0,offsetY:0});(0,n.useRef)(0);let N=(0,n.useRef)(null),V=(0,n.useCallback)((e,t)=>{let r=E.current;if(!r)return 4;let l=r.layout.cols*c.dn,n=r.layout.rows*c.dn;return Math.max(c.DH,Math.floor(Math.min(e/l,t/n)))},[E]),_=(0,n.useCallback)(()=>{let e=A.current;if(!e)return;let t=e.parentElement;if(!t)return;let r=window.devicePixelRatio||1,l=t.clientWidth,n=t.clientHeight;e.width=l*r,e.height=n*r,e.style.width="".concat(l,"px"),e.style.height="".concat(n,"px");let i=e.getContext("2d");i&&i.scale(r,r),P.current=V(l,n),L.current={x:0,y:0}},[V,P,L]);(0,n.useEffect)(()=>{let e=!1;return(0,R.F)().then(t=>{e||((0,T.ar)(t.tilesetSprites),D.current=t.layout,W(!0),null==S||S())}).catch(t=>{console.warn("[OfficeCanvas] Asset loading failed, using fallbacks:",t),e||(W(!0),null==S||S())}),()=>{e=!0}},[S]),(0,n.useEffect)(()=>{var e;if(!B)return;let t=A.current;if(!t)return;let r=new y(null!=(e=D.current)?e:void 0);for(let[e,t]of(E.current=r,_(),window.addEventListener("resize",_),i.f.getState().agents))r.addCharacter(e,t.name,t.palette),r.updateCharacterStatus(e,t.status),F.current.add(e);let l=window.devicePixelRatio||1,n=function(e,t){let r=e.getContext("2d");r.imageSmoothingEnabled=!1;let l=0,n=0,i=!1,a=e=>{if(i)return;let o=0===l?0:Math.min((e-l)/1e3,c.O9);l=e,t.update(o),r.imageSmoothingEnabled=!1,t.render(r),n=requestAnimationFrame(a)};return n=requestAnimationFrame(a),()=>{i=!0,cancelAnimationFrame(n)}}(t,{update:e=>{r.update(e)},render:e=>{let n,i=t.width/l,o=t.height/l,u=P.current,h=L.current,d=s.current;if(U.current){let e=null;if(d.activeTool===a.VF.FURNITURE_PLACE&&d.selectedFurnitureType){let t=(0,T.Um)(d.selectedFurnitureType);t&&(e=t.sprite)}if(d.dragUid){let t=r.layout.furniture.find(e=>e.uid===d.dragUid);if(t){let r=(0,T.Um)(t.type);r&&(e=r.sprite)}}let t=!1,l=0,i=0,o=1,s=1,u=!1;if(d.selectedFurnitureUid){let e=r.layout.furniture.find(e=>e.uid===d.selectedFurnitureUid);if(e){var g,m;let r=(0,T.Um)(e.type);t=!0,l=e.col,i=e.row,o=null!=(g=null==r?void 0:r.footprintW)?g:1,s=null!=(m=null==r?void 0:r.footprintH)?m:1,u=(0,T.ZZ)(e.type)}}n={showGrid:!0,ghostSprite:e,ghostCol:d.ghostCol,ghostRow:d.ghostRow,ghostValid:d.ghostValid,hasSelection:t,selectedCol:l,selectedRow:i,selectedW:o,selectedH:s,isRotatable:u,deleteButtonBounds:null,rotateButtonBounds:null,showGhostBorder:!0,ghostBorderHoverCol:d.ghostCol,ghostBorderHoverRow:d.ghostRow}}H.current=function(e,t,r,l,n,i,o,s,u,h,d,g,m,w,p){e.clearRect(0,0,t,r);let T=null!=m?m:l.length>0?l[0].length:0,y=null!=w?w:l.length,R=T*a.dn*o,k=y*a.dn*o,M=Math.floor((t-R)/2)+Math.round(s),E=Math.floor((r-k)/2)+Math.round(u);!function(e,t,r,l,n,i,o){let s=a.dn*n,u=(0,I.$0)(),f=t.length,h=f>0?t[0].length:0,d=null!=o?o:h;for(let o=0;o<f;o++)for(let f=0;f<h;f++){var g;let h=t[o][f];if(h===a.nb.VOID)continue;if(h===a.nb.WALL||!u){if(h===a.nb.WALL){let t=o*d+f,r=null==i?void 0:i[t];e.fillStyle=r?(0,x.og)(r):I.ty}else e.fillStyle=c.q3;e.fillRect(r+f*s,l+o*s,s,s);continue}let m=o*d+f,b=null!=(g=null==i?void 0:i[m])?g:{h:0,s:0,b:0,c:0},w=(0,I.To)(h,b),p=(0,C.k)(w,n);e.drawImage(p,r+f*s,l+o*s)}}(e,l,M,E,o,g,m);let S=(0,x.BN)()?(0,x.vb)(l,g,m):[];return!function(e,t,r,l,n,i,o,s){let u=[];for(let e of t){let t=(0,C.k)(e.sprite,i),r=l+e.x*i,a=n+e.y*i;u.push({zY:e.zY,draw:e=>{e.drawImage(t,r,a)}})}for(let e of r){let t=(0,v.Ih)(e.palette,e.hueShift),r=function(e,t){switch(e.state){case a.Lp.TYPE:var r;if((r=e.currentTool)&&f.has(r))return t.reading[e.dir][e.frame%2];return t.typing[e.dir][e.frame%2];case a.Lp.WALK:return t.walk[e.dir][e.frame%4];case a.Lp.IDLE:default:return t.walk[e.dir][1]}}(e,t),h=(0,C.k)(r,i),d=e.state===a.Lp.TYPE?c.iE:0,g=Math.round(l+e.x*i-h.width/2),m=Math.round(n+(e.y+d)*i-h.height),w=e.y+a.dn/2+c.Sg;if(e.matrixEffect){let t=e;u.push({zY:w,draw:e=>{!function(e,t,r,l,n,i){let o=t.matrixEffectTimer/a.Pz,s="spawn"===t.matrixEffect,u=t.matrixEffectTimer,f=c.wN+c.M1;for(let a=0;a<c.W3;a++){var h,d;let g=Math.max(0,Math.min(1,(o-(null!=(h=t.matrixEffectSeeds[a])?h:0)*c.hI)/(1-c.hI)))*f;for(let t=0;t<c.wN;t++){let o=null==(d=r[t])?void 0:d[a],f=o&&""!==o,h=g-t,m=l+a*i,w=n+t*i;if(s)if(h<0)continue;else if(h<1)e.fillStyle=c.zw,e.fillRect(m,w,i,i);else if(h<c.M1){let r=h/c.M1;if(f){e.fillStyle=o,e.fillRect(m,w,i,i);let l=(1-r)*c.Nd;b(a,t,u)&&(e.fillStyle="rgba(0, 255, 65, ".concat(l,")"),e.fillRect(m,w,i,i))}else if(b(a,t,u)){let t=(1-r)*c.gi;e.fillStyle=r<c.Wn?"rgba(0, 255, 65, ".concat(t,")"):r<c.WJ?"rgba(0, 170, 40, ".concat(t,")"):"rgba(0, 85, 20, ".concat(t,")"),e.fillRect(m,w,i,i)}}else f&&(e.fillStyle=o,e.fillRect(m,w,i,i));else if(h<0)f&&(e.fillStyle=o,e.fillRect(m,w,i,i));else if(h<1)e.fillStyle=c.zw,e.fillRect(m,w,i,i);else if(h<c.M1&&b(a,t,u)){let t=h/c.M1,r=(1-t)*c.gi;e.fillStyle=t<c.Wn?"rgba(0, 255, 65, ".concat(r,")"):t<c.WJ?"rgba(0, 170, 40, ".concat(r,")"):"rgba(0, 85, 20, ".concat(r,")"),e.fillRect(m,w,i,i)}}}}(e,t,r,g,m,i)}});continue}let p=null!==o&&e.id===o,T=null!==s&&e.id===s;if(p||T){let e=p?c.O1:c.y9,t=(0,C.Y)(r),l=(0,C.k)(t,i),n=g-i,a=m-i;u.push({zY:w-c.F2,draw:t=>{t.save(),t.globalAlpha=e,t.drawImage(l,n,a),t.restore()}})}u.push({zY:w,draw:e=>{e.drawImage(h,g,m)}})}for(let t of(u.sort((e,t)=>e.zY-t.zY),u))t.draw(e)}(e,S.length>0?[...S,...n]:n,i,M,E,o,h,d),!function(e,t,r,l,n){for(let i of t){if(!i.bubbleType)continue;let t="permission"===i.bubbleType?v.$D:"working"===i.bubbleType?v.j9:v.VQ,o=1;"waiting"===i.bubbleType&&i.bubbleTimer<c.v3&&(o=i.bubbleTimer/c.v3);let s=(0,C.k)(t,n),u=i.state===a.Lp.TYPE?c.PA:0,f=Math.round(r+i.x*n-s.width/2),h=Math.round(l+(i.y+u-c.$L)*n-s.height-n);e.save(),o<1&&(e.globalAlpha=o),e.drawImage(s,f,h),e.restore()}}(e,i,M,E,o),p&&(p.showGrid&&function(e,t,r,l,n,i,o){let s=a.dn*l;e.strokeStyle=c.AL,e.lineWidth=1,e.beginPath();for(let l=0;l<=n;l++){let n=t+l*s+.5;e.moveTo(n,r),e.lineTo(n,r+i*s)}for(let l=0;l<=i;l++){let i=r+l*s+.5;e.moveTo(t,i),e.lineTo(t+n*s,i)}if(e.stroke(),o){e.save(),e.strokeStyle=c.fJ,e.lineWidth=1,e.setLineDash(c.i);for(let l=0;l<i;l++)for(let i=0;i<n;i++){var u;(null==(u=o[l])?void 0:u[i])===a.nb.VOID&&e.strokeRect(t+i*s+.5,r+l*s+.5,s-1,s-1)}e.restore()}}(e,M,E,o,T,y,l),p.showGhostBorder&&function(e,t,r,l,n,i,o,s){let u=a.dn*l;e.save();let f=[];for(let e=-1;e<=n;e++)f.push({c:e,r:-1}),f.push({c:e,r:i});for(let e=0;e<i;e++)f.push({c:-1,r:e}),f.push({c:n,r:e});for(let{c:l,r:n}of f){let i=t+l*u,a=r+n*u,f=l===o&&n===s;f&&(e.fillStyle=c.Mo,e.fillRect(i,a,u,u)),e.strokeStyle=f?c.pr:c.gD,e.lineWidth=1,e.setLineDash(c.i),e.strokeRect(i+.5,a+.5,u-1,u-1)}e.restore()}(e,M,E,o,T,y,p.ghostBorderHoverCol,p.ghostBorderHoverRow),p.ghostSprite&&p.ghostCol>=0&&function(e,t,r,l,n,i,o,s){let u=(0,C.k)(t,s),f=i+r*a.dn*s,h=o+l*a.dn*s;e.save(),e.globalAlpha=c.qD,e.drawImage(u,f,h),e.globalAlpha=c.W7,e.fillStyle=n?c.TE:c.oj,e.fillRect(f,h,u.width,u.height),e.restore()}(e,p.ghostSprite,p.ghostCol,p.ghostRow,p.ghostValid,M,E,o),p.hasSelection?(!function(e,t,r,l,n,i,o,s){let u=a.dn*s;e.save(),e.strokeStyle=c.Ii,e.lineWidth=2,e.setLineDash(c.n6),e.strokeRect(i+t*u+1,o+r*u+1,l*u-2,n*u-2),e.restore()}(e,p.selectedCol,p.selectedRow,p.selectedW,p.selectedH,M,E,o),p.deleteButtonBounds=function(e,t,r,l,n,i,o,s){let u=a.dn*s,f=i+(t+l)*u+1,h=o+r*u-1,d=Math.max(c.l0,s*c.YX);e.save(),e.beginPath(),e.arc(f,h,d,0,2*Math.PI),e.fillStyle=c.Zz,e.fill(),e.strokeStyle="#fff",e.lineWidth=Math.max(c.SS,s*c.zY),e.lineCap="round";let g=d*c.R_;return e.beginPath(),e.moveTo(f-g,h-g),e.lineTo(f+g,h+g),e.moveTo(f+g,h-g),e.lineTo(f-g,h+g),e.stroke(),e.restore(),{cx:f,cy:h,radius:d}}(e,p.selectedCol,p.selectedRow,p.selectedW,p.selectedH,M,E,o),p.isRotatable?p.rotateButtonBounds=function(e,t,r,l,n,i,o,s){let u=a.dn*s,f=Math.max(c.l0,s*c.YX),h=i+t*u-1,d=o+r*u-1;e.save(),e.beginPath(),e.arc(h,d,f,0,2*Math.PI),e.fillStyle=c.BD,e.fill(),e.strokeStyle="#fff",e.lineWidth=Math.max(c.SS,s*c.zY),e.lineCap="round";let g=f*c.R_;e.beginPath(),e.arc(h,d,g,-(.8*Math.PI),.7*Math.PI),e.stroke();let m=.7*Math.PI,b=h+g*Math.cos(m),w=d+g*Math.sin(m),p=.35*f;return e.beginPath(),e.moveTo(b+.6*p,w-.3*p),e.lineTo(b,w),e.lineTo(b+.7*p,w+.5*p),e.stroke(),e.restore(),{cx:h,cy:d,radius:f}}(e,p.selectedCol,p.selectedRow,p.selectedW,p.selectedH,M,E,o):p.rotateButtonBounds=null):(p.deleteButtonBounds=null,p.rotateButtonBounds=null)),{offsetX:M,offsetY:E}}(e,i,o,r.tileMap,r.furniture,r.getCharacters(),u,h.x,h.y,r.getSelectedCharId(),r.getHoveredCharId(),r.layout.tileColors,r.layout.cols,r.layout.rows,n),N.current=null!=n?n:null}});return Y.current=n,()=>{n(),Y.current=null,E.current=null,F.current.clear(),window.removeEventListener("resize",_)}},[B,_,E,P,L,s]),(0,n.useEffect)(()=>i.f.subscribe(e=>{let t=E.current;if(!t)return;let r=new Set(e.agents.keys());for(let[r,l]of e.agents)F.current.has(r)||(t.addCharacter(r,l.name,l.palette),F.current.add(r)),t.updateCharacterStatus(r,l.status),l.pendingApproval?t.showBubble(r,"permission"):"working"===l.status?t.showBubble(r,"working"):"done"===l.status||"error"===l.status?t.showBubble(r,"waiting"):t.clearBubble(r);for(let e of F.current)r.has(e)||(t.removeCharacter(e),F.current.delete(e))}),[E]),(0,n.useEffect)(()=>{var e;null==(e=E.current)||e.selectCharacter(r)},[r,E]);let j=(0,n.useCallback)((e,t)=>{let r=A.current;if(!r)return{x:0,y:0};let l=r.getBoundingClientRect(),n=P.current,{offsetX:i,offsetY:a}=H.current;return{x:(e-l.left-i)/n,y:(t-l.top-a)/n}},[P]),q=(0,n.useCallback)((e,t)=>({col:Math.floor(e/c.dn),row:Math.floor(t/c.dn)}),[]),G=(0,n.useCallback)((e,t)=>{let r=j(e,t);return q(r.x,r.y)},[j,q]),K=(0,n.useCallback)(e=>{if(O.current=!0,z.current={x:e.clientX,y:e.clientY,panX:L.current.x,panY:L.current.y},U.current&&s.current.selectedFurnitureUid){var t;let r=G(e.clientX,e.clientY),l=null==(t=E.current)?void 0:t.layout;if(l){let e=(0,k.iH)(l,r.col,r.row);e&&e.uid===s.current.selectedFurnitureUid&&(null==g||g(r.col,r.row))}}},[L,s,E,G,g]),Z=(0,n.useCallback)(e=>{let t=E.current;if(t&&!U.current){let r=j(e.clientX,e.clientY);t.setHoveredCharAtPixel(r.x,r.y)}if(U.current){let t=G(e.clientX,e.clientY);s.current.dragUid?null==m||m(t.col,t.row):null==d||d(t.col,t.row)}if(!O.current||s.current.dragUid)return;let r=e.clientX-z.current.x,l=e.clientY-z.current.y;L.current={x:z.current.panX+r,y:z.current.panY+l}},[j,G,E,L,s,m,d]),J=(0,n.useCallback)(e=>{let t=O.current;if(O.current=!1,s.current.dragUid){let t=G(e.clientX,e.clientY);null==w||w(t.col,t.row);return}let r=Math.abs(e.clientX-z.current.x),l=Math.abs(e.clientY-z.current.y);if(t&&(r>5||l>5))return;let n=E.current;if(!n)return;if(U.current){let t=N.current;if(t){let r=A.current;if(r){let l=r.getBoundingClientRect(),n=e.clientX-l.left,i=e.clientY-l.top;if(t.deleteButtonBounds){let{cx:e,cy:r,radius:l}=t.deleteButtonBounds;if(Math.sqrt((n-e)**2+(i-r)**2)<=l){null==p||p();return}}if(t.rotateButtonBounds){let{cx:e,cy:r,radius:l}=t.rotateButtonBounds;if(Math.sqrt((n-e)**2+(i-r)**2)<=l){null==M||M();return}}}}let r=G(e.clientX,e.clientY);null==u||u(r.col,r.row);return}let i=j(e.clientX,e.clientY),a=n.getAgentAtPixel(i.x,i.y);a&&X.current(a)},[j,G,E,s,u,w,p,M]),$=(0,n.useCallback)(e=>{if(!U.current)return;e.preventDefault();let t=G(e.clientX,e.clientY);null==h||h(t.col,t.row)},[G,h]),Q=(0,n.useCallback)(e=>{},[]),ee=(0,n.useRef)([]),et=(0,n.useRef)(0),er=(0,n.useCallback)(e=>{if(ee.current=Array.from(e.touches),2===e.touches.length){let t=e.touches[0].clientX-e.touches[1].clientX,r=e.touches[0].clientY-e.touches[1].clientY;et.current=Math.sqrt(t*t+r*r)}else 1===e.touches.length&&(O.current=!0,z.current={x:e.touches[0].clientX,y:e.touches[0].clientY,panX:L.current.x,panY:L.current.y})},[L]),el=(0,n.useCallback)(e=>{if(2===e.touches.length){let t=e.touches[0].clientX-e.touches[1].clientX,r=e.touches[0].clientY-e.touches[1].clientY,l=Math.sqrt(t*t+r*r),n=l-et.current;Math.abs(n)>20&&(P.current=Math.max(c.DH,Math.min(c.ZV,P.current+(n>0?1:-1))),et.current=l)}else if(1===e.touches.length&&O.current){let t=e.touches[0].clientX-z.current.x,r=e.touches[0].clientY-z.current.y;L.current={x:z.current.panX+t,y:z.current.panY+r}}},[P,L]),en=(0,n.useCallback)(e=>{if(0===e.touches.length&&1===ee.current.length){let e=ee.current[0],t=Math.abs(e.clientX-z.current.x),r=Math.abs(e.clientY-z.current.y);if(t<10&&r<10)if(U.current){let t=G(e.clientX,e.clientY);null==u||u(t.col,t.row)}else{let t=E.current;if(t){let r=j(e.clientX,e.clientY),l=t.getAgentAtPixel(r.x,r.y);l&&X.current(l)}}}O.current=!1,ee.current=Array.from(e.touches)},[j,G,E,u]),ei=o?s.current.activeTool===a.VF.ERASE?"crosshair":s.current.activeTool===a.VF.EYEDROPPER?"copy":s.current.activeTool===a.VF.FURNITURE_PLACE?"cell":s.current.dragUid?"grabbing":"default":"grab";return(0,l.jsxs)("div",{style:{width:"100%",height:"100%",overflow:"hidden",backgroundColor:"#12121f"},children:[!B&&(0,l.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:14,fontFamily:"system-ui, sans-serif",zIndex:10},children:"Loading office..."}),(0,l.jsx)("canvas",{ref:A,onPointerDown:K,onPointerMove:Z,onPointerUp:J,onContextMenu:$,onWheel:Q,onTouchStart:er,onTouchMove:el,onTouchEnd:en,style:{display:"block",width:"100%",height:"100%",touchAction:"none",cursor:ei}})]})}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[823],{1204:(e,t,r)=>{"use strict";r.d(t,{FH:()=>a,Ii:()=>f,PT:()=>c,WC:()=>u,iH:()=>h,iZ:()=>d,qZ:()=>s,si:()=>p,vk:()=>g});var n=r(5195),o=r(2243),l=r(9892),i=r(9631);function a(e,t,r,l,i){let a=r*e.cols+t;if(a<0||a>=e.tiles.length)return e;let s=e.tileColors||Array(e.tiles.length).fill(null),c=null!=i?i:l===n.nb.WALL||l===n.nb.VOID?null:{...o.ql};if(e.tiles[a]===l){let t=s[a];if(null===c&&null===t||c&&t&&c.h===t.h&&c.s===t.s&&c.b===t.b&&c.c===t.c&&!!c.colorize==!!t.colorize)return e}let d=[...e.tiles];d[a]=l;let u=[...s];return u[a]=c,{...e,tiles:d,tileColors:u}}function s(e,t){return f(e,t.type,t.col,t.row)?{...e,furniture:[...e.furniture,t]}:e}function c(e,t){let r=e.furniture.filter(e=>e.uid!==t);return r.length===e.furniture.length?e:{...e,furniture:r}}function d(e,t,r,n){let o=e.furniture.find(e=>e.uid===t);return o&&f(e,o.type,r,n,t)?{...e,furniture:e.furniture.map(e=>e.uid===t?{...e,col:r,row:n}:e)}:e}function u(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"cw",n=e.furniture.find(e=>e.uid===t);if(!n)return e;let o=(0,l.UV)(n.type,r);return o?{...e,furniture:e.furniture.map(e=>e.uid===t?{...e,type:o}:e)}:e}function p(e,t){let r=(0,l.Um)(e);return(null==r?void 0:r.canPlaceOnWalls)?t-(r.footprintH-1):t}function f(e,t,r,o,a){let s=(0,l.Um)(t);if(!s)return!1;if(s.canPlaceOnWalls){let t=o+s.footprintH-1;if(r<0||r+s.footprintW>e.cols||t<0||t>=e.rows)return!1}else if(r<0||o<0||r+s.footprintW>e.cols||o+s.footprintH>e.rows)return!1;let c=s.backgroundTiles||0;for(let t=0;t<s.footprintH;t++)if(!(t<c)&&!(o+t<0)&&(!s.canPlaceOnWalls||!(t<s.footprintH-1)))for(let l=0;l<s.footprintW;l++){let i=(o+t)*e.cols+(r+l),a=e.tiles[i];if(s.canPlaceOnWalls){if(a!==n.nb.WALL)return!1}else if(a===n.nb.VOID||a===n.nb.WALL)return!1}let d=(0,i.Pg)(e.furniture,a),u=null;if(s.canPlaceOnSurfaces)for(let t of(u=new Set,e.furniture)){if(t.uid===a)continue;let e=(0,l.Um)(t.type);if(e&&e.isDesk)for(let r=0;r<e.footprintH;r++)for(let n=0;n<e.footprintW;n++)u.add("".concat(t.col+n,",").concat(t.row+r))}let p=s.backgroundTiles||0;for(let e=0;e<s.footprintH;e++)if(!(e<p)&&!(o+e<0))for(let t=0;t<s.footprintW;t++){let n="".concat(r+t,",").concat(o+e);if(d.has(n)&&!(null==u?void 0:u.has(n)))return!1}return!0}function g(e,t){let{cols:r,rows:o,tiles:l,furniture:i,tileColors:a}=e,s=a||Array(l.length).fill(null),c=r,d=o,u=0,p=0;if("right"===t?c=r+1:"left"===t?(c=r+1,u=1):"down"===t?d=o+1:"up"===t&&(d=o+1,p=1),c>n.Tj||d>n.pX)return null;let f=Array(c*d).fill(n.nb.VOID),g=Array(c*d).fill(null);for(let e=0;e<o;e++)for(let t=0;t<r;t++){let n=e*r+t,o=(e+p)*c+(t+u);f[o]=l[n],g[o]=s[n]}let h=i.map(e=>({...e,col:e.col+u,row:e.row+p}));return{layout:{...e,cols:c,rows:d,tiles:f,tileColors:g,furniture:h},shift:{col:u,row:p}}}function h(e,t,r){for(let n of e.furniture){let e=(0,l.Um)(n.type);if(e){for(let o=0;o<e.footprintH;o++)for(let l=0;l<e.footprintW;l++)if(n.col+l===t&&n.row+o===r)return n}}return null}},1661:(e,t,r)=>{"use strict";r.d(t,{LN:()=>o,Zg:()=>l,fu:()=>s});let n=new Map;function o(e,t,r){let o=n.get(e);if(o)return o;let l=r.colorize?function(e,t){let{h:r,s:n,b:o,c:l}=t,a=[];for(let t of e){let e=[];for(let a of t){if(""===a){e.push("");continue}let t=parseInt(a.slice(1,3),16),s=(.299*t+.587*parseInt(a.slice(3,5),16)+.114*parseInt(a.slice(5,7),16))/255;0!==l&&(s=.5+(100+l)/100*(s-.5)),0!==o&&(s+=o/200);let c=i(r,n/100,s=Math.max(0,Math.min(1,s)));e.push(c)}a.push(e)}return a}(t,r):s(t,r);return n.set(e,l),l}function l(){n.clear()}function i(e,t,r){let n=(1-Math.abs(2*r-1))*t,o=e/60,l=n*(1-Math.abs(o%2-1)),i=0,s=0,c=0;o<1?(i=n,s=l,c=0):o<2?(i=l,s=n,c=0):o<3?(i=0,s=n,c=l):o<4?(i=0,s=l,c=n):o<5?(i=l,s=0,c=n):(i=n,s=0,c=l);let d=r-n/2,u=Math.round((i+d)*255),p=Math.round((s+d)*255),f=Math.round((c+d)*255);return"#".concat(a(u).toString(16).padStart(2,"0")).concat(a(p).toString(16).padStart(2,"0")).concat(a(f).toString(16).padStart(2,"0")).toUpperCase()}function a(e){return Math.max(0,Math.min(255,e))}function s(e,t){let{h:r,s:n,b:o,c:l}=t,a=[];for(let t of e){let e=[];for(let a of t){if(""===a){e.push("");continue}let t=parseInt(a.slice(1,3),16),[s,c,d]=function(e,t,r){let n=e/255,o=t/255,l=r/255,i=Math.max(n,o,l),a=Math.min(n,o,l),s=(i+a)/2;if(i===a)return[0,0,s];let c=i-a;return[i===n?((o-l)/c+6*(o<l))*60:i===o?((l-n)/c+2)*60:((n-o)/c+4)*60,s>.5?c/(2-i-a):c/(i+a),s]}(t,parseInt(a.slice(3,5),16),parseInt(a.slice(5,7),16)),u=((s+r)%360+360)%360,p=Math.max(0,Math.min(1,c+n/100)),f=d;0!==l&&(f=.5+(100+l)/100*(f-.5)),0!==o&&(f+=o/200);let g=i(u,p,f=Math.max(0,Math.min(1,f)));e.push(g)}a.push(e)}return a}},2243:(e,t,r)=>{"use strict";r.d(t,{$L:()=>z,AL:()=>G,BD:()=>er,BZ:()=>y,DH:()=>en,F2:()=>D,Ii:()=>ee,M1:()=>k,M_:()=>ea,Mo:()=>J,Nd:()=>E,Ns:()=>ef,O1:()=>_,O9:()=>el,Ot:()=>h,PA:()=>B,Pk:()=>ey,R_:()=>Y,Rb:()=>f,S3:()=>d,SS:()=>N,Sg:()=>I,TE:()=>q,Tj:()=>i,W3:()=>S,W7:()=>j,WJ:()=>w,WK:()=>ei,Wn:()=>v,Ww:()=>b,XE:()=>s,Xo:()=>eu,YK:()=>l,YX:()=>L,ZV:()=>eo,Zz:()=>et,dn:()=>n,e7:()=>eb,fJ:()=>V,fS:()=>ek,gB:()=>T,gD:()=>$,gi:()=>W,hI:()=>A,he:()=>g,i:()=>K,iE:()=>O,ic:()=>es,k2:()=>eh,k8:()=>p,l0:()=>F,lY:()=>c,n6:()=>R,o3:()=>eg,oj:()=>Q,ou:()=>ep,p7:()=>ed,pX:()=>a,pr:()=>Z,q3:()=>X,qD:()=>P,ql:()=>eS,qt:()=>ec,v3:()=>M,vU:()=>m,wN:()=>x,wh:()=>o,wj:()=>u,y9:()=>H,zY:()=>U,zw:()=>C});let n=16,o=21,l=21,i=64,a=64,s=48,c=.15,d=.3,u=2,p=20,f=3,g=6,h=120,b=240,y=.3,k=6,S=16,x=24,m=30,T=180,A=.3,C="#ccffcc",E=.6,W=.5,v=.33,w=.66,O=6,I=.5,D=.001,_=1,H=.5,P=.5,j=.25,R=[4,3],F=6,L=3,Y=.45,N=1.5,U=.5,M=.5,B=10,z=24,X="#808080",G="rgba(255,255,255,0.12)",V="rgba(255,255,255,0.08)",K=[2,2],J="rgba(60, 130, 220, 0.25)",Z="rgba(60, 130, 220, 0.5)",$="rgba(255, 255, 255, 0.06)",q="#00ff00",Q="#ff0000",ee="#007fd4",et="rgba(200, 50, 50, 0.85)",er="rgba(50, 120, 200, 0.85)",en=1,eo=10,el=.1,ei=2,ea=.3,es=6,ec=45,ed=271,eu=3,ep=2,ef=8,eg=24,eh=50,eb=500,ey={h:35,s:30,b:15,c:0},ek={h:240,s:25,b:0,c:0},eS={h:0,s:0,b:0,c:0}},2988:(e,t,r)=>{"use strict";r.d(t,{$D:()=>f,Cr:()=>J,Ih:()=>Z,L$:()=>s,SJ:()=>c,US:()=>l,VQ:()=>h,WN:()=>i,Zc:()=>p,bn:()=>G,iK:()=>a,j9:()=>g,mY:()=>u,mr:()=>d});var n=r(5195),o=r(1661);let l=(()=>{let e="#8B6914",t="#A07828",r="#B8922E",n="#6B4E0A",o=[];o.push(Array(32).fill("")),o.push(["",...Array(30).fill(e),""]);for(let n=0;n<4;n++)o.push(["",e,...Array(28).fill(n<1?t:r),e,""]);o.push(["",n,...Array(28).fill(e),n,""]);for(let t=0;t<6;t++)o.push(["",e,...Array(28).fill(r),e,""]);o.push(["",e,...Array(28).fill(t),e,""]);for(let t=0;t<6;t++)o.push(["",e,...Array(28).fill(r),e,""]);o.push(["",n,...Array(28).fill(e),n,""]);for(let n=0;n<4;n++)o.push(["",e,...Array(28).fill(n>2?t:r),e,""]);o.push(["",...Array(30).fill(e),""]);for(let e=0;e<4;e++){let e=Array(32).fill("");e[1]=n,e[2]=n,e[29]=n,e[30]=n,o.push(e)}return o.push(Array(32).fill("")),o.push(Array(32).fill("")),o})(),i=(()=>{let e="#3D8B37",t="#2D6B27",r="#6B4E0A",n="#B85C3A",o="#8B4422";return[["","","","","","",e,e,"","","","","","","",""],["","","","","",e,e,e,e,"","","","","","",""],["","","","",e,e,t,e,e,e,"","","","","",""],["","","",e,e,t,e,e,t,e,e,"","","","",""],["","",e,e,e,e,e,e,e,e,e,e,"","","",""],["",e,e,t,e,e,e,e,e,e,t,e,e,"","",""],["",e,e,e,e,t,e,e,t,e,e,e,e,"","",""],["","",e,e,e,e,e,e,e,e,e,e,"","","",""],["","","",e,e,e,t,e,e,e,e,"","","","",""],["","","","",e,e,e,e,e,e,"","","","","",""],["","","","","",e,e,e,e,"","","","","","",""],["","","","","","",r,r,"","","","","","","",""],["","","","","","",r,r,"","","","","","","",""],["","","","","","",r,r,"","","","","","","",""],["","","","","",o,o,o,o,o,"","","","","",""],["","","","",o,n,n,n,n,n,o,"","","","",""],["","","","",o,n,n,n,n,n,o,"","","","",""],["","","","",o,n,n,n,n,n,o,"","","","",""],["","","","",o,n,n,n,n,n,o,"","","","",""],["","","","",o,n,n,n,n,n,o,"","","","",""],["","","","",o,n,n,n,n,n,o,"","","","",""],["","","","","",o,n,n,n,o,"","","","","",""],["","","","","","",o,o,o,"","","","","","",""],["","","","","","","","","","","","","","","",""]]})(),a=(()=>{let e="#8B6914",t="#6B4E0A",r="#CC4444",n="#4477AA",o="#44AA66",l="#CCAA33",i="#9955AA";return[["",e,e,e,e,e,e,e,e,e,e,e,e,e,e,""],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,r,r,n,n,o,o,l,l,r,r,n,n,t,e],[e,t,r,r,n,n,o,o,l,l,r,r,n,n,t,e],[e,t,r,r,n,n,o,o,l,l,r,r,n,n,t,e],[e,t,r,r,n,n,o,o,l,l,r,r,n,n,t,e],[e,t,r,r,n,n,o,o,l,l,r,r,n,n,t,e],[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,i,i,l,l,n,n,o,o,i,i,r,r,t,e],[e,t,i,i,l,l,n,n,o,o,i,i,r,r,t,e],[e,t,i,i,l,l,n,n,o,o,i,i,r,r,t,e],[e,t,i,i,l,l,n,n,o,o,i,i,r,r,t,e],[e,t,i,i,l,l,n,n,o,o,i,i,r,r,t,e],[e,t,i,i,l,l,n,n,o,o,i,i,r,r,t,e],[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,o,o,r,r,i,i,n,n,l,l,o,o,t,e],[e,t,o,o,r,r,i,i,n,n,l,l,o,o,t,e],[e,t,o,o,r,r,i,i,n,n,l,l,o,o,t,e],[e,t,o,o,r,r,i,i,n,n,l,l,o,o,t,e],[e,t,o,o,r,r,i,i,n,n,l,l,o,o,t,e],[e,t,o,o,r,r,i,i,n,n,l,l,o,o,t,e],[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e],[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],["",e,e,e,e,e,e,e,e,e,e,e,e,e,e,""]]})(),s=(()=>{let e="#CCDDEE",t="#88BBDD",r="#999999",n="#666666";return[["","","","","","","","","","","","","","","",""],["","","","","",r,r,r,r,r,r,"","","","",""],["","","","",r,t,t,t,t,t,t,r,"","","",""],["","","","",r,t,t,t,t,t,t,r,"","","",""],["","","","",r,t,t,t,t,t,t,r,"","","",""],["","","","",r,t,t,t,t,t,t,r,"","","",""],["","","","",r,t,t,t,t,t,t,r,"","","",""],["","","","","",r,r,r,r,r,r,"","","","",""],["","","","","",r,e,e,e,e,r,"","","","",""],["","","","","",r,e,e,e,e,r,"","","","",""],["","","","","",r,e,e,e,e,r,"","","","",""],["","","","","",r,e,e,e,e,r,"","","","",""],["","","","","",r,e,e,e,e,r,"","","","",""],["","","","",r,r,e,e,e,e,r,r,"","","",""],["","","","",r,e,e,e,e,e,e,r,"","","",""],["","","","",r,e,e,e,e,e,e,r,"","","",""],["","","","",r,r,r,r,r,r,r,r,"","","",""],["","","","","",r,n,n,n,n,r,"","","","",""],["","","","","",r,n,n,n,n,r,"","","","",""],["","","","","",r,n,n,n,n,r,"","","","",""],["","","","",r,r,n,n,n,n,r,r,"","","",""],["","","","",r,n,n,n,n,n,n,r,"","","",""],["","","","",r,r,r,r,r,r,r,r,"","","",""],["","","","","","","","","","","","","","","",""]]})(),c=(()=>{let e="#AAAAAA",t="#EEEEFF",r="#CC4444",n="#4477AA";return[["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],["",e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,""],["",e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e,""],["",e,t,t,r,r,r,t,t,t,t,t,n,n,n,n,t,t,t,t,t,t,t,r,t,t,t,t,t,t,e,""],["",e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,n,n,t,t,r,t,t,t,t,t,t,e,""],["",e,t,t,t,t,r,r,r,r,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,n,n,t,t,e,""],["",e,t,t,t,t,t,t,t,t,t,t,t,n,n,n,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e,""],["",e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,r,r,r,t,t,t,t,t,t,t,e,""],["",e,t,r,r,t,t,t,t,t,t,t,t,t,t,t,n,n,t,t,t,t,t,t,t,t,t,t,t,t,e,""],["",e,t,t,t,t,t,t,n,n,n,t,t,t,t,t,t,t,t,t,t,t,t,t,r,r,r,r,t,t,e,""],["",e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e,""],["",e,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,e,""],["",e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,""],["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]]})(),d=(()=>{let e="#8B6914",t="#6B4E0A",r="#5C3D0A",n="#A07828";return[["","","","","",t,t,t,t,t,t,"","","","",""],["","","","",t,r,r,r,r,r,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,n,n,n,n,r,t,"","","",""],["","","","",t,r,r,r,r,r,r,t,"","","",""],["","","","","",t,t,t,t,t,t,"","","","",""],["","","","","","",t,e,e,t,"","","","","",""],["","","","","","",t,e,e,t,"","","","","",""],["","","","","",t,t,t,t,t,t,"","","","",""],["","","","","",t,"","","","",t,"","","","",""],["","","","","",t,"","","","",t,"","","","",""]]})(),u=(()=>{let e="#555555",t="#3A3A5C",r="#6688CC",n="#444444";return[["","","",e,e,e,e,e,e,e,e,e,e,"","",""],["","","",e,t,t,t,t,t,t,t,t,e,"","",""],["","","",e,t,r,r,r,r,r,r,t,e,"","",""],["","","",e,t,r,r,r,r,r,r,t,e,"","",""],["","","",e,t,r,r,r,r,r,r,t,e,"","",""],["","","",e,t,r,r,r,r,r,r,t,e,"","",""],["","","",e,t,r,r,r,r,r,r,t,e,"","",""],["","","",e,t,r,r,r,r,r,r,t,e,"","",""],["","","",e,t,t,t,t,t,t,t,t,e,"","",""],["","","",e,e,e,e,e,e,e,e,e,e,"","",""],["","","","","","","",n,n,"","","","","","",""],["","","","","","","",n,n,"","","","","","",""],["","","","","","",n,n,n,n,"","","","","",""],["","","","","",n,n,n,n,n,n,"","","","",""],["","","","","",n,n,n,n,n,n,"","","","",""],["","","","","","","","","","","","","","","",""]]})(),p=(()=>{let e="#FFDD55",t="#FFEE88",r="#888888",n="#555555",o="#FFFFCC";return[["","","","","","","","","","","","","","","",""],["","","","","","",o,o,o,o,"","","","","",""],["","","","","",o,e,e,e,e,o,"","","","",""],["","","","",o,e,e,t,t,e,e,o,"","","",""],["","","","",e,e,t,t,t,t,e,e,"","","",""],["","","","",e,e,t,t,t,t,e,e,"","","",""],["","","","","",e,e,e,e,e,e,"","","","",""],["","","","","","",r,r,r,r,"","","","","",""],["","","","","","","",r,r,"","","","","","",""],["","","","","","","",r,r,"","","","","","",""],["","","","","","","",r,r,"","","","","","",""],["","","","","","","",r,r,"","","","","","",""],["","","","","","",r,r,r,r,"","","","","",""],["","","","","",n,n,n,n,n,n,"","","","",""],["","","","","",n,n,n,n,n,n,"","","","",""],["","","","","","","","","","","","","","","",""]]})(),f=(()=>{let e="#555566",t="#EEEEFF",r="#CCA700";return[["","","",e,e,e,e,e,"","",""],["","",e,t,t,t,t,t,e,"",""],["",e,t,t,t,t,t,t,t,e,""],[e,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,e],[e,t,t,r,t,r,t,r,t,t,e],[e,t,t,t,t,t,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,e],["",e,t,t,t,t,t,t,t,e,""],["","",e,e,e,e,e,e,e,"",""],["","","","",e,e,e,"","","",""],["","","","","",e,"","","","",""],["","","","","","","","","","",""]]})(),g=(()=>{let e="#555566",t="#EEEEFF",r="#D4A017",n="#F5C842";return[["","","",e,e,e,e,e,"","",""],["","",e,t,t,t,n,t,e,"",""],["",e,t,t,t,n,n,t,t,e,""],[e,t,t,t,n,n,t,t,t,t,e],[e,t,t,n,n,n,n,n,t,t,e],[e,t,t,t,t,r,r,t,t,t,e],[e,t,t,t,r,r,t,t,t,t,e],[e,t,t,r,r,t,t,t,t,t,e],["",e,t,t,r,t,t,t,t,e,""],["","",e,e,e,e,e,e,e,"",""],["","","","",e,e,e,"","","",""],["","","","","",e,"","","","",""],["","","","","","","","","","",""]]})(),h=(()=>{let e="#555566",t="#EEEEFF",r="#44BB66";return[["","","",e,e,e,e,e,"","",""],["","",e,t,t,t,t,t,e,"",""],["",e,t,t,t,t,t,t,t,e,""],[e,t,t,t,t,t,t,t,r,t,e],[e,t,t,t,t,t,t,r,t,t,e],[e,t,t,r,t,t,r,t,t,t,e],[e,t,t,t,r,r,t,t,t,t,e],[e,t,t,t,t,t,t,t,t,t,e],["",e,t,t,t,t,t,t,t,e,""],["","",e,e,e,e,e,e,e,"",""],["","","","",e,e,e,"","","",""],["","","","","",e,"","","","",""],["","","","","","","","","","",""]]})(),b=[{skin:"#FFCC99",shirt:"#4488CC",pants:"#334466",hair:"#553322",shoes:"#222222"},{skin:"#FFCC99",shirt:"#CC4444",pants:"#333333",hair:"#FFD700",shoes:"#222222"},{skin:"#DEB887",shirt:"#44AA66",pants:"#334444",hair:"#222222",shoes:"#333333"},{skin:"#FFCC99",shirt:"#AA55CC",pants:"#443355",hair:"#AA4422",shoes:"#222222"},{skin:"#DEB887",shirt:"#CCAA33",pants:"#444433",hair:"#553322",shoes:"#333333"},{skin:"#FFCC99",shirt:"#FF8844",pants:"#443322",hair:"#111111",shoes:"#222222"}],y="hair",k="skin",S="shirt",x="pants",m="shoes",T="#FFFFFF";function A(e,t){return e.map(e=>e.map(e=>""===e?"":e===T?T:e===y?t.hair:e===k?t.skin:e===S?t.shirt:e===x?t.pants:e===m?t.shoes:e))}let C=[["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","",x,x,"","","","",x,x,"","","",""],["","","","",x,x,"","","","",x,x,"","","",""],["","","","",m,m,"","","","","",m,m,"","",""],["","","","",m,m,"","","","","",m,m,"","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],E=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],W=[["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","",m,m,"","","","","","",x,x,"","",""],["","","",m,m,"","","","","","",x,x,"","",""],["","","","","","","","","","",m,m,"","","",""],["","","","","","","","","","",m,m,"","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],v=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","",k,k,S,S,S,S,S,S,k,k,"","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],w=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,k,"","",""],["","","","",k,S,S,S,S,S,S,"",k,"","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],O=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],I=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,T,k,k,T,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],D=[["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","",x,x,"","","","",x,x,"","","",""],["","","","",x,x,"","","","",x,x,"","","",""],["","","",m,m,"","","","","","",m,m,"","",""],["","","",m,m,"","","","","","",m,m,"","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],_=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],H=[["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","",m,m,"","","","","","",x,x,"","",""],["","","",m,m,"","","","","","",x,x,"","",""],["","","","","","","","","","",m,m,"","","",""],["","","","","","","","","","",m,m,"","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],P=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","",k,k,S,S,S,S,S,S,k,k,"","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],j=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,k,"","",""],["","","","",k,S,S,S,S,S,S,"",k,"","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],R=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],F=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","",y,y,y,y,"","","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",y,y,y,y,y,y,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","",k,k,k,k,k,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",S,S,S,S,S,S,S,S,"","","",""],["","","","",k,S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,x,x,x,x,"","","","",""],["","","","","",x,x,"","",x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],L=[["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",k,S,S,S,S,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","",x,x,"","","",x,x,"","","",""],["","","","","",x,x,"","","",x,x,"","","",""],["","","","","",m,m,"","","","",m,m,"","",""],["","","","","",m,m,"","","","",m,m,"","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],Y=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",k,S,S,S,S,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",m,m,"",m,m,"","","","",""],["","","","","","",m,m,"",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],N=[["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",k,S,S,S,S,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","","","",x,x,x,"","","","",""],["","","","","","","","",x,x,x,"","","","",""],["","","","","",m,m,"","",m,m,"","","","",""],["","","","","",m,m,"","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],U=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,k,"","","",""],["","","","","",S,S,S,S,S,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",m,m,"",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],M=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"",k,"","",""],["","","","","",S,S,S,S,S,"","",k,"","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",m,m,"",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],B=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",k,S,S,S,S,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",m,m,"",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],z=[["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","",y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",y,y,y,y,y,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,T,k,"","","","",""],["","","","","","",k,k,k,k,k,"","","","",""],["","","","","","",k,k,k,k,"","","","","",""],["","","","","","","",S,S,S,"","","","","",""],["","","","","","",S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",S,S,S,S,S,S,"","","","",""],["","","","","",k,S,S,S,S,k,"","","","",""],["","","","","","",S,S,S,S,"","","","","",""],["","","","","","","",x,x,"","","","","","",""],["","","","","","",x,x,x,x,"","","","","",""],["","","","","","",x,x,"",x,x,"","","","",""],["","","","","","",m,m,"",m,m,"","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""],["","","","","","","","","","","","","","","",""]],X=null;function G(e){X=e,K.clear()}function V(e){return e.map(e=>[...e].reverse())}let K=new Map;function J(e){return X?X[e%X.length].down[1]:null}function Z(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l="".concat(e,":").concat(r),i=K.get(l);if(i)return i;if(X){let r=X[e%X.length],o=r.down,l=r.up,i=r.right;t={walk:{[n.OP.DOWN]:[o[0],o[1],o[2],o[1]],[n.OP.UP]:[l[0],l[1],l[2],l[1]],[n.OP.RIGHT]:[i[0],i[1],i[2],i[1]],[n.OP.LEFT]:[V(i[0]),V(i[1]),V(i[2]),V(i[1])]},typing:{[n.OP.DOWN]:[o[3],o[4]],[n.OP.UP]:[l[3],l[4]],[n.OP.RIGHT]:[i[3],i[4]],[n.OP.LEFT]:[V(i[3]),V(i[4])]},reading:{[n.OP.DOWN]:[o[5],o[6]],[n.OP.UP]:[l[5],l[6]],[n.OP.RIGHT]:[i[5],i[6]],[n.OP.LEFT]:[V(i[5]),V(i[6])]}}}else{let r=b[e%b.length],o=e=>A(e,r),l=e=>A(e.map(e=>[...e].reverse()),r);t={walk:{[n.OP.DOWN]:[o(C),o(E),o(W),o(E)],[n.OP.UP]:[o(D),o(_),o(H),o(_)],[n.OP.RIGHT]:[o(L),o(Y),o(N),o(Y)],[n.OP.LEFT]:[l(L),l(Y),l(N),l(Y)]},typing:{[n.OP.DOWN]:[o(v),o(w)],[n.OP.UP]:[o(P),o(j)],[n.OP.RIGHT]:[o(U),o(M)],[n.OP.LEFT]:[l(U),l(M)]},reading:{[n.OP.DOWN]:[o(O),o(I)],[n.OP.UP]:[o(R),o(F)],[n.OP.RIGHT]:[o(B),o(z)],[n.OP.LEFT]:[l(B),l(z)]}}}return 0!==r&&(t=function(e,t){let r={h:t,s:0,b:0,c:0},l=e=>(0,o.fu)(e,r),i=e=>[l(e[0]),l(e[1]),l(e[2]),l(e[3])],a=e=>[l(e[0]),l(e[1])];return{walk:{[n.OP.DOWN]:i(e.walk[n.OP.DOWN]),[n.OP.UP]:i(e.walk[n.OP.UP]),[n.OP.RIGHT]:i(e.walk[n.OP.RIGHT]),[n.OP.LEFT]:i(e.walk[n.OP.LEFT])},typing:{[n.OP.DOWN]:a(e.typing[n.OP.DOWN]),[n.OP.UP]:a(e.typing[n.OP.UP]),[n.OP.RIGHT]:a(e.typing[n.OP.RIGHT]),[n.OP.LEFT]:a(e.typing[n.OP.LEFT])},reading:{[n.OP.DOWN]:a(e.reading[n.OP.DOWN]),[n.OP.UP]:a(e.reading[n.OP.UP]),[n.OP.RIGHT]:a(e.reading[n.OP.RIGHT]),[n.OP.LEFT]:a(e.reading[n.OP.LEFT])}}}(t,r)),K.set(l,t),t}},4296:(e,t,r)=>{"use strict";r.d(t,{F:()=>h,Q:()=>u});var n=r(2988),o=r(4777),l=r(5055);let i=["down","up","right"];function a(e){return new Promise((t,r)=>{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>t(n),n.onerror=t=>r(Error("Failed to load image: ".concat(e," — ").concat(t))),n.src=e})}function s(e,t,r,n,o){let l=document.createElement("canvas");l.width=n,l.height=o;let i=l.getContext("2d"),a=e.naturalWidth,s=e.naturalHeight,c=Math.max(0,t),d=Math.max(0,r),u=Math.min(t+n,a)-c,p=Math.min(r+o,s)-d;u>0&&p>0&&i.drawImage(e,c,d,u,p,c-t,d-r,u,p);let{data:f}=i.getImageData(0,0,n,o),g=[];for(let e=0;e<o;e++){let t=[];for(let r=0;r<n;r++){let o=(e*n+r)*4,l=f[o],i=f[o+1],a=f[o+2];f[o+3]<128?t.push(""):t.push("#".concat(l.toString(16).padStart(2,"0")).concat(i.toString(16).padStart(2,"0")).concat(a.toString(16).padStart(2,"0")).toUpperCase())}g.push(t)}return g}async function c(){let e=[];for(let t=0;t<6;t++){let r=await a("/assets/characters/char_".concat(t,".png")),n={down:[],up:[],right:[]};for(let e=0;e<i.length;e++){let t=i[e],o=32*e,l=[];for(let e=0;e<7;e++){let t=16*e;l.push(s(r,t,o,16,32))}n[t]=l}e.push(n)}return e}async function d(){let e=await a("/assets/walls.png"),t=[];for(let r=0;r<16;r++){let n=r%4*16,o=32*Math.floor(r/4);t.push(s(e,n,o,16,32))}return t}let u=[{id:"ASSET_4",label:"Wooden Counter",srcX:128,srcY:0,srcW:48,srcH:32,footprintW:3,footprintH:2,isDesk:!0,category:"desks",backgroundTiles:1},{id:"ASSET_7",label:"White Counter",srcX:80,srcY:23,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!0,category:"desks",backgroundTiles:1},{id:"ASSET_15",label:"Plastic Counter",srcX:128,srcY:64,srcW:48,srcH:32,footprintW:3,footprintH:2,isDesk:!0,category:"desks",backgroundTiles:1},{id:"ASSET_NEW_106",label:"Wooden Table",srcX:16,srcY:-9,srcW:48,srcH:32,footprintW:3,footprintH:2,isDesk:!0,category:"desks",backgroundTiles:1},{id:"ASSET_27_A",label:"Large Table",srcX:16,srcY:528,srcW:32,srcH:64,footprintW:2,footprintH:4,isDesk:!0,category:"desks",backgroundTiles:1},{id:"ASSET_46",label:"Vertical Table",srcX:16,srcY:288,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!0,category:"desks"},{id:"ASSET_NEW_112",label:"Coffee Table",srcX:48,srcY:624,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!0,category:"desks",backgroundTiles:1},{id:"ASSET_50_0_0",label:"Wood Coffee Table",srcX:64,srcY:299,srcW:32,srcH:16,footprintW:2,footprintH:1,isDesk:!0,category:"desks"},{id:"ASSET_17",label:"Wooden Bookshelf",srcX:112,srcY:512,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_18",label:"Full Bookshelf",srcX:144,srcY:512,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_27_B_A_A",label:"Bookshelf Tall",srcX:128,srcY:183,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_27_B_A_B_A",label:"Full Bookshelf Tall",srcX:144,srcY:183,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_27_B_A_B_B_A",label:"Cabinet Tall",srcX:160,srcY:183,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_28",label:"White Bookshelf",srcX:192,srcY:184,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_41_0_1",label:"Fridge",srcX:208,srcY:264,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_139",label:"Crates",srcX:224,srcY:447,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"storage",backgroundTiles:1},{id:"ASSET_32",label:"Chair Front",srcX:0,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_38",label:"Chair Back",srcX:16,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_33",label:"Chair Right",srcX:32,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_34",label:"Chair Left",srcX:48,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_35",label:"Office Chair Front",srcX:64,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_39",label:"Office Chair Back",srcX:80,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_36",label:"Office Chair Right",srcX:96,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_37",label:"Office Chair Left",srcX:112,srcY:258,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_49",label:"Stool",srcX:0,srcY:290,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"chairs"},{id:"ASSET_NEW_110",label:"Large Chair Right",srcX:16,srcY:624,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"chairs"},{id:"ASSET_NEW_111",label:"Large Chair Left",srcX:32,srcY:624,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"chairs"},{id:"ASSET_90",label:"Computer + Coffee",srcX:192,srcY:358,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_74",label:"CRT Monitor Off",srcX:128,srcY:360,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0},{id:"ASSET_76",label:"CRT Monitor On",srcX:160,srcY:360,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0},{id:"ASSET_78",label:"Monitor Off",srcX:192,srcY:359,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0},{id:"ASSET_79",label:"Monitor On",srcX:224,srcY:359,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0},{id:"ASSET_107",label:"Laptop Off",srcX:128,srcY:384,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_108",label:"Laptop On",srcX:144,srcY:384,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_99",label:"Laptop Left",srcX:177,srcY:386,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_109",label:"Laptop Back",srcX:192,srcY:386,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_61",label:"Telephone",srcX:192,srcY:304,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_123",label:"Server",srcX:131,srcY:417,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_126",label:"Printer",srcX:216,srcY:423,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"electronics",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_63",label:"Wood Window",srcX:32,srcY:319,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_64",label:"White Window",srcX:64,srcY:319,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_80",label:"Small Window Wood",srcX:80,srcY:351,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_81",label:"Small Window White",srcX:96,srcY:351,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_83",label:"Clock White",srcX:0,srcY:360,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_84",label:"Clock Color",srcX:15,srcY:352,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_101",label:"Painting",srcX:0,srcY:384,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_102",label:"Painting 2",srcX:32,srcY:384,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_103",label:"Small Painting",srcX:64,srcY:384,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_118",label:"Chart 1",srcX:32,srcY:415,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_122",label:"Chalkboard",srcX:0,srcY:415,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_134",label:"Chart 2",srcX:0,srcY:448,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"wall",canPlaceOnWalls:!0},{id:"ASSET_140",label:"White Plant",srcX:96,srcY:448,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"decor",backgroundTiles:1},{id:"ASSET_141",label:"White Plant 2",srcX:112,srcY:448,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"decor",backgroundTiles:1},{id:"ASSET_142",label:"Plant",srcX:64,srcY:448,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"decor",backgroundTiles:1},{id:"ASSET_143",label:"Plant 2",srcX:80,srcY:448,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"decor",backgroundTiles:1},{id:"ASSET_72",label:"Red Book",srcX:163,srcY:336,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"decor",canPlaceOnSurfaces:!0},{id:"ASSET_100",label:"Paper",srcX:240,srcY:384,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"decor",canPlaceOnSurfaces:!0,backgroundTiles:1},{id:"ASSET_40",label:"Vending Machine",srcX:224,srcY:264,srcW:32,srcH:32,footprintW:2,footprintH:2,isDesk:!1,category:"misc",backgroundTiles:1},{id:"ASSET_42",label:"Water Cooler",srcX:142,srcY:264,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"misc",backgroundTiles:1},{id:"ASSET_44",label:"Bin",srcX:130,srcY:278,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"misc"},{id:"ASSET_51",label:"Coffee Mug",srcX:225,srcY:299,srcW:16,srcH:16,footprintW:1,footprintH:1,isDesk:!1,category:"misc",canPlaceOnSurfaces:!0},{id:"ASSET_55",label:"Coffee Machine",srcX:161,srcY:309,srcW:16,srcH:32,footprintW:1,footprintH:2,isDesk:!1,category:"misc",canPlaceOnSurfaces:!0,backgroundTiles:1}],p={ASSET_17:{fill:"#8B6914",edge:"#5B4910"},ASSET_18:{fill:"#7B5910",edge:"#4B3908"},ASSET_27_A:{fill:"#D4C090",edge:"#B8A070"},ASSET_NEW_106:{fill:"#C8B480",edge:"#A89460"},ASSET_NEW_110:{fill:"#9B5050",edge:"#6B3030"},ASSET_NEW_111:{fill:"#9B5050",edge:"#6B3030"},ASSET_NEW_112:{fill:"#D4C090",edge:"#B8A070"}};async function f(){let e=await a("/Office%20Tileset/Office%20Tileset%20All%2016x16.png"),t=new Map;for(let r of u){let n=s(e,r.srcX,r.srcY,r.srcW,r.srcH);if(function(e){for(let t of e)for(let e of t)if(""!==e)return!1;return!0}(n)){let e=p[r.id];e&&t.set(r.id,function(e,t,r,n){let o=[];for(let l=0;l<t;l++){let i=[];for(let o=0;o<e;o++)0===o||o===e-1||0===l||l===t-1?i.push(n):i.push(r);o.push(i)}return o}(r.srcW,r.srcH,e.fill,e.edge))}else t.set(r.id,n)}return{sprites:t}}async function g(){try{let e=await fetch("/pixel-agents-layout.json");if(!e.ok)return null;let t=await e.json();if(t&&1===t.version&&Array.isArray(t.tiles))return t;return null}catch(e){return null}}async function h(){let[e,t,r,i]=await Promise.all([c(),d(),f(),g()]),a=function(){let e=[],t=[{base:"#C8B896",accent:"#B8A886"},{base:"#D4C4A0",accent:"#C4B490"},{base:"#B0A888",accent:"#A09878"},{base:"#A89078",accent:"#988068"},{base:"#C0B898",accent:"#B0A888"},{base:"#B8A890",accent:"#A89880"},{base:"#D0C0A0",accent:"#C0B090"}];for(let r=0;r<7;r++){let{base:n,accent:o}=t[r],l=[];for(let e=0;e<16;e++){let t=[];for(let r=0;r<16;r++){let l=(r+e)%4==0||(3*r+7*e)%11==0;t.push(l?o:n)}l.push(t)}e.push(l)}return e}();return(0,n.bn)(e),(0,l.ZZ)(t),(0,o.Di)(a),{characters:e,walls:t,floors:a,tilesetSprites:r.sprites,layout:i}}},4777:(e,t,r)=>{"use strict";r.d(t,{$0:()=>c,Di:()=>s,QQ:()=>d,To:()=>u,ty:()=>a});var n=r(1661),o=r(2243);let l=Array.from({length:o.dn},()=>Array(o.dn).fill(o.q3)),i=[],a="#3A3A5C";function s(e){i=e,(0,n.Zg)()}function c(){return!0}function d(){return i.length>0?i.length:1}function u(e,t){let r="floor-".concat(e,"-").concat(t.h,"-").concat(t.s,"-").concat(t.b,"-").concat(t.c),o=function(e){let t=e-1;return t<0?null:t<i.length?i[t]:0===i.length&&e>=1?l:null}(e);return o?(0,n.LN)(r,o,{...t,colorize:!0}):Array.from({length:16},()=>Array(16).fill("#FF00FF"))}},5055:(e,t,r)=>{"use strict";r.d(t,{BN:()=>a,ZZ:()=>i,og:()=>c,vb:()=>s});var n=r(5195),o=r(1661);let l=null;function i(e){l=e}function a(){return null!==l}function s(e,t,r){if(!l)return[];let i=e.length,a=i>0?e[0].length:0,s=null!=r?r:a,c=[];for(let r=0;r<i;r++)for(let i=0;i<a;i++){if(e[r][i]!==n.nb.WALL)continue;let a=r*s+i,d=null==t?void 0:t[a],u=d?function(e,t,r,i){if(!l)return null;let a=r.length,s=a>0?r[0].length:0,c=0;t>0&&r[t-1][e]===n.nb.WALL&&(c|=1),e<s-1&&r[t][e+1]===n.nb.WALL&&(c|=2),t<a-1&&r[t+1][e]===n.nb.WALL&&(c|=4),e>0&&r[t][e-1]===n.nb.WALL&&(c|=8);let d=l[c];if(!d)return null;let u="wall-".concat(c,"-").concat(i.h,"-").concat(i.s,"-").concat(i.b,"-").concat(i.c);return{sprite:(0,o.LN)(u,d,{...i,colorize:!0}),offsetY:n.dn-d.length}}(i,r,e,d):function(e,t,r){if(!l)return null;let o=r.length,i=o>0?r[0].length:0,a=0;t>0&&r[t-1][e]===n.nb.WALL&&(a|=1),e<i-1&&r[t][e+1]===n.nb.WALL&&(a|=2),t<o-1&&r[t+1][e]===n.nb.WALL&&(a|=4),e>0&&r[t][e-1]===n.nb.WALL&&(a|=8);let s=l[a];return s?{sprite:s,offsetY:n.dn-s.length}:null}(i,r,e);u&&c.push({sprite:u.sprite,x:i*n.dn,y:r*n.dn+u.offsetY,zY:(r+1)*n.dn})}return c}function c(e){let{h:t,s:r,b:n,c:o}=e,l=.5;0!==o&&(l=.5+(100+o)/100*(l-.5)),0!==n&&(l+=n/200);let i=r/100*(1-Math.abs(2*(l=Math.max(0,Math.min(1,l)))-1)),a=t/60,s=i*(1-Math.abs(a%2-1)),c=0,d=0,u=0;a<1?(c=i,d=s,u=0):a<2?(c=s,d=i,u=0):a<3?(c=0,d=i,u=s):a<4?(c=0,d=s,u=i):a<5?(c=s,d=0,u=i):(c=i,d=0,u=s);let p=l-i/2,f=e=>Math.max(0,Math.min(255,Math.round((e+p)*255)));return"#".concat(f(c).toString(16).padStart(2,"0")).concat(f(d).toString(16).padStart(2,"0")).concat(f(u).toString(16).padStart(2,"0"))}},5149:(e,t,r)=>{"use strict";r.r(t),r.d(t,{clearConnection:()=>i,getConnection:()=>l,getGatewayHttpUrl:()=>a,saveConnection:()=>o});let n="arcade_connection";function o(e){localStorage.setItem(n,JSON.stringify(e))}function l(){let e=localStorage.getItem(n);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}}function i(){localStorage.removeItem(n)}function a(){let e=l();return(null==e?void 0:e.wsUrl)?e.wsUrl.replace(/^ws(s?):\/\//,"http$1://"):window.location.origin}},5195:(e,t,r)=>{"use strict";r.d(t,{JM:()=>a,Lp:()=>l,OP:()=>i,Pz:()=>n.BZ,Tj:()=>n.Tj,VF:()=>s,YK:()=>n.YK,dn:()=>n.dn,nb:()=>o,pX:()=>n.pX,wh:()=>n.wh});var n=r(2243);let o={WALL:0,FLOOR_1:1,FLOOR_2:2,FLOOR_3:3,FLOOR_4:4,FLOOR_5:5,FLOOR_6:6,FLOOR_7:7,VOID:8},l={IDLE:"idle",WALK:"walk",TYPE:"type"},i={DOWN:0,LEFT:1,RIGHT:2,UP:3},a={DESK:"desk",BOOKSHELF:"bookshelf",PLANT:"plant",COOLER:"cooler",WHITEBOARD:"whiteboard",CHAIR:"chair",PC:"pc",LAMP:"lamp",TS_DESK_WOOD:"ts-desk-wood",TS_DESK_GRAY:"ts-desk-gray",TS_TABLE_LONG:"ts-table-long",TS_BOOKSHELF:"ts-bookshelf",TS_CABINET:"ts-cabinet",TS_BOOKSHELF_COLOR:"ts-bookshelf-color",TS_COUCH_RED:"ts-couch-red",TS_COUCH_BLUE:"ts-couch-blue",TS_CHAIR_GREEN:"ts-chair-green",TS_CHAIR_OFFICE:"ts-chair-office",TS_COMPUTER:"ts-computer",TS_LAPTOP:"ts-laptop",TS_MONITOR:"ts-monitor",TS_PHONE:"ts-phone",TS_PLANT:"ts-plant",TS_PLANT_TALL:"ts-plant-tall",TS_PAINTING:"ts-painting",TS_FRAME_SMALL:"ts-frame-small",TS_CLOCK:"ts-clock",TS_COOLER:"ts-cooler",TS_BOXES:"ts-boxes",TS_WHITEBOARD:"ts-whiteboard"},s={SELECT:"select",TILE_PAINT:"tile_paint",WALL_PAINT:"wall_paint",ERASE:"erase",FURNITURE_PLACE:"furniture_place",FURNITURE_PICK:"furniture_pick",EYEDROPPER:"eyedropper"}},8012:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ed});var n=r(206),o=r(1406),l=r(4717),i=r(8474),a=r(9984),s=r(6353);let c=s.k5(["idle","working","waiting_approval","done","error"]),d=s.k5(["low","med","high"]),u=s.k5(["yes","no"]),p=s.Ik({type:s.eu("RUN_TASK"),agentId:s.Yj(),taskId:s.Yj(),prompt:s.Yj(),repoPath:s.Yj().optional(),name:s.Yj().optional(),role:s.Yj().optional(),personality:s.Yj().optional(),backend:s.Yj().optional()}),f=s.Ik({type:s.eu("APPROVAL_DECISION"),approvalId:s.Yj(),decision:u}),g=s.Ik({type:s.eu("CANCEL_TASK"),agentId:s.Yj(),taskId:s.Yj()}),h=s.Ik({type:s.eu("PING")}),b=s.Ik({type:s.eu("CREATE_AGENT"),agentId:s.Yj(),name:s.Yj(),role:s.Yj(),palette:s.ai().optional(),personality:s.Yj().optional(),backend:s.Yj().optional()}),y=s.Ik({type:s.eu("FIRE_AGENT"),agentId:s.Yj()}),k=s.Ik({type:s.eu("OPEN_FILE"),path:s.Yj()});s.gM("type",[p,f,g,h,b,y,k]);let S=s.Ik({type:s.eu("AGENT_STATUS"),agentId:s.Yj(),status:c,details:s.Yj().optional()}),x=s.Ik({type:s.eu("TASK_STARTED"),agentId:s.Yj(),taskId:s.Yj(),prompt:s.Yj()}),m=s.Ik({type:s.eu("LOG_APPEND"),agentId:s.Yj(),taskId:s.Yj(),stream:s.k5(["stdout","stderr"]),chunk:s.Yj()}),T=s.Ik({type:s.eu("APPROVAL_NEEDED"),approvalId:s.Yj(),agentId:s.Yj(),taskId:s.Yj(),title:s.Yj(),summary:s.Yj(),riskLevel:d}),A=s.Ik({summary:s.Yj(),changedFiles:s.YO(s.Yj()),diffStat:s.Yj(),testResult:s.k5(["passed","failed","unknown"]),nextSuggestion:s.Yj().optional()}),C=s.Ik({type:s.eu("TASK_DONE"),agentId:s.Yj(),taskId:s.Yj(),result:A}),E=s.Ik({type:s.eu("TASK_FAILED"),agentId:s.Yj(),taskId:s.Yj(),error:s.Yj()}),W=s.Ik({type:s.eu("TASK_DELEGATED"),fromAgentId:s.Yj(),toAgentId:s.Yj(),taskId:s.Yj(),prompt:s.Yj()}),v=s.Ik({type:s.eu("AGENT_CREATED"),agentId:s.Yj(),name:s.Yj(),role:s.Yj(),palette:s.ai().optional(),personality:s.Yj().optional(),backend:s.Yj().optional()}),w=s.Ik({type:s.eu("AGENT_FIRED"),agentId:s.Yj()}),O=s.gM("type",[S,x,m,T,C,E,W,v,w]);var I=r(5149);let D=null,_=null,H=null,P=null,j=null;function R(){P&&(clearTimeout(P),P=null),H&&(H.onopen=null,H.onmessage=null,H.onclose=null,H.onerror=null,H.close(),H=null)}let F=null;function L(e){if("ws"===F)!function(e){if(!H||H.readyState!==WebSocket.OPEN)return console.warn("[WS] Not connected, dropping command:",e.type);console.log("[WS] Sending command:",e.type,e),H.send(JSON.stringify(e))}(e);else if("ably"===F){if(!_)throw Error("Not connected");console.log("[Web] Sending command:",e.type,e),_.publish(e.type,e).then(()=>console.log("[Web] Command published OK"),e=>console.error("[Web] Command publish failed:",e))}else console.error("[Connection] No active transport")}function Y(){"ws"===F?(j=null,R()):"ably"===F&&function(){if(!D)return;let e=D.connection.state;"connected"===e||"disconnected"===e||"suspended"===e?D.close():("connecting"===e||"initialized"===e)&&(D.connection.once("connected",()=>null==D?void 0:D.close()),D.connection.once("failed",()=>{})),D=null,_=null}(),F=null}var N=r(2001),U=r(7441);let M=[{palette:0,name:"Alex",role:"Frontend Dev",description:"UI components, React/Next.js/CSS",personality:"You speak in a friendly, casual, encouraging, and natural tone."},{palette:1,name:"Mia",role:"Backend Dev",description:"APIs, database, server logic",personality:"You speak formally, professionally, in an organized and concise manner."},{palette:2,name:"Leo",role:"Fullstack Dev",description:"End-to-end, frontend + backend",personality:"You are aggressive, action-first, always pursuing speed and efficiency."},{palette:3,name:"Sophie",role:"Code Reviewer",description:"Review PRs, find bugs, quality",personality:"You teach patiently, explain the reasoning, and guide like a mentor."},{palette:4,name:"Yuki",role:"QA / Tester",description:"Write tests, edge cases",personality:"You are extremely concise, no fluff, straight to the result."},{palette:5,name:"Marcus",role:"Architect",description:"System design, refactoring",personality:"You speak formally, professionally, in an organized and concise manner."}];var B=r(2988),z=r(5195),X=r(2243);class G{pushUndo(e){this.undoStack.push(e),this.undoStack.length>X.k2&&this.undoStack.shift()}popUndo(){return this.undoStack.pop()||null}pushRedo(e){this.redoStack.push(e),this.redoStack.length>X.k2&&this.redoStack.shift()}popRedo(){return this.redoStack.pop()||null}clearRedo(){this.redoStack=[]}clearSelection(){this.selectedFurnitureUid=null}clearGhost(){this.ghostCol=-1,this.ghostRow=-1,this.ghostValid=!1}startDrag(e,t,r,n,o){this.dragUid=e,this.dragStartCol=t,this.dragStartRow=r,this.dragOffsetCol=n,this.dragOffsetRow=o,this.isDragMoving=!1}clearDrag(){this.dragUid=null,this.isDragMoving=!1}reset(){this.activeTool=z.VF.SELECT,this.selectedFurnitureUid=null,this.ghostCol=-1,this.ghostRow=-1,this.ghostValid=!1,this.isDragging=!1,this.wallDragAdding=null,this.undoStack=[],this.redoStack=[],this.isDirty=!1,this.dragUid=null,this.isDragMoving=!1}constructor(){this.isEditMode=!1,this.activeTool=z.VF.SELECT,this.selectedTileType=z.nb.FLOOR_1,this.selectedFurnitureType="desk",this.floorColor={...X.Pk},this.wallColor={...X.fS},this.wallDragAdding=null,this.pickedFurnitureColor=null,this.ghostCol=-1,this.ghostRow=-1,this.ghostValid=!1,this.selectedFurnitureUid=null,this.isDragging=!1,this.undoStack=[],this.redoStack=[],this.isDirty=!1,this.dragUid=null,this.dragStartCol=0,this.dragStartRow=0,this.dragOffsetCol=0,this.dragOffsetRow=0,this.isDragMoving=!1}}var V=r(1204),K=r(9892);let J="arcade-office-layout";var Z=r(9631),$=r(5282);let q=(0,$.default)(()=>r.e(904).then(r.bind(r,6904)),{loadableGenerated:{webpack:()=>[6904]},ssr:!1}),Q=(0,$.default)(()=>r.e(810).then(r.bind(r,9810)),{loadableGenerated:{webpack:()=>[9810]},ssr:!1});(0,$.default)(()=>r.e(290).then(r.bind(r,9290)),{loadableGenerated:{webpack:()=>[9290]},ssr:!1});let ee=(0,$.default)(()=>r.e(29).then(r.bind(r,6029)),{loadableGenerated:{webpack:()=>[6029]},ssr:!1}),et=(0,$.default)(()=>r.e(757).then(r.bind(r,3757)),{loadableGenerated:{webpack:()=>[3757]},ssr:!1}),er={idle:{color:"#6b7280",label:"Idle"},working:{color:"#3b82f6",label:"Working..."},waiting_approval:{color:"#f97316",label:"Needs Approval"},done:{color:"#22c55e",label:"Done"},error:{color:"#ef4444",label:"Error"}},en=/(https?:\/\/[^\s)>\]]+)|((?:open\s+)?\/[\w./-]+\.\w+)/g;function eo(e){if("string"==typeof e){let t,r=[],o=0;for(en.lastIndex=0;null!==(t=en.exec(e));){t.index>o&&r.push(e.slice(o,t.index));let l=t[1],i=t[2];if(l)r.push((0,n.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",style:{color:"#818cf8",textDecoration:"underline"},children:l},t.index));else if(i){let e=i.replace(/^open\s+/,"");r.push((0,n.jsx)("span",{onClick:()=>L({type:"OPEN_FILE",path:e}),style:{color:"#818cf8",textDecoration:"underline",cursor:"pointer",fontFamily:"monospace",fontSize:13},title:"Click to open",children:i},t.index))}o=t.index+t[0].length}return 0===r.length?e:(o<e.length&&r.push(e.slice(o)),r)}return Array.isArray(e)?e.map((e,t)=>"string"==typeof e?eo(e):e):e}function el(e){let{logLine:t}=e;return(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-start",marginBottom:8},children:(0,n.jsxs)("div",{style:{padding:"10px 14px",borderRadius:"16px 16px 16px 4px",backgroundColor:"#1e1e3a",color:"#6ee7b7",fontSize:13,fontFamily:"monospace",maxWidth:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:[(0,n.jsx)("span",{style:{opacity:.5,marginRight:6},children:">"}),t||"Thinking..."]})})}function ei(e){let{msg:t}=e;return"user"===t.role?(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:8},children:(0,n.jsx)("div",{style:{maxWidth:"80%",padding:"10px 14px",borderRadius:"16px 16px 4px 16px",backgroundColor:"#4f46e5",color:"#fff",fontSize:14,wordBreak:"break-word"},children:eo(t.text)})}):"system"===t.role?(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-start",marginBottom:8},children:(0,n.jsx)("div",{style:{maxWidth:"80%",padding:"10px 14px",borderRadius:"16px 16px 16px 4px",backgroundColor:"#3b1111",border:"1px solid #ef444444",color:"#f87171",fontSize:14,wordBreak:"break-word"},children:eo(t.text)})}):(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-start",marginBottom:8},children:(0,n.jsxs)("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"16px 16px 16px 4px",backgroundColor:"#1e1e3a",color:"#ddd",fontSize:14,wordBreak:"break-word",overflow:"hidden",minWidth:0},className:"chat-markdown",children:[(0,n.jsx)(U.oz,{urlTransform:e=>e,components:{pre(e){let{children:t}=e;return(0,n.jsx)("div",{style:{overflowX:"auto",margin:"6px 0",WebkitOverflowScrolling:"touch"},children:t})},code(e){var t;let{className:r,children:o,...l}=e,i=String(o).replace(/\n$/,""),a=(null==r?void 0:r.includes("language-"))||i.includes("\n"),s=i.match(/^open\s+(\/\S+)/),c=s?null:i.match(/^(\/[\w./-]+\.\w+)$/),d=null!=(t=null==s?void 0:s[1])?t:null==c?void 0:c[1];return d?(0,n.jsxs)("pre",{onClick:()=>L({type:"OPEN_FILE",path:d}),style:{backgroundColor:"#0d0d1f",padding:"8px 10px",borderRadius:6,fontSize:12,cursor:"pointer",border:"1px solid #2a2a4a",display:"flex",alignItems:"center",gap:8,whiteSpace:"pre"},title:"Click to open",children:[(0,n.jsx)("span",{style:{fontSize:14},children:"\uD83D\uDD17"}),(0,n.jsx)("code",{style:{fontFamily:"monospace",color:"#818cf8"},...l,children:i})]}):a?(0,n.jsx)("pre",{style:{backgroundColor:"#0d0d1f",padding:"8px 10px",borderRadius:6,fontSize:12,whiteSpace:"pre"},children:(0,n.jsx)("code",{style:{fontFamily:"monospace",color:"#a5b4fc"},...l,children:o})}):(0,n.jsx)("code",{style:{backgroundColor:"#0d0d1f",padding:"1px 5px",borderRadius:4,fontFamily:"monospace",color:"#a5b4fc",fontSize:13},...l,children:o})},table(e){let{children:t}=e;return(0,n.jsx)("div",{style:{overflowX:"auto",margin:"6px 0",WebkitOverflowScrolling:"touch"},children:(0,n.jsx)("table",{style:{borderCollapse:"collapse",fontSize:13,whiteSpace:"nowrap"},children:t})})},th(e){let{children:t}=e;return(0,n.jsx)("th",{style:{padding:"4px 10px",borderBottom:"1px solid #444",textAlign:"left",color:"#e2e8f0"},children:t})},td(e){let{children:t}=e;return(0,n.jsx)("td",{style:{padding:"4px 10px",borderBottom:"1px solid #222"},children:t})},p(e){let{children:t}=e;return(0,n.jsx)("p",{style:{margin:"4px 0"},children:eo(t)})},ul(e){let{children:t}=e;return(0,n.jsx)("ul",{style:{margin:"4px 0",paddingLeft:18},children:t})},ol(e){let{children:t}=e;return(0,n.jsx)("ol",{style:{margin:"4px 0",paddingLeft:18},children:t})},a(e){let{href:t,children:r}=e;return(0,n.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",style:{color:"#818cf8",textDecoration:"underline"},children:r})},strong(e){let{children:t}=e;return(0,n.jsx)("strong",{style:{color:"#f0f0f0"},children:t})}},children:t.text.replace(/(https?:\/\/[^\s)>\]]+)/g,"[$1]($1)")}),t.result&&t.result.changedFiles.length>0&&(0,n.jsxs)("div",{style:{marginTop:8,padding:"8px 10px",borderRadius:8,backgroundColor:"#0f1a2f",fontSize:12},children:[(0,n.jsxs)("div",{style:{color:"#888",marginBottom:4},children:["Changed ",t.result.changedFiles.length," files"]}),t.result.changedFiles.slice(0,5).map((e,t)=>(0,n.jsx)("div",{style:{fontFamily:"monospace",color:"#a5b4fc"},children:e},t)),t.result.changedFiles.length>5&&(0,n.jsxs)("div",{style:{color:"#888"},children:["...and ",t.result.changedFiles.length-5," more"]})]})]})})}function ea(e){let{palette:t,zoom:r=3,ready:l}=e,i=(0,o.useRef)(null);return(0,o.useEffect)(()=>{var e,n;let o=i.current;if(!o)return;let l=(0,B.Cr)(t);if(!l)return;let a=l.length,s=null!=(n=null==(e=l[0])?void 0:e.length)?n:0;o.width=s*r,o.height=a*r;let c=o.getContext("2d");if(c){c.clearRect(0,0,o.width,o.height);for(let e=0;e<a;e++)for(let t=0;t<s;t++){let n=l[e][t];n&&(c.fillStyle=n,c.fillRect(t*r,e*r,r,r))}}},[t,r,l]),(0,n.jsx)("canvas",{ref:i,style:{width:16*r,height:32*r,imageRendering:"pixelated"}})}let es=[{id:"claude",name:"Claude",color:"#d97706"},{id:"codex",name:"Codex",color:"#a855f7"},{id:"gemini",name:"Gemini",color:"#3b82f6"},{id:"aider",name:"Aider",color:"#22c55e"},{id:"opencode",name:"OpenCode",color:"#06b6d4"}];function ec(e){let{onHire:t,onClose:r,assetsReady:l}=e,[i,a]=(0,o.useState)("claude");return(0,n.jsx)("div",{onClick:r,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:(0,n.jsxs)("div",{onClick:e=>e.stopPropagation(),style:{backgroundColor:"#16162a",borderRadius:14,padding:"16px 16px 12px",width:"90%",maxWidth:320,border:"1px solid #333"},children:[(0,n.jsx)("h2",{style:{fontSize:16,margin:"0 0 10px",textAlign:"center"},children:"Hire Agent"}),(0,n.jsxs)("div",{style:{marginBottom:10},children:[(0,n.jsx)("div",{style:{fontSize:11,color:"#888",marginBottom:4},children:"AI Backend"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:es.map(e=>(0,n.jsx)("button",{onClick:()=>a(e.id),style:{flex:1,padding:"5px 4px",borderRadius:6,fontSize:11,fontWeight:600,border:i===e.id?"1px solid ".concat(e.color):"1px solid #333",backgroundColor:i===e.id?e.color+"22":"#0a0a1a",color:i===e.id?e.color:"#666",cursor:"pointer",transition:"all 0.15s"},children:e.name},e.id))})]}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:M.map(e=>(0,n.jsxs)("button",{onClick:()=>t(e.name,e.description,e.palette,e.personality,i),style:{display:"flex",alignItems:"center",gap:10,padding:"5px 10px",borderRadius:8,border:"1px solid #333",backgroundColor:"#0a0a1a",cursor:"pointer",textAlign:"left",transition:"background-color 0.15s"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#1a1a3a"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#0a0a1a"},children:[(0,n.jsx)(ea,{palette:e.palette,zoom:2,ready:l}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"#e2e8f0"},children:e.name}),(0,n.jsxs)("div",{style:{fontSize:11,color:"#888"},children:[e.role," \xb7 ",e.description]})]})]},e.palette))}),(0,n.jsx)("button",{onClick:r,style:{width:"100%",marginTop:8,padding:"8px",borderRadius:8,border:"1px solid #333",backgroundColor:"transparent",color:"#666",fontSize:12,cursor:"pointer"},children:"Cancel"})]})})}function ed(){var e;let t=(0,l.useRouter)(),{agents:r,connected:s,addUserMessage:c}=(0,i.f)(),[d,u]=(0,o.useState)(null),[p,f]=(0,o.useState)(!1),[g,h]=(0,o.useState)(!1),[b,y]=(0,o.useState)(""),k=(0,o.useRef)(null),[S,x]=(0,o.useState)(!1),[m,T]=(0,o.useState)(!1),[A,C]=(0,o.useState)(!0),[,E]=(0,o.useState)(0),W=(0,o.useRef)(new G),v=(0,o.useRef)(null),w=(0,o.useRef)(1),U=(0,o.useRef)({x:0,y:0}),[M,B]=(0,o.useState)(!1);(0,o.useEffect)(()=>{try{let e=localStorage.getItem("arcade-sound-enabled");null!==e&&C(JSON.parse(e))}catch(e){}},[]);let{handleTileClick:$,handleRightClick:en,handleDeleteSelected:eo,handleRotateSelected:ed,handleDragStart:eu,handleDragMove:ep,handleDragEnd:ef,updateGhost:eg,handleUndo:eh,handleRedo:eb,handleImportLayout:ey,handleSelectedFurnitureColorChange:ek}=function(e,t,r){let n=(0,o.useRef)(null),l=(0,o.useCallback)(()=>{var e,r;return null!=(r=null==(e=t.current)?void 0:e.layout)?r:null},[t]),i=(0,o.useCallback)(o=>{let l=t.current;l&&(l.setLayout(o),e.current.isDirty=!0,r(),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{try{localStorage.setItem(J,JSON.stringify(o))}catch(e){}},X.e7))},[t,e,r]),a=(0,o.useCallback)((t,n)=>{var o,a,s,c;let d=e.current,u=l();if(!u)return;let p=d.activeTool;if(t<0||t>=u.cols||n<0||n>=u.rows){let e=null;if(n<0?e="up":n>=u.rows?e="down":t<0?e="left":t>=u.cols&&(e="right"),e){d.pushUndo(u),d.clearRedo();let t=(0,V.vk)(u,e);t&&i(t.layout)}return}switch(p){case z.VF.TILE_PAINT:d.pushUndo(u),d.clearRedo(),i((0,V.FH)(u,t,n,d.selectedTileType,d.floorColor));break;case z.VF.WALL_PAINT:{d.pushUndo(u),d.clearRedo();let e=n*u.cols+t;u.tiles[e]===z.nb.WALL?i((0,V.FH)(u,t,n,z.nb.FLOOR_1,d.floorColor)):i((0,V.FH)(u,t,n,z.nb.WALL,d.wallColor));break}case z.VF.ERASE:{d.pushUndo(u),d.clearRedo();let e=(0,V.iH)(u,t,n),r=u;e&&(r=(0,V.PT)(r,e.uid)),i(r=(0,V.FH)(r,t,n,z.nb.VOID));break}case z.VF.FURNITURE_PLACE:if(d.selectedFurnitureType){let e=(0,K.Um)(d.selectedFurnitureType);if(e){let r=e.canPlaceOnWalls?(0,V.si)(d.selectedFurnitureType,n):n;if((0,V.Ii)(u,d.selectedFurnitureType,t,r)){d.pushUndo(u),d.clearRedo();let e={uid:"f-".concat((0,N.Ak)(6)),type:d.selectedFurnitureType,col:t,row:r,...d.pickedFurnitureColor?{color:d.pickedFurnitureColor}:{}};i((0,V.qZ)(u,e))}}}break;case z.VF.SELECT:{let e=(0,V.iH)(u,t,n);d.selectedFurnitureUid=null!=(o=null==e?void 0:e.uid)?o:null,r();break}case z.VF.EYEDROPPER:{let e=n*u.cols+t,o=u.tiles[e];if(void 0!==o&&o!==z.nb.WALL&&o!==z.nb.VOID){d.selectedTileType=o;let t=null==(a=u.tileColors)?void 0:a[e];t&&(d.floorColor={...t}),d.activeTool=z.VF.TILE_PAINT}else if(o===z.nb.WALL){let t=null==(s=u.tileColors)?void 0:s[e];t&&(d.wallColor={...t}),d.activeTool=z.VF.WALL_PAINT}r();break}case z.VF.FURNITURE_PICK:{let e=(0,V.iH)(u,t,n);e&&(d.selectedFurnitureType=e.type,d.pickedFurnitureColor=null!=(c=e.color)?c:null,d.activeTool=z.VF.FURNITURE_PLACE,r())}}},[e,l,i,r]),s=(0,o.useCallback)((t,r)=>{let n=l();if(!n||t<0||t>=n.cols||r<0||r>=n.rows)return;let o=e.current;o.pushUndo(n),o.clearRedo();let a=(0,V.iH)(n,t,r),s=n;a&&(s=(0,V.PT)(s,a.uid)),i(s=(0,V.FH)(s,t,r,z.nb.VOID))},[e,l,i]),c=(0,o.useCallback)(()=>{let t=e.current,n=l();n&&t.selectedFurnitureUid&&(t.pushUndo(n),t.clearRedo(),i((0,V.PT)(n,t.selectedFurnitureUid)),t.selectedFurnitureUid=null,r())},[e,l,i,r]),d=(0,o.useCallback)(()=>{let t=e.current,r=l();if(!r||!t.selectedFurnitureUid)return;let n=r.furniture.find(e=>e.uid===t.selectedFurnitureUid);n&&(0,K.ZZ)(n.type)&&(t.pushUndo(r),t.clearRedo(),i((0,V.WC)(r,t.selectedFurnitureUid)))},[e,l,i]),u=(0,o.useCallback)((t,r)=>{let n=e.current,o=l();if(!o)return;let i=(0,V.iH)(o,t,r);i&&(n.selectedFurnitureUid=i.uid,n.startDrag(i.uid,t,r,t-i.col,r-i.row),n.pushUndo(o),n.clearRedo())},[e,l]),p=(0,o.useCallback)((t,r)=>{let n=e.current;if(!n.dragUid)return;n.isDragMoving=!0;let o=l();if(!o)return;let i=t-n.dragOffsetCol,a=r-n.dragOffsetRow,s=o.furniture.find(e=>e.uid===n.dragUid);s&&((0,K.Um)(s.type),n.ghostCol=i,n.ghostRow=a,n.ghostValid=(0,V.Ii)(o,s.type,i,a,n.dragUid))},[e,l]),f=(0,o.useCallback)((t,r)=>{let n=e.current;if(!n.dragUid)return;let o=n.dragUid,a=n.isDragMoving;if(n.clearDrag(),n.clearGhost(),!a)return;let s=l();if(!s)return;let c=t-n.dragOffsetCol,d=r-n.dragOffsetRow;i((0,V.iZ)(s,o,c,d))},[e,l,i]),g=(0,o.useCallback)((t,r)=>{let n=e.current;if(!n.dragUid)if(n.activeTool===z.VF.FURNITURE_PLACE&&n.selectedFurnitureType){let e=l();if(!e)return;let o=(0,K.Um)(n.selectedFurnitureType);if(!o)return;let i=o.canPlaceOnWalls?(0,V.si)(n.selectedFurnitureType,r):r;n.ghostCol=t,n.ghostRow=i,n.ghostValid=(0,V.Ii)(e,n.selectedFurnitureType,t,i)}else n.ghostCol=t,n.ghostRow=r,n.ghostValid=!1},[e,l]),h=(0,o.useCallback)(()=>{let t=e.current,r=l();if(!r)return;let n=t.popUndo();n&&(t.pushRedo(r),i(n))},[e,l,i]),b=(0,o.useCallback)(()=>{let t=e.current,r=l();if(!r)return;let n=t.popRedo();n&&(t.pushUndo(r),i(n))},[e,l,i]);return{handleTileClick:a,handleRightClick:s,handleDeleteSelected:c,handleRotateSelected:d,handleDragStart:u,handleDragMove:p,handleDragEnd:f,updateGhost:g,handleUndo:h,handleRedo:b,handleImportLayout:(0,o.useCallback)(t=>{let r=e.current,n=l();n&&(r.pushUndo(n),r.clearRedo()),i(t)},[e,l,i]),handleSelectedFurnitureColorChange:(0,o.useCallback)(t=>{let r=e.current,n=l();if(!n||!r.selectedFurnitureUid)return;r.pushUndo(n),r.clearRedo();let o=n.furniture.map(e=>e.uid===r.selectedFurnitureUid?{...e,color:null!=t?t:void 0}:e);i({...n,furniture:o})},[e,l,i])}}(W,v,(0,o.useCallback)(()=>{E(e=>e+1)},[])),eS=(0,o.useCallback)(()=>{x(e=>{let t=!e;return t||W.current.reset(),t})},[]);!function(e){let{editMode:t,editorRef:r,onUndo:n,onRedo:l,onDeleteSelected:i,onRotateSelected:a,onExitEditMode:s}=e;(0,o.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.ctrlKey||e.metaKey;if(t&&"z"===e.key&&!e.shiftKey){e.preventDefault(),n();return}if(t&&"y"===e.key||t&&"z"===e.key&&e.shiftKey){e.preventDefault(),l();return}if("Delete"===e.key||"Backspace"===e.key){r.current.selectedFurnitureUid&&(e.preventDefault(),i());return}if("r"===e.key||"R"===e.key){r.current.selectedFurnitureUid&&(e.preventDefault(),a());return}if("Escape"===e.key)return void(r.current.selectedFurnitureUid?r.current.selectedFurnitureUid=null:s());let o={1:z.VF.SELECT,2:z.VF.TILE_PAINT,3:z.VF.WALL_PAINT,4:z.VF.ERASE,5:z.VF.FURNITURE_PLACE,6:z.VF.EYEDROPPER};if(o[e.key]){r.current.activeTool=o[e.key],r.current.selectedFurnitureUid=null;return}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,r,n,l,i,a,s])}({editMode:S,editorRef:W,onUndo:eh,onRedo:eb,onDeleteSelected:eo,onRotateSelected:ed,onExitEditMode:eS});let ex=(0,o.useCallback)(()=>{let e=function(){try{let e=localStorage.getItem(J);if(!e)return null;let t=JSON.parse(e);if(t&&1===t.version)return t}catch(e){}return null}();if(e&&v.current){let t=(0,Z._m)(e);v.current.setLayout(t),E(e=>e+1)}B(!0)},[]);(0,o.useEffect)(()=>{var e,r;let n=(0,I.getConnection)();if(!n)return void t.push("/pair");return i.f.getState().hydrate(),(Y(),"ws"===n.mode&&n.wsUrl)?(F="ws",e=n.wsUrl,R(),j=e,function e(){if(!j)return;let t=new WebSocket(j);t.onopen=()=>{console.log("[WS] Connected"),i.f.getState().setConnected(!0),t.readyState===WebSocket.OPEN&&t.send(JSON.stringify({type:"PING"}))},t.onmessage=e=>{try{let t=O.parse(JSON.parse(e.data));i.f.getState().handleEvent(t)}catch(e){console.error("[WS] Invalid event:",e)}},t.onclose=()=>{console.log("[WS] Disconnected"),i.f.getState().setConnected(!1),H===t&&j&&(H=null,P=setTimeout(e,2e3))},t.onerror=()=>{},H=t}()):"ably"===n.mode&&(F="ably",r=n.machineId,(D=new a.Realtime({authCallback:async(e,t)=>{try{let e=(0,I.getGatewayHttpUrl)(),n=await fetch("".concat(e,"/ably/token"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({machineId:r})});if(!n.ok)throw Error("Token request failed");let o=await n.json();t(null,o)}catch(e){t(e instanceof Error?e.message:String(e),null)}}})).connection.on("connected",()=>{i.f.getState().setConnected(!0),D.channels.get("machine:".concat(r,":commands")).publish("PING",{type:"PING"})}),D.connection.on("disconnected",()=>{i.f.getState().setConnected(!1)}),D.channels.get("machine:".concat(r,":events")).subscribe(e=>{try{let t=O.parse(e.data);i.f.getState().handleEvent(t)}catch(e){console.error("[Web] Invalid event:",e)}}),_=D.channels.get("machine:".concat(r,":commands"))),()=>{Y()}},[t]);let em=d?r.get(d):null,eT=(null==em?void 0:em.status)==="working"||(null==em?void 0:em.status)==="waiting_approval";(0,o.useEffect)(()=>{var e;null==(e=k.current)||e.scrollIntoView({behavior:"smooth"})},[null==em||null==(e=em.messages)?void 0:e.length,null==em?void 0:em.status]);let eA=(0,o.useCallback)(e=>{u(e),h(!0)},[]),eC=(0,o.useCallback)((e,t,n,o,l)=>{let i=Array.from(r.values()).filter(t=>t.name===e||t.name.match(new RegExp("^".concat(e," \\d+$")))),a=0===i.length?e:"".concat(e," ").concat(i.length+1),s="agent-".concat((0,N.Ak)(6));L({type:"CREATE_AGENT",agentId:s,name:a,role:t,palette:n,personality:o,backend:l}),u(s),h(!0),f(!1)},[r]),eE=(0,o.useCallback)(e=>{var t,n;confirm("Fire ".concat(null!=(n=null==(t=r.get(e))?void 0:t.name)?n:e,"?"))&&(L({type:"FIRE_AGENT",agentId:e}),d===e&&(u(null),h(!1)))},[d,r]),eW=(0,o.useCallback)(()=>{if(!d||!b.trim())return;let e=r.get(d),t=(0,N.Ak)();c(d,t,b.trim()),L({type:"RUN_TASK",agentId:d,taskId:t,prompt:b.trim(),name:null==e?void 0:e.name,role:null==e?void 0:e.role,personality:null==e?void 0:e.personality}),y("")},[d,b,c,r]),ev=(0,o.useCallback)(()=>{d&&L({type:"CANCEL_TASK",agentId:d,taskId:""})},[d]),ew=(0,o.useCallback)((e,t)=>{L({type:"APPROVAL_DECISION",approvalId:e,decision:t})},[]);(0,o.useCallback)(e=>{w.current=Math.max(X.DH,Math.min(X.ZV,e)),E(e=>e+1)},[]);let eO=Array.from(r.values()),eI=W.current,[eD,e_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=window.matchMedia("(max-width: 768px)");e_(e.matches);let t=e=>e_(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]);let eH=g&&null!==d;return(0,n.jsxs)("div",{style:{height:"100vh",width:"100vw",position:"relative",overflow:"hidden",display:"flex"},children:[(0,n.jsxs)("div",{style:{flex:1,position:"relative",minWidth:0},children:[(0,n.jsx)(q,{onAgentClick:eA,selectedAgent:d,editMode:S,editorRef:W,stateRef:v,zoomRef:w,panRef:U,onTileClick:$,onTileRightClick:en,onGhostMove:eg,onDragStart:eu,onDragMove:ep,onDragEnd:ef,onDeleteBtnClick:eo,onRotateBtnClick:ed,onAssetsLoaded:ex}),(0,n.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,zIndex:10,padding:"10px 16px",display:"flex",alignItems:"center",gap:12,background:"linear-gradient(to bottom, rgba(10,10,26,0.85) 0%, rgba(10,10,26,0) 100%)",pointerEvents:"none"},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,pointerEvents:"auto"},children:[(0,n.jsx)("h1",{style:{fontSize:16,margin:0,fontWeight:600},children:"Bit Office"}),(0,n.jsx)("span",{style:{fontSize:10,padding:"2px 8px",borderRadius:10,backgroundColor:s?"#052e16":"#450a0a",color:s?"#22c55e":"#ef4444"},children:s?"Online":"Offline"}),S&&(0,n.jsx)("span",{style:{fontSize:10,padding:"2px 8px",borderRadius:10,backgroundColor:"#1a1a4a",color:"#a5b4fc"},children:"Edit Mode"})]})}),S&&(0,n.jsx)(Q,{activeTool:eI.activeTool,selectedTileType:eI.selectedTileType,selectedFurnitureType:eI.selectedFurnitureType,selectedFurnitureUid:eI.selectedFurnitureUid,selectedFurnitureColor:(()=>{var e;if(!eI.selectedFurnitureUid||!v.current)return null;let t=v.current.layout.furniture.find(e=>e.uid===eI.selectedFurnitureUid);return null!=(e=null==t?void 0:t.color)?e:null})(),floorColor:eI.floorColor,wallColor:eI.wallColor,onToolChange:e=>{eI.activeTool=e,eI.clearSelection(),E(e=>e+1)},onTileTypeChange:e=>{eI.selectedTileType=e,E(e=>e+1)},onFloorColorChange:e=>{eI.floorColor=e,E(e=>e+1)},onWallColorChange:e=>{eI.wallColor=e,E(e=>e+1)},onSelectedFurnitureColorChange:ek,onFurnitureTypeChange:e=>{eI.selectedFurnitureType=e,eI.activeTool=z.VF.FURNITURE_PLACE,E(e=>e+1)}}),!eD&&(0,n.jsx)(et,{editMode:S,onToggleEditMode:eS,onOpenSettings:()=>T(!0)})]}),!eD&&(0,n.jsxs)("div",{style:{width:"33vw",minWidth:300,maxWidth:500,flexShrink:0,height:"100vh",backgroundColor:"#0c0c1a",borderLeft:"1px solid #222",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,n.jsx)("button",{onClick:()=>f(!0),style:{margin:"12px 12px 4px",padding:"10px",borderRadius:10,border:"1px dashed #4f46e5",backgroundColor:"transparent",color:"#a5b4fc",fontSize:13,fontWeight:600,cursor:"pointer",flexShrink:0,transition:"background-color 0.15s"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="rgba(79,70,229,0.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:"+ Hire Agent"}),(0,n.jsx)("div",{style:{flex:1,overflowY:"auto",padding:"4px 0"},children:eO.map(e=>{var t,o,l,i,a,s,c,p;let f=null!=(i=er[e.status])?i:er.idle,S=g&&d===e.agentId,x=r.get(e.agentId),m=(null==x?void 0:x.status)==="working"||(null==x?void 0:x.status)==="waiting_approval";return(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",borderBottom:"1px solid #1a1a2e"},children:[(0,n.jsxs)("button",{onClick:()=>{S?h(!1):(u(e.agentId),h(!0))},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",background:S?"#16162e":"transparent",border:"none",cursor:"pointer",textAlign:"left",width:"100%",transition:"background-color 0.15s",...S?{position:"sticky",top:0,zIndex:2,backgroundColor:"#16162e"}:{}},onMouseEnter:e=>{S||(e.currentTarget.style.backgroundColor="#111125")},onMouseLeave:e=>{S||(e.currentTarget.style.backgroundColor="transparent")},children:[(0,n.jsx)(ea,{palette:null!=(a=e.palette)?a:0,zoom:2,ready:M}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"#e2e8f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),(0,n.jsxs)("div",{style:{fontSize:11,color:"#666",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:4},children:[e.role,e.backend&&(0,n.jsx)("span",{style:{fontSize:9,padding:"1px 4px",borderRadius:4,backgroundColor:(null!=(s=null==(t=es.find(t=>t.id===e.backend))?void 0:t.color)?s:"#666")+"22",color:null!=(c=null==(o=es.find(t=>t.id===e.backend))?void 0:o.color)?c:"#666"},children:null!=(p=null==(l=es.find(t=>t.id===e.backend))?void 0:l.name)?p:e.backend})]})]}),(0,n.jsxs)("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:8,backgroundColor:f.color+"22",color:f.color,flexShrink:0,whiteSpace:"nowrap"},children:["done"===e.status?"✅ ":"working"===e.status?"⚡ ":"",f.label]}),(0,n.jsx)("span",{onClick:t=>{t.stopPropagation(),eE(e.agentId)},style:{fontSize:11,color:"#555",cursor:"pointer",lineHeight:1,padding:"4px",flexShrink:0},children:"✕"})]}),S&&x&&(0,n.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"#0a0a18",minHeight:0,height:"calc(100vh - 200px)",maxHeight:"calc(100vh - 160px)"},children:[(0,n.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"12px 14px",display:"flex",flexDirection:"column"},children:[0===x.messages.length&&(0,n.jsx)("div",{style:{textAlign:"center",color:"#555",padding:20,fontSize:13},children:"Send a message to get started"}),x.messages.map(e=>(0,n.jsx)(ei,{msg:e},e.id)),m&&!x.pendingApproval&&(0,n.jsx)(el,{logLine:x.lastLogLine}),x.pendingApproval&&(0,n.jsxs)("div",{style:{marginBottom:8,padding:14,borderRadius:12,backgroundColor:"#2d1b00",border:"1px solid #f97316"},children:[(0,n.jsx)("div",{style:{fontSize:14,fontWeight:"bold",color:"#f97316",marginBottom:4},children:x.pendingApproval.title}),(0,n.jsx)("div",{style:{fontSize:13,color:"#ccc",marginBottom:10},children:x.pendingApproval.summary}),(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsx)("button",{onClick:()=>ew(x.pendingApproval.approvalId,"yes"),style:{flex:1,padding:"10px",borderRadius:8,border:"none",backgroundColor:"#22c55e",color:"#fff",cursor:"pointer",fontWeight:"bold",fontSize:14},children:"Approve"}),(0,n.jsx)("button",{onClick:()=>ew(x.pendingApproval.approvalId,"no"),style:{flex:1,padding:"10px",borderRadius:8,border:"none",backgroundColor:"#ef4444",color:"#fff",cursor:"pointer",fontWeight:"bold",fontSize:14},children:"Reject"})]})]}),(0,n.jsx)("div",{ref:k})]}),(0,n.jsx)("div",{style:{padding:"10px 12px",borderTop:"1px solid #1a1a2e",backgroundColor:"#0a0a18",flexShrink:0},children:eT?(0,n.jsx)("button",{onClick:()=>{window.confirm("Cancel current work?")&&ev()},style:{width:"100%",padding:"10px 16px",borderRadius:8,border:"1px solid #dc2626",backgroundColor:"transparent",color:"#f87171",fontSize:14,cursor:"pointer"},children:"Cancel current work"}):(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsx)("input",{value:b,onChange:e=>y(e.target.value),onKeyDown:e=>"Enter"===e.key&&!e.nativeEvent.isComposing&&eW(),placeholder:"Send a message...",style:{flex:1,padding:"10px 12px",borderRadius:8,border:"1px solid #222",backgroundColor:"#12122a",color:"#fff",fontSize:14,outline:"none"},autoFocus:!0}),(0,n.jsx)("button",{onClick:eW,disabled:!b.trim(),style:{padding:"10px 16px",borderRadius:8,border:"none",backgroundColor:b.trim()?"#4f46e5":"#222",color:"#fff",fontSize:14,cursor:b.trim()?"pointer":"default"},children:"Send"})]})})]})]},e.agentId)})})]}),eD&&eO.length>0&&!eH&&(0,n.jsxs)("div",{style:{position:"absolute",bottom:0,left:0,right:0,zIndex:20,padding:"8px 12px",display:"flex",alignItems:"center",gap:8,background:"linear-gradient(to top, rgba(10,10,26,0.95) 0%, rgba(10,10,26,0.7) 80%, transparent 100%)",overflowX:"auto"},children:[(0,n.jsx)("button",{onClick:()=>f(!0),style:{width:44,height:44,borderRadius:"50%",flexShrink:0,border:"2px dashed #4f46e5",backgroundColor:"rgba(79,70,229,0.15)",color:"#a5b4fc",fontSize:20,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:"+"}),eO.map(e=>{var t,r;let o=null!=(t=er[e.status])?t:er.idle;return(0,n.jsxs)("button",{onClick:()=>{u(e.agentId),h(!0)},style:{position:"relative",flexShrink:0,width:44,height:44,borderRadius:"50%",border:d===e.agentId?"2px solid #4f46e5":"2px solid #333",backgroundColor:"#0c0c1a",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:[(0,n.jsx)(ea,{palette:null!=(r=e.palette)?r:0,zoom:1,ready:M}),(0,n.jsx)("span",{style:{position:"absolute",bottom:2,right:2,width:8,height:8,borderRadius:"50%",backgroundColor:o.color,border:"1px solid #0c0c1a"}})]},e.agentId)})]}),eD&&eH&&(()=>{var e,t;let o=d?r.get(d):null;if(!o)return null;let l=null!=(e=er[o.status])?e:er.idle,i="working"===o.status||"waiting_approval"===o.status;return(0,n.jsxs)("div",{style:{position:"absolute",inset:0,zIndex:30,backgroundColor:"#0a0a18",display:"flex",flexDirection:"column"},children:[(0,n.jsxs)("div",{onClick:()=>h(!1),style:{padding:"12px 14px",borderBottom:"1px solid #1a1a2e",display:"flex",alignItems:"center",gap:10,flexShrink:0,backgroundColor:"#0e0e20",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontSize:16,color:"#888",marginRight:4},children:"←"}),(0,n.jsx)(ea,{palette:null!=(t=o.palette)?t:0,zoom:2,ready:M}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:14,fontWeight:600,color:"#e2e8f0"},children:o.name}),(0,n.jsx)("div",{style:{fontSize:11,color:"#888"},children:o.role})]}),(0,n.jsx)("span",{style:{fontSize:11,padding:"2px 8px",borderRadius:10,backgroundColor:l.color+"22",color:l.color,flexShrink:0},children:l.label})]}),(0,n.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"12px 14px",display:"flex",flexDirection:"column"},children:[0===o.messages.length&&(0,n.jsx)("div",{style:{textAlign:"center",color:"#555",padding:20,fontSize:13},children:"Send a message to get started"}),o.messages.map(e=>(0,n.jsx)(ei,{msg:e},e.id)),i&&!o.pendingApproval&&(0,n.jsx)(el,{logLine:o.lastLogLine}),o.pendingApproval&&(0,n.jsxs)("div",{style:{marginBottom:8,padding:14,borderRadius:12,backgroundColor:"#2d1b00",border:"1px solid #f97316"},children:[(0,n.jsx)("div",{style:{fontSize:14,fontWeight:"bold",color:"#f97316",marginBottom:4},children:o.pendingApproval.title}),(0,n.jsx)("div",{style:{fontSize:13,color:"#ccc",marginBottom:10},children:o.pendingApproval.summary}),(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsx)("button",{onClick:()=>ew(o.pendingApproval.approvalId,"yes"),style:{flex:1,padding:"10px",borderRadius:8,border:"none",backgroundColor:"#22c55e",color:"#fff",cursor:"pointer",fontWeight:"bold",fontSize:14},children:"Approve"}),(0,n.jsx)("button",{onClick:()=>ew(o.pendingApproval.approvalId,"no"),style:{flex:1,padding:"10px",borderRadius:8,border:"none",backgroundColor:"#ef4444",color:"#fff",cursor:"pointer",fontWeight:"bold",fontSize:14},children:"Reject"})]})]}),(0,n.jsx)("div",{ref:k})]}),(0,n.jsx)("div",{style:{padding:"10px 12px",borderTop:"1px solid #1a1a2e",backgroundColor:"#0a0a18",flexShrink:0},children:i?(0,n.jsx)("button",{onClick:()=>{window.confirm("Cancel current work?")&&ev()},style:{width:"100%",padding:"10px 16px",borderRadius:8,border:"1px solid #dc2626",backgroundColor:"transparent",color:"#f87171",fontSize:14,cursor:"pointer"},children:"Cancel current work"}):(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsx)("input",{value:b,onChange:e=>y(e.target.value),onKeyDown:e=>"Enter"===e.key&&!e.nativeEvent.isComposing&&eW(),placeholder:"Send a message...",style:{flex:1,padding:"10px 12px",borderRadius:8,border:"1px solid #222",backgroundColor:"#12122a",color:"#fff",fontSize:14,outline:"none"},autoFocus:!0}),(0,n.jsx)("button",{onClick:eW,disabled:!b.trim(),style:{padding:"10px 16px",borderRadius:8,border:"none",backgroundColor:b.trim()?"#4f46e5":"#222",color:"#fff",fontSize:14,cursor:b.trim()?"pointer":"default"},children:"Send"})]})})]})})(),p&&(0,n.jsx)(ec,{onHire:eC,onClose:()=>f(!1),assetsReady:M}),v.current&&(0,n.jsx)(ee,{isOpen:m,onClose:()=>T(!1),layout:v.current.layout,onImportLayout:ey,soundEnabled:A,onSoundEnabledChange:C})]})}},8208:(e,t,r)=>{Promise.resolve().then(r.bind(r,8012))},8474:(e,t,r)=>{"use strict";r.d(t,{f:()=>c});var n=r(9576);let o="arcade-chat-history";function l(e){try{let t=[];for(let[,r]of e)(r.messages.length>0||r.name!==r.agentId)&&t.push({agentId:r.agentId,name:r.name,role:r.role,palette:r.palette,personality:r.personality,backend:r.backend,messages:r.messages});localStorage.setItem(o,JSON.stringify(t))}catch(e){}}function i(){try{let e=localStorage.getItem(o);if(!e)return new Map;let t=JSON.parse(e),r=new Map;for(let e of t)r.set(e.agentId,e);return r}catch(e){return new Map}}function a(e){try{let t=localStorage.getItem(o);if(!t)return;let r=JSON.parse(t);localStorage.setItem(o,JSON.stringify(r.filter(t=>t.agentId!==e)))}catch(e){}}function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return{agentId:e,name:t,role:r,status:"idle",currentTaskId:null,currentPrompt:null,pendingApproval:null,messages:[],lastLogLine:null}}let c=(0,n.v)((e,t)=>({agents:new Map,connected:!1,hydrated:!1,setConnected:t=>e({connected:t}),hydrate:()=>{if(t().hydrated)return;let r=i();if(0===r.size)return void e({hydrated:!0});e(e=>{let t=new Map(e.agents);for(let[e,n]of r)t.has(e)||t.set(e,{...s(e,n.name,n.role),palette:n.palette,personality:n.personality,backend:n.backend,messages:n.messages});return{agents:t,hydrated:!0}})},getAgent:e=>{var r;return null!=(r=t().agents.get(e))?r:s(e)},removeAgent:t=>{e(e=>{let r=new Map(e.agents);return r.delete(t),a(t),{agents:r}})},addUserMessage:(t,r,n)=>{e(e=>{var o;let i=new Map(e.agents),a=null!=(o=i.get(t))?o:s(t);return i.set(t,{...a,messages:[...a.messages,{id:r,role:"user",text:n,timestamp:Date.now()}]}),l(i),{agents:i}})},handleEvent:t=>{e(e=>{var r,n,o,c,d,u,p,f,g,h,b,y;let k=new Map(e.agents);switch(t.type){case"AGENT_CREATED":{let e=k.get(t.agentId);if(e)k.set(t.agentId,{...e,name:t.name,role:t.role,palette:null!=(r=t.palette)?r:e.palette,personality:null!=(n=t.personality)?n:e.personality,backend:null!=(o=t.backend)?o:e.backend});else{let e=i().get(t.agentId),r=s(t.agentId,t.name,t.role);r.palette=null!=(c=t.palette)?c:null==e?void 0:e.palette,r.personality=null!=(d=t.personality)?d:null==e?void 0:e.personality,r.backend=null!=(u=t.backend)?u:null==e?void 0:e.backend,e&&(r.messages=e.messages),k.set(t.agentId,r)}l(k);break}case"AGENT_FIRED":k.delete(t.agentId),a(t.agentId);break;case"AGENT_STATUS":{let e=null!=(p=k.get(t.agentId))?p:s(t.agentId);k.set(t.agentId,{...e,status:t.status});break}case"TASK_STARTED":{let e=null!=(f=k.get(t.agentId))?f:s(t.agentId);k.set(t.agentId,{...e,status:"working",currentTaskId:t.taskId,currentPrompt:t.prompt,pendingApproval:null,lastLogLine:null});break}case"APPROVAL_NEEDED":{let e=null!=(g=k.get(t.agentId))?g:s(t.agentId);k.set(t.agentId,{...e,status:"waiting_approval",pendingApproval:{approvalId:t.approvalId,title:t.title,summary:t.summary,riskLevel:t.riskLevel}});break}case"TASK_DONE":{let e=null!=(h=k.get(t.agentId))?h:s(t.agentId),r=t.taskId+"-reply";if(e.messages.some(e=>e.id===r))break;k.set(t.agentId,{...e,status:"done",currentTaskId:null,pendingApproval:null,lastLogLine:null,messages:[...e.messages,{id:r,role:"agent",text:t.result.summary,timestamp:Date.now(),result:t.result}]}),l(k);break}case"TASK_FAILED":{let e=null!=(b=k.get(t.agentId))?b:s(t.agentId),r=t.taskId+"-error";if(e.messages.some(e=>e.id===r))break;k.set(t.agentId,{...e,status:"error",currentTaskId:null,pendingApproval:null,lastLogLine:null,messages:[...e.messages,{id:r,role:"system",text:t.error,timestamp:Date.now()}]}),l(k);break}case"TASK_DELEGATED":{let e=k.get(t.fromAgentId);if(e){let r=k.get(t.toAgentId),n=t.taskId+"-delegate";e.messages.some(e=>e.id===n)||k.set(t.fromAgentId,{...e,messages:[...e.messages,{id:n,role:"system",text:"Delegated to ".concat(null!=(y=null==r?void 0:r.name)?y:t.toAgentId,": ").concat(t.prompt),timestamp:Date.now()}]})}break}case"LOG_APPEND":{let e=k.get(t.agentId);e&&k.set(t.agentId,{...e,lastLogLine:t.chunk})}}return{agents:k}})}}))},9631:(e,t,r)=>{"use strict";r.d(t,{AI:()=>g,CW:()=>b,Co:()=>f,Kf:()=>S,MB:()=>p,Pg:()=>h,_m:()=>x,hF:()=>k,kr:()=>y});var n=r(5195),o=r(9892),l=r(1661);let i={h:210,s:20,b:22,c:0},a={h:35,s:30,b:15,c:0},s={h:150,s:15,b:20,c:0},c={h:30,s:40,b:25,c:0},d={h:195,s:10,b:18,c:0},u={h:270,s:15,b:20,c:0};function p(e){let t=[];for(let r=0;r<e.rows;r++){let n=[];for(let t=0;t<e.cols;t++)n.push(e.tiles[r*e.cols+t]);t.push(n)}return t}function f(e){let t=new Map;for(let r of e){let e=(0,o.Um)(r.type);if(!e||!e.isDesk)continue;let l=r.row*n.dn+e.sprite.length;for(let n=0;n<e.footprintH;n++)for(let o=0;o<e.footprintW;o++){let e="".concat(r.col+o,",").concat(r.row+n),i=t.get(e);(void 0===i||l>i)&&t.set(e,l)}}let r=[];for(let i of e){let e=(0,o.Um)(i.type);if(!e)continue;let a=i.col*n.dn,s=i.row*n.dn,c=s+e.sprite.length;if("chairs"===e.category&&(c="back"===e.orientation?(i.row+1)*n.dn+1:(i.row+1)*n.dn),e.canPlaceOnSurfaces)for(let r=0;r<e.footprintH;r++)for(let n=0;n<e.footprintW;n++){let e=t.get("".concat(i.col+n,",").concat(i.row+r));void 0!==e&&e+.5>c&&(c=e+.5)}let d=e.sprite;if(i.color){let{h:t,s:r,b:n,c:o}=i.color;d=(0,l.LN)("furn-".concat(i.type,"-").concat(t,"-").concat(r,"-").concat(n,"-").concat(o,"-").concat(+!!i.color.colorize),e.sprite,i.color)}r.push({sprite:d,x:a,y:s,zY:c})}return r}function g(e,t){let r=new Set;for(let n of e){let e=(0,o.Um)(n.type);if(!e)continue;let l=e.backgroundTiles||0;for(let o=0;o<e.footprintH;o++)if(!(o<l))for(let l=0;l<e.footprintW;l++){let e="".concat(n.col+l,",").concat(n.row+o);t&&t.has(e)||r.add(e)}}return r}function h(e,t){return g(t?e.filter(e=>e.uid!==t):e)}function b(e){let t=new Map,r=new Set;for(let t of e){let e=(0,o.Um)(t.type);if(e&&e.isDesk)for(let n=0;n<e.footprintH;n++)for(let o=0;o<e.footprintW;o++)r.add("".concat(t.col+o,",").concat(t.row+n))}let l=[{dc:0,dr:-1,facing:n.OP.UP},{dc:0,dr:1,facing:n.OP.DOWN},{dc:-1,dr:0,facing:n.OP.LEFT},{dc:1,dr:0,facing:n.OP.RIGHT}];for(let i of e){let e=(0,o.Um)(i.type);if(!e||"chairs"!==e.category)continue;let a=0;for(let o=0;o<e.footprintH;o++)for(let s=0;s<e.footprintW;s++){let c=i.col+s,d=i.row+o,u=n.OP.DOWN;if(e.orientation)u=function(e){switch(e){case"front":default:return n.OP.DOWN;case"back":return n.OP.UP;case"left":return n.OP.LEFT;case"right":return n.OP.RIGHT}}(e.orientation);else for(let e of l)if(r.has("".concat(c+e.dc,",").concat(d+e.dr))){u=e.facing;break}let p=0===a?i.uid:"".concat(i.uid,":").concat(a);t.set(p,{uid:p,seatCol:c,seatRow:d,facingDir:u,assigned:!1}),a++}}return t}function y(){let e=n.wh,t=n.YK,r=n.nb.WALL,o=n.nb.FLOOR_1;n.nb.VOID;let l=[],i=[],a={h:195,s:10,b:18,c:0};for(let n=0;n<t;n++)for(let s=0;s<e;s++){let c=0===n||n===t-1||0===s||s===e-1?r:o;l.push(c),i.push(c===o?a:null)}return{version:1,cols:e,rows:t,tiles:l,tileColors:i,furniture:[{uid:"desk-1",type:n.JM.DESK,col:3,row:3},{uid:"desk-2",type:n.JM.DESK,col:7,row:3},{uid:"desk-3",type:n.JM.DESK,col:3,row:7},{uid:"desk-4",type:n.JM.DESK,col:7,row:7},{uid:"ch-1",type:n.JM.CHAIR,col:3,row:5},{uid:"ch-2",type:n.JM.CHAIR,col:7,row:5},{uid:"ch-3",type:n.JM.CHAIR,col:3,row:9},{uid:"ch-4",type:n.JM.CHAIR,col:7,row:9},{uid:"plant-1",type:n.JM.PLANT,col:1,row:1},{uid:"shelf-1",type:n.JM.BOOKSHELF,col:12,row:1}]}}function k(e){return JSON.stringify(e)}function S(e){try{let t=JSON.parse(e);if(t&&1===t.version&&Array.isArray(t.tiles)&&Array.isArray(t.furniture))return m(t)}catch(e){}return null}function x(e){return m(e)}function m(e){if(e.tileColors&&e.tileColors.length===e.tiles.length)return e;let t=[];for(let r of e.tiles)switch(r){case 0:t.push(null);break;case 1:t.push(i);break;case 2:t.push(a);break;case 3:t.push(s);break;case 4:t.push(c);break;case 5:t.push(d);break;case 6:t.push(u);break;default:t.push(r>0?{h:0,s:0,b:0,c:0}:null)}return{...e,tileColors:t}}},9892:(e,t,r)=>{"use strict";r.d(t,{UV:()=>h,Um:()=>f,ZZ:()=>b,Ze:()=>k,Zl:()=>y,ar:()=>p,xr:()=>g});var n=r(5195),o=r(2988),l=r(4296);let i=[{type:n.JM.DESK,label:"Desk",footprintW:2,footprintH:2,sprite:o.US,isDesk:!0,category:"desks"},{type:n.JM.BOOKSHELF,label:"Bookshelf",footprintW:1,footprintH:2,sprite:o.iK,isDesk:!1,category:"storage"},{type:n.JM.PLANT,label:"Plant",footprintW:1,footprintH:1,sprite:o.WN,isDesk:!1,category:"decor"},{type:n.JM.COOLER,label:"Cooler",footprintW:1,footprintH:1,sprite:o.L$,isDesk:!1,category:"misc"},{type:n.JM.WHITEBOARD,label:"Whiteboard",footprintW:2,footprintH:1,sprite:o.SJ,isDesk:!1,category:"decor"},{type:n.JM.CHAIR,label:"Chair",footprintW:1,footprintH:1,sprite:o.mr,isDesk:!1,category:"chairs"},{type:n.JM.PC,label:"PC",footprintW:1,footprintH:1,sprite:o.mY,isDesk:!1,category:"electronics"},{type:n.JM.LAMP,label:"Lamp",footprintW:1,footprintH:1,sprite:o.Zc,isDesk:!1,category:"decor"}],a=[{id:"desks",label:"Desks"},{id:"chairs",label:"Chairs"},{id:"storage",label:"Storage"},{id:"electronics",label:"Tech"},{id:"decor",label:"Decor"},{id:"wall",label:"Wall"},{id:"misc",label:"Misc"}],s=new Map,c=new Map,d=new Map,u=new Map;function p(e){for(let n of l.Q){var t,r;let o=e.get(n.id);if(!o)continue;let l=i.findIndex(e=>e.type===n.id),a=(t=n,r=o,{type:t.id,label:t.label,footprintW:t.footprintW,footprintH:t.footprintH,sprite:r,isDesk:t.isDesk,category:t.category,canPlaceOnSurfaces:t.canPlaceOnSurfaces,backgroundTiles:t.backgroundTiles,canPlaceOnWalls:t.canPlaceOnWalls,...t.orientation?{orientation:t.orientation}:{}});l>=0?i[l]=a:i.push(a)}let n=new Map;for(let e of l.Q)if(e.groupId&&e.orientation){if(e.state&&"off"!==e.state)continue;let t=n.get(e.groupId);t||(t=new Map,n.set(e.groupId,t)),t.set(e.orientation,e.id)}let o=["front","right","back","left"];for(let e of n.values()){if(e.size<2)continue;let t=o.filter(t=>e.has(t));if(t.length<2)continue;let r={};for(let n of t)r[n]=e.get(n);let n={orientations:t,members:r};for(let e of Object.values(r))s.set(e,n)}let a=new Map;for(let e of l.Q)if(e.groupId&&e.state){let t="".concat(e.groupId,"|").concat(e.orientation||""),r=a.get(t);r||(r=new Map,a.set(t,r)),r.set(e.state,e.id)}for(let e of a.values()){let t=e.get("on"),r=e.get("off");t&&r&&(c.set(t,r),c.set(r,t),d.set(r,t),u.set(t,r))}for(let e of l.Q)if(e.groupId&&e.orientation&&"on"===e.state){let t=c.get(e.id);if(t){let e=s.get(t);if(e){let t={};for(let r of e.orientations){let n=e.members[r],o=c.get(n);t[r]=null!=o?o:n}let r={orientations:e.orientations,members:t};for(let e of Object.values(t))s.has(e)||s.set(e,r)}}}}function f(e){return i.find(t=>t.type===e)}function g(e){var t;return null!=(t=d.get(e))?t:e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"cw",r=s.get(e);if(!r)return null;let n=r.orientations.map(e=>r.members[e]),o=n.indexOf(e);if(-1===o)return null;let l=(o+("cw"===t?1:-1)+n.length)%n.length;return n[l]}function b(e){return s.has(e)}function y(e){return i.filter(t=>t.category===e)}function k(){let e=new Set;for(let t of i)t.category&&e.add(t.category);return a.filter(t=>e.has(t.id))}}},e=>{e.O(0,[284,989,235,977,358],()=>e(e.s=8208)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (()=>{"use strict";var e={},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}},i=!0;try{e[o].call(a.exports,a,a.exports,r),i=!1}finally{i&&delete t[o]}return a.exports}r.m=e,(()=>{var e=[];r.O=(t,o,n,a)=>{if(o){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[o,n,a];return}for(var u=1/0,i=0;i<e.length;i++){for(var[o,n,a]=e[i],c=!0,l=0;l<o.length;l++)(!1&a||u>=a)&&Object.keys(r.O).every(e=>r.O[e](o[l]))?o.splice(l--,1):(c=!1,a<u&&(u=a));if(c){e.splice(i--,1);var d=n();void 0!==d&&(t=d)}}return t}})(),r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;r.t=function(o,n){if(1&n&&(o=this(o)),8&n||"object"==typeof o&&o&&(4&n&&o.__esModule||16&n&&"function"==typeof o.then))return o;var a=Object.create(null);r.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var u=2&n&&o;"object"==typeof u&&!~e.indexOf(u);u=t(u))Object.getOwnPropertyNames(u).forEach(e=>i[e]=()=>o[e]);return i.default=()=>o,r.d(a,i),a}})(),r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,o)=>(r.f[o](e,t),t),[])),r.u=e=>"static/chunks/"+e+"."+({29:"3e7650727aadf8c2",176:"7af67c16b9732441",290:"d0fe5fb72a5068b2",757:"6b9b9f11f348e673",810:"44213c6355518b0b",904:"8b3ff312a1556d6a"})[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={},t="_N_E:";r.l=(o,n,a,i)=>{if(e[o])return void e[o].push(n);if(void 0!==a)for(var u,c,l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var f=l[d];if(f.getAttribute("src")==o||f.getAttribute("data-webpack")==t+a){u=f;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,r.nc&&u.setAttribute("nonce",r.nc),u.setAttribute("data-webpack",t+a),u.src=r.tu(o)),e[o]=[n];var s=(t,r)=>{u.onerror=u.onload=null,clearTimeout(p);var n=e[o];if(delete e[o],u.parentNode&&u.parentNode.removeChild(u),n&&n.forEach(e=>e(r)),t)return t(r)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="/_next/",(()=>{var e={68:0};r.f.j=(t,o)=>{var n=r.o(e,t)?e[t]:void 0;if(0!==n)if(n)o.push(n[2]);else if(68!=t){var a=new Promise((r,o)=>n=e[t]=[r,o]);o.push(n[2]=a);var i=r.p+r.u(t),u=Error();r.l(i,o=>{if(r.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=o&&("load"===o.type?"missing":o.type),i=o&&o.target&&o.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}},"chunk-"+t,t)}else e[t]=0},r.O.j=t=>0===e[t];var t=(t,o)=>{var n,a,[i,u,c]=o,l=0;if(i.some(t=>0!==e[t])){for(n in u)r.o(u,n)&&(r.m[n]=u[n]);if(c)var d=c(r)}for(t&&t(o);l<i.length;l++)a=i[l],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(d)},o=self.webpackChunk_N_E=self.webpackChunk_N_E||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})()})();
1
+ (()=>{"use strict";var e={},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}},i=!0;try{e[o].call(a.exports,a,a.exports,r),i=!1}finally{i&&delete t[o]}return a.exports}r.m=e,(()=>{var e=[];r.O=(t,o,n,a)=>{if(o){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[o,n,a];return}for(var u=1/0,i=0;i<e.length;i++){for(var[o,n,a]=e[i],c=!0,l=0;l<o.length;l++)(!1&a||u>=a)&&Object.keys(r.O).every(e=>r.O[e](o[l]))?o.splice(l--,1):(c=!1,a<u&&(u=a));if(c){e.splice(i--,1);var f=n();void 0!==f&&(t=f)}}return t}})(),r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;r.t=function(o,n){if(1&n&&(o=this(o)),8&n||"object"==typeof o&&o&&(4&n&&o.__esModule||16&n&&"function"==typeof o.then))return o;var a=Object.create(null);r.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var u=2&n&&o;"object"==typeof u&&!~e.indexOf(u);u=t(u))Object.getOwnPropertyNames(u).forEach(e=>i[e]=()=>o[e]);return i.default=()=>o,r.d(a,i),a}})(),r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,o)=>(r.f[o](e,t),t),[])),r.u=e=>"static/chunks/"+e+"."+({29:"3e7650727aadf8c2",176:"7af67c16b9732441",290:"d0fe5fb72a5068b2",757:"6b9b9f11f348e673",810:"44213c6355518b0b",904:"4649cb92e3c1355c"})[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={},t="_N_E:";r.l=(o,n,a,i)=>{if(e[o])return void e[o].push(n);if(void 0!==a)for(var u,c,l=document.getElementsByTagName("script"),f=0;f<l.length;f++){var d=l[f];if(d.getAttribute("src")==o||d.getAttribute("data-webpack")==t+a){u=d;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,r.nc&&u.setAttribute("nonce",r.nc),u.setAttribute("data-webpack",t+a),u.src=r.tu(o)),e[o]=[n];var s=(t,r)=>{u.onerror=u.onload=null,clearTimeout(p);var n=e[o];if(delete e[o],u.parentNode&&u.parentNode.removeChild(u),n&&n.forEach(e=>e(r)),t)return t(r)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="/_next/",(()=>{var e={68:0};r.f.j=(t,o)=>{var n=r.o(e,t)?e[t]:void 0;if(0!==n)if(n)o.push(n[2]);else if(68!=t){var a=new Promise((r,o)=>n=e[t]=[r,o]);o.push(n[2]=a);var i=r.p+r.u(t),u=Error();r.l(i,o=>{if(r.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=o&&("load"===o.type?"missing":o.type),i=o&&o.target&&o.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}},"chunk-"+t,t)}else e[t]=0},r.O.j=t=>0===e[t];var t=(t,o)=>{var n,a,[i,u,c]=o,l=0;if(i.some(t=>0!==e[t])){for(n in u)r.o(u,n)&&(r.m[n]=u[n]);if(c)var f=c(r)}for(t&&t(o);l<i.length;l++)a=i[l],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(f)},o=self.webpackChunk_N_E=self.webpackChunk_N_E||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})()})();