bit-office 1.0.3 → 1.1.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.
- package/dist/index.js +1755 -193
- package/dist/index.js.map +1 -1
- package/dist/web/{out/out/404.html → 404.html} +2 -2
- package/dist/web/_next/static/chunks/368.cc1f599d57c41c84.js +1 -0
- package/dist/web/_next/static/chunks/app/office/page-3c20b887f5c4dc88.js +1 -0
- package/dist/web/{out/out/_next/static/chunks/webpack-2f6b11d148fba4ca.js → _next/static/chunks/webpack-24a71fb73bc694fc.js} +1 -1
- package/dist/web/{out/out/index.html → index.html} +2 -2
- package/dist/web/{out/out/index.txt → index.txt} +1 -1
- package/dist/web/{out/out/office.html → office.html} +3 -3
- package/dist/web/{out/out/office.txt → office.txt} +2 -2
- package/dist/web/{out/out/pair.html → pair.html} +2 -2
- package/dist/web/{out/out/pair.txt → pair.txt} +1 -1
- package/dist/web/{out/out/sw.js → sw.js} +1 -1
- package/package.json +2 -2
- package/dist/web/out/out/_next/static/chunks/904.70db0cb7d0ebff73.js +0 -1
- package/dist/web/out/out/_next/static/chunks/app/office/page-40e6628ffa58377f.js +0 -1
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/LICENSE.txt +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Designs/Office Level 1.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Designs/Office Level 2.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Designs/Office Level 3.5.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Designs/Office Level 3.jpeg +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Designs/Office Level 3.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Designs/Office Level 4.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Palette/Office Palette Large.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Palette/Office Palette Medium.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Palette/Office Palette Small.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Tileset All 16x16 no shadow.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Tileset All 16x16.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Tileset All 32x32 no shadow.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Tileset All 32x32.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Tileset All 48x48 no shadow.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office Tileset All 48x48.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/A2 Office Floors.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/A4 Office Walls.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/A5 Office Floors & Walls.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/B-C-D-E Office 1 No Shadows.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/B-C-D-E Office 1.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/B-C-D-E Office 2 No Shadows.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/B-C-D-E Office 2.png +0 -0
- /package/dist/web/{out/out/Office Tileset → Office Tileset}/Office VX Ace/README.txt +0 -0
- /package/dist/web/{out/out/_next/static/0Dv8UrlW-3l4rmSUSmwsV → _next/static/2DlUdS8198vtEVFBCTvcr}/_buildManifest.js +0 -0
- /package/dist/web/{out/out/_next/static/0Dv8UrlW-3l4rmSUSmwsV → _next/static/2DlUdS8198vtEVFBCTvcr}/_ssgManifest.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/29.2a4210219e06b537.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/290.d0fe5fb72a5068b2.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/325ca9c7-f84e7e4973790fdf.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/388-5a04e93e2531cfb7.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/4d67e943-e6a0fd3b5c397505.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/757.6d61de28074ba8d4.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/810.44213c6355518b0b.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/880.614e72604eb723a3.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/989-4c2c2b3a6c2f8a4a.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/app/_not-found/page-182ed2c105839b2a.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/app/layout-72c65340fbaef4c0.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/app/page-9721074d4b94e149.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/app/pair/page-ffb2dcb5753f3161.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/framework-bec628f2b7cc8f6d.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/main-314e1c8a2c4316bd.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/main-app-baad86574bd560af.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/pages/_app-f4d560c9dbc22e4e.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/pages/_error-492bd157be5771d5.js +0 -0
- /package/dist/web/{out/out/_next → _next}/static/chunks/polyfills-42372ed130431b0a.js +0 -0
- /package/dist/web/{out/out/assets → assets}/characters/char_0.png +0 -0
- /package/dist/web/{out/out/assets → assets}/characters/char_1.png +0 -0
- /package/dist/web/{out/out/assets → assets}/characters/char_2.png +0 -0
- /package/dist/web/{out/out/assets → assets}/characters/char_3.png +0 -0
- /package/dist/web/{out/out/assets → assets}/characters/char_4.png +0 -0
- /package/dist/web/{out/out/assets → assets}/characters/char_5.png +0 -0
- /package/dist/web/{out/out/assets → assets}/walls.png +0 -0
- /package/dist/web/{out/out/icons → icons}/icon-192.png +0 -0
- /package/dist/web/{out/out/icons → icons}/icon-512.png +0 -0
- /package/dist/web/{out/out/manifest.json → manifest.json} +0 -0
- /package/dist/web/{out/out/pixel-agents-layout.json → pixel-agents-layout.json} +0 -0
- /package/dist/web/{out/out/workbox-5194662c.js → workbox-5194662c.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--2DlUdS8198vtEVFBCTvcr--><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-24a71fb73bc694fc.js"/><script src="/_next/static/chunks/4d67e943-e6a0fd3b5c397505.js" async=""></script><script src="/_next/static/chunks/388-5a04e93e2531cfb7.js" async=""></script><script src="/_next/static/chunks/main-app-baad86574bd560af.js" async=""></script><meta name="theme-color" content="#1a1530"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><title>404: This page could not be found.</title><meta name="robots" content="noindex"/><title>Bit Office</title><meta name="description" content="Control your AI agents from anywhere"/><link rel="manifest" href="/manifest.json"/><link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body style="margin:0;background-color:#1a1530;color:#eddcb8;font-family:system-ui, sans-serif"><div hidden=""><!--$--><!--/$--></div><style>
|
|
2
2
|
:root {
|
|
3
3
|
--px-bg-deep: #16122a;
|
|
4
4
|
--px-bg-panel: #1e1a30;
|
|
@@ -52,4 +52,4 @@
|
|
|
52
52
|
for (var r of regs) r.unregister();
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
</script><script src="/_next/static/chunks/webpack-
|
|
55
|
+
</script><script src="/_next/static/chunks/webpack-24a71fb73bc694fc.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n3:I[9653,[],\"\"]\n4:I[1329,[],\"\"]\n9:I[5719,[],\"\"]\n2:T5c9,"])</script><script>self.__next_f.push([1,"\n :root {\n --px-bg-deep: #16122a;\n --px-bg-panel: #1e1a30;\n --px-bg-card: #231e38;\n --px-bg-chat: #1a1530;\n --px-border: #3d2e54;\n --px-border-warm: #5a3d14;\n --px-gold: #e8b040;\n --px-gold-dim: #a87820;\n --px-text: #eddcb8;\n --px-text-muted: #9a8a68;\n --px-text-dim: #6a5a48;\n --px-amber: #e0900a;\n --px-amber-bg: rgba(232, 176, 64, 0.14);\n }\n * {\n scrollbar-width: thin;\n scrollbar-color: #5a3d14 #1a1530;\n }\n *::-webkit-scrollbar {\n width: 4px;\n height: 4px;\n }\n *::-webkit-scrollbar-track {\n background: transparent;\n }\n *::-webkit-scrollbar-thumb {\n background: #3d2d10;\n border-radius: 0;\n }\n *::-webkit-scrollbar-thumb:hover {\n background: #e8b040;\n }\n *::-webkit-scrollbar-corner {\n background: transparent;\n }\n .px-font {\n font-family: 'Press Start 2P', monospace;\n }\n @keyframes px-blink {\n 0%, 49% { opacity: 1; }\n 50%, 100% { opacity: 0; }\n }\n @keyframes px-pulse-gold {\n 0%, 100% { box-shadow: 0 0 0 0 rgba(200,155,48,0); }\n 50% { box-shadow: 0 0 8px 2px rgba(200,155,48,0.25); }\n }\n "])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"2DlUdS8198vtEVFBCTvcr\",\"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\":\"#1a1530\"}],[\"$\",\"meta\",null,{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\"}],[\"$\",\"link\",null,{\"rel\":\"preconnect\",\"href\":\"https://fonts.googleapis.com\"}],[\"$\",\"link\",null,{\"rel\":\"preconnect\",\"href\":\"https://fonts.gstatic.com\",\"crossOrigin\":\"anonymous\"}],[\"$\",\"link\",null,{\"href\":\"https://fonts.googleapis.com/css2?family=Press+Start+2P\u0026display=swap\",\"rel\":\"stylesheet\"}]]}],[\"$\",\"body\",null,{\"style\":{\"margin\":0,\"backgroundColor\":\"#1a1530\",\"color\":\"#eddcb8\",\"fontFamily\":\"system-ui, sans-serif\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}],[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",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,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",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)}}\"}}],\"$L5\",\"$L6\"]}]}]],null,\"$L7\"]}],{},null,false]},null,false]},null,false],\"$L8\",false]],\"m\":\"$undefined\",\"G\":[\"$9\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"a:I[9096,[],\"OutletBoundary\"]\nc:I[913,[],\"AsyncMetadataOutlet\"]\ne:I[9096,[],\"ViewportBoundary\"]\n10:I[9096,[],\"MetadataBoundary\"]\n11:\"$Sreact.suspense\"\n5:[\"$\",\"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}]\n6:[\"$\",\"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.\"}]}]\n7:[\"$\",\"$La\",null,{\"children\":[\"$Lb\",[\"$\",\"$Lc\",null,{\"promise\":\"$@d\"}]]}]\n8:[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$Le\",null,{\"children\":\"$Lf\"}],null],[\"$\",\"$L10\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$11\",null,{\"fallback\":null,\"children\":\"$L12\"}]}]}]]}]\n"])</script><script>self.__next_f.push([1,"f:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nb:null\n"])</script><script>self.__next_f.push([1,"d:{\"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,"12:\"$d:metadata\"\n"])</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[368],{368:(e,t,l)=>{l.r(t),l.d(t,{default:()=>S});var r=l(206),i=l(1406),n=l(5195);function a(e,t,l,r){let i=l.length,a=i>0?l[0].length:0;if(t<0||t>=i||e<0||e>=a)return!1;let o=l[t][e];return!(o===n.nb.WALL||o===n.nb.VOID||r.has("".concat(e,",").concat(t)))}function o(e,t){let l=e.length,r=l>0?e[0].length:0,i=[];for(let n=0;n<l;n++)for(let l=0;l<r;l++)a(l,n,e,t)&&i.push({col:l,row:n});return i}function s(e,t,l,r,i,n){if(e===l&&t===r)return[];let o=(e,t)=>"".concat(e,",").concat(t),s=o(e,t),c=o(l,r);if(!a(l,r,i,n))return[];let u=new Set;u.add(s);let h=new Map,f=[{col:e,row:t}],d=[{dc:0,dr:-1},{dc:0,dr:1},{dc:-1,dr:0},{dc:1,dr:0}];for(;f.length>0;){let e=f.shift(),t=o(e.col,e.row);if(t===c){let e=[],t=c;for(;t!==s;){let[l,r]=t.split(",").map(Number);e.unshift({col:l,row:r}),t=h.get(t)}return e}for(let l of d){let r=e.col+l.dc,s=e.row+l.dr,c=o(r,s);!u.has(c)&&a(r,s,i,n)&&(u.add(c),h.set(c,t),f.push({col:r,row:s}))}}return[]}var c=l(2243);let u=new Set(["Read","Grep","Glob","WebFetch","WebSearch"]);function h(e,t){return{x:e*n.dn+n.dn/2,y:t*n.dn+n.dn/2}}function f(e,t,l,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=r?r.seatCol:1,o=r?r.seatRow:1,s=h(a,o);return{id:e,state:n.Lp.TYPE,dir:r?r.facingDir:n.OP.DOWN,x:s.x,y:s.y,tileCol:a,tileRow:o,path:[],moveProgress:0,currentTool:null,palette:t,hueShift:i,frame:0,frameTimer:0,wanderTimer:0,wanderCount:0,wanderLimit:g(c.Rb,c.he),isActive:!0,seatId:l,bubbleType:null,bubbleTimer:0,speechText:null,speechTimer:0,seatTimer:0,isSubagent:!1,parentAgentId:null,matrixEffect:null,matrixEffectTimer:0,matrixEffectSeeds:[],isExternal:!1,label:null,labelColor:null}}function d(e,t){return e+Math.random()*(t-e)}function g(e,t){return e+Math.floor(Math.random()*(t-e+1))}function m(e,t,l){return(7*e+13*t+31*Math.floor(l*c.vU)&255)<c.gB}function b(){let e=[];for(let t=0;t<c.W3;t++)e.push(Math.random());return e}var p=l(9631),w=l(9892);class T{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=o(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,l,r,i,a){let o;if(this.agentIdToCharId.has(e))return;let s=this.nextCharId++;this.agentIdToCharId.set(e,s),this.charIdToAgentId.set(s,e);let{palette:c,hueShift:u}=void 0!==l?{palette:l,hueShift:0}:this.pickDiversePalette(),h=this.findFreeSeat();if(h){let e=this.seats.get(h);e.assigned=!0,o=f(s,c,h,e,u)}else{let e=this.walkableTiles.length>0?this.walkableTiles[Math.floor(Math.random()*this.walkableTiles.length)]:{col:1,row:1};(o=f(s,c,null,null,u)).x=e.col*n.dn+n.dn/2,o.y=e.row*n.dn+n.dn/2,o.tileCol=e.col,o.tileRow=e.row}r&&(o.isExternal=!0),i&&(o.label=i),a&&(o.labelColor=a),o.matrixEffect="spawn",o.matrixEffectTimer=0,o.matrixEffectSeeds=b(),this.characters.set(s,o)}removeCharacter(e){let t=this.agentIdToCharId.get(e);if(void 0===t)return;let l=this.characters.get(t);if(l&&"despawn"!==l.matrixEffect){if(l.seatId){let e=this.seats.get(l.seatId);e&&(e.assigned=!1)}this.selectedCharId===t&&(this.selectedCharId=null),l.matrixEffect="despawn",l.matrixEffectTimer=0,l.matrixEffectSeeds=b(),l.bubbleType=null}}updateCharacterStatus(e,t){let l=this.agentIdToCharId.get(e);if(void 0===l)return;let r=this.characters.get(l);if(!r)return;let i=r.isActive,n="working"===t||"waiting_approval"===t;r.isActive=n,!n&&i?(r.seatTimer=-1,r.path=[],r.moveProgress=0,this.rebuildFurnitureInstances()):n&&!i&&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 l=this.agentIdToCharId.get(e);if(void 0===l)return;let r=this.characters.get(l);r&&("permission"===t||"working"===t?(r.bubbleType=t,r.bubbleTimer=0):(r.bubbleType="waiting",r.bubbleTimer=c.WK))}clearBubble(e){let t=this.agentIdToCharId.get(e);if(void 0===t)return;let l=this.characters.get(t);l&&("permission"===l.bubbleType||"working"===l.bubbleType?(l.bubbleType=null,l.bubbleTimer=0):"waiting"===l.bubbleType&&(l.bubbleTimer=Math.min(l.bubbleTimer,c.M_)))}showSpeechBubble(e,t){let l=this.agentIdToCharId.get(e);if(void 0===l)return;let r=this.characters.get(l);r&&(r.speechText=t.length>c.lO?t.slice(0,c.lO)+"...":t,r.speechTimer=c.Jk)}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 r of this.getCharacters().sort((e,t)=>t.y-e.y)){if("despawn"===r.matrixEffect)continue;let i=r.state===n.Lp.TYPE?c.iE:0,a=r.y+i,o=r.x-c.Ns,s=r.x+c.Ns,u=a-c.o3;if(e>=o&&e<=s&&t>=u&&t<=a){var l;return null!=(l=this.charIdToAgentId.get(r.id))?l:null}}return null}setHoveredCharAtPixel(e,t){for(let l of this.getCharacters().sort((e,t)=>t.y-e.y)){if("despawn"===l.matrixEffect)continue;let r=l.state===n.Lp.TYPE?c.iE:0,i=l.y+r,a=l.x-c.Ns,o=l.x+c.Ns,s=i-c.o3;if(e>=a&&e<=o&&t>=s&&t<=i){this.hoveredCharId=l.id;return}}this.hoveredCharId=null}update(e){let t=[];for(let l of this.characters.values()){if(l.matrixEffect){l.matrixEffectTimer+=e,l.matrixEffectTimer>=n.Pz&&("spawn"===l.matrixEffect?(l.matrixEffect=null,l.matrixEffectTimer=0,l.matrixEffectSeeds=[]):t.push(l.id));continue}this.withOwnSeatUnblocked(l,()=>(function(e,t,l,r,i,a){switch(e.frameTimer+=t,e.state){case n.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=n.Lp.IDLE,e.frame=0,e.frameTimer=0,e.wanderTimer=d(c.wj,c.k8),e.wanderCount=0,e.wanderLimit=g(c.Rb,c.he)}break;case n.Lp.IDLE:if(e.frame=0,e.seatTimer<0&&(e.seatTimer=0),e.isActive){if(!e.seatId){e.state=n.Lp.TYPE,e.frame=0,e.frameTimer=0;break}let t=r.get(e.seatId);if(t){let l=s(e.tileCol,e.tileRow,t.seatCol,t.seatRow,i,a);l.length>0?(e.path=l,e.moveProgress=0,e.state=n.Lp.WALK):(e.state=n.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=r.get(e.seatId);if(t){let l=s(e.tileCol,e.tileRow,t.seatCol,t.seatRow,i,a);if(l.length>0){e.path=l,e.moveProgress=0,e.state=n.Lp.WALK,e.frame=0,e.frameTimer=0;break}}}if(l.length>0){let t=l[Math.floor(Math.random()*l.length)],r=s(e.tileCol,e.tileRow,t.col,t.row,i,a);r.length>0&&(e.path=r,e.moveProgress=0,e.state=n.Lp.WALK,e.frame=0,e.frameTimer=0,e.wanderCount++)}e.wanderTimer=d(c.wj,c.k8)}break;case n.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=r.get(e.seatId);t&&e.tileCol===t.seatCol&&e.tileRow===t.seatRow?(e.state=n.Lp.TYPE,e.dir=t.facingDir):e.state=n.Lp.IDLE}else e.state=n.Lp.TYPE;else{if(e.seatId){let t=r.get(e.seatId);if(t&&e.tileCol===t.seatCol&&e.tileRow===t.seatRow){e.state=n.Lp.TYPE,e.dir=t.facingDir,e.seatTimer<0?e.seatTimer=0:e.seatTimer=d(c.Ot,c.Ww),e.wanderCount=0,e.wanderLimit=g(c.Rb,c.he),e.frame=0,e.frameTimer=0;break}}e.state=n.Lp.IDLE,e.wanderTimer=d(c.wj,c.k8)}e.frame=0,e.frameTimer=0;break}let l=e.path[0];e.dir=function(e,t,l,r){let i=l-e;return i>0?n.OP.RIGHT:i<0?n.OP.LEFT:r-t>0?n.OP.DOWN:n.OP.UP}(e.tileCol,e.tileRow,l.col,l.row),e.moveProgress+=c.XE/n.dn*t;let o=h(e.tileCol,e.tileRow),u=h(l.col,l.row),f=Math.min(e.moveProgress,1);if(e.x=o.x+(u.x-o.x)*f,e.y=o.y+(u.y-o.y)*f,e.moveProgress>=1&&(e.tileCol=l.col,e.tileRow=l.row,e.x=u.x,e.y=u.y,e.path.shift(),e.moveProgress=0),e.isActive&&e.seatId){let t=r.get(e.seatId);if(t){let l=e.path[e.path.length-1];if(!l||l.col!==t.seatCol||l.row!==t.seatRow){let l=s(e.tileCol,e.tileRow,t.seatCol,t.seatRow,i,a);l.length>0&&(e.path=l,e.moveProgress=0)}}}}}})(l,e,this.walkableTiles,this.seats,this.tileMap,this.blockedTiles)),"waiting"===l.bubbleType&&(l.bubbleTimer-=e,l.bubbleTimer<=0&&(l.bubbleType=null,l.bubbleTimer=0)),l.speechText&&(l.speechTimer-=e,l.speechTimer<=0&&(l.speechText=null,l.speechTimer=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),l=[];for(let r=0;r<c.ic;r++)e[r]===t&&l.push(r);let r=l[Math.floor(Math.random()*l.length)],i=0;return t>0&&(i=c.qt+Math.floor(Math.random()*c.p7)),{palette:r,hueShift:i}}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 l=this.ownSeatKey(e);l&&this.blockedTiles.delete(l);let r=t();return l&&this.blockedTiles.add(l),r}rebuildFurnitureInstances(){let e=new Set;for(let t of this.characters.values()){if(!t.isActive||!t.seatId)continue;let l=this.seats.get(t.seatId);if(!l)continue;let r=l.facingDir===n.OP.RIGHT?1:l.facingDir===n.OP.LEFT?-1:0,i=l.facingDir===n.OP.DOWN?1:l.facingDir===n.OP.UP?-1:0;for(let t=1;t<=c.Xo;t++)e.add("".concat(l.seatCol+r*t,",").concat(l.seatRow+i*t));for(let t=1;t<=c.ou;t++){let n=l.seatCol+r*t,a=l.seatRow+i*t;0!==r?(e.add("".concat(n,",").concat(a-1)),e.add("".concat(n,",").concat(a+1))):(e.add("".concat(n-1,",").concat(a)),e.add("".concat(n+1,",").concat(a)))}}if(0===e.size){this.furniture=(0,p.Co)(this.layout.furniture);return}let t=this.layout.furniture.map(t=>{let l=(0,w.Um)(t.type);if(!l)return t;for(let r=0;r<l.footprintH;r++)for(let i=0;i<l.footprintW;i++)if(e.has("".concat(t.col+i,",").concat(t.row+r))){let e=(0,w.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=o(this.tileMap,this.blockedTiles)}}var y=l(5702),x=l(2988),C=l(4777),v=l(5055),I=l(4296),M=l(1204);class R{addAgent(e,t){this.officeState.addCharacter(e,t.name,t.palette,t.isExternal,t.label,t.labelColor)}removeAgent(e){this.officeState.removeCharacter(e)}updateAgent(e,t,l){this.officeState.updateCharacterStatus(e,t),l?this.officeState.showBubble(e,l):this.officeState.clearBubble(e)}showSpeechBubble(e,t){this.officeState.showSpeechBubble(e,t)}selectAgent(e){this.officeState.selectCharacter(e)}dispose(){var e;null==(e=this.stopLoop)||e.call(this),this.stopLoop=null}getOfficeState(){return this.officeState}constructor(e,t){this.officeState=e,this.stopLoop=t}}function S(e){let{onAdapterReady:t,onAgentClick:l,editMode:a,editorRef:o,onTileClick:s,onTileRightClick:h,onGhostMove:f,onDragStart:d,onDragMove:g,onDragEnd:b,onDeleteBtnClick:p,onRotateBtnClick:S,officeStateRef:k,onAssetsLoaded:E,zoomRef:P,panRef:L}=e,A=(0,i.useRef)(null),[Y,F]=(0,i.useState)(!1),B=(0,i.useRef)(null),W=(0,i.useRef)(l);W.current=l;let D=(0,i.useRef)(a);D.current=a;let X=(0,i.useRef)(!1),O=(0,i.useRef)({x:0,y:0,panX:0,panY:0}),U=(0,i.useRef)({offsetX:0,offsetY:0}),z=(0,i.useRef)(null),H=(0,i.useCallback)((e,t)=>{let l=k.current;if(!l)return 4;let r=l.layout.cols*c.dn,i=l.layout.rows*c.dn;return Math.max(c.DH,Math.floor(Math.min(e/r,t/i)))},[k]),N=(0,i.useCallback)(()=>{let e=A.current;if(!e)return;let t=e.parentElement;if(!t)return;let l=window.devicePixelRatio||1,r=t.clientWidth,i=t.clientHeight;e.width=r*l,e.height=i*l,e.style.width="".concat(r,"px"),e.style.height="".concat(i,"px");let n=e.getContext("2d");n&&n.scale(l,l),P.current=H(r,i),L.current={x:0,y:0}},[H,P,L]);(0,i.useEffect)(()=>{let e=!1;return(0,I.F)().then(t=>{e||((0,w.ar)(t.tilesetSprites),B.current=t.layout,F(!0),null==E||E())}).catch(t=>{console.warn("[PixelOfficeScene] Asset loading failed, using fallbacks:",t),e||(F(!0),null==E||E())}),()=>{e=!0}},[E]),(0,i.useEffect)(()=>{var e;if(!Y)return;let l=A.current;if(!l)return;let r=new T(null!=(e=B.current)?e:void 0);k.current=r,N(),window.addEventListener("resize",N);let i=window.devicePixelRatio||1,a=function(e,t){let l=e.getContext("2d");l.imageSmoothingEnabled=!1;let r=0,i=0,n=!1,a=e=>{if(n)return;let o=0===r?0:Math.min((e-r)/1e3,c.O9);r=e,t.update(o),l.imageSmoothingEnabled=!1,t.render(l),i=requestAnimationFrame(a)};return i=requestAnimationFrame(a),()=>{n=!0,cancelAnimationFrame(i)}}(l,{update:e=>{r.update(e)},render:e=>{let t,a=l.width/i,s=l.height/i,h=P.current,f=L.current,d=o.current;if(D.current){let e=null;if(d.activeTool===n.VF.FURNITURE_PLACE&&d.selectedFurnitureType){let t=(0,w.Um)(d.selectedFurnitureType);t&&(e=t.sprite)}if(d.dragUid){let t=r.layout.furniture.find(e=>e.uid===d.dragUid);if(t){let l=(0,w.Um)(t.type);l&&(e=l.sprite)}}let l=!1,i=0,a=0,o=1,s=1,c=!1;if(d.selectedFurnitureUid){let e=r.layout.furniture.find(e=>e.uid===d.selectedFurnitureUid);if(e){var g,b;let t=(0,w.Um)(e.type);l=!0,i=e.col,a=e.row,o=null!=(g=null==t?void 0:t.footprintW)?g:1,s=null!=(b=null==t?void 0:t.footprintH)?b:1,c=(0,w.ZZ)(e.type)}}t={showGrid:!0,ghostSprite:e,ghostCol:d.ghostCol,ghostRow:d.ghostRow,ghostValid:d.ghostValid,hasSelection:l,selectedCol:i,selectedRow:a,selectedW:o,selectedH:s,isRotatable:c,deleteButtonBounds:null,rotateButtonBounds:null,showGhostBorder:!0,ghostBorderHoverCol:d.ghostCol,ghostBorderHoverRow:d.ghostRow}}U.current=function(e,t,l,r,i,a,o,s,h,f,d,g,b,p,w){e.clearRect(0,0,t,l);let T=null!=b?b:r.length>0?r[0].length:0,I=null!=p?p:r.length,M=T*n.dn*o,R=I*n.dn*o,S=Math.floor((t-M)/2)+Math.round(s),k=Math.floor((l-R)/2)+Math.round(h);!function(e,t,l,r,i,a,o){let s=n.dn*i,u=(0,C.$0)(),h=t.length,f=h>0?t[0].length:0,d=null!=o?o:f;for(let o=0;o<h;o++)for(let h=0;h<f;h++){var g;let f=t[o][h];if(f===n.nb.VOID)continue;if(f===n.nb.WALL||!u){if(f===n.nb.WALL){let t=o*d+h,l=null==a?void 0:a[t];e.fillStyle=l?(0,v.og)(l):C.ty}else e.fillStyle=c.q3;e.fillRect(l+h*s,r+o*s,s,s);continue}let m=o*d+h,b=null!=(g=null==a?void 0:a[m])?g:{h:0,s:0,b:0,c:0},p=(0,C.To)(f,b),w=(0,y.k)(p,i);e.drawImage(w,l+h*s,r+o*s)}}(e,r,S,k,o,g,b);let E=(0,v.BN)()?(0,v.vb)(r,g,b):[];return!function(e,t,l,r,i,a,o,s){let h=[];for(let e of t){let t=(0,y.k)(e.sprite,a),l=r+e.x*a,n=i+e.y*a;h.push({zY:e.zY,draw:e=>{e.drawImage(t,l,n)}})}for(let e of l){let t=(0,x.Ih)(e.palette,e.hueShift),l=function(e,t){switch(e.state){case n.Lp.TYPE:var l;if((l=e.currentTool)&&u.has(l))return t.reading[e.dir][e.frame%2];return t.typing[e.dir][e.frame%2];case n.Lp.WALK:return t.walk[e.dir][e.frame%4];case n.Lp.IDLE:default:return t.walk[e.dir][1]}}(e,t),f=(0,y.k)(l,a),d=e.state===n.Lp.TYPE?c.iE:0,g=Math.round(r+e.x*a-f.width/2),b=Math.round(i+(e.y+d)*a-f.height),p=e.y+n.dn/2+c.Sg;if(e.matrixEffect){let t=e;h.push({zY:p,draw:e=>{!function(e,t,l,r,i,a){let o=t.matrixEffectTimer/n.Pz,s="spawn"===t.matrixEffect,u=t.matrixEffectTimer,h=c.wN+c.M1;for(let n=0;n<c.W3;n++){var f,d;let g=Math.max(0,Math.min(1,(o-(null!=(f=t.matrixEffectSeeds[n])?f:0)*c.hI)/(1-c.hI)))*h;for(let t=0;t<c.wN;t++){let o=null==(d=l[t])?void 0:d[n],h=o&&""!==o,f=g-t,b=r+n*a,p=i+t*a;if(s)if(f<0)continue;else if(f<1)e.fillStyle=c.zw,e.fillRect(b,p,a,a);else if(f<c.M1){let l=f/c.M1;if(h){e.fillStyle=o,e.fillRect(b,p,a,a);let r=(1-l)*c.Nd;m(n,t,u)&&(e.fillStyle="rgba(0, 255, 65, ".concat(r,")"),e.fillRect(b,p,a,a))}else if(m(n,t,u)){let t=(1-l)*c.gi;e.fillStyle=l<c.Wn?"rgba(0, 255, 65, ".concat(t,")"):l<c.WJ?"rgba(0, 170, 40, ".concat(t,")"):"rgba(0, 85, 20, ".concat(t,")"),e.fillRect(b,p,a,a)}}else h&&(e.fillStyle=o,e.fillRect(b,p,a,a));else if(f<0)h&&(e.fillStyle=o,e.fillRect(b,p,a,a));else if(f<1)e.fillStyle=c.zw,e.fillRect(b,p,a,a);else if(f<c.M1&&m(n,t,u)){let t=f/c.M1,l=(1-t)*c.gi;e.fillStyle=t<c.Wn?"rgba(0, 255, 65, ".concat(l,")"):t<c.WJ?"rgba(0, 170, 40, ".concat(l,")"):"rgba(0, 85, 20, ".concat(l,")"),e.fillRect(b,p,a,a)}}}}(e,t,l,g,b,a)}});continue}let w=null!==o&&e.id===o,T=null!==s&&e.id===s;if(w||T){let e=w?c.O1:c.y9,t=(0,y.Y)(l),r=(0,y.k)(t,a),i=g-a,n=b-a;h.push({zY:p-c.F2,draw:t=>{t.save(),t.globalAlpha=e,t.drawImage(r,i,n),t.restore()}})}h.push({zY:p,draw:e=>{e.drawImage(f,g,b)}})}for(let t of(h.sort((e,t)=>e.zY-t.zY),h))t.draw(e)}(e,E.length>0?[...E,...i]:i,a,S,k,o,f,d),!function(e,t,l,r,i){let a=Math.max(1,Math.round(i));for(let s of t){var o;if(!s.label||"despawn"===s.matrixEffect)continue;let t=Math.max(6,Math.round(3.5*i));e.save(),e.imageSmoothingEnabled=!1,e.font="bold ".concat(t,"px monospace");let u=Math.ceil(e.measureText(s.label).width),h=2*a,f=+a,d=u+2*h,g=t+2*f,m=s.state===n.Lp.TYPE?c.PA:0,b=Math.round(l+s.x*i-d/2),p=Math.round(r+(s.y+m-26)*i-g),w=null!=(o=s.labelColor)?o:"#8a7a6a";e.fillStyle="#222",e.fillRect(b-a,p,d+2*a,g+a),e.fillRect(b,p-a,d,g+2*a),e.fillStyle=w,e.fillRect(b,p,d,g),e.fillStyle="#fff",e.textBaseline="top",e.fillText(s.label,b+h,p+f),e.restore()}}(e,a,S,k,o),!function(e,t,l,r,i){for(let a of t){if(!a.bubbleType)continue;let t="permission"===a.bubbleType?x.$D:"working"===a.bubbleType?x.j9:x.VQ,o=1;"waiting"===a.bubbleType&&a.bubbleTimer<c.v3&&(o=a.bubbleTimer/c.v3);let s=(0,y.k)(t,i),u=a.state===n.Lp.TYPE?c.PA:0,h=Math.round(l+a.x*i-s.width/2),f=Math.round(r+(a.y+u-c.$L)*i-s.height-i);e.save(),o<1&&(e.globalAlpha=o),e.drawImage(s,h,f),e.restore()}}(e,a,S,k,o),!function(e,t,l,r,i){let a=Math.max(1,Math.round(i));for(let o of t){if(!o.speechText)continue;let t=1;if(o.speechTimer<c.nW&&(t=Math.max(0,o.speechTimer/c.nW)),t<=0)continue;let s=Math.max(7,Math.round(4.5*i));e.save(),e.imageSmoothingEnabled=!1,e.font="".concat(s,"px monospace");let u=Math.ceil(e.measureText(o.speechText).width),h=3*a,f=2*a,d=u+2*h,g=s+2*f,m=3*a,b=o.state===n.Lp.TYPE?c.PA:0,p=Math.round(l+o.x*i-d/2),w=Math.round(r+(o.y+b-c.$L)*i-g-m-4*a);t<1&&(e.globalAlpha=t),e.fillStyle="#333",e.fillRect(p-a,w,d+2*a,g+a),e.fillRect(p,w-a,d,g+2*a),e.fillStyle="#fff",e.fillRect(p,w,d,g);let T=Math.round(p+d/2);e.fillStyle="#333",e.fillRect(T-2*a,w+g,4*a,a),e.fillRect(T-a,w+g+a,2*a,a),e.fillRect(T,w+g+2*a,a,a),e.fillStyle="#fff",e.fillRect(T-a,w+g,2*a,a),e.fillRect(T,w+g+a,a,a),e.fillStyle="#222",e.textBaseline="top",e.fillText(o.speechText,p+h,w+f),e.restore()}}(e,a,S,k,o),w&&(w.showGrid&&function(e,t,l,r,i,a,o){let s=n.dn*r;e.strokeStyle=c.AL,e.lineWidth=1,e.beginPath();for(let r=0;r<=i;r++){let i=t+r*s+.5;e.moveTo(i,l),e.lineTo(i,l+a*s)}for(let r=0;r<=a;r++){let n=l+r*s+.5;e.moveTo(t,n),e.lineTo(t+i*s,n)}if(e.stroke(),o){e.save(),e.strokeStyle=c.fJ,e.lineWidth=1,e.setLineDash(c.i);for(let r=0;r<a;r++)for(let a=0;a<i;a++){var u;(null==(u=o[r])?void 0:u[a])===n.nb.VOID&&e.strokeRect(t+a*s+.5,l+r*s+.5,s-1,s-1)}e.restore()}}(e,S,k,o,T,I,r),w.showGhostBorder&&function(e,t,l,r,i,a,o,s){let u=n.dn*r;e.save();let h=[];for(let e=-1;e<=i;e++)h.push({c:e,r:-1}),h.push({c:e,r:a});for(let e=0;e<a;e++)h.push({c:-1,r:e}),h.push({c:i,r:e});for(let{c:r,r:i}of h){let n=t+r*u,a=l+i*u,h=r===o&&i===s;h&&(e.fillStyle=c.Mo,e.fillRect(n,a,u,u)),e.strokeStyle=h?c.pr:c.gD,e.lineWidth=1,e.setLineDash(c.i),e.strokeRect(n+.5,a+.5,u-1,u-1)}e.restore()}(e,S,k,o,T,I,w.ghostBorderHoverCol,w.ghostBorderHoverRow),w.ghostSprite&&w.ghostCol>=0&&function(e,t,l,r,i,a,o,s){let u=(0,y.k)(t,s),h=a+l*n.dn*s,f=o+r*n.dn*s;e.save(),e.globalAlpha=c.qD,e.drawImage(u,h,f),e.globalAlpha=c.W7,e.fillStyle=i?c.TE:c.oj,e.fillRect(h,f,u.width,u.height),e.restore()}(e,w.ghostSprite,w.ghostCol,w.ghostRow,w.ghostValid,S,k,o),w.hasSelection?(!function(e,t,l,r,i,a,o,s){let u=n.dn*s;e.save(),e.strokeStyle=c.Ii,e.lineWidth=2,e.setLineDash(c.n6),e.strokeRect(a+t*u+1,o+l*u+1,r*u-2,i*u-2),e.restore()}(e,w.selectedCol,w.selectedRow,w.selectedW,w.selectedH,S,k,o),w.deleteButtonBounds=function(e,t,l,r,i,a,o,s){let u=n.dn*s,h=a+(t+r)*u+1,f=o+l*u-1,d=Math.max(c.l0,s*c.YX);e.save(),e.beginPath(),e.arc(h,f,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(h-g,f-g),e.lineTo(h+g,f+g),e.moveTo(h+g,f-g),e.lineTo(h-g,f+g),e.stroke(),e.restore(),{cx:h,cy:f,radius:d}}(e,w.selectedCol,w.selectedRow,w.selectedW,w.selectedH,S,k,o),w.isRotatable?w.rotateButtonBounds=function(e,t,l,r,i,a,o,s){let u=n.dn*s,h=Math.max(c.l0,s*c.YX),f=a+t*u-1,d=o+l*u-1;e.save(),e.beginPath(),e.arc(f,d,h,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=h*c.R_;e.beginPath(),e.arc(f,d,g,-(.8*Math.PI),.7*Math.PI),e.stroke();let m=.7*Math.PI,b=f+g*Math.cos(m),p=d+g*Math.sin(m),w=.35*h;return e.beginPath(),e.moveTo(b+.6*w,p-.3*w),e.lineTo(b,p),e.lineTo(b+.7*w,p+.5*w),e.stroke(),e.restore(),{cx:f,cy:d,radius:h}}(e,w.selectedCol,w.selectedRow,w.selectedW,w.selectedH,S,k,o):w.rotateButtonBounds=null):(w.deleteButtonBounds=null,w.rotateButtonBounds=null)),{offsetX:S,offsetY:k}}(e,a,s,r.tileMap,r.furniture,r.getCharacters(),h,f.x,f.y,r.getSelectedCharId(),r.getHoveredCharId(),r.layout.tileColors,r.layout.cols,r.layout.rows,t),z.current=null!=t?t:null}}),s=new R(r,a);return t(s),()=>{s.dispose(),k.current=null,window.removeEventListener("resize",N)}},[Y,N,k,P,L,o,t]);let V=(0,i.useCallback)((e,t)=>{let l=A.current;if(!l)return{x:0,y:0};let r=l.getBoundingClientRect(),i=P.current,{offsetX:n,offsetY:a}=U.current;return{x:(e-r.left-n)/i,y:(t-r.top-a)/i}},[P]),_=(0,i.useCallback)((e,t)=>({col:Math.floor(e/c.dn),row:Math.floor(t/c.dn)}),[]),j=(0,i.useCallback)((e,t)=>{let l=V(e,t);return _(l.x,l.y)},[V,_]),q=(0,i.useCallback)(e=>{if(X.current=!0,O.current={x:e.clientX,y:e.clientY,panX:L.current.x,panY:L.current.y},D.current&&o.current.selectedFurnitureUid){var t;let l=j(e.clientX,e.clientY),r=null==(t=k.current)?void 0:t.layout;if(r){let e=(0,M.iH)(r,l.col,l.row);e&&e.uid===o.current.selectedFurnitureUid&&(null==d||d(l.col,l.row))}}},[L,o,k,j,d]),G=(0,i.useCallback)(e=>{let t=k.current;if(t&&!D.current){let l=V(e.clientX,e.clientY);t.setHoveredCharAtPixel(l.x,l.y)}if(D.current){let t=j(e.clientX,e.clientY);o.current.dragUid?null==g||g(t.col,t.row):null==f||f(t.col,t.row)}if(!X.current||o.current.dragUid)return;let l=e.clientX-O.current.x,r=e.clientY-O.current.y;L.current={x:O.current.panX+l,y:O.current.panY+r}},[V,j,k,L,o,g,f]),K=(0,i.useCallback)(e=>{let t=X.current;if(X.current=!1,o.current.dragUid){let t=j(e.clientX,e.clientY);null==b||b(t.col,t.row);return}let l=Math.abs(e.clientX-O.current.x),r=Math.abs(e.clientY-O.current.y);if(t&&(l>5||r>5))return;let i=k.current;if(!i)return;if(D.current){let t=z.current;if(t){let l=A.current;if(l){let r=l.getBoundingClientRect(),i=e.clientX-r.left,n=e.clientY-r.top;if(t.deleteButtonBounds){let{cx:e,cy:l,radius:r}=t.deleteButtonBounds;if(Math.sqrt((i-e)**2+(n-l)**2)<=r){null==p||p();return}}if(t.rotateButtonBounds){let{cx:e,cy:l,radius:r}=t.rotateButtonBounds;if(Math.sqrt((i-e)**2+(n-l)**2)<=r){null==S||S();return}}}}let l=j(e.clientX,e.clientY);null==s||s(l.col,l.row);return}let n=V(e.clientX,e.clientY),a=i.getAgentAtPixel(n.x,n.y);a&&W.current(a)},[V,j,k,o,s,b,p,S]),J=(0,i.useCallback)(e=>{if(!D.current)return;e.preventDefault();let t=j(e.clientX,e.clientY);null==h||h(t.col,t.row)},[j,h]),Z=(0,i.useCallback)(e=>{},[]),$=(0,i.useRef)([]),Q=(0,i.useRef)(0),ee=(0,i.useCallback)(e=>{if($.current=Array.from(e.touches),2===e.touches.length){let t=e.touches[0].clientX-e.touches[1].clientX,l=e.touches[0].clientY-e.touches[1].clientY;Q.current=Math.sqrt(t*t+l*l)}else 1===e.touches.length&&(X.current=!0,O.current={x:e.touches[0].clientX,y:e.touches[0].clientY,panX:L.current.x,panY:L.current.y})},[L]),et=(0,i.useCallback)(e=>{if(2===e.touches.length){let t=e.touches[0].clientX-e.touches[1].clientX,l=e.touches[0].clientY-e.touches[1].clientY,r=Math.sqrt(t*t+l*l),i=r-Q.current;Math.abs(i)>20&&(P.current=Math.max(c.DH,Math.min(c.ZV,P.current+(i>0?1:-1))),Q.current=r)}else if(1===e.touches.length&&X.current){let t=e.touches[0].clientX-O.current.x,l=e.touches[0].clientY-O.current.y;L.current={x:O.current.panX+t,y:O.current.panY+l}}},[P,L]),el=(0,i.useCallback)(e=>{if(0===e.touches.length&&1===$.current.length){let e=$.current[0],t=Math.abs(e.clientX-O.current.x),l=Math.abs(e.clientY-O.current.y);if(t<10&&l<10)if(D.current){let t=j(e.clientX,e.clientY);null==s||s(t.col,t.row)}else{let t=k.current;if(t){let l=V(e.clientX,e.clientY),r=t.getAgentAtPixel(l.x,l.y);r&&W.current(r)}}}X.current=!1,$.current=Array.from(e.touches)},[V,j,k,s]),er=a?o.current.activeTool===n.VF.ERASE?"crosshair":o.current.activeTool===n.VF.EYEDROPPER?"copy":o.current.activeTool===n.VF.FURNITURE_PLACE?"cell":o.current.dragUid?"grabbing":"default":"grab";return(0,r.jsxs)("div",{style:{width:"100%",height:"100%",overflow:"hidden",backgroundColor:"#12121f"},children:[!Y&&(0,r.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,r.jsx)("canvas",{ref:A,onPointerDown:q,onPointerMove:G,onPointerUp:K,onContextMenu:J,onWheel:Z,onTouchStart:ee,onTouchMove:et,onTouchEnd:el,style:{display:"block",width:"100%",height:"100%",touchAction:"none",cursor:er}})]})}},5702:(e,t,l)=>{l.d(t,{Y:()=>n,k:()=>a});let r=new Map,i=new WeakMap;function n(e){let t=i.get(e);if(t)return t;let l=e.length,r=e[0].length,n=[];for(let e=0;e<l+2;e++)n.push(Array(r+2).fill(""));for(let t=0;t<l;t++)for(let l=0;l<r;l++){if(""===e[t][l])continue;let r=t+1,i=l+1;""===n[r-1][i]&&(n[r-1][i]="#FFFFFF"),""===n[r+1][i]&&(n[r+1][i]="#FFFFFF"),""===n[r][i-1]&&(n[r][i-1]="#FFFFFF"),""===n[r][i+1]&&(n[r][i+1]="#FFFFFF")}for(let t=0;t<l;t++)for(let l=0;l<r;l++)""!==e[t][l]&&(n[t+1][l+1]="");return i.set(e,n),n}function a(e,t){let l=r.get(t);l||(l=new WeakMap,r.set(t,l));let i=l.get(e);if(i)return i;let n=e.length,a=e[0].length,o=document.createElement("canvas");o.width=a*t,o.height=n*t;let s=o.getContext("2d");s.imageSmoothingEnabled=!1;for(let l=0;l<n;l++)for(let r=0;r<a;r++){let i=e[l][r];""!==i&&(s.fillStyle=i,s.fillRect(r*t,l*t,t,t))}return l.set(e,o),o}}}]);
|