@ragtechdev/pixel-sprites 0.0.0-stage → 0.9.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/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RAGTECH PTE. LTD. (Singapore UEN 202602756N)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This licence covers the source code. The pixel-art assets listed in
26
+ LICENSE-ART.md are licensed separately under CC BY 4.0.
package/LICENSE-ART.md ADDED
@@ -0,0 +1,25 @@
1
+ # Art licence
2
+
3
+ The pixel-art assets in this repository are © 2026 RAGTECH PTE. LTD., a company registered in Singapore (UEN 202602756N), and are licensed under the
4
+ [Creative Commons Attribution 4.0 International licence (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
5
+ Full legal text: https://creativecommons.org/licenses/by/4.0/legalcode
6
+
7
+ ## What counts as art
8
+
9
+ - Avatar masks: `src/avatar/masks/**`
10
+ - World masks (terrain tiles and object parts): `src/world/masks/**`
11
+ - Block layouts: `src/world/tilesets/**`
12
+ - Interface icons: `src/icons/**/*.mask.ts`
13
+ - Images rendered from the art: `docs/images/**`
14
+
15
+ Everything else, including the palette tables, style tables, rendering code, build scripts and tests, is source code under the MIT licence in [LICENSE](LICENSE).
16
+
17
+ ## Attribution
18
+
19
+ If you redistribute the art or anything rendered from it, credit it like this:
20
+
21
+ > Pixel art from pixel-sprites by RAGTECH PTE. LTD., licensed under CC BY 4.0.
22
+
23
+ ## Origin
24
+
25
+ Masks are created by the maintainers and contributors, some with the help of coding agents, and are reviewed before they are merged.
package/README.md CHANGED
@@ -1,3 +1,253 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="docs/images/banner.png" alt="Pixel avatars walking through a small village: cottages, a pond, trees and a path" width="100%">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ # ragTech's Pixel Sprites
6
+
7
+ Hi, we're **ragTech**: three engineers who care about humane, responsible technology. We're building [Willage](https://ragtechdev.com/willage), a safety-first creator platform for iOS, Android and the web, and this library is the pixel art that grows out of it.
8
+
9
+ We love the early days of computing, when programmers made wonderful things inside tiny limits: a few kilobytes, a handful of colours, no room to waste. That way of thinking shaped everything here. Art is drawn as small text masks, shading is worked out by code, and colours come from fixed palettes. The result is light, sustainable and bloat-free.
10
+
11
+ We also know many of you build with coding agents now. One of our principles is that we don't generate image or video content, because it costs a lot of compute. We make things in code instead. So we hope you'll point your coding agent at this library whenever it needs game-like assets: avatars, icons, tiles and little worlds that render crisply on the web, at a fraction of the resources.
12
+
13
+ Today it works on the web (canvas, SVG and React)! Android and iOS are on our list for later...so stay tuned!
14
+
15
+ <p align="center"><img src="docs/images/icons.svg" alt="Every icon in the library" width="100%"></p>
16
+
17
+ ## What's inside (and how small they are!)
18
+
19
+ <!-- stats:start -->
20
+ <!-- counts: {"icons":23,"tiles":33,"objects":8,"avatarVariations":1537258466304,"avatarOptions":{"head orientation":4,"skin tone":6,"front hair":3,"hair length":6,"hair texture":4,"hair drape":3,"hair accessory":4,"back hair":11,"hair colour":9,"eye colour":6,"clothing":671,"shoes":31,"arm pose":3,"leg pose":2}} -->
21
+ Generated by `pnpm stats`. Sizes are minified and gzipped, for an app that imports only that part.
22
+
23
+ | Part | How many | Bundled size |
24
+ | --- | --- | --- |
25
+ | Icons | 23 | 11.33 KB |
26
+ | Tiles | 33 | 10.90 KB |
27
+ | Objects | 8 | 11.61 KB |
28
+ | Avatars | up to 1,537,258,466,304 variations | 12.99 KB |
29
+ | Everything (core entry) | | 18.73 KB |
30
+ | Canvas helper | | 0.44 KB |
31
+ | React components | | 18.67 KB |
32
+
33
+ <!-- stats:end -->
34
+ Since you only use the parts you import, we think this is one of the smallest icon libraries you can find, and the avatars, tiles and objects are just as light!
35
+
36
+ <p align="center"><img src="docs/images/avatars.svg" alt="Seven avatars with different hair, skin, clothes and poses" width="60%"></p>
37
+
38
+ ## Browse it in the studio
39
+
40
+ The studio is a small site for browsing every icon, tile, object, avatar and world: search, preview at 8x8 and 16x16 and in 1 or 2-bit colour, then copy the code or download an SVG or PNG. Run it locally:
41
+
42
+ ```sh
43
+ pnpm install
44
+ pnpm dev # opens the studio
45
+ pnpm build:studio # static site in studio/dist
46
+ ```
47
+
48
+ It is published to GitHub Pages by `.github/workflows/studio.yml`.
49
+
50
+ ## Install
51
+
52
+ ```sh
53
+ npm install @ragtechdev/pixel-sprites
54
+ ```
55
+
56
+ ## Use it
57
+
58
+ Everything you build is a `Raster`: a small grid of pixels you can show as an `<img>`, a CSS background, inline SVG or a React component. In React, `<Icon>`, `<Avatar>`, `<Tile>`, `<WorldObject>` and `<World>` take ids and options, and `<PixelImage>` draws any `Raster` you have built yourself.
59
+
60
+ ### Icons
61
+
62
+ <img src="docs/images/example-icon.svg" alt="The heart icon" height="52">
63
+
64
+ **As an image**
65
+
66
+ ```ts
67
+ import { buildIcon, toSvgDataUrl } from "@ragtechdev/pixel-sprites";
68
+
69
+ img.src = toSvgDataUrl(buildIcon("heart"), 4); // 4 screen pixels per icon pixel
70
+ ```
71
+
72
+ **In React**
73
+
74
+ ```tsx
75
+ import { Icon } from "@ragtechdev/pixel-sprites/react";
76
+
77
+ <Icon id="heart" pixelSize={4} title="Like" />
78
+ ```
79
+
80
+ **Idle look**
81
+
82
+ Some icons (`idleIconIds` lists them) have a faded look for something that is off or not the current page. It is an option, not a separate icon: `<Icon id="cottage" idle />` or `buildIcon("cottage", { idle: true })`. Icons without one ignore it.
83
+
84
+ **In CSS**
85
+
86
+ ```ts
87
+ import { buildIcon, toSvgDataUrl } from "@ragtechdev/pixel-sprites";
88
+
89
+ document.documentElement.style.setProperty("--icon-heart", `url("${toSvgDataUrl(buildIcon("heart"), 2)}")`);
90
+ ```
91
+
92
+ ```css
93
+ .like::before {
94
+ content: "";
95
+ display: inline-block;
96
+ width: 30px;
97
+ height: 26px;
98
+ margin-right: 6px;
99
+ background: var(--icon-heart) no-repeat center / contain;
100
+ }
101
+ ```
102
+
103
+ **Inline, next to text**
104
+
105
+ ```ts
106
+ import { buildIcon, toSvg } from "@ragtechdev/pixel-sprites";
107
+
108
+ button.innerHTML = `${toSvg(buildIcon("heart"), 2)} Like`; // an <svg> in the page, no extra request
109
+ ```
110
+
111
+ ```tsx
112
+ <button style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
113
+ <Icon id="heart" pixelSize={2} /> Like
114
+ </button>
115
+ ```
116
+
117
+ ### Avatars
118
+
119
+ <img src="docs/images/example-avatar.svg" alt="An avatar with medium skin, black hair and a shirt" height="96">
120
+
121
+ **In React**
122
+
123
+ ```tsx
124
+ import { Avatar } from "@ragtechdev/pixel-sprites/react";
125
+
126
+ <Avatar skinTone="medium" hairColor="black" topStyle="shirt" pixelSize={4} />
127
+ ```
128
+
129
+ **In CSS**
130
+
131
+ ```ts
132
+ import { buildAvatar, toSvgDataUrl } from "@ragtechdev/pixel-sprites";
133
+
134
+ const avatar = buildAvatar({ skinTone: "medium", hairColor: "black", topStyle: "shirt" });
135
+ profile.style.backgroundImage = `url("${toSvgDataUrl(avatar, 4)}")`;
136
+ ```
137
+
138
+ ```css
139
+ .profile {
140
+ width: 64px;
141
+ height: 96px;
142
+ background: no-repeat center / contain;
143
+ }
144
+ ```
145
+
146
+ ### Worlds
147
+
148
+ <img src="docs/images/example-world.svg" alt="A small autumn world: a tree on grass, a pond and a path" height="192">
149
+
150
+ **On a canvas**
151
+
152
+ ```ts
153
+ import { buildMap, defineMap, townTileset } from "@ragtechdev/pixel-sprites";
154
+ import { drawRaster } from "@ragtechdev/pixel-sprites/canvas";
155
+
156
+ const map = defineMap(townTileset, ["gggg", "gwwg", "pppp"], [{ id: "tree", x: 0, y: 0 }]);
157
+ drawRaster(ctx, buildMap(map, "autumn"), 0, 0, 2); // themes: spring, summer (the default), autumn, winter. Trees and flowers change with it.
158
+ ```
159
+
160
+ **In React**
161
+
162
+ ```tsx
163
+ import { defineMap, townTileset } from "@ragtechdev/pixel-sprites";
164
+ import { World, WorldObject } from "@ragtechdev/pixel-sprites/react";
165
+
166
+ const map = defineMap(townTileset, ["gggg", "gwwg", "pppp"], [{ id: "tree", x: 0, y: 0 }]);
167
+
168
+ <World map={map} theme="autumn" pixelSize={2} />
169
+ <WorldObject id="tree" pixelSize={4} />
170
+ ```
171
+
172
+ **In CSS**
173
+
174
+ ```ts
175
+ import { buildMap, toSvgDataUrl } from "@ragtechdev/pixel-sprites";
176
+
177
+ hero.style.backgroundImage = `url("${toSvgDataUrl(buildMap(map, "autumn"), 2)}")`;
178
+ ```
179
+
180
+ ```css
181
+ .hero {
182
+ min-height: 192px;
183
+ background: no-repeat bottom left;
184
+ }
185
+ ```
186
+
187
+ <p align="center"><img src="docs/images/themes.svg" alt="The same village in the spring, summer, autumn and winter palettes" width="100%"></p>
188
+
189
+ Everything is picked from built-in tables, so configs are plain data that you can store and cache. Anything unknown falls back to a default. Every item is a `Raster` you can also turn into an SVG string with `toSvg`. The ids to pick from are `iconIds`, `tileIds` and `objectIds`, and the avatar options are the exported tables such as `skinPalettes` and `topStyles`.
190
+
191
+ ### Smaller sizes and fewer colours
192
+
193
+ Every icon, tile, object, avatar and world can also be shown on an 8x8 or 16x16 grid, and with 1 or 2 bits of colour. Pass `size` and `bits` to any component, or call `toVariant` on any `Raster`.
194
+
195
+ ```tsx
196
+ <Icon id="heart" size={8} bits={2} pixelSize={4} />
197
+ <Avatar size={16} bits={2} />
198
+ ```
199
+
200
+ ```ts
201
+ import { buildTile, toVariant } from "@ragtechdev/pixel-sprites";
202
+
203
+ const retro = toVariant(buildTile("grass"), { size: 8, bits: 1 });
204
+ ```
205
+
206
+ - `size` fits the image inside a square of 8 or 16 pixels and centres it. Shapes keep their proportions, so a tall avatar leaves empty space on the sides. Shrinking keeps the most common colour in each block instead of blending, and small images are only enlarged by whole numbers.
207
+ - For `<World>` and `toMapVariant`, `size` is the pixels per tile (8 or 16), not the size of the whole map, so the map keeps its tiles and proportions. 16 is the original.
208
+ - `bits` uses fixed palettes: `1` is black and white and `2` is four greys. Transparent pixels stay transparent. Leave it out for the original colours.
209
+ - `palette` swaps in one of six fixed four-colour palettes (`paletteNames`: `game-boy`, `sepia`, `pastel`, `night`, `autumn-glow`, `mint`) by brightness: each colour takes the palette tone for its own brightness, so a faded image (an idle icon) stays lighter than a normal one. It is applied after `bits`, so `bits: 2, palette: "game-boy"` gives a clean four-tone look. `<Icon id="heart" palette="game-boy" />` or `toVariant(raster, { palette: "sepia" })`. It works on every component, `toVariant` and `toMapVariant`.
210
+ - Any other value is ignored and gives you the original. Leave both out to get the original, with its own grid and its full colours. Every icon is drawn on the same 20x20 canvas (`ICON_SIZE`), so icons line up and share one default size.
211
+
212
+ **Colours**
213
+
214
+ Everything is drawn from fixed palettes, so you pick a colour by name. Avatars have many more presets per part: skin (`fair`, `light`, `tan`, `medium`, `brown`, `deep`), hair (`brown` is brunette, plus `black`, `blonde`, `red`, `auburn`, `grey`, `white`, `pink`, `blue`), eyes (`dark`, `green`, `blue`, `brown`, `hazel`, `grey`) and clothes (ten colours). `clothesColor` colours every piece, and `topColor`, `bottomColor` and `shoeColor` give a single piece a colour of its own (a dress or overalls is a top, `topStyle: "dress"`, that covers the bottom), for example `<Avatar clothesColor="blue" topColor="red" shoeColor="yellow" />`. Icons with a main colour (`colorableIconIds`) and objects with one (`colorableObjectIds`, each with its own list in `objectColors`) take a common colour:
215
+
216
+ ```tsx
217
+ <Avatar skinTone="tan" hairColor="auburn" eyeColor="hazel" clothesColor="teal" />
218
+ <Icon id="heart" color="blue" />
219
+ <WorldObject id="door" color="green" />
220
+ ```
221
+
222
+ `buildIcon("heart", { color: "blue" })` and `buildObject("door", undefined, "green")` do the same without React (the second argument of `buildObject` is the season). Icons, objects and tiles also take any hex colour: `<Icon id="heart" color="#e8873a" />`, `buildObject("door", undefined, "#336699")`. Only `#rgb` and `#rrggbb` are accepted, and the other tones (outline, shadow, highlight) are shaded from it the same way every time. Tiles and maps take a hex colour per group (`grass`, `water`, `path`, `roof`, `pavement`; `tileColorGroups`): `<Tile id="grass" colors={{ grass: "#5fae3c" }} />` or `buildMap(map, "summer", { water: "#2a6f97" })`. Anything that is not a valid hex colour, group or offered name is ignored. Avatars stay on their fixed presets; the studio lets you pick any colour for avatar parts, but only for what it shows and exports.
223
+
224
+ **Using assets together on one surface**
225
+
226
+ Each kind has its own grid: tiles are 16x16, objects cover whole tiles (16x16, 16x32, 32x16 or 32x32), an avatar is 16x24 and every icon is drawn on one 20x20 canvas. On one surface, show them at their original size with one shared `pixelSize`, so every art pixel is the same physical size.
227
+
228
+ ```tsx
229
+ const PX = 4; // one value for the whole surface
230
+
231
+ <Tile id="path" pixelSize={PX} />
232
+ <WorldObject id="door" pixelSize={PX} />
233
+ <Avatar pixelSize={PX} />
234
+ <Icon id="cottage" pixelSize={PX} />
235
+ ```
236
+
237
+ - Tiles, objects and avatars share the 16 pixel tile grid, so they stay in proportion. Icons are 20 pixels, so beside world art they read as interface, not as tile-sized objects.
238
+ - `size` fits each asset into its own box, so the shrink factor differs: a 20 pixel icon at `size={8}` shrinks by 0.4, a tile by 0.5 and an avatar by about 0.33. Mixed kinds at one `size` end up with different effective pixel sizes, so use `size` to pick a tier within one kind, such as all icons at 16x16.
239
+ - `bits` is safe to mix: a 1 or 2-bit palette is the same for every kind.
240
+
241
+ ## For coding agents
242
+
243
+ Tell your agent to use `@ragtechdev/pixel-sprites` for pixel art instead of generating images. It can list what exists with `iconIds`, `tileIds` and `objectIds`, and everything renders from code.
244
+
245
+ ## Contributing
246
+
247
+ We'd love your help! Run `pnpm new` and a friendly wizard scaffolds a new icon, avatar garment, hair style, object or tile. The steps, the art rules and how to request art are in [CONTRIBUTING.md](CONTRIBUTING.md).
248
+
249
+ ## Licence
250
+
251
+ Code is MIT. The pixel art is CC BY 4.0. Both belong to RAGTECH PTE. LTD., a company registered in Singapore (UEN 202602756N). See [LICENSE](LICENSE) and [LICENSE-ART.md](LICENSE-ART.md).
252
+
253
+ If you use the art, please credit it: *Pixel art from pixel-sprites by RAGTECH PTE. LTD., licensed under CC BY 4.0.*
@@ -0,0 +1,10 @@
1
+ import { R as Raster } from './compose-BKsBg6Z_.js';
2
+
3
+ type AnyCanvas = HTMLCanvasElement | OffscreenCanvas;
4
+ type AnyContext = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
5
+ /** Paints a raster once at 1:1 into an (offscreen) canvas; repeated calls reuse it. */
6
+ declare function paintRaster(raster: Raster): AnyCanvas;
7
+ /** Draws a raster with nearest-neighbour scaling. */
8
+ declare function drawRaster(ctx: AnyContext, raster: Raster, x: number, y: number, scale?: number): void;
9
+
10
+ export { drawRaster, paintRaster };
package/dist/canvas.js ADDED
@@ -0,0 +1 @@
1
+ var g=new WeakMap;function C(t){let e=t.slice(1);e.length===3&&(e=e.replace(/./g,"$&$&"));let n=parseInt(e,16);return [n>>16&255,n>>8&255,n&255,255]}function d(t){let e=g.get(t);if(e)return e;let{width:n,height:s,px:o,colors:m}=t,r=typeof OffscreenCanvas<"u"?new OffscreenCanvas(n,s):Object.assign(document.createElement("canvas"),{width:n,height:s}),c=r.getContext("2d"),i=c.createImageData(n,s),f=m.map((a,p)=>p===0?[0,0,0,0]:C(a));for(let a=0;a<o.length;a+=1)i.data.set(f[o[a]],a*4);return c.putImageData(i,0,0),g.set(t,r),r}function u(t,e,n,s,o=1){t.imageSmoothingEnabled=false,t.drawImage(d(e),n,s,e.width*o,e.height*o);}export{u as drawRaster,d as paintRaster};
@@ -0,0 +1,2 @@
1
+ var D1=new WeakMap;function L(e){let o=D1.get(e);return o||(o=e.map(t=>[...t].reverse().join("")),D1.set(e,o)),o}function G0(e){return e[0]?.length??0}function N0(e){return e.length}function La(e,o,t){return t>=0&&t<N0(e)&&o>=0&&o<G0(e)}function N(e,o,t){return La(e,o,t)?e[t][o]==="1":false}function M0(e,o){return `${e},${o}`}function z0(e){let[o,t]=e.split(",").map(Number);return {x:o,y:t}}function e0(e,o){for(let t=0;t<e.length;t+=1){let r=e[t];for(let a=0;a<r.length;a+=1)r[a]==="1"&&o({x:a,y:t});}}var O1=["00011111000","01111111110","11111111111","10111111101"];var j1=["00011111000","01111111110","11111111111","10110001101","11100000111","11000000011"];var U1=["00011111000","01111111110","10011100101","10011000001","11100000001"];var $1=["00011111000","01111111110","11111111111","11111111111","11111111111","11111111111","11111111111","11111111111","01111111110","00000000000"];var G1=["00011111000","00111111100","01111111110","01111111111","01111111100","01111000000","01110000000"];var N1=["00011111000","00111111100","01111111110","01111111100","01111100000","01111000000","01110000000"];var z1=["00011111000","00111111100","01111111110","01111111111","01111111000","01111100000","01111000000"];var Y1=["00001110000","00001110000","00001110000","00001110000","00000100000"];var X1=["00001110000","00001110000","00000100000"];var W1=["00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00000100000"];var V1=["00001110000","00001110000","00001110000","00001110000","00000100000"];var K1=["00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00000100000"];var q1=["00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00000100000"];var Z1=["00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00000100000"];var J1=["00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00001110000","00000100000"];var Y0=["00000010101","00000011111","00000001110","00000000100"];var Q1=["00000001100","00000000110","00000000010"];var ee=["00000001100","00000000110","00000000011","00000000011","00000000010"];var oe=["00000001100","00000000110","00000000011","00000000011","00000000011","00000000011","00000000011","00000000011","00000000010"];var te=["00000001100","00000000110","00000000011","00000000011","00000000011","00000000011","00000000011","00000000011","00000000011","00000000011","00000000011","00000000011","00000000010"];var X0=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","0111111111110"];var re=["00000000000","00000000000","00000000000","11111000000","11111000000","11111000000","11111000000","01110000000"];var o0=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","0111111111110"];var ae=["00000000000","00000000000","00000000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","01110000000"];var ie=["11111111111","11111111111","11111111111","01111111110","00111111100"];var se=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111"];var ne=["0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0011000001100","0011000001100"];var le=["00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00011000000","00011000000"];var pe=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1110000000111","1110000000111"];var me=["00000000000","00000000000","00000000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000"];var ce=["1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111"];var de=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111"];var he=["0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0011000001100","0011000001100","0011000001100","0011000001100"];var fe=["00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00011000000","00011000000","00011000000","00011000000"];var ge=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1110000000111","1110000000111","1110000000111","1110000000111"];var ye=["00000000000","00000000000","00000000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000"];var ke=["1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111"];var xe=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111"];var ue=["0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0000000000000","0011000001100","0011000001100","0011000001100","0011000001100","0011000001100","0011000001100"];var be=["00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00000000000","00011000000","00011000000","00011000000","00011000000","00011000000","00011000000"];var Me=["0000111110000","0011111111100","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1110000000111","1110000000111","1110000000111","1110000000111","1110000000111","1110000000111"];var we=["00000000000","00000000000","00000000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000","11111000000"];var Pe=["1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111"];function Ha(e){return e>=11?[3,2,1]:e>=7?[2,1]:e>=5?[1]:[]}var Se=new Map;function Ce(e,o,t){if(o==="blunt")return e;let r=Se.get(o);r||Se.set(o,r=new WeakMap);let a=r.get(e);if(!a){let s=e.map(i=>[...i]),n=o==="v"?Math.min(t,3):t;for(let i=0;i<Math.min(n,s.length);i+=1){let p=s[s.length-1-i];for(let m of e[e.length-1-i].matchAll(/1+/g)){let c=m.index,h=m[0].length,f=Math.floor((h-1)/2),w=o==="v"?Math.floor(f*(n-i)/n+.5):Ha(h)[i]??0,y=Math.min(w,f);for(let g=0;g<y;g+=1)p[c+g]="0",p[c+h-1-g]="0";}}a=s.map(i=>i.join("")),r.set(e,a);}return a}var W0={bald:1,ear:1,chin:1,shoulder:1,armpit:1,midBack:1};function Ae(e){let o=Object.keys(q0);return e==="bald"||e==="ear"?["looseBlunt"]:e==="chin"?o.filter(t=>t!=="looseV"&&t!=="looseU"):o}var V0={overShoulder:1,behindShoulder:1,overAndBehindShoulder:1},_e=e=>e==="shoulder"||e==="armpit"||e==="midBack",z=1,F=-5,u=(e,o,t,r,a)=>({mask:e,offsetX:o,offsetY:t,placement:r,...a?{blends:a}:{}});function K0(e,o){let t=[u(e,z,F,"front")];return {byOrientation:{front:t,right:[u(o,z,F,"front")],left:[u(L(o),z,F,"front")],back:[u($1,z,F,"front")]},fallback:t}}var Ia=K0(j1,N1),Ra=K0(O1,G1),Da=K0(U1,z1),ve={chin:Q1,shoulder:ee,armpit:oe,midBack:te},B=(e,o,t,r,a)=>({...e,tie:{x:o,y:t,...r?{tilt:r}:{},...a?{under:true}:{}}}),r0="slash",a0="backslash";function H(e,o,t,r,a){return o==="back"?e==="behind"?u(t,r,a,"top",true):u(t,r,a,"behindBody"):e==="behind"?u(t,r,a,"behindBody"):u(t,r,a,"behindHead")}var Y=e=>e==="behindShoulder"?"behind":"over",Oa={chin:{high:Y1,low:X1},shoulder:{high:W1,low:V1},armpit:{high:K1,low:q1},midBack:{high:Z1,low:J1}};function t0(e,o,t,r){if(r==="middle"){if(e==="chin"&&o==="high"){let y=(g,P)=>{let S=g==="back"?u(Y0,P,-7,"top"):u(Y0,P,-7,"behindBody");return [B(S,P+8,g==="front"?-7:g==="back"?-4:-5,g==="right"?r0:g==="left"?a0:void 0,g==="back")]};return {byOrientation:{front:y("front",-2),back:y("back",-2),right:y("right",-7),left:y("left",3)},fallback:y("front",-2)}}let c=Oa[e][o],h=o==="high"?-7:1,f=o==="high"?h:h+1,w=[B(u(c,1,h,"behindBody"),6,f)];return {byOrientation:{front:w,back:[B(u(c,1,h,"top"),6,f,void 0,o==="high")],right:[B(u(c,-4,h,"behindBody"),1,f)],left:[B(u(c,6,h,"behindBody"),11,f)]},fallback:w}}let a=ve[e],s=o==="high"?-3:0,n=o==="high"?4:3,i=r==="right",p=s+2,m=[B(H(Y(t),"front",i?a:L(a),i?n:2-n,s),i?n+9:3-n,p,i?r0:a0)];return {byOrientation:{front:m,back:[B(H(Y(t),"back",i?L(a):a,i?2-n:n,s),i?3-n:n+9,p,i?a0:r0,o==="high")],right:[B(H(Y(t),"right",L(a),-2,s),0,s+1,r0)],left:[B(H(Y(t),"left",a,4,s),12,s+1,a0)]},fallback:m}}function Fe(e,o,t){let r=ve[e],a=o==="high"?-5:0,s=n=>[B(H(Y(t),n,L(r),-2,a),-1,a+2,a0),B(H(Y(t),n,r,4,a),13,a+2,r0)];return {byOrientation:{front:s("front"),back:s("back"),right:[B(H(Y(t),"right",L(r),-2,a),0,a+1,r0)],left:[B(H(Y(t),"left",r,4,a),12,a+1,a0)]},fallback:s("front")}}var ja={ear:{volume:X0,front:X0,side:re},chin:{volume:o0,front:o0,side:ae,back:ie},shoulder:{volume:o0,front:pe,side:me,back:ce,behindFront:se,overStrandFront:ne,sideOverStrand:le},armpit:{volume:o0,front:ge,side:ye,back:ke,behindFront:de,overStrandFront:he,sideOverStrand:fe},midBack:{volume:o0,front:Me,side:we,back:Pe,behindFront:xe,overStrandFront:ue,sideOverStrand:be}},Ua=F+6,$a={ear:0,chin:0,shoulder:2,armpit:4,midBack:6};function w0(e,o,t){let r=ja[e],a=c=>c&&t!=="blunt"?Ce(c,t,$a[e]):c,s={...r,front:a(r.front),side:a(r.side),back:a(r.back),behindFront:a(r.behindFront),overStrandFront:a(r.overStrandFront),sideOverStrand:a(r.sideOverStrand)},n=o==="overAndBehindShoulder",i=c=>{let h=f=>c==="right"?f:L(f);return s.sideOverStrand?n?[H("behind",c,h(s.side),z,F),H("over",c,h(s.sideOverStrand),z,F)]:[H(o==="behindShoulder"?"behind":"over",c,h(s.side),z,F)]:[H("over",c,h(s.side),z,F)]},p=()=>s.behindFront?n?[u(s.behindFront,0,F,"behindBody"),u(s.overStrandFront,0,F,"behindHead")]:[o==="behindShoulder"?u(s.behindFront,0,F,"behindBody"):u(s.front,0,F,"behindHead")]:[u(s.front,0,F,"behindHead")],m=()=>{let c=u(s.volume,0,F,"top",true);return s.behindFront?[c,o==="overShoulder"?u(s.behindFront,0,F,"behindBody"):u(s.back,0,Ua,"top",true)]:[c]};return {byOrientation:{front:p(),right:i("right"),left:i("left"),back:m()},fallback:p()}}var P0={centerPart:Ia,bangs:Ra,sideSwept:Da},Ga=Object.fromEntries(Object.keys(W0).map(e=>{if(e==="bald")return [e,{}];let o=t=>{if(e==="ear"){let r=w0(e,t,"blunt");return {looseBlunt:r,looseV:r,looseU:r,highPonytailRight:r,highPonytailLeft:r,highPonytailMiddle:r,lowPonytailRight:r,lowPonytailLeft:r,lowPonytailMiddle:r,highPigtails:r,lowPigtails:r}}return {looseBlunt:w0(e,t,"blunt"),looseV:w0(e,t,e==="chin"?"blunt":"v"),looseU:w0(e,t,e==="chin"?"blunt":"u"),highPonytailRight:t0(e,"high",t,"right"),highPonytailLeft:t0(e,"high",t,"left"),highPonytailMiddle:t0(e,"high",t,"middle"),lowPonytailRight:t0(e,"low",t,"right"),lowPonytailLeft:t0(e,"low",t,"left"),lowPonytailMiddle:t0(e,"low",t,"middle"),highPigtails:Fe(e,"high",t),lowPigtails:Fe(e,"low",t)}};return [e,Object.fromEntries(Object.keys(V0).map(t=>[t,o(t)]))]})),Be=(e,o)=>e!=="bald"&&e!=="ear"&&!S0(o),Ee=e=>e==="highPonytailMiddle"||e==="lowPonytailMiddle",S0=e=>e==="looseBlunt"||e==="looseV"||e==="looseU",q0={looseBlunt:1,looseV:1,looseU:1,highPonytailRight:1,highPonytailLeft:1,highPonytailMiddle:1,lowPonytailRight:1,lowPonytailLeft:1,lowPonytailMiddle:1,highPigtails:1,lowPigtails:1};function Te(e,o,t,r,a){if(t==="bald")return [];let s=P0[e].byOrientation[a]??P0[e].fallback,n=Ga[t][r][o],i=n.byOrientation[a]??n.fallback;return a==="back"?[...s,...i]:[...i,...s]}var C0={front:1,left:1,right:1,back:1};function I(e,o){switch(o){case "left":return L(e.side);case "right":return e.side;case "back":return e.back??e.front;default:return e.front}}var Le=["111111111"];var He=["011111110"];var Ie=["111101111"];var Re=["001111100"];var De=["001111100","001111100","011111110","011111110","011111110","111111111","111111111"];var Oe=["001111100","001111100","001111100","001111100","001111100","011111110","011111110"];var je=["010000010","010000010","010000010","011111110","011111110","011111110","011101110","011101110"];var Ue=["000010000","000010000","000010000","001111100","001111100","001111100","001111100","001111100"];var $e=["000000000","011101110","111101111","111101111"];var Ge=["000000000","001111100","001101100","001101110"];var Ne=["100101001"];var ze=["001001110"];var Ye=["111101111"];var Xe=["001101110"];var We=["0010000000100","0110000000110","1110000000111","1100000000011"];var Ve=["0000011100000","0000011100000","0000011100000","0000001110000"];var Ke=["001111100","011111110","011111110","011111110","011111110","011111110","011111110"];var qe=["001111100","001111100","001111100","001111100","001111100","001111100","001111100"];var Ze=["0010000000100","0110000000110","0110000000110","0000000000000","0000000000000","0000000000000"];var Je=["0000011100000","0000011100000","0000011100000"];var Qe=["001111100","011111110","011111110","011111110","011111110"];var eo=["001111100","001111100","001111100","001111100","001111100"];var oo=["010000010","010000010","011111110","011111110","011111110","011111110","000000000"];var to=["000010000","000010000","001111100","001111100","001111100","001111100","000000000"];function O(e,o,t={}){let r=s=>o.map(({masks:n,...i})=>({...i,mask:I(n,s)})),a=Object.fromEntries(Object.keys(C0).map(s=>[s,r(s)]));return {slot:e,...t,byOrientation:a,fallback:r("front")}}var F0={none:{slot:"top",byOrientation:{},fallback:[]},spaghetti:O("top",[{masks:{front:oo,side:to},offsetX:2,offsetY:6,placement:"overBody"}]),shirt:O("top",[{masks:{front:Qe,side:eo},offsetX:2,offsetY:6,placement:"overBody"},{masks:{front:Ze,side:Je},offsetX:0,offsetY:6,placement:"overArms",armPoses:["down"]}]),longSleeve:O("top",[{masks:{front:Ke,side:qe},offsetX:2,offsetY:6,placement:"overBody"},{masks:{front:We,side:Ve},offsetX:0,offsetY:6,placement:"overArms",armPoses:["down"]}]),overalls:O("top",[{masks:{front:je,side:Ue},offsetX:2,offsetY:6,placement:"overBody"}],{coversBottom:true}),dress:O("top",[{masks:{front:De,side:Oe},offsetX:2,offsetY:6,placement:"overBody"}],{coversBottom:true})},Z0={none:{slot:"bottom",byOrientation:{},fallback:[]},shorts:O("bottom",[{masks:{front:Ie,side:Re},offsetX:2,offsetY:12,placement:"overBody"}]),skirt:O("bottom",[{masks:{front:Le,side:He},offsetX:2,offsetY:12,placement:"overBody"}])},J0={none:{slot:"shoes",byOrientation:{},fallback:[]},boots:O("shoes",[{masks:{front:$e,side:Ge},offsetX:2,offsetY:13,placement:"overlay",legPoses:["neutral","step"]}]),sandals:O("shoes",[{masks:{front:Ne,side:ze},offsetX:2,offsetY:16,placement:"overlay",legPoses:["neutral","step"]}]),shoes:O("shoes",[{masks:{front:Ye,side:Xe},offsetX:2,offsetY:16,placement:"overlay",legPoses:["neutral","step"]}])};var ao={straight:1,wavy:1,curly:1,coiled:1},Q0=2,Na={wavy:[[1,0],[1,0],[0,1],[0,1]],curly:[[1,1],[1,1],[0,0]],coiled:[[2,2],[1,1],[2,2]]},io=e=>e==="straight"?0:Q0,ro=new Map;function so(e,o){if(o==="straight")return e;let t=ro.get(o);t||ro.set(o,t=new WeakMap);let r=t.get(e);if(!r){let a=Na[o];r=e.map((s,n)=>{let i=[..."0".repeat(Q0),...s,..."0".repeat(Q0)],p=i.indexOf("1"),m=i.lastIndexOf("1");if(p<0)return i.join("");let[c,h]=a[n%a.length];for(let f=1;f<=c;f+=1)i[p-f]="1";for(let f=1;f<=h;f+=1)i[m+f]="1";return i.join("")}),t.set(e,r);}return r}var no=["00011","00011","00100","11000","11000"];var lo=["11011","11111","11011"];var po=["001","010","100"];var mo=["111"];var co=["00011","00110","01100","11000"];var ho=["01110","11111"];var fo={none:1,hairtie:1,scrunchie:1,bow:1},go={hairtie:{mask:mo,above:0,tilted:{mask:po,centre:1,up:1},outlined:false},scrunchie:{mask:ho,above:1,tilted:{mask:co,centre:2,up:1},outlined:true},bow:{mask:lo,above:1,tilted:{mask:no,centre:2,up:2},outlined:true}};var e1={fair:{base:"#F7DCC8",shadow:"#DEAC88",highlight:"#FAE3D0",outline:"#7C4F36"},light:{base:"#f2c9a5",shadow:"#d69a6b",highlight:"#ffe1c6",outline:"#7a3f1c"},tan:{base:"#E0AE7F",shadow:"#CA8856",highlight:"#ECC8A4",outline:"#703F22"},medium:{base:"#d39b72",shadow:"#ad6f47",highlight:"#e8b48d",outline:"#603018"},brown:{base:"#9a6038",shadow:"#6f4223",highlight:"#b67a52",outline:"#3d200f"},deep:{base:"#6E4128",shadow:"#63331B",highlight:"#A88670",outline:"#37170B"}},o1={brown:{base:"#7d5337",shadow:"#523220",highlight:"#9c704f",outline:"#2d1a0f"},black:{base:"#2d2f33",shadow:"#15171a",highlight:"#474b51",outline:"#07080a"},blonde:{base:"#d5b269",shadow:"#a88643",highlight:"#e6c882",outline:"#6e5523"},red:{base:"#B8502A",shadow:"#843A1E",highlight:"#CD856A",outline:"#4A2011"},auburn:{base:"#8A3F2A",shadow:"#632D1E",highlight:"#AD796A",outline:"#371911"},grey:{base:"#A8ADB5",shadow:"#797D82",highlight:"#C2C6CB",outline:"#434548"},white:{base:"#E8E6E0",shadow:"#A7A6A1",highlight:"#EFEEE9",outline:"#5D5C5A"},pink:{base:"#E58BB0",shadow:"#A5647F",highlight:"#EDAEC8",outline:"#5C3846"},blue:{base:"#4F7FC4",shadow:"#395B8D",highlight:"#84A5D6",outline:"#20334E"}},t1={dark:{base:"#2f343b",shadow:"#1a1d21",highlight:"#4a5563",outline:"#090b0f"},green:{base:"#3e5d45",shadow:"#24392a",highlight:"#58785f",outline:"#101b13"},blue:{base:"#3f5f89",shadow:"#29405e",highlight:"#5e7ba3",outline:"#132033"},brown:{base:"#6B4528",shadow:"#4D321D",highlight:"#977D69",outline:"#2B1C10"},hazel:{base:"#8A7A3E",shadow:"#63582D",highlight:"#ADA278",outline:"#373119"},grey:{base:"#7C8794",shadow:"#59616B",highlight:"#A3ABB4",outline:"#32363B"}},n0={blue:{base:"#6a7da8",shadow:"#455275",highlight:"#8ea1c9",outline:"#232b40"},red:{base:"#9e5656",shadow:"#713a3a",highlight:"#ba7373",outline:"#3f2020"},green:{base:"#5e815f",shadow:"#3d5b3f",highlight:"#7ea07f",outline:"#1f321f"},yellow:{base:"#D6B24A",shadow:"#9A8035",highlight:"#E2C980",outline:"#56471E"},orange:{base:"#C97A3A",shadow:"#91582A",highlight:"#D9A275",outline:"#503117"},purple:{base:"#7C5FA0",shadow:"#594473",highlight:"#A38FBD",outline:"#322640"},pink:{base:"#C97A98",shadow:"#91586D",highlight:"#D9A2B7",outline:"#50313D"},teal:{base:"#4A8F8C",shadow:"#356765",highlight:"#80B1AF",outline:"#1E3938"},white:{base:"#E8E4DA",shadow:"#A7A49D",highlight:"#EFECE5",outline:"#5D5B57"},grey:{base:"#7E838C",shadow:"#5B5E65",highlight:"#A5A8AF",outline:"#323438"}};var za=[{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:0}];function yo(e){let o=new Set;return e0(e,({x:t,y:r})=>{for(let a of za){let s=t+a.x,n=r+a.y;N(e,s,n)||o.add(M0(s,n));}}),o}function ko(e){let o=new Set;return e0(e,({x:t,y:r})=>{let a=N(e,t,r-1),s=N(e,t-1,r),n=!N(e,t,r+1),i=!N(e,t+1,r);(a||s)&&(n||i)&&o.add(M0(t,r));}),o}function xo(e){let o=new Set;return e0(e,({x:t,y:r})=>{let a=!N(e,t,r-1),s=!N(e,t-1,r);(a||s)&&o.add(M0(t,r));}),o}var C={outline:1,base:2,shadow:3,highlight:4};function j(e){return ["",e.outline,e.base,e.shadow,e.highlight]}function i0(e){let o=G0(e)+2,t=N0(e)+2,r=new Uint8Array(o*t),a=(s,n)=>{for(let i of s){let{x:p,y:m}=z0(i);r[(m+1)*o+p+1]=n;}};return a(yo(e),C.outline),e0(e,({x:s,y:n})=>{r[(n+1)*o+s+1]=C.base;}),a(ko(e),C.shadow),a(xo(e),C.highlight),{width:o,height:t,originX:-1,originY:-1,px:r}}function l0(e,o){let t=e[0]?.length??0,r=e.length,a=new Uint8Array(t*r);return e.forEach((s,n)=>{for(let i=0;i<t;i+=1)a[n*t+i]=o[s[i]]??0;}),{width:t,height:r,originX:0,originY:0,px:a}}function p0(e){if(e.length===0)return {x:0,y:0,width:0,height:0};let o=1/0,t=1/0,r=-1/0,a=-1/0;for(let{sprite:s,x:n,y:i}of e)o=Math.min(o,n+s.originX),t=Math.min(t,i+s.originY),r=Math.max(r,n+s.originX+s.width),a=Math.max(a,i+s.originY+s.height);return {x:o,y:t,width:r-o,height:a-t}}function R(e,o=p0(e)){let{width:t,height:r}=o,a=[""],s=new Map,n=new Uint8Array(t*r);for(let{sprite:i,slots:p,x:m,y:c,noOutlineOver:h,noHighlightOver:f}of e){let w=m+i.originX-o.x,y=c+i.originY-o.y;for(let g=0;g<i.height;g+=1){let P=y+g;if(!(P<0||P>=r))for(let S=0;S<i.width;S+=1){let _=w+S,E=p[i.px[g*i.width+S]];if(!E||_<0||_>=t)continue;let G=i.px[g*i.width+S],$=a[n[P*t+_]];if(h&&G===C.outline&&h.includes($)||f&&G===C.highlight&&f.includes($))continue;let T=s.get(E);T===void 0&&(T=a.length,a.push(E),s.set(E,T)),n[P*t+_]=T;}}}return {width:t,height:r,colors:a,px:n}}function r1(e){return Object.keys(e).filter(o=>e[o]!==void 0).sort().map(o=>`${o}=${e[o]}`).join(";")}function Ya(e=256){let o=new Map;return {get(t,r){if(o.has(t)){let s=o.get(t);return o.delete(t),o.set(t,s),s}let a=r();return o.set(t,a),o.size>e&&o.delete(o.keys().next().value),a},clear(){o.clear();},get size(){return o.size}}}var uo=["0010000000100","0110000000110","1110000000111","1110000000111","1110000000111","0100000000010"];var bo=["0000011100000","0000011100000","0000011100000","0000001110000","0000000111000","0000000011000"];var Mo=["0H000H","010001"];var wo=["H","1"];var Po=["00011111000","01111111110","11111111111","11111111111","11111111111","11111111111","11111111111","11111111111","11111111111","01111111110","00111111100"];var So=["00011111000","00111111100","01111111110","01111111110","01111111110","01111111110","01111111110","01111111110","01111111110","00111111100","00011111000"];var Co=["011101110","011101110","111101111","111101111"];var Fo=["001111100","001111100","001101100","001101100"];var Ao=["011111110","011111110","011111110","111111111","111111111","111111111","111111111"];var _o=["001111100","001111100","001111100","001111100","001111100","001111100","001111100"];var Oo=["topColor","bottomColor","shoeColor","hairAccessoryColor"],m0={headOrientation:"front",skinTone:"light",frontHairStyle:"centerPart",hairLength:"shoulder",hairDrape:"overShoulder",hairTexture:"straight",hairAccessory:"none",backHairStyle:"lowPonytailRight",hairColor:"brown",eyeColor:"dark",clothesColor:"blue",topStyle:"shirt",bottomStyle:"shorts",shoeStyle:"boots",armPose:"down",legPose:"neutral"},Xa={down:1,forward:1,back:1},Wa={neutral:1,step:1},vo={headOrientation:C0,skinTone:e1,frontHairStyle:P0,hairLength:W0,hairDrape:V0,hairTexture:ao,hairAccessory:fo,backHairStyle:q0,hairColor:o1,eyeColor:t1,clothesColor:n0,topStyle:F0,bottomStyle:Z0,shoeStyle:J0,armPose:Xa,legPose:Wa};function i1(e={}){let o={...m0};for(let t of Object.keys(vo)){let r=e[t];typeof r=="string"&&Object.prototype.hasOwnProperty.call(vo[t],r)&&(o[t]=r);}for(let t of Oo){let r=e[t];typeof r=="string"&&r!==o.clothesColor&&Object.prototype.hasOwnProperty.call(n0,r)&&(o[t]=r);}return Ae(o.hairLength).includes(o.backHairStyle)||(o.backHairStyle="looseBlunt"),_e(o.hairLength)||(o.hairDrape=m0.hairDrape),Ee(o.backHairStyle)&&(o.hairDrape=m0.hairDrape),o.hairDrape==="overAndBehindShoulder"&&!S0(o.backHairStyle)&&(o.hairDrape=m0.hairDrape),Be(o.hairLength,o.backHairStyle)||(o.hairAccessory="none"),o.hairAccessory==="none"&&delete o.hairAccessoryColor,o}function Va(e={}){return r1(i1(e))}var Bo=new WeakMap;function jo(e){let o=Bo.get(e);return o||(o=i0(e),Bo.set(e,o)),o}var Eo={outlined:new WeakMap,bare:new WeakMap};function Ka(e,o){let t=o?Eo.outlined:Eo.bare,r=t.get(e);if(!r){let a=jo(e);r={...a,px:a.px.map(s=>s===C.highlight||s===C.shadow?C.base:s===C.outline&&!o?0:s)},t.set(e,r);}return r}var To={front:uo,side:bo},Lo={front:Po,side:So},Ho={front:Co,side:Fo},Io={front:Ao,side:_o},Ro={1:C.base,H:C.highlight},Do={front:l0(Mo,Ro),side:l0(wo,Ro)};function a1(e,o){return e.byOrientation[o]??e.fallback}function qa(e={}){let o=i1(e),t=o.headOrientation,r=j(e1[o.skinTone]),a=j(o1[o.hairColor]),s=j(t1[o.eyeColor]),n=k=>j(n0[k??o.clothesColor]),i=(k,M,K,v)=>({sprite:jo(k),slots:M,x:K,y:v}),p=Te(o.frontHairStyle,o.backHairStyle,o.hairLength,o.hairDrape,t),m=F0[o.topStyle].coversBottom===true,c=(k,M)=>{let K=n(M);return k.map(v=>({...v,slots:K}))},h=[...c(a1(F0[o.topStyle],t),o.topColor),...m?[]:c(a1(Z0[o.bottomStyle],t),o.bottomColor),...c(a1(J0[o.shoeStyle],t),o.shoeColor)],f=k=>h.filter(M=>M.placement===k&&(!M.armPoses||M.armPoses.includes(o.armPose))&&(!M.legPoses||M.legPoses.includes(o.legPose))).map(M=>i(M.mask,M.slots,M.offsetX,M.offsetY)),w=[a[C.base],a[C.shadow],a[C.highlight]],y=k=>({...i(so(k.mask,o.hairTexture),a,k.offsetX-io(o.hairTexture),k.offsetY),...k.blends?{noOutlineOver:w,noHighlightOver:w}:{}}),g=j(n0[o.hairAccessoryColor??o.clothesColor]),P=(k,M,K,v)=>({sprite:Ka(k,M),slots:g,x:K,y:v}),S=k=>{if(o.hairAccessory==="none"||!k.tie)return [];let{mask:M,above:K,tilted:v,outlined:j0}=go[o.hairAccessory],{x:U0,y:$0,tilt:R1}=k.tie;if(R1){let Ta=v.mask[0].length;return R1==="slash"?[P(v.mask,j0,U0-v.centre,$0-v.up)]:[P(L(v.mask),j0,U0-(Ta-1-v.centre),$0-v.up)]}return [P(M,j0,U0-Math.floor(M[0].length/2),$0-K)]},_=k=>k.tie?.under?[...S(k),y(k)]:[y(k),...S(k)],E=k=>p.filter(M=>M.placement===k).flatMap(_),G=i(I(Ho,t),r,2,13),$=i(I(Io,t),r,2,6),T=i(I(To,t),r,0,6),V={...i(I(Lo,t),r,1,-5),...S0(o.backHairStyle)&&o.hairLength!=="bald"?{noOutlineOver:w}:{}},Q=t==="left"||t==="right",va=t==="front"?[{sprite:Do.front,slots:s,x:3,y:1}]:t==="back"?[]:[{sprite:Do.side,slots:s,x:t==="right"?8:4,y:1}],Ba=[...E("behindBody"),...f("behindBody"),G,$,...Q?[]:[T],...f("overBody"),...Q?[T]:[],...f("overArms"),...E("behindHead"),V,...va,...E("front"),...f("overlay"),...E("top")],Ea=p0([i(I(Ho,"front"),r,2,13),i(I(Io,"front"),r,2,6),i(I(To,"front"),r,0,6),i(I(Lo,"front"),r,1,-5),G,$,T,V,...p.flatMap(_),...h.map(k=>i(k.mask,k.slots,k.offsetX,k.offsetY))]);return R(Ba,Ea)}var x=16;var Za=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function q(e){if(typeof e!="string"||!Za.test(e))return;let o=e.slice(1).toLowerCase();return `#${o.length===3?[...o].map(t=>t+t).join(""):o}`}var Ja=e=>[1,3,5].map(o=>parseInt(e.slice(o,o+2),16)),Uo=e=>`#${e.map(o=>Math.round(Math.min(255,Math.max(0,o))).toString(16).padStart(2,"0")).join("")}`;function s0(e){let o=Ja(e),t=r=>Uo(o.map(a=>a*r));return {base:e,shadow:t(.72),highlight:Uo(o.map(r=>r+(255-r)*.3)),outline:t(.4)}}var c0={roadBase:"#726962",roadCurb:"#8A7D78",roadLine:"#FFFFFF",pavementBase:"#E9BFA7",pavementShade:"#C4A090",pavementLight:"#F5D0BA",pavementGrout:"#D4C4B4",brickBase:"#6B4548",brickMortar:"#3E2830",brickLight:"#8C6870",grass:"#8FB36A",grassShade:"#6E9450",grassLight:"#A8C682",water:"#6FA3C7",waterLight:"#A9D0E6",waterShade:"#4F7FA6",wall:"#C9BFB0",wallShade:"#A09585",wallFoundation:"#7C7364",floor:"#D8C8A8",floorLine:"#BFAE8C",path:"#D1B48A",pathShade:"#B8996D",pathLight:"#E3CBA5",roof:"#B0604A",roofShade:"#864637",roofLight:"#CC7E64",roofEdge:"#5E2F28",roofCast:"#A09585",sky:"#BFDDEB",skyLight:"#D3E9F3"},s1=Object.keys(c0),d0={spring:{...c0,grass:"#A6CF72",grassShade:"#84B35A",grassLight:"#C6E49A",water:"#74B3D6",waterLight:"#B5DCEF",waterShade:"#5390B8",path:"#D6BC93",pathShade:"#BDA177",pathLight:"#E8D3B0",sky:"#CFE8F5",skyLight:"#E1F2FA"},summer:c0,autumn:{...c0,grass:"#B59B47",grassShade:"#93803A",grassLight:"#D1BC66",water:"#6A9AA8",waterLight:"#A3C7CE",waterShade:"#4D7886",path:"#C49A64",pathShade:"#A87F4D",pathLight:"#DDB98A",roof:"#8E4B3A",roofShade:"#6B372B",roofLight:"#AD6650",sky:"#EAD7B9",skyLight:"#F3E6CF"},winter:{...c0,grass:"#E4ECEF",grassShade:"#C3D1D8",grassLight:"#FFFFFF",water:"#8DB4CE",waterLight:"#C6DDEA",waterShade:"#6C94B0",path:"#D9D3C7",pathShade:"#B9B1A3",pathLight:"#EFEAE0",roof:"#D8DEE4",roofShade:"#AEB8C2",roofLight:"#FFFFFF",roofEdge:"#5F6B77",sky:"#D5DFE8",skyLight:"#E8EFF5"}},Qa=Object.keys(d0),A0="summer";function Z(e){return e!==void 0&&Object.prototype.hasOwnProperty.call(d0,e)?e:A0}var n1={grass:["grass","grassShade","grassLight"],water:["water","waterShade","waterLight"],path:["path","pathShade","pathLight"],roof:["roof","roofShade","roofLight"],pavement:["pavementBase","pavementShade","pavementLight"]};function h0(e){return e?Object.keys(n1).flatMap(o=>{let t=Object.prototype.hasOwnProperty.call(e,o)?q(e[o]):void 0;return t?[`${o}=${t}`]:[]}).join(","):""}function $o(e,o){if(!o)return e;let t={...e};for(let r of o.split(",")){let[a,s]=r.split("="),{base:n,shadow:i,highlight:p}=s0(s),[m,c,h]=n1[a];t[m]=n,t[c]=i,t[h]=p;}return t}var Go=["0000000100000000","0000000100000000","0000000100000000","0000000100000000","0000000100000000","0000000100000000","0000000100000000","1111111111111111","0001000000001000","0001000000001000","0001000000001000","0001000000001000","0001000000001000","0001000000001000","0001000000001000","1111111111111111"];var No=["0100000001000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0100000001000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"];var zo=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000011000000011","0000111000000111","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0010000000010000","0110000000110000","0000000000000000"];var Yo=["0100000001000000","0000000000000000","0000000000000000","0000000000000000","0100001000001000","0000000000000000","0000000000000000","0000000000000000","0100000001000000","0000000000000000","0000000000000000","0000000000000000","0100001000001000","0000000000000000","0000000000000000","0000000000000000"];var Xo=["0000000100000000","0000000100000000","0000000100000000","1111111111111111","0001000000100000","0001000000100000","0001000000100000","1111111111111111","0000000100000000","0000000100000000","0000000100000000","1111111111111111","0001000000100000","0001000000100000","0001000000100000","1111111111111111"];var Wo=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","1111111111111111"];var Vo=["1111111111111111","1111111111111111","1111111111111111","0000000000000000","0000000000000000"];var Ko=["0000000000000000","0000000000000000","0000000000000000","1111111111111111","0000000000000000"];var qo=["1111111111111111","0000000000000000","0000000000000000","0000000000000000"];var Zo=["0000000000000000","1111111111111111","1111111111111111","0000000000000000"];var Jo=["0000000000000000","0000000000000000","0000000000000000","1111111111111111"];var Qo=["1111111111111111","0000000000000000"];var et=["0000000000000000","1111111111111111"];var ot=["1111111111111111","0000000000000000","0000000000000000","0000000000000000"];var tt=["0000000000000000","1111111111111111","1111111111111111","0000000000000000"];var rt=["0000000000000000","0000000000000000","0000000000000000","1111111111111111"];var at=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1011101110110111"];var it=["1111111111111111","1111111111111111","1111111111111111","1111111111111111","1111111111111111","1111111111111111","0000000000000000","0000000000000000","0000000000000000"];var st=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1111111111111111","0000000000000000"];var nt=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1111111111111111","0000000000000000","0000000000000000"];var lt=["1111111111111111","1111111111111111","1111111111111111","0000000000000000"];var pt=["0000000000000000","0000000000000000","0000000000000000","1111111111111111"];var mt=["1111111111111111","0000000000000000"];var ct=["0000000000000000","1111111111111111"];var dt=["1111111111111111","0000000010000000","0000000010000000","0000000010000000","1111111111111111","0001000000000000","0001000000000000","0001000000000000","1111111111111111","0000000010000000","0000000010000000","0000000010000000","1111111111111111","0001000000000000","0001000000000000","0001000000000000"];var ht=["0000000000000000","0001000000000000","0000000000000000","0000000000000100","0000001000000000","0000000000000000","0000000000000000","0010000000000000","0000000000000000","0000000001000000","0000000000000000","0100000000000000","0000000000000010","0000000000000000","0000000000000000","0000000010000000"];var ft=["0000000000000000","0000000000001000","0000000001000000","0000000000000000","0100000000000000","0000000000000000","0000000001000000","0000000000000100","0000000000000000","0000100000000000","0000000000000000","0000000000000000","0000000100000000","0000000000000000","0010000000010000","0000000000000000"];var gt=["0000000000000000","0010000000000000","0000000000000000","0000000001000000","0000000000000000","0100000000000000","0000000100000000","0000000000001000","0000000000000000","0000000000100000","0000000000000000","0100000000000000","0000000000000000","0000000000010000","0000000000000010","0000000000000000"];var yt=["0000000000000000","0000000000010000","0000000000000000","0000100000000000","0000000000000000","0000000000000100","0000000000000000","0000000000000000","0001000000000000","0000000000000000","0000000000000100","0000000000000000","0000001000000000","0000000000000000","0010000000000000","0000000000000000"];var kt=["0000000000000000","1000000000000001","1000000000000001","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000000001","1000000000000001","0000000000000000"];var xt=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000110000000","0000000110000000","0000000110000000","0000000110000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"];var ut=["0111111101111111","0000000000000000","0000000000000000","0000000000000000","1111011111110111","0000000000000000","0000000000000000","0000000000000000","0111111101111111","0000000000000000","0000000000000000","0000000000000000","1111011111110111","0000000000000000","0000000000000000","0000000000000000"];var bt=["1000000010000000","1000000010000000","1000000010000000","1111111111111111","0000100000001000","0000100000001000","0000100000001000","1111111111111111","1000000010000000","1000000010000000","1000000010000000","1111111111111111","0000100000001000","0000100000001000","0000100000001000","1111111111111111"];var Mt=["0000000000000000","0000000000000000","0001000000000000","0000000000000000","0000000000000000","0000000000100000","0000000000000000","0000000000000000","0000000100000000","0000000000000000","0000000000000000","0000000000000000","0000000000000010","0010000000000000","0000000000000000","0000000000000000"];var wt=["0010000000100000","0010000000100000","0010000000100000","0010000000100000","0000001000000010","0000010000000100","0000010000000100","0000010000000100","0010000000100000","0010000000100000","0010000000100000","0010000000100000","0000001000000010","0000010000000100","0000010000000100","0000010000000100"];var Pt=["0000000000000000","0101000001010000","0101000001010000","1000100010001000","0000000000000000","0000101000001010","0000101000001010","0001000100010001","0000000000000000","0101000001010000","0101000001010000","1000100010001000","0000000000000000","0000101000001010","0000101000001010","0001000100010001"];var St=["1111111111111111","0000000100000001","0000000100000001","0000000100000001","1111111111111111","0001000000010000","0001000000010000","0001000000010000","1111111111111111","0000000100000001","0000000100000001","0000000100000001","1111111111111111","0001000000010000","0001000000010000","0001000000010000"];var Ct=["0000000000000000","0011100000000000","0000000000000000","0000000000011100","0000000000000000","0000000000000000","0000000011100000","0000000000000000","0000000000000000","0111000000000000","0000000000000000","0000000000000000","0000000000001110","0000000000000000","0000000000000000","0000000001110000"];var Ft=["0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0011000000001100","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000011000000","0000000000000000","0000000000000000","0110000000000000","0000000000000000"];var D=(e,...o)=>({base:e,layers:o.map(([t,r])=>({mask:t,color:r}))}),b=(e,o,...t)=>({inner:e,family:o,sides:t}),_0={outer:Vo,shade:Ko,light:Wo},X={order:["light","shade","outer"],profiles:{top:_0,bottom:_0,left:_0,right:_0},paint:{light:"pavementLight",shade:"pavementShade",outer:{tile:"grass"}}},At={edge:Qo,shade:et},W={order:["light","shade","cast","edge"],profiles:{top:{edge:ot,light:tt,shade:rt},bottom:{cast:qo,edge:Zo,shade:Jo},left:At,right:At},paint:{light:"roofLight",shade:"roofShade",cast:"roofCast",edge:"roofEdge"}},_t={foundation:mt,shade:ct},f0={order:["shade","foundation"],profiles:{left:_t,right:_t,bottom:{foundation:lt,shade:pt}},paint:{shade:"wallShade",foundation:"wallFoundation"}},ei={order:["outer","sandShade","sand","foam"],profiles:{top:{outer:it,sandShade:nt,sand:st,foam:at}},paint:{outer:{tile:"grass"},sandShade:"pathShade",sand:"path",foam:"waterLight"}},l1={road:D("roadBase",[kt,"roadCurb"],[xt,"roadLine"]),beige_pavement:D("pavementBase",[zo,"pavementShade"],[No,"pavementLight"],[Go,"pavementGrout"]),brick_pavement:D("brickBase",[Xo,"brickMortar"],[Yo,"brickLight"]),grass:D("grass",[ft,"grassShade"],[ht,"grassLight"]),tall_grass:D("grass",[Pt,"grassShade"],[wt,"grassLight"]),path:D("path",[yt,"pathShade"],[gt,"pathLight"]),water:D("water",[Ct,"waterLight"],[Ft,"waterShade"]),wall:D("wall",[St,"wallShade"]),floor:D("floor",[dt,"floorLine"]),sky:D("sky",[Mt,"skyLight"]),roof:D("roof",[bt,"roofShade"],[ut,"roofLight"]),shore:b("water",ei,"top"),beige_pavement_top:b("beige_pavement",X,"top"),beige_pavement_bottom:b("beige_pavement",X,"bottom"),beige_pavement_left:b("beige_pavement",X,"left"),beige_pavement_right:b("beige_pavement",X,"right"),beige_pavement_top_left:b("beige_pavement",X,"top","left"),beige_pavement_top_right:b("beige_pavement",X,"top","right"),beige_pavement_bottom_left:b("beige_pavement",X,"bottom","left"),beige_pavement_bottom_right:b("beige_pavement",X,"bottom","right"),roof_top_left:b("roof",W,"top","left"),roof_top:b("roof",W,"top"),roof_top_right:b("roof",W,"top","right"),roof_left:b("roof",W,"left"),roof_right:b("roof",W,"right"),roof_bottom_left:b("roof",W,"bottom","left"),roof_bottom:b("roof",W,"bottom"),roof_bottom_right:b("roof",W,"bottom","right"),wall_left:b("wall",f0,"left"),wall_right:b("wall",f0,"right"),wall_base:b("wall",f0,"bottom"),wall_base_left:b("wall",f0,"bottom","left"),wall_base_right:b("wall",f0,"bottom","right")};function vt(e,o,t){if(o.length>t||o.some(r=>r.length!==16))throw new Error(`Tile "${e}": masks must be ${16} wide and at most ${t} rows`)}var Bt=new Map;function v0(e){let o=Bt.get(e);if(o)return o;let t=l1[e];if(!t)throw new Error(`Unknown tile: ${String(e)}`);if("base"in t){let r=Array.from({length:16},()=>Array(16).fill(t.base));for(let{mask:a,color:s}of t.layers)vt(e,a,16),a.forEach((n,i)=>{for(let p=0;p<16;p+=1)n[p]==="1"&&(r[i][p]=s);});o=r;}else {let r=v0(t.inner).map(a=>[...a]);for(let a of t.family.order){let s=t.family.paint[a];for(let n of t.sides){let i=t.family.profiles[n]?.[a];if(i){vt(e,i,16);for(let p=0;p<16;p+=1)for(let m=0;m<16;m+=1){let[c,h]=n==="top"?[p,m]:n==="bottom"?[15-p,m]:n==="left"?[m,p]:[15-m,p];i[c]?.[h]==="1"&&(r[p][m]=typeof s=="string"?s:v0(s.tile)[p][m]);}}}}o=r;}return Bt.set(e,o),o}var p1=Object.keys(l1),oi=new Map(s1.map((e,o)=>[e,o+1])),Et=new Map;function m1(e){let o=Et.get(e);if(!o){let t=v0(e),r=new Uint8Array(256);t.forEach((a,s)=>a.forEach((n,i)=>r[s*16+i]=oi.get(n))),o={width:16,height:16,originX:0,originY:0,px:r},Et.set(e,o);}return o}var Tt=new Map;function c1(e,o){let t=Z(e),r=h0(o),a=`${t}|${r}`,s=Tt.get(a);if(!s){let n=$o(d0[t],r);s=["",...s1.map(i=>n[i])],Tt.set(a,s);}return s}var Lt=new Map;function ti(e,o,t){let r=Z(o),a=h0(t),s=`${r}|${a}:${e}`,n=Lt.get(s);return n||(n=R([{sprite:m1(e),slots:c1(r,t),x:0,y:0}]),Lt.set(s,n)),n}function B0(e,o,t){for(let r of t)if(!p1.includes(r))throw new Error(`Tileset "${e}": unknown tile "${r}" in ${o}`);return new Set(t)}function g0(e){let o=e.blockSize??2;if(!Number.isInteger(o)||o<1)throw new Error(`Tileset "${e.id}": blockSize must be a positive integer`);for(let[t,r]of Object.entries(e.blocks)){if(t.length!==1)throw new Error(`Tileset "${e.id}": block key "${t}" must be one character`);if(r.length!==o||r.some(a=>a.length!==o))throw new Error(`Tileset "${e.id}": block "${t}" must be ${o}\xD7${o}`);for(let a of r)B0(e.id,`block "${t}"`,a);}return Object.freeze({id:e.id,blockSize:o,blocks:e.blocks,solid:B0(e.id,"solid",e.solid??[]),water:B0(e.id,"water",e.water??[]),grass:B0(e.id,"grass",e.grass??[])})}var y0={red:{outline:"#572120",base:"#D9534F",shadow:"#9C3C39",highlight:"#E48784"},orange:{outline:"#5D3617",base:"#E8873A",shadow:"#A7612A",highlight:"#EFAB75"},yellow:{outline:"#5D4F23",base:"#E8C557",shadow:"#A78E3F",highlight:"#EFD689"},green:{outline:"#263E22",base:"#5E9A55",shadow:"#446F3D",highlight:"#8EB888"},teal:{outline:"#193E3E",base:"#3E9C9A",shadow:"#2D706F",highlight:"#78BAB8"},blue:{outline:"#1E2C42",base:"#4A6FA5",shadow:"#355077",highlight:"#809AC0"},purple:{outline:"#372846",base:"#8A63B0",shadow:"#63477F",highlight:"#AD92C8"},pink:{outline:"#5C3846",base:"#E58BB0",shadow:"#A5647F",highlight:"#EDAEC8"},brown:{outline:"#3E2A1C",base:"#9A6A45",shadow:"#6F4C32",highlight:"#B8977D"},grey:{outline:"#383A3D",base:"#8C9099",shadow:"#65686E",highlight:"#AFB1B8"},white:{outline:"#62605E",base:"#F4F1EA",shadow:"#B0AEA8",highlight:"#F7F5F0"}};var E0=["111011101110","111011101110","111011101110","111011101110","111011101110","111011101110"];var Ht=["11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"];var It=["111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111"];var Rt=["111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111","111111111111111111111111111111"];var Dt=["11","11"];var Ot=["011111111110","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111"];var jt=["11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111","11100000000111"];var Ut=["11111111111111","11111111111111","00000000000000","00000000000000","00000000000000","11111111111111","11111111111111"];var T0=["010","111","010"];var $t=["1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111","1111111111111111111111111111"];var Gt=["11111111111111111111","11111111111111111111","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11000000000000000011","11111111111111111111","11111111111111111111"];var Nt=["00000111100000","00011111111000","00111111111100","01111111111110","01111111111110","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","01111111111110","01111111111110","00111111111100","00011111111000","00000111100000"];var zt=["011110","011110","011110","011110","011110","011110","011110","011110","011110","011110","011110","011110","111111","111111"];var Yt=["111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111"];var Xt=["11111111","11111111","11111111","11111111","11111111","11111111"];var d1={tree:[{mask:zt,ramp:"bark",x:5,y:14},{mask:Nt,ramp:"leaf",seasonal:{spring:"leaf_spring",autumn:"leaf_autumn",winter:"leaf_snow"},x:1,y:1}],fence:[{mask:jt,ramp:"wood",x:1,y:2},{mask:Ut,ramp:"wood",x:1,y:4}],door:[{mask:Ot,ramp:"wood",x:2,y:1},{mask:Dt,ramp:"gold",x:10,y:8}],window:[{mask:Yt,ramp:"wood",x:2,y:3},{mask:Xt,ramp:"glass",x:4,y:5}],counter:[{mask:It,ramp:"wood",x:1,y:2},{mask:Rt,ramp:"wood_light",x:1,y:2}],bookshelf:[{mask:Ht,ramp:"wood",x:1,y:1},{mask:E0,ramp:"book_blue",x:2,y:3},{mask:E0,ramp:"book_red",x:2,y:12},{mask:E0,ramp:"book_green",x:2,y:21}],rug:[{mask:$t,ramp:"cloth_red",x:2,y:2},{mask:Gt,ramp:"gold",x:6,y:6}],flower:[{mask:T0,ramp:"flower_red",seasonal:{spring:"flower_pink",autumn:"flower_orange",winter:"flower_frost"},x:3,y:3},{mask:T0,ramp:"flower_yellow",seasonal:{spring:"flower_white",autumn:"flower_rust",winter:"flower_ice"},x:10,y:8},{mask:T0,ramp:"flower_red",seasonal:{spring:"flower_pink",autumn:"flower_orange",winter:"flower_frost"},x:5,y:11}]};var h1={wood:{outline:"#4A2F1D",base:"#A8794E",shadow:"#7A5434",highlight:"#C79A6B"},wood_light:{outline:"#6B4528",base:"#C79A6B",shadow:"#A8794E",highlight:"#E0BC91"},bark:{outline:"#3B2616",base:"#7A5434",shadow:"#5A3C24",highlight:"#9A7048"},leaf:{outline:"#2F4D26",base:"#6E9450",shadow:"#4F7A3E",highlight:"#A8C682"},glass:{outline:"#3F5F70",base:"#9CC7DB",shadow:"#7FAFC6",highlight:"#D6EBF5"},gold:{outline:"#6E5420",base:"#E8C557",shadow:"#C4A23F",highlight:"#F6E39A"},cloth_red:{outline:"#4F1D22",base:"#A8474D",shadow:"#7F3238",highlight:"#C86A70"},book_blue:{outline:"#243A5C",base:"#4A6FA5",shadow:"#375684",highlight:"#7596C8"},book_red:{outline:"#5A2B30",base:"#B2555B",shadow:"#8A3A40",highlight:"#D07A80"},book_green:{outline:"#26402B",base:"#5E8B5A",shadow:"#456B42",highlight:"#85B081"},flower_red:{outline:"#7A2E2A",base:"#D9645B",shadow:"#B54A44",highlight:"#EE8D86"},flower_yellow:{outline:"#7A5E18",base:"#E8C557",shadow:"#C4A23F",highlight:"#F6E39A"},leaf_spring:{outline:"#3A5E2C",base:"#8DC25B",shadow:"#6BA444",highlight:"#BEE58A"},leaf_autumn:{outline:"#6B2E14",base:"#D2762F",shadow:"#A9561F",highlight:"#EDA45C"},leaf_snow:{outline:"#5F7280",base:"#E3ECEE",shadow:"#B9CAD2",highlight:"#FFFFFF"},flower_pink:{outline:"#8A3A5E",base:"#EE8FB5",shadow:"#CC6A93",highlight:"#F8BED5"},flower_white:{outline:"#8A8478",base:"#FFFFFF",shadow:"#E3DCCB",highlight:"#FFFFFF"},flower_orange:{outline:"#7A3A12",base:"#E58A3C",shadow:"#C06A28",highlight:"#F4B070"},flower_rust:{outline:"#5A2B18",base:"#A8553A",shadow:"#84402A",highlight:"#C77A5E"},flower_frost:{outline:"#5F7280",base:"#EEF4F6",shadow:"#C5D6DD",highlight:"#FFFFFF"},flower_ice:{outline:"#4F6E86",base:"#B7D3E4",shadow:"#93B6CD",highlight:"#DCEBF4"}};var U={tree:{width:1,height:2,layer:"standing",footprint:[".","#"]},fence:{width:1,height:1,layer:"standing",footprint:["#"]},door:{width:1,height:1,layer:"standing",footprint:["."],door:true},window:{width:1,height:1,layer:"standing",footprint:["#"]},counter:{width:2,height:1,layer:"standing",footprint:["##"],counter:true},bookshelf:{width:1,height:2,layer:"standing",footprint:["#","#"]},rug:{width:2,height:2,layer:"ground",footprint:["..",".."]},flower:{width:1,height:1,layer:"ground",footprint:["."]}},k0=Object.keys(U),Wt=new WeakMap;function ri(e){let o=Wt.get(e);return o||(o=i0(e.mask),Wt.set(e,o)),o}var L0={tree:["orange","red","yellow","pink","purple"],door:["red","orange","yellow","green","teal","blue","purple","pink","white","grey"],window:["red","orange","yellow","green","teal","blue","purple","pink","white","grey"],fence:["red","orange","yellow","green","teal","blue","purple","pink","white","grey"],bookshelf:["red","orange","yellow","green","teal","blue","purple","pink","white","grey"],rug:["orange","yellow","green","teal","blue","purple","pink","grey"],flower:["orange","pink","purple","blue","white"]},ai={tree:["leaf"],door:["wood"],window:["wood"],fence:["wood"],bookshelf:["wood"],rug:["cloth_red"],flower:["flower_red","flower_yellow"]},ii=k0.filter(e=>L0[e]),Kt=k0.filter(e=>d1[e].some(o=>o.seasonal));function f1(e,o,t,r=A0,a){let s=d1[e];if(!s)throw new Error(`Unknown object: ${String(e)}`);return s.map(n=>({sprite:ri(n),slots:j(a&&ai[e]?.includes(n.ramp)?a.startsWith("#")?s0(a):y0[a]:h1[n.seasonal?.[r]??n.ramp]),x:o+n.x,y:t+n.y}))}var Vt=new Map;function si(e,o,t){let r=Z(o),a=L0[e]&&t?L0[e].includes(t)?t:q(t):void 0,s=a?`${e}:${r}:${a}`:Kt.includes(e)?`${e}:${r}`:e,n=Vt.get(s);if(!n){let{width:i,height:p}=U[e];n=R(f1(e,0,0,r,a),{x:0,y:0,width:i*16,height:p*16}),Vt.set(s,n);}return n}var Zt=new WeakMap;function ni(e,o,t=[]){if(o.length===0)throw new Error("A map needs at least one row");let r=o[0].length;o.forEach((p,m)=>{if(p.length!==r)throw new Error(`Map row ${m} is ${p.length} wide, expected ${r}`);for(let c of p)if(!e.blocks[c])throw new Error(`Map row ${m}: no block "${c}" in tileset "${e.id}"`)});let a=r*e.blockSize,s=o.length*e.blockSize,n={standing:new Map,ground:new Map};for(let p of t){if(!k0.includes(p.id))throw new Error(`Unknown object "${String(p.id)}"`);let m=U[p.id];if(!Number.isInteger(p.x)||!Number.isInteger(p.y)||p.x<0||p.y<0||p.x+m.width>a||p.y+m.height>s)throw new Error(`Object "${p.id}" at (${p.x}, ${p.y}) does not fit in the map`);let c=n[m.layer];for(let h=0;h<m.height;h+=1)for(let f=0;f<m.width;f+=1){let w=(p.y+h)*a+p.x+f;if(c.has(w))throw new Error(`Object "${p.id}" at (${p.x}, ${p.y}) overlaps another ${m.layer} object`);c.set(w,{object:p,mark:m.footprint[h][f]});}}let i=Object.freeze({tileset:e,rows:Object.freeze([...o]),objects:Object.freeze([...t]),width:r,height:o.length});return Zt.set(i,n),i}function g1(e){return {width:e.width*e.tileset.blockSize,height:e.height*e.tileset.blockSize}}function Jt(e,o,t){let r=e.tileset.blockSize;if(!Number.isInteger(o)||!Number.isInteger(t)||o<0||t<0)return;let a=e.rows[Math.floor(t/r)];if(a===void 0)return;let s=a[Math.floor(o/r)];if(s!==void 0)return e.tileset.blocks[s][t%r][o%r]}function li(e,o,t){let r=Jt(e,o,t);if(r===void 0)return;let{solid:a,water:s,grass:n}=e.tileset,i=Zt.get(e),p=t*g1(e).width+o,m=i?.standing.get(p),c=i?.ground.get(p),h=m&&U[m.object.id];return {tile:r,object:(m??c)?.object.id,solid:a.has(r)||m?.mark==="#",water:s.has(r),grass:n.has(r),counter:h?.counter===true,door:h?.door===true}}var qt=new WeakMap;function pi(e,o,t){let r=Z(o),a=h0(t),s=`${r}|${a}`,n=qt.get(e);n||(n=new Map,qt.set(e,n));let i=n.get(s);if(!i){let p=c1(r,t),m=e.tileset.blockSize,c=[];for(let y=0;y<e.height;y+=1)for(let g=0;g<e.width;g+=1){let P=e.tileset.blocks[e.rows[y][g]];for(let S=0;S<m;S+=1)for(let _=0;_<m;_+=1)c.push({sprite:m1(P[S][_]),slots:p,x:(g*m+_)*16,y:(y*m+S)*16});}let h=(y,g)=>+(U[y.id].layer==="standing")-+(U[g.id].layer==="standing")||y.y+U[y.id].height-(g.y+U[g.id].height)||y.x-g.x;for(let y of [...e.objects].sort(h))c.push(...f1(y.id,y.x*16,y.y*16,r));let{width:f,height:w}=g1(e);i=R(c,{x:0,y:0,width:f*16,height:w*16}),n.set(s,i);}return i}var mi=g0({id:"town",blocks:{g:[["grass","grass"],["grass","grass"]],t:[["tall_grass","tall_grass"],["tall_grass","tall_grass"]],p:[["path","path"],["path","path"]],w:[["water","water"],["water","water"]],s:[["shore","shore"],["water","water"]],k:[["sky","sky"],["sky","sky"]],1:[["roof_top_left","roof_top"],["roof_left","roof"]],2:[["roof_top","roof_top"],["roof","roof"]],3:[["roof_top","roof_top_right"],["roof","roof_right"]],4:[["roof_left","roof"],["roof_left","roof"]],5:[["roof","roof"],["roof","roof"]],6:[["roof","roof_right"],["roof","roof_right"]],7:[["roof_left","roof"],["roof_bottom_left","roof_bottom"]],8:[["roof","roof"],["roof_bottom","roof_bottom"]],9:[["roof","roof_right"],["roof_bottom","roof_bottom_right"]],"<":[["roof_top_left","roof_top"],["roof_bottom_left","roof_bottom"]],"=":[["roof_top","roof_top"],["roof_bottom","roof_bottom"]],">":[["roof_top","roof_top_right"],["roof_bottom","roof_bottom_right"]],A:[["beige_pavement_top_left","beige_pavement_top"],["beige_pavement_left","beige_pavement"]],B:[["beige_pavement_top","beige_pavement_top"],["beige_pavement","beige_pavement"]],C:[["beige_pavement_top","beige_pavement_top_right"],["beige_pavement","beige_pavement_right"]],D:[["beige_pavement_left","beige_pavement"],["beige_pavement_left","beige_pavement"]],E:[["beige_pavement","beige_pavement"],["beige_pavement","beige_pavement"]],F:[["beige_pavement","beige_pavement_right"],["beige_pavement","beige_pavement_right"]],G:[["beige_pavement_left","beige_pavement"],["beige_pavement_bottom_left","beige_pavement_bottom"]],H:[["beige_pavement","beige_pavement"],["beige_pavement_bottom","beige_pavement_bottom"]],I:[["beige_pavement","beige_pavement_right"],["beige_pavement_bottom","beige_pavement_bottom_right"]],l:[["wall_left","wall"],["wall_left","wall"]],h:[["wall","wall"],["wall","wall"]],r:[["wall","wall_right"],["wall","wall_right"]],"[":[["wall_left","wall"],["wall_base_left","wall_base"]],_:[["wall","wall"],["wall_base","wall_base"]],"]":[["wall","wall_right"],["wall_base","wall_base_right"]]},solid:["water","wall","wall_left","wall_right","wall_base","wall_base_left","wall_base_right","roof_top_left","roof_top","roof_top_right","roof_left","roof","roof_right","roof_bottom_left","roof_bottom","roof_bottom_right"],water:["water"],grass:["tall_grass"]});var ci=g0({id:"house",blocks:{f:[["floor","floor"],["floor","floor"]],h:[["wall","wall"],["wall","wall"]]},solid:["wall"]});function Qt(e){let{width:o,height:t,px:r,colors:a}=e,s=a.map(()=>"");for(let n=0;n<t;n+=1){let i=0;for(;i<o;){let p=r[n*o+i];if(!p){i+=1;continue}let m=i;for(;i<o&&r[n*o+i]===p;)i+=1;s[p]+=`M${m} ${n}h${i-m}v1h${m-i}z`;}}return s.flatMap((n,i)=>i>0&&n?[{fill:a[i],d:n}]:[])}function er(e,o=1){let t=Qt(e).map(r=>`<path fill="${r.fill}" d="${r.d}"/>`).join("");return `<svg xmlns="http://www.w3.org/2000/svg" width="${e.width*o}" height="${e.height*o}" viewBox="0 0 ${e.width} ${e.height}" shape-rendering="crispEdges">${t}</svg>`}function di(e,o=1){return `data:image/svg+xml,${encodeURIComponent(er(e,o))}`}var l={heart:{outline:"#7A2E3A",base:"#E0525F",shadow:"#B53A4A",highlight:"#F4909A"},cream:{outline:"#6B5A48",base:"#F7F1E1",shadow:"#DDD2BC",highlight:"#FFFFFF"},bread:{outline:"#6E4A1E",base:"#D79A4A",shadow:"#B57A33",highlight:"#EDBB78"},wicker:{outline:"#5A3B22",base:"#B98A57",shadow:"#946A3E",highlight:"#D6AB78"},dove:{outline:"#5E6470",base:"#EEF0F3",shadow:"#C9CED8",highlight:"#FFFFFF"},dove_wing:{outline:"#4F5666",base:"#A9B2C2",shadow:"#8993A6",highlight:"#C9D0DB"},dove_idle:{outline:"#8A8478",base:"#E6E2D6",shadow:"#D1CBBC",highlight:"#F4F1E8"},dove_wing_idle:{outline:"#8A8478",base:"#BDB7A8",shadow:"#A8A294",highlight:"#D0CBBE"},cream_soft:{outline:"#8A8478",base:"#F7F1E1",shadow:"#DDD2BC",highlight:"#FFFFFF"},mailbox:{outline:"#243A5C",base:"#4A6FA5",shadow:"#375684",highlight:"#7596C8"},coral:{outline:"#7A3E30",base:"#E59A82",shadow:"#C97C65",highlight:"#F2BBA8"},glass:{outline:"#3F5F70",base:"#9CC7DB",shadow:"#7FAFC6",highlight:"#D6EBF5"},gold:{outline:"#6E5420",base:"#E8C557",shadow:"#C4A23F",highlight:"#F6E39A"},roof:{outline:"#5E2F28",base:"#B0604A",shadow:"#864637",highlight:"#CC7E64"},brick:{outline:"#3E2830",base:"#8C5A5E",shadow:"#6B4548",highlight:"#A9787C"},skin:{outline:"#6B4528",base:"#E0B08A",shadow:"#C2906A",highlight:"#F0C9A8"},cloth_green:{outline:"#26402B",base:"#5E8B5A",shadow:"#456B42",highlight:"#85B081"},ink_blue:{outline:"#1F2A44",base:"#34507F",shadow:"#263B60",highlight:"#5A78A8"},grass:{outline:"#2F4D26",base:"#6E9450",shadow:"#4F7A3E",highlight:"#A8C682"},map_paper:{outline:"#6B4528",base:"#EAD9B0",shadow:"#D2BF93",highlight:"#F6EBCB"},cream_idle:{outline:"#8A8478",base:"#EFEBDD",shadow:"#DCD6C4",highlight:"#FAF8F1"}},d={dark:"#5A3B22",eye:"#2B2A26",beak:"#E8B04A",legs:"#5E6470",legs_idle:"#8A8478",flap:"#B5A58A",flap_idle:"#CFC8B6",seal:"#C8505A",river:"#6FA3C7",path:"#B8996D"};var J=["1"];function A(e,o){return e.map(t=>{if("mask"in t){let r=o?t.ramp:t.tone==="light"?l.cream_idle:l.dove_wing_idle;return {shaded:t.mask,ramp:r,x:t.x,y:t.y}}return {flat:t.flat,color:o?t.color:d.legs_idle,x:t.x,y:t.y}})}var or=["000000111000000","000000111000000","001100111001100","001111111111100","000111111111000","000111101111000","111111000111111","111110000011111","111111000111111","000111101111000","000111111111000","001111111111100","001100111001100","000000111000000","000000111000000"];var tr=[{mask:or,ramp:l.wicker,tone:"dark",x:0,y:0}],rr={cog:A(tr,true),cog_idle:A(tr,false)};var y1=["1111111110","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],ar=["11111111","00000000","11111111","00000000","11111100"];var ir=["0111111111110","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","1111111111111","0111111111110"],sr=["1100000011","1100000011","0000000000","0000110000","0000110000","0000000000","1100000011","1100000011"];var nr=["00001000000000","00011000000000","00111111111100","01111111111110","00111100001111","00011000000111","00001000000111","00000000001111","00000111111110","00000111111100"];var lr=["11111111111100","11111111111110","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"],pr=["11111111","11111111","11111111"],mr=["11111111","11111111","11111111","11111111","11111111"];var cr={dice:[{shaded:ir,ramp:l.cream,x:0,y:0},{flat:sr,color:d.eye,x:2,y:3}],reset:[{shaded:nr,ramp:l.ink_blue,x:0,y:0}],save:[{shaded:lr,ramp:l.mailbox,x:0,y:0},{flat:pr,color:d.flap,x:3,y:1},{flat:mr,color:l.cream.base,x:3,y:7}],copy:[{shaded:y1,ramp:l.dove_wing,x:0,y:0},{shaded:y1,ramp:l.dove,x:4,y:3},{flat:ar,color:d.legs,x:6,y:6}]};var k1=["010","111"];var x1=["010","000"];var u1=["000","111"];var H0=["1","1"];var dr=["001100","011110","111111"];var hr=["111111","111111","111111","111111","111111"];var b1=["0110","1111"];var M1=["1111","1111","1111","1111"];var fr=["11","11","11"];var gr=["111","111","111","111"];var yr=["00000111100000","00001111110000","00011111111000","00111111111100","01111111111110","11111111111111"];var kr=["111111111111","111111111111","111111111111","111111111111","111111111111"];var xr=["11","11"];var ur=[{mask:fr,ramp:l.brick,tone:"dark",x:9,y:0},{mask:yr,ramp:l.roof,tone:"dark",x:0,y:1},{mask:kr,ramp:l.cream,tone:"light",x:1,y:7},{mask:gr,ramp:l.wicker,tone:"dark",x:3,y:8},{mask:xr,ramp:l.glass,tone:"dark",x:9,y:8}],br=[{mask:hr,ramp:l.cream,tone:"light",x:4,y:6},{mask:dr,ramp:l.mailbox,tone:"dark",x:4,y:3},{mask:M1,ramp:l.cream,tone:"light",x:0,y:7},{mask:b1,ramp:l.roof,tone:"dark",x:0,y:5},{mask:M1,ramp:l.cream,tone:"light",x:10,y:7},{mask:b1,ramp:l.coral,tone:"dark",x:10,y:5},{flat:H0,color:d.dark,x:1,y:9},{flat:H0,color:d.dark,x:11,y:9},{flat:H0,color:d.dark,x:7,y:9},{flat:k1,color:l.grass.base,x:3,y:9},{flat:u1,color:l.grass.shadow,x:3,y:9},{flat:x1,color:l.grass.highlight,x:3,y:9},{flat:k1,color:l.grass.base,x:8,y:9},{flat:u1,color:l.grass.shadow,x:8,y:9},{flat:x1,color:l.grass.highlight,x:8,y:9}],Mr={cottage:A(ur,true),cottage_idle:A(ur,false),cottage_row:A(br,true),cottage_row_idle:A(br,false)};var w1=["000000011100","000000111110","000001111110","011111111110","111111111110","011111111100","001111111000","000011110000"];var wr=["1010"];var Pr=["11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"];var Sr=["10000000000001","01000000000010","00100000000100","00010000001000","00001000010000","00000110110000"];var Cr=["100001","010010","001100"];var Fr=["111111","111111","111111","111111"];var P1=["011110","111111","011100"];var Ar=["0111111111110","1111111111111","1111111111111","1111111111111","1111111111111","0111111111110","0011111000000","0001110000000","0001100000000","0001000000000"];var _r=["10101"];var S1=["11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"];var C1=["10000000000001","01000000000010","00100000000100","00010000001000","00001000010000","00000100100000","00000011000000"];var vr=["00111111111100","01111111111110","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"];var Br=["1111","1111"];var Er=["1","1","1","1","1","1"];var Tr=["11","11","11","11"];var Lr=["11111"];var x0=["11","11"];var Hr=["1000000001","0100000010","0010000100","0001001000","0000110000"];var Ir=["1111111111","1111111111","1111111111","1111111111","1111111111"];var Rr=["00011","00111","01111","11110","11100"];var Dr=["11000","11100","11110","01111","00111"];var hi=["11"];function Or(e){let o=e?l.dove:l.dove_idle,t=e?l.dove_wing:l.dove_wing_idle,r=e?l.cream:l.cream_idle;return [{shaded:Fr,ramp:r,x:10,y:1},{flat:Cr,color:e?d.flap:d.flap_idle,x:10,y:1},...e?[{flat:x0,color:d.seal,x:12,y:2}]:[],{shaded:w1,ramp:o,x:0,y:0},{shaded:P1,ramp:t,x:2,y:3},{flat:wr,color:e?d.legs:d.legs_idle,x:5,y:8},{flat:J,color:d.eye,x:8,y:1},{flat:hi,color:d.beak,x:11,y:2}]}var jr={comment:[{shaded:Ar,ramp:l.cream_soft,x:0,y:0},{flat:_r,color:d.dark,x:4,y:2}],bird_letter:Or(true),bird_letter_idle:Or(false),bird_perch:[{shaded:Pr,ramp:l.cream,x:0,y:9},{flat:Sr,color:d.flap,x:0,y:9},{flat:x0,color:d.seal,x:6,y:12},{shaded:w1,ramp:l.dove,x:1,y:0},{shaded:P1,ramp:l.dove_wing,x:3,y:3},{flat:J,color:d.eye,x:9,y:1},{flat:J,color:d.beak,x:12,y:2}],winged_letter:[{shaded:Rr,ramp:l.dove_wing,x:0,y:0},{shaded:Dr,ramp:l.dove_wing,x:13,y:0},{shaded:Ir,ramp:l.cream,x:4,y:4},{flat:Hr,color:d.flap,x:4,y:4},{flat:x0,color:d.seal,x:8,y:7}],envelope:[{shaded:S1,ramp:l.cream,x:0,y:0},{flat:C1,color:d.flap,x:0,y:0},{flat:x0,color:d.seal,x:6,y:5}],envelope_idle:[{shaded:S1,ramp:l.cream_idle,x:0,y:0},{flat:C1,color:d.flap_idle,x:0,y:0}],mailbox:[{shaded:Tr,ramp:l.wicker,x:6,y:9},{shaded:vr,ramp:l.mailbox,x:0,y:3},{flat:Lr,color:d.eye,x:4,y:6},{flat:Er,color:d.dark,x:14,y:1},{shaded:Br,ramp:l.heart,x:14,y:0}]};var Ur=["0000000000000","0000000000000","0000000111100","0000011111100","0000111111100","0000111111100","0001111111000","0001111111000","0011111110000","0011111000000","0011100000000","0000000000000","0000000000000"];var $r=["011110","111111","111111","111111","011110"];var Gr=["0000000000000","0000000000010","0000000000100","0000000001000","0000000010000","0000000100000","0000001000000","0000010000000","0000100000000","0001000000000","0010000000000","0100000000000","1000000000000"];var Nr=[{mask:Ur,ramp:l.dove,tone:"light",x:0,y:0},{flat:Gr,color:d.legs,x:0,y:0},{mask:$r,ramp:l.ink_blue,tone:"dark",x:8,y:9}],zr={quill:A(Nr,true),quill_idle:A(Nr,false)};var F1=["111111111","111111111","111111111","111111111","111111111","111111111","111111111","111111111","111111111","111101111","111000111","110000011"];var Yr=["111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111","111111111111"];var Xr=["111111111111","111111111111"];var Wr=["1111","1111"];var Vr=["11111111","00000000","11111100","00000000","11111111"];var Kr=["11","11"];var qr=["11111111111","11111111111","11111111111","11111111111","11111111111","11111111111","11111111111","11111111111","11111111111"];var Zr={note_ribbon:[{shaded:Yr,ramp:l.cream,x:0,y:0},{flat:Xr,color:d.seal,x:0,y:4},{shaded:Wr,ramp:l.heart,x:4,y:3}],bookmark:[{shaded:F1,ramp:l.coral,x:0,y:0}],bookmark_idle:[{shaded:F1,ramp:l.cream_soft,x:0,y:0}],pinned_note:[{shaded:qr,ramp:l.cream,x:0,y:1},{flat:Vr,color:d.flap,x:1,y:4},{shaded:Kr,ramp:l.heart,x:4,y:0}]};var Jr=["11111111111111","11111111111111","01111111111110","01111111111110","00111111111100","00111111111100","00011111111000"];var Qr=["1010101010","0101010101","1010101010"];var ea=["0011111100","0111111110","1111111111","1111111111","1111111111"];var oa=["0111111110","1111111111","1111111111","1111111111","1111111111","1111111111","0111111110"];var ta=["111111","111111","111111","111111"];var ra=["11111111","11111111"];var aa={basket:[{shaded:ea,ramp:l.bread,x:2,y:0},{shaded:Jr,ramp:l.wicker,x:0,y:4},{flat:Qr,color:d.dark,x:2,y:7}],jar:[{shaded:oa,ramp:l.glass,x:0,y:2},{shaded:ta,ramp:l.heart,x:2,y:5},{shaded:ra,ramp:l.gold,x:1,y:0}]};var ia=["11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"];var sa=["1111","1111","1111"];var na=["111","111","111","111"];var la=["111","000","111"];var A1=["11","11","11","11"];var pa=["0011100","0111110","1111111"];var ma=["0110","1111"];var ca=["1111","1111"];var da=["11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111","11111111111111"];var ha=["1010101"];var fa=["00000000000100","00000000001100","00000000011000","00000001110000","00000011000000","00001110000000"];var ga=[{mask:da,ramp:l.map_paper,tone:"light",x:0,y:0},{mask:pa,ramp:l.grass,tone:"dark",x:1,y:6},{flat:fa,color:d.river,x:0,y:2},{mask:ma,ramp:l.roof,tone:"dark",x:8,y:1},{mask:ca,ramp:l.cream,tone:"light",x:8,y:3},{flat:ha,color:d.path,x:3,y:7}],ya=[{mask:A1,ramp:l.wicker,tone:"dark",x:2,y:8},{mask:A1,ramp:l.wicker,tone:"dark",x:10,y:8},{mask:ia,ramp:l.wicker,tone:"dark",x:0,y:0},{mask:sa,ramp:l.cream,tone:"light",x:2,y:2},{mask:na,ramp:l.cream,tone:"light",x:8,y:2},{flat:la,color:d.flap,x:2,y:3},{flat:J,color:d.seal,x:3,y:2},{flat:J,color:d.seal,x:9,y:2}],ka={willage_map:A(ga,true),willage_map_idle:A(ga,false),notice_board:A(ya,true),notice_board_idle:A(ya,false)};var _1=["0011100011100","0111110111110","1111111111111","1111111111111","1111111111111","0111111111110","0011111111100","0001111111000","0000111110000","0000011100000","0000001000000"];var xa={heart:[{shaded:_1,ramp:l.heart,x:0,y:0}],heart_empty:[{shaded:_1,ramp:l.cream_soft,x:0,y:0}]};var v1={account:rr,actions:cr,buildings:Mr,communication:jr,design:zr,files:Zr,"food-beverage":aa,navigation:ka,social:xa};var I0="_idle",u0=20,Ma=["red","orange","yellow","green","teal","blue","purple","pink","brown","grey"],B1={heart:l.heart,mailbox:l.mailbox,bookmark:l.coral,note_ribbon:l.heart,pinned_note:l.heart,jar:l.heart,cottage:l.roof,willage_map:l.roof,quill:l.ink_blue,cog:l.wicker,notice_board:l.wicker},b0=Object.assign({},...Object.values(v1)),E1=e=>e.endsWith(I0),T1=Object.keys(b0).filter(e=>!E1(e)),fi=T1.filter(e=>e in B1),gi=T1.filter(e=>`${e}${I0}`in b0),yi=Object.fromEntries(Object.entries(v1).map(([e,o])=>[e,Object.keys(o).filter(t=>!E1(t))])),ua=new WeakMap;function ki(e,o,t){if("shaded"in e){let r=ua.get(e.shaded);r||(r=i0(e.shaded),ua.set(e.shaded,r));let a=o&&t&&e.ramp===o?t:e.ramp;return {sprite:r,slots:j(a),x:e.x,y:e.y}}return {sprite:l0(e.flat,{1:1}),slots:["",e.color],x:e.x,y:e.y}}function xi({width:e,height:o,px:t}){let r=e,a=o,s=-1,n=-1;return t.forEach((i,p)=>{if(!i)return;let m=p%e,c=Math.floor(p/e);r=Math.min(r,m),s=Math.max(s,m),a=Math.min(a,c),n=Math.max(n,c);}),{x:r,y:a,width:s-r+1,height:n-a+1}}var ba=new Map;function ui(e,o={}){if(!b0[e]||E1(e))throw new Error(`Unknown icon: ${String(e)}`);let t=o.idle&&`${e}${I0}`in b0?`${e}${I0}`:e,r=o.color&&t===e&&e in B1?o.color:void 0,a=r&&Ma.includes(r)?r:q(r),s=a?`${t}:${a}`:t,n=ba.get(s);if(!n){let i=b0[t].map(c=>ki(c,B1[e],a&&(a.startsWith("#")?s0(a):y0[a]))),p=p0(i),m=xi(R(i,p));n=R(i,{x:p.x+m.x-Math.floor((u0-m.width)/2),y:p.y+m.y-Math.floor((u0-m.height)/2),width:u0,height:u0}),ba.set(s,n);}return n}var H1=[8,16],I1=[1,2],O0={"game-boy":["#0f380f","#306230","#8bac0f","#9bbc0f"],sepia:["#2b1d0e","#6b4a2b","#b08a5a","#e8d3a8"],pastel:["#5a4a6a","#a0a0d8","#f4a8c4","#fff0b0"],night:["#0b1020","#1f2a4a","#4a5d8f","#aab8e0"],"autumn-glow":["#3b1f14","#8a3f1c","#d27a2a","#f2c46b"],mint:["#16342e","#2f7a68","#7cc4a8","#e4f5e8"]},bi=Object.keys(O0);function L1(e){let o=e.slice(1);o.length===3&&(o=o.replace(/./g,"$&$&"));let t=parseInt(o,16);return [t>>16&255,t>>8&255,t&255]}function Mi([e,o,t]){return `#${(1<<24|e<<16|o<<8|t).toString(16).slice(1)}`}var R0=([e,o,t])=>(.2126*e+.7152*o+.0722*t)/255,wi=(e,o)=>Math.round(Math.round(e/255*(o-1))*255/(o-1)),Pi={1:e=>{let o=R0(e)>=.5?255:0;return [o,o,o]},2:e=>{let o=wi(R0(e)*255,4);return [o,o,o]}},Ca=e=>typeof e=="string"&&Object.prototype.hasOwnProperty.call(O0,e),wa=50,Si=250;function Fa(e,o){let t=O0[o].map(n=>({c:n,l:R0(L1(n))})).sort((n,i)=>n.l-i.l),r=[""],a=new Map,s=e.colors.map((n,i)=>{if(i===0)return 0;let p=(R0(L1(n))*255-wa)/(Si-wa),m=t[Math.min(t.length-1,Math.max(0,Math.round(p*(t.length-1))))].c,c=a.get(m);return c===void 0&&(c=r.length,r.push(m),a.set(m,c)),c});return {...e,colors:r,px:e.px.map(n=>s[n])}}function D0(e,o){return typeof o=="number"&&e.includes(o)}function Aa(e,o,t,r,a){let{width:s,height:n,px:i}=e,p=new Uint8Array(o*t),m=Math.floor((o-r)/2),c=Math.floor((t-a)/2);for(let h=0;h<a;h+=1){let f=Math.floor(h*n/a),w=Math.max(f+1,Math.ceil((h+1)*n/a));for(let y=0;y<r;y+=1){let g=Math.floor(y*s/r),P=Math.max(g+1,Math.ceil((y+1)*s/r)),S=new Map,_=0,E=0,G=0;for(let $=f;$<w;$+=1)for(let T=g;T<P;T+=1){let V=i[$*s+T];if(!V)continue;_+=1;let Q=(S.get(V)??0)+1;S.set(V,Q),Q>G&&(E=V,G=Q);}_*2>=(w-f)*(P-g)&&(p[(c+h)*o+m+y]=E);}}return {width:o,height:t,colors:e.colors,px:p}}function Ci(e,o){let{width:t,height:r}=e;if(t===0||r===0)return {...e,width:o,height:o,px:new Uint8Array(o*o)};let a=Math.min(o/t,o/r),s=Math.max(1,Math.floor(a)),n=a>=1?t*s:Math.max(1,Math.round(t*a)),i=a>=1?r*s:Math.max(1,Math.round(r*a));return Aa(e,o,o,n,i)}function _a(e,o){let t=Pi[o],r=[""],a=new Map,s=e.colors.map((n,i)=>{if(i===0)return 0;let p=Mi(t(L1(n))),m=a.get(p);return m===void 0&&(m=r.length,r.push(p),a.set(p,m)),m});return {...e,colors:r,px:e.px.map(n=>s[n])}}var Pa=new WeakMap;function Fi(e,o={}){let t=D0(H1,o.size)?o.size:void 0,r=D0(I1,o.bits)?o.bits:void 0,a=Ca(o.palette)?o.palette:void 0;if(t===void 0&&r===void 0&&a===void 0)return e;let s=`${t??""}:${r??""}:${a??""}`,n=Pa.get(e);n||(n=new Map,Pa.set(e,n));let i=n.get(s);return i||(i=t===void 0?e:Ci(e,t),r!==void 0&&(i=_a(i,r)),a!==void 0&&(i=Fa(i,a)),n.set(s,i)),i}var Sa=new WeakMap;function Ai(e,o={}){let t=D0(H1,o.size)?o.size:void 0,r=D0(I1,o.bits)?o.bits:void 0,a=Ca(o.palette)?o.palette:void 0;if(t===void 0&&r===void 0&&a===void 0)return e;let s=`${t??""}:${r??""}:${a??""}`,n=Sa.get(e);n||(n=new Map,Sa.set(e,n));let i=n.get(s);if(!i){if(i=e,t!==void 0&&t<16){let p=t/16;i=Aa(e,Math.max(1,Math.round(e.width*p)),Math.max(1,Math.round(e.height*p)),Math.max(1,Math.round(e.width*p)),Math.max(1,Math.round(e.height*p)));}r!==void 0&&(i=_a(i,r)),a!==void 0&&(i=Fa(i,a)),n.set(s,i);}return i}
2
+ export{ci as $,m0 as A,i1 as B,Va as C,qa as D,x as E,q as F,d0 as G,Qa as H,A0 as I,n1 as J,p1 as K,ti as L,g0 as M,y0 as N,h1 as O,U as P,k0 as Q,L0 as R,ii as S,Kt as T,si as U,ni as V,g1 as W,Jt as X,li as Y,pi as Z,mi as _,W0 as a,Qt as aa,Ae as b,er as ba,V0 as c,di as ca,_e as d,l as da,P0 as e,d as ea,Ga as f,u0 as fa,Be as g,Ma as ga,Ee as h,T1 as ha,S0 as i,fi as ia,q0 as j,gi as ja,Te as k,yi as ka,F0 as l,ui as la,Z0 as m,H1 as ma,J0 as n,I1 as na,ao as o,O0 as oa,io as p,bi as pa,so as q,Fi as qa,fo as r,Ai as ra,go as s,e1 as t,o1 as u,t1 as v,n0 as w,r1 as x,Ya as y,Oo as z};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A composed, colour-resolved image. `px` indexes into `colors`;
3
+ * index 0 is transparent. Rasters are immutable and safe to cache.
4
+ */
5
+ interface Raster {
6
+ readonly width: number;
7
+ readonly height: number;
8
+ readonly colors: readonly string[];
9
+ readonly px: Uint8Array;
10
+ }
11
+
12
+ export type { Raster as R };