@fabi-play/sdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,41 @@ From the CDN, pinned to an exact version with its Subresource Integrity hash (li
45
45
  | `fabi-play.d.ts` | types for script-tag games (`FabiPlay.PlayerFrame`, …) |
46
46
  | `fabi-play.schema.json` | the JSON Schema of `fabi-play.json` |
47
47
 
48
+ ## Fabi explains your game (intro)
49
+
50
+ Before calibration, Fabi (the mascot) can explain your game on the TV in a few steps: a speech bubble over an image
51
+ of the game, or a move shown with the children's own avatars, which they can also try. You write only data, in
52
+ `fabi-play.json`:
53
+
54
+ ```json
55
+ "intro": { "steps": [
56
+ { "say": { "it": "Si corre nel bosco! Ognuno ha la sua pista e raccoglie le stelle.", "en": "Let's run in the woods! Everyone has a track and collects stars." }, "image": "intro/track.jpg" },
57
+ { "say": { "it": "Tronco? Salta! Provate adesso.", "en": "A log? Jump! Try it now." }, "move": "jump", "practice": true },
58
+ { "say": { "it": "Ramo basso? Giù!", "en": "Low branch? Down!" }, "move": "squat" }
59
+ ] }
60
+ ```
61
+
62
+ - **1 to 4 steps.** Fabi Play adds its own last step ("Ready?") and goes on to calibration.
63
+ - **`say`**: one sentence, in Italian and English, up to 90 characters each (an emoji counts as one), with no spaces
64
+ at either end and no control characters. Or one per age range, when the little
65
+ ones need simpler words: `{ "3-5": { "it": "…", "en": "…" }, "9-12": { "it": "…", "en": "…" } }` (at least one
66
+ range; a child of a range you left out gets the closest one you wrote, the younger if two are as close).
67
+ - **Each step has an `image` or a `move`, not both.**
68
+ - `image`: a picture of the game, 16:9, at least 1280×720, `.jpg` or `.png` (no WebP: old TV browsers may not
69
+ decode it; use JPG, quality about 80, for screenshots and PNG only for flat art), a path
70
+ relative to the game's address like `entry`: no scheme (`https://`), no leading `/`, no `.` or `..` segments,
71
+ letters, digits, `_` and `-`, extension in lowercase (`intro/track.jpg`, not `intro/Track.JPG`).
72
+ - `move`: one of `jump`, `squat`, `clap`, `lane-left`, `lane-right`, `arms-up`, `arms-wide`, `arms-v`, `star`,
73
+ drawn with each child's avatar.
74
+ - `practice` (optional, only with a `move`): `true` and the children try it, each gets a tick, and the step moves
75
+ on when all did, or after 8 seconds. Default `false`: Fabi only shows it.
76
+ - **The voice is Fabi Play's.** Fabi speaks each sentence with a clip Fabi Play generates from the text when the
77
+ game is published. Changing a text needs a new clip: until it is made, the TV shows that sentence in the bubble
78
+ only.
79
+ - **No `intro`**: the game goes straight to calibration, as before.
80
+ - **An invalid intro** is reported by the check (the Studio, `parseManifest`, the JSON Schema) and skipped by the
81
+ TV: it never blocks the game.
82
+
48
83
  Docs: https://docs.fabiplay.app.
49
84
 
50
85
  ## License
package/dist/avatars.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  drawShapes,
7
7
  frameOf,
8
8
  iconShapes
9
- } from "./chunks/chunk-QJPCNRFI.js";
9
+ } from "./chunks/chunk-57WXWAXG.js";
10
10
  export {
11
11
  BAND_BODY,
12
12
  DEFAULT_AVATAR,
@@ -290,7 +290,11 @@ declare namespace FabiPlay {
290
290
  * "title": { "it": "Acchiappastelle", "en": "Star catcher" },
291
291
  * "description": { "it": "Prendi le stelle con le mani.", "en": "Catch the stars with your hands." },
292
292
  * "ageRanges": ["3-5", "6-8"], "movements": ["hands"], "players": { "min": 1, "max": 2 },
293
- * "minutes": 3, "entry": "index.html", "sdk": 1
293
+ * "minutes": 3, "entry": "index.html", "sdk": 1,
294
+ * "intro": { "steps": [
295
+ * { "say": { "it": "Prendi le stelle!", "en": "Catch the stars!" }, "image": "intro/stars.jpg" },
296
+ * { "say": { "it": "Alza le braccia!", "en": "Arms up!" }, "move": "arms-up", "practice": true }
297
+ * ] }
294
298
  * }
295
299
  */
296
300
  export interface GameManifest {
@@ -315,15 +319,45 @@ declare namespace FabiPlay {
315
319
  };
316
320
  /** Minutes of a typical game, 1 to 20. */
317
321
  minutes: number;
318
- /** Page that starts the game, an .html file relative to the game's address (same site, no ".."). */
322
+ /**
323
+ * Page that starts the game: a path relative to the game's address (no scheme, no leading /, no "." or ".."
324
+ * segments, up to 200 characters), of letters, digits, _ and -, ending in lowercase .html: index.html, play/index.html.
325
+ */
319
326
  entry: string;
320
327
  /** Protocol version of the SDK it was built with: 1 (PROTOCOL_VERSION). */
321
328
  sdk: number;
322
329
  /** Optional: the backdrops it can draw over besides its own; ['video'] opts in to mirror mode. */
323
330
  backdrop?: GameBackdrop[];
331
+ /** Optional: Fabi explains the game on the TV before calibration (see GameIntro). Absent: straight to calibration. */
332
+ intro?: GameIntro;
324
333
  }
325
334
  /** The backdrops a game may declare in its manifest (its own background is always supported). */
326
335
  export type GameBackdrop = Exclude<Backdrop, "none">;
336
+ /** The moves an intro step can show; the platform draws them with each child's avatar. Same names the SDK detects. */
337
+ export type IntroMove = "jump" | "squat" | "clap" | "lane-left" | "lane-right" | "arms-up" | "arms-wide" | "arms-v" | "star";
338
+ /** One sentence in every language, or one per age range (each with every language). */
339
+ export type IntroText = Record<Locale, string> | Partial<Record<AgeRange, Record<Locale, string>>>;
340
+ /** One step of the intro: Fabi says one sentence, over an image of the game or a move shown with the avatars. */
341
+ export interface IntroStep {
342
+ say: IntroText;
343
+ /**
344
+ * An image of the game, 16:9: a path relative to the game's address with the same rules as entry (no scheme, no
345
+ * leading /, no "." or ".." segments), ending in lowercase .jpg or .png (no WebP: old TV browsers may not decode it): intro/track.jpg.
346
+ */
347
+ image?: string;
348
+ /** Or a move, shown with the avatars. Exactly one of image and move. */
349
+ move?: IntroMove;
350
+ /** Only with move: the children try it and each gets a tick; the step moves on when all did, or after 8 s. Default false: Fabi only shows it. */
351
+ practice?: boolean;
352
+ }
353
+ /**
354
+ * Fabi explains the game on the TV, before calibration, in 1 to 4 steps (the platform adds its own final "ready"
355
+ * step). Only data: Fabi Play draws it, and speaks each sentence with a voice clip generated at publication from the
356
+ * text (voiceKey); a text without its clip yet is shown in the bubble only.
357
+ */
358
+ export interface GameIntro {
359
+ steps: IntroStep[];
360
+ }
327
361
  /** Where player space (0–1) lands on the canvas. */
328
362
  export interface Box {
329
363
  /** Left edge, canvas units. */
package/dist/fabi-play.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var Ye=Object.defineProperty;var It=(n,e,t)=>e in n?Ye(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Lt=(n,e)=>{for(var t in e)Ye(n,t,{get:e[t],enumerable:!0})};var z=(n,e,t)=>It(n,typeof e!="symbol"?e+"":e,t);function We(n,e=window){let t=new Set,r=e.AudioContext;r&&(e.AudioContext=class extends r{constructor(...s){super(...s),t.add(this)}});let a=[],o=[];Promise.resolve(n).then(s=>{s.on("break-start",()=>{a=[...e.document.querySelectorAll("audio, video")].filter(u=>!u.paused),a.forEach(u=>u.pause()),o=[...t].filter(u=>u.state==="running"),o.forEach(u=>{u.suspend()})}),s.on("break-done",()=>{a.forEach(u=>{u.play().catch(()=>{})}),o.forEach(u=>{u.resume()}),a=[],o=[]})})}var $t={jump:"Space",squat:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",clap:"Enter"};function Xe(n){if(n.trim()==="default")return;let e={};for(let t of n.split(",")){let[r,a]=t.split(":").map(o=>o.trim());r&&a&&(e[r]=a)}return e}var Nt={Space:[" ",32],Enter:["Enter",13],Escape:["Escape",27],ShiftLeft:["Shift",16],ArrowLeft:["ArrowLeft",37],ArrowUp:["ArrowUp",38],ArrowRight:["ArrowRight",39],ArrowDown:["ArrowDown",40]};function Qe(n){let e=Nt[n];if(e)return{key:e[0],code:n,keyCode:e[1]};let t=/^Key([A-Z])$/.exec(n);if(t)return{key:t[1].toLowerCase(),code:n,keyCode:t[1].charCodeAt(0)};let r=/^Digit([0-9])$/.exec(n);if(r)return{key:r[1],code:n,keyCode:48+Number(r[1])};throw new Error(`Fabi Play: unknown key "${n}" (use Space, Enter, Arrow\u2026, KeyA\u2026, Digit0\u2026)`)}var Ft=(n=document)=>({dispatch(e,t){let r=new KeyboardEvent(e,{key:t.key,code:t.code,bubbles:!0,cancelable:!0});for(let a of["keyCode","which"])Object.defineProperty(r,a,{get:()=>t.keyCode});(n.activeElement??n.body??n).dispatchEvent(r)}}),je=80,Ht=800;function qe(n,e=$t,t={}){let r=t.player??1,a=t.target??Ft(),o=t.setTimeout??((d,m)=>setTimeout(d,m)),s=new Set,u=0,l=d=>{let m=e[d];!m||s.has(d)||(s.add(d),a.dispatch("keydown",Qe(m)))},p=d=>{let m=e[d];!m||!s.has(d)||(s.delete(d),a.dispatch("keyup",Qe(m)))},i=d=>{l(d),o(()=>p(d),je)},f=d=>{if(d.player!==r)return;let m={"lane-left":-1,"lane-center":0,"lane-right":1};switch(d.gesture){case"jump":l("jump"),o(()=>p("jump"),Ht);break;case"land":p("jump");break;case"squat":l("squat");break;case"stand":p("squat");break;case"clap":i("clap");break;default:{let h=m[d.gesture];if(h===void 0)break;let b=h>u?"right":"left";for(let w=0;w<Math.abs(h-u);w++)o(()=>i(b),w*(je*2));u=h}}},c=d=>{let m=d.players.find(h=>h.id===r);m&&(m.shape==="arms-up"?l("arms-up"):p("arms-up"))},x=[n.on("gesture",f),n.on("frame",c),n.on("break-start",()=>[...s].forEach(p))];return()=>{x.forEach(d=>d()),[...s].forEach(p)}}function _t(n=document){let e=n.createElement("div");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;left:0;top:0;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;border:6px solid #FBE7B8;background:rgba(251,231,184,.25);pointer-events:none;z-index:2147483647;box-sizing:border-box;transition:transform 60ms linear",n.body.appendChild(e);let t=(r,a,...o)=>{let s=n.elementFromPoint(r,a)??n.body;for(let u of o){let l={bubbles:!0,cancelable:!0,clientX:r,clientY:a,pointerId:1,pointerType:"touch",isPrimary:!0};s.dispatchEvent(u.startsWith("pointer")?new PointerEvent(u,l):new MouseEvent(u,l))}};return{size:()=>({width:n.documentElement.clientWidth,height:n.documentElement.clientHeight}),move:(r,a)=>t(r,a,"pointermove","mousemove"),click:(r,a)=>t(r,a,"pointerdown","mousedown","pointerup","mouseup","click"),cursor:(r,a,o)=>{e.style.transform=`translate(${r}px, ${a}px) scale(${1-o*.35})`,e.style.borderColor=o>0?"#EE6A43":"#FBE7B8"}}}function Ze(n,e={}){let t=e.player??1,r=e.hand??"any",a=e.dwellMs??800,o=e.radius??.04,s=e.target??_t(),u=null,l=!1;return n.on("frame",p=>{let i=p.players.find(D=>D.id===t);if(!i)return;let c=r==="left"?i.leftHand:r==="right"?i.rightHand:((D,V)=>D&&V?D.y<V.y?D:V:D??V)(i.leftHand,i.rightHand);if(!c)return;let{width:x,height:d}=s.size(),m=c.x*x,h=c.y*d;s.move(m,h),(!u||Math.hypot(m-u.x,h-u.y)>o*Math.hypot(x,d))&&(u={x:m,y:h,t:p.t},l=!1);let w=l?0:Math.min((p.t-u.t)/a,1);w>=1&&(l=!0,s.click(u.x,u.y)),s.cursor(m,h,l?0:w)})}var P={nose:0,leftShoulder:11,rightShoulder:12,leftElbow:13,rightElbow:14,leftWrist:15,rightWrist:16,leftHip:23,rightHip:24,leftKnee:25,rightKnee:26,leftAnkle:27,rightAnkle:28},Je=["3-5","6-8","9-12"],Vt=n=>Je.includes(n);var Gt=4;var et={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},Kt=et["6-8"],De=(n,e)=>{let t=Vt(e)?et[e]:Kt;return t[Number.isInteger(n)&&n>=0?n%t.length:0]};var Te="fabi-play",ae=n=>({ns:Te,...n});function Re(n){if(!ze(n))return;let{x:e,y:t,w:r,h:a}=n;return oe(e)&&oe(t)&&oe(r)&&oe(a)&&r>0&&a>0?{x:e,y:t,w:r,h:a}:void 0}var ge=(n,e)=>n?{x:n.x+e.x*n.w,y:n.y+e.y*n.h}:{x:e.x,y:e.y},tt=["high","medium","low"];function nt(n){if(!ze(n))return;let e={};return tt.includes(n.tier)&&(e.tier=n.tier),oe(n.hz)&&n.hz>=20&&n.hz<=240&&(e.hz=Math.round(n.hz)),e.tier||e.hz?e:void 0}function rt(n){let e={};return ze(n)&&(oe(n.fps)&&n.fps>=0&&n.fps<1e3&&(e.fps=n.fps),typeof n.renderer=="string"&&/^[a-z0-9-]{1,16}$/.test(n.renderer)&&(e.renderer=n.renderer),tt.includes(n.tier)&&(e.tier=n.tier)),e}var ze=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),oe=n=>typeof n=="number"&&Number.isFinite(n);var Ut=12,Yt=132,Qt=n=>Ut+n*Yt,Ln=Qt(Gt);var _="#4a382c",$="#2b2118",G="#1c1f2b",ot="#fbefe3",K="#f4897a",he="#3a2a22",Oe=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:ot,accent:"#ffd9c2",outline:$,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:he,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:ot,accent:"#5a3426",outline:$,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:he,muzzle:"band",cheeks:K},tail:"brush",headExtras:[],bodyExtras:["star"],extraColors:["#ffd84a"]},{id:"bunny",name:{en:"Bunny",it:"Coniglietto"},band:"3-5",palette:{body:"#f9d0de",limbs:"#f9d0de",belly:"#fff6f8",accent:"#f4a0b9",outline:_},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:K},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:_},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:he,muzzle:"oval",cheeks:K},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:_,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:K},tail:"long",headExtras:["whiskers"],bodyExtras:[]},{id:"panda",name:{en:"Panda",it:"Panda"},band:"3-5",palette:{body:"#ffffff",limbs:"#6e6674",belly:"#ffffff",accent:"#6e6674",outline:_,ears:"#6e6674"},head:"wide",ears:"round",face:{eyes:"mask",mouth:"smile",nose:"#2f2a2c",muzzle:"none",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:[]},{id:"penguin",name:{en:"Penguin",it:"Pinguino"},band:"3-5",palette:{body:"#6c8fca",limbs:"#6c8fca",belly:"#ffffff",accent:"#f9b95c",outline:_,feet:"#f9b95c"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"heart",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:["flippers","scarf"],extraColors:["#f6907a"]},{id:"frog",name:{en:"Frog",it:"Ranocchio"},band:"3-5",palette:{body:"#8fd487",limbs:"#8fd487",belly:"#e6f7cc",accent:"#62ad62",outline:_},head:"wide",ears:"none",face:{eyes:"big",eyesOnTop:!0,mouth:"open",muzzle:"none",cheeks:"#f59b8f"},tail:"none",headExtras:[],bodyExtras:["flippers","spots"],extraColors:["#62ad62","#b0e6a4"]},{id:"lion",name:{en:"Lion",it:"Leoncino"},band:"6-8",palette:{body:"#f6c454",limbs:"#f6c454",belly:"#fde7b0",accent:"#fde7b0",outline:$},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:K},tail:"tuft",headExtras:["mane"],bodyExtras:[],extraColors:["#c8692e"]},{id:"unicorn",name:{en:"Unicorn",it:"Unicorno"},band:"6-8",palette:{body:"#fbf5ff",limbs:"#fbf5ff",belly:"#efe0ff",accent:"#fbd46a",outline:$,hands:"#c9a6f2",feet:"#c9a6f2"},head:"tall",ears:"unicorn",face:{eyes:"dot",mouth:"smile",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["rainbow-mane"],bodyExtras:[],extraColors:["#f58cc0","#8fd3f4","#a98ff2"]},{id:"dragon",name:{en:"Little Dragon",it:"Draghetto"},band:"6-8",palette:{body:"#8a63d2",limbs:"#8a63d2",belly:"#fbd46a",accent:"#5fd0b5",outline:$},head:"wide",ears:"horns",face:{eyes:"big",eyeColor:"#3a2a6a",mouth:"teeth",muzzle:"none",cheeks:"#f59bc0"},tail:"arrow",headExtras:[],bodyExtras:["wings"]},{id:"robot",name:{en:"Robot",it:"Robot"},band:"9-12",palette:{body:"#b9c7d2",limbs:"#8b9aa6",belly:"#b9c7d2",accent:"#ee6a43",outline:G,hands:"#ee6a43",feet:"#6b7a86"},head:"square",ears:"antenna",face:{eyes:"screen",eyeColor:"#7ff0ff",mouth:"grill",muzzle:"none"},tail:"none",headExtras:["bolts"],bodyExtras:["panel","joints","boots"],extraColors:["#ff7a6b","#fbd46a","#7ff0ff"]},{id:"astronaut",name:{en:"Astronaut",it:"Astronauta"},band:"9-12",palette:{body:"#f4f1ec",limbs:"#f4f1ec",belly:"#f4f1ec",accent:"#ee6a43",outline:G,hands:"#9fb0bd",feet:"#9fb0bd"},head:"round",ears:"none",face:{eyes:"visor",mouth:"smile",muzzle:"none"},tail:"none",headExtras:["helmet"],bodyExtras:["backpack","badge","boots"],extraColors:["#c9d3db"]},{id:"dinosaur",name:{en:"Dinosaur",it:"Dinosauro"},band:"6-8",palette:{body:"#3fb3a6",limbs:"#3fb3a6",belly:"#c9f0d6",accent:"#f79a3e",outline:$},head:"wide",ears:"none",face:{eyes:"dot",mouth:"teeth",muzzle:"none",cheeks:"#f59b8f"},tail:"spiky",headExtras:["spikes","spots"],bodyExtras:[],extraColors:["#2b8f84","#7fd3c6"]},{id:"monkey",name:{en:"Monkey",it:"Scimmietta"},band:"6-8",palette:{body:"#7b5234",limbs:"#7b5234",belly:"#f2c9a0",accent:"#f2c9a0",outline:$,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:K},tail:"curl",headExtras:["tuft"],bodyExtras:[]},{id:"koala",name:{en:"Koala",it:"Koala"},band:"3-5",palette:{body:"#b7bcc6",limbs:"#b7bcc6",belly:"#eef0f3",accent:"#f4dbe2",outline:_},head:"wide",ears:"big-round",face:{eyes:"dot",mouth:"smile",nose:"#3b3438",muzzle:"none",cheeks:"#f4a3b0"},tail:"none",headExtras:[],bodyExtras:[]},{id:"tiger",name:{en:"Tiger",it:"Tigrotto"},band:"6-8",palette:{body:"#f9a33a",limbs:"#f9a33a",belly:"#fff1dc",accent:"#fff1dc",outline:$},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:K},tail:"striped",headExtras:["stripes","whiskers"],bodyExtras:[],extraColors:["#3a2a22"]},{id:"owl",name:{en:"Owl",it:"Gufetto"},band:"3-5",palette:{body:"#8ec0e6",limbs:"#8ec0e6",belly:"#e3f2fc",accent:"#639cc9",outline:_,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:_,eyeRing:"#fde08a",mouth:"beak",muzzle:"none",cheeks:"#f6a8b4"},tail:"none",headExtras:[],bodyExtras:["feathers"]},{id:"alien",name:{en:"Alien",it:"Alieno"},band:"9-12",palette:{body:"#9ee05a",limbs:"#9ee05a",belly:"#d8f5a8",accent:"#b07cf2",outline:G},head:"bulb",ears:"antennae",face:{eyes:"almond",eyeColor:"#1e1838",mouth:"smirk",muzzle:"none"},tail:"none",headExtras:[],bodyExtras:["spots"],extraColors:["#7cc23e","#7cc23e"]},{id:"ghost",name:{en:"Friendly Ghost",it:"Fantasmino"},band:"6-8",palette:{body:"#e6f4ff",limbs:"#e6f4ff",belly:"#e6f4ff",accent:"#bcd9f2",outline:$},head:"round",ears:"none",face:{eyes:"dot",mouth:"open",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["curl"],bodyExtras:["sheet"]},{id:"octopus",name:{en:"Octopus",it:"Polpetto"},band:"6-8",palette:{body:"#e0578a",limbs:"#e0578a",belly:"#f7b3cc",accent:"#f7b3cc",outline:$,hands:"#f7b3cc",feet:"#f7b3cc"},head:"tall",ears:"none",face:{eyes:"big",eyeColor:"#3a2140",mouth:"smile",muzzle:"none",cheeks:"#ffd0a0"},tail:"none",headExtras:["spots"],bodyExtras:["tentacles"],extraColors:["#f7b3cc","#f7b3cc"]},{id:"chick",name:{en:"Chick",it:"Pulcino"},band:"3-5",palette:{body:"#ffd45e",limbs:"#ffd45e",belly:"#fff2c2",accent:"#ffa04a",outline:_,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:K},tail:"none",headExtras:["eggshell"],bodyExtras:[],extraColors:["#fffaf0"]},{id:"puppy",name:{en:"Puppy",it:"Cucciolo"},band:"3-5",palette:{body:"#f4e4cf",limbs:"#f4e4cf",belly:"#fffaf2",accent:"#f29aa4",outline:_,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:he,muzzle:"oval",cheeks:K},tail:"curl",headExtras:["eye-spot"],bodyExtras:[]},{id:"lamb",name:{en:"Lamb",it:"Agnellino"},band:"3-5",palette:{body:"#fdf8ee",limbs:"#e3d1c2",belly:"#fffdf8",accent:"#f6bcc2",outline:_,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:K},tail:"pom",headExtras:["wool"],bodyExtras:["wool"]},{id:"duckling",name:{en:"Duckling",it:"Anatroccolo"},band:"3-5",palette:{body:"#fff1a6",limbs:"#fff1a6",belly:"#fffbe0",accent:"#ff9f43",outline:_,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:K},tail:"none",headExtras:["curl"],bodyExtras:["flippers","scarf"],extraColors:["#86cfe0"]},{id:"shark",name:{en:"Shark",it:"Squalo"},band:"6-8",palette:{body:"#6c95c4",limbs:"#6c95c4",belly:"#eef5fb",accent:"#4c76a8",outline:$,hands:"#eef5fb",feet:"#4c76a8"},head:"wide",ears:"fin",face:{eyes:"dot",mouth:"jaws",muzzle:"none",cheeks:"#f59bb0"},tail:"fish",headExtras:["gills"],bodyExtras:[]},{id:"wolf",name:{en:"Wolf",it:"Lupo"},band:"6-8",palette:{body:"#8f9bb3",limbs:"#8f9bb3",belly:"#eef1f6",accent:"#f3b8c4",outline:$,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:he,muzzle:"oval",cheeks:"#f4a3b0"},tail:"fluffy",headExtras:["ruff","forehead"],bodyExtras:[],extraColors:["#636d84"]},{id:"parrot",name:{en:"Parrot",it:"Pappagallo"},band:"6-8",palette:{body:"#e8503f",limbs:"#e8503f",belly:"#ffd25a",accent:"#f6e6c4",outline:$,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:$,eyeRing:"#ffffff",mouth:"hook",muzzle:"none",cheeks:"#ffb0a0"},tail:"plume",headExtras:["crest"],bodyExtras:["feathers"],extraColors:["#ffd25a","#3fae5a","#3a9bdc"]},{id:"ninja",name:{en:"Ninja",it:"Ninja"},band:"9-12",palette:{body:"#2f3a56",limbs:"#2f3a56",belly:"#2f3a56",accent:"#36c9bb",outline:G,skin:"#b07a52",hands:"#222a40",feet:"#222a40"},head:"round",ears:"none",face:{eyes:"calm",mouth:"none",muzzle:"none",brows:"#2a1d16"},tail:"none",headExtras:["ninja-hood"],bodyExtras:["belt"],extraColors:["#36c9bb","#36c9bb","#36c9bb"]},{id:"skater",name:{en:"Skater",it:"Skater"},band:"9-12",palette:{body:"#3a8fc0",limbs:"#2c3e57",belly:"#2f7aa6",accent:"#ffcf3a",outline:G,skin:"#f2c9a5",hair:"#7a4a2a",hands:"#f2c9a5",feet:"#eef1f5"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#5a3520"},tail:"none",headExtras:["hair","cap"],bodyExtras:["pocket","joints"],extraColors:["#ff5d73"]},{id:"explorer",name:{en:"Explorer",it:"Giramondo"},band:"9-12",palette:{body:"#5f8f5b",limbs:"#5f8f5b",belly:"#5f8f5b",accent:"#d9bb7e",outline:G,skin:"#7a4a30",hair:"#1d1410",hands:"#7a4a30",feet:"#6b4a2a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#1d1410"},tail:"none",headExtras:["curls","safari-hat"],bodyExtras:["backpack","straps","boots"],extraColors:["#e07b39","#6b4a2a"]},{id:"wizard",name:{en:"Wizard",it:"Mago"},band:"9-12",palette:{body:"#5b3fa0",limbs:"#5b3fa0",belly:"#5b3fa0",accent:"#3d5fc8",outline:G,skin:"#c98d62",hair:"#a8452a",hands:"#c98d62",feet:"#33255e"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#7a301c"},tail:"none",headExtras:["locks","wizard-hat"],bodyExtras:["robe","belt"],extraColors:["#ffd84a","#ffd84a","#ffd84a"]},{id:"knight",name:{en:"Knight",it:"Cavaliere"},band:"9-12",palette:{body:"#bcc7d3",limbs:"#8e9aa8",belly:"#dce3ea",accent:"#d8443a",outline:G,hands:"#6c7786",feet:"#6c7786"},head:"bucket",ears:"none",face:{eyes:"slit",eyeColor:"#bfefff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["plume"],bodyExtras:["pauldrons","emblem","boots"],extraColors:["#d8443a"]},{id:"racer",name:{en:"Racer",it:"Pilota"},band:"9-12",palette:{body:"#ff6a2b",limbs:"#ff6a2b",belly:"#ffffff",accent:"#ffffff",outline:G,hands:"#232838",feet:"#232838"},head:"round",ears:"none",face:{eyes:"goggle",eyeColor:"#7fd6ff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["stripe"],bodyExtras:["racing-stripe","boots"]},{id:"pirate",name:{en:"Pirate",it:"Pirata"},band:"9-12",palette:{body:"#f2efe6",limbs:"#2a3d6e",belly:"#f2efe6",accent:"#d94545",outline:G,skin:"#d9a072",hair:"#2b1a12",hands:"#d9a072",feet:"#3a2a20"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#2b1a12"},tail:"none",headExtras:["locks","bandana","eye-patch"],bodyExtras:["stripes","belt","boots"],extraColors:["#d94545","#2a3d6e","#4a3426"]},{id:"diver",name:{en:"Diver",it:"Sub"},band:"9-12",palette:{body:"#1f6582",limbs:"#1f6582",belly:"#1f6582",accent:"#ffb020",outline:G,skin:"#e8b48a",hair:"#c98f2e",hands:"#1b4f66",feet:"#ffb020"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#8a5a1a"},tail:"none",headExtras:["curls","dive-mask"],bodyExtras:["tank","fins"],extraColors:["#c9d3db"]},{id:"hero",name:{en:"Hero",it:"Supereroe"},band:"9-12",palette:{body:"#3557c8",limbs:"#3557c8",belly:"#3557c8",accent:"#e0403a",outline:G,skin:"#5a3825",hair:"#141010",hands:"#e0403a",feet:"#e0403a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#141010"},tail:"none",headExtras:["hair","domino"],bodyExtras:["cape","emblem","boots"],extraColors:["#ffd84a"]}];var R={M:0,L:1,Q:2,C:3,Z:4},at=[2,2,4,6,0];function se(n,e){for(let t of e)jt(n,t)}function jt(n,e){if(e.k==="group"){n.save(),n.translate(e.x,e.y),e.rot&&n.rotate(e.rot),e.s!==void 0&&e.s!==1&&n.scale(e.s,e.s),e.alpha!==void 0&&(n.globalAlpha*=e.alpha),se(n,e.items),n.restore();return}switch(n.save(),e.alpha!==void 0&&(n.globalAlpha*=e.alpha),n.beginPath(),e.k){case"circle":n.arc(e.x,e.y,Math.max(e.r,0),0,Math.PI*2);break;case"ellipse":n.ellipse(e.x,e.y,Math.max(e.rx,0),Math.max(e.ry,0),e.rot??0,0,Math.PI*2);break;case"rect":Wt(n,e);break;case"path":typeof e.d=="string"?qt(n,e.d):Xt(n,e.d);break;case"line":n.moveTo(e.pts[0]??0,e.pts[1]??0);for(let t=2;t+1<e.pts.length;t+=2)n.lineTo(e.pts[t],e.pts[t+1]);break}n.lineCap="round",n.lineJoin="round",e.fill&&e.k!=="line"&&(n.fillStyle=e.fill,n.fill()),e.stroke&&(e.lw??1)>0&&(n.strokeStyle=e.stroke,n.lineWidth=e.lw??1,n.stroke()),n.restore()}function Wt(n,e){let t=Math.max(0,Math.min(e.r,e.w/2,e.h/2));n.translate(e.x,e.y),e.rot&&n.rotate(e.rot);let r=-e.w/2,a=-e.h/2;n.moveTo(r+t,a),n.lineTo(r+e.w-t,a),n.quadraticCurveTo(r+e.w,a,r+e.w,a+t),n.lineTo(r+e.w,a+e.h-t),n.quadraticCurveTo(r+e.w,a+e.h,r+e.w-t,a+e.h),n.lineTo(r+t,a+e.h),n.quadraticCurveTo(r,a+e.h,r,a+e.h-t),n.lineTo(r,a+t),n.quadraticCurveTo(r,a,r+t,a),n.closePath()}function Xt(n,e){for(let t=0;t<e.length;){let r=e[t++];if(r===R.M)n.moveTo(e[t],e[t+1]);else if(r===R.L)n.lineTo(e[t],e[t+1]);else if(r===R.Q)n.quadraticCurveTo(e[t],e[t+1],e[t+2],e[t+3]);else if(r===R.C)n.bezierCurveTo(e[t],e[t+1],e[t+2],e[t+3],e[t+4],e[t+5]);else if(r===R.Z)n.closePath();else return;t+=at[r]}}function Ie(n){if(typeof n=="string")return(n.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);let e=[];for(let t=0;t<n.length;){let r=at[n[t++]];if(r===void 0)break;for(let a=0;a<r;a++)e.push(n[t+a]);t+=r}return e}function qt(n,e){let t=e.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[],r="",a=0,o=()=>Number(t[a++]);for(;a<t.length;){let s=t[a];if(/[MLQCZ]/i.test(s)&&(r=s.toUpperCase(),a++,r==="Z")){n.closePath();continue}r==="M"?(n.moveTo(o(),o()),r="L"):r==="L"?n.lineTo(o(),o()):r==="Q"?n.quadraticCurveTo(o(),o(),o(),o()):r==="C"?n.bezierCurveTo(o(),o(),o(),o(),o(),o()):a++}}var B=n=>{let e=Math.round(n*100)/100;return e===0?0:e};function T(n,e=.5){let t=n.length;if(t<3)return[];let r=(u,l,p)=>({x:u.x+(l.x-u.x)*p,y:u.y+(l.y-u.y)*p}),a=Math.min(Math.max(e,0),.5),o=r(n[0],n[1],a),s=[R.M,B(o.x),B(o.y)];for(let u=1;u<=t;u++){let l=n[(u-1)%t],p=n[u%t],i=n[(u+1)%t],f=r(l,p,1-a),c=r(p,i,a);s.push(R.L,B(f.x),B(f.y),R.Q,B(p.x),B(p.y),B(c.x),B(c.y))}return s.push(R.Z),s}function C(n,e=1){let t=n.length;if(t<3)return[];let r=[R.M,B(n[0].x),B(n[0].y)],a=e/6;for(let o=0;o<t;o++){let s=n[(o-1+t)%t],u=n[o],l=n[(o+1)%t],p=n[(o+2)%t];r.push(R.C,B(u.x+(l.x-s.x)*a),B(u.y+(l.y-s.y)*a),B(l.x-(p.x-u.x)*a),B(l.y-(p.y-u.y)*a),B(l.x),B(l.y))}return r.push(R.Z),r}function ie(n){let e=n.length;if(e<2)return[];let t=[R.M,B(n[0].x),B(n[0].y)];for(let r=0;r<e-1;r++){let a=n[Math.max(r-1,0)],o=n[r],s=n[r+1],u=n[Math.min(r+2,e-1)];t.push(R.C,B(o.x+(s.x-a.x)/6),B(o.y+(s.y-a.y)/6),B(s.x-(u.x-o.x)/6),B(s.y-(u.y-o.y)/6),B(s.x),B(s.y))}return t}var J="M0 -1 L0.29 -0.4 L0.95 -0.31 L0.47 0.15 L0.59 0.81 L0 0.5 L-0.59 0.81 L-0.47 0.15 L-0.95 -0.31 L-0.29 -0.4 Z";var I="#ffffff",v=[-1,1],st="#3a2420",Zt="#f2808f",Le="#26324a",Jt="#ffd84a",N=(...n)=>{let e=[];for(let t=0;t+1<n.length;t+=2)e.push({x:n[t],y:n[t+1]});return e};function we(n,e){let t=n.palette,r=[],a={stroke:t.outline,lw:e},o=i=>n.headExtras.includes(i),s=(i,f)=>n.extraColors?.[i]??f;if(o("mane")){for(let f=0;f<12;f++){let c=f/12*Math.PI*2;r.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:s(0,t.accent),...a})}r.push({k:"circle",x:0,y:.04,r:1.08,fill:s(0,t.accent)})}if(o("rainbow-mane")){let i=n.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,x,d,m,h],b)=>r.push({k:"ellipse",x:c,y:x,rx:d,ry:m,rot:h,fill:i[b%i.length],...a}))}if(o("spikes"))for(let i of[-.55,0,.55]){let f=me(i,1.48),c=me(i-.32,.86),x=me(i+.32,.86);r.push({k:"path",d:T([c,f,x],.22),fill:t.accent,...a})}if(o("curl")&&r.push({k:"path",d:C([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:t.body,...a}),o("wool"))for(let i=0;i<=8;i++){let f=-1.75+i/8*3.5;r.push({k:"circle",x:Math.sin(f)*.98,y:-Math.cos(f)*.92-.04,r:.34,fill:t.body,...a})}if(o("crest")&&[-.38,0,.38].forEach((i,f)=>{let c=me(i,1.12);r.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:i,fill:s(f,t.accent),...a})}),o("plume")&&r.push({k:"path",d:C(N(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:t.accent,...a}),o("locks")&&r.push({k:"path",d:C(N(-1.14,.58,-1.24,-.2,-.86,-.98,0,-1.2,.86,-.98,1.24,-.2,1.14,.58,.8,.66,0,.2,-.8,.66)),fill:t.hair??t.outline,...a}),o("ninja-hood"))for(let[i,f]of[[.35,.5],[.85,.42]])r.push({k:"ellipse",x:1+Math.cos(i)*f*.8,y:-.5+Math.sin(i)*f*.8,rx:f,ry:.11,rot:i,fill:t.accent,...a});if(o("bandana"))for(let[i,f]of[[Math.PI-.5,.42],[Math.PI-1,.36]])r.push({k:"ellipse",x:-.98+Math.cos(i)*f*.8,y:-.36+Math.sin(i)*f*.8,rx:f,ry:.12,rot:i,fill:t.accent,...a});if(o("ruff"))for(let i of v)r.push({k:"path",d:T(N(i*.7,-.3,i*1.32,0,i*1.02,.18,i*1.26,.46,i*.86,.56,i*.98,.84,i*.4,.7),.25),fill:t.body,...a});if(n.face.eyesOnTop)for(let i of v)r.push({k:"circle",x:i*.46,y:-.72,r:.38,fill:t.body,...a});r.push(...rn(n,e)),r.push(en(n,a));let u=n.face.muzzle,l=t.belly;if(u==="oval"&&r.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:l}),u==="monkey"){for(let i of v)r.push({k:"circle",x:i*.32,y:-.04,r:.38,fill:l});r.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:l})}if(u==="heart"){for(let i of v)r.push({k:"circle",x:i*.36,y:.02,r:.5,fill:l});r.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:l})}if(u==="disc")for(let i of v)r.push({k:"circle",x:i*.4,y:.02,r:.44,fill:l});if(u==="cheeks")for(let i of v)r.push({k:"ellipse",x:i*.4,y:.44,rx:.44,ry:.32,fill:l});if(u==="band"&&r.push({k:"path",d:nn(n,e),fill:l}),o("stripes")){let i=s(0,t.outline);r.push({k:"line",pts:[0,-.97,0,-.66],stroke:i,lw:.13});for(let f of v)r.push({k:"line",pts:[f*.3,-.93,f*.24,-.7],stroke:i,lw:.1}),r.push({k:"line",pts:[f*.98,-.05,f*.74,0],stroke:i,lw:.1}),r.push({k:"line",pts:[f*.94,.22,f*.74,.22],stroke:i,lw:.09})}if(o("spots")){let i=s(1,t.belly);r.push({k:"circle",x:-.55,y:-.5,r:.15,fill:i}),r.push({k:"circle",x:.58,y:-.42,r:.11,fill:i}),r.push({k:"circle",x:.22,y:-.76,r:.09,fill:i})}if(o("forehead")&&r.push({k:"path",d:C(N(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:s(0,t.accent)}),o("eye-spot")&&r.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:t.ears??t.accent}),o("gills"))for(let i of v)for(let f of[0,.12,.24])r.push({k:"path",d:`M${i*(.66+f)} 0.06 Q${i*(.6+f)} 0.22 ${i*(.66+f)} 0.38`,stroke:t.accent,lw:e*.9});let p=t.hair??t.outline;if(o("hair")&&r.push({k:"path",d:C(N(-1.02,-.06,-1.02,-.58,-.62,-1.04,.08,-1.14,.76,-.92,1.05,-.42,1,-.06,.84,-.4,.42,-.5,.06,-.4,-.34,-.56,-.74,-.38)),fill:p,...a}),o("locks")&&r.push({k:"path",d:C(N(-1,-.08,-.98,-.62,-.56,-1.02,0,-1.1,.56,-1.02,.98,-.62,1,-.08,.8,-.38,.36,-.44,0,-.4,-.36,-.44,-.8,-.38)),fill:p,...a}),o("curls")){for(let i=0;i<7;i++){let f=me(-1.3+i/6*2.6,.86);r.push({k:"circle",x:f.x,y:f.y,r:.3,fill:p,...a})}r.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:p})}if(o("ninja-hood")&&(r.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:t.skin??I,stroke:t.outline,lw:e*.8}),r.push({k:"path",d:"M-0.98 -0.42 Q0 -0.74 0.98 -0.42 L1.0 -0.62 Q0 -0.94 -1.0 -0.62 Z",fill:t.accent,...a})),o("domino")){r.push({k:"path",d:C(N(-.86,-.04,-.62,-.3,-.18,-.24,0,-.16,.18,-.24,.62,-.3,.86,-.04,.6,.22,.16,.16,0,.1,-.16,.16,-.6,.22),.9),fill:t.accent,...a});for(let i of v)r.push({k:"ellipse",x:i*.38,y:0,rx:.19,ry:.13,fill:I})}if(r.push(...on(n,e)),o("brows"))for(let i of v)r.push({k:"line",pts:[i*.72,-.5,i*.14,-.3],stroke:t.accent,lw:.16});if(n.face.brows)for(let i of v)r.push({k:"line",pts:[i*.2,-.2,i*.54,-.28],stroke:n.face.brows,lw:.09});if(r.push(...an(n,e)),n.face.cheeks)for(let i of v)r.push({k:"ellipse",x:i*.64,y:.3,rx:.15,ry:.1,fill:n.face.cheeks,alpha:.8});if(o("whiskers"))for(let i of v)for(let f of[-.1,.06])r.push({k:"line",pts:[i*.62,.38+f,i*1.06,.3+f*2.2],stroke:t.outline,lw:e*.7,alpha:.75});if(o("rainbow-mane")){let i=n.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];r.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:i[0],...a}),r.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:i[1%i.length],...a})}if(n.ears==="unicorn"){let i=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];r.push({k:"path",d:T(i,.12),fill:t.accent,...a});for(let f of[-1,-1.2,-1.4]){let c=.16*((f+1.72)/.88);r.push({k:"line",pts:[-c,f+.04,c,f-.04],stroke:t.outline,lw:e*.7,alpha:.6})}}if(o("helmet")){for(let i of v)r.push({k:"rect",x:i*1,y:.05,w:.26,h:.56,r:.12,fill:t.accent,...a});r.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:I,lw:.1,alpha:.9})}if(o("bolts"))for(let i of v)r.push({k:"rect",x:i*1.08,y:.08,w:.2,h:.44,r:.08,fill:t.accent,...a});if(o("tuft")&&r.push({k:"path",d:C([{x:-.26,y:-.95},{x:-.12,y:-1.22},{x:.02,y:-1.04},{x:.16,y:-1.28},{x:.28,y:-.95},{x:0,y:-.86}]),fill:t.body,...a}),o("eggshell")&&r.push({k:"path",d:"M-0.88 -0.5 C-0.88 -1.12 -0.46 -1.42 0 -1.42 C0.46 -1.42 0.88 -1.12 0.88 -0.5 L0.66 -0.66 L0.44 -0.48 L0.22 -0.66 L0 -0.48 L-0.22 -0.66 L-0.44 -0.48 L-0.66 -0.66 Z",fill:s(0,I),...a}),o("wool"))for(let[i,f]of[[-.36,-.84],[.02,-.94],[.4,-.82]])r.push({k:"circle",x:i,y:f,r:.27,fill:t.body,...a});if(o("stripe")&&r.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:t.accent}),o("eye-patch")&&(r.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:t.outline,lw:.07}),r.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:t.outline})),o("bandana")){r.push({k:"path",d:C(N(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:t.accent,...a});for(let[i,f]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])r.push({k:"circle",x:i,y:f,r:.06,fill:I,alpha:.85});r.push({k:"circle",x:-.98,y:-.34,r:.15,fill:t.accent,...a})}if(o("cap")){for(let i of v)r.push({k:"line",pts:[i*.98,-.2,i*.5,.82,-i*.05,.98],stroke:t.outline,lw:.06});r.push({k:"path",d:C(N(-1.1,-.16,-1.04,-.66,-.6,-1.12,0,-1.24,.6,-1.12,1.04,-.66,1.1,-.16,.5,-.4,-.5,-.4)),fill:t.accent,...a}),r.push({k:"path",d:"M-0.74 -0.4 Q0 -0.6 0.74 -0.4 Q0.8 -0.24 0.6 -0.22 Q0 -0.36 -0.6 -0.22 Q-0.8 -0.24 -0.74 -0.4 Z",fill:t.accent,...a}),r.push({k:"circle",x:.5,y:-.82,r:.15,fill:s(0,I),...a});for(let i of[-.42,-.14])r.push({k:"line",pts:[i,-1.04,i+.02,-.78],stroke:t.outline,lw:.07,alpha:.7})}if(o("safari-hat")&&(r.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:t.accent,...a}),r.push({k:"path",d:C(N(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:t.accent,...a}),r.push({k:"path",d:"M-0.77 -0.72 Q0 -0.62 0.77 -0.72 L0.74 -0.9 Q0 -0.8 -0.74 -0.9 Z",fill:s(1,t.outline),stroke:t.outline,lw:e*.8})),o("wizard-hat")){r.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:t.accent,...a}),r.push({k:"path",d:T(N(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:t.accent,...a});let i=s(0,Jt);for(let[f,c,x]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])r.push({k:"group",x:f,y:c,s:x,items:[{k:"path",d:J,fill:i}]})}if(o("dive-mask")){for(let f of v)r.push({k:"line",pts:[f*.7,-.04,f*1,-.12],stroke:t.outline,lw:.2},{k:"line",pts:[f*.7,-.04,f*1,-.12],stroke:t.accent,lw:.11});r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:t.outline,lw:.2}),r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:t.accent,lw:.11}),r.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:I,lw:.06,alpha:.9});let i="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";r.push({k:"path",d:i,stroke:t.outline,lw:.24},{k:"path",d:i,stroke:t.accent,lw:.13})}return r}function en(n,e){let t=n.headExtras.includes("ninja-hood")?n.palette.body:n.palette.skin??n.palette.body;switch(n.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:t,...e};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:t,...e};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:t,...e};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:t,...e};case"bucket":return{k:"path",d:T(N(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:t,...e};case"bulb":return{k:"path",d:C([{x:0,y:-1.02},{x:.86,y:-.74},{x:1.08,y:-.12},{x:.72,y:.62},{x:0,y:.92},{x:-.72,y:.62},{x:-1.08,y:-.12},{x:-.86,y:-.74}]),fill:t,...e}}}function tn(n){return n.head==="round"?{cy:0,rx:1,ry:1}:n.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function nn(n,e){let{cy:t,rx:r,ry:a}=tn(n),o=r-e/2,s=a-e/2,u=.15,l=Math.asin(Math.min(1,(u-t)/s)),p=Math.cos(l)*o,i=d=>Math.round(d*100)/100||0,f=[R.M,i(-p),u],c=[[-.84*p,.02,-.53*p,.06,-.32*p,.24],[-.17*p,.11,.17*p,.11,.32*p,.24],[.53*p,.06,.84*p,.02,p,u]];for(let d of c)f.push(R.C,...d.map(i));let x=24;for(let d=1;d<=x;d++){let m=l+(Math.PI-2*l)*d/x;f.push(R.L,i(Math.cos(m)*o),i(t+Math.sin(m)*s))}return f.push(R.Z),f}function rn(n,e){let t=n.palette,r={stroke:t.outline,lw:e},a=[];for(let o of v)switch(n.ears){case"pointy":case"unicorn":{let s=n.ears==="unicorn"?.8:1,u={x:o*.3,y:-.82},l={x:o*.86,y:-.82-.62*s},p={x:o*.94,y:-.36};a.push({k:"path",d:T([u,l,p],.2),fill:t.body,...r});let i={x:(u.x+l.x+p.x)/3,y:(u.y+l.y+p.y)/3},f=[u,l,p].map(c=>({x:i.x+(c.x-i.x)*.55,y:i.y+(c.y-i.y)*.55+.04}));a.push({k:"path",d:T(f,.25),fill:t.accent});break}case"round":a.push({k:"circle",x:o*.72,y:-.72,r:.36,fill:t.ears??t.body,...r}),t.ears||a.push({k:"circle",x:o*.74,y:-.74,r:.19,fill:t.accent});break;case"big-round":a.push({k:"circle",x:o*.96,y:-.46,r:.52,fill:t.body,...r}),a.push({k:"circle",x:o*1,y:-.44,r:.32,fill:t.accent});break;case"long":a.push({k:"ellipse",x:o*.38,y:-1.42,rx:.25,ry:.68,rot:o*.14,fill:t.body,...r}),a.push({k:"ellipse",x:o*.39,y:-1.36,rx:.12,ry:.48,rot:o*.14,fill:t.accent});break;case"side":a.push({k:"circle",x:o*1,y:.02,r:.34,fill:t.body,...r}),a.push({k:"circle",x:o*1.02,y:.02,r:.2,fill:t.belly});break;case"tufts":a.push({k:"path",d:T([{x:o*.3,y:-.84},{x:o*1.22,y:-1.12},{x:o*.92,y:-.42}],.16),fill:t.body,...r}),a.push({k:"line",pts:[o*.62,-.78,o*1,-.98],stroke:t.accent,lw:.08});break;case"antennae":{let s={x:o*.62,y:-1.42};a.push({k:"path",d:`M${o*.3} -0.8 Q${o*.36} -1.2 ${s.x} ${s.y}`,stroke:t.outline,lw:e*2.6}),a.push({k:"path",d:`M${o*.3} -0.8 Q${o*.36} -1.2 ${s.x} ${s.y}`,stroke:t.body,lw:e*1.2}),a.push({k:"circle",x:s.x,y:s.y,r:.17,fill:t.accent,...r});break}case"floppy":a.push({k:"ellipse",x:o*.96,y:.02,rx:.3,ry:.62,rot:-o*.36,fill:t.ears??t.body,...r});break;case"droopy":a.push({k:"ellipse",x:o*1.04,y:-.22,rx:.4,ry:.18,rot:o*.32,fill:t.skin??t.body,...r}),a.push({k:"ellipse",x:o*1.08,y:-.2,rx:.24,ry:.08,rot:o*.32,fill:t.accent});break;case"human":a.push({k:"ellipse",x:o*.98,y:.06,rx:.17,ry:.23,fill:t.skin??t.body,...r});break;case"horns":{let s=[{x:o*.3,y:-.84},{x:o*.6,y:-1.5},{x:o*.66,y:-.68}];a.push({k:"path",d:T(s,.18),fill:t.accent,...r});break}}return n.ears==="fin"&&a.push({k:"path",d:T(N(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:t.body,...r}),n.ears==="antenna"&&(a.push({k:"line",pts:[0,-.85,0,-1.42],stroke:t.outline,lw:e*2.6}),a.push({k:"line",pts:[0,-.85,0,-1.42],stroke:t.limbs,lw:e*1.2}),a.push({k:"circle",x:0,y:-1.5,r:.18,fill:t.accent,...r})),a}function on(n,e){let t=n.palette,r=n.face,a=[],o=t.outline,s=r.eyesOnTop?.46:.4,u=r.eyesOnTop?-.72:-.04,l=(p,i,f)=>({k:"circle",x:p,y:i,r:f,fill:I});switch(r.eyes){case"dot":for(let p of v)a.push({k:"ellipse",x:p*s,y:u,rx:.12,ry:.155,fill:o}),a.push(l(p*s+.04,u-.06,.045));break;case"bead":for(let p of v)a.push({k:"ellipse",x:p*s,y:u,rx:.16,ry:.22,fill:o}),a.push(l(p*s+.05,u-.08,.065));break;case"big":for(let p of v)r.eyeRing&&a.push({k:"circle",x:p*s,y:u,r:.36,fill:r.eyeRing,stroke:o,lw:e*.8}),a.push({k:"circle",x:p*s,y:u,r:.25,fill:I,stroke:o,lw:e*.8}),a.push({k:"circle",x:p*s+p*-.03,y:u+.03,r:.14,fill:r.eyeColor??o}),a.push(l(p*s+p*-.03+.05,u-.03,.05));break;case"mask":for(let p of v)a.push({k:"ellipse",x:p*.4,y:0,rx:.24,ry:.32,rot:p*-.55,fill:t.limbs}),a.push({k:"circle",x:p*.4,y:-.02,r:.11,fill:I}),a.push({k:"circle",x:p*.39,y:-0,r:.065,fill:o});break;case"screen":a.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:o,lw:e*.8});for(let p of v)a.push({k:"ellipse",x:p*.36,y:0,rx:.2,ry:.24,fill:r.eyeColor??"#7ff0ff",alpha:.3}),a.push({k:"ellipse",x:p*.36,y:0,rx:.12,ry:.16,fill:r.eyeColor??"#7ff0ff"});break;case"almond":for(let p of v)a.push({k:"ellipse",x:p*.42,y:-.02,rx:.3,ry:.2,rot:-p*.5,fill:r.eyeColor??o}),a.push(l(p*.42-p*.07,-.08,.07));break;case"calm":for(let p of v)a.push({k:"ellipse",x:p*.38,y:.02,rx:.085,ry:.12,fill:o}),a.push(l(p*.38+.03,-.02,.03));break;case"slit":a.push({k:"line",pts:[0,-.98,0,-.2],stroke:o,lw:e*.8,alpha:.5}),a.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:Le,stroke:o,lw:e*.8}),a.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:Le,stroke:o,lw:e*.8});for(let p of v){a.push({k:"ellipse",x:p*.4,y:-.04,rx:.12,ry:.07,fill:r.eyeColor??I});for(let i of[.36,.56])a.push({k:"circle",x:p*.42,y:i,r:.05,fill:o,alpha:.6})}break;case"goggle":for(let p of v)a.push({k:"circle",x:p*.9,y:0,r:.13,fill:t.accent,stroke:o,lw:e*.8});a.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:Le,stroke:o,lw:e*.8}),a.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:I,lw:.07,alpha:.8});for(let p of v)a.push({k:"path",d:`M${p*.5} 0.04 Q${p*.34} -0.08 ${p*.16} 0.02`,stroke:r.eyeColor??"#7fd6ff",lw:.08});for(let p of[-.18,0,.18])a.push({k:"line",pts:[p,.56,p,.72],stroke:o,lw:e*.8,alpha:.6});break;case"visor":a.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:o,lw:e*.8}),a.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:I,lw:.08,alpha:.7});for(let p of v)a.push({k:"ellipse",x:p*.28,y:.04,rx:.1,ry:.14,fill:r.eyeColor??"#cfeeff"});break}return a}function an(n,e){let t=n.palette,r=n.face,a=[],o=r.eyes==="visor"?"#cfeeff":st,s=e*1.05;switch(r.nose&&r.mouth!=="beak"&&(r.mouth==="cat"?a.push({k:"path",d:T([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:r.nose,stroke:r.nose,lw:e*.6}):n.ears==="big-round"?a.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:r.nose}):a.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:r.nose})),r.mouth){case"smile":a.push({k:"path",d:r.eyes==="visor"?"M-0.16 0.32 Q0 0.46 0.16 0.32":"M-0.17 0.42 Q0 0.58 0.17 0.42",stroke:o,lw:s});break;case"open":a.push({k:"path",d:"M-0.21 0.4 Q0 0.46 0.21 0.4 Q0.19 0.68 0 0.68 Q-0.19 0.68 -0.21 0.4 Z",fill:o,stroke:o,lw:e*.5}),a.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Zt});break;case"cat":a.push({k:"path",d:"M-0.19 0.4 Q-0.1 0.5 0 0.37 Q0.1 0.5 0.19 0.4",stroke:o,lw:s});break;case"beak":a.push({k:"path",d:T([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:t.accent,stroke:t.outline,lw:e*.8});break;case"teeth":a.push({k:"path",d:"M-0.36 0.34 Q0 0.44 0.36 0.34 Q0.28 0.66 0 0.66 Q-0.28 0.66 -0.36 0.34 Z",fill:o,stroke:o,lw:e*.5});for(let u of v)a.push({k:"rect",x:u*.12,y:.43,w:.1,h:.1,r:.03,fill:I});break;case"grill":a.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:t.outline,lw:e*.7});for(let u of[-.15,0,.15])a.push({k:"line",pts:[u,.51,u,.61],stroke:"#9fb0bd",lw:e*.6});break;case"tiny":a.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:o});break;case"smirk":a.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:o,lw:s});break;case"bill":a.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:t.accent,stroke:t.outline,lw:e*.8}),a.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:t.outline,lw:e*.7});for(let u of v)a.push({k:"circle",x:u*.1,y:.28,r:.03,fill:t.outline});break;case"hook":a.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:st}),a.push({k:"path",d:"M-0.3 0.12 Q0 -0.02 0.3 0.12 Q0.36 0.52 0.04 0.76 Q0.08 0.52 -0.08 0.46 Q-0.28 0.38 -0.3 0.12 Z",fill:t.accent,stroke:t.outline,lw:e*.8});break;case"jaws":{a.push({k:"path",d:"M-0.5 0.3 Q0 0.5 0.5 0.3 Q0.38 0.72 0 0.72 Q-0.38 0.72 -0.5 0.3 Z",fill:o,stroke:o,lw:e*.5});for(let u of[-.34,-.17,0,.17,.34]){let l=.3+.4*(u+.5)*(.5-u)-.01;a.push({k:"path",d:T(N(u-.075,l,u+.075,l,u,l+.13),.15),fill:I})}break}}return a}var me=(n,e)=>({x:Math.sin(n)*e,y:-Math.cos(n)*e});var ut=.5,Q={leftEye:2,rightEye:5,leftEar:7,rightEar:8},j={"3-5":{head:.75,neck:.74,arm:.3,leg:.36,hand:.19,foot:1.2,shoulderMin:.4,shoulderPad:.07,hipMin:.5,hipPad:.22,bottom:.26,bulge:1.12,armsOverHead:!0},"6-8":{head:.6,neck:.78,arm:.22,leg:.28,hand:.15,foot:1,shoulderMin:.34,shoulderPad:.04,hipMin:.4,hipPad:.16,bottom:.14,bulge:1.04,armsOverHead:!1},"9-12":{head:.5,neck:.92,arm:.17,leg:.21,hand:.125,foot:.9,shoulderMin:.36,shoulderPad:.07,hipMin:.32,hipPad:.08,bottom:.1,bulge:1,armsOverHead:!1}},ve="6-8",Ae=n=>n.band in j?n.band:ve,sn=j[ve].head,ft=.3,dt=.12,ln=.9,it=.5,lt=.65,cn=.35,pn=.2,un=.25,q=(n,e)=>({x:n.x-e.x,y:n.y-e.y}),U=(n,e)=>({x:n.x+e.x,y:n.y+e.y}),L=(n,e)=>({x:n.x*e,y:n.y*e}),ee=n=>Math.hypot(n.x,n.y),ct=(n,e)=>({x:(n.x+e.x)/2,y:(n.y+e.y)/2}),$e=n=>{let e=ee(n);return e>1e-9?{x:n.x/e,y:n.y/e}:{x:0,y:1}},fn=(...n)=>n.every(Number.isFinite),dn=n=>Math.atan2(Math.sin(n),Math.cos(n)),yn=(n,e,t)=>Math.min(Math.max(n,e),t);function yt(n,e,t=!1){return r=>{let a=n[r*3],o=n[r*3+1],s=n[r*3+2];return a===void 0||o===void 0||s===void 0||!fn(a,o,s)?{x:0,y:0,ok:!1}:{x:e.x+(t?1-a:a)*e.w,y:e.y+o*e.h,ok:s>=ut}}}function le(n,e,t={}){let r=yt(n,e,t.mirrored),a=r(P.leftShoulder),o=r(P.rightShoulder);if(!a.ok||!o.ok)return null;let s=r(P.leftHip),u=r(P.rightHip),l=ct(a,o),p=ee(q(o,a)),i=s.ok&&u.ok,f=$e(q(o,a));p<1e-6&&(f={x:1,y:0});let c,x,d;if(i){let Z=ct(s,u);x=ee(q(Z,l)),x>=p*un?c=$e(q(Z,l)):(c={x:-f.y,y:f.x},c.y<0&&(c=L(c,-1))),d=Math.max(x,p*1.15)}else c={x:-f.y,y:f.x},c.y<0&&(c=L(c,-1)),d=p*1.15,x=d;d=Math.max(d,1e-6);let m={x:c.y,y:-c.x},h=Math.atan2(m.y,m.x),b=L(c,-1),w=j[t.band??ve]??j[ve],D=w.head*d,V=U(l,L(b,D*w.neck)),ue=r(P.nose);if(ue.ok){let Z=U(ue,L(b,D*.15)),fe=L(q(Z,V),cn),Me=Math.min(1,D*pn/Math.max(ee(fe),1e-6));V=U(V,L(fe,Me))}return{S:l,r:m,d:c,U:d,L:x,hipsOk:i,head:V,headR:D,headRot:h+hn(n,r,h,d),angle:h}}function hn(n,e,t,r){let a=[[Q.leftEar,Q.rightEar],[Q.leftEye,Q.rightEye]];for(let[o,s]of a){let u=e(o),l=e(s);if(!u.ok||!l.ok||!(n[o*3+2]>=lt&&n[s*3+2]>=lt)||ee(q(l,u))<r*.05)continue;let p=dn(Math.atan2(l.y-u.y,l.x-u.x)-t),i=Math.max(Math.abs(p)-dt,0),f=yn((ln+it-Math.abs(p))/it,0,1);return Math.sign(p)*Math.min(i,ft)*f}return 0}function ce(n,e,t,r={}){let a=Ae(e),o=j[a],s=le(n,t,{...r,band:a});if(!s)return[];let u=yt(n,t,r.mirrored),l=e.palette,{S:p,r:i,d:f,U:c,L:x}=s,d=y=>e.bodyExtras.includes(y),m=Math.max(1.2,c*.045),h={stroke:l.outline,lw:m},b=(y,k)=>({x:p.x+i.x*y+f.x*k,y:p.y+i.y*y+f.y*k}),w=y=>y.map(([k,g])=>b(k,g)),D=u(P.leftShoulder),V=u(P.rightShoulder),ue=u(P.leftHip),Z=u(P.rightHip),fe=ee(q(V,D)),Me=s.hipsOk?ee(q(Z,ue)):fe*.7,S=Math.max(fe/2+o.shoulderPad*c,o.shoulderMin*c),O=Math.max(Me/2+o.hipPad*c,o.hipMin*c),F=-.1*c,te=x+o.bottom*c,W=[],xe=[],E=[],ke=[],He=[],_e=(y,k,g,M)=>{let A=k.flatMap(H=>[H.x,H.y]);y.push({k:"line",pts:A,stroke:l.outline,lw:g+m*2}),y.push({k:"line",pts:A,stroke:M,lw:g})},Rt=o.leg*c,zt=o.arm*c,Ve=Math.max(o.arm/.22,.9);if(s.hipsOk)for(let[y,k,g,M]of[[ue,P.leftKnee,P.leftAnkle,-1],[Z,P.rightKnee,P.rightAnkle,1]]){let A=u(k),H=u(g);if(!A.ok)continue;let Pe=U(y,L(f,-.12*c)),ne=H.ok?[Pe,A,H]:[Pe,A];_e(xe,ne,Rt,l.limbs),d("joints")&&xe.push({k:"circle",x:A.x,y:A.y,r:.15*c*Ve,fill:l.accent,...h}),H.ok&&xe.push(xn(e,H,s,M,m,o.foot))}for(let[y,k,g,M]of[[D,P.leftElbow,P.leftWrist,-1],[V,P.rightElbow,P.rightWrist,1]]){let A=u(k),H=u(g);if(d("pauldrons")){let re=U(y,L(f,.02*c));ke.push({k:"ellipse",x:re.x,y:re.y,rx:.25*c,ry:.17*c,rot:s.angle+M*.25,fill:l.body,...h});let ye=U(re,L(f,.05*c));ke.push({k:"ellipse",x:ye.x,y:ye.y,rx:.17*c,ry:.07*c,rot:s.angle+M*.25,fill:l.belly})}if(!A.ok)continue;let ne=o.armsOverHead&&(A.x-p.x)*f.x+(A.y-p.y)*f.y<-.25*c?He:ke,Ge=U(y,L(f,.04*c));if(_e(ne,H.ok?[Ge,A,H]:[Ge,A],zt,l.limbs),d("joints")&&ne.push({k:"circle",x:A.x,y:A.y,r:.13*c*Ve,fill:l.accent,...h}),!H.ok)continue;let de=$e(q(H,A)),Be=U(H,L(de,.05*c));if(d("feathers"))for(let re of[-.55,0,.55]){let ye=Math.cos(re),Ke=Math.sin(re)*M,Ce={x:de.x*ye-de.y*Ke,y:de.x*Ke+de.y*ye},Ue=U(Be,L(Ce,.16*c));ne.push({k:"ellipse",x:Ue.x,y:Ue.y,rx:.2*c,ry:.09*c,rot:Math.atan2(Ce.y,Ce.x),fill:l.hands??l.accent,...h})}ne.push({k:"circle",x:Be.x,y:Be.y,r:o.hand*c,fill:l.hands??l.limbs,...h})}if(d("wings"))for(let y of[-1,1]){let k=w([[y*S*.5,.05*c],[y*(S+.85*c),-.6*c],[y*(S+.72*c),.05*c],[y*(S+.45*c),-.02*c],[y*(S+.3*c),.32*c],[y*S*.6,.55*c]]);W.push({k:"path",d:T(k,.18),fill:l.accent,...h})}if(d("cape")){let y=x+.8*c,k=O+.36*c,g=w([[-S*.92,F+.04*c],[S*.92,F+.04*c],[S+.16*c,x*.5],[k,y],[k*.5,y-.1*c],[0,y],[-k*.5,y-.1*c],[-k,y],[-S-.16*c,x*.5]]);W.push({k:"path",d:C(g,.6),fill:l.accent,...h})}if(d("backpack")){let y=b(0,.35*c);W.push({k:"rect",x:y.x,y:y.y,w:S*2+.34*c,h:.8*c,r:.16*c,rot:s.angle,fill:e.extraColors?.[0]??l.limbs,...h})}if(d("tank")){let y=b(S*.95,.24*c),k=e.extraColors?.[0]??l.accent,g=b(S*.95,-.3*c);W.push({k:"rect",x:g.x,y:g.y,w:.14*c,h:.16*c,r:.04*c,rot:s.angle,fill:l.outline}),W.push({k:"rect",x:y.x,y:y.y,w:.34*c,h:1*c,r:.17*c,rot:s.angle,fill:k,...h})}if(s.hipsOk&&!r.portrait&&W.push(...kn(e,s,O,m)),d("tentacles")&&s.hipsOk)for(let y of[-1,1]){let k=w([[y*O*.7,x*.9],[y*(O+.22*c),x+.3*c],[y*(O+.48*c),x+.22*c],[y*(O+.5*c),x-.02*c],[y*(O+.34*c),x-.06*c]]);W.push({k:"path",d:ie(k),stroke:l.outline,lw:.2*c+m*2}),W.push({k:"path",d:ie(k),stroke:l.limbs,lw:.2*c})}let X=Math.max(S,O)*o.bulge;if(d("wool")){for(let[k,g]of[[S*.7,F+.02*c],[X,x*.3],[X*1.02,x*.62],[(X+O)/2,x*.92],[O*.55,te]])for(let M of[-1,1]){let A=b(M*k,g);E.push({k:"circle",x:A.x,y:A.y,r:.2*c,fill:l.body,...h})}let y=b(0,te+.02*c);E.push({k:"circle",x:y.x,y:y.y,r:.2*c,fill:l.body,...h})}if(d("robe")){let y=x+.58*c,k=O*1.4;E.push({k:"path",d:C(w([[-S,F],[0,F-.04*c],[S,F],[X,x*.55],[k,y],[0,y+.06*c],[-k,y],[-X,x*.55]]),.7),fill:l.body,...h});let g=w([[-k*.94,y-.1*c],[0,y-.04*c],[k*.94,y-.1*c]]);E.push({k:"path",d:ie(g),stroke:e.extraColors?.[0]??l.accent,lw:.07*c})}else if(d("sheet")){let y=x+.78*c,k=O*1.3;E.push({k:"path",d:C(w([[-S,F],[S,F],[X,x*.55],[k,y],[k*.5,y-.2*c],[0,y],[-k*.5,y-.2*c],[-k,y],[-X,x*.55]]),.9),fill:l.body,...h})}else E.push({k:"path",d:C(w([[-S,F],[0,F-.04*c],[S,F],[X,x*.55],[O,te],[0,te+.03*c],[-O,te],[-X,x*.55]]),.85),fill:l.body,...h});let Y=Math.min(S,O);if(d("pocket")){let y=b(0,x*.74);E.push({k:"rect",x:y.x,y:y.y,w:Y*1.3,h:.3*c,r:.1*c,rot:s.angle,fill:l.belly,stroke:l.outline,lw:m*.8})}else if(d("racing-stripe"))for(let y of[-.1,.1]){let k=b(y*c,F+.02*c),g=b(y*c,te-.04*c);E.push({k:"line",pts:[k.x,k.y,g.x,g.y],stroke:l.belly,lw:.1*c})}else if(l.belly&&l.belly!==l.body&&!d("panel")&&!d("sheet")&&!d("stripes")){let y=b(0,x*.58);E.push({k:"ellipse",x:y.x,y:y.y,rx:Y*.64,ry:Math.max(x*.36,.2*c),rot:s.angle,fill:l.belly})}if(d("spots")){let y=e.extraColors?.[1]??l.belly;for(let[k,g,M]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){let A=b(k*Y,g*x);E.push({k:"circle",x:A.x,y:A.y,r:M*c,fill:y})}}if(d("stripes")){let y=e.extraColors?.[1]??l.accent;for(let k of[.22,.44,.66]){let g=b(-Y*.98,x*k),M=b(Y*.98,x*k);E.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:y,lw:.1*c})}}if(d("straps")){let y=e.extraColors?.[1]??l.outline;for(let k of[-1,1]){let g=b(k*S*.62,F+.02*c),M=b(k*Y*.62,x*.72);E.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:l.outline,lw:.13*c+m*2}),E.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:y,lw:.13*c})}}if(d("belt")){let y=b(0,x*.9);E.push({k:"rect",x:y.x,y:y.y,w:O*1.92,h:.17*c,r:.06*c,rot:s.angle,fill:e.extraColors?.[2]??"#4a3426",...h}),E.push({k:"rect",x:y.x,y:y.y,w:.2*c,h:.19*c,r:.04*c,rot:s.angle,fill:"#ffd84a",...h})}if(d("emblem")){let y=b(0,x*.4),k=e.extraColors?.[0]??l.accent,g=T([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);E.push({k:"group",x:y.x,y:y.y,rot:s.angle,s:c,items:[{k:"path",d:g,fill:k,stroke:l.outline,lw:m/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:J,fill:k===l.accent?"#ffffff":l.accent}]}]})}if(d("panel")){let y=b(0,x*.5);E.push({k:"rect",x:y.x,y:y.y,w:Y*1.2,h:.38*c,r:.1*c,rot:s.angle,fill:"#24323d",...h}),(e.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((g,M)=>{let A=b((M-1)*Y*.34,x*.5);E.push({k:"circle",x:A.x,y:A.y,r:.075*c,fill:g})})}if(d("badge")){let y=b(-Y*.42,x*.36);E.push({k:"circle",x:y.x,y:y.y,r:.15*c,fill:l.accent,...h}),E.push({k:"group",x:y.x,y:y.y,rot:s.angle,s:.09*c,items:[{k:"path",d:J,fill:"#ffffff"}]})}if(d("star")){let y=b(-Y*.5,x*.3),k=.15*c;E.push({k:"group",x:y.x,y:y.y,rot:s.angle-.2,s:k,items:[{k:"path",d:J,fill:e.extraColors?.[0]??"#ffd84a",stroke:l.outline,lw:m*.8/k}]})}if(d("scarf")){let y=Math.max(.04,o.head*(1-o.neck)-.06)*c,k=b(0,y),g=e.extraColors?.[0]??l.accent,M=b(S*.45,y+.28*c);E.push({k:"rect",x:M.x,y:M.y,w:.16*c,h:.42*c,r:.06*c,rot:s.angle+.15,fill:g,...h}),E.push({k:"rect",x:k.x,y:k.y,w:S*2.05,h:.2*c,r:.1*c,rot:s.angle,fill:g,...h})}let Ot={k:"group",x:s.head.x,y:s.head.y,rot:s.headRot,s:s.headR,items:bn(e,m/s.headR)};return[...W,...xe,...E,...ke,Ot,...He]}var pt=new WeakMap,mn=64;function bn(n,e){let t=Number(e.toPrecision(4)),r=pt.get(n);r||pt.set(n,r=new Map);let a=r.get(t);return a||(r.size>=mn&&r.clear(),r.set(t,a=we(n,t))),a}function xn(n,e,t,r,a,o){let s=n.palette,{d:u,r:l}=t,p=t.U*o,i=U(U(e,L(u,.07*p)),L(l,r*.06*p)),f={stroke:s.outline,lw:a},c=s.feet??s.limbs;if(n.bodyExtras.includes("fins")){let x=T([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:i.x,y:i.y,rot:t.angle,s:p,items:[{k:"path",d:x,fill:c,stroke:s.outline,lw:a/p},{k:"line",pts:[0,.06,0,.38],stroke:s.outline,lw:a/p,alpha:.5}]}}return n.bodyExtras.includes("flippers")?{k:"ellipse",x:i.x,y:i.y,rx:.27*p,ry:.11*p,rot:t.angle,fill:c,...f}:n.bodyExtras.includes("boots")?{k:"rect",x:i.x,y:i.y,w:.4*p,h:.24*p,r:.09*p,rot:t.angle,fill:c,...f}:{k:"ellipse",x:i.x,y:i.y,rx:.2*p,ry:.13*p,rot:t.angle,fill:c,...f}}function kn(n,e,t,r){let a=n.palette,{U:o,L:s,S:u,r:l,d:p}=e,i=(m,h)=>({x:u.x+l.x*m+p.x*h,y:u.y+l.y*m+p.y*h}),f=m=>m.map(([h,b])=>i(h,b)),c={stroke:a.outline,lw:r},x=(m,h,b)=>[{k:"path",d:ie(m),stroke:a.outline,lw:h+r*2},{k:"path",d:ie(m),stroke:b,lw:h}],d=[];switch(n.tail){case"none":break;case"fluffy":{let m=f([[t*.5,s*.95],[t+.28*o,s*1],[t+.72*o,s*.62],[t+.78*o,s*.12],[t+.52*o,s*.32],[t+.3*o,s*.6],[t*.6,s*.7]]);d.push({k:"path",d:C(m),fill:a.body,...c});let h=i(t+.72*o,s*.2);d.push({k:"ellipse",x:h.x,y:h.y,rx:.13*o,ry:.2*o,rot:e.angle+.25,fill:a.belly,...c});break}case"brush":{let m=f([[t*.4,s*.98],[t+.42*o,s*1.06],[t+.98*o,s*.66],[t+1.06*o,s*.12],[t+.86*o,-.04*o],[t+.66*o,s*.36],[t+.3*o,s*.66],[t*.5,s*.68]]);d.push({k:"path",d:C(m),fill:a.body,...c});let h=f([[t+1.03*o,s*.36],[t+1.06*o,s*.12],[t+.86*o,-.04*o],[t+.72*o,s*.24],[t+.86*o,s*.34]]);d.push({k:"path",d:C(h),fill:a.belly,...c});break}case"pom":{let m=i(t+.06*o,s*.88);d.push({k:"circle",x:m.x,y:m.y,r:.2*o,fill:a.belly,...c});break}case"long":case"striped":case"tuft":{let m=f([[t*.6,s*.9],[t+.35*o,s*.85],[t+.58*o,s*.4],[t+.5*o,-.02*o]]);if(d.push(...x(m,.14*o,a.body)),n.tail==="tuft"){let h=m[m.length-1];d.push({k:"circle",x:h.x,y:h.y,r:.16*o,fill:n.extraColors?.[0]??a.accent,...c})}if(n.tail==="striped"){for(let b of[.35,.6,.85]){let w=i(t+.35*o+.22999999999999998*o*(b*1.4>1?1:b*1.4),s*(.85-.85*b));d.push({k:"line",pts:[w.x-l.x*.08*o,w.y-l.y*.08*o,w.x+l.x*.08*o,w.y+l.y*.08*o],stroke:n.extraColors?.[0]??a.outline,lw:.06*o})}let h=m[m.length-1];d.push({k:"circle",x:h.x,y:h.y,r:.07*o,fill:n.extraColors?.[0]??a.outline})}break}case"curl":{let m=f([[t*.6,s*.9],[t+.4*o,s*.88],[t+.62*o,s*.45],[t+.5*o,s*.12],[t+.3*o,s*.24],[t+.36*o,s*.42]]);d.push(...x(m,.12*o,a.limbs));break}case"fish":{let m=f([[t*.6,s*.9],[t+.36*o,s*.86],[t+.6*o,s*.5]]);d.push(...x(m,.17*o,a.body));let h=m[m.length-1],b=T([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);d.push({k:"group",x:h.x,y:h.y,rot:e.angle+.35,s:o,items:[{k:"path",d:b,fill:a.body,stroke:a.outline,lw:r/o}]});break}case"plume":{let m=n.extraColors??[a.accent];[0,1,2].forEach(h=>{let b=i(t+(.12+h*.13)*o,s+(.32-h*.06)*o);d.push({k:"ellipse",x:b.x,y:b.y,rx:.11*o,ry:.44*o,rot:e.angle-.55+h*.28,fill:m[(h+1)%m.length],...c})});break}case"spiky":case"arrow":{let m=f([[t*.3,s*.55],[t+.35*o,s*.68],[t+.95*o,s*.86],[t+.35*o,s*1.08],[t*.3,s*1.08]]);if(n.tail==="spiky"){for(let h of[.15,.45,.72]){let b=t+(.2+h*.7)*o,w=s*(.66+h*.19);d.push({k:"path",d:T(f([[b-.12*o,w+.05*o],[b,w-.2*o],[b+.12*o,w+.07*o]]),.2),fill:a.accent,...c})}d.push({k:"path",d:C(m,.7),fill:a.body,...c})}else{let h=f([[t*.6,s*.9],[t+.4*o,s*.92],[t+.62*o,s*.5],[t+.62*o,s*.18]]);d.push(...x(h,.13*o,a.body));let b=h[h.length-1];d.push({k:"group",x:b.x,y:b.y,rot:e.angle,s:o,items:[{k:"path",d:T([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:a.accent,stroke:a.outline,lw:r/o}]})}break}}return d}var wn={nose:[0,-.62],leftShoulder:[-.42,0],rightShoulder:[.42,0],leftElbow:[-.58,.5],rightElbow:[.58,.5],leftWrist:[-.66,.98],rightWrist:[.66,.98],leftHip:[-.27,1],rightHip:[.27,1],leftKnee:[-.31,1.6],rightKnee:[.31,1.6],leftAnkle:[-.33,2.18],rightAnkle:[.33,2.18]};function vn(n,{cx:e=.5,cy:t=.36,T:r=.18}={}){let a={...wn,...n},o=new Array(99).fill(0),s=(p,[i,f],c=.99)=>{o[p*3]=e+i*r,o[p*3+1]=t+f*r,o[p*3+2]=c};for(let p of Object.keys(P))s(P[p],a[p]);let u=a.tilt??0,l=(p,i)=>[a.nose[0]+p*Math.cos(u)-i*Math.sin(u),a.nose[1]+p*Math.sin(u)+i*Math.cos(u)];return s(Q.leftEye,l(-.1,-.08)),s(Q.rightEye,l(.1,-.08)),s(Q.leftEar,l(-.22,-.02)),s(Q.rightEar,l(.22,-.02)),o}var ht=()=>vn({});var be=class{constructor(e={}){z(this,"tracks",new Map);z(this,"offset",NaN);z(this,"lastArrival",NaN);z(this,"interval",33);z(this,"lastT",NaN);z(this,"lostMs");z(this,"maxExtrapolateMs");this.lostMs=e.lostMs??250,this.maxExtrapolateMs=e.maxExtrapolateMs??25}get delayMs(){return this.interval}push(e,t,r,a=mt()){Number.isFinite(t)||(t=a),this.clock(t,a);let o=this.tracks.get(e);if(!o||t-o.tb>this.lostMs||t<o.tb-this.lostMs||r.length!==o.b.length){this.tracks.set(e,{a:null,ta:t,b:r,tb:t,out:null,outAt:NaN});return}if(r===o.b||t<=o.tb){t===o.tb&&r!==o.b&&(o.b=r,o.out=null);return}o.a=o.b,o.ta=o.tb,o.b=r,o.tb=t,o.out=null}at(e,t=mt()){let r=this.tracks.get(e);if(!r)return null;if(!r.a)return r.b;if(r.out&&r.outAt===t)return r.out;let a=t-this.offset-this.interval,o=r.tb-r.ta,s=Math.min(o*.5,this.maxExtrapolateMs),u=Math.min(Math.max((a-r.ta)/o,0),1+s/o);return r.out=bt(r.a,r.b,u),r.outAt=t,r.out}forget(e){this.tracks.delete(e)}clear(){this.tracks.clear()}clock(e,t){let r=t-e;if(!Number.isFinite(this.offset)||r<this.offset||r>this.offset+1e3?this.offset=r:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(r-this.offset,(t-this.lastArrival)/1e3)),this.lastArrival=t,Number.isFinite(this.lastT)&&e>this.lastT){let a=e-this.lastT;a<this.interval*3+20&&(this.interval+=(Math.min(Math.max(a,8),100)-this.interval)*.1)}e<=this.lastT||(this.lastT=e)}},mt=()=>globalThis.performance?.now()??Date.now();function bt(n,e,t){let r=e.slice(),a=t<.5?n:e;for(let o=0;o+2<e.length;o+=3){let s=n[o],u=n[o+1],l=e[o],p=e[o+1];n[o+2]>=.5&&e[o+2]>=.5&&Math.abs(l-s)+Math.abs(p-u)<.15?(r[o]=s+(l-s)*t,r[o+1]=u+(p-u)*t,r[o+2]=n[o+2]+(e[o+2]-n[o+2])*Math.min(t,1)):(r[o]=a[o],r[o+1]=a[o+1],r[o+2]=a[o+2])}return r}var or=Oe.map(n=>n.id);var Se=new Map(Oe.map(n=>[n.id,n])),Ne=Se.get("fox"),xt=n=>typeof n=="string"&&Se.has(n),kt=n=>Se.get(n);var gt=n=>typeof n=="string"?Se.get(n)??Ne:n;function wt(n,e,t,r,a={}){let o=ce(e,gt(t),r,{mirrored:a.mirrored});return o.length?(n.save(),a.alpha!==void 0&&(n.globalAlpha*=Math.min(Math.max(a.alpha,0),1)),se(n,o),n.restore(),!0):!1}function vt(n,e){let t=gt(n),r=ht(),a=Ae(t),o=le(r,{x:0,y:0,w:1,h:1},{band:a}),s=-St(we(t,.05)).minY,l=Math.min(.27,.43/Math.max(s,1))*e/j[a].head/o.U,p=.5*e+Math.min(0,(s-1.6)*.06*e),i={x:e/2-o.head.x*l,y:p-o.head.y*l,w:l,h:l};return ce(r,t,i,{portrait:!0})}function At(n,e,t=.5){if(!n||n.length!==e.length)return e.slice();let r=e.slice();for(let a=0;a+2<e.length;a+=3){let o=n[a+2],s=e[a+2],u=o>=.5,l=s>=.5;u&&s>=.3&&(r[a+2]=Math.max(s,.5)),u&&l&&Math.hypot(e[a]-n[a],e[a+1]-n[a+1])<.15?(r[a]=n[a]+(e[a]-n[a])*t,r[a+1]=n[a+1]+(e[a+1]-n[a+1])*t):u&&!l&&r[a+2]>=.5&&(r[a]=n[a],r[a+1]=n[a+1])}return Mn(n,e,r,t*Sn),r}var Sn=.35,En=11;function Mn(n,e,t,r){let a=P.leftShoulder*3,o=P.rightShoulder*3,s=(f,c)=>f[c+2]>=.5;if(!s(n,a)||!s(n,o)||!s(e,a)||!s(e,o))return;let u=(f,c)=>(f[a+c]+f[o+c])/2,l=[u(n,0),u(n,1)],p=[u(e,0),u(e,1)],i=[u(t,0),u(t,1)];for(let f=0;f<En&&f*3+2<e.length;f++){let c=f*3;if(!s(n,c)||!s(e,c))continue;let x=[n[c]-l[0],n[c+1]-l[1]],d=[e[c]-p[0],e[c+1]-p[1]];Math.hypot(d[0]-x[0],d[1]-x[1])>=.15||(t[c]=i[0]+x[0]+(d[0]-x[0])*r,t[c+1]=i[1]+x[1]+(d[1]-x[1])*r)}}function St(n){let e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},t=(r,a)=>{e.minX=Math.min(e.minX,r),e.minY=Math.min(e.minY,a),e.maxX=Math.max(e.maxX,r),e.maxY=Math.max(e.maxY,a)};for(let r of n){let a="lw"in r&&r.stroke?(r.lw??1)/2:0;switch(r.k){case"circle":t(r.x-r.r-a,r.y-r.r-a),t(r.x+r.r+a,r.y+r.r+a);break;case"ellipse":case"rect":{let o=r.k==="ellipse"?r.rx:r.w/2,s=r.k==="ellipse"?r.ry:r.h/2,u=Math.max(o,s)+a;t(r.x-u,r.y-u),t(r.x+u,r.y+u);break}case"path":{let o=Ie(r.d);for(let s=0;s+1<o.length;s+=2)t(o[s]-a,o[s+1]-a),t(o[s]+a,o[s+1]+a);break}case"line":for(let o=0;o+1<r.pts.length;o+=2)t(r.pts[o]-a,r.pts[o+1]-a),t(r.pts[o]+a,r.pts[o+1]+a);break;case"group":{let o=St(r.items);if(!Number.isFinite(o.minX))break;let s=r.s??1,u=Math.cos(r.rot??0),l=Math.sin(r.rot??0);for(let[p,i]of[[o.minX,o.minY],[o.maxX,o.minY],[o.minX,o.maxY],[o.maxX,o.maxY]])t(r.x+(p*u-i*l)*s,r.y+(p*l+i*u)*s);break}}}return e}var Pn=()=>{let n=typeof document<"u"?document.timeline?.currentTime:null;return typeof n=="number"&&Number.isFinite(n)?n:globalThis.performance?.now()??Date.now()},Et=()=>globalThis.performance?.now()??Date.now(),pe=class{constructor(e=Pn){z(this,"now",e);z(this,"known",new Map);z(this,"smoothed",new Map);z(this,"times",new WeakMap);z(this,"lerp",new be);z(this,"drawnAt",NaN);z(this,"drawn",0);z(this,"smoothedBody",(e,t={})=>{let r=t.interpolate!==!1;if(typeof e=="number"){let a=this.smoothed.get(e);return a?r?this.lerp.at(e,this.tick())??a.body:a.body:null}return typeof e!="object"||e===null||!Array.isArray(e.body)?null:this.posed(e.id,e.body,Mt(t.smooth),r)})}note(e,t,r=Et()){for(let a of e)this.known.set(a.id,this.resolve(a.id,a.avatar)),t!==void 0&&Number.isFinite(t)&&Array.isArray(a.body)&&this.times.set(a.body,{t,arrival:r})}of(e){return typeof e=="object"&&e!==null?e.avatar!==void 0?this.resolve(e.id,e.avatar):this.of(e.id):this.known.get(e)??De(e-1)}posed(e,t,r,a=!0){let o=this.smooth(e,t,r);return a?this.lerp.at(e,this.tick())??o:o}smooth(e,t,r){let a=this.smoothed.get(e);if(a&&a.raw===t&&a.amount===r)return a.body;a&&a.amount!==r&&this.lerp.forget(e);let o=r<1?At(a?.body,t,r):t;this.smoothed.set(e,{raw:t,body:o,amount:r});let s=this.times.get(t),u=s?.arrival??Et();return this.lerp.push(e,s?.t??u,o,u),o}takeDrawn(){let e=this.drawn;return this.drawn=0,e}tick(){let e=this.now();return e!==this.drawnAt&&(this.drawnAt=e,this.drawn++),e}resolve(e,t){return xt(t)?t:De(e-1)}};function Bn(n,e){let t=typeof n.getTransform=="function"?n.getTransform():null,r=t&&Math.hypot(t.a,t.b)||1,a=t&&Math.hypot(t.c,t.d)||1,o=(n.canvas?.width??0)/r,s=(n.canvas?.height??0)/a;return e?{x:e.x*o,y:e.y*s,w:e.w*o,h:e.h*s}:{x:0,y:0,w:o,h:s}}var Mt=n=>n===!1?1:typeof n=="number"?Math.min(Math.max(n,.05),1):.5;function Ee(n,e){return(t,r,a,o,s={})=>{let u=Array.isArray(r)?null:r,l=u?u.body:r;if(!Array.isArray(l))return null;let p=typeof a=="string"?a:n.of(typeof a=="number"?a:u??1),i=typeof a=="number"?a:u?.id,f=i!==void 0?n.posed(i,l,Mt(s.smooth),s.interpolate!==!1):l;return wt(t,f,p,o??Bn(t,e().view),s.alpha!==void 0?{alpha:s.alpha}:{})?f:null}}function Bt(n){let e=new Map,t=(l,p)=>e.get(l)?.forEach(i=>i(p)),r=null,a=[],o=l=>r?l(r):a.push(l),s=new pe,u=Ee(s,()=>({view:null}));return n.then(l=>{r=l;let p=new Map;l.on("gesture",i=>t(i.gesture,{player:i.player})),l.on("pause",i=>t("pause",{reason:i.reason==="distance"?"distance":"user"})),l.on("resume",()=>t("resume",{})),l.on("break-start",()=>t("break-start",{})),l.on("break-done",i=>t("break-end",{shown:i.shown})),l.onBackdrop((i,f)=>t("backdrop",{backdrop:i,view:f})),l.on("frame",i=>{t("players",{players:i.players});for(let f of i.players)t("hands",{player:f.id,left:f.leftHand,right:f.rightHand}),p.get(f.id)!==f.shape&&(p.set(f.id,f.shape),t("shape",{player:f.id,shape:f.shape}))}),t("start",Pt(l)),a.splice(0).forEach(i=>i(l))}),{on(l,p){let i=e.get(l)??new Set;return e.set(l,i),i.add(p),l==="start"&&r&&p(Pt(r)),()=>{i.delete(p)}},ready:()=>o(l=>l.ready()),score:(l,p=1)=>o(i=>i.score(p,l)),break:l=>new Promise(p=>o(i=>{i.break(l).then(p)})),end:l=>o(p=>p.end(typeof l=="number"?[{player:1,score:l,stars:2}]:l.map(i=>({player:i.player,score:i.score,stars:i.stars??2})))),keys:(l,p)=>o(i=>{qe(i,l,p)}),pointer:l=>o(p=>{Ze(p,l)}),get view(){return r?.view??null},get device(){return r?.device??null},reportStats:l=>r?.reportStats(l),toScreen:l=>r?r.toScreen(l):ge(null,l),avatarOf:l=>r?r.avatarOf(l):s.of(l),drawAvatar:(...l)=>r?r.drawAvatar(...l):u(...l),smoothedBody:(...l)=>r?r.smoothedBody(...l):s.smoothedBody(...l)}}var Pt=n=>({ageRange:n.ageRange,players:n.players,locale:n.locale,mode:n.mode,backdrop:n.backdrop,view:n.view,device:n.device});var Cn=(n=window)=>({post:e=>n.parent.postMessage(e,"*"),listen:e=>n.addEventListener("message",t=>t.source===n.parent&&e(t.data))}),Dn=1e4,Tn=1e3;function Dt(n=Cn()){return new Promise((e,t)=>{let r=new Map,a=[],o=!1,s="none",u=null,l=new Set,p=new pe,i=Ee(p,()=>({view:u})),f=p.smoothedBody,c=setTimeout(()=>t(new Error("Fabi Play: no host, is the game opened from Fabi Play?")),Dn);n.listen(x=>{if(typeof x!="object"||x===null||x.ns!==Te)return;let d=x;if(d.type==="init"&&!o){if(d.v!==1)return clearTimeout(c),t(new Error(`Fabi Play: protocol ${d.v}, this SDK speaks ${1}`));o=!0,clearTimeout(c),s=d.backdrop==="video"?"video":"none",u=Re(d.view)??null;let m=nt(d.device)??null,h={};if(d.stats===!0){let b=performance.now();setInterval(()=>{let D=performance.now();n.post(ae({type:"stats",renderFps:Math.round(p.takeDrawn()*1e3/Math.max(D-b,1)),...h})),b=D},Tn).unref?.()}e({locale:d.locale,mode:d.mode,players:d.players,muted:d.muted,ageRange:d.ageRange??"6-8",get backdrop(){return s},get view(){return u},device:m,reportStats:b=>{h=rt(b)},toScreen:b=>ge(u,b),avatarOf:b=>p.of(b),drawAvatar:i,smoothedBody:f,onBackdrop(b){return l.add(b),()=>{l.delete(b)}},on(b,w){let D=r.get(b)??new Set;return r.set(b,D),D.add(w),()=>{D.delete(w)}},ready:()=>n.post(ae({type:"ready"})),score:(b,w)=>n.post(ae({type:"score",player:b,score:w})),break:(b="level")=>new Promise(w=>{a.push(w),n.post(ae({type:"break",reason:b}))}),end:b=>n.post(ae({type:"end",scores:b}))})}else if(o){let m=d;if(d.type==="frame"&&Array.isArray(d.players)&&p.note(d.players,d.t),d.type==="backdrop"){if(d.backdrop!=="video"&&d.backdrop!=="none")return;let h=Re(d.view)??null;if(d.backdrop===s&&Rn(h,u))return;s=d.backdrop,u=h,m={type:"backdrop",backdrop:s,...u?{view:u}:{}};for(let b of[...l])b(s,u)}for(let h of r.get(d.type)??[])h(m);d.type==="break-done"&&a.shift()?.(d.shown)}else return})})}var Rn=(n,e)=>n===e||n!==null&&e!==null&&n.x===e.x&&n.y===e.y&&n.w===e.w&&n.h===e.h;var Fe={};Lt(Fe,{BAND_BODY:()=>j,DEFAULT_AVATAR:()=>Ne,avatarById:()=>kt,avatarShapes:()=>ce,drawShapes:()=>se,frameOf:()=>le,iconShapes:()=>vt});function Tt(n){let e=Dt(),t=Bt(e);n?.dataset.mute!=="manual"&&We(e);let r=Object.assign(t,{avatars:{...Fe}});window.FabiPlay=r;let a=n?.dataset.keys;a&&t.keys(Xe(a));let o=n?.dataset.pointer;return o&&t.pointer({hand:o==="left"||o==="right"?o:"any"}),n?.dataset.ready!=="manual"&&(document.readyState==="complete"?t.ready():window.addEventListener("load",()=>t.ready(),{once:!0})),r}Tt(document.currentScript);})();
1
+ "use strict";(()=>{var Qe=Object.defineProperty;var $t=(n,e,t)=>e in n?Qe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Lt=(n,e)=>{for(var t in e)Qe(n,t,{get:e[t],enumerable:!0})};var O=(n,e,t)=>$t(n,typeof e!="symbol"?e+"":e,t);function qe(n,e=window){let t=new Set,r=e.AudioContext;r&&(e.AudioContext=class extends r{constructor(...s){super(...s),t.add(this)}});let a=[],o=[];Promise.resolve(n).then(s=>{s.on("break-start",()=>{a=[...e.document.querySelectorAll("audio, video")].filter(u=>!u.paused),a.forEach(u=>u.pause()),o=[...t].filter(u=>u.state==="running"),o.forEach(u=>{u.suspend()})}),s.on("break-done",()=>{a.forEach(u=>{u.play().catch(()=>{})}),o.forEach(u=>{u.resume()}),a=[],o=[]})})}var _t={jump:"Space",squat:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",clap:"Enter"};function Ze(n){if(n.trim()==="default")return;let e={};for(let t of n.split(",")){let[r,a]=t.split(":").map(o=>o.trim());r&&a&&(e[r]=a)}return e}var Nt={Space:[" ",32],Enter:["Enter",13],Escape:["Escape",27],ShiftLeft:["Shift",16],ArrowLeft:["ArrowLeft",37],ArrowUp:["ArrowUp",38],ArrowRight:["ArrowRight",39],ArrowDown:["ArrowDown",40]};function Xe(n){let e=Nt[n];if(e)return{key:e[0],code:n,keyCode:e[1]};let t=/^Key([A-Z])$/.exec(n);if(t)return{key:t[1].toLowerCase(),code:n,keyCode:t[1].charCodeAt(0)};let r=/^Digit([0-9])$/.exec(n);if(r)return{key:r[1],code:n,keyCode:48+Number(r[1])};throw new Error(`Fabi Play: unknown key "${n}" (use Space, Enter, Arrow\u2026, KeyA\u2026, Digit0\u2026)`)}var Ft=(n=document)=>({dispatch(e,t){let r=new KeyboardEvent(e,{key:t.key,code:t.code,bubbles:!0,cancelable:!0});for(let a of["keyCode","which"])Object.defineProperty(r,a,{get:()=>t.keyCode});(n.activeElement??n.body??n).dispatchEvent(r)}}),We=80,Ht=800;function Je(n,e=_t,t={}){let r=t.player??1,a=t.target??Ft(),o=t.setTimeout??((d,m)=>setTimeout(d,m)),s=new Set,u=0,l=d=>{let m=e[d];!m||s.has(d)||(s.add(d),a.dispatch("keydown",Xe(m)))},p=d=>{let m=e[d];!m||!s.has(d)||(s.delete(d),a.dispatch("keyup",Xe(m)))},i=d=>{l(d),o(()=>p(d),We)},f=d=>{if(d.player!==r)return;let m={"lane-left":-1,"lane-center":0,"lane-right":1};switch(d.gesture){case"jump":l("jump"),o(()=>p("jump"),Ht);break;case"land":p("jump");break;case"squat":l("squat");break;case"stand":p("squat");break;case"clap":i("clap");break;default:{let h=m[d.gesture];if(h===void 0)break;let b=h>u?"right":"left";for(let w=0;w<Math.abs(h-u);w++)o(()=>i(b),w*(We*2));u=h}}},c=d=>{let m=d.players.find(h=>h.id===r);m&&(m.shape==="arms-up"?l("arms-up"):p("arms-up"))},x=[n.on("gesture",f),n.on("frame",c),n.on("break-start",()=>[...s].forEach(p))];return()=>{x.forEach(d=>d()),[...s].forEach(p)}}function Gt(n=document){let e=n.createElement("div");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;left:0;top:0;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;border:6px solid #FBE7B8;background:rgba(251,231,184,.25);pointer-events:none;z-index:2147483647;box-sizing:border-box;transition:transform 60ms linear",n.body.appendChild(e);let t=(r,a,...o)=>{let s=n.elementFromPoint(r,a)??n.body;for(let u of o){let l={bubbles:!0,cancelable:!0,clientX:r,clientY:a,pointerId:1,pointerType:"touch",isPrimary:!0};s.dispatchEvent(u.startsWith("pointer")?new PointerEvent(u,l):new MouseEvent(u,l))}};return{size:()=>({width:n.documentElement.clientWidth,height:n.documentElement.clientHeight}),move:(r,a)=>t(r,a,"pointermove","mousemove"),click:(r,a)=>t(r,a,"pointerdown","mousedown","pointerup","mouseup","click"),cursor:(r,a,o)=>{e.style.transform=`translate(${r}px, ${a}px) scale(${1-o*.35})`,e.style.borderColor=o>0?"#EE6A43":"#FBE7B8"}}}function et(n,e={}){let t=e.player??1,r=e.hand??"any",a=e.dwellMs??800,o=e.radius??.04,s=e.target??Gt(),u=null,l=!1;return n.on("frame",p=>{let i=p.players.find(T=>T.id===t);if(!i)return;let c=r==="left"?i.leftHand:r==="right"?i.rightHand:((T,G)=>T&&G?T.y<G.y?T:G:T??G)(i.leftHand,i.rightHand);if(!c)return;let{width:x,height:d}=s.size(),m=c.x*x,h=c.y*d;s.move(m,h),(!u||Math.hypot(m-u.x,h-u.y)>o*Math.hypot(x,d))&&(u={x:m,y:h,t:p.t},l=!1);let w=l?0:Math.min((p.t-u.t)/a,1);w>=1&&(l=!0,s.click(u.x,u.y)),s.cursor(m,h,l?0:w)})}var Te=1,Re=33,P={nose:0,leftShoulder:11,rightShoulder:12,leftElbow:13,rightElbow:14,leftWrist:15,rightWrist:16,leftHip:23,rightHip:24,leftKnee:25,rightKnee:26,leftAnkle:27,rightAnkle:28},tt=["3-5","6-8","9-12"],Vt=n=>tt.includes(n);var jt=4;var nt={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},Kt=nt["6-8"],De=(n,e)=>{let t=Vt(e)?nt[e]:Kt;return t[Number.isInteger(n)&&n>=0?n%t.length:0]};var Oe="fabi-play",ae=n=>({ns:Oe,...n});function ze(n){if(!Ie(n))return;let{x:e,y:t,w:r,h:a}=n;return oe(e)&&oe(t)&&oe(r)&&oe(a)&&r>0&&a>0?{x:e,y:t,w:r,h:a}:void 0}var ge=(n,e)=>n?{x:n.x+e.x*n.w,y:n.y+e.y*n.h}:{x:e.x,y:e.y},rt=["high","medium","low"];function ot(n){if(!Ie(n))return;let e={};return rt.includes(n.tier)&&(e.tier=n.tier),oe(n.hz)&&n.hz>=20&&n.hz<=240&&(e.hz=Math.round(n.hz)),e.tier||e.hz?e:void 0}function at(n){let e={};return Ie(n)&&(oe(n.fps)&&n.fps>=0&&n.fps<1e3&&(e.fps=n.fps),typeof n.renderer=="string"&&/^[a-z0-9-]{1,16}$/.test(n.renderer)&&(e.renderer=n.renderer),rt.includes(n.tier)&&(e.tier=n.tier)),e}var Ie=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),oe=n=>typeof n=="number"&&Number.isFinite(n);var Ut=12,Yt=Re*4,Qt=n=>Ut+n*Yt,$n=Qt(jt);var H="#4a382c",L="#2b2118",V="#1c1f2b",st="#fbefe3",j="#f4897a",he="#3a2a22",$e=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:st,accent:"#ffd9c2",outline:L,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:he,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:st,accent:"#5a3426",outline:L,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:he,muzzle:"band",cheeks:j},tail:"brush",headExtras:[],bodyExtras:["star"],extraColors:["#ffd84a"]},{id:"bunny",name:{en:"Bunny",it:"Coniglietto"},band:"3-5",palette:{body:"#f9d0de",limbs:"#f9d0de",belly:"#fff6f8",accent:"#f4a0b9",outline:H},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:j},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:H},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:he,muzzle:"oval",cheeks:j},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:H,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:j},tail:"long",headExtras:["whiskers"],bodyExtras:[]},{id:"panda",name:{en:"Panda",it:"Panda"},band:"3-5",palette:{body:"#ffffff",limbs:"#6e6674",belly:"#ffffff",accent:"#6e6674",outline:H,ears:"#6e6674"},head:"wide",ears:"round",face:{eyes:"mask",mouth:"smile",nose:"#2f2a2c",muzzle:"none",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:[]},{id:"penguin",name:{en:"Penguin",it:"Pinguino"},band:"3-5",palette:{body:"#6c8fca",limbs:"#6c8fca",belly:"#ffffff",accent:"#f9b95c",outline:H,feet:"#f9b95c"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"heart",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:["flippers","scarf"],extraColors:["#f6907a"]},{id:"frog",name:{en:"Frog",it:"Ranocchio"},band:"3-5",palette:{body:"#8fd487",limbs:"#8fd487",belly:"#e6f7cc",accent:"#62ad62",outline:H},head:"wide",ears:"none",face:{eyes:"big",eyesOnTop:!0,mouth:"open",muzzle:"none",cheeks:"#f59b8f"},tail:"none",headExtras:[],bodyExtras:["flippers","spots"],extraColors:["#62ad62","#b0e6a4"]},{id:"lion",name:{en:"Lion",it:"Leoncino"},band:"6-8",palette:{body:"#f6c454",limbs:"#f6c454",belly:"#fde7b0",accent:"#fde7b0",outline:L},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:j},tail:"tuft",headExtras:["mane"],bodyExtras:[],extraColors:["#c8692e"]},{id:"unicorn",name:{en:"Unicorn",it:"Unicorno"},band:"6-8",palette:{body:"#fbf5ff",limbs:"#fbf5ff",belly:"#efe0ff",accent:"#fbd46a",outline:L,hands:"#c9a6f2",feet:"#c9a6f2"},head:"tall",ears:"unicorn",face:{eyes:"dot",mouth:"smile",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["rainbow-mane"],bodyExtras:[],extraColors:["#f58cc0","#8fd3f4","#a98ff2"]},{id:"dragon",name:{en:"Little Dragon",it:"Draghetto"},band:"6-8",palette:{body:"#8a63d2",limbs:"#8a63d2",belly:"#fbd46a",accent:"#5fd0b5",outline:L},head:"wide",ears:"horns",face:{eyes:"big",eyeColor:"#3a2a6a",mouth:"teeth",muzzle:"none",cheeks:"#f59bc0"},tail:"arrow",headExtras:[],bodyExtras:["wings"]},{id:"robot",name:{en:"Robot",it:"Robot"},band:"9-12",palette:{body:"#b9c7d2",limbs:"#8b9aa6",belly:"#b9c7d2",accent:"#ee6a43",outline:V,hands:"#ee6a43",feet:"#6b7a86"},head:"square",ears:"antenna",face:{eyes:"screen",eyeColor:"#7ff0ff",mouth:"grill",muzzle:"none"},tail:"none",headExtras:["bolts"],bodyExtras:["panel","joints","boots"],extraColors:["#ff7a6b","#fbd46a","#7ff0ff"]},{id:"astronaut",name:{en:"Astronaut",it:"Astronauta"},band:"9-12",palette:{body:"#f4f1ec",limbs:"#f4f1ec",belly:"#f4f1ec",accent:"#ee6a43",outline:V,hands:"#9fb0bd",feet:"#9fb0bd"},head:"round",ears:"none",face:{eyes:"visor",mouth:"smile",muzzle:"none"},tail:"none",headExtras:["helmet"],bodyExtras:["backpack","badge","boots"],extraColors:["#c9d3db"]},{id:"dinosaur",name:{en:"Dinosaur",it:"Dinosauro"},band:"6-8",palette:{body:"#3fb3a6",limbs:"#3fb3a6",belly:"#c9f0d6",accent:"#f79a3e",outline:L},head:"wide",ears:"none",face:{eyes:"dot",mouth:"teeth",muzzle:"none",cheeks:"#f59b8f"},tail:"spiky",headExtras:["spikes","spots"],bodyExtras:[],extraColors:["#2b8f84","#7fd3c6"]},{id:"monkey",name:{en:"Monkey",it:"Scimmietta"},band:"6-8",palette:{body:"#7b5234",limbs:"#7b5234",belly:"#f2c9a0",accent:"#f2c9a0",outline:L,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:j},tail:"curl",headExtras:["tuft"],bodyExtras:[]},{id:"koala",name:{en:"Koala",it:"Koala"},band:"3-5",palette:{body:"#b7bcc6",limbs:"#b7bcc6",belly:"#eef0f3",accent:"#f4dbe2",outline:H},head:"wide",ears:"big-round",face:{eyes:"dot",mouth:"smile",nose:"#3b3438",muzzle:"none",cheeks:"#f4a3b0"},tail:"none",headExtras:[],bodyExtras:[]},{id:"tiger",name:{en:"Tiger",it:"Tigrotto"},band:"6-8",palette:{body:"#f9a33a",limbs:"#f9a33a",belly:"#fff1dc",accent:"#fff1dc",outline:L},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:j},tail:"striped",headExtras:["stripes","whiskers"],bodyExtras:[],extraColors:["#3a2a22"]},{id:"owl",name:{en:"Owl",it:"Gufetto"},band:"3-5",palette:{body:"#8ec0e6",limbs:"#8ec0e6",belly:"#e3f2fc",accent:"#639cc9",outline:H,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:H,eyeRing:"#fde08a",mouth:"beak",muzzle:"none",cheeks:"#f6a8b4"},tail:"none",headExtras:[],bodyExtras:["feathers"]},{id:"alien",name:{en:"Alien",it:"Alieno"},band:"9-12",palette:{body:"#9ee05a",limbs:"#9ee05a",belly:"#d8f5a8",accent:"#b07cf2",outline:V},head:"bulb",ears:"antennae",face:{eyes:"almond",eyeColor:"#1e1838",mouth:"smirk",muzzle:"none"},tail:"none",headExtras:[],bodyExtras:["spots"],extraColors:["#7cc23e","#7cc23e"]},{id:"ghost",name:{en:"Friendly Ghost",it:"Fantasmino"},band:"6-8",palette:{body:"#e6f4ff",limbs:"#e6f4ff",belly:"#e6f4ff",accent:"#bcd9f2",outline:L},head:"round",ears:"none",face:{eyes:"dot",mouth:"open",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["curl"],bodyExtras:["sheet"]},{id:"octopus",name:{en:"Octopus",it:"Polpetto"},band:"6-8",palette:{body:"#e0578a",limbs:"#e0578a",belly:"#f7b3cc",accent:"#f7b3cc",outline:L,hands:"#f7b3cc",feet:"#f7b3cc"},head:"tall",ears:"none",face:{eyes:"big",eyeColor:"#3a2140",mouth:"smile",muzzle:"none",cheeks:"#ffd0a0"},tail:"none",headExtras:["spots"],bodyExtras:["tentacles"],extraColors:["#f7b3cc","#f7b3cc"]},{id:"chick",name:{en:"Chick",it:"Pulcino"},band:"3-5",palette:{body:"#ffd45e",limbs:"#ffd45e",belly:"#fff2c2",accent:"#ffa04a",outline:H,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:j},tail:"none",headExtras:["eggshell"],bodyExtras:[],extraColors:["#fffaf0"]},{id:"puppy",name:{en:"Puppy",it:"Cucciolo"},band:"3-5",palette:{body:"#f4e4cf",limbs:"#f4e4cf",belly:"#fffaf2",accent:"#f29aa4",outline:H,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:he,muzzle:"oval",cheeks:j},tail:"curl",headExtras:["eye-spot"],bodyExtras:[]},{id:"lamb",name:{en:"Lamb",it:"Agnellino"},band:"3-5",palette:{body:"#fdf8ee",limbs:"#e3d1c2",belly:"#fffdf8",accent:"#f6bcc2",outline:H,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:j},tail:"pom",headExtras:["wool"],bodyExtras:["wool"]},{id:"duckling",name:{en:"Duckling",it:"Anatroccolo"},band:"3-5",palette:{body:"#fff1a6",limbs:"#fff1a6",belly:"#fffbe0",accent:"#ff9f43",outline:H,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:j},tail:"none",headExtras:["curl"],bodyExtras:["flippers","scarf"],extraColors:["#86cfe0"]},{id:"shark",name:{en:"Shark",it:"Squalo"},band:"6-8",palette:{body:"#6c95c4",limbs:"#6c95c4",belly:"#eef5fb",accent:"#4c76a8",outline:L,hands:"#eef5fb",feet:"#4c76a8"},head:"wide",ears:"fin",face:{eyes:"dot",mouth:"jaws",muzzle:"none",cheeks:"#f59bb0"},tail:"fish",headExtras:["gills"],bodyExtras:[]},{id:"wolf",name:{en:"Wolf",it:"Lupo"},band:"6-8",palette:{body:"#8f9bb3",limbs:"#8f9bb3",belly:"#eef1f6",accent:"#f3b8c4",outline:L,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:he,muzzle:"oval",cheeks:"#f4a3b0"},tail:"fluffy",headExtras:["ruff","forehead"],bodyExtras:[],extraColors:["#636d84"]},{id:"parrot",name:{en:"Parrot",it:"Pappagallo"},band:"6-8",palette:{body:"#e8503f",limbs:"#e8503f",belly:"#ffd25a",accent:"#f6e6c4",outline:L,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:L,eyeRing:"#ffffff",mouth:"hook",muzzle:"none",cheeks:"#ffb0a0"},tail:"plume",headExtras:["crest"],bodyExtras:["feathers"],extraColors:["#ffd25a","#3fae5a","#3a9bdc"]},{id:"ninja",name:{en:"Ninja",it:"Ninja"},band:"9-12",palette:{body:"#2f3a56",limbs:"#2f3a56",belly:"#2f3a56",accent:"#36c9bb",outline:V,skin:"#b07a52",hands:"#222a40",feet:"#222a40"},head:"round",ears:"none",face:{eyes:"calm",mouth:"none",muzzle:"none",brows:"#2a1d16"},tail:"none",headExtras:["ninja-hood"],bodyExtras:["belt"],extraColors:["#36c9bb","#36c9bb","#36c9bb"]},{id:"skater",name:{en:"Skater",it:"Skater"},band:"9-12",palette:{body:"#3a8fc0",limbs:"#2c3e57",belly:"#2f7aa6",accent:"#ffcf3a",outline:V,skin:"#f2c9a5",hair:"#7a4a2a",hands:"#f2c9a5",feet:"#eef1f5"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#5a3520"},tail:"none",headExtras:["hair","cap"],bodyExtras:["pocket","joints"],extraColors:["#ff5d73"]},{id:"explorer",name:{en:"Explorer",it:"Giramondo"},band:"9-12",palette:{body:"#5f8f5b",limbs:"#5f8f5b",belly:"#5f8f5b",accent:"#d9bb7e",outline:V,skin:"#7a4a30",hair:"#1d1410",hands:"#7a4a30",feet:"#6b4a2a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#1d1410"},tail:"none",headExtras:["curls","safari-hat"],bodyExtras:["backpack","straps","boots"],extraColors:["#e07b39","#6b4a2a"]},{id:"wizard",name:{en:"Wizard",it:"Mago"},band:"9-12",palette:{body:"#5b3fa0",limbs:"#5b3fa0",belly:"#5b3fa0",accent:"#3d5fc8",outline:V,skin:"#c98d62",hair:"#a8452a",hands:"#c98d62",feet:"#33255e"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#7a301c"},tail:"none",headExtras:["locks","wizard-hat"],bodyExtras:["robe","belt"],extraColors:["#ffd84a","#ffd84a","#ffd84a"]},{id:"knight",name:{en:"Knight",it:"Cavaliere"},band:"9-12",palette:{body:"#bcc7d3",limbs:"#8e9aa8",belly:"#dce3ea",accent:"#d8443a",outline:V,hands:"#6c7786",feet:"#6c7786"},head:"bucket",ears:"none",face:{eyes:"slit",eyeColor:"#bfefff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["plume"],bodyExtras:["pauldrons","emblem","boots"],extraColors:["#d8443a"]},{id:"racer",name:{en:"Racer",it:"Pilota"},band:"9-12",palette:{body:"#ff6a2b",limbs:"#ff6a2b",belly:"#ffffff",accent:"#ffffff",outline:V,hands:"#232838",feet:"#232838"},head:"round",ears:"none",face:{eyes:"goggle",eyeColor:"#7fd6ff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["stripe"],bodyExtras:["racing-stripe","boots"]},{id:"pirate",name:{en:"Pirate",it:"Pirata"},band:"9-12",palette:{body:"#f2efe6",limbs:"#2a3d6e",belly:"#f2efe6",accent:"#d94545",outline:V,skin:"#d9a072",hair:"#2b1a12",hands:"#d9a072",feet:"#3a2a20"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#2b1a12"},tail:"none",headExtras:["locks","bandana","eye-patch"],bodyExtras:["stripes","belt","boots"],extraColors:["#d94545","#2a3d6e","#4a3426"]},{id:"diver",name:{en:"Diver",it:"Sub"},band:"9-12",palette:{body:"#1f6582",limbs:"#1f6582",belly:"#1f6582",accent:"#ffb020",outline:V,skin:"#e8b48a",hair:"#c98f2e",hands:"#1b4f66",feet:"#ffb020"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#8a5a1a"},tail:"none",headExtras:["curls","dive-mask"],bodyExtras:["tank","fins"],extraColors:["#c9d3db"]},{id:"hero",name:{en:"Hero",it:"Supereroe"},band:"9-12",palette:{body:"#3557c8",limbs:"#3557c8",belly:"#3557c8",accent:"#e0403a",outline:V,skin:"#5a3825",hair:"#141010",hands:"#e0403a",feet:"#e0403a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#141010"},tail:"none",headExtras:["hair","domino"],bodyExtras:["cape","emblem","boots"],extraColors:["#ffd84a"]}];var D={M:0,L:1,Q:2,C:3,Z:4},it=[2,2,4,6,0];function se(n,e){for(let t of e)Xt(n,t)}function Xt(n,e){if(e.k==="group"){n.save(),n.translate(e.x,e.y),e.rot&&n.rotate(e.rot),e.s!==void 0&&e.s!==1&&n.scale(e.s,e.s),e.alpha!==void 0&&(n.globalAlpha*=e.alpha),se(n,e.items),n.restore();return}switch(n.save(),e.alpha!==void 0&&(n.globalAlpha*=e.alpha),n.beginPath(),e.k){case"circle":n.arc(e.x,e.y,Math.max(e.r,0),0,Math.PI*2);break;case"ellipse":n.ellipse(e.x,e.y,Math.max(e.rx,0),Math.max(e.ry,0),e.rot??0,0,Math.PI*2);break;case"rect":Wt(n,e);break;case"path":typeof e.d=="string"?Zt(n,e.d):qt(n,e.d);break;case"line":n.moveTo(e.pts[0]??0,e.pts[1]??0);for(let t=2;t+1<e.pts.length;t+=2)n.lineTo(e.pts[t],e.pts[t+1]);break}n.lineCap="round",n.lineJoin="round",e.fill&&e.k!=="line"&&(n.fillStyle=e.fill,n.fill()),e.stroke&&(e.lw??1)>0&&(n.strokeStyle=e.stroke,n.lineWidth=e.lw??1,n.stroke()),n.restore()}function Wt(n,e){let t=Math.max(0,Math.min(e.r,e.w/2,e.h/2));n.translate(e.x,e.y),e.rot&&n.rotate(e.rot);let r=-e.w/2,a=-e.h/2;n.moveTo(r+t,a),n.lineTo(r+e.w-t,a),n.quadraticCurveTo(r+e.w,a,r+e.w,a+t),n.lineTo(r+e.w,a+e.h-t),n.quadraticCurveTo(r+e.w,a+e.h,r+e.w-t,a+e.h),n.lineTo(r+t,a+e.h),n.quadraticCurveTo(r,a+e.h,r,a+e.h-t),n.lineTo(r,a+t),n.quadraticCurveTo(r,a,r+t,a),n.closePath()}function qt(n,e){for(let t=0;t<e.length;){let r=e[t++];if(r===D.M)n.moveTo(e[t],e[t+1]);else if(r===D.L)n.lineTo(e[t],e[t+1]);else if(r===D.Q)n.quadraticCurveTo(e[t],e[t+1],e[t+2],e[t+3]);else if(r===D.C)n.bezierCurveTo(e[t],e[t+1],e[t+2],e[t+3],e[t+4],e[t+5]);else if(r===D.Z)n.closePath();else return;t+=it[r]}}function Le(n){if(typeof n=="string")return(n.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);let e=[];for(let t=0;t<n.length;){let r=it[n[t++]];if(r===void 0)break;for(let a=0;a<r;a++)e.push(n[t+a]);t+=r}return e}function Zt(n,e){let t=e.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[],r="",a=0,o=()=>Number(t[a++]);for(;a<t.length;){let s=t[a];if(/[MLQCZ]/i.test(s)&&(r=s.toUpperCase(),a++,r==="Z")){n.closePath();continue}r==="M"?(n.moveTo(o(),o()),r="L"):r==="L"?n.lineTo(o(),o()):r==="Q"?n.quadraticCurveTo(o(),o(),o(),o()):r==="C"?n.bezierCurveTo(o(),o(),o(),o(),o(),o()):a++}}var B=n=>{let e=Math.round(n*100)/100;return e===0?0:e};function R(n,e=.5){let t=n.length;if(t<3)return[];let r=(u,l,p)=>({x:u.x+(l.x-u.x)*p,y:u.y+(l.y-u.y)*p}),a=Math.min(Math.max(e,0),.5),o=r(n[0],n[1],a),s=[D.M,B(o.x),B(o.y)];for(let u=1;u<=t;u++){let l=n[(u-1)%t],p=n[u%t],i=n[(u+1)%t],f=r(l,p,1-a),c=r(p,i,a);s.push(D.L,B(f.x),B(f.y),D.Q,B(p.x),B(p.y),B(c.x),B(c.y))}return s.push(D.Z),s}function C(n,e=1){let t=n.length;if(t<3)return[];let r=[D.M,B(n[0].x),B(n[0].y)],a=e/6;for(let o=0;o<t;o++){let s=n[(o-1+t)%t],u=n[o],l=n[(o+1)%t],p=n[(o+2)%t];r.push(D.C,B(u.x+(l.x-s.x)*a),B(u.y+(l.y-s.y)*a),B(l.x-(p.x-u.x)*a),B(l.y-(p.y-u.y)*a),B(l.x),B(l.y))}return r.push(D.Z),r}function ie(n){let e=n.length;if(e<2)return[];let t=[D.M,B(n[0].x),B(n[0].y)];for(let r=0;r<e-1;r++){let a=n[Math.max(r-1,0)],o=n[r],s=n[r+1],u=n[Math.min(r+2,e-1)];t.push(D.C,B(o.x+(s.x-a.x)/6),B(o.y+(s.y-a.y)/6),B(s.x-(u.x-o.x)/6),B(s.y-(u.y-o.y)/6),B(s.x),B(s.y))}return t}var J="M0 -1 L0.29 -0.4 L0.95 -0.31 L0.47 0.15 L0.59 0.81 L0 0.5 L-0.59 0.81 L-0.47 0.15 L-0.95 -0.31 L-0.29 -0.4 Z";var I="#ffffff",v=[-1,1],lt="#3a2420",Jt="#f2808f",_e="#26324a",en="#ffd84a",_=(...n)=>{let e=[];for(let t=0;t+1<n.length;t+=2)e.push({x:n[t],y:n[t+1]});return e};function we(n,e){let t=n.palette,r=[],a={stroke:t.outline,lw:e},o=i=>n.headExtras.includes(i),s=(i,f)=>n.extraColors?.[i]??f;if(o("mane")){for(let f=0;f<12;f++){let c=f/12*Math.PI*2;r.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:s(0,t.accent),...a})}r.push({k:"circle",x:0,y:.04,r:1.08,fill:s(0,t.accent)})}if(o("rainbow-mane")){let i=n.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,x,d,m,h],b)=>r.push({k:"ellipse",x:c,y:x,rx:d,ry:m,rot:h,fill:i[b%i.length],...a}))}if(o("spikes"))for(let i of[-.55,0,.55]){let f=me(i,1.48),c=me(i-.32,.86),x=me(i+.32,.86);r.push({k:"path",d:R([c,f,x],.22),fill:t.accent,...a})}if(o("curl")&&r.push({k:"path",d:C([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:t.body,...a}),o("wool"))for(let i=0;i<=8;i++){let f=-1.75+i/8*3.5;r.push({k:"circle",x:Math.sin(f)*.98,y:-Math.cos(f)*.92-.04,r:.34,fill:t.body,...a})}if(o("crest")&&[-.38,0,.38].forEach((i,f)=>{let c=me(i,1.12);r.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:i,fill:s(f,t.accent),...a})}),o("plume")&&r.push({k:"path",d:C(_(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:t.accent,...a}),o("locks")&&r.push({k:"path",d:C(_(-1.14,.58,-1.24,-.2,-.86,-.98,0,-1.2,.86,-.98,1.24,-.2,1.14,.58,.8,.66,0,.2,-.8,.66)),fill:t.hair??t.outline,...a}),o("ninja-hood"))for(let[i,f]of[[.35,.5],[.85,.42]])r.push({k:"ellipse",x:1+Math.cos(i)*f*.8,y:-.5+Math.sin(i)*f*.8,rx:f,ry:.11,rot:i,fill:t.accent,...a});if(o("bandana"))for(let[i,f]of[[Math.PI-.5,.42],[Math.PI-1,.36]])r.push({k:"ellipse",x:-.98+Math.cos(i)*f*.8,y:-.36+Math.sin(i)*f*.8,rx:f,ry:.12,rot:i,fill:t.accent,...a});if(o("ruff"))for(let i of v)r.push({k:"path",d:R(_(i*.7,-.3,i*1.32,0,i*1.02,.18,i*1.26,.46,i*.86,.56,i*.98,.84,i*.4,.7),.25),fill:t.body,...a});if(n.face.eyesOnTop)for(let i of v)r.push({k:"circle",x:i*.46,y:-.72,r:.38,fill:t.body,...a});r.push(...on(n,e)),r.push(tn(n,a));let u=n.face.muzzle,l=t.belly;if(u==="oval"&&r.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:l}),u==="monkey"){for(let i of v)r.push({k:"circle",x:i*.32,y:-.04,r:.38,fill:l});r.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:l})}if(u==="heart"){for(let i of v)r.push({k:"circle",x:i*.36,y:.02,r:.5,fill:l});r.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:l})}if(u==="disc")for(let i of v)r.push({k:"circle",x:i*.4,y:.02,r:.44,fill:l});if(u==="cheeks")for(let i of v)r.push({k:"ellipse",x:i*.4,y:.44,rx:.44,ry:.32,fill:l});if(u==="band"&&r.push({k:"path",d:rn(n,e),fill:l}),o("stripes")){let i=s(0,t.outline);r.push({k:"line",pts:[0,-.97,0,-.66],stroke:i,lw:.13});for(let f of v)r.push({k:"line",pts:[f*.3,-.93,f*.24,-.7],stroke:i,lw:.1}),r.push({k:"line",pts:[f*.98,-.05,f*.74,0],stroke:i,lw:.1}),r.push({k:"line",pts:[f*.94,.22,f*.74,.22],stroke:i,lw:.09})}if(o("spots")){let i=s(1,t.belly);r.push({k:"circle",x:-.55,y:-.5,r:.15,fill:i}),r.push({k:"circle",x:.58,y:-.42,r:.11,fill:i}),r.push({k:"circle",x:.22,y:-.76,r:.09,fill:i})}if(o("forehead")&&r.push({k:"path",d:C(_(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:s(0,t.accent)}),o("eye-spot")&&r.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:t.ears??t.accent}),o("gills"))for(let i of v)for(let f of[0,.12,.24])r.push({k:"path",d:`M${i*(.66+f)} 0.06 Q${i*(.6+f)} 0.22 ${i*(.66+f)} 0.38`,stroke:t.accent,lw:e*.9});let p=t.hair??t.outline;if(o("hair")&&r.push({k:"path",d:C(_(-1.02,-.06,-1.02,-.58,-.62,-1.04,.08,-1.14,.76,-.92,1.05,-.42,1,-.06,.84,-.4,.42,-.5,.06,-.4,-.34,-.56,-.74,-.38)),fill:p,...a}),o("locks")&&r.push({k:"path",d:C(_(-1,-.08,-.98,-.62,-.56,-1.02,0,-1.1,.56,-1.02,.98,-.62,1,-.08,.8,-.38,.36,-.44,0,-.4,-.36,-.44,-.8,-.38)),fill:p,...a}),o("curls")){for(let i=0;i<7;i++){let f=me(-1.3+i/6*2.6,.86);r.push({k:"circle",x:f.x,y:f.y,r:.3,fill:p,...a})}r.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:p})}if(o("ninja-hood")&&(r.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:t.skin??I,stroke:t.outline,lw:e*.8}),r.push({k:"path",d:"M-0.98 -0.42 Q0 -0.74 0.98 -0.42 L1.0 -0.62 Q0 -0.94 -1.0 -0.62 Z",fill:t.accent,...a})),o("domino")){r.push({k:"path",d:C(_(-.86,-.04,-.62,-.3,-.18,-.24,0,-.16,.18,-.24,.62,-.3,.86,-.04,.6,.22,.16,.16,0,.1,-.16,.16,-.6,.22),.9),fill:t.accent,...a});for(let i of v)r.push({k:"ellipse",x:i*.38,y:0,rx:.19,ry:.13,fill:I})}if(r.push(...an(n,e)),o("brows"))for(let i of v)r.push({k:"line",pts:[i*.72,-.5,i*.14,-.3],stroke:t.accent,lw:.16});if(n.face.brows)for(let i of v)r.push({k:"line",pts:[i*.2,-.2,i*.54,-.28],stroke:n.face.brows,lw:.09});if(r.push(...sn(n,e)),n.face.cheeks)for(let i of v)r.push({k:"ellipse",x:i*.64,y:.3,rx:.15,ry:.1,fill:n.face.cheeks,alpha:.8});if(o("whiskers"))for(let i of v)for(let f of[-.1,.06])r.push({k:"line",pts:[i*.62,.38+f,i*1.06,.3+f*2.2],stroke:t.outline,lw:e*.7,alpha:.75});if(o("rainbow-mane")){let i=n.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];r.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:i[0],...a}),r.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:i[1%i.length],...a})}if(n.ears==="unicorn"){let i=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];r.push({k:"path",d:R(i,.12),fill:t.accent,...a});for(let f of[-1,-1.2,-1.4]){let c=.16*((f+1.72)/.88);r.push({k:"line",pts:[-c,f+.04,c,f-.04],stroke:t.outline,lw:e*.7,alpha:.6})}}if(o("helmet")){for(let i of v)r.push({k:"rect",x:i*1,y:.05,w:.26,h:.56,r:.12,fill:t.accent,...a});r.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:I,lw:.1,alpha:.9})}if(o("bolts"))for(let i of v)r.push({k:"rect",x:i*1.08,y:.08,w:.2,h:.44,r:.08,fill:t.accent,...a});if(o("tuft")&&r.push({k:"path",d:C([{x:-.26,y:-.95},{x:-.12,y:-1.22},{x:.02,y:-1.04},{x:.16,y:-1.28},{x:.28,y:-.95},{x:0,y:-.86}]),fill:t.body,...a}),o("eggshell")&&r.push({k:"path",d:"M-0.88 -0.5 C-0.88 -1.12 -0.46 -1.42 0 -1.42 C0.46 -1.42 0.88 -1.12 0.88 -0.5 L0.66 -0.66 L0.44 -0.48 L0.22 -0.66 L0 -0.48 L-0.22 -0.66 L-0.44 -0.48 L-0.66 -0.66 Z",fill:s(0,I),...a}),o("wool"))for(let[i,f]of[[-.36,-.84],[.02,-.94],[.4,-.82]])r.push({k:"circle",x:i,y:f,r:.27,fill:t.body,...a});if(o("stripe")&&r.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:t.accent}),o("eye-patch")&&(r.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:t.outline,lw:.07}),r.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:t.outline})),o("bandana")){r.push({k:"path",d:C(_(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:t.accent,...a});for(let[i,f]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])r.push({k:"circle",x:i,y:f,r:.06,fill:I,alpha:.85});r.push({k:"circle",x:-.98,y:-.34,r:.15,fill:t.accent,...a})}if(o("cap")){for(let i of v)r.push({k:"line",pts:[i*.98,-.2,i*.5,.82,-i*.05,.98],stroke:t.outline,lw:.06});r.push({k:"path",d:C(_(-1.1,-.16,-1.04,-.66,-.6,-1.12,0,-1.24,.6,-1.12,1.04,-.66,1.1,-.16,.5,-.4,-.5,-.4)),fill:t.accent,...a}),r.push({k:"path",d:"M-0.74 -0.4 Q0 -0.6 0.74 -0.4 Q0.8 -0.24 0.6 -0.22 Q0 -0.36 -0.6 -0.22 Q-0.8 -0.24 -0.74 -0.4 Z",fill:t.accent,...a}),r.push({k:"circle",x:.5,y:-.82,r:.15,fill:s(0,I),...a});for(let i of[-.42,-.14])r.push({k:"line",pts:[i,-1.04,i+.02,-.78],stroke:t.outline,lw:.07,alpha:.7})}if(o("safari-hat")&&(r.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:t.accent,...a}),r.push({k:"path",d:C(_(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:t.accent,...a}),r.push({k:"path",d:"M-0.77 -0.72 Q0 -0.62 0.77 -0.72 L0.74 -0.9 Q0 -0.8 -0.74 -0.9 Z",fill:s(1,t.outline),stroke:t.outline,lw:e*.8})),o("wizard-hat")){r.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:t.accent,...a}),r.push({k:"path",d:R(_(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:t.accent,...a});let i=s(0,en);for(let[f,c,x]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])r.push({k:"group",x:f,y:c,s:x,items:[{k:"path",d:J,fill:i}]})}if(o("dive-mask")){for(let f of v)r.push({k:"line",pts:[f*.7,-.04,f*1,-.12],stroke:t.outline,lw:.2},{k:"line",pts:[f*.7,-.04,f*1,-.12],stroke:t.accent,lw:.11});r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:t.outline,lw:.2}),r.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:t.accent,lw:.11}),r.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:I,lw:.06,alpha:.9});let i="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";r.push({k:"path",d:i,stroke:t.outline,lw:.24},{k:"path",d:i,stroke:t.accent,lw:.13})}return r}function tn(n,e){let t=n.headExtras.includes("ninja-hood")?n.palette.body:n.palette.skin??n.palette.body;switch(n.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:t,...e};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:t,...e};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:t,...e};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:t,...e};case"bucket":return{k:"path",d:R(_(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:t,...e};case"bulb":return{k:"path",d:C([{x:0,y:-1.02},{x:.86,y:-.74},{x:1.08,y:-.12},{x:.72,y:.62},{x:0,y:.92},{x:-.72,y:.62},{x:-1.08,y:-.12},{x:-.86,y:-.74}]),fill:t,...e}}}function nn(n){return n.head==="round"?{cy:0,rx:1,ry:1}:n.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function rn(n,e){let{cy:t,rx:r,ry:a}=nn(n),o=r-e/2,s=a-e/2,u=.15,l=Math.asin(Math.min(1,(u-t)/s)),p=Math.cos(l)*o,i=d=>Math.round(d*100)/100||0,f=[D.M,i(-p),u],c=[[-.84*p,.02,-.53*p,.06,-.32*p,.24],[-.17*p,.11,.17*p,.11,.32*p,.24],[.53*p,.06,.84*p,.02,p,u]];for(let d of c)f.push(D.C,...d.map(i));let x=24;for(let d=1;d<=x;d++){let m=l+(Math.PI-2*l)*d/x;f.push(D.L,i(Math.cos(m)*o),i(t+Math.sin(m)*s))}return f.push(D.Z),f}function on(n,e){let t=n.palette,r={stroke:t.outline,lw:e},a=[];for(let o of v)switch(n.ears){case"pointy":case"unicorn":{let s=n.ears==="unicorn"?.8:1,u={x:o*.3,y:-.82},l={x:o*.86,y:-.82-.62*s},p={x:o*.94,y:-.36};a.push({k:"path",d:R([u,l,p],.2),fill:t.body,...r});let i={x:(u.x+l.x+p.x)/3,y:(u.y+l.y+p.y)/3},f=[u,l,p].map(c=>({x:i.x+(c.x-i.x)*.55,y:i.y+(c.y-i.y)*.55+.04}));a.push({k:"path",d:R(f,.25),fill:t.accent});break}case"round":a.push({k:"circle",x:o*.72,y:-.72,r:.36,fill:t.ears??t.body,...r}),t.ears||a.push({k:"circle",x:o*.74,y:-.74,r:.19,fill:t.accent});break;case"big-round":a.push({k:"circle",x:o*.96,y:-.46,r:.52,fill:t.body,...r}),a.push({k:"circle",x:o*1,y:-.44,r:.32,fill:t.accent});break;case"long":a.push({k:"ellipse",x:o*.38,y:-1.42,rx:.25,ry:.68,rot:o*.14,fill:t.body,...r}),a.push({k:"ellipse",x:o*.39,y:-1.36,rx:.12,ry:.48,rot:o*.14,fill:t.accent});break;case"side":a.push({k:"circle",x:o*1,y:.02,r:.34,fill:t.body,...r}),a.push({k:"circle",x:o*1.02,y:.02,r:.2,fill:t.belly});break;case"tufts":a.push({k:"path",d:R([{x:o*.3,y:-.84},{x:o*1.22,y:-1.12},{x:o*.92,y:-.42}],.16),fill:t.body,...r}),a.push({k:"line",pts:[o*.62,-.78,o*1,-.98],stroke:t.accent,lw:.08});break;case"antennae":{let s={x:o*.62,y:-1.42};a.push({k:"path",d:`M${o*.3} -0.8 Q${o*.36} -1.2 ${s.x} ${s.y}`,stroke:t.outline,lw:e*2.6}),a.push({k:"path",d:`M${o*.3} -0.8 Q${o*.36} -1.2 ${s.x} ${s.y}`,stroke:t.body,lw:e*1.2}),a.push({k:"circle",x:s.x,y:s.y,r:.17,fill:t.accent,...r});break}case"floppy":a.push({k:"ellipse",x:o*.96,y:.02,rx:.3,ry:.62,rot:-o*.36,fill:t.ears??t.body,...r});break;case"droopy":a.push({k:"ellipse",x:o*1.04,y:-.22,rx:.4,ry:.18,rot:o*.32,fill:t.skin??t.body,...r}),a.push({k:"ellipse",x:o*1.08,y:-.2,rx:.24,ry:.08,rot:o*.32,fill:t.accent});break;case"human":a.push({k:"ellipse",x:o*.98,y:.06,rx:.17,ry:.23,fill:t.skin??t.body,...r});break;case"horns":{let s=[{x:o*.3,y:-.84},{x:o*.6,y:-1.5},{x:o*.66,y:-.68}];a.push({k:"path",d:R(s,.18),fill:t.accent,...r});break}}return n.ears==="fin"&&a.push({k:"path",d:R(_(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:t.body,...r}),n.ears==="antenna"&&(a.push({k:"line",pts:[0,-.85,0,-1.42],stroke:t.outline,lw:e*2.6}),a.push({k:"line",pts:[0,-.85,0,-1.42],stroke:t.limbs,lw:e*1.2}),a.push({k:"circle",x:0,y:-1.5,r:.18,fill:t.accent,...r})),a}function an(n,e){let t=n.palette,r=n.face,a=[],o=t.outline,s=r.eyesOnTop?.46:.4,u=r.eyesOnTop?-.72:-.04,l=(p,i,f)=>({k:"circle",x:p,y:i,r:f,fill:I});switch(r.eyes){case"dot":for(let p of v)a.push({k:"ellipse",x:p*s,y:u,rx:.12,ry:.155,fill:o}),a.push(l(p*s+.04,u-.06,.045));break;case"bead":for(let p of v)a.push({k:"ellipse",x:p*s,y:u,rx:.16,ry:.22,fill:o}),a.push(l(p*s+.05,u-.08,.065));break;case"big":for(let p of v)r.eyeRing&&a.push({k:"circle",x:p*s,y:u,r:.36,fill:r.eyeRing,stroke:o,lw:e*.8}),a.push({k:"circle",x:p*s,y:u,r:.25,fill:I,stroke:o,lw:e*.8}),a.push({k:"circle",x:p*s+p*-.03,y:u+.03,r:.14,fill:r.eyeColor??o}),a.push(l(p*s+p*-.03+.05,u-.03,.05));break;case"mask":for(let p of v)a.push({k:"ellipse",x:p*.4,y:0,rx:.24,ry:.32,rot:p*-.55,fill:t.limbs}),a.push({k:"circle",x:p*.4,y:-.02,r:.11,fill:I}),a.push({k:"circle",x:p*.39,y:-0,r:.065,fill:o});break;case"screen":a.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:o,lw:e*.8});for(let p of v)a.push({k:"ellipse",x:p*.36,y:0,rx:.2,ry:.24,fill:r.eyeColor??"#7ff0ff",alpha:.3}),a.push({k:"ellipse",x:p*.36,y:0,rx:.12,ry:.16,fill:r.eyeColor??"#7ff0ff"});break;case"almond":for(let p of v)a.push({k:"ellipse",x:p*.42,y:-.02,rx:.3,ry:.2,rot:-p*.5,fill:r.eyeColor??o}),a.push(l(p*.42-p*.07,-.08,.07));break;case"calm":for(let p of v)a.push({k:"ellipse",x:p*.38,y:.02,rx:.085,ry:.12,fill:o}),a.push(l(p*.38+.03,-.02,.03));break;case"slit":a.push({k:"line",pts:[0,-.98,0,-.2],stroke:o,lw:e*.8,alpha:.5}),a.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:_e,stroke:o,lw:e*.8}),a.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:_e,stroke:o,lw:e*.8});for(let p of v){a.push({k:"ellipse",x:p*.4,y:-.04,rx:.12,ry:.07,fill:r.eyeColor??I});for(let i of[.36,.56])a.push({k:"circle",x:p*.42,y:i,r:.05,fill:o,alpha:.6})}break;case"goggle":for(let p of v)a.push({k:"circle",x:p*.9,y:0,r:.13,fill:t.accent,stroke:o,lw:e*.8});a.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:_e,stroke:o,lw:e*.8}),a.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:I,lw:.07,alpha:.8});for(let p of v)a.push({k:"path",d:`M${p*.5} 0.04 Q${p*.34} -0.08 ${p*.16} 0.02`,stroke:r.eyeColor??"#7fd6ff",lw:.08});for(let p of[-.18,0,.18])a.push({k:"line",pts:[p,.56,p,.72],stroke:o,lw:e*.8,alpha:.6});break;case"visor":a.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:o,lw:e*.8}),a.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:I,lw:.08,alpha:.7});for(let p of v)a.push({k:"ellipse",x:p*.28,y:.04,rx:.1,ry:.14,fill:r.eyeColor??"#cfeeff"});break}return a}function sn(n,e){let t=n.palette,r=n.face,a=[],o=r.eyes==="visor"?"#cfeeff":lt,s=e*1.05;switch(r.nose&&r.mouth!=="beak"&&(r.mouth==="cat"?a.push({k:"path",d:R([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:r.nose,stroke:r.nose,lw:e*.6}):n.ears==="big-round"?a.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:r.nose}):a.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:r.nose})),r.mouth){case"smile":a.push({k:"path",d:r.eyes==="visor"?"M-0.16 0.32 Q0 0.46 0.16 0.32":"M-0.17 0.42 Q0 0.58 0.17 0.42",stroke:o,lw:s});break;case"open":a.push({k:"path",d:"M-0.21 0.4 Q0 0.46 0.21 0.4 Q0.19 0.68 0 0.68 Q-0.19 0.68 -0.21 0.4 Z",fill:o,stroke:o,lw:e*.5}),a.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Jt});break;case"cat":a.push({k:"path",d:"M-0.19 0.4 Q-0.1 0.5 0 0.37 Q0.1 0.5 0.19 0.4",stroke:o,lw:s});break;case"beak":a.push({k:"path",d:R([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:t.accent,stroke:t.outline,lw:e*.8});break;case"teeth":a.push({k:"path",d:"M-0.36 0.34 Q0 0.44 0.36 0.34 Q0.28 0.66 0 0.66 Q-0.28 0.66 -0.36 0.34 Z",fill:o,stroke:o,lw:e*.5});for(let u of v)a.push({k:"rect",x:u*.12,y:.43,w:.1,h:.1,r:.03,fill:I});break;case"grill":a.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:t.outline,lw:e*.7});for(let u of[-.15,0,.15])a.push({k:"line",pts:[u,.51,u,.61],stroke:"#9fb0bd",lw:e*.6});break;case"tiny":a.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:o});break;case"smirk":a.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:o,lw:s});break;case"bill":a.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:t.accent,stroke:t.outline,lw:e*.8}),a.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:t.outline,lw:e*.7});for(let u of v)a.push({k:"circle",x:u*.1,y:.28,r:.03,fill:t.outline});break;case"hook":a.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:lt}),a.push({k:"path",d:"M-0.3 0.12 Q0 -0.02 0.3 0.12 Q0.36 0.52 0.04 0.76 Q0.08 0.52 -0.08 0.46 Q-0.28 0.38 -0.3 0.12 Z",fill:t.accent,stroke:t.outline,lw:e*.8});break;case"jaws":{a.push({k:"path",d:"M-0.5 0.3 Q0 0.5 0.5 0.3 Q0.38 0.72 0 0.72 Q-0.38 0.72 -0.5 0.3 Z",fill:o,stroke:o,lw:e*.5});for(let u of[-.34,-.17,0,.17,.34]){let l=.3+.4*(u+.5)*(.5-u)-.01;a.push({k:"path",d:R(_(u-.075,l,u+.075,l,u,l+.13),.15),fill:I})}break}}return a}var me=(n,e)=>({x:Math.sin(n)*e,y:-Math.cos(n)*e});var dt=.5,Y={leftEye:2,rightEye:5,leftEar:7,rightEar:8},Q={"3-5":{head:.75,neck:.74,arm:.3,leg:.36,hand:.19,foot:1.2,shoulderMin:.4,shoulderPad:.07,hipMin:.5,hipPad:.22,bottom:.26,bulge:1.12,armsOverHead:!0},"6-8":{head:.6,neck:.78,arm:.22,leg:.28,hand:.15,foot:1,shoulderMin:.34,shoulderPad:.04,hipMin:.4,hipPad:.16,bottom:.14,bulge:1.04,armsOverHead:!1},"9-12":{head:.5,neck:.92,arm:.17,leg:.21,hand:.125,foot:.9,shoulderMin:.36,shoulderPad:.07,hipMin:.32,hipPad:.08,bottom:.1,bulge:1,armsOverHead:!1}},ve="6-8",Ae=n=>n.band in Q?n.band:ve,ln=Q[ve].head,yt=.3,ht=.12,cn=.9,ct=.5,pt=.65,pn=.35,un=.2,fn=.25,q=(n,e)=>({x:n.x-e.x,y:n.y-e.y}),K=(n,e)=>({x:n.x+e.x,y:n.y+e.y}),$=(n,e)=>({x:n.x*e,y:n.y*e}),ee=n=>Math.hypot(n.x,n.y),ut=(n,e)=>({x:(n.x+e.x)/2,y:(n.y+e.y)/2}),Ne=n=>{let e=ee(n);return e>1e-9?{x:n.x/e,y:n.y/e}:{x:0,y:1}},dn=(...n)=>n.every(Number.isFinite),yn=n=>Math.atan2(Math.sin(n),Math.cos(n)),hn=(n,e,t)=>Math.min(Math.max(n,e),t);function mt(n,e,t=!1){return r=>{let a=n[r*3],o=n[r*3+1],s=n[r*3+2];return a===void 0||o===void 0||s===void 0||!dn(a,o,s)?{x:0,y:0,ok:!1}:{x:e.x+(t?1-a:a)*e.w,y:e.y+o*e.h,ok:s>=dt}}}function le(n,e,t={}){let r=mt(n,e,t.mirrored),a=r(P.leftShoulder),o=r(P.rightShoulder);if(!a.ok||!o.ok)return null;let s=r(P.leftHip),u=r(P.rightHip),l=ut(a,o),p=ee(q(o,a)),i=s.ok&&u.ok,f=Ne(q(o,a));p<1e-6&&(f={x:1,y:0});let c,x,d;if(i){let Z=ut(s,u);x=ee(q(Z,l)),x>=p*fn?c=Ne(q(Z,l)):(c={x:-f.y,y:f.x},c.y<0&&(c=$(c,-1))),d=Math.max(x,p*1.15)}else c={x:-f.y,y:f.x},c.y<0&&(c=$(c,-1)),d=p*1.15,x=d;d=Math.max(d,1e-6);let m={x:c.y,y:-c.x},h=Math.atan2(m.y,m.x),b=$(c,-1),w=Q[t.band??ve]??Q[ve],T=w.head*d,G=K(l,$(b,T*w.neck)),ue=r(P.nose);if(ue.ok){let Z=K(ue,$(b,T*.15)),fe=$(q(Z,G),pn),Me=Math.min(1,T*un/Math.max(ee(fe),1e-6));G=K(G,$(fe,Me))}return{S:l,r:m,d:c,U:d,L:x,hipsOk:i,head:G,headR:T,headRot:h+mn(n,r,h,d),angle:h}}function mn(n,e,t,r){let a=[[Y.leftEar,Y.rightEar],[Y.leftEye,Y.rightEye]];for(let[o,s]of a){let u=e(o),l=e(s);if(!u.ok||!l.ok||!(n[o*3+2]>=pt&&n[s*3+2]>=pt)||ee(q(l,u))<r*.05)continue;let p=yn(Math.atan2(l.y-u.y,l.x-u.x)-t),i=Math.max(Math.abs(p)-ht,0),f=hn((cn+ct-Math.abs(p))/ct,0,1);return Math.sign(p)*Math.min(i,yt)*f}return 0}function ce(n,e,t,r={}){let a=Ae(e),o=Q[a],s=le(n,t,{...r,band:a});if(!s)return[];let u=mt(n,t,r.mirrored),l=e.palette,{S:p,r:i,d:f,U:c,L:x}=s,d=y=>e.bodyExtras.includes(y),m=Math.max(1.2,c*.045),h={stroke:l.outline,lw:m},b=(y,k)=>({x:p.x+i.x*y+f.x*k,y:p.y+i.y*y+f.y*k}),w=y=>y.map(([k,g])=>b(k,g)),T=u(P.leftShoulder),G=u(P.rightShoulder),ue=u(P.leftHip),Z=u(P.rightHip),fe=ee(q(G,T)),Me=s.hipsOk?ee(q(Z,ue)):fe*.7,E=Math.max(fe/2+o.shoulderPad*c,o.shoulderMin*c),z=Math.max(Me/2+o.hipPad*c,o.hipMin*c),N=-.1*c,te=x+o.bottom*c,X=[],xe=[],S=[],ke=[],Ge=[],Ve=(y,k,g,M)=>{let A=k.flatMap(F=>[F.x,F.y]);y.push({k:"line",pts:A,stroke:l.outline,lw:g+m*2}),y.push({k:"line",pts:A,stroke:M,lw:g})},Ot=o.leg*c,zt=o.arm*c,je=Math.max(o.arm/.22,.9);if(s.hipsOk)for(let[y,k,g,M]of[[ue,P.leftKnee,P.leftAnkle,-1],[Z,P.rightKnee,P.rightAnkle,1]]){let A=u(k),F=u(g);if(!A.ok)continue;let Pe=K(y,$(f,-.12*c)),ne=F.ok?[Pe,A,F]:[Pe,A];Ve(xe,ne,Ot,l.limbs),d("joints")&&xe.push({k:"circle",x:A.x,y:A.y,r:.15*c*je,fill:l.accent,...h}),F.ok&&xe.push(kn(e,F,s,M,m,o.foot))}for(let[y,k,g,M]of[[T,P.leftElbow,P.leftWrist,-1],[G,P.rightElbow,P.rightWrist,1]]){let A=u(k),F=u(g);if(d("pauldrons")){let re=K(y,$(f,.02*c));ke.push({k:"ellipse",x:re.x,y:re.y,rx:.25*c,ry:.17*c,rot:s.angle+M*.25,fill:l.body,...h});let ye=K(re,$(f,.05*c));ke.push({k:"ellipse",x:ye.x,y:ye.y,rx:.17*c,ry:.07*c,rot:s.angle+M*.25,fill:l.belly})}if(!A.ok)continue;let ne=o.armsOverHead&&(A.x-p.x)*f.x+(A.y-p.y)*f.y<-.25*c?Ge:ke,Ke=K(y,$(f,.04*c));if(Ve(ne,F.ok?[Ke,A,F]:[Ke,A],zt,l.limbs),d("joints")&&ne.push({k:"circle",x:A.x,y:A.y,r:.13*c*je,fill:l.accent,...h}),!F.ok)continue;let de=Ne(q(F,A)),Be=K(F,$(de,.05*c));if(d("feathers"))for(let re of[-.55,0,.55]){let ye=Math.cos(re),Ue=Math.sin(re)*M,Ce={x:de.x*ye-de.y*Ue,y:de.x*Ue+de.y*ye},Ye=K(Be,$(Ce,.16*c));ne.push({k:"ellipse",x:Ye.x,y:Ye.y,rx:.2*c,ry:.09*c,rot:Math.atan2(Ce.y,Ce.x),fill:l.hands??l.accent,...h})}ne.push({k:"circle",x:Be.x,y:Be.y,r:o.hand*c,fill:l.hands??l.limbs,...h})}if(d("wings"))for(let y of[-1,1]){let k=w([[y*E*.5,.05*c],[y*(E+.85*c),-.6*c],[y*(E+.72*c),.05*c],[y*(E+.45*c),-.02*c],[y*(E+.3*c),.32*c],[y*E*.6,.55*c]]);X.push({k:"path",d:R(k,.18),fill:l.accent,...h})}if(d("cape")){let y=x+.8*c,k=z+.36*c,g=w([[-E*.92,N+.04*c],[E*.92,N+.04*c],[E+.16*c,x*.5],[k,y],[k*.5,y-.1*c],[0,y],[-k*.5,y-.1*c],[-k,y],[-E-.16*c,x*.5]]);X.push({k:"path",d:C(g,.6),fill:l.accent,...h})}if(d("backpack")){let y=b(0,.35*c);X.push({k:"rect",x:y.x,y:y.y,w:E*2+.34*c,h:.8*c,r:.16*c,rot:s.angle,fill:e.extraColors?.[0]??l.limbs,...h})}if(d("tank")){let y=b(E*.95,.24*c),k=e.extraColors?.[0]??l.accent,g=b(E*.95,-.3*c);X.push({k:"rect",x:g.x,y:g.y,w:.14*c,h:.16*c,r:.04*c,rot:s.angle,fill:l.outline}),X.push({k:"rect",x:y.x,y:y.y,w:.34*c,h:1*c,r:.17*c,rot:s.angle,fill:k,...h})}if(s.hipsOk&&!r.portrait&&X.push(...gn(e,s,z,m)),d("tentacles")&&s.hipsOk)for(let y of[-1,1]){let k=w([[y*z*.7,x*.9],[y*(z+.22*c),x+.3*c],[y*(z+.48*c),x+.22*c],[y*(z+.5*c),x-.02*c],[y*(z+.34*c),x-.06*c]]);X.push({k:"path",d:ie(k),stroke:l.outline,lw:.2*c+m*2}),X.push({k:"path",d:ie(k),stroke:l.limbs,lw:.2*c})}let W=Math.max(E,z)*o.bulge;if(d("wool")){for(let[k,g]of[[E*.7,N+.02*c],[W,x*.3],[W*1.02,x*.62],[(W+z)/2,x*.92],[z*.55,te]])for(let M of[-1,1]){let A=b(M*k,g);S.push({k:"circle",x:A.x,y:A.y,r:.2*c,fill:l.body,...h})}let y=b(0,te+.02*c);S.push({k:"circle",x:y.x,y:y.y,r:.2*c,fill:l.body,...h})}if(d("robe")){let y=x+.58*c,k=z*1.4;S.push({k:"path",d:C(w([[-E,N],[0,N-.04*c],[E,N],[W,x*.55],[k,y],[0,y+.06*c],[-k,y],[-W,x*.55]]),.7),fill:l.body,...h});let g=w([[-k*.94,y-.1*c],[0,y-.04*c],[k*.94,y-.1*c]]);S.push({k:"path",d:ie(g),stroke:e.extraColors?.[0]??l.accent,lw:.07*c})}else if(d("sheet")){let y=x+.78*c,k=z*1.3;S.push({k:"path",d:C(w([[-E,N],[E,N],[W,x*.55],[k,y],[k*.5,y-.2*c],[0,y],[-k*.5,y-.2*c],[-k,y],[-W,x*.55]]),.9),fill:l.body,...h})}else S.push({k:"path",d:C(w([[-E,N],[0,N-.04*c],[E,N],[W,x*.55],[z,te],[0,te+.03*c],[-z,te],[-W,x*.55]]),.85),fill:l.body,...h});let U=Math.min(E,z);if(d("pocket")){let y=b(0,x*.74);S.push({k:"rect",x:y.x,y:y.y,w:U*1.3,h:.3*c,r:.1*c,rot:s.angle,fill:l.belly,stroke:l.outline,lw:m*.8})}else if(d("racing-stripe"))for(let y of[-.1,.1]){let k=b(y*c,N+.02*c),g=b(y*c,te-.04*c);S.push({k:"line",pts:[k.x,k.y,g.x,g.y],stroke:l.belly,lw:.1*c})}else if(l.belly&&l.belly!==l.body&&!d("panel")&&!d("sheet")&&!d("stripes")){let y=b(0,x*.58);S.push({k:"ellipse",x:y.x,y:y.y,rx:U*.64,ry:Math.max(x*.36,.2*c),rot:s.angle,fill:l.belly})}if(d("spots")){let y=e.extraColors?.[1]??l.belly;for(let[k,g,M]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){let A=b(k*U,g*x);S.push({k:"circle",x:A.x,y:A.y,r:M*c,fill:y})}}if(d("stripes")){let y=e.extraColors?.[1]??l.accent;for(let k of[.22,.44,.66]){let g=b(-U*.98,x*k),M=b(U*.98,x*k);S.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:y,lw:.1*c})}}if(d("straps")){let y=e.extraColors?.[1]??l.outline;for(let k of[-1,1]){let g=b(k*E*.62,N+.02*c),M=b(k*U*.62,x*.72);S.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:l.outline,lw:.13*c+m*2}),S.push({k:"line",pts:[g.x,g.y,M.x,M.y],stroke:y,lw:.13*c})}}if(d("belt")){let y=b(0,x*.9);S.push({k:"rect",x:y.x,y:y.y,w:z*1.92,h:.17*c,r:.06*c,rot:s.angle,fill:e.extraColors?.[2]??"#4a3426",...h}),S.push({k:"rect",x:y.x,y:y.y,w:.2*c,h:.19*c,r:.04*c,rot:s.angle,fill:"#ffd84a",...h})}if(d("emblem")){let y=b(0,x*.4),k=e.extraColors?.[0]??l.accent,g=R([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);S.push({k:"group",x:y.x,y:y.y,rot:s.angle,s:c,items:[{k:"path",d:g,fill:k,stroke:l.outline,lw:m/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:J,fill:k===l.accent?"#ffffff":l.accent}]}]})}if(d("panel")){let y=b(0,x*.5);S.push({k:"rect",x:y.x,y:y.y,w:U*1.2,h:.38*c,r:.1*c,rot:s.angle,fill:"#24323d",...h}),(e.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((g,M)=>{let A=b((M-1)*U*.34,x*.5);S.push({k:"circle",x:A.x,y:A.y,r:.075*c,fill:g})})}if(d("badge")){let y=b(-U*.42,x*.36);S.push({k:"circle",x:y.x,y:y.y,r:.15*c,fill:l.accent,...h}),S.push({k:"group",x:y.x,y:y.y,rot:s.angle,s:.09*c,items:[{k:"path",d:J,fill:"#ffffff"}]})}if(d("star")){let y=b(-U*.5,x*.3),k=.15*c;S.push({k:"group",x:y.x,y:y.y,rot:s.angle-.2,s:k,items:[{k:"path",d:J,fill:e.extraColors?.[0]??"#ffd84a",stroke:l.outline,lw:m*.8/k}]})}if(d("scarf")){let y=Math.max(.04,o.head*(1-o.neck)-.06)*c,k=b(0,y),g=e.extraColors?.[0]??l.accent,M=b(E*.45,y+.28*c);S.push({k:"rect",x:M.x,y:M.y,w:.16*c,h:.42*c,r:.06*c,rot:s.angle+.15,fill:g,...h}),S.push({k:"rect",x:k.x,y:k.y,w:E*2.05,h:.2*c,r:.1*c,rot:s.angle,fill:g,...h})}let It={k:"group",x:s.head.x,y:s.head.y,rot:s.headRot,s:s.headR,items:xn(e,m/s.headR)};return[...X,...xe,...S,...ke,It,...Ge]}var ft=new WeakMap,bn=64;function xn(n,e){let t=Number(e.toPrecision(4)),r=ft.get(n);r||ft.set(n,r=new Map);let a=r.get(t);return a||(r.size>=bn&&r.clear(),r.set(t,a=we(n,t))),a}function kn(n,e,t,r,a,o){let s=n.palette,{d:u,r:l}=t,p=t.U*o,i=K(K(e,$(u,.07*p)),$(l,r*.06*p)),f={stroke:s.outline,lw:a},c=s.feet??s.limbs;if(n.bodyExtras.includes("fins")){let x=R([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:i.x,y:i.y,rot:t.angle,s:p,items:[{k:"path",d:x,fill:c,stroke:s.outline,lw:a/p},{k:"line",pts:[0,.06,0,.38],stroke:s.outline,lw:a/p,alpha:.5}]}}return n.bodyExtras.includes("flippers")?{k:"ellipse",x:i.x,y:i.y,rx:.27*p,ry:.11*p,rot:t.angle,fill:c,...f}:n.bodyExtras.includes("boots")?{k:"rect",x:i.x,y:i.y,w:.4*p,h:.24*p,r:.09*p,rot:t.angle,fill:c,...f}:{k:"ellipse",x:i.x,y:i.y,rx:.2*p,ry:.13*p,rot:t.angle,fill:c,...f}}function gn(n,e,t,r){let a=n.palette,{U:o,L:s,S:u,r:l,d:p}=e,i=(m,h)=>({x:u.x+l.x*m+p.x*h,y:u.y+l.y*m+p.y*h}),f=m=>m.map(([h,b])=>i(h,b)),c={stroke:a.outline,lw:r},x=(m,h,b)=>[{k:"path",d:ie(m),stroke:a.outline,lw:h+r*2},{k:"path",d:ie(m),stroke:b,lw:h}],d=[];switch(n.tail){case"none":break;case"fluffy":{let m=f([[t*.5,s*.95],[t+.28*o,s*1],[t+.72*o,s*.62],[t+.78*o,s*.12],[t+.52*o,s*.32],[t+.3*o,s*.6],[t*.6,s*.7]]);d.push({k:"path",d:C(m),fill:a.body,...c});let h=i(t+.72*o,s*.2);d.push({k:"ellipse",x:h.x,y:h.y,rx:.13*o,ry:.2*o,rot:e.angle+.25,fill:a.belly,...c});break}case"brush":{let m=f([[t*.4,s*.98],[t+.42*o,s*1.06],[t+.98*o,s*.66],[t+1.06*o,s*.12],[t+.86*o,-.04*o],[t+.66*o,s*.36],[t+.3*o,s*.66],[t*.5,s*.68]]);d.push({k:"path",d:C(m),fill:a.body,...c});let h=f([[t+1.03*o,s*.36],[t+1.06*o,s*.12],[t+.86*o,-.04*o],[t+.72*o,s*.24],[t+.86*o,s*.34]]);d.push({k:"path",d:C(h),fill:a.belly,...c});break}case"pom":{let m=i(t+.06*o,s*.88);d.push({k:"circle",x:m.x,y:m.y,r:.2*o,fill:a.belly,...c});break}case"long":case"striped":case"tuft":{let m=f([[t*.6,s*.9],[t+.35*o,s*.85],[t+.58*o,s*.4],[t+.5*o,-.02*o]]);if(d.push(...x(m,.14*o,a.body)),n.tail==="tuft"){let h=m[m.length-1];d.push({k:"circle",x:h.x,y:h.y,r:.16*o,fill:n.extraColors?.[0]??a.accent,...c})}if(n.tail==="striped"){for(let b of[.35,.6,.85]){let w=i(t+.35*o+.22999999999999998*o*(b*1.4>1?1:b*1.4),s*(.85-.85*b));d.push({k:"line",pts:[w.x-l.x*.08*o,w.y-l.y*.08*o,w.x+l.x*.08*o,w.y+l.y*.08*o],stroke:n.extraColors?.[0]??a.outline,lw:.06*o})}let h=m[m.length-1];d.push({k:"circle",x:h.x,y:h.y,r:.07*o,fill:n.extraColors?.[0]??a.outline})}break}case"curl":{let m=f([[t*.6,s*.9],[t+.4*o,s*.88],[t+.62*o,s*.45],[t+.5*o,s*.12],[t+.3*o,s*.24],[t+.36*o,s*.42]]);d.push(...x(m,.12*o,a.limbs));break}case"fish":{let m=f([[t*.6,s*.9],[t+.36*o,s*.86],[t+.6*o,s*.5]]);d.push(...x(m,.17*o,a.body));let h=m[m.length-1],b=R([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);d.push({k:"group",x:h.x,y:h.y,rot:e.angle+.35,s:o,items:[{k:"path",d:b,fill:a.body,stroke:a.outline,lw:r/o}]});break}case"plume":{let m=n.extraColors??[a.accent];[0,1,2].forEach(h=>{let b=i(t+(.12+h*.13)*o,s+(.32-h*.06)*o);d.push({k:"ellipse",x:b.x,y:b.y,rx:.11*o,ry:.44*o,rot:e.angle-.55+h*.28,fill:m[(h+1)%m.length],...c})});break}case"spiky":case"arrow":{let m=f([[t*.3,s*.55],[t+.35*o,s*.68],[t+.95*o,s*.86],[t+.35*o,s*1.08],[t*.3,s*1.08]]);if(n.tail==="spiky"){for(let h of[.15,.45,.72]){let b=t+(.2+h*.7)*o,w=s*(.66+h*.19);d.push({k:"path",d:R(f([[b-.12*o,w+.05*o],[b,w-.2*o],[b+.12*o,w+.07*o]]),.2),fill:a.accent,...c})}d.push({k:"path",d:C(m,.7),fill:a.body,...c})}else{let h=f([[t*.6,s*.9],[t+.4*o,s*.92],[t+.62*o,s*.5],[t+.62*o,s*.18]]);d.push(...x(h,.13*o,a.body));let b=h[h.length-1];d.push({k:"group",x:b.x,y:b.y,rot:e.angle,s:o,items:[{k:"path",d:R([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:a.accent,stroke:a.outline,lw:r/o}]})}break}}return d}var wn={nose:[0,-.62],leftShoulder:[-.42,0],rightShoulder:[.42,0],leftElbow:[-.58,.5],rightElbow:[.58,.5],leftWrist:[-.66,.98],rightWrist:[.66,.98],leftHip:[-.27,1],rightHip:[.27,1],leftKnee:[-.31,1.6],rightKnee:[.31,1.6],leftAnkle:[-.33,2.18],rightAnkle:[.33,2.18]};function vn(n,{cx:e=.5,cy:t=.36,T:r=.18}={}){let a={...wn,...n},o=new Array(Re*3).fill(0),s=(p,[i,f],c=.99)=>{o[p*3]=e+i*r,o[p*3+1]=t+f*r,o[p*3+2]=c};for(let p of Object.keys(P))s(P[p],a[p]);let u=a.tilt??0,l=(p,i)=>[a.nose[0]+p*Math.cos(u)-i*Math.sin(u),a.nose[1]+p*Math.sin(u)+i*Math.cos(u)];return s(Y.leftEye,l(-.1,-.08)),s(Y.rightEye,l(.1,-.08)),s(Y.leftEar,l(-.22,-.02)),s(Y.rightEar,l(.22,-.02)),o}var bt=()=>vn({});var be=class{constructor(e={}){O(this,"tracks",new Map);O(this,"offset",NaN);O(this,"lastArrival",NaN);O(this,"interval",33);O(this,"lastT",NaN);O(this,"lostMs");O(this,"maxExtrapolateMs");this.lostMs=e.lostMs??250,this.maxExtrapolateMs=e.maxExtrapolateMs??25}get delayMs(){return this.interval}push(e,t,r,a=xt()){Number.isFinite(t)||(t=a),this.clock(t,a);let o=this.tracks.get(e);if(!o||t-o.tb>this.lostMs||t<o.tb-this.lostMs||r.length!==o.b.length){this.tracks.set(e,{a:null,ta:t,b:r,tb:t,out:null,outAt:NaN});return}if(r===o.b||t<=o.tb){t===o.tb&&r!==o.b&&(o.b=r,o.out=null);return}o.a=o.b,o.ta=o.tb,o.b=r,o.tb=t,o.out=null}at(e,t=xt()){let r=this.tracks.get(e);if(!r)return null;if(!r.a)return r.b;if(r.out&&r.outAt===t)return r.out;let a=t-this.offset-this.interval,o=r.tb-r.ta,s=Math.min(o*.5,this.maxExtrapolateMs),u=Math.min(Math.max((a-r.ta)/o,0),1+s/o);return r.out=kt(r.a,r.b,u),r.outAt=t,r.out}forget(e){this.tracks.delete(e)}clear(){this.tracks.clear()}clock(e,t){let r=t-e;if(!Number.isFinite(this.offset)||r<this.offset||r>this.offset+1e3?this.offset=r:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(r-this.offset,(t-this.lastArrival)/1e3)),this.lastArrival=t,Number.isFinite(this.lastT)&&e>this.lastT){let a=e-this.lastT;a<this.interval*3+20&&(this.interval+=(Math.min(Math.max(a,8),100)-this.interval)*.1)}e<=this.lastT||(this.lastT=e)}},xt=()=>globalThis.performance?.now()??Date.now();function kt(n,e,t){let r=e.slice(),a=t<.5?n:e;for(let o=0;o+2<e.length;o+=3){let s=n[o],u=n[o+1],l=e[o],p=e[o+1];n[o+2]>=.5&&e[o+2]>=.5&&Math.abs(l-s)+Math.abs(p-u)<.15?(r[o]=s+(l-s)*t,r[o+1]=u+(p-u)*t,r[o+2]=n[o+2]+(e[o+2]-n[o+2])*Math.min(t,1)):(r[o]=a[o],r[o+1]=a[o+1],r[o+2]=a[o+2])}return r}var or=$e.map(n=>n.id);var Ee=new Map($e.map(n=>[n.id,n])),Fe=Ee.get("fox"),gt=n=>typeof n=="string"&&Ee.has(n),wt=n=>Ee.get(n);var vt=n=>typeof n=="string"?Ee.get(n)??Fe:n;function At(n,e,t,r,a={}){let o=ce(e,vt(t),r,{mirrored:a.mirrored});return o.length?(n.save(),a.alpha!==void 0&&(n.globalAlpha*=Math.min(Math.max(a.alpha,0),1)),se(n,o),n.restore(),!0):!1}function Et(n,e){let t=vt(n),r=bt(),a=Ae(t),o=le(r,{x:0,y:0,w:1,h:1},{band:a}),s=-Mt(we(t,.05)).minY,l=Math.min(.27,.43/Math.max(s,1))*e/Q[a].head/o.U,p=.5*e+Math.min(0,(s-1.6)*.06*e),i={x:e/2-o.head.x*l,y:p-o.head.y*l,w:l,h:l};return ce(r,t,i,{portrait:!0})}function St(n,e,t=.5){if(!n||n.length!==e.length)return e.slice();let r=e.slice();for(let a=0;a+2<e.length;a+=3){let o=n[a+2],s=e[a+2],u=o>=.5,l=s>=.5;u&&s>=.3&&(r[a+2]=Math.max(s,.5)),u&&l&&Math.hypot(e[a]-n[a],e[a+1]-n[a+1])<.15?(r[a]=n[a]+(e[a]-n[a])*t,r[a+1]=n[a+1]+(e[a+1]-n[a+1])*t):u&&!l&&r[a+2]>=.5&&(r[a]=n[a],r[a+1]=n[a+1])}return Mn(n,e,r,t*En),r}var En=.35,Sn=11;function Mn(n,e,t,r){let a=P.leftShoulder*3,o=P.rightShoulder*3,s=(f,c)=>f[c+2]>=.5;if(!s(n,a)||!s(n,o)||!s(e,a)||!s(e,o))return;let u=(f,c)=>(f[a+c]+f[o+c])/2,l=[u(n,0),u(n,1)],p=[u(e,0),u(e,1)],i=[u(t,0),u(t,1)];for(let f=0;f<Sn&&f*3+2<e.length;f++){let c=f*3;if(!s(n,c)||!s(e,c))continue;let x=[n[c]-l[0],n[c+1]-l[1]],d=[e[c]-p[0],e[c+1]-p[1]];Math.hypot(d[0]-x[0],d[1]-x[1])>=.15||(t[c]=i[0]+x[0]+(d[0]-x[0])*r,t[c+1]=i[1]+x[1]+(d[1]-x[1])*r)}}function Mt(n){let e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},t=(r,a)=>{e.minX=Math.min(e.minX,r),e.minY=Math.min(e.minY,a),e.maxX=Math.max(e.maxX,r),e.maxY=Math.max(e.maxY,a)};for(let r of n){let a="lw"in r&&r.stroke?(r.lw??1)/2:0;switch(r.k){case"circle":t(r.x-r.r-a,r.y-r.r-a),t(r.x+r.r+a,r.y+r.r+a);break;case"ellipse":case"rect":{let o=r.k==="ellipse"?r.rx:r.w/2,s=r.k==="ellipse"?r.ry:r.h/2,u=Math.max(o,s)+a;t(r.x-u,r.y-u),t(r.x+u,r.y+u);break}case"path":{let o=Le(r.d);for(let s=0;s+1<o.length;s+=2)t(o[s]-a,o[s+1]-a),t(o[s]+a,o[s+1]+a);break}case"line":for(let o=0;o+1<r.pts.length;o+=2)t(r.pts[o]-a,r.pts[o+1]-a),t(r.pts[o]+a,r.pts[o+1]+a);break;case"group":{let o=Mt(r.items);if(!Number.isFinite(o.minX))break;let s=r.s??1,u=Math.cos(r.rot??0),l=Math.sin(r.rot??0);for(let[p,i]of[[o.minX,o.minY],[o.maxX,o.minY],[o.minX,o.maxY],[o.maxX,o.maxY]])t(r.x+(p*u-i*l)*s,r.y+(p*l+i*u)*s);break}}}return e}var Pn=()=>{let n=typeof document<"u"?document.timeline?.currentTime:null;return typeof n=="number"&&Number.isFinite(n)?n:globalThis.performance?.now()??Date.now()},Pt=()=>globalThis.performance?.now()??Date.now(),pe=class{constructor(e=Pn){O(this,"now",e);O(this,"known",new Map);O(this,"smoothed",new Map);O(this,"times",new WeakMap);O(this,"lerp",new be);O(this,"drawnAt",NaN);O(this,"drawn",0);O(this,"smoothedBody",(e,t={})=>{let r=t.interpolate!==!1;if(typeof e=="number"){let a=this.smoothed.get(e);return a?r?this.lerp.at(e,this.tick())??a.body:a.body:null}return typeof e!="object"||e===null||!Array.isArray(e.body)?null:this.posed(e.id,e.body,Bt(t.smooth),r)})}note(e,t,r=Pt()){for(let a of e)this.known.set(a.id,this.resolve(a.id,a.avatar)),t!==void 0&&Number.isFinite(t)&&Array.isArray(a.body)&&this.times.set(a.body,{t,arrival:r})}of(e){return typeof e=="object"&&e!==null?e.avatar!==void 0?this.resolve(e.id,e.avatar):this.of(e.id):this.known.get(e)??De(e-1)}posed(e,t,r,a=!0){let o=this.smooth(e,t,r);return a?this.lerp.at(e,this.tick())??o:o}smooth(e,t,r){let a=this.smoothed.get(e);if(a&&a.raw===t&&a.amount===r)return a.body;a&&a.amount!==r&&this.lerp.forget(e);let o=r<1?St(a?.body,t,r):t;this.smoothed.set(e,{raw:t,body:o,amount:r});let s=this.times.get(t),u=s?.arrival??Pt();return this.lerp.push(e,s?.t??u,o,u),o}takeDrawn(){let e=this.drawn;return this.drawn=0,e}tick(){let e=this.now();return e!==this.drawnAt&&(this.drawnAt=e,this.drawn++),e}resolve(e,t){return gt(t)?t:De(e-1)}};function Bn(n,e){let t=typeof n.getTransform=="function"?n.getTransform():null,r=t&&Math.hypot(t.a,t.b)||1,a=t&&Math.hypot(t.c,t.d)||1,o=(n.canvas?.width??0)/r,s=(n.canvas?.height??0)/a;return e?{x:e.x*o,y:e.y*s,w:e.w*o,h:e.h*s}:{x:0,y:0,w:o,h:s}}var Bt=n=>n===!1?1:typeof n=="number"?Math.min(Math.max(n,.05),1):.5;function Se(n,e){return(t,r,a,o,s={})=>{let u=Array.isArray(r)?null:r,l=u?u.body:r;if(!Array.isArray(l))return null;let p=typeof a=="string"?a:n.of(typeof a=="number"?a:u??1),i=typeof a=="number"?a:u?.id,f=i!==void 0?n.posed(i,l,Bt(s.smooth),s.interpolate!==!1):l;return At(t,f,p,o??Bn(t,e().view),s.alpha!==void 0?{alpha:s.alpha}:{})?f:null}}function Tt(n){let e=new Map,t=(l,p)=>e.get(l)?.forEach(i=>i(p)),r=null,a=[],o=l=>r?l(r):a.push(l),s=new pe,u=Se(s,()=>({view:null}));return n.then(l=>{r=l;let p=new Map;l.on("gesture",i=>t(i.gesture,{player:i.player})),l.on("pause",i=>t("pause",{reason:i.reason==="distance"?"distance":"user"})),l.on("resume",()=>t("resume",{})),l.on("break-start",()=>t("break-start",{})),l.on("break-done",i=>t("break-end",{shown:i.shown})),l.onBackdrop((i,f)=>t("backdrop",{backdrop:i,view:f})),l.on("frame",i=>{t("players",{players:i.players});for(let f of i.players)t("hands",{player:f.id,left:f.leftHand,right:f.rightHand}),p.get(f.id)!==f.shape&&(p.set(f.id,f.shape),t("shape",{player:f.id,shape:f.shape}))}),t("start",Ct(l)),a.splice(0).forEach(i=>i(l))}),{on(l,p){let i=e.get(l)??new Set;return e.set(l,i),i.add(p),l==="start"&&r&&p(Ct(r)),()=>{i.delete(p)}},ready:()=>o(l=>l.ready()),score:(l,p=1)=>o(i=>i.score(p,l)),break:l=>new Promise(p=>o(i=>{i.break(l).then(p)})),end:l=>o(p=>p.end(typeof l=="number"?[{player:1,score:l,stars:2}]:l.map(i=>({player:i.player,score:i.score,stars:i.stars??2})))),keys:(l,p)=>o(i=>{Je(i,l,p)}),pointer:l=>o(p=>{et(p,l)}),get view(){return r?.view??null},get device(){return r?.device??null},reportStats:l=>r?.reportStats(l),toScreen:l=>r?r.toScreen(l):ge(null,l),avatarOf:l=>r?r.avatarOf(l):s.of(l),drawAvatar:(...l)=>r?r.drawAvatar(...l):u(...l),smoothedBody:(...l)=>r?r.smoothedBody(...l):s.smoothedBody(...l)}}var Ct=n=>({ageRange:n.ageRange,players:n.players,locale:n.locale,mode:n.mode,backdrop:n.backdrop,view:n.view,device:n.device});var Cn=(n=window)=>({post:e=>n.parent.postMessage(e,"*"),listen:e=>n.addEventListener("message",t=>t.source===n.parent&&e(t.data))}),Tn=1e4,Rn=1e3;function Rt(n=Cn()){return new Promise((e,t)=>{let r=new Map,a=[],o=!1,s="none",u=null,l=new Set,p=new pe,i=Se(p,()=>({view:u})),f=p.smoothedBody,c=setTimeout(()=>t(new Error("Fabi Play: no host, is the game opened from Fabi Play?")),Tn);n.listen(x=>{if(typeof x!="object"||x===null||x.ns!==Oe)return;let d=x;if(d.type==="init"&&!o){if(d.v!==Te)return clearTimeout(c),t(new Error(`Fabi Play: protocol ${d.v}, this SDK speaks ${Te}`));o=!0,clearTimeout(c),s=d.backdrop==="video"?"video":"none",u=ze(d.view)??null;let m=ot(d.device)??null,h={};if(d.stats===!0){let b=performance.now();setInterval(()=>{let T=performance.now();n.post(ae({type:"stats",renderFps:Math.round(p.takeDrawn()*1e3/Math.max(T-b,1)),...h})),b=T},Rn).unref?.()}e({locale:d.locale,mode:d.mode,players:d.players,muted:d.muted,ageRange:d.ageRange??"6-8",get backdrop(){return s},get view(){return u},device:m,reportStats:b=>{h=at(b)},toScreen:b=>ge(u,b),avatarOf:b=>p.of(b),drawAvatar:i,smoothedBody:f,onBackdrop(b){return l.add(b),()=>{l.delete(b)}},on(b,w){let T=r.get(b)??new Set;return r.set(b,T),T.add(w),()=>{T.delete(w)}},ready:()=>n.post(ae({type:"ready"})),score:(b,w)=>n.post(ae({type:"score",player:b,score:w})),break:(b="level")=>new Promise(w=>{a.push(w),n.post(ae({type:"break",reason:b}))}),end:b=>n.post(ae({type:"end",scores:b}))})}else if(o){let m=d;if(d.type==="frame"&&Array.isArray(d.players)&&p.note(d.players,d.t),d.type==="backdrop"){if(d.backdrop!=="video"&&d.backdrop!=="none")return;let h=ze(d.view)??null;if(d.backdrop===s&&Dn(h,u))return;s=d.backdrop,u=h,m={type:"backdrop",backdrop:s,...u?{view:u}:{}};for(let b of[...l])b(s,u)}for(let h of r.get(d.type)??[])h(m);d.type==="break-done"&&a.shift()?.(d.shown)}else return})})}var Dn=(n,e)=>n===e||n!==null&&e!==null&&n.x===e.x&&n.y===e.y&&n.w===e.w&&n.h===e.h;var He={};Lt(He,{BAND_BODY:()=>Q,DEFAULT_AVATAR:()=>Fe,avatarById:()=>wt,avatarShapes:()=>ce,drawShapes:()=>se,frameOf:()=>le,iconShapes:()=>Et});function Dt(n){let e=Rt(),t=Tt(e);n?.dataset.mute!=="manual"&&qe(e);let r=Object.assign(t,{avatars:{...He}});window.FabiPlay=r;let a=n?.dataset.keys;a&&t.keys(Ze(a));let o=n?.dataset.pointer;return o&&t.pointer({hand:o==="left"||o==="right"?o:"any"}),n?.dataset.ready!=="manual"&&(document.readyState==="complete"?t.ready():window.addEventListener("load",()=>t.ready(),{once:!0})),r}Dt(document.currentScript);})();
@@ -63,9 +63,9 @@
63
63
  },
64
64
  "entry": {
65
65
  "type": "string",
66
- "description": "The page that starts the game: an .html file relative to the game's address (same site, no \"..\").",
67
- "pattern": "^[\\w./-]+\\.html$",
68
- "not": { "pattern": "\\.\\." },
66
+ "description": "The page that starts the game: a path relative to the game's address (no scheme, no leading /, no \".\" or \"..\" segments, up to 200 characters) of letters, digits, _ and -, ending in lowercase .html.",
67
+ "pattern": "^(?:[A-Za-z0-9_][A-Za-z0-9_-]*(?:\\.[A-Za-z0-9_-]+)*/)*[A-Za-z0-9_][A-Za-z0-9_-]*(?:\\.[A-Za-z0-9_-]+)*\\.(?:html)$",
68
+ "maxLength": 200,
69
69
  "examples": ["index.html"]
70
70
  },
71
71
  "sdk": {
@@ -77,9 +77,83 @@
77
77
  "description": "Optional: the backdrops the game can draw over besides its own background. [\"video\"] opts in to mirror mode (paint no opaque background while backdrop is 'video').",
78
78
  "uniqueItems": true,
79
79
  "items": { "enum": ["video"] }
80
+ },
81
+ "intro": {
82
+ "type": "object",
83
+ "description": "Optional: Fabi explains the game on the TV before calibration, in 1 to 4 steps. Each step: one sentence (Italian and English, up to 90 characters; or one per age range) over an image of the game or a move shown with the children's avatars. The voice is generated by Fabi Play at publication from the text. Without intro the game goes straight to calibration; an invalid one is skipped by the TV.",
84
+ "required": ["steps"],
85
+ "additionalProperties": false,
86
+ "properties": {
87
+ "steps": {
88
+ "type": "array",
89
+ "minItems": 1,
90
+ "maxItems": 4,
91
+ "items": { "anyOf": [{ "$ref": "#/definitions/imageStep" }, { "$ref": "#/definitions/moveStep" }] }
92
+ }
93
+ }
80
94
  }
81
95
  },
82
96
  "definitions": {
97
+ "imageStep": {
98
+ "type": "object",
99
+ "description": "A step over an image of the game.",
100
+ "required": ["say", "image"],
101
+ "additionalProperties": false,
102
+ "properties": {
103
+ "say": { "$ref": "#/definitions/say" },
104
+ "image": {
105
+ "type": "string",
106
+ "description": "An image of the game, 16:9, at least 1280×720: a path relative to the game's address, with the same rules as entry (no scheme, no leading /, no \".\" or \"..\" segments, up to 200 characters), ending in lowercase .jpg or .png (no WebP: old TV browsers may not decode it). JPG (quality about 80) for screenshots, PNG only for flat art.",
107
+ "pattern": "^(?:[A-Za-z0-9_][A-Za-z0-9_-]*(?:\\.[A-Za-z0-9_-]+)*/)*[A-Za-z0-9_][A-Za-z0-9_-]*(?:\\.[A-Za-z0-9_-]+)*\\.(?:jpg|png)$",
108
+ "maxLength": 200,
109
+ "examples": ["intro/track.jpg"]
110
+ },
111
+ "practice": { "const": false, "description": "Only with a move." }
112
+ }
113
+ },
114
+ "moveStep": {
115
+ "type": "object",
116
+ "description": "A step showing a move with the children's avatars.",
117
+ "required": ["say", "move"],
118
+ "additionalProperties": false,
119
+ "properties": {
120
+ "say": { "$ref": "#/definitions/say" },
121
+ "move": {
122
+ "description": "The move Fabi shows, drawn with each child's avatar.",
123
+ "enum": ["jump", "squat", "clap", "lane-left", "lane-right", "arms-up", "arms-wide", "arms-v", "star"]
124
+ },
125
+ "practice": {
126
+ "type": "boolean",
127
+ "description": "true: the children try it and each gets a tick; the step moves on when all did, or after 8 s. Default false: Fabi only shows it."
128
+ }
129
+ }
130
+ },
131
+ "say": {
132
+ "description": "What Fabi says: Italian and English, up to 90 characters each; or one such per age range (at least one; the closest range present is used for the others).",
133
+ "anyOf": [
134
+ { "$ref": "#/definitions/texts90" },
135
+ {
136
+ "type": "object",
137
+ "minProperties": 1,
138
+ "additionalProperties": false,
139
+ "properties": {
140
+ "3-5": { "$ref": "#/definitions/texts90" },
141
+ "6-8": { "$ref": "#/definitions/texts90" },
142
+ "9-12": { "$ref": "#/definitions/texts90" }
143
+ }
144
+ }
145
+ ]
146
+ },
147
+ "texts90": {
148
+ "type": "object",
149
+ "description": "One sentence in Italian and English: up to 90 characters (code points), no white space at either end, no control or bidirectional control characters. Fabi Play's check (parseIntro) also rejects lone surrogates and counts the characters of the NFC form.",
150
+ "required": ["it", "en"],
151
+ "additionalProperties": false,
152
+ "properties": {
153
+ "it": { "type": "string", "minLength": 1, "maxLength": 90, "pattern": "^[^\\s\\u0000-\\u001F\\u007F-\\u009F\\u202A-\\u202E\\u2066-\\u2069](?:[^\\u0000-\\u001F\\u007F-\\u009F\\u202A-\\u202E\\u2066-\\u2069]*[^\\s\\u0000-\\u001F\\u007F-\\u009F\\u202A-\\u202E\\u2066-\\u2069])?$" },
154
+ "en": { "type": "string", "minLength": 1, "maxLength": 90, "pattern": "^[^\\s\\u0000-\\u001F\\u007F-\\u009F\\u202A-\\u202E\\u2066-\\u2069](?:[^\\u0000-\\u001F\\u007F-\\u009F\\u202A-\\u202E\\u2066-\\u2069]*[^\\s\\u0000-\\u001F\\u007F-\\u009F\\u202A-\\u202E\\u2066-\\u2069])?$" }
155
+ }
156
+ },
83
157
  "texts60": {
84
158
  "type": "object",
85
159
  "required": ["it", "en"],
@@ -1,4 +1,4 @@
1
- /*! @fabi-play/sdk 0.1.0 | Fabi Play Kit License | https://docs.fabiplay.app */
1
+ /*! @fabi-play/sdk 0.2.0 | Fabi Play Kit License | https://docs.fabiplay.app */
2
2
  (function (root, factory) {
3
3
  var script = typeof document !== 'undefined' ? document.currentScript : null;
4
4
  if (typeof define === 'function' && define.amd) define([], function () { return factory(script); });
@@ -1 +1 @@
1
- /*! @fabi-play/sdk 0.1.0 | Fabi Play Kit License | https://docs.fabiplay.app */(function(we,G){var de=typeof document<"u"?document.currentScript:null;typeof define=="function"&&define.amd?define([],function(){return G(de)}):typeof module=="object"&&module&&module.exports?module.exports=G(de):we.FabiPlay=G(de)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(we){"use strict";var G={exports:{}},de=G.exports,pe=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,xt=Object.getOwnPropertyNames,mt=Object.prototype.hasOwnProperty,wt=(e,t,a)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Oe=(e,t)=>{for(var a in t)pe(e,a,{get:t[a],enumerable:!0})},gt=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xt(t))!mt.call(e,s)&&s!==a&&pe(e,s,{get:()=>t[s],enumerable:!(o=kt(t,s))||o.enumerable});return e},vt=e=>gt(pe({},"__esModule",{value:!0}),e),D=(e,t,a)=>wt(e,typeof t!="symbol"?t+"":t,a),Le={};Oe(Le,{install:()=>Ra}),G.exports=vt(Le);function Et(e,t=window){const a=new Set,o=t.AudioContext;o&&(t.AudioContext=class extends o{constructor(...r){super(...r),a.add(this)}});let s=[],n=[];Promise.resolve(e).then(r=>{r.on("break-start",()=>{s=[...t.document.querySelectorAll("audio, video")].filter(h=>!h.paused),s.forEach(h=>h.pause()),n=[...a].filter(h=>h.state==="running"),n.forEach(h=>{h.suspend()})}),r.on("break-done",()=>{s.forEach(h=>{h.play().catch(()=>{})}),n.forEach(h=>{h.resume()}),s=[],n=[]})})}var Mt={jump:"Space",squat:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",clap:"Enter"};function At(e){if(e.trim()==="default")return;const t={};for(const a of e.split(",")){const[o,s]=a.split(":").map(n=>n.trim());o&&s&&(t[o]=s)}return t}var Ct={Space:[" ",32],Enter:["Enter",13],Escape:["Escape",27],ShiftLeft:["Shift",16],ArrowLeft:["ArrowLeft",37],ArrowUp:["ArrowUp",38],ArrowRight:["ArrowRight",39],ArrowDown:["ArrowDown",40]};function _e(e){const t=Ct[e];if(t)return{key:t[0],code:e,keyCode:t[1]};const a=/^Key([A-Z])$/.exec(e);if(a)return{key:a[1].toLowerCase(),code:e,keyCode:a[1].charCodeAt(0)};const o=/^Digit([0-9])$/.exec(e);if(o)return{key:o[1],code:e,keyCode:48+Number(o[1])};throw new Error(`Fabi Play: unknown key "${e}" (use Space, Enter, Arrow\u2026, KeyA\u2026, Digit0\u2026)`)}var St=(e=document)=>({dispatch(t,a){const o=new KeyboardEvent(t,{key:a.key,code:a.code,bubbles:!0,cancelable:!0});for(const s of["keyCode","which"])Object.defineProperty(o,s,{get:()=>a.keyCode});(e.activeElement??e.body??e).dispatchEvent(o)}}),De=80,Tt=800;function zt(e,t=Mt,a={}){const o=a.player??1,s=a.target??St(),n=a.setTimeout??((d,b)=>setTimeout(d,b)),r=new Set;let h=0;const i=d=>{const b=t[d];!b||r.has(d)||(r.add(d),s.dispatch("keydown",_e(b)))},f=d=>{const b=t[d];!b||!r.has(d)||(r.delete(d),s.dispatch("keyup",_e(b)))},l=d=>{i(d),n(()=>f(d),De)},u=d=>{if(d.player!==o)return;const b={"lane-left":-1,"lane-center":0,"lane-right":1};switch(d.gesture){case"jump":i("jump"),n(()=>f("jump"),Tt);break;case"land":f("jump");break;case"squat":i("squat");break;case"stand":f("squat");break;case"clap":l("clap");break;default:{const y=b[d.gesture];if(y===void 0)break;const k=y>h?"right":"left";for(let g=0;g<Math.abs(y-h);g++)n(()=>l(k),g*(De*2));h=y}}},c=d=>{const b=d.players.find(y=>y.id===o);b&&(b.shape==="arms-up"?i("arms-up"):f("arms-up"))},x=[e.on("gesture",u),e.on("frame",c),e.on("break-start",()=>[...r].forEach(f))];return()=>{x.forEach(d=>d()),[...r].forEach(f)}}function Pt(e=document){const t=e.createElement("div");t.setAttribute("aria-hidden","true"),t.style.cssText="position:fixed;left:0;top:0;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;border:6px solid #FBE7B8;background:rgba(251,231,184,.25);pointer-events:none;z-index:2147483647;box-sizing:border-box;transition:transform 60ms linear",e.body.appendChild(t);const a=(o,s,...n)=>{const r=e.elementFromPoint(o,s)??e.body;for(const h of n){const i={bubbles:!0,cancelable:!0,clientX:o,clientY:s,pointerId:1,pointerType:"touch",isPrimary:!0};r.dispatchEvent(h.startsWith("pointer")?new PointerEvent(h,i):new MouseEvent(h,i))}};return{size:()=>({width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}),move:(o,s)=>a(o,s,"pointermove","mousemove"),click:(o,s)=>a(o,s,"pointerdown","mousedown","pointerup","mouseup","click"),cursor:(o,s,n)=>{t.style.transform=`translate(${o}px, ${s}px) scale(${1-n*.35})`,t.style.borderColor=n>0?"#EE6A43":"#FBE7B8"}}}function Ot(e,t={}){const a=t.player??1,o=t.hand??"any",s=t.dwellMs??800,n=t.radius??.04,r=t.target??Pt();let h=null,i=!1;return e.on("frame",f=>{const l=f.players.find(z=>z.id===a);if(!l)return;const c=o==="left"?l.leftHand:o==="right"?l.rightHand:((z,U)=>z&&U?z.y<U.y?z:U:z??U)(l.leftHand,l.rightHand);if(!c)return;const{width:x,height:d}=r.size(),b=c.x*x,y=c.y*d;r.move(b,y),(!h||Math.hypot(b-h.x,y-h.y)>n*Math.hypot(x,d))&&(h={x:b,y,t:f.t},i=!1);const g=i?0:Math.min((f.t-h.t)/s,1);g>=1&&(i=!0,r.click(h.x,h.y)),r.cursor(b,y,i?0:g)})}var Ne=1,Ie=33,T={nose:0,leftShoulder:11,rightShoulder:12,leftElbow:13,rightElbow:14,leftWrist:15,rightWrist:16,leftHip:23,rightHip:24,leftKnee:25,rightKnee:26,leftAnkle:27,rightAnkle:28},Lt=["3-5","6-8","9-12"],_t=e=>Lt.includes(e),Dt=4,Re={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},Nt=Re["6-8"],Qe=(e,t)=>{const a=_t(t)?Re[t]:Nt;return a[Number.isInteger(e)&&e>=0?e%a.length:0]},Be="fabi-play",ne=e=>({ns:Be,...e});function Fe(e){if(!ge(e))return;const{x:t,y:a,w:o,h:s}=e;return te(t)&&te(a)&&te(o)&&te(s)&&o>0&&s>0?{x:t,y:a,w:o,h:s}:void 0}var He=(e,t)=>e?{x:e.x+t.x*e.w,y:e.y+t.y*e.h}:{x:t.x,y:t.y},je=["high","medium","low"];function It(e){if(!ge(e))return;const t={};return je.includes(e.tier)&&(t.tier=e.tier),te(e.hz)&&e.hz>=20&&e.hz<=240&&(t.hz=Math.round(e.hz)),t.tier||t.hz?t:void 0}function Rt(e){const t={};return ge(e)&&(te(e.fps)&&e.fps>=0&&e.fps<1e3&&(t.fps=e.fps),typeof e.renderer=="string"&&/^[a-z0-9-]{1,16}$/.test(e.renderer)&&(t.renderer=e.renderer),je.includes(e.tier)&&(t.tier=e.tier)),t}var ge=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),te=e=>typeof e=="number"&&Number.isFinite(e),Qt=12,Bt=Ie*4,Ft=e=>Qt+e*Bt,Ha=Ft(Dt),B="#4a382c",R="#2b2118",j="#1c1f2b",Ue="#fbefe3",$="#f4897a",re="#3a2a22",$e=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ue,accent:"#ffd9c2",outline:R,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:re,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ue,accent:"#5a3426",outline:R,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:re,muzzle:"band",cheeks:$},tail:"brush",headExtras:[],bodyExtras:["star"],extraColors:["#ffd84a"]},{id:"bunny",name:{en:"Bunny",it:"Coniglietto"},band:"3-5",palette:{body:"#f9d0de",limbs:"#f9d0de",belly:"#fff6f8",accent:"#f4a0b9",outline:B},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:$},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:B},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:re,muzzle:"oval",cheeks:$},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:B,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:$},tail:"long",headExtras:["whiskers"],bodyExtras:[]},{id:"panda",name:{en:"Panda",it:"Panda"},band:"3-5",palette:{body:"#ffffff",limbs:"#6e6674",belly:"#ffffff",accent:"#6e6674",outline:B,ears:"#6e6674"},head:"wide",ears:"round",face:{eyes:"mask",mouth:"smile",nose:"#2f2a2c",muzzle:"none",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:[]},{id:"penguin",name:{en:"Penguin",it:"Pinguino"},band:"3-5",palette:{body:"#6c8fca",limbs:"#6c8fca",belly:"#ffffff",accent:"#f9b95c",outline:B,feet:"#f9b95c"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"heart",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:["flippers","scarf"],extraColors:["#f6907a"]},{id:"frog",name:{en:"Frog",it:"Ranocchio"},band:"3-5",palette:{body:"#8fd487",limbs:"#8fd487",belly:"#e6f7cc",accent:"#62ad62",outline:B},head:"wide",ears:"none",face:{eyes:"big",eyesOnTop:!0,mouth:"open",muzzle:"none",cheeks:"#f59b8f"},tail:"none",headExtras:[],bodyExtras:["flippers","spots"],extraColors:["#62ad62","#b0e6a4"]},{id:"lion",name:{en:"Lion",it:"Leoncino"},band:"6-8",palette:{body:"#f6c454",limbs:"#f6c454",belly:"#fde7b0",accent:"#fde7b0",outline:R},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:$},tail:"tuft",headExtras:["mane"],bodyExtras:[],extraColors:["#c8692e"]},{id:"unicorn",name:{en:"Unicorn",it:"Unicorno"},band:"6-8",palette:{body:"#fbf5ff",limbs:"#fbf5ff",belly:"#efe0ff",accent:"#fbd46a",outline:R,hands:"#c9a6f2",feet:"#c9a6f2"},head:"tall",ears:"unicorn",face:{eyes:"dot",mouth:"smile",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["rainbow-mane"],bodyExtras:[],extraColors:["#f58cc0","#8fd3f4","#a98ff2"]},{id:"dragon",name:{en:"Little Dragon",it:"Draghetto"},band:"6-8",palette:{body:"#8a63d2",limbs:"#8a63d2",belly:"#fbd46a",accent:"#5fd0b5",outline:R},head:"wide",ears:"horns",face:{eyes:"big",eyeColor:"#3a2a6a",mouth:"teeth",muzzle:"none",cheeks:"#f59bc0"},tail:"arrow",headExtras:[],bodyExtras:["wings"]},{id:"robot",name:{en:"Robot",it:"Robot"},band:"9-12",palette:{body:"#b9c7d2",limbs:"#8b9aa6",belly:"#b9c7d2",accent:"#ee6a43",outline:j,hands:"#ee6a43",feet:"#6b7a86"},head:"square",ears:"antenna",face:{eyes:"screen",eyeColor:"#7ff0ff",mouth:"grill",muzzle:"none"},tail:"none",headExtras:["bolts"],bodyExtras:["panel","joints","boots"],extraColors:["#ff7a6b","#fbd46a","#7ff0ff"]},{id:"astronaut",name:{en:"Astronaut",it:"Astronauta"},band:"9-12",palette:{body:"#f4f1ec",limbs:"#f4f1ec",belly:"#f4f1ec",accent:"#ee6a43",outline:j,hands:"#9fb0bd",feet:"#9fb0bd"},head:"round",ears:"none",face:{eyes:"visor",mouth:"smile",muzzle:"none"},tail:"none",headExtras:["helmet"],bodyExtras:["backpack","badge","boots"],extraColors:["#c9d3db"]},{id:"dinosaur",name:{en:"Dinosaur",it:"Dinosauro"},band:"6-8",palette:{body:"#3fb3a6",limbs:"#3fb3a6",belly:"#c9f0d6",accent:"#f79a3e",outline:R},head:"wide",ears:"none",face:{eyes:"dot",mouth:"teeth",muzzle:"none",cheeks:"#f59b8f"},tail:"spiky",headExtras:["spikes","spots"],bodyExtras:[],extraColors:["#2b8f84","#7fd3c6"]},{id:"monkey",name:{en:"Monkey",it:"Scimmietta"},band:"6-8",palette:{body:"#7b5234",limbs:"#7b5234",belly:"#f2c9a0",accent:"#f2c9a0",outline:R,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:$},tail:"curl",headExtras:["tuft"],bodyExtras:[]},{id:"koala",name:{en:"Koala",it:"Koala"},band:"3-5",palette:{body:"#b7bcc6",limbs:"#b7bcc6",belly:"#eef0f3",accent:"#f4dbe2",outline:B},head:"wide",ears:"big-round",face:{eyes:"dot",mouth:"smile",nose:"#3b3438",muzzle:"none",cheeks:"#f4a3b0"},tail:"none",headExtras:[],bodyExtras:[]},{id:"tiger",name:{en:"Tiger",it:"Tigrotto"},band:"6-8",palette:{body:"#f9a33a",limbs:"#f9a33a",belly:"#fff1dc",accent:"#fff1dc",outline:R},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:$},tail:"striped",headExtras:["stripes","whiskers"],bodyExtras:[],extraColors:["#3a2a22"]},{id:"owl",name:{en:"Owl",it:"Gufetto"},band:"3-5",palette:{body:"#8ec0e6",limbs:"#8ec0e6",belly:"#e3f2fc",accent:"#639cc9",outline:B,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:B,eyeRing:"#fde08a",mouth:"beak",muzzle:"none",cheeks:"#f6a8b4"},tail:"none",headExtras:[],bodyExtras:["feathers"]},{id:"alien",name:{en:"Alien",it:"Alieno"},band:"9-12",palette:{body:"#9ee05a",limbs:"#9ee05a",belly:"#d8f5a8",accent:"#b07cf2",outline:j},head:"bulb",ears:"antennae",face:{eyes:"almond",eyeColor:"#1e1838",mouth:"smirk",muzzle:"none"},tail:"none",headExtras:[],bodyExtras:["spots"],extraColors:["#7cc23e","#7cc23e"]},{id:"ghost",name:{en:"Friendly Ghost",it:"Fantasmino"},band:"6-8",palette:{body:"#e6f4ff",limbs:"#e6f4ff",belly:"#e6f4ff",accent:"#bcd9f2",outline:R},head:"round",ears:"none",face:{eyes:"dot",mouth:"open",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["curl"],bodyExtras:["sheet"]},{id:"octopus",name:{en:"Octopus",it:"Polpetto"},band:"6-8",palette:{body:"#e0578a",limbs:"#e0578a",belly:"#f7b3cc",accent:"#f7b3cc",outline:R,hands:"#f7b3cc",feet:"#f7b3cc"},head:"tall",ears:"none",face:{eyes:"big",eyeColor:"#3a2140",mouth:"smile",muzzle:"none",cheeks:"#ffd0a0"},tail:"none",headExtras:["spots"],bodyExtras:["tentacles"],extraColors:["#f7b3cc","#f7b3cc"]},{id:"chick",name:{en:"Chick",it:"Pulcino"},band:"3-5",palette:{body:"#ffd45e",limbs:"#ffd45e",belly:"#fff2c2",accent:"#ffa04a",outline:B,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:$},tail:"none",headExtras:["eggshell"],bodyExtras:[],extraColors:["#fffaf0"]},{id:"puppy",name:{en:"Puppy",it:"Cucciolo"},band:"3-5",palette:{body:"#f4e4cf",limbs:"#f4e4cf",belly:"#fffaf2",accent:"#f29aa4",outline:B,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:re,muzzle:"oval",cheeks:$},tail:"curl",headExtras:["eye-spot"],bodyExtras:[]},{id:"lamb",name:{en:"Lamb",it:"Agnellino"},band:"3-5",palette:{body:"#fdf8ee",limbs:"#e3d1c2",belly:"#fffdf8",accent:"#f6bcc2",outline:B,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:$},tail:"pom",headExtras:["wool"],bodyExtras:["wool"]},{id:"duckling",name:{en:"Duckling",it:"Anatroccolo"},band:"3-5",palette:{body:"#fff1a6",limbs:"#fff1a6",belly:"#fffbe0",accent:"#ff9f43",outline:B,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:$},tail:"none",headExtras:["curl"],bodyExtras:["flippers","scarf"],extraColors:["#86cfe0"]},{id:"shark",name:{en:"Shark",it:"Squalo"},band:"6-8",palette:{body:"#6c95c4",limbs:"#6c95c4",belly:"#eef5fb",accent:"#4c76a8",outline:R,hands:"#eef5fb",feet:"#4c76a8"},head:"wide",ears:"fin",face:{eyes:"dot",mouth:"jaws",muzzle:"none",cheeks:"#f59bb0"},tail:"fish",headExtras:["gills"],bodyExtras:[]},{id:"wolf",name:{en:"Wolf",it:"Lupo"},band:"6-8",palette:{body:"#8f9bb3",limbs:"#8f9bb3",belly:"#eef1f6",accent:"#f3b8c4",outline:R,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:re,muzzle:"oval",cheeks:"#f4a3b0"},tail:"fluffy",headExtras:["ruff","forehead"],bodyExtras:[],extraColors:["#636d84"]},{id:"parrot",name:{en:"Parrot",it:"Pappagallo"},band:"6-8",palette:{body:"#e8503f",limbs:"#e8503f",belly:"#ffd25a",accent:"#f6e6c4",outline:R,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:R,eyeRing:"#ffffff",mouth:"hook",muzzle:"none",cheeks:"#ffb0a0"},tail:"plume",headExtras:["crest"],bodyExtras:["feathers"],extraColors:["#ffd25a","#3fae5a","#3a9bdc"]},{id:"ninja",name:{en:"Ninja",it:"Ninja"},band:"9-12",palette:{body:"#2f3a56",limbs:"#2f3a56",belly:"#2f3a56",accent:"#36c9bb",outline:j,skin:"#b07a52",hands:"#222a40",feet:"#222a40"},head:"round",ears:"none",face:{eyes:"calm",mouth:"none",muzzle:"none",brows:"#2a1d16"},tail:"none",headExtras:["ninja-hood"],bodyExtras:["belt"],extraColors:["#36c9bb","#36c9bb","#36c9bb"]},{id:"skater",name:{en:"Skater",it:"Skater"},band:"9-12",palette:{body:"#3a8fc0",limbs:"#2c3e57",belly:"#2f7aa6",accent:"#ffcf3a",outline:j,skin:"#f2c9a5",hair:"#7a4a2a",hands:"#f2c9a5",feet:"#eef1f5"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#5a3520"},tail:"none",headExtras:["hair","cap"],bodyExtras:["pocket","joints"],extraColors:["#ff5d73"]},{id:"explorer",name:{en:"Explorer",it:"Giramondo"},band:"9-12",palette:{body:"#5f8f5b",limbs:"#5f8f5b",belly:"#5f8f5b",accent:"#d9bb7e",outline:j,skin:"#7a4a30",hair:"#1d1410",hands:"#7a4a30",feet:"#6b4a2a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#1d1410"},tail:"none",headExtras:["curls","safari-hat"],bodyExtras:["backpack","straps","boots"],extraColors:["#e07b39","#6b4a2a"]},{id:"wizard",name:{en:"Wizard",it:"Mago"},band:"9-12",palette:{body:"#5b3fa0",limbs:"#5b3fa0",belly:"#5b3fa0",accent:"#3d5fc8",outline:j,skin:"#c98d62",hair:"#a8452a",hands:"#c98d62",feet:"#33255e"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#7a301c"},tail:"none",headExtras:["locks","wizard-hat"],bodyExtras:["robe","belt"],extraColors:["#ffd84a","#ffd84a","#ffd84a"]},{id:"knight",name:{en:"Knight",it:"Cavaliere"},band:"9-12",palette:{body:"#bcc7d3",limbs:"#8e9aa8",belly:"#dce3ea",accent:"#d8443a",outline:j,hands:"#6c7786",feet:"#6c7786"},head:"bucket",ears:"none",face:{eyes:"slit",eyeColor:"#bfefff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["plume"],bodyExtras:["pauldrons","emblem","boots"],extraColors:["#d8443a"]},{id:"racer",name:{en:"Racer",it:"Pilota"},band:"9-12",palette:{body:"#ff6a2b",limbs:"#ff6a2b",belly:"#ffffff",accent:"#ffffff",outline:j,hands:"#232838",feet:"#232838"},head:"round",ears:"none",face:{eyes:"goggle",eyeColor:"#7fd6ff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["stripe"],bodyExtras:["racing-stripe","boots"]},{id:"pirate",name:{en:"Pirate",it:"Pirata"},band:"9-12",palette:{body:"#f2efe6",limbs:"#2a3d6e",belly:"#f2efe6",accent:"#d94545",outline:j,skin:"#d9a072",hair:"#2b1a12",hands:"#d9a072",feet:"#3a2a20"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#2b1a12"},tail:"none",headExtras:["locks","bandana","eye-patch"],bodyExtras:["stripes","belt","boots"],extraColors:["#d94545","#2a3d6e","#4a3426"]},{id:"diver",name:{en:"Diver",it:"Sub"},band:"9-12",palette:{body:"#1f6582",limbs:"#1f6582",belly:"#1f6582",accent:"#ffb020",outline:j,skin:"#e8b48a",hair:"#c98f2e",hands:"#1b4f66",feet:"#ffb020"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#8a5a1a"},tail:"none",headExtras:["curls","dive-mask"],bodyExtras:["tank","fins"],extraColors:["#c9d3db"]},{id:"hero",name:{en:"Hero",it:"Supereroe"},band:"9-12",palette:{body:"#3557c8",limbs:"#3557c8",belly:"#3557c8",accent:"#e0403a",outline:j,skin:"#5a3825",hair:"#141010",hands:"#e0403a",feet:"#e0403a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#141010"},tail:"none",headExtras:["hair","domino"],bodyExtras:["cape","emblem","boots"],extraColors:["#ffd84a"]}],L={M:0,L:1,Q:2,C:3,Z:4},qe=[2,2,4,6,0];function ve(e,t){for(const a of t)Ht(e,a)}function Ht(e,t){if(t.k==="group"){e.save(),e.translate(t.x,t.y),t.rot&&e.rotate(t.rot),t.s!==void 0&&t.s!==1&&e.scale(t.s,t.s),t.alpha!==void 0&&(e.globalAlpha*=t.alpha),ve(e,t.items),e.restore();return}switch(e.save(),t.alpha!==void 0&&(e.globalAlpha*=t.alpha),e.beginPath(),t.k){case"circle":e.arc(t.x,t.y,Math.max(t.r,0),0,Math.PI*2);break;case"ellipse":e.ellipse(t.x,t.y,Math.max(t.rx,0),Math.max(t.ry,0),t.rot??0,0,Math.PI*2);break;case"rect":jt(e,t);break;case"path":typeof t.d=="string"?qt(e,t.d):Ut(e,t.d);break;case"line":e.moveTo(t.pts[0]??0,t.pts[1]??0);for(let a=2;a+1<t.pts.length;a+=2)e.lineTo(t.pts[a],t.pts[a+1]);break}e.lineCap="round",e.lineJoin="round",t.fill&&t.k!=="line"&&(e.fillStyle=t.fill,e.fill()),t.stroke&&(t.lw??1)>0&&(e.strokeStyle=t.stroke,e.lineWidth=t.lw??1,e.stroke()),e.restore()}function jt(e,t){const a=Math.max(0,Math.min(t.r,t.w/2,t.h/2));e.translate(t.x,t.y),t.rot&&e.rotate(t.rot);const o=-t.w/2,s=-t.h/2;e.moveTo(o+a,s),e.lineTo(o+t.w-a,s),e.quadraticCurveTo(o+t.w,s,o+t.w,s+a),e.lineTo(o+t.w,s+t.h-a),e.quadraticCurveTo(o+t.w,s+t.h,o+t.w-a,s+t.h),e.lineTo(o+a,s+t.h),e.quadraticCurveTo(o,s+t.h,o,s+t.h-a),e.lineTo(o,s+a),e.quadraticCurveTo(o,s,o+a,s),e.closePath()}function Ut(e,t){for(let a=0;a<t.length;){const o=t[a++];if(o===L.M)e.moveTo(t[a],t[a+1]);else if(o===L.L)e.lineTo(t[a],t[a+1]);else if(o===L.Q)e.quadraticCurveTo(t[a],t[a+1],t[a+2],t[a+3]);else if(o===L.C)e.bezierCurveTo(t[a],t[a+1],t[a+2],t[a+3],t[a+4],t[a+5]);else if(o===L.Z)e.closePath();else return;a+=qe[o]}}function $t(e){if(typeof e=="string")return(e.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);const t=[];for(let a=0;a<e.length;){const o=qe[e[a++]];if(o===void 0)break;for(let s=0;s<o;s++)t.push(e[a+s]);a+=o}return t}function qt(e,t){const a=t.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[];let o="",s=0;const n=()=>Number(a[s++]);for(;s<a.length;){const r=a[s];if(/[MLQCZ]/i.test(r)&&(o=r.toUpperCase(),s++,o==="Z")){e.closePath();continue}o==="M"?(e.moveTo(n(),n()),o="L"):o==="L"?e.lineTo(n(),n()):o==="Q"?e.quadraticCurveTo(n(),n(),n(),n()):o==="C"?e.bezierCurveTo(n(),n(),n(),n(),n(),n()):s++}}var A=e=>{const t=Math.round(e*100)/100;return t===0?0:t};function O(e,t=.5){const a=e.length;if(a<3)return[];const o=(h,i,f)=>({x:h.x+(i.x-h.x)*f,y:h.y+(i.y-h.y)*f}),s=Math.min(Math.max(t,0),.5),n=o(e[0],e[1],s),r=[L.M,A(n.x),A(n.y)];for(let h=1;h<=a;h++){const i=e[(h-1)%a],f=e[h%a],l=e[(h+1)%a],u=o(i,f,1-s),c=o(f,l,s);r.push(L.L,A(u.x),A(u.y),L.Q,A(f.x),A(f.y),A(c.x),A(c.y))}return r.push(L.Z),r}function P(e,t=1){const a=e.length;if(a<3)return[];const o=[L.M,A(e[0].x),A(e[0].y)],s=t/6;for(let n=0;n<a;n++){const r=e[(n-1+a)%a],h=e[n],i=e[(n+1)%a],f=e[(n+2)%a];o.push(L.C,A(h.x+(i.x-r.x)*s),A(h.y+(i.y-r.y)*s),A(i.x-(f.x-h.x)*s),A(i.y-(f.y-h.y)*s),A(i.x),A(i.y))}return o.push(L.Z),o}function le(e){const t=e.length;if(t<2)return[];const a=[L.M,A(e[0].x),A(e[0].y)];for(let o=0;o<t-1;o++){const s=e[Math.max(o-1,0)],n=e[o],r=e[o+1],h=e[Math.min(o+2,t-1)];a.push(L.C,A(n.x+(r.x-s.x)/6),A(n.y+(r.y-s.y)/6),A(r.x-(h.x-n.x)/6),A(r.y-(h.y-n.y)/6),A(r.x),A(r.y))}return a}var ye="M0 -1 L0.29 -0.4 L0.95 -0.31 L0.47 0.15 L0.59 0.81 L0 0.5 L-0.59 0.81 L-0.47 0.15 L-0.95 -0.31 L-0.29 -0.4 Z",N="#ffffff",v=[-1,1],Ye="#3a2420",Yt="#f2808f",Ee="#26324a",Zt="#ffd84a",Q=(...e)=>{const t=[];for(let a=0;a+1<e.length;a+=2)t.push({x:e[a],y:e[a+1]});return t};function Ze(e,t){const a=e.palette,o=[],s={stroke:a.outline,lw:t},n=l=>e.headExtras.includes(l),r=(l,u)=>e.extraColors?.[l]??u;if(n("mane")){for(let u=0;u<12;u++){const c=u/12*Math.PI*2;o.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:r(0,a.accent),...s})}o.push({k:"circle",x:0,y:.04,r:1.08,fill:r(0,a.accent)})}if(n("rainbow-mane")){const l=e.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,x,d,b,y],k)=>o.push({k:"ellipse",x:c,y:x,rx:d,ry:b,rot:y,fill:l[k%l.length],...s}))}if(n("spikes"))for(const l of[-.55,0,.55]){const u=ie(l,1.48),c=ie(l-.32,.86),x=ie(l+.32,.86);o.push({k:"path",d:O([c,u,x],.22),fill:a.accent,...s})}if(n("curl")&&o.push({k:"path",d:P([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:a.body,...s}),n("wool"))for(let l=0;l<=8;l++){const u=-1.75+l/8*3.5;o.push({k:"circle",x:Math.sin(u)*.98,y:-Math.cos(u)*.92-.04,r:.34,fill:a.body,...s})}if(n("crest")&&[-.38,0,.38].forEach((l,u)=>{const c=ie(l,1.12);o.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:l,fill:r(u,a.accent),...s})}),n("plume")&&o.push({k:"path",d:P(Q(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:a.accent,...s}),n("locks")&&o.push({k:"path",d:P(Q(-1.14,.58,-1.24,-.2,-.86,-.98,0,-1.2,.86,-.98,1.24,-.2,1.14,.58,.8,.66,0,.2,-.8,.66)),fill:a.hair??a.outline,...s}),n("ninja-hood"))for(const[l,u]of[[.35,.5],[.85,.42]])o.push({k:"ellipse",x:1+Math.cos(l)*u*.8,y:-.5+Math.sin(l)*u*.8,rx:u,ry:.11,rot:l,fill:a.accent,...s});if(n("bandana"))for(const[l,u]of[[Math.PI-.5,.42],[Math.PI-1,.36]])o.push({k:"ellipse",x:-.98+Math.cos(l)*u*.8,y:-.36+Math.sin(l)*u*.8,rx:u,ry:.12,rot:l,fill:a.accent,...s});if(n("ruff"))for(const l of v)o.push({k:"path",d:O(Q(l*.7,-.3,l*1.32,0,l*1.02,.18,l*1.26,.46,l*.86,.56,l*.98,.84,l*.4,.7),.25),fill:a.body,...s});if(e.face.eyesOnTop)for(const l of v)o.push({k:"circle",x:l*.46,y:-.72,r:.38,fill:a.body,...s});o.push(...Gt(e,t)),o.push(Kt(e,s));const h=e.face.muzzle,i=a.belly;if(h==="oval"&&o.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:i}),h==="monkey"){for(const l of v)o.push({k:"circle",x:l*.32,y:-.04,r:.38,fill:i});o.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:i})}if(h==="heart"){for(const l of v)o.push({k:"circle",x:l*.36,y:.02,r:.5,fill:i});o.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:i})}if(h==="disc")for(const l of v)o.push({k:"circle",x:l*.4,y:.02,r:.44,fill:i});if(h==="cheeks")for(const l of v)o.push({k:"ellipse",x:l*.4,y:.44,rx:.44,ry:.32,fill:i});if(h==="band"&&o.push({k:"path",d:Xt(e,t),fill:i}),n("stripes")){const l=r(0,a.outline);o.push({k:"line",pts:[0,-.97,0,-.66],stroke:l,lw:.13});for(const u of v)o.push({k:"line",pts:[u*.3,-.93,u*.24,-.7],stroke:l,lw:.1}),o.push({k:"line",pts:[u*.98,-.05,u*.74,0],stroke:l,lw:.1}),o.push({k:"line",pts:[u*.94,.22,u*.74,.22],stroke:l,lw:.09})}if(n("spots")){const l=r(1,a.belly);o.push({k:"circle",x:-.55,y:-.5,r:.15,fill:l}),o.push({k:"circle",x:.58,y:-.42,r:.11,fill:l}),o.push({k:"circle",x:.22,y:-.76,r:.09,fill:l})}if(n("forehead")&&o.push({k:"path",d:P(Q(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:r(0,a.accent)}),n("eye-spot")&&o.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:a.ears??a.accent}),n("gills"))for(const l of v)for(const u of[0,.12,.24])o.push({k:"path",d:`M${l*(.66+u)} 0.06 Q${l*(.6+u)} 0.22 ${l*(.66+u)} 0.38`,stroke:a.accent,lw:t*.9});const f=a.hair??a.outline;if(n("hair")&&o.push({k:"path",d:P(Q(-1.02,-.06,-1.02,-.58,-.62,-1.04,.08,-1.14,.76,-.92,1.05,-.42,1,-.06,.84,-.4,.42,-.5,.06,-.4,-.34,-.56,-.74,-.38)),fill:f,...s}),n("locks")&&o.push({k:"path",d:P(Q(-1,-.08,-.98,-.62,-.56,-1.02,0,-1.1,.56,-1.02,.98,-.62,1,-.08,.8,-.38,.36,-.44,0,-.4,-.36,-.44,-.8,-.38)),fill:f,...s}),n("curls")){for(let l=0;l<7;l++){const u=ie(-1.3+l/6*2.6,.86);o.push({k:"circle",x:u.x,y:u.y,r:.3,fill:f,...s})}o.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:f})}if(n("ninja-hood")&&(o.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:a.skin??N,stroke:a.outline,lw:t*.8}),o.push({k:"path",d:"M-0.98 -0.42 Q0 -0.74 0.98 -0.42 L1.0 -0.62 Q0 -0.94 -1.0 -0.62 Z",fill:a.accent,...s})),n("domino")){o.push({k:"path",d:P(Q(-.86,-.04,-.62,-.3,-.18,-.24,0,-.16,.18,-.24,.62,-.3,.86,-.04,.6,.22,.16,.16,0,.1,-.16,.16,-.6,.22),.9),fill:a.accent,...s});for(const l of v)o.push({k:"ellipse",x:l*.38,y:0,rx:.19,ry:.13,fill:N})}if(o.push(...Vt(e,t)),n("brows"))for(const l of v)o.push({k:"line",pts:[l*.72,-.5,l*.14,-.3],stroke:a.accent,lw:.16});if(e.face.brows)for(const l of v)o.push({k:"line",pts:[l*.2,-.2,l*.54,-.28],stroke:e.face.brows,lw:.09});if(o.push(...Jt(e,t)),e.face.cheeks)for(const l of v)o.push({k:"ellipse",x:l*.64,y:.3,rx:.15,ry:.1,fill:e.face.cheeks,alpha:.8});if(n("whiskers"))for(const l of v)for(const u of[-.1,.06])o.push({k:"line",pts:[l*.62,.38+u,l*1.06,.3+u*2.2],stroke:a.outline,lw:t*.7,alpha:.75});if(n("rainbow-mane")){const l=e.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];o.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:l[0],...s}),o.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:l[1%l.length],...s})}if(e.ears==="unicorn"){const l=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];o.push({k:"path",d:O(l,.12),fill:a.accent,...s});for(const u of[-1,-1.2,-1.4]){const c=.16*((u+1.72)/.88);o.push({k:"line",pts:[-c,u+.04,c,u-.04],stroke:a.outline,lw:t*.7,alpha:.6})}}if(n("helmet")){for(const l of v)o.push({k:"rect",x:l*1,y:.05,w:.26,h:.56,r:.12,fill:a.accent,...s});o.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:N,lw:.1,alpha:.9})}if(n("bolts"))for(const l of v)o.push({k:"rect",x:l*1.08,y:.08,w:.2,h:.44,r:.08,fill:a.accent,...s});if(n("tuft")&&o.push({k:"path",d:P([{x:-.26,y:-.95},{x:-.12,y:-1.22},{x:.02,y:-1.04},{x:.16,y:-1.28},{x:.28,y:-.95},{x:0,y:-.86}]),fill:a.body,...s}),n("eggshell")&&o.push({k:"path",d:"M-0.88 -0.5 C-0.88 -1.12 -0.46 -1.42 0 -1.42 C0.46 -1.42 0.88 -1.12 0.88 -0.5 L0.66 -0.66 L0.44 -0.48 L0.22 -0.66 L0 -0.48 L-0.22 -0.66 L-0.44 -0.48 L-0.66 -0.66 Z",fill:r(0,N),...s}),n("wool"))for(const[l,u]of[[-.36,-.84],[.02,-.94],[.4,-.82]])o.push({k:"circle",x:l,y:u,r:.27,fill:a.body,...s});if(n("stripe")&&o.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:a.accent}),n("eye-patch")&&(o.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:a.outline,lw:.07}),o.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:a.outline})),n("bandana")){o.push({k:"path",d:P(Q(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:a.accent,...s});for(const[l,u]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])o.push({k:"circle",x:l,y:u,r:.06,fill:N,alpha:.85});o.push({k:"circle",x:-.98,y:-.34,r:.15,fill:a.accent,...s})}if(n("cap")){for(const l of v)o.push({k:"line",pts:[l*.98,-.2,l*.5,.82,-l*.05,.98],stroke:a.outline,lw:.06});o.push({k:"path",d:P(Q(-1.1,-.16,-1.04,-.66,-.6,-1.12,0,-1.24,.6,-1.12,1.04,-.66,1.1,-.16,.5,-.4,-.5,-.4)),fill:a.accent,...s}),o.push({k:"path",d:"M-0.74 -0.4 Q0 -0.6 0.74 -0.4 Q0.8 -0.24 0.6 -0.22 Q0 -0.36 -0.6 -0.22 Q-0.8 -0.24 -0.74 -0.4 Z",fill:a.accent,...s}),o.push({k:"circle",x:.5,y:-.82,r:.15,fill:r(0,N),...s});for(const l of[-.42,-.14])o.push({k:"line",pts:[l,-1.04,l+.02,-.78],stroke:a.outline,lw:.07,alpha:.7})}if(n("safari-hat")&&(o.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:a.accent,...s}),o.push({k:"path",d:P(Q(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:a.accent,...s}),o.push({k:"path",d:"M-0.77 -0.72 Q0 -0.62 0.77 -0.72 L0.74 -0.9 Q0 -0.8 -0.74 -0.9 Z",fill:r(1,a.outline),stroke:a.outline,lw:t*.8})),n("wizard-hat")){o.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:a.accent,...s}),o.push({k:"path",d:O(Q(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:a.accent,...s});const l=r(0,Zt);for(const[u,c,x]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])o.push({k:"group",x:u,y:c,s:x,items:[{k:"path",d:ye,fill:l}]})}if(n("dive-mask")){for(const u of v)o.push({k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:a.outline,lw:.2},{k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:a.accent,lw:.11});o.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),o.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:a.outline,lw:.2}),o.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:a.accent,lw:.11}),o.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:N,lw:.06,alpha:.9});const l="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";o.push({k:"path",d:l,stroke:a.outline,lw:.24},{k:"path",d:l,stroke:a.accent,lw:.13})}return o}function Kt(e,t){const a=e.headExtras.includes("ninja-hood")?e.palette.body:e.palette.skin??e.palette.body;switch(e.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:a,...t};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:a,...t};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:a,...t};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:a,...t};case"bucket":return{k:"path",d:O(Q(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:a,...t};case"bulb":return{k:"path",d:P([{x:0,y:-1.02},{x:.86,y:-.74},{x:1.08,y:-.12},{x:.72,y:.62},{x:0,y:.92},{x:-.72,y:.62},{x:-1.08,y:-.12},{x:-.86,y:-.74}]),fill:a,...t}}}function Wt(e){return e.head==="round"?{cy:0,rx:1,ry:1}:e.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function Xt(e,t){const{cy:a,rx:o,ry:s}=Wt(e),n=o-t/2,r=s-t/2,h=.15,i=Math.asin(Math.min(1,(h-a)/r)),f=Math.cos(i)*n,l=d=>Math.round(d*100)/100||0,u=[L.M,l(-f),h],c=[[-.84*f,.02,-.53*f,.06,-.32*f,.24],[-.17*f,.11,.17*f,.11,.32*f,.24],[.53*f,.06,.84*f,.02,f,h]];for(const d of c)u.push(L.C,...d.map(l));const x=24;for(let d=1;d<=x;d++){const b=i+(Math.PI-2*i)*d/x;u.push(L.L,l(Math.cos(b)*n),l(a+Math.sin(b)*r))}return u.push(L.Z),u}function Gt(e,t){const a=e.palette,o={stroke:a.outline,lw:t},s=[];for(const n of v)switch(e.ears){case"pointy":case"unicorn":{const r=e.ears==="unicorn"?.8:1,h={x:n*.3,y:-.82},i={x:n*.86,y:-.82-.62*r},f={x:n*.94,y:-.36};s.push({k:"path",d:O([h,i,f],.2),fill:a.body,...o});const l={x:(h.x+i.x+f.x)/3,y:(h.y+i.y+f.y)/3},u=[h,i,f].map(c=>({x:l.x+(c.x-l.x)*.55,y:l.y+(c.y-l.y)*.55+.04}));s.push({k:"path",d:O(u,.25),fill:a.accent});break}case"round":s.push({k:"circle",x:n*.72,y:-.72,r:.36,fill:a.ears??a.body,...o}),a.ears||s.push({k:"circle",x:n*.74,y:-.74,r:.19,fill:a.accent});break;case"big-round":s.push({k:"circle",x:n*.96,y:-.46,r:.52,fill:a.body,...o}),s.push({k:"circle",x:n*1,y:-.44,r:.32,fill:a.accent});break;case"long":s.push({k:"ellipse",x:n*.38,y:-1.42,rx:.25,ry:.68,rot:n*.14,fill:a.body,...o}),s.push({k:"ellipse",x:n*.39,y:-1.36,rx:.12,ry:.48,rot:n*.14,fill:a.accent});break;case"side":s.push({k:"circle",x:n*1,y:.02,r:.34,fill:a.body,...o}),s.push({k:"circle",x:n*1.02,y:.02,r:.2,fill:a.belly});break;case"tufts":s.push({k:"path",d:O([{x:n*.3,y:-.84},{x:n*1.22,y:-1.12},{x:n*.92,y:-.42}],.16),fill:a.body,...o}),s.push({k:"line",pts:[n*.62,-.78,n*1,-.98],stroke:a.accent,lw:.08});break;case"antennae":{const r={x:n*.62,y:-1.42};s.push({k:"path",d:`M${n*.3} -0.8 Q${n*.36} -1.2 ${r.x} ${r.y}`,stroke:a.outline,lw:t*2.6}),s.push({k:"path",d:`M${n*.3} -0.8 Q${n*.36} -1.2 ${r.x} ${r.y}`,stroke:a.body,lw:t*1.2}),s.push({k:"circle",x:r.x,y:r.y,r:.17,fill:a.accent,...o});break}case"floppy":s.push({k:"ellipse",x:n*.96,y:.02,rx:.3,ry:.62,rot:-n*.36,fill:a.ears??a.body,...o});break;case"droopy":s.push({k:"ellipse",x:n*1.04,y:-.22,rx:.4,ry:.18,rot:n*.32,fill:a.skin??a.body,...o}),s.push({k:"ellipse",x:n*1.08,y:-.2,rx:.24,ry:.08,rot:n*.32,fill:a.accent});break;case"human":s.push({k:"ellipse",x:n*.98,y:.06,rx:.17,ry:.23,fill:a.skin??a.body,...o});break;case"horns":{const r=[{x:n*.3,y:-.84},{x:n*.6,y:-1.5},{x:n*.66,y:-.68}];s.push({k:"path",d:O(r,.18),fill:a.accent,...o});break}}return e.ears==="fin"&&s.push({k:"path",d:O(Q(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:a.body,...o}),e.ears==="antenna"&&(s.push({k:"line",pts:[0,-.85,0,-1.42],stroke:a.outline,lw:t*2.6}),s.push({k:"line",pts:[0,-.85,0,-1.42],stroke:a.limbs,lw:t*1.2}),s.push({k:"circle",x:0,y:-1.5,r:.18,fill:a.accent,...o})),s}function Vt(e,t){const a=e.palette,o=e.face,s=[],n=a.outline,r=o.eyesOnTop?.46:.4,h=o.eyesOnTop?-.72:-.04,i=(f,l,u)=>({k:"circle",x:f,y:l,r:u,fill:N});switch(o.eyes){case"dot":for(const f of v)s.push({k:"ellipse",x:f*r,y:h,rx:.12,ry:.155,fill:n}),s.push(i(f*r+.04,h-.06,.045));break;case"bead":for(const f of v)s.push({k:"ellipse",x:f*r,y:h,rx:.16,ry:.22,fill:n}),s.push(i(f*r+.05,h-.08,.065));break;case"big":for(const f of v)o.eyeRing&&s.push({k:"circle",x:f*r,y:h,r:.36,fill:o.eyeRing,stroke:n,lw:t*.8}),s.push({k:"circle",x:f*r,y:h,r:.25,fill:N,stroke:n,lw:t*.8}),s.push({k:"circle",x:f*r+f*-.03,y:h+.03,r:.14,fill:o.eyeColor??n}),s.push(i(f*r+f*-.03+.05,h-.03,.05));break;case"mask":for(const f of v)s.push({k:"ellipse",x:f*.4,y:0,rx:.24,ry:.32,rot:f*-.55,fill:a.limbs}),s.push({k:"circle",x:f*.4,y:-.02,r:.11,fill:N}),s.push({k:"circle",x:f*.39,y:-0,r:.065,fill:n});break;case"screen":s.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:n,lw:t*.8});for(const f of v)s.push({k:"ellipse",x:f*.36,y:0,rx:.2,ry:.24,fill:o.eyeColor??"#7ff0ff",alpha:.3}),s.push({k:"ellipse",x:f*.36,y:0,rx:.12,ry:.16,fill:o.eyeColor??"#7ff0ff"});break;case"almond":for(const f of v)s.push({k:"ellipse",x:f*.42,y:-.02,rx:.3,ry:.2,rot:-f*.5,fill:o.eyeColor??n}),s.push(i(f*.42-f*.07,-.08,.07));break;case"calm":for(const f of v)s.push({k:"ellipse",x:f*.38,y:.02,rx:.085,ry:.12,fill:n}),s.push(i(f*.38+.03,-.02,.03));break;case"slit":s.push({k:"line",pts:[0,-.98,0,-.2],stroke:n,lw:t*.8,alpha:.5}),s.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:Ee,stroke:n,lw:t*.8}),s.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:Ee,stroke:n,lw:t*.8});for(const f of v){s.push({k:"ellipse",x:f*.4,y:-.04,rx:.12,ry:.07,fill:o.eyeColor??N});for(const l of[.36,.56])s.push({k:"circle",x:f*.42,y:l,r:.05,fill:n,alpha:.6})}break;case"goggle":for(const f of v)s.push({k:"circle",x:f*.9,y:0,r:.13,fill:a.accent,stroke:n,lw:t*.8});s.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:Ee,stroke:n,lw:t*.8}),s.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:N,lw:.07,alpha:.8});for(const f of v)s.push({k:"path",d:`M${f*.5} 0.04 Q${f*.34} -0.08 ${f*.16} 0.02`,stroke:o.eyeColor??"#7fd6ff",lw:.08});for(const f of[-.18,0,.18])s.push({k:"line",pts:[f,.56,f,.72],stroke:n,lw:t*.8,alpha:.6});break;case"visor":s.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:n,lw:t*.8}),s.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:N,lw:.08,alpha:.7});for(const f of v)s.push({k:"ellipse",x:f*.28,y:.04,rx:.1,ry:.14,fill:o.eyeColor??"#cfeeff"});break}return s}function Jt(e,t){const a=e.palette,o=e.face,s=[],n=o.eyes==="visor"?"#cfeeff":Ye,r=t*1.05;switch(o.nose&&o.mouth!=="beak"&&(o.mouth==="cat"?s.push({k:"path",d:O([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:o.nose,stroke:o.nose,lw:t*.6}):e.ears==="big-round"?s.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:o.nose}):s.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:o.nose})),o.mouth){case"smile":s.push({k:"path",d:o.eyes==="visor"?"M-0.16 0.32 Q0 0.46 0.16 0.32":"M-0.17 0.42 Q0 0.58 0.17 0.42",stroke:n,lw:r});break;case"open":s.push({k:"path",d:"M-0.21 0.4 Q0 0.46 0.21 0.4 Q0.19 0.68 0 0.68 Q-0.19 0.68 -0.21 0.4 Z",fill:n,stroke:n,lw:t*.5}),s.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Yt});break;case"cat":s.push({k:"path",d:"M-0.19 0.4 Q-0.1 0.5 0 0.37 Q0.1 0.5 0.19 0.4",stroke:n,lw:r});break;case"beak":s.push({k:"path",d:O([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:a.accent,stroke:a.outline,lw:t*.8});break;case"teeth":s.push({k:"path",d:"M-0.36 0.34 Q0 0.44 0.36 0.34 Q0.28 0.66 0 0.66 Q-0.28 0.66 -0.36 0.34 Z",fill:n,stroke:n,lw:t*.5});for(const h of v)s.push({k:"rect",x:h*.12,y:.43,w:.1,h:.1,r:.03,fill:N});break;case"grill":s.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:a.outline,lw:t*.7});for(const h of[-.15,0,.15])s.push({k:"line",pts:[h,.51,h,.61],stroke:"#9fb0bd",lw:t*.6});break;case"tiny":s.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:n});break;case"smirk":s.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:n,lw:r});break;case"bill":s.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:a.accent,stroke:a.outline,lw:t*.8}),s.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:a.outline,lw:t*.7});for(const h of v)s.push({k:"circle",x:h*.1,y:.28,r:.03,fill:a.outline});break;case"hook":s.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:Ye}),s.push({k:"path",d:"M-0.3 0.12 Q0 -0.02 0.3 0.12 Q0.36 0.52 0.04 0.76 Q0.08 0.52 -0.08 0.46 Q-0.28 0.38 -0.3 0.12 Z",fill:a.accent,stroke:a.outline,lw:t*.8});break;case"jaws":{s.push({k:"path",d:"M-0.5 0.3 Q0 0.5 0.5 0.3 Q0.38 0.72 0 0.72 Q-0.38 0.72 -0.5 0.3 Z",fill:n,stroke:n,lw:t*.5});for(const h of[-.34,-.17,0,.17,.34]){const i=.3+.4*(h+.5)*(.5-h)-.01;s.push({k:"path",d:O(Q(h-.075,i,h+.075,i,h,i+.13),.15),fill:N})}break}}return s}var ie=(e,t)=>({x:Math.sin(e)*t,y:-Math.cos(e)*t}),ea=.5,X={leftEye:2,rightEye:5,leftEar:7,rightEar:8},V={"3-5":{head:.75,neck:.74,arm:.3,leg:.36,hand:.19,foot:1.2,shoulderMin:.4,shoulderPad:.07,hipMin:.5,hipPad:.22,bottom:.26,bulge:1.12,armsOverHead:!0},"6-8":{head:.6,neck:.78,arm:.22,leg:.28,hand:.15,foot:1,shoulderMin:.34,shoulderPad:.04,hipMin:.4,hipPad:.16,bottom:.14,bulge:1.04,armsOverHead:!1},"9-12":{head:.5,neck:.92,arm:.17,leg:.21,hand:.125,foot:.9,shoulderMin:.36,shoulderPad:.07,hipMin:.32,hipPad:.08,bottom:.1,bulge:1,armsOverHead:!1}},be="6-8",Ke=e=>e.band in V?e.band:be,ja=V[be].head,ta=.3,aa=.12,oa=.9,We=.5,Xe=.65,sa=.35,na=.2,ra=.25,Z=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),q=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),I=(e,t)=>({x:e.x*t,y:e.y*t}),J=e=>Math.hypot(e.x,e.y),Ge=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),Me=e=>{const t=J(e);return t>1e-9?{x:e.x/t,y:e.y/t}:{x:0,y:1}},la=(...e)=>e.every(Number.isFinite),ia=e=>Math.atan2(Math.sin(e),Math.cos(e)),ca=(e,t,a)=>Math.min(Math.max(e,t),a);function Ve(e,t,a=!1){return o=>{const s=e[o*3],n=e[o*3+1],r=e[o*3+2];return s===void 0||n===void 0||r===void 0||!la(s,n,r)?{x:0,y:0,ok:!1}:{x:t.x+(a?1-s:s)*t.w,y:t.y+n*t.h,ok:r>=ea}}}function Ae(e,t,a={}){const o=Ve(e,t,a.mirrored),s=o(T.leftShoulder),n=o(T.rightShoulder);if(!s.ok||!n.ok)return null;const r=o(T.leftHip),h=o(T.rightHip),i=Ge(s,n),f=J(Z(n,s)),l=r.ok&&h.ok;let u=Me(Z(n,s));f<1e-6&&(u={x:1,y:0});let c,x,d;if(l){const ee=Ge(r,h);x=J(Z(ee,i)),x>=f*ra?c=Me(Z(ee,i)):(c={x:-u.y,y:u.x},c.y<0&&(c=I(c,-1))),d=Math.max(x,f*1.15)}else c={x:-u.y,y:u.x},c.y<0&&(c=I(c,-1)),d=f*1.15,x=d;d=Math.max(d,1e-6);const b={x:c.y,y:-c.x},y=Math.atan2(b.y,b.x),k=I(c,-1),g=V[a.band??be]??V[be],z=g.head*d;let U=q(i,I(k,z*g.neck));const ce=o(T.nose);if(ce.ok){const ee=q(ce,I(k,z*.15)),fe=I(Z(ee,U),sa),Se=Math.min(1,z*na/Math.max(J(fe),1e-6));U=q(U,I(fe,Se))}return{S:i,r:b,d:c,U:d,L:x,hipsOk:l,head:U,headR:z,headRot:y+fa(e,o,y,d),angle:y}}function fa(e,t,a,o){const s=[[X.leftEar,X.rightEar],[X.leftEye,X.rightEye]];for(const[n,r]of s){const h=t(n),i=t(r);if(!h.ok||!i.ok||!(e[n*3+2]>=Xe&&e[r*3+2]>=Xe)||J(Z(i,h))<o*.05)continue;const f=ia(Math.atan2(i.y-h.y,i.x-h.x)-a),l=Math.max(Math.abs(f)-aa,0),u=ca((oa+We-Math.abs(f))/We,0,1);return Math.sign(f)*Math.min(l,ta)*u}return 0}function Ce(e,t,a,o={}){const s=Ke(t),n=V[s],r=Ae(e,a,{...o,band:s});if(!r)return[];const h=Ve(e,a,o.mirrored),i=t.palette,{S:f,r:l,d:u,U:c,L:x}=r,d=p=>t.bodyExtras.includes(p),b=Math.max(1.2,c*.045),y={stroke:i.outline,lw:b},k=(p,m)=>({x:f.x+l.x*p+u.x*m,y:f.y+l.y*p+u.y*m}),g=p=>p.map(([m,w])=>k(m,w)),z=h(T.leftShoulder),U=h(T.rightShoulder),ce=h(T.leftHip),ee=h(T.rightHip),fe=J(Z(U,z)),Se=r.hipsOk?J(Z(ee,ce)):fe*.7,M=Math.max(fe/2+n.shoulderPad*c,n.shoulderMin*c),_=Math.max(Se/2+n.hipPad*c,n.hipMin*c),F=-.1*c,ae=x+n.bottom*c,K=[],xe=[],C=[],me=[],ht=[],ut=(p,m,w,S)=>{const E=m.flatMap(H=>[H.x,H.y]);p.push({k:"line",pts:E,stroke:i.outline,lw:w+b*2}),p.push({k:"line",pts:E,stroke:S,lw:w})},Qa=n.leg*c,Ba=n.arm*c,dt=Math.max(n.arm/.22,.9);if(r.hipsOk)for(const[p,m,w,S]of[[ce,T.leftKnee,T.leftAnkle,-1],[ee,T.rightKnee,T.rightAnkle,1]]){const E=h(m),H=h(w);if(!E.ok)continue;const Te=q(p,I(u,-.12*c)),oe=H.ok?[Te,E,H]:[Te,E];ut(xe,oe,Qa,i.limbs),d("joints")&&xe.push({k:"circle",x:E.x,y:E.y,r:.15*c*dt,fill:i.accent,...y}),H.ok&&xe.push(da(t,H,r,S,b,n.foot))}for(const[p,m,w,S]of[[z,T.leftElbow,T.leftWrist,-1],[U,T.rightElbow,T.rightWrist,1]]){const E=h(m),H=h(w);if(d("pauldrons")){const se=q(p,I(u,.02*c));me.push({k:"ellipse",x:se.x,y:se.y,rx:.25*c,ry:.17*c,rot:r.angle+S*.25,fill:i.body,...y});const ue=q(se,I(u,.05*c));me.push({k:"ellipse",x:ue.x,y:ue.y,rx:.17*c,ry:.07*c,rot:r.angle+S*.25,fill:i.belly})}if(!E.ok)continue;const oe=n.armsOverHead&&(E.x-f.x)*u.x+(E.y-f.y)*u.y<-.25*c?ht:me,pt=q(p,I(u,.04*c));if(ut(oe,H.ok?[pt,E,H]:[pt,E],Ba,i.limbs),d("joints")&&oe.push({k:"circle",x:E.x,y:E.y,r:.13*c*dt,fill:i.accent,...y}),!H.ok)continue;const he=Me(Z(H,E)),ze=q(H,I(he,.05*c));if(d("feathers"))for(const se of[-.55,0,.55]){const ue=Math.cos(se),yt=Math.sin(se)*S,Pe={x:he.x*ue-he.y*yt,y:he.x*yt+he.y*ue},bt=q(ze,I(Pe,.16*c));oe.push({k:"ellipse",x:bt.x,y:bt.y,rx:.2*c,ry:.09*c,rot:Math.atan2(Pe.y,Pe.x),fill:i.hands??i.accent,...y})}oe.push({k:"circle",x:ze.x,y:ze.y,r:n.hand*c,fill:i.hands??i.limbs,...y})}if(d("wings"))for(const p of[-1,1]){const m=g([[p*M*.5,.05*c],[p*(M+.85*c),-.6*c],[p*(M+.72*c),.05*c],[p*(M+.45*c),-.02*c],[p*(M+.3*c),.32*c],[p*M*.6,.55*c]]);K.push({k:"path",d:O(m,.18),fill:i.accent,...y})}if(d("cape")){const p=x+.8*c,m=_+.36*c,w=g([[-M*.92,F+.04*c],[M*.92,F+.04*c],[M+.16*c,x*.5],[m,p],[m*.5,p-.1*c],[0,p],[-m*.5,p-.1*c],[-m,p],[-M-.16*c,x*.5]]);K.push({k:"path",d:P(w,.6),fill:i.accent,...y})}if(d("backpack")){const p=k(0,.35*c);K.push({k:"rect",x:p.x,y:p.y,w:M*2+.34*c,h:.8*c,r:.16*c,rot:r.angle,fill:t.extraColors?.[0]??i.limbs,...y})}if(d("tank")){const p=k(M*.95,.24*c),m=t.extraColors?.[0]??i.accent,w=k(M*.95,-.3*c);K.push({k:"rect",x:w.x,y:w.y,w:.14*c,h:.16*c,r:.04*c,rot:r.angle,fill:i.outline}),K.push({k:"rect",x:p.x,y:p.y,w:.34*c,h:1*c,r:.17*c,rot:r.angle,fill:m,...y})}if(r.hipsOk&&!o.portrait&&K.push(...pa(t,r,_,b)),d("tentacles")&&r.hipsOk)for(const p of[-1,1]){const m=g([[p*_*.7,x*.9],[p*(_+.22*c),x+.3*c],[p*(_+.48*c),x+.22*c],[p*(_+.5*c),x-.02*c],[p*(_+.34*c),x-.06*c]]);K.push({k:"path",d:le(m),stroke:i.outline,lw:.2*c+b*2}),K.push({k:"path",d:le(m),stroke:i.limbs,lw:.2*c})}const W=Math.max(M,_)*n.bulge;if(d("wool")){for(const[m,w]of[[M*.7,F+.02*c],[W,x*.3],[W*1.02,x*.62],[(W+_)/2,x*.92],[_*.55,ae]])for(const S of[-1,1]){const E=k(S*m,w);C.push({k:"circle",x:E.x,y:E.y,r:.2*c,fill:i.body,...y})}const p=k(0,ae+.02*c);C.push({k:"circle",x:p.x,y:p.y,r:.2*c,fill:i.body,...y})}if(d("robe")){const p=x+.58*c,m=_*1.4;C.push({k:"path",d:P(g([[-M,F],[0,F-.04*c],[M,F],[W,x*.55],[m,p],[0,p+.06*c],[-m,p],[-W,x*.55]]),.7),fill:i.body,...y});const w=g([[-m*.94,p-.1*c],[0,p-.04*c],[m*.94,p-.1*c]]);C.push({k:"path",d:le(w),stroke:t.extraColors?.[0]??i.accent,lw:.07*c})}else if(d("sheet")){const p=x+.78*c,m=_*1.3;C.push({k:"path",d:P(g([[-M,F],[M,F],[W,x*.55],[m,p],[m*.5,p-.2*c],[0,p],[-m*.5,p-.2*c],[-m,p],[-W,x*.55]]),.9),fill:i.body,...y})}else C.push({k:"path",d:P(g([[-M,F],[0,F-.04*c],[M,F],[W,x*.55],[_,ae],[0,ae+.03*c],[-_,ae],[-W,x*.55]]),.85),fill:i.body,...y});const Y=Math.min(M,_);if(d("pocket")){const p=k(0,x*.74);C.push({k:"rect",x:p.x,y:p.y,w:Y*1.3,h:.3*c,r:.1*c,rot:r.angle,fill:i.belly,stroke:i.outline,lw:b*.8})}else if(d("racing-stripe"))for(const p of[-.1,.1]){const m=k(p*c,F+.02*c),w=k(p*c,ae-.04*c);C.push({k:"line",pts:[m.x,m.y,w.x,w.y],stroke:i.belly,lw:.1*c})}else if(i.belly&&i.belly!==i.body&&!d("panel")&&!d("sheet")&&!d("stripes")){const p=k(0,x*.58);C.push({k:"ellipse",x:p.x,y:p.y,rx:Y*.64,ry:Math.max(x*.36,.2*c),rot:r.angle,fill:i.belly})}if(d("spots")){const p=t.extraColors?.[1]??i.belly;for(const[m,w,S]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){const E=k(m*Y,w*x);C.push({k:"circle",x:E.x,y:E.y,r:S*c,fill:p})}}if(d("stripes")){const p=t.extraColors?.[1]??i.accent;for(const m of[.22,.44,.66]){const w=k(-Y*.98,x*m),S=k(Y*.98,x*m);C.push({k:"line",pts:[w.x,w.y,S.x,S.y],stroke:p,lw:.1*c})}}if(d("straps")){const p=t.extraColors?.[1]??i.outline;for(const m of[-1,1]){const w=k(m*M*.62,F+.02*c),S=k(m*Y*.62,x*.72);C.push({k:"line",pts:[w.x,w.y,S.x,S.y],stroke:i.outline,lw:.13*c+b*2}),C.push({k:"line",pts:[w.x,w.y,S.x,S.y],stroke:p,lw:.13*c})}}if(d("belt")){const p=k(0,x*.9);C.push({k:"rect",x:p.x,y:p.y,w:_*1.92,h:.17*c,r:.06*c,rot:r.angle,fill:t.extraColors?.[2]??"#4a3426",...y}),C.push({k:"rect",x:p.x,y:p.y,w:.2*c,h:.19*c,r:.04*c,rot:r.angle,fill:"#ffd84a",...y})}if(d("emblem")){const p=k(0,x*.4),m=t.extraColors?.[0]??i.accent,w=O([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);C.push({k:"group",x:p.x,y:p.y,rot:r.angle,s:c,items:[{k:"path",d:w,fill:m,stroke:i.outline,lw:b/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:ye,fill:m===i.accent?"#ffffff":i.accent}]}]})}if(d("panel")){const p=k(0,x*.5);C.push({k:"rect",x:p.x,y:p.y,w:Y*1.2,h:.38*c,r:.1*c,rot:r.angle,fill:"#24323d",...y}),(t.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((w,S)=>{const E=k((S-1)*Y*.34,x*.5);C.push({k:"circle",x:E.x,y:E.y,r:.075*c,fill:w})})}if(d("badge")){const p=k(-Y*.42,x*.36);C.push({k:"circle",x:p.x,y:p.y,r:.15*c,fill:i.accent,...y}),C.push({k:"group",x:p.x,y:p.y,rot:r.angle,s:.09*c,items:[{k:"path",d:ye,fill:"#ffffff"}]})}if(d("star")){const p=k(-Y*.5,x*.3),m=.15*c;C.push({k:"group",x:p.x,y:p.y,rot:r.angle-.2,s:m,items:[{k:"path",d:ye,fill:t.extraColors?.[0]??"#ffd84a",stroke:i.outline,lw:b*.8/m}]})}if(d("scarf")){const p=Math.max(.04,n.head*(1-n.neck)-.06)*c,m=k(0,p),w=t.extraColors?.[0]??i.accent,S=k(M*.45,p+.28*c);C.push({k:"rect",x:S.x,y:S.y,w:.16*c,h:.42*c,r:.06*c,rot:r.angle+.15,fill:w,...y}),C.push({k:"rect",x:m.x,y:m.y,w:M*2.05,h:.2*c,r:.1*c,rot:r.angle,fill:w,...y})}const Fa={k:"group",x:r.head.x,y:r.head.y,rot:r.headRot,s:r.headR,items:ua(t,b/r.headR)};return[...K,...xe,...C,...me,Fa,...ht]}var Je=new WeakMap,ha=64;function ua(e,t){const a=Number(t.toPrecision(4));let o=Je.get(e);o||Je.set(e,o=new Map);let s=o.get(a);return s||(o.size>=ha&&o.clear(),o.set(a,s=Ze(e,a))),s}function da(e,t,a,o,s,n){const r=e.palette,{d:h,r:i}=a,f=a.U*n,l=q(q(t,I(h,.07*f)),I(i,o*.06*f)),u={stroke:r.outline,lw:s},c=r.feet??r.limbs;if(e.bodyExtras.includes("fins")){const x=O([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:l.x,y:l.y,rot:a.angle,s:f,items:[{k:"path",d:x,fill:c,stroke:r.outline,lw:s/f},{k:"line",pts:[0,.06,0,.38],stroke:r.outline,lw:s/f,alpha:.5}]}}return e.bodyExtras.includes("flippers")?{k:"ellipse",x:l.x,y:l.y,rx:.27*f,ry:.11*f,rot:a.angle,fill:c,...u}:e.bodyExtras.includes("boots")?{k:"rect",x:l.x,y:l.y,w:.4*f,h:.24*f,r:.09*f,rot:a.angle,fill:c,...u}:{k:"ellipse",x:l.x,y:l.y,rx:.2*f,ry:.13*f,rot:a.angle,fill:c,...u}}function pa(e,t,a,o){const s=e.palette,{U:n,L:r,S:h,r:i,d:f}=t,l=(b,y)=>({x:h.x+i.x*b+f.x*y,y:h.y+i.y*b+f.y*y}),u=b=>b.map(([y,k])=>l(y,k)),c={stroke:s.outline,lw:o},x=(b,y,k)=>[{k:"path",d:le(b),stroke:s.outline,lw:y+o*2},{k:"path",d:le(b),stroke:k,lw:y}],d=[];switch(e.tail){case"none":break;case"fluffy":{const b=u([[a*.5,r*.95],[a+.28*n,r*1],[a+.72*n,r*.62],[a+.78*n,r*.12],[a+.52*n,r*.32],[a+.3*n,r*.6],[a*.6,r*.7]]);d.push({k:"path",d:P(b),fill:s.body,...c});const y=l(a+.72*n,r*.2);d.push({k:"ellipse",x:y.x,y:y.y,rx:.13*n,ry:.2*n,rot:t.angle+.25,fill:s.belly,...c});break}case"brush":{const b=u([[a*.4,r*.98],[a+.42*n,r*1.06],[a+.98*n,r*.66],[a+1.06*n,r*.12],[a+.86*n,-.04*n],[a+.66*n,r*.36],[a+.3*n,r*.66],[a*.5,r*.68]]);d.push({k:"path",d:P(b),fill:s.body,...c});const y=u([[a+1.03*n,r*.36],[a+1.06*n,r*.12],[a+.86*n,-.04*n],[a+.72*n,r*.24],[a+.86*n,r*.34]]);d.push({k:"path",d:P(y),fill:s.belly,...c});break}case"pom":{const b=l(a+.06*n,r*.88);d.push({k:"circle",x:b.x,y:b.y,r:.2*n,fill:s.belly,...c});break}case"long":case"striped":case"tuft":{const b=u([[a*.6,r*.9],[a+.35*n,r*.85],[a+.58*n,r*.4],[a+.5*n,-.02*n]]);if(d.push(...x(b,.14*n,s.body)),e.tail==="tuft"){const y=b[b.length-1];d.push({k:"circle",x:y.x,y:y.y,r:.16*n,fill:e.extraColors?.[0]??s.accent,...c})}if(e.tail==="striped"){for(const k of[.35,.6,.85]){const g=l(a+.35*n+.22999999999999998*n*(k*1.4>1?1:k*1.4),r*(.85-.85*k));d.push({k:"line",pts:[g.x-i.x*.08*n,g.y-i.y*.08*n,g.x+i.x*.08*n,g.y+i.y*.08*n],stroke:e.extraColors?.[0]??s.outline,lw:.06*n})}const y=b[b.length-1];d.push({k:"circle",x:y.x,y:y.y,r:.07*n,fill:e.extraColors?.[0]??s.outline})}break}case"curl":{const b=u([[a*.6,r*.9],[a+.4*n,r*.88],[a+.62*n,r*.45],[a+.5*n,r*.12],[a+.3*n,r*.24],[a+.36*n,r*.42]]);d.push(...x(b,.12*n,s.limbs));break}case"fish":{const b=u([[a*.6,r*.9],[a+.36*n,r*.86],[a+.6*n,r*.5]]);d.push(...x(b,.17*n,s.body));const y=b[b.length-1],k=O([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);d.push({k:"group",x:y.x,y:y.y,rot:t.angle+.35,s:n,items:[{k:"path",d:k,fill:s.body,stroke:s.outline,lw:o/n}]});break}case"plume":{const b=e.extraColors??[s.accent];[0,1,2].forEach(y=>{const k=l(a+(.12+y*.13)*n,r+(.32-y*.06)*n);d.push({k:"ellipse",x:k.x,y:k.y,rx:.11*n,ry:.44*n,rot:t.angle-.55+y*.28,fill:b[(y+1)%b.length],...c})});break}case"spiky":case"arrow":{const b=u([[a*.3,r*.55],[a+.35*n,r*.68],[a+.95*n,r*.86],[a+.35*n,r*1.08],[a*.3,r*1.08]]);if(e.tail==="spiky"){for(const y of[.15,.45,.72]){const k=a+(.2+y*.7)*n,g=r*(.66+y*.19);d.push({k:"path",d:O(u([[k-.12*n,g+.05*n],[k,g-.2*n],[k+.12*n,g+.07*n]]),.2),fill:s.accent,...c})}d.push({k:"path",d:P(b,.7),fill:s.body,...c})}else{const y=u([[a*.6,r*.9],[a+.4*n,r*.92],[a+.62*n,r*.5],[a+.62*n,r*.18]]);d.push(...x(y,.13*n,s.body));const k=y[y.length-1];d.push({k:"group",x:k.x,y:k.y,rot:t.angle,s:n,items:[{k:"path",d:O([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:s.accent,stroke:s.outline,lw:o/n}]})}break}}return d}var ya={nose:[0,-.62],leftShoulder:[-.42,0],rightShoulder:[.42,0],leftElbow:[-.58,.5],rightElbow:[.58,.5],leftWrist:[-.66,.98],rightWrist:[.66,.98],leftHip:[-.27,1],rightHip:[.27,1],leftKnee:[-.31,1.6],rightKnee:[.31,1.6],leftAnkle:[-.33,2.18],rightAnkle:[.33,2.18]};function ba(e,{cx:t=.5,cy:a=.36,T:o=.18}={}){const s={...ya,...e},n=new Array(Ie*3).fill(0),r=(f,[l,u],c=.99)=>{n[f*3]=t+l*o,n[f*3+1]=a+u*o,n[f*3+2]=c};for(const f of Object.keys(T))r(T[f],s[f]);const h=s.tilt??0,i=(f,l)=>[s.nose[0]+f*Math.cos(h)-l*Math.sin(h),s.nose[1]+f*Math.sin(h)+l*Math.cos(h)];return r(X.leftEye,i(-.1,-.08)),r(X.rightEye,i(.1,-.08)),r(X.leftEar,i(-.22,-.02)),r(X.rightEar,i(.22,-.02)),n}var ka=()=>ba({}),et=.5,xa=.15,ma=class{constructor(e={}){D(this,"tracks",new Map),D(this,"offset",NaN),D(this,"lastArrival",NaN),D(this,"interval",33),D(this,"lastT",NaN),D(this,"lostMs"),D(this,"maxExtrapolateMs"),this.lostMs=e.lostMs??250,this.maxExtrapolateMs=e.maxExtrapolateMs??25}get delayMs(){return this.interval}push(e,t,a,o=tt()){Number.isFinite(t)||(t=o),this.clock(t,o);const s=this.tracks.get(e);if(!s||t-s.tb>this.lostMs||t<s.tb-this.lostMs||a.length!==s.b.length){this.tracks.set(e,{a:null,ta:t,b:a,tb:t,out:null,outAt:NaN});return}if(a===s.b||t<=s.tb){t===s.tb&&a!==s.b&&(s.b=a,s.out=null);return}s.a=s.b,s.ta=s.tb,s.b=a,s.tb=t,s.out=null}at(e,t=tt()){const a=this.tracks.get(e);if(!a)return null;if(!a.a)return a.b;if(a.out&&a.outAt===t)return a.out;const o=t-this.offset-this.interval,s=a.tb-a.ta,n=Math.min(s*.5,this.maxExtrapolateMs),r=Math.min(Math.max((o-a.ta)/s,0),1+n/s);return a.out=wa(a.a,a.b,r),a.outAt=t,a.out}forget(e){this.tracks.delete(e)}clear(){this.tracks.clear()}clock(e,t){const a=t-e;if(!Number.isFinite(this.offset)||a<this.offset||a>this.offset+1e3?this.offset=a:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(a-this.offset,(t-this.lastArrival)/1e3)),this.lastArrival=t,Number.isFinite(this.lastT)&&e>this.lastT){const o=e-this.lastT;o<this.interval*3+20&&(this.interval+=(Math.min(Math.max(o,8),100)-this.interval)*.1)}e<=this.lastT||(this.lastT=e)}},tt=()=>globalThis.performance?.now()??Date.now();function wa(e,t,a){const o=t.slice(),s=a<.5?e:t;for(let n=0;n+2<t.length;n+=3){const r=e[n],h=e[n+1],i=t[n],f=t[n+1];e[n+2]>=et&&t[n+2]>=et&&Math.abs(i-r)+Math.abs(f-h)<xa?(o[n]=r+(i-r)*a,o[n+1]=h+(f-h)*a,o[n+2]=e[n+2]+(t[n+2]-e[n+2])*Math.min(a,1)):(o[n]=s[n],o[n+1]=s[n+1],o[n+2]=s[n+2])}return o}var Ua=$e.map(e=>e.id),ke=new Map($e.map(e=>[e.id,e])),at=ke.get("fox"),ga=e=>typeof e=="string"&&ke.has(e),va=e=>ke.get(e),ot=e=>typeof e=="string"?ke.get(e)??at:e;function Ea(e,t,a,o,s={}){const n=Ce(t,ot(a),o,{mirrored:s.mirrored});return n.length?(e.save(),s.alpha!==void 0&&(e.globalAlpha*=Math.min(Math.max(s.alpha,0),1)),ve(e,n),e.restore(),!0):!1}function Ma(e,t){const a=ot(e),o=ka(),s=Ke(a),n=Ae(o,{x:0,y:0,w:1,h:1},{band:s}),r=-st(Ze(a,.05)).minY,i=Math.min(.27,.43/Math.max(r,1))*t/V[s].head/n.U,f=.5*t+Math.min(0,(r-1.6)*.06*t),l={x:t/2-n.head.x*i,y:f-n.head.y*i,w:i,h:i};return Ce(o,a,l,{portrait:!0})}function Aa(e,t,a=.5){if(!e||e.length!==t.length)return t.slice();const o=t.slice();for(let s=0;s+2<t.length;s+=3){const n=e[s+2],r=t[s+2],h=n>=.5,i=r>=.5;h&&r>=.3&&(o[s+2]=Math.max(r,.5)),h&&i&&Math.hypot(t[s]-e[s],t[s+1]-e[s+1])<.15?(o[s]=e[s]+(t[s]-e[s])*a,o[s+1]=e[s+1]+(t[s+1]-e[s+1])*a):h&&!i&&o[s+2]>=.5&&(o[s]=e[s],o[s+1]=e[s+1])}return Ta(e,t,o,a*Ca),o}var Ca=.35,Sa=11;function Ta(e,t,a,o){const s=T.leftShoulder*3,n=T.rightShoulder*3,r=(u,c)=>u[c+2]>=.5;if(!r(e,s)||!r(e,n)||!r(t,s)||!r(t,n))return;const h=(u,c)=>(u[s+c]+u[n+c])/2,i=[h(e,0),h(e,1)],f=[h(t,0),h(t,1)],l=[h(a,0),h(a,1)];for(let u=0;u<Sa&&u*3+2<t.length;u++){const c=u*3;if(!r(e,c)||!r(t,c))continue;const x=[e[c]-i[0],e[c+1]-i[1]],d=[t[c]-f[0],t[c+1]-f[1]];Math.hypot(d[0]-x[0],d[1]-x[1])>=.15||(a[c]=l[0]+x[0]+(d[0]-x[0])*o,a[c+1]=l[1]+x[1]+(d[1]-x[1])*o)}}function st(e){const t={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=(o,s)=>{t.minX=Math.min(t.minX,o),t.minY=Math.min(t.minY,s),t.maxX=Math.max(t.maxX,o),t.maxY=Math.max(t.maxY,s)};for(const o of e){const s="lw"in o&&o.stroke?(o.lw??1)/2:0;switch(o.k){case"circle":a(o.x-o.r-s,o.y-o.r-s),a(o.x+o.r+s,o.y+o.r+s);break;case"ellipse":case"rect":{const n=o.k==="ellipse"?o.rx:o.w/2,r=o.k==="ellipse"?o.ry:o.h/2,h=Math.max(n,r)+s;a(o.x-h,o.y-h),a(o.x+h,o.y+h);break}case"path":{const n=$t(o.d);for(let r=0;r+1<n.length;r+=2)a(n[r]-s,n[r+1]-s),a(n[r]+s,n[r+1]+s);break}case"line":for(let n=0;n+1<o.pts.length;n+=2)a(o.pts[n]-s,o.pts[n+1]-s),a(o.pts[n]+s,o.pts[n+1]+s);break;case"group":{const n=st(o.items);if(!Number.isFinite(n.minX))break;const r=o.s??1,h=Math.cos(o.rot??0),i=Math.sin(o.rot??0);for(const[f,l]of[[n.minX,n.minY],[n.maxX,n.minY],[n.minX,n.maxY],[n.maxX,n.maxY]])a(o.x+(f*h-l*i)*r,o.y+(f*i+l*h)*r);break}}}return t}var za=()=>{const e=typeof document<"u"?document.timeline?.currentTime:null;return typeof e=="number"&&Number.isFinite(e)?e:globalThis.performance?.now()??Date.now()},nt=()=>globalThis.performance?.now()??Date.now(),rt=class{constructor(e=za){D(this,"now",e),D(this,"known",new Map),D(this,"smoothed",new Map),D(this,"times",new WeakMap),D(this,"lerp",new ma),D(this,"drawnAt",NaN),D(this,"drawn",0),D(this,"smoothedBody",(t,a={})=>{const o=a.interpolate!==!1;if(typeof t=="number"){const s=this.smoothed.get(t);return s?o?this.lerp.at(t,this.tick())??s.body:s.body:null}return typeof t!="object"||t===null||!Array.isArray(t.body)?null:this.posed(t.id,t.body,lt(a.smooth),o)})}note(e,t,a=nt()){for(const o of e)this.known.set(o.id,this.resolve(o.id,o.avatar)),t!==void 0&&Number.isFinite(t)&&Array.isArray(o.body)&&this.times.set(o.body,{t,arrival:a})}of(e){return typeof e=="object"&&e!==null?e.avatar!==void 0?this.resolve(e.id,e.avatar):this.of(e.id):this.known.get(e)??Qe(e-1)}posed(e,t,a,o=!0){const s=this.smooth(e,t,a);return o?this.lerp.at(e,this.tick())??s:s}smooth(e,t,a){const o=this.smoothed.get(e);if(o&&o.raw===t&&o.amount===a)return o.body;o&&o.amount!==a&&this.lerp.forget(e);const s=a<1?Aa(o?.body,t,a):t;this.smoothed.set(e,{raw:t,body:s,amount:a});const n=this.times.get(t),r=n?.arrival??nt();return this.lerp.push(e,n?.t??r,s,r),s}takeDrawn(){const e=this.drawn;return this.drawn=0,e}tick(){const e=this.now();return e!==this.drawnAt&&(this.drawnAt=e,this.drawn++),e}resolve(e,t){return ga(t)?t:Qe(e-1)}};function Pa(e,t){const a=typeof e.getTransform=="function"?e.getTransform():null,o=a&&Math.hypot(a.a,a.b)||1,s=a&&Math.hypot(a.c,a.d)||1,n=(e.canvas?.width??0)/o,r=(e.canvas?.height??0)/s;return t?{x:t.x*n,y:t.y*r,w:t.w*n,h:t.h*r}:{x:0,y:0,w:n,h:r}}var lt=e=>e===!1?1:typeof e=="number"?Math.min(Math.max(e,.05),1):.5;function it(e,t){return(a,o,s,n,r={})=>{const h=Array.isArray(o)?null:o,i=h?h.body:o;if(!Array.isArray(i))return null;const f=typeof s=="string"?s:e.of(typeof s=="number"?s:h??1),l=typeof s=="number"?s:h?.id,u=l!==void 0?e.posed(l,i,lt(r.smooth),r.interpolate!==!1):i;return Ea(a,u,f,n??Pa(a,t().view),r.alpha!==void 0?{alpha:r.alpha}:{})?u:null}}function Oa(e){const t=new Map,a=(i,f)=>t.get(i)?.forEach(l=>l(f));let o=null;const s=[],n=i=>o?i(o):s.push(i),r=new rt,h=it(r,()=>({view:null}));return e.then(i=>{o=i;const f=new Map;i.on("gesture",l=>a(l.gesture,{player:l.player})),i.on("pause",l=>a("pause",{reason:l.reason==="distance"?"distance":"user"})),i.on("resume",()=>a("resume",{})),i.on("break-start",()=>a("break-start",{})),i.on("break-done",l=>a("break-end",{shown:l.shown})),i.onBackdrop((l,u)=>a("backdrop",{backdrop:l,view:u})),i.on("frame",l=>{a("players",{players:l.players});for(const u of l.players)a("hands",{player:u.id,left:u.leftHand,right:u.rightHand}),f.get(u.id)!==u.shape&&(f.set(u.id,u.shape),a("shape",{player:u.id,shape:u.shape}))}),a("start",ct(i)),s.splice(0).forEach(l=>l(i))}),{on(i,f){const l=t.get(i)??new Set;return t.set(i,l),l.add(f),i==="start"&&o&&f(ct(o)),()=>{l.delete(f)}},ready:()=>n(i=>i.ready()),score:(i,f=1)=>n(l=>l.score(f,i)),break:i=>new Promise(f=>n(l=>{l.break(i).then(f)})),end:i=>n(f=>f.end(typeof i=="number"?[{player:1,score:i,stars:2}]:i.map(l=>({player:l.player,score:l.score,stars:l.stars??2})))),keys:(i,f)=>n(l=>{zt(l,i,f)}),pointer:i=>n(f=>{Ot(f,i)}),get view(){return o?.view??null},get device(){return o?.device??null},reportStats:i=>o?.reportStats(i),toScreen:i=>o?o.toScreen(i):He(null,i),avatarOf:i=>o?o.avatarOf(i):r.of(i),drawAvatar:(...i)=>o?o.drawAvatar(...i):h(...i),smoothedBody:(...i)=>o?o.smoothedBody(...i):r.smoothedBody(...i)}}var ct=e=>({ageRange:e.ageRange,players:e.players,locale:e.locale,mode:e.mode,backdrop:e.backdrop,view:e.view,device:e.device}),La=(e=window)=>({post:t=>e.parent.postMessage(t,"*"),listen:t=>e.addEventListener("message",a=>a.source===e.parent&&t(a.data))}),_a=1e4,Da=1e3;function Na(e=La()){return new Promise((t,a)=>{const o=new Map,s=[];let n=!1,r="none",h=null;const i=new Set,f=new rt,l=it(f,()=>({view:h})),u=f.smoothedBody,c=setTimeout(()=>a(new Error("Fabi Play: no host, is the game opened from Fabi Play?")),_a);e.listen(x=>{if(typeof x!="object"||x===null||x.ns!==Be)return;const d=x;if(d.type==="init"&&!n){if(d.v!==Ne)return clearTimeout(c),a(new Error(`Fabi Play: protocol ${d.v}, this SDK speaks ${Ne}`));n=!0,clearTimeout(c),r=d.backdrop==="video"?"video":"none",h=Fe(d.view)??null;const b=It(d.device)??null;let y={};if(d.stats===!0){let k=performance.now();setInterval(()=>{const z=performance.now();e.post(ne({type:"stats",renderFps:Math.round(f.takeDrawn()*1e3/Math.max(z-k,1)),...y})),k=z},Da).unref?.()}t({locale:d.locale,mode:d.mode,players:d.players,muted:d.muted,ageRange:d.ageRange??"6-8",get backdrop(){return r},get view(){return h},device:b,reportStats:k=>{y=Rt(k)},toScreen:k=>He(h,k),avatarOf:k=>f.of(k),drawAvatar:l,smoothedBody:u,onBackdrop(k){return i.add(k),()=>{i.delete(k)}},on(k,g){const z=o.get(k)??new Set;return o.set(k,z),z.add(g),()=>{z.delete(g)}},ready:()=>e.post(ne({type:"ready"})),score:(k,g)=>e.post(ne({type:"score",player:k,score:g})),break:(k="level")=>new Promise(g=>{s.push(g),e.post(ne({type:"break",reason:k}))}),end:k=>e.post(ne({type:"end",scores:k}))})}else if(n){let b=d;if(d.type==="frame"&&Array.isArray(d.players)&&f.note(d.players,d.t),d.type==="backdrop"){if(d.backdrop!=="video"&&d.backdrop!=="none")return;const y=Fe(d.view)??null;if(d.backdrop===r&&Ia(y,h))return;r=d.backdrop,h=y,b={type:"backdrop",backdrop:r,...h?{view:h}:{}};for(const k of[...i])k(r,h)}for(const y of o.get(d.type)??[])y(b);d.type==="break-done"&&s.shift()?.(d.shown)}else return})})}var Ia=(e,t)=>e===t||e!==null&&t!==null&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,ft={};Oe(ft,{BAND_BODY:()=>V,DEFAULT_AVATAR:()=>at,avatarById:()=>va,avatarShapes:()=>Ce,drawShapes:()=>ve,frameOf:()=>Ae,iconShapes:()=>Ma});function Ra(e){const t=Na(),a=Oa(t);e?.dataset.mute!=="manual"&&Et(t);const o=Object.assign(a,{avatars:{...ft}});window.FabiPlay=o;const s=e?.dataset.keys;s&&a.keys(At(s));const n=e?.dataset.pointer;return n&&a.pointer({hand:n==="left"||n==="right"?n:"any"}),e?.dataset.ready!=="manual"&&(document.readyState==="complete"?a.ready():window.addEventListener("load",()=>a.ready(),{once:!0})),o}return G.exports.install(we)});
1
+ /*! @fabi-play/sdk 0.2.0 | Fabi Play Kit License | https://docs.fabiplay.app */(function(we,G){var de=typeof document<"u"?document.currentScript:null;typeof define=="function"&&define.amd?define([],function(){return G(de)}):typeof module=="object"&&module&&module.exports?module.exports=G(de):we.FabiPlay=G(de)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(we){"use strict";var G={exports:{}},de=G.exports,pe=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,xt=Object.getOwnPropertyNames,mt=Object.prototype.hasOwnProperty,wt=(e,t,a)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Oe=(e,t)=>{for(var a in t)pe(e,a,{get:t[a],enumerable:!0})},gt=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xt(t))!mt.call(e,s)&&s!==a&&pe(e,s,{get:()=>t[s],enumerable:!(o=kt(t,s))||o.enumerable});return e},vt=e=>gt(pe({},"__esModule",{value:!0}),e),D=(e,t,a)=>wt(e,typeof t!="symbol"?t+"":t,a),Le={};Oe(Le,{install:()=>Ra}),G.exports=vt(Le);function Et(e,t=window){const a=new Set,o=t.AudioContext;o&&(t.AudioContext=class extends o{constructor(...r){super(...r),a.add(this)}});let s=[],n=[];Promise.resolve(e).then(r=>{r.on("break-start",()=>{s=[...t.document.querySelectorAll("audio, video")].filter(h=>!h.paused),s.forEach(h=>h.pause()),n=[...a].filter(h=>h.state==="running"),n.forEach(h=>{h.suspend()})}),r.on("break-done",()=>{s.forEach(h=>{h.play().catch(()=>{})}),n.forEach(h=>{h.resume()}),s=[],n=[]})})}var Mt={jump:"Space",squat:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",clap:"Enter"};function At(e){if(e.trim()==="default")return;const t={};for(const a of e.split(",")){const[o,s]=a.split(":").map(n=>n.trim());o&&s&&(t[o]=s)}return t}var Ct={Space:[" ",32],Enter:["Enter",13],Escape:["Escape",27],ShiftLeft:["Shift",16],ArrowLeft:["ArrowLeft",37],ArrowUp:["ArrowUp",38],ArrowRight:["ArrowRight",39],ArrowDown:["ArrowDown",40]};function _e(e){const t=Ct[e];if(t)return{key:t[0],code:e,keyCode:t[1]};const a=/^Key([A-Z])$/.exec(e);if(a)return{key:a[1].toLowerCase(),code:e,keyCode:a[1].charCodeAt(0)};const o=/^Digit([0-9])$/.exec(e);if(o)return{key:o[1],code:e,keyCode:48+Number(o[1])};throw new Error(`Fabi Play: unknown key "${e}" (use Space, Enter, Arrow\u2026, KeyA\u2026, Digit0\u2026)`)}var St=(e=document)=>({dispatch(t,a){const o=new KeyboardEvent(t,{key:a.key,code:a.code,bubbles:!0,cancelable:!0});for(const s of["keyCode","which"])Object.defineProperty(o,s,{get:()=>a.keyCode});(e.activeElement??e.body??e).dispatchEvent(o)}}),De=80,Tt=800;function zt(e,t=Mt,a={}){const o=a.player??1,s=a.target??St(),n=a.setTimeout??((d,b)=>setTimeout(d,b)),r=new Set;let h=0;const i=d=>{const b=t[d];!b||r.has(d)||(r.add(d),s.dispatch("keydown",_e(b)))},f=d=>{const b=t[d];!b||!r.has(d)||(r.delete(d),s.dispatch("keyup",_e(b)))},l=d=>{i(d),n(()=>f(d),De)},u=d=>{if(d.player!==o)return;const b={"lane-left":-1,"lane-center":0,"lane-right":1};switch(d.gesture){case"jump":i("jump"),n(()=>f("jump"),Tt);break;case"land":f("jump");break;case"squat":i("squat");break;case"stand":f("squat");break;case"clap":l("clap");break;default:{const y=b[d.gesture];if(y===void 0)break;const k=y>h?"right":"left";for(let g=0;g<Math.abs(y-h);g++)n(()=>l(k),g*(De*2));h=y}}},c=d=>{const b=d.players.find(y=>y.id===o);b&&(b.shape==="arms-up"?i("arms-up"):f("arms-up"))},x=[e.on("gesture",u),e.on("frame",c),e.on("break-start",()=>[...r].forEach(f))];return()=>{x.forEach(d=>d()),[...r].forEach(f)}}function Pt(e=document){const t=e.createElement("div");t.setAttribute("aria-hidden","true"),t.style.cssText="position:fixed;left:0;top:0;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;border:6px solid #FBE7B8;background:rgba(251,231,184,.25);pointer-events:none;z-index:2147483647;box-sizing:border-box;transition:transform 60ms linear",e.body.appendChild(t);const a=(o,s,...n)=>{const r=e.elementFromPoint(o,s)??e.body;for(const h of n){const i={bubbles:!0,cancelable:!0,clientX:o,clientY:s,pointerId:1,pointerType:"touch",isPrimary:!0};r.dispatchEvent(h.startsWith("pointer")?new PointerEvent(h,i):new MouseEvent(h,i))}};return{size:()=>({width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}),move:(o,s)=>a(o,s,"pointermove","mousemove"),click:(o,s)=>a(o,s,"pointerdown","mousedown","pointerup","mouseup","click"),cursor:(o,s,n)=>{t.style.transform=`translate(${o}px, ${s}px) scale(${1-n*.35})`,t.style.borderColor=n>0?"#EE6A43":"#FBE7B8"}}}function Ot(e,t={}){const a=t.player??1,o=t.hand??"any",s=t.dwellMs??800,n=t.radius??.04,r=t.target??Pt();let h=null,i=!1;return e.on("frame",f=>{const l=f.players.find(z=>z.id===a);if(!l)return;const c=o==="left"?l.leftHand:o==="right"?l.rightHand:((z,U)=>z&&U?z.y<U.y?z:U:z??U)(l.leftHand,l.rightHand);if(!c)return;const{width:x,height:d}=r.size(),b=c.x*x,y=c.y*d;r.move(b,y),(!h||Math.hypot(b-h.x,y-h.y)>n*Math.hypot(x,d))&&(h={x:b,y,t:f.t},i=!1);const g=i?0:Math.min((f.t-h.t)/s,1);g>=1&&(i=!0,r.click(h.x,h.y)),r.cursor(b,y,i?0:g)})}var Ne=1,Ie=33,T={nose:0,leftShoulder:11,rightShoulder:12,leftElbow:13,rightElbow:14,leftWrist:15,rightWrist:16,leftHip:23,rightHip:24,leftKnee:25,rightKnee:26,leftAnkle:27,rightAnkle:28},Lt=["3-5","6-8","9-12"],_t=e=>Lt.includes(e),Dt=4,Re={"3-5":["bunny","bear","panda","penguin"],"6-8":["fox","lion","dragon","unicorn"],"9-12":["robot","astronaut","ninja","skater"]},Nt=Re["6-8"],Qe=(e,t)=>{const a=_t(t)?Re[t]:Nt;return a[Number.isInteger(e)&&e>=0?e%a.length:0]},Be="fabi-play",ne=e=>({ns:Be,...e});function Fe(e){if(!ge(e))return;const{x:t,y:a,w:o,h:s}=e;return te(t)&&te(a)&&te(o)&&te(s)&&o>0&&s>0?{x:t,y:a,w:o,h:s}:void 0}var He=(e,t)=>e?{x:e.x+t.x*e.w,y:e.y+t.y*e.h}:{x:t.x,y:t.y},je=["high","medium","low"];function It(e){if(!ge(e))return;const t={};return je.includes(e.tier)&&(t.tier=e.tier),te(e.hz)&&e.hz>=20&&e.hz<=240&&(t.hz=Math.round(e.hz)),t.tier||t.hz?t:void 0}function Rt(e){const t={};return ge(e)&&(te(e.fps)&&e.fps>=0&&e.fps<1e3&&(t.fps=e.fps),typeof e.renderer=="string"&&/^[a-z0-9-]{1,16}$/.test(e.renderer)&&(t.renderer=e.renderer),je.includes(e.tier)&&(t.tier=e.tier)),t}var ge=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),te=e=>typeof e=="number"&&Number.isFinite(e),Qt=12,Bt=Ie*4,Ft=e=>Qt+e*Bt,Ha=Ft(Dt),B="#4a382c",R="#2b2118",j="#1c1f2b",Ue="#fbefe3",$="#f4897a",re="#3a2a22",$e=[{id:"fox",name:{en:"Fox",it:"Volpe"},band:"6-8",palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ue,accent:"#ffd9c2",outline:R,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"dot",mouth:"cat",nose:re,muzzle:"cheeks"},tail:"fluffy",headExtras:[],bodyExtras:[]},{id:"mascot",name:{en:"Fabi",it:"Fabi"},band:"all",special:!0,palette:{body:"#ee6a43",limbs:"#ee6a43",belly:Ue,accent:"#5a3426",outline:R,hands:"#5a3426",feet:"#5a3426"},head:"wide",ears:"pointy",face:{eyes:"bead",mouth:"open",nose:re,muzzle:"band",cheeks:$},tail:"brush",headExtras:[],bodyExtras:["star"],extraColors:["#ffd84a"]},{id:"bunny",name:{en:"Bunny",it:"Coniglietto"},band:"3-5",palette:{body:"#f9d0de",limbs:"#f9d0de",belly:"#fff6f8",accent:"#f4a0b9",outline:B},head:"round",ears:"long",face:{eyes:"dot",mouth:"cat",nose:"#e0607e",muzzle:"none",cheeks:$},tail:"pom",headExtras:[],bodyExtras:[]},{id:"bear",name:{en:"Bear",it:"Orsetto"},band:"3-5",palette:{body:"#cf9f78",limbs:"#cf9f78",belly:"#f7e0bf",accent:"#f7e0bf",outline:B},head:"round",ears:"round",face:{eyes:"dot",mouth:"smile",nose:re,muzzle:"oval",cheeks:$},tail:"none",headExtras:[],bodyExtras:[]},{id:"cat",name:{en:"Cat",it:"Gattino"},band:"3-5",palette:{body:"#c8b6ee",limbs:"#c8b6ee",belly:"#f4eeff",accent:"#f7b3c8",outline:B,hands:"#f4eeff",feet:"#f4eeff"},head:"wide",ears:"pointy",face:{eyes:"big",eyeColor:"#3f9a5a",mouth:"cat",nose:"#f07a9a",muzzle:"none",cheeks:$},tail:"long",headExtras:["whiskers"],bodyExtras:[]},{id:"panda",name:{en:"Panda",it:"Panda"},band:"3-5",palette:{body:"#ffffff",limbs:"#6e6674",belly:"#ffffff",accent:"#6e6674",outline:B,ears:"#6e6674"},head:"wide",ears:"round",face:{eyes:"mask",mouth:"smile",nose:"#2f2a2c",muzzle:"none",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:[]},{id:"penguin",name:{en:"Penguin",it:"Pinguino"},band:"3-5",palette:{body:"#6c8fca",limbs:"#6c8fca",belly:"#ffffff",accent:"#f9b95c",outline:B,feet:"#f9b95c"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"heart",cheeks:"#f6a3a3"},tail:"none",headExtras:[],bodyExtras:["flippers","scarf"],extraColors:["#f6907a"]},{id:"frog",name:{en:"Frog",it:"Ranocchio"},band:"3-5",palette:{body:"#8fd487",limbs:"#8fd487",belly:"#e6f7cc",accent:"#62ad62",outline:B},head:"wide",ears:"none",face:{eyes:"big",eyesOnTop:!0,mouth:"open",muzzle:"none",cheeks:"#f59b8f"},tail:"none",headExtras:[],bodyExtras:["flippers","spots"],extraColors:["#62ad62","#b0e6a4"]},{id:"lion",name:{en:"Lion",it:"Leoncino"},band:"6-8",palette:{body:"#f6c454",limbs:"#f6c454",belly:"#fde7b0",accent:"#fde7b0",outline:R},head:"round",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#8a4b2a",muzzle:"oval",cheeks:$},tail:"tuft",headExtras:["mane"],bodyExtras:[],extraColors:["#c8692e"]},{id:"unicorn",name:{en:"Unicorn",it:"Unicorno"},band:"6-8",palette:{body:"#fbf5ff",limbs:"#fbf5ff",belly:"#efe0ff",accent:"#fbd46a",outline:R,hands:"#c9a6f2",feet:"#c9a6f2"},head:"tall",ears:"unicorn",face:{eyes:"dot",mouth:"smile",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["rainbow-mane"],bodyExtras:[],extraColors:["#f58cc0","#8fd3f4","#a98ff2"]},{id:"dragon",name:{en:"Little Dragon",it:"Draghetto"},band:"6-8",palette:{body:"#8a63d2",limbs:"#8a63d2",belly:"#fbd46a",accent:"#5fd0b5",outline:R},head:"wide",ears:"horns",face:{eyes:"big",eyeColor:"#3a2a6a",mouth:"teeth",muzzle:"none",cheeks:"#f59bc0"},tail:"arrow",headExtras:[],bodyExtras:["wings"]},{id:"robot",name:{en:"Robot",it:"Robot"},band:"9-12",palette:{body:"#b9c7d2",limbs:"#8b9aa6",belly:"#b9c7d2",accent:"#ee6a43",outline:j,hands:"#ee6a43",feet:"#6b7a86"},head:"square",ears:"antenna",face:{eyes:"screen",eyeColor:"#7ff0ff",mouth:"grill",muzzle:"none"},tail:"none",headExtras:["bolts"],bodyExtras:["panel","joints","boots"],extraColors:["#ff7a6b","#fbd46a","#7ff0ff"]},{id:"astronaut",name:{en:"Astronaut",it:"Astronauta"},band:"9-12",palette:{body:"#f4f1ec",limbs:"#f4f1ec",belly:"#f4f1ec",accent:"#ee6a43",outline:j,hands:"#9fb0bd",feet:"#9fb0bd"},head:"round",ears:"none",face:{eyes:"visor",mouth:"smile",muzzle:"none"},tail:"none",headExtras:["helmet"],bodyExtras:["backpack","badge","boots"],extraColors:["#c9d3db"]},{id:"dinosaur",name:{en:"Dinosaur",it:"Dinosauro"},band:"6-8",palette:{body:"#3fb3a6",limbs:"#3fb3a6",belly:"#c9f0d6",accent:"#f79a3e",outline:R},head:"wide",ears:"none",face:{eyes:"dot",mouth:"teeth",muzzle:"none",cheeks:"#f59b8f"},tail:"spiky",headExtras:["spikes","spots"],bodyExtras:[],extraColors:["#2b8f84","#7fd3c6"]},{id:"monkey",name:{en:"Monkey",it:"Scimmietta"},band:"6-8",palette:{body:"#7b5234",limbs:"#7b5234",belly:"#f2c9a0",accent:"#f2c9a0",outline:R,hands:"#f2c9a0",feet:"#f2c9a0"},head:"round",ears:"side",face:{eyes:"dot",mouth:"open",nose:"#5a3a26",muzzle:"monkey",cheeks:$},tail:"curl",headExtras:["tuft"],bodyExtras:[]},{id:"koala",name:{en:"Koala",it:"Koala"},band:"3-5",palette:{body:"#b7bcc6",limbs:"#b7bcc6",belly:"#eef0f3",accent:"#f4dbe2",outline:B},head:"wide",ears:"big-round",face:{eyes:"dot",mouth:"smile",nose:"#3b3438",muzzle:"none",cheeks:"#f4a3b0"},tail:"none",headExtras:[],bodyExtras:[]},{id:"tiger",name:{en:"Tiger",it:"Tigrotto"},band:"6-8",palette:{body:"#f9a33a",limbs:"#f9a33a",belly:"#fff1dc",accent:"#fff1dc",outline:R},head:"wide",ears:"round",face:{eyes:"dot",mouth:"cat",nose:"#e2607a",muzzle:"oval",cheeks:$},tail:"striped",headExtras:["stripes","whiskers"],bodyExtras:[],extraColors:["#3a2a22"]},{id:"owl",name:{en:"Owl",it:"Gufetto"},band:"3-5",palette:{body:"#8ec0e6",limbs:"#8ec0e6",belly:"#e3f2fc",accent:"#639cc9",outline:B,feet:"#f9b95c",hands:"#639cc9"},head:"tall",ears:"tufts",face:{eyes:"big",eyeColor:B,eyeRing:"#fde08a",mouth:"beak",muzzle:"none",cheeks:"#f6a8b4"},tail:"none",headExtras:[],bodyExtras:["feathers"]},{id:"alien",name:{en:"Alien",it:"Alieno"},band:"9-12",palette:{body:"#9ee05a",limbs:"#9ee05a",belly:"#d8f5a8",accent:"#b07cf2",outline:j},head:"bulb",ears:"antennae",face:{eyes:"almond",eyeColor:"#1e1838",mouth:"smirk",muzzle:"none"},tail:"none",headExtras:[],bodyExtras:["spots"],extraColors:["#7cc23e","#7cc23e"]},{id:"ghost",name:{en:"Friendly Ghost",it:"Fantasmino"},band:"6-8",palette:{body:"#e6f4ff",limbs:"#e6f4ff",belly:"#e6f4ff",accent:"#bcd9f2",outline:R},head:"round",ears:"none",face:{eyes:"dot",mouth:"open",muzzle:"none",cheeks:"#f7a6c8"},tail:"none",headExtras:["curl"],bodyExtras:["sheet"]},{id:"octopus",name:{en:"Octopus",it:"Polpetto"},band:"6-8",palette:{body:"#e0578a",limbs:"#e0578a",belly:"#f7b3cc",accent:"#f7b3cc",outline:R,hands:"#f7b3cc",feet:"#f7b3cc"},head:"tall",ears:"none",face:{eyes:"big",eyeColor:"#3a2140",mouth:"smile",muzzle:"none",cheeks:"#ffd0a0"},tail:"none",headExtras:["spots"],bodyExtras:["tentacles"],extraColors:["#f7b3cc","#f7b3cc"]},{id:"chick",name:{en:"Chick",it:"Pulcino"},band:"3-5",palette:{body:"#ffd45e",limbs:"#ffd45e",belly:"#fff2c2",accent:"#ffa04a",outline:B,hands:"#ffc23d",feet:"#ffa04a"},head:"round",ears:"none",face:{eyes:"dot",mouth:"beak",muzzle:"none",cheeks:$},tail:"none",headExtras:["eggshell"],bodyExtras:[],extraColors:["#fffaf0"]},{id:"puppy",name:{en:"Puppy",it:"Cucciolo"},band:"3-5",palette:{body:"#f4e4cf",limbs:"#f4e4cf",belly:"#fffaf2",accent:"#f29aa4",outline:B,ears:"#b58262",hands:"#e6caa6",feet:"#e6caa6"},head:"wide",ears:"floppy",face:{eyes:"dot",mouth:"open",nose:re,muzzle:"oval",cheeks:$},tail:"curl",headExtras:["eye-spot"],bodyExtras:[]},{id:"lamb",name:{en:"Lamb",it:"Agnellino"},band:"3-5",palette:{body:"#fdf8ee",limbs:"#e3d1c2",belly:"#fffdf8",accent:"#f6bcc2",outline:B,skin:"#f7dccb",hands:"#a58c7e",feet:"#a58c7e"},head:"round",ears:"droopy",face:{eyes:"dot",mouth:"smile",nose:"#e591a0",muzzle:"none",cheeks:$},tail:"pom",headExtras:["wool"],bodyExtras:["wool"]},{id:"duckling",name:{en:"Duckling",it:"Anatroccolo"},band:"3-5",palette:{body:"#fff1a6",limbs:"#fff1a6",belly:"#fffbe0",accent:"#ff9f43",outline:B,feet:"#ff9f43"},head:"tall",ears:"none",face:{eyes:"dot",mouth:"bill",muzzle:"none",cheeks:$},tail:"none",headExtras:["curl"],bodyExtras:["flippers","scarf"],extraColors:["#86cfe0"]},{id:"shark",name:{en:"Shark",it:"Squalo"},band:"6-8",palette:{body:"#6c95c4",limbs:"#6c95c4",belly:"#eef5fb",accent:"#4c76a8",outline:R,hands:"#eef5fb",feet:"#4c76a8"},head:"wide",ears:"fin",face:{eyes:"dot",mouth:"jaws",muzzle:"none",cheeks:"#f59bb0"},tail:"fish",headExtras:["gills"],bodyExtras:[]},{id:"wolf",name:{en:"Wolf",it:"Lupo"},band:"6-8",palette:{body:"#8f9bb3",limbs:"#8f9bb3",belly:"#eef1f6",accent:"#f3b8c4",outline:R,hands:"#5a647a",feet:"#5a647a"},head:"round",ears:"pointy",face:{eyes:"dot",mouth:"open",nose:re,muzzle:"oval",cheeks:"#f4a3b0"},tail:"fluffy",headExtras:["ruff","forehead"],bodyExtras:[],extraColors:["#636d84"]},{id:"parrot",name:{en:"Parrot",it:"Pappagallo"},band:"6-8",palette:{body:"#e8503f",limbs:"#e8503f",belly:"#ffd25a",accent:"#f6e6c4",outline:R,hands:"#3a9bdc",feet:"#8a7a70"},head:"round",ears:"none",face:{eyes:"big",eyeColor:R,eyeRing:"#ffffff",mouth:"hook",muzzle:"none",cheeks:"#ffb0a0"},tail:"plume",headExtras:["crest"],bodyExtras:["feathers"],extraColors:["#ffd25a","#3fae5a","#3a9bdc"]},{id:"ninja",name:{en:"Ninja",it:"Ninja"},band:"9-12",palette:{body:"#2f3a56",limbs:"#2f3a56",belly:"#2f3a56",accent:"#36c9bb",outline:j,skin:"#b07a52",hands:"#222a40",feet:"#222a40"},head:"round",ears:"none",face:{eyes:"calm",mouth:"none",muzzle:"none",brows:"#2a1d16"},tail:"none",headExtras:["ninja-hood"],bodyExtras:["belt"],extraColors:["#36c9bb","#36c9bb","#36c9bb"]},{id:"skater",name:{en:"Skater",it:"Skater"},band:"9-12",palette:{body:"#3a8fc0",limbs:"#2c3e57",belly:"#2f7aa6",accent:"#ffcf3a",outline:j,skin:"#f2c9a5",hair:"#7a4a2a",hands:"#f2c9a5",feet:"#eef1f5"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#5a3520"},tail:"none",headExtras:["hair","cap"],bodyExtras:["pocket","joints"],extraColors:["#ff5d73"]},{id:"explorer",name:{en:"Explorer",it:"Giramondo"},band:"9-12",palette:{body:"#5f8f5b",limbs:"#5f8f5b",belly:"#5f8f5b",accent:"#d9bb7e",outline:j,skin:"#7a4a30",hair:"#1d1410",hands:"#7a4a30",feet:"#6b4a2a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#1d1410"},tail:"none",headExtras:["curls","safari-hat"],bodyExtras:["backpack","straps","boots"],extraColors:["#e07b39","#6b4a2a"]},{id:"wizard",name:{en:"Wizard",it:"Mago"},band:"9-12",palette:{body:"#5b3fa0",limbs:"#5b3fa0",belly:"#5b3fa0",accent:"#3d5fc8",outline:j,skin:"#c98d62",hair:"#a8452a",hands:"#c98d62",feet:"#33255e"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#7a301c"},tail:"none",headExtras:["locks","wizard-hat"],bodyExtras:["robe","belt"],extraColors:["#ffd84a","#ffd84a","#ffd84a"]},{id:"knight",name:{en:"Knight",it:"Cavaliere"},band:"9-12",palette:{body:"#bcc7d3",limbs:"#8e9aa8",belly:"#dce3ea",accent:"#d8443a",outline:j,hands:"#6c7786",feet:"#6c7786"},head:"bucket",ears:"none",face:{eyes:"slit",eyeColor:"#bfefff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["plume"],bodyExtras:["pauldrons","emblem","boots"],extraColors:["#d8443a"]},{id:"racer",name:{en:"Racer",it:"Pilota"},band:"9-12",palette:{body:"#ff6a2b",limbs:"#ff6a2b",belly:"#ffffff",accent:"#ffffff",outline:j,hands:"#232838",feet:"#232838"},head:"round",ears:"none",face:{eyes:"goggle",eyeColor:"#7fd6ff",mouth:"none",muzzle:"none"},tail:"none",headExtras:["stripe"],bodyExtras:["racing-stripe","boots"]},{id:"pirate",name:{en:"Pirate",it:"Pirata"},band:"9-12",palette:{body:"#f2efe6",limbs:"#2a3d6e",belly:"#f2efe6",accent:"#d94545",outline:j,skin:"#d9a072",hair:"#2b1a12",hands:"#d9a072",feet:"#3a2a20"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#2b1a12"},tail:"none",headExtras:["locks","bandana","eye-patch"],bodyExtras:["stripes","belt","boots"],extraColors:["#d94545","#2a3d6e","#4a3426"]},{id:"diver",name:{en:"Diver",it:"Sub"},band:"9-12",palette:{body:"#1f6582",limbs:"#1f6582",belly:"#1f6582",accent:"#ffb020",outline:j,skin:"#e8b48a",hair:"#c98f2e",hands:"#1b4f66",feet:"#ffb020"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smile",muzzle:"none",brows:"#8a5a1a"},tail:"none",headExtras:["curls","dive-mask"],bodyExtras:["tank","fins"],extraColors:["#c9d3db"]},{id:"hero",name:{en:"Hero",it:"Supereroe"},band:"9-12",palette:{body:"#3557c8",limbs:"#3557c8",belly:"#3557c8",accent:"#e0403a",outline:j,skin:"#5a3825",hair:"#141010",hands:"#e0403a",feet:"#e0403a"},head:"round",ears:"human",face:{eyes:"calm",mouth:"smirk",muzzle:"none",brows:"#141010"},tail:"none",headExtras:["hair","domino"],bodyExtras:["cape","emblem","boots"],extraColors:["#ffd84a"]}],L={M:0,L:1,Q:2,C:3,Z:4},qe=[2,2,4,6,0];function ve(e,t){for(const a of t)Ht(e,a)}function Ht(e,t){if(t.k==="group"){e.save(),e.translate(t.x,t.y),t.rot&&e.rotate(t.rot),t.s!==void 0&&t.s!==1&&e.scale(t.s,t.s),t.alpha!==void 0&&(e.globalAlpha*=t.alpha),ve(e,t.items),e.restore();return}switch(e.save(),t.alpha!==void 0&&(e.globalAlpha*=t.alpha),e.beginPath(),t.k){case"circle":e.arc(t.x,t.y,Math.max(t.r,0),0,Math.PI*2);break;case"ellipse":e.ellipse(t.x,t.y,Math.max(t.rx,0),Math.max(t.ry,0),t.rot??0,0,Math.PI*2);break;case"rect":jt(e,t);break;case"path":typeof t.d=="string"?qt(e,t.d):Ut(e,t.d);break;case"line":e.moveTo(t.pts[0]??0,t.pts[1]??0);for(let a=2;a+1<t.pts.length;a+=2)e.lineTo(t.pts[a],t.pts[a+1]);break}e.lineCap="round",e.lineJoin="round",t.fill&&t.k!=="line"&&(e.fillStyle=t.fill,e.fill()),t.stroke&&(t.lw??1)>0&&(e.strokeStyle=t.stroke,e.lineWidth=t.lw??1,e.stroke()),e.restore()}function jt(e,t){const a=Math.max(0,Math.min(t.r,t.w/2,t.h/2));e.translate(t.x,t.y),t.rot&&e.rotate(t.rot);const o=-t.w/2,s=-t.h/2;e.moveTo(o+a,s),e.lineTo(o+t.w-a,s),e.quadraticCurveTo(o+t.w,s,o+t.w,s+a),e.lineTo(o+t.w,s+t.h-a),e.quadraticCurveTo(o+t.w,s+t.h,o+t.w-a,s+t.h),e.lineTo(o+a,s+t.h),e.quadraticCurveTo(o,s+t.h,o,s+t.h-a),e.lineTo(o,s+a),e.quadraticCurveTo(o,s,o+a,s),e.closePath()}function Ut(e,t){for(let a=0;a<t.length;){const o=t[a++];if(o===L.M)e.moveTo(t[a],t[a+1]);else if(o===L.L)e.lineTo(t[a],t[a+1]);else if(o===L.Q)e.quadraticCurveTo(t[a],t[a+1],t[a+2],t[a+3]);else if(o===L.C)e.bezierCurveTo(t[a],t[a+1],t[a+2],t[a+3],t[a+4],t[a+5]);else if(o===L.Z)e.closePath();else return;a+=qe[o]}}function $t(e){if(typeof e=="string")return(e.match(/-?\d*\.?\d+(?:e-?\d+)?/gi)??[]).map(Number);const t=[];for(let a=0;a<e.length;){const o=qe[e[a++]];if(o===void 0)break;for(let s=0;s<o;s++)t.push(e[a+s]);a+=o}return t}function qt(e,t){const a=t.match(/[MLQCZ]|-?\d*\.?\d+(?:e-?\d+)?/gi)??[];let o="",s=0;const n=()=>Number(a[s++]);for(;s<a.length;){const r=a[s];if(/[MLQCZ]/i.test(r)&&(o=r.toUpperCase(),s++,o==="Z")){e.closePath();continue}o==="M"?(e.moveTo(n(),n()),o="L"):o==="L"?e.lineTo(n(),n()):o==="Q"?e.quadraticCurveTo(n(),n(),n(),n()):o==="C"?e.bezierCurveTo(n(),n(),n(),n(),n(),n()):s++}}var A=e=>{const t=Math.round(e*100)/100;return t===0?0:t};function O(e,t=.5){const a=e.length;if(a<3)return[];const o=(h,i,f)=>({x:h.x+(i.x-h.x)*f,y:h.y+(i.y-h.y)*f}),s=Math.min(Math.max(t,0),.5),n=o(e[0],e[1],s),r=[L.M,A(n.x),A(n.y)];for(let h=1;h<=a;h++){const i=e[(h-1)%a],f=e[h%a],l=e[(h+1)%a],u=o(i,f,1-s),c=o(f,l,s);r.push(L.L,A(u.x),A(u.y),L.Q,A(f.x),A(f.y),A(c.x),A(c.y))}return r.push(L.Z),r}function P(e,t=1){const a=e.length;if(a<3)return[];const o=[L.M,A(e[0].x),A(e[0].y)],s=t/6;for(let n=0;n<a;n++){const r=e[(n-1+a)%a],h=e[n],i=e[(n+1)%a],f=e[(n+2)%a];o.push(L.C,A(h.x+(i.x-r.x)*s),A(h.y+(i.y-r.y)*s),A(i.x-(f.x-h.x)*s),A(i.y-(f.y-h.y)*s),A(i.x),A(i.y))}return o.push(L.Z),o}function le(e){const t=e.length;if(t<2)return[];const a=[L.M,A(e[0].x),A(e[0].y)];for(let o=0;o<t-1;o++){const s=e[Math.max(o-1,0)],n=e[o],r=e[o+1],h=e[Math.min(o+2,t-1)];a.push(L.C,A(n.x+(r.x-s.x)/6),A(n.y+(r.y-s.y)/6),A(r.x-(h.x-n.x)/6),A(r.y-(h.y-n.y)/6),A(r.x),A(r.y))}return a}var ye="M0 -1 L0.29 -0.4 L0.95 -0.31 L0.47 0.15 L0.59 0.81 L0 0.5 L-0.59 0.81 L-0.47 0.15 L-0.95 -0.31 L-0.29 -0.4 Z",N="#ffffff",v=[-1,1],Ye="#3a2420",Yt="#f2808f",Ee="#26324a",Zt="#ffd84a",Q=(...e)=>{const t=[];for(let a=0;a+1<e.length;a+=2)t.push({x:e[a],y:e[a+1]});return t};function Ze(e,t){const a=e.palette,o=[],s={stroke:a.outline,lw:t},n=l=>e.headExtras.includes(l),r=(l,u)=>e.extraColors?.[l]??u;if(n("mane")){for(let u=0;u<12;u++){const c=u/12*Math.PI*2;o.push({k:"circle",x:Math.cos(c)*1.02,y:Math.sin(c)*1+.04,r:.42,fill:r(0,a.accent),...s})}o.push({k:"circle",x:0,y:.04,r:1.08,fill:r(0,a.accent)})}if(n("rainbow-mane")){const l=e.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];[[.98,.05,.3,.5,-.25],[.92,.58,.26,.42,-.1],[.62,.92,.22,.32,.4]].forEach(([c,x,d,b,y],k)=>o.push({k:"ellipse",x:c,y:x,rx:d,ry:b,rot:y,fill:l[k%l.length],...s}))}if(n("spikes"))for(const l of[-.55,0,.55]){const u=ie(l,1.48),c=ie(l-.32,.86),x=ie(l+.32,.86);o.push({k:"path",d:O([c,u,x],.22),fill:a.accent,...s})}if(n("curl")&&o.push({k:"path",d:P([{x:-.2,y:-.9},{x:-.05,y:-1.3},{x:.32,y:-1.42},{x:.16,y:-1.18},{x:.2,y:-.9}]),fill:a.body,...s}),n("wool"))for(let l=0;l<=8;l++){const u=-1.75+l/8*3.5;o.push({k:"circle",x:Math.sin(u)*.98,y:-Math.cos(u)*.92-.04,r:.34,fill:a.body,...s})}if(n("crest")&&[-.38,0,.38].forEach((l,u)=>{const c=ie(l,1.12);o.push({k:"ellipse",x:c.x,y:c.y,rx:.15,ry:.42,rot:l,fill:r(u,a.accent),...s})}),n("plume")&&o.push({k:"path",d:P(Q(-.12,-.92,-.2,-1.42,.1,-1.78,.62,-1.74,.36,-1.46,.16,-.98)),fill:a.accent,...s}),n("locks")&&o.push({k:"path",d:P(Q(-1.14,.58,-1.24,-.2,-.86,-.98,0,-1.2,.86,-.98,1.24,-.2,1.14,.58,.8,.66,0,.2,-.8,.66)),fill:a.hair??a.outline,...s}),n("ninja-hood"))for(const[l,u]of[[.35,.5],[.85,.42]])o.push({k:"ellipse",x:1+Math.cos(l)*u*.8,y:-.5+Math.sin(l)*u*.8,rx:u,ry:.11,rot:l,fill:a.accent,...s});if(n("bandana"))for(const[l,u]of[[Math.PI-.5,.42],[Math.PI-1,.36]])o.push({k:"ellipse",x:-.98+Math.cos(l)*u*.8,y:-.36+Math.sin(l)*u*.8,rx:u,ry:.12,rot:l,fill:a.accent,...s});if(n("ruff"))for(const l of v)o.push({k:"path",d:O(Q(l*.7,-.3,l*1.32,0,l*1.02,.18,l*1.26,.46,l*.86,.56,l*.98,.84,l*.4,.7),.25),fill:a.body,...s});if(e.face.eyesOnTop)for(const l of v)o.push({k:"circle",x:l*.46,y:-.72,r:.38,fill:a.body,...s});o.push(...Gt(e,t)),o.push(Kt(e,s));const h=e.face.muzzle,i=a.belly;if(h==="oval"&&o.push({k:"ellipse",x:0,y:.4,rx:.46,ry:.32,fill:i}),h==="monkey"){for(const l of v)o.push({k:"circle",x:l*.32,y:-.04,r:.38,fill:i});o.push({k:"ellipse",x:0,y:.4,rx:.56,ry:.4,fill:i})}if(h==="heart"){for(const l of v)o.push({k:"circle",x:l*.36,y:.02,r:.5,fill:i});o.push({k:"ellipse",x:0,y:.38,rx:.66,ry:.48,fill:i})}if(h==="disc")for(const l of v)o.push({k:"circle",x:l*.4,y:.02,r:.44,fill:i});if(h==="cheeks")for(const l of v)o.push({k:"ellipse",x:l*.4,y:.44,rx:.44,ry:.32,fill:i});if(h==="band"&&o.push({k:"path",d:Xt(e,t),fill:i}),n("stripes")){const l=r(0,a.outline);o.push({k:"line",pts:[0,-.97,0,-.66],stroke:l,lw:.13});for(const u of v)o.push({k:"line",pts:[u*.3,-.93,u*.24,-.7],stroke:l,lw:.1}),o.push({k:"line",pts:[u*.98,-.05,u*.74,0],stroke:l,lw:.1}),o.push({k:"line",pts:[u*.94,.22,u*.74,.22],stroke:l,lw:.09})}if(n("spots")){const l=r(1,a.belly);o.push({k:"circle",x:-.55,y:-.5,r:.15,fill:l}),o.push({k:"circle",x:.58,y:-.42,r:.11,fill:l}),o.push({k:"circle",x:.22,y:-.76,r:.09,fill:l})}if(n("forehead")&&o.push({k:"path",d:P(Q(-.62,-.66,0,-.86,.62,-.66,.26,-.36,0,-.1,-.26,-.36),.9),fill:r(0,a.accent)}),n("eye-spot")&&o.push({k:"ellipse",x:.42,y:-.06,rx:.3,ry:.33,rot:.3,fill:a.ears??a.accent}),n("gills"))for(const l of v)for(const u of[0,.12,.24])o.push({k:"path",d:`M${l*(.66+u)} 0.06 Q${l*(.6+u)} 0.22 ${l*(.66+u)} 0.38`,stroke:a.accent,lw:t*.9});const f=a.hair??a.outline;if(n("hair")&&o.push({k:"path",d:P(Q(-1.02,-.06,-1.02,-.58,-.62,-1.04,.08,-1.14,.76,-.92,1.05,-.42,1,-.06,.84,-.4,.42,-.5,.06,-.4,-.34,-.56,-.74,-.38)),fill:f,...s}),n("locks")&&o.push({k:"path",d:P(Q(-1,-.08,-.98,-.62,-.56,-1.02,0,-1.1,.56,-1.02,.98,-.62,1,-.08,.8,-.38,.36,-.44,0,-.4,-.36,-.44,-.8,-.38)),fill:f,...s}),n("curls")){for(let l=0;l<7;l++){const u=ie(-1.3+l/6*2.6,.86);o.push({k:"circle",x:u.x,y:u.y,r:.3,fill:f,...s})}o.push({k:"ellipse",x:0,y:-.64,rx:.8,ry:.36,fill:f})}if(n("ninja-hood")&&(o.push({k:"rect",x:0,y:0,w:1.56,h:.6,r:.28,fill:a.skin??N,stroke:a.outline,lw:t*.8}),o.push({k:"path",d:"M-0.98 -0.42 Q0 -0.74 0.98 -0.42 L1.0 -0.62 Q0 -0.94 -1.0 -0.62 Z",fill:a.accent,...s})),n("domino")){o.push({k:"path",d:P(Q(-.86,-.04,-.62,-.3,-.18,-.24,0,-.16,.18,-.24,.62,-.3,.86,-.04,.6,.22,.16,.16,0,.1,-.16,.16,-.6,.22),.9),fill:a.accent,...s});for(const l of v)o.push({k:"ellipse",x:l*.38,y:0,rx:.19,ry:.13,fill:N})}if(o.push(...Vt(e,t)),n("brows"))for(const l of v)o.push({k:"line",pts:[l*.72,-.5,l*.14,-.3],stroke:a.accent,lw:.16});if(e.face.brows)for(const l of v)o.push({k:"line",pts:[l*.2,-.2,l*.54,-.28],stroke:e.face.brows,lw:.09});if(o.push(...Jt(e,t)),e.face.cheeks)for(const l of v)o.push({k:"ellipse",x:l*.64,y:.3,rx:.15,ry:.1,fill:e.face.cheeks,alpha:.8});if(n("whiskers"))for(const l of v)for(const u of[-.1,.06])o.push({k:"line",pts:[l*.62,.38+u,l*1.06,.3+u*2.2],stroke:a.outline,lw:t*.7,alpha:.75});if(n("rainbow-mane")){const l=e.extraColors??["#f59ac0","#fbd46a","#8fd3f4"];o.push({k:"ellipse",x:.42,y:-.82,rx:.34,ry:.22,rot:.5,fill:l[0],...s}),o.push({k:"ellipse",x:.1,y:-.92,rx:.3,ry:.2,rot:.25,fill:l[1%l.length],...s})}if(e.ears==="unicorn"){const l=[{x:-.18,y:-.84},{x:.02,y:-1.72},{x:.18,y:-.84}];o.push({k:"path",d:O(l,.12),fill:a.accent,...s});for(const u of[-1,-1.2,-1.4]){const c=.16*((u+1.72)/.88);o.push({k:"line",pts:[-c,u+.04,c,u-.04],stroke:a.outline,lw:t*.7,alpha:.6})}}if(n("helmet")){for(const l of v)o.push({k:"rect",x:l*1,y:.05,w:.26,h:.56,r:.12,fill:a.accent,...s});o.push({k:"path",d:"M-0.62 -0.62 Q-0.3 -0.92 0.12 -0.9",stroke:N,lw:.1,alpha:.9})}if(n("bolts"))for(const l of v)o.push({k:"rect",x:l*1.08,y:.08,w:.2,h:.44,r:.08,fill:a.accent,...s});if(n("tuft")&&o.push({k:"path",d:P([{x:-.26,y:-.95},{x:-.12,y:-1.22},{x:.02,y:-1.04},{x:.16,y:-1.28},{x:.28,y:-.95},{x:0,y:-.86}]),fill:a.body,...s}),n("eggshell")&&o.push({k:"path",d:"M-0.88 -0.5 C-0.88 -1.12 -0.46 -1.42 0 -1.42 C0.46 -1.42 0.88 -1.12 0.88 -0.5 L0.66 -0.66 L0.44 -0.48 L0.22 -0.66 L0 -0.48 L-0.22 -0.66 L-0.44 -0.48 L-0.66 -0.66 Z",fill:r(0,N),...s}),n("wool"))for(const[l,u]of[[-.36,-.84],[.02,-.94],[.4,-.82]])o.push({k:"circle",x:l,y:u,r:.27,fill:a.body,...s});if(n("stripe")&&o.push({k:"rect",x:0,y:-.64,w:.38,h:.62,r:.06,fill:a.accent}),n("eye-patch")&&(o.push({k:"line",pts:[-.97,-.5,.97,.13],stroke:a.outline,lw:.07}),o.push({k:"ellipse",x:.38,y:.02,rx:.21,ry:.19,fill:a.outline})),n("bandana")){o.push({k:"path",d:P(Q(-1.05,-.22,-.96,-.72,-.5,-1.08,.1,-1.14,.72,-.96,1.04,-.56,1.05,-.22,.5,-.46,-.5,-.46)),fill:a.accent,...s});for(const[l,u]of[[-.5,-.8],[.08,-.92],[.6,-.74],[-.12,-.62],[.36,-.6]])o.push({k:"circle",x:l,y:u,r:.06,fill:N,alpha:.85});o.push({k:"circle",x:-.98,y:-.34,r:.15,fill:a.accent,...s})}if(n("cap")){for(const l of v)o.push({k:"line",pts:[l*.98,-.2,l*.5,.82,-l*.05,.98],stroke:a.outline,lw:.06});o.push({k:"path",d:P(Q(-1.1,-.16,-1.04,-.66,-.6,-1.12,0,-1.24,.6,-1.12,1.04,-.66,1.1,-.16,.5,-.4,-.5,-.4)),fill:a.accent,...s}),o.push({k:"path",d:"M-0.74 -0.4 Q0 -0.6 0.74 -0.4 Q0.8 -0.24 0.6 -0.22 Q0 -0.36 -0.6 -0.22 Q-0.8 -0.24 -0.74 -0.4 Z",fill:a.accent,...s}),o.push({k:"circle",x:.5,y:-.82,r:.15,fill:r(0,N),...s});for(const l of[-.42,-.14])o.push({k:"line",pts:[l,-1.04,l+.02,-.78],stroke:a.outline,lw:.07,alpha:.7})}if(n("safari-hat")&&(o.push({k:"ellipse",x:0,y:-.56,rx:1.48,ry:.3,fill:a.accent,...s}),o.push({k:"path",d:P(Q(-.78,-.58,-.7,-1.1,-.3,-1.38,.3,-1.38,.7,-1.1,.78,-.58,0,-.5),.8),fill:a.accent,...s}),o.push({k:"path",d:"M-0.77 -0.72 Q0 -0.62 0.77 -0.72 L0.74 -0.9 Q0 -0.8 -0.74 -0.9 Z",fill:r(1,a.outline),stroke:a.outline,lw:t*.8})),n("wizard-hat")){o.push({k:"ellipse",x:0,y:-.62,rx:1.32,ry:.26,fill:a.accent,...s}),o.push({k:"path",d:O(Q(-.8,-.66,-.36,-1.5,.5,-2.2,.3,-1.46,.8,-.66),.3),fill:a.accent,...s});const l=r(0,Zt);for(const[u,c,x]of[[.02,-1.08,.18],[-.38,-.84,.1],[.36,-1.5,.11]])o.push({k:"group",x:u,y:c,s:x,items:[{k:"path",d:ye,fill:l}]})}if(n("dive-mask")){for(const u of v)o.push({k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:a.outline,lw:.2},{k:"line",pts:[u*.7,-.04,u*1,-.12],stroke:a.accent,lw:.11});o.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,fill:"#bfe9f5",alpha:.35}),o.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:a.outline,lw:.2}),o.push({k:"rect",x:0,y:0,w:1.42,h:.62,r:.28,stroke:a.accent,lw:.11}),o.push({k:"path",d:"M-0.5 -0.16 Q-0.4 -0.24 -0.22 -0.24",stroke:N,lw:.06,alpha:.9});const l="M0.5 0.52 Q0.98 0.56 1.04 0.1 L1.12 -0.92";o.push({k:"path",d:l,stroke:a.outline,lw:.24},{k:"path",d:l,stroke:a.accent,lw:.13})}return o}function Kt(e,t){const a=e.headExtras.includes("ninja-hood")?e.palette.body:e.palette.skin??e.palette.body;switch(e.head){case"round":return{k:"circle",x:0,y:0,r:1,fill:a,...t};case"wide":return{k:"ellipse",x:0,y:.03,rx:1.12,ry:.94,fill:a,...t};case"tall":return{k:"ellipse",x:0,y:-.02,rx:.94,ry:1.04,fill:a,...t};case"square":return{k:"rect",x:0,y:0,w:2,h:1.8,r:.46,fill:a,...t};case"bucket":return{k:"path",d:O(Q(-.94,.96,-.98,-.36,-.62,-1.04,.62,-1.04,.98,-.36,.94,.96),.42),fill:a,...t};case"bulb":return{k:"path",d:P([{x:0,y:-1.02},{x:.86,y:-.74},{x:1.08,y:-.12},{x:.72,y:.62},{x:0,y:.92},{x:-.72,y:.62},{x:-1.08,y:-.12},{x:-.86,y:-.74}]),fill:a,...t}}}function Wt(e){return e.head==="round"?{cy:0,rx:1,ry:1}:e.head==="tall"?{cy:-.02,rx:.94,ry:1.04}:{cy:.03,rx:1.12,ry:.94}}function Xt(e,t){const{cy:a,rx:o,ry:s}=Wt(e),n=o-t/2,r=s-t/2,h=.15,i=Math.asin(Math.min(1,(h-a)/r)),f=Math.cos(i)*n,l=d=>Math.round(d*100)/100||0,u=[L.M,l(-f),h],c=[[-.84*f,.02,-.53*f,.06,-.32*f,.24],[-.17*f,.11,.17*f,.11,.32*f,.24],[.53*f,.06,.84*f,.02,f,h]];for(const d of c)u.push(L.C,...d.map(l));const x=24;for(let d=1;d<=x;d++){const b=i+(Math.PI-2*i)*d/x;u.push(L.L,l(Math.cos(b)*n),l(a+Math.sin(b)*r))}return u.push(L.Z),u}function Gt(e,t){const a=e.palette,o={stroke:a.outline,lw:t},s=[];for(const n of v)switch(e.ears){case"pointy":case"unicorn":{const r=e.ears==="unicorn"?.8:1,h={x:n*.3,y:-.82},i={x:n*.86,y:-.82-.62*r},f={x:n*.94,y:-.36};s.push({k:"path",d:O([h,i,f],.2),fill:a.body,...o});const l={x:(h.x+i.x+f.x)/3,y:(h.y+i.y+f.y)/3},u=[h,i,f].map(c=>({x:l.x+(c.x-l.x)*.55,y:l.y+(c.y-l.y)*.55+.04}));s.push({k:"path",d:O(u,.25),fill:a.accent});break}case"round":s.push({k:"circle",x:n*.72,y:-.72,r:.36,fill:a.ears??a.body,...o}),a.ears||s.push({k:"circle",x:n*.74,y:-.74,r:.19,fill:a.accent});break;case"big-round":s.push({k:"circle",x:n*.96,y:-.46,r:.52,fill:a.body,...o}),s.push({k:"circle",x:n*1,y:-.44,r:.32,fill:a.accent});break;case"long":s.push({k:"ellipse",x:n*.38,y:-1.42,rx:.25,ry:.68,rot:n*.14,fill:a.body,...o}),s.push({k:"ellipse",x:n*.39,y:-1.36,rx:.12,ry:.48,rot:n*.14,fill:a.accent});break;case"side":s.push({k:"circle",x:n*1,y:.02,r:.34,fill:a.body,...o}),s.push({k:"circle",x:n*1.02,y:.02,r:.2,fill:a.belly});break;case"tufts":s.push({k:"path",d:O([{x:n*.3,y:-.84},{x:n*1.22,y:-1.12},{x:n*.92,y:-.42}],.16),fill:a.body,...o}),s.push({k:"line",pts:[n*.62,-.78,n*1,-.98],stroke:a.accent,lw:.08});break;case"antennae":{const r={x:n*.62,y:-1.42};s.push({k:"path",d:`M${n*.3} -0.8 Q${n*.36} -1.2 ${r.x} ${r.y}`,stroke:a.outline,lw:t*2.6}),s.push({k:"path",d:`M${n*.3} -0.8 Q${n*.36} -1.2 ${r.x} ${r.y}`,stroke:a.body,lw:t*1.2}),s.push({k:"circle",x:r.x,y:r.y,r:.17,fill:a.accent,...o});break}case"floppy":s.push({k:"ellipse",x:n*.96,y:.02,rx:.3,ry:.62,rot:-n*.36,fill:a.ears??a.body,...o});break;case"droopy":s.push({k:"ellipse",x:n*1.04,y:-.22,rx:.4,ry:.18,rot:n*.32,fill:a.skin??a.body,...o}),s.push({k:"ellipse",x:n*1.08,y:-.2,rx:.24,ry:.08,rot:n*.32,fill:a.accent});break;case"human":s.push({k:"ellipse",x:n*.98,y:.06,rx:.17,ry:.23,fill:a.skin??a.body,...o});break;case"horns":{const r=[{x:n*.3,y:-.84},{x:n*.6,y:-1.5},{x:n*.66,y:-.68}];s.push({k:"path",d:O(r,.18),fill:a.accent,...o});break}}return e.ears==="fin"&&s.push({k:"path",d:O(Q(-.4,-.82,.2,-1.62,.46,-.78),.2),fill:a.body,...o}),e.ears==="antenna"&&(s.push({k:"line",pts:[0,-.85,0,-1.42],stroke:a.outline,lw:t*2.6}),s.push({k:"line",pts:[0,-.85,0,-1.42],stroke:a.limbs,lw:t*1.2}),s.push({k:"circle",x:0,y:-1.5,r:.18,fill:a.accent,...o})),s}function Vt(e,t){const a=e.palette,o=e.face,s=[],n=a.outline,r=o.eyesOnTop?.46:.4,h=o.eyesOnTop?-.72:-.04,i=(f,l,u)=>({k:"circle",x:f,y:l,r:u,fill:N});switch(o.eyes){case"dot":for(const f of v)s.push({k:"ellipse",x:f*r,y:h,rx:.12,ry:.155,fill:n}),s.push(i(f*r+.04,h-.06,.045));break;case"bead":for(const f of v)s.push({k:"ellipse",x:f*r,y:h,rx:.16,ry:.22,fill:n}),s.push(i(f*r+.05,h-.08,.065));break;case"big":for(const f of v)o.eyeRing&&s.push({k:"circle",x:f*r,y:h,r:.36,fill:o.eyeRing,stroke:n,lw:t*.8}),s.push({k:"circle",x:f*r,y:h,r:.25,fill:N,stroke:n,lw:t*.8}),s.push({k:"circle",x:f*r+f*-.03,y:h+.03,r:.14,fill:o.eyeColor??n}),s.push(i(f*r+f*-.03+.05,h-.03,.05));break;case"mask":for(const f of v)s.push({k:"ellipse",x:f*.4,y:0,rx:.24,ry:.32,rot:f*-.55,fill:a.limbs}),s.push({k:"circle",x:f*.4,y:-.02,r:.11,fill:N}),s.push({k:"circle",x:f*.39,y:-0,r:.065,fill:n});break;case"screen":s.push({k:"rect",x:0,y:0,w:1.5,h:.66,r:.26,fill:"#24323d",stroke:n,lw:t*.8});for(const f of v)s.push({k:"ellipse",x:f*.36,y:0,rx:.2,ry:.24,fill:o.eyeColor??"#7ff0ff",alpha:.3}),s.push({k:"ellipse",x:f*.36,y:0,rx:.12,ry:.16,fill:o.eyeColor??"#7ff0ff"});break;case"almond":for(const f of v)s.push({k:"ellipse",x:f*.42,y:-.02,rx:.3,ry:.2,rot:-f*.5,fill:o.eyeColor??n}),s.push(i(f*.42-f*.07,-.08,.07));break;case"calm":for(const f of v)s.push({k:"ellipse",x:f*.38,y:.02,rx:.085,ry:.12,fill:n}),s.push(i(f*.38+.03,-.02,.03));break;case"slit":s.push({k:"line",pts:[0,-.98,0,-.2],stroke:n,lw:t*.8,alpha:.5}),s.push({k:"rect",x:0,y:-.04,w:1.56,h:.26,r:.1,fill:Ee,stroke:n,lw:t*.8}),s.push({k:"rect",x:0,y:.3,w:.22,h:.46,r:.08,fill:Ee,stroke:n,lw:t*.8});for(const f of v){s.push({k:"ellipse",x:f*.4,y:-.04,rx:.12,ry:.07,fill:o.eyeColor??N});for(const l of[.36,.56])s.push({k:"circle",x:f*.42,y:l,r:.05,fill:n,alpha:.6})}break;case"goggle":for(const f of v)s.push({k:"circle",x:f*.9,y:0,r:.13,fill:a.accent,stroke:n,lw:t*.8});s.push({k:"rect",x:0,y:0,w:1.66,h:.62,r:.3,fill:Ee,stroke:n,lw:t*.8}),s.push({k:"path",d:"M-0.6 -0.16 Q-0.42 -0.24 -0.12 -0.24",stroke:N,lw:.07,alpha:.8});for(const f of v)s.push({k:"path",d:`M${f*.5} 0.04 Q${f*.34} -0.08 ${f*.16} 0.02`,stroke:o.eyeColor??"#7fd6ff",lw:.08});for(const f of[-.18,0,.18])s.push({k:"line",pts:[f,.56,f,.72],stroke:n,lw:t*.8,alpha:.6});break;case"visor":s.push({k:"ellipse",x:0,y:.08,rx:.8,ry:.64,fill:"#2a3f6b",stroke:n,lw:t*.8}),s.push({k:"path",d:"M-0.56 -0.14 Q-0.46 -0.4 -0.16 -0.46",stroke:N,lw:.08,alpha:.7});for(const f of v)s.push({k:"ellipse",x:f*.28,y:.04,rx:.1,ry:.14,fill:o.eyeColor??"#cfeeff"});break}return s}function Jt(e,t){const a=e.palette,o=e.face,s=[],n=o.eyes==="visor"?"#cfeeff":Ye,r=t*1.05;switch(o.nose&&o.mouth!=="beak"&&(o.mouth==="cat"?s.push({k:"path",d:O([{x:-.1,y:.22},{x:.1,y:.22},{x:0,y:.33}],.3),fill:o.nose,stroke:o.nose,lw:t*.6}):e.ears==="big-round"?s.push({k:"ellipse",x:0,y:.22,rx:.2,ry:.25,fill:o.nose}):s.push({k:"ellipse",x:0,y:.25,rx:.13,ry:.085,fill:o.nose})),o.mouth){case"smile":s.push({k:"path",d:o.eyes==="visor"?"M-0.16 0.32 Q0 0.46 0.16 0.32":"M-0.17 0.42 Q0 0.58 0.17 0.42",stroke:n,lw:r});break;case"open":s.push({k:"path",d:"M-0.21 0.4 Q0 0.46 0.21 0.4 Q0.19 0.68 0 0.68 Q-0.19 0.68 -0.21 0.4 Z",fill:n,stroke:n,lw:t*.5}),s.push({k:"ellipse",x:0,y:.6,rx:.1,ry:.06,fill:Yt});break;case"cat":s.push({k:"path",d:"M-0.19 0.4 Q-0.1 0.5 0 0.37 Q0.1 0.5 0.19 0.4",stroke:n,lw:r});break;case"beak":s.push({k:"path",d:O([{x:-.17,y:.2},{x:.17,y:.2},{x:0,y:.48}],.25),fill:a.accent,stroke:a.outline,lw:t*.8});break;case"teeth":s.push({k:"path",d:"M-0.36 0.34 Q0 0.44 0.36 0.34 Q0.28 0.66 0 0.66 Q-0.28 0.66 -0.36 0.34 Z",fill:n,stroke:n,lw:t*.5});for(const h of v)s.push({k:"rect",x:h*.12,y:.43,w:.1,h:.1,r:.03,fill:N});break;case"grill":s.push({k:"rect",x:0,y:.56,w:.62,h:.2,r:.08,fill:"#24323d",stroke:a.outline,lw:t*.7});for(const h of[-.15,0,.15])s.push({k:"line",pts:[h,.51,h,.61],stroke:"#9fb0bd",lw:t*.6});break;case"tiny":s.push({k:"ellipse",x:0,y:.44,rx:.08,ry:.1,fill:n});break;case"smirk":s.push({k:"path",d:"M-0.16 0.46 Q0.06 0.54 0.22 0.38",stroke:n,lw:r});break;case"bill":s.push({k:"ellipse",x:0,y:.36,rx:.44,ry:.2,fill:a.accent,stroke:a.outline,lw:t*.8}),s.push({k:"path",d:"M-0.36 0.38 Q0 0.46 0.36 0.38",stroke:a.outline,lw:t*.7});for(const h of v)s.push({k:"circle",x:h*.1,y:.28,r:.03,fill:a.outline});break;case"hook":s.push({k:"ellipse",x:0,y:.48,rx:.16,ry:.11,fill:Ye}),s.push({k:"path",d:"M-0.3 0.12 Q0 -0.02 0.3 0.12 Q0.36 0.52 0.04 0.76 Q0.08 0.52 -0.08 0.46 Q-0.28 0.38 -0.3 0.12 Z",fill:a.accent,stroke:a.outline,lw:t*.8});break;case"jaws":{s.push({k:"path",d:"M-0.5 0.3 Q0 0.5 0.5 0.3 Q0.38 0.72 0 0.72 Q-0.38 0.72 -0.5 0.3 Z",fill:n,stroke:n,lw:t*.5});for(const h of[-.34,-.17,0,.17,.34]){const i=.3+.4*(h+.5)*(.5-h)-.01;s.push({k:"path",d:O(Q(h-.075,i,h+.075,i,h,i+.13),.15),fill:N})}break}}return s}var ie=(e,t)=>({x:Math.sin(e)*t,y:-Math.cos(e)*t}),ea=.5,X={leftEye:2,rightEye:5,leftEar:7,rightEar:8},V={"3-5":{head:.75,neck:.74,arm:.3,leg:.36,hand:.19,foot:1.2,shoulderMin:.4,shoulderPad:.07,hipMin:.5,hipPad:.22,bottom:.26,bulge:1.12,armsOverHead:!0},"6-8":{head:.6,neck:.78,arm:.22,leg:.28,hand:.15,foot:1,shoulderMin:.34,shoulderPad:.04,hipMin:.4,hipPad:.16,bottom:.14,bulge:1.04,armsOverHead:!1},"9-12":{head:.5,neck:.92,arm:.17,leg:.21,hand:.125,foot:.9,shoulderMin:.36,shoulderPad:.07,hipMin:.32,hipPad:.08,bottom:.1,bulge:1,armsOverHead:!1}},be="6-8",Ke=e=>e.band in V?e.band:be,ja=V[be].head,ta=.3,aa=.12,oa=.9,We=.5,Xe=.65,sa=.35,na=.2,ra=.25,Z=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),q=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),I=(e,t)=>({x:e.x*t,y:e.y*t}),J=e=>Math.hypot(e.x,e.y),Ge=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),Me=e=>{const t=J(e);return t>1e-9?{x:e.x/t,y:e.y/t}:{x:0,y:1}},la=(...e)=>e.every(Number.isFinite),ia=e=>Math.atan2(Math.sin(e),Math.cos(e)),ca=(e,t,a)=>Math.min(Math.max(e,t),a);function Ve(e,t,a=!1){return o=>{const s=e[o*3],n=e[o*3+1],r=e[o*3+2];return s===void 0||n===void 0||r===void 0||!la(s,n,r)?{x:0,y:0,ok:!1}:{x:t.x+(a?1-s:s)*t.w,y:t.y+n*t.h,ok:r>=ea}}}function Ae(e,t,a={}){const o=Ve(e,t,a.mirrored),s=o(T.leftShoulder),n=o(T.rightShoulder);if(!s.ok||!n.ok)return null;const r=o(T.leftHip),h=o(T.rightHip),i=Ge(s,n),f=J(Z(n,s)),l=r.ok&&h.ok;let u=Me(Z(n,s));f<1e-6&&(u={x:1,y:0});let c,x,d;if(l){const ee=Ge(r,h);x=J(Z(ee,i)),x>=f*ra?c=Me(Z(ee,i)):(c={x:-u.y,y:u.x},c.y<0&&(c=I(c,-1))),d=Math.max(x,f*1.15)}else c={x:-u.y,y:u.x},c.y<0&&(c=I(c,-1)),d=f*1.15,x=d;d=Math.max(d,1e-6);const b={x:c.y,y:-c.x},y=Math.atan2(b.y,b.x),k=I(c,-1),g=V[a.band??be]??V[be],z=g.head*d;let U=q(i,I(k,z*g.neck));const ce=o(T.nose);if(ce.ok){const ee=q(ce,I(k,z*.15)),fe=I(Z(ee,U),sa),Se=Math.min(1,z*na/Math.max(J(fe),1e-6));U=q(U,I(fe,Se))}return{S:i,r:b,d:c,U:d,L:x,hipsOk:l,head:U,headR:z,headRot:y+fa(e,o,y,d),angle:y}}function fa(e,t,a,o){const s=[[X.leftEar,X.rightEar],[X.leftEye,X.rightEye]];for(const[n,r]of s){const h=t(n),i=t(r);if(!h.ok||!i.ok||!(e[n*3+2]>=Xe&&e[r*3+2]>=Xe)||J(Z(i,h))<o*.05)continue;const f=ia(Math.atan2(i.y-h.y,i.x-h.x)-a),l=Math.max(Math.abs(f)-aa,0),u=ca((oa+We-Math.abs(f))/We,0,1);return Math.sign(f)*Math.min(l,ta)*u}return 0}function Ce(e,t,a,o={}){const s=Ke(t),n=V[s],r=Ae(e,a,{...o,band:s});if(!r)return[];const h=Ve(e,a,o.mirrored),i=t.palette,{S:f,r:l,d:u,U:c,L:x}=r,d=p=>t.bodyExtras.includes(p),b=Math.max(1.2,c*.045),y={stroke:i.outline,lw:b},k=(p,m)=>({x:f.x+l.x*p+u.x*m,y:f.y+l.y*p+u.y*m}),g=p=>p.map(([m,w])=>k(m,w)),z=h(T.leftShoulder),U=h(T.rightShoulder),ce=h(T.leftHip),ee=h(T.rightHip),fe=J(Z(U,z)),Se=r.hipsOk?J(Z(ee,ce)):fe*.7,M=Math.max(fe/2+n.shoulderPad*c,n.shoulderMin*c),_=Math.max(Se/2+n.hipPad*c,n.hipMin*c),F=-.1*c,ae=x+n.bottom*c,K=[],xe=[],C=[],me=[],ht=[],ut=(p,m,w,S)=>{const E=m.flatMap(H=>[H.x,H.y]);p.push({k:"line",pts:E,stroke:i.outline,lw:w+b*2}),p.push({k:"line",pts:E,stroke:S,lw:w})},Qa=n.leg*c,Ba=n.arm*c,dt=Math.max(n.arm/.22,.9);if(r.hipsOk)for(const[p,m,w,S]of[[ce,T.leftKnee,T.leftAnkle,-1],[ee,T.rightKnee,T.rightAnkle,1]]){const E=h(m),H=h(w);if(!E.ok)continue;const Te=q(p,I(u,-.12*c)),oe=H.ok?[Te,E,H]:[Te,E];ut(xe,oe,Qa,i.limbs),d("joints")&&xe.push({k:"circle",x:E.x,y:E.y,r:.15*c*dt,fill:i.accent,...y}),H.ok&&xe.push(da(t,H,r,S,b,n.foot))}for(const[p,m,w,S]of[[z,T.leftElbow,T.leftWrist,-1],[U,T.rightElbow,T.rightWrist,1]]){const E=h(m),H=h(w);if(d("pauldrons")){const se=q(p,I(u,.02*c));me.push({k:"ellipse",x:se.x,y:se.y,rx:.25*c,ry:.17*c,rot:r.angle+S*.25,fill:i.body,...y});const ue=q(se,I(u,.05*c));me.push({k:"ellipse",x:ue.x,y:ue.y,rx:.17*c,ry:.07*c,rot:r.angle+S*.25,fill:i.belly})}if(!E.ok)continue;const oe=n.armsOverHead&&(E.x-f.x)*u.x+(E.y-f.y)*u.y<-.25*c?ht:me,pt=q(p,I(u,.04*c));if(ut(oe,H.ok?[pt,E,H]:[pt,E],Ba,i.limbs),d("joints")&&oe.push({k:"circle",x:E.x,y:E.y,r:.13*c*dt,fill:i.accent,...y}),!H.ok)continue;const he=Me(Z(H,E)),ze=q(H,I(he,.05*c));if(d("feathers"))for(const se of[-.55,0,.55]){const ue=Math.cos(se),yt=Math.sin(se)*S,Pe={x:he.x*ue-he.y*yt,y:he.x*yt+he.y*ue},bt=q(ze,I(Pe,.16*c));oe.push({k:"ellipse",x:bt.x,y:bt.y,rx:.2*c,ry:.09*c,rot:Math.atan2(Pe.y,Pe.x),fill:i.hands??i.accent,...y})}oe.push({k:"circle",x:ze.x,y:ze.y,r:n.hand*c,fill:i.hands??i.limbs,...y})}if(d("wings"))for(const p of[-1,1]){const m=g([[p*M*.5,.05*c],[p*(M+.85*c),-.6*c],[p*(M+.72*c),.05*c],[p*(M+.45*c),-.02*c],[p*(M+.3*c),.32*c],[p*M*.6,.55*c]]);K.push({k:"path",d:O(m,.18),fill:i.accent,...y})}if(d("cape")){const p=x+.8*c,m=_+.36*c,w=g([[-M*.92,F+.04*c],[M*.92,F+.04*c],[M+.16*c,x*.5],[m,p],[m*.5,p-.1*c],[0,p],[-m*.5,p-.1*c],[-m,p],[-M-.16*c,x*.5]]);K.push({k:"path",d:P(w,.6),fill:i.accent,...y})}if(d("backpack")){const p=k(0,.35*c);K.push({k:"rect",x:p.x,y:p.y,w:M*2+.34*c,h:.8*c,r:.16*c,rot:r.angle,fill:t.extraColors?.[0]??i.limbs,...y})}if(d("tank")){const p=k(M*.95,.24*c),m=t.extraColors?.[0]??i.accent,w=k(M*.95,-.3*c);K.push({k:"rect",x:w.x,y:w.y,w:.14*c,h:.16*c,r:.04*c,rot:r.angle,fill:i.outline}),K.push({k:"rect",x:p.x,y:p.y,w:.34*c,h:1*c,r:.17*c,rot:r.angle,fill:m,...y})}if(r.hipsOk&&!o.portrait&&K.push(...pa(t,r,_,b)),d("tentacles")&&r.hipsOk)for(const p of[-1,1]){const m=g([[p*_*.7,x*.9],[p*(_+.22*c),x+.3*c],[p*(_+.48*c),x+.22*c],[p*(_+.5*c),x-.02*c],[p*(_+.34*c),x-.06*c]]);K.push({k:"path",d:le(m),stroke:i.outline,lw:.2*c+b*2}),K.push({k:"path",d:le(m),stroke:i.limbs,lw:.2*c})}const W=Math.max(M,_)*n.bulge;if(d("wool")){for(const[m,w]of[[M*.7,F+.02*c],[W,x*.3],[W*1.02,x*.62],[(W+_)/2,x*.92],[_*.55,ae]])for(const S of[-1,1]){const E=k(S*m,w);C.push({k:"circle",x:E.x,y:E.y,r:.2*c,fill:i.body,...y})}const p=k(0,ae+.02*c);C.push({k:"circle",x:p.x,y:p.y,r:.2*c,fill:i.body,...y})}if(d("robe")){const p=x+.58*c,m=_*1.4;C.push({k:"path",d:P(g([[-M,F],[0,F-.04*c],[M,F],[W,x*.55],[m,p],[0,p+.06*c],[-m,p],[-W,x*.55]]),.7),fill:i.body,...y});const w=g([[-m*.94,p-.1*c],[0,p-.04*c],[m*.94,p-.1*c]]);C.push({k:"path",d:le(w),stroke:t.extraColors?.[0]??i.accent,lw:.07*c})}else if(d("sheet")){const p=x+.78*c,m=_*1.3;C.push({k:"path",d:P(g([[-M,F],[M,F],[W,x*.55],[m,p],[m*.5,p-.2*c],[0,p],[-m*.5,p-.2*c],[-m,p],[-W,x*.55]]),.9),fill:i.body,...y})}else C.push({k:"path",d:P(g([[-M,F],[0,F-.04*c],[M,F],[W,x*.55],[_,ae],[0,ae+.03*c],[-_,ae],[-W,x*.55]]),.85),fill:i.body,...y});const Y=Math.min(M,_);if(d("pocket")){const p=k(0,x*.74);C.push({k:"rect",x:p.x,y:p.y,w:Y*1.3,h:.3*c,r:.1*c,rot:r.angle,fill:i.belly,stroke:i.outline,lw:b*.8})}else if(d("racing-stripe"))for(const p of[-.1,.1]){const m=k(p*c,F+.02*c),w=k(p*c,ae-.04*c);C.push({k:"line",pts:[m.x,m.y,w.x,w.y],stroke:i.belly,lw:.1*c})}else if(i.belly&&i.belly!==i.body&&!d("panel")&&!d("sheet")&&!d("stripes")){const p=k(0,x*.58);C.push({k:"ellipse",x:p.x,y:p.y,rx:Y*.64,ry:Math.max(x*.36,.2*c),rot:r.angle,fill:i.belly})}if(d("spots")){const p=t.extraColors?.[1]??i.belly;for(const[m,w,S]of[[-.55,.35,.09],[.5,.62,.11],[-.35,.86,.07]]){const E=k(m*Y,w*x);C.push({k:"circle",x:E.x,y:E.y,r:S*c,fill:p})}}if(d("stripes")){const p=t.extraColors?.[1]??i.accent;for(const m of[.22,.44,.66]){const w=k(-Y*.98,x*m),S=k(Y*.98,x*m);C.push({k:"line",pts:[w.x,w.y,S.x,S.y],stroke:p,lw:.1*c})}}if(d("straps")){const p=t.extraColors?.[1]??i.outline;for(const m of[-1,1]){const w=k(m*M*.62,F+.02*c),S=k(m*Y*.62,x*.72);C.push({k:"line",pts:[w.x,w.y,S.x,S.y],stroke:i.outline,lw:.13*c+b*2}),C.push({k:"line",pts:[w.x,w.y,S.x,S.y],stroke:p,lw:.13*c})}}if(d("belt")){const p=k(0,x*.9);C.push({k:"rect",x:p.x,y:p.y,w:_*1.92,h:.17*c,r:.06*c,rot:r.angle,fill:t.extraColors?.[2]??"#4a3426",...y}),C.push({k:"rect",x:p.x,y:p.y,w:.2*c,h:.19*c,r:.04*c,rot:r.angle,fill:"#ffd84a",...y})}if(d("emblem")){const p=k(0,x*.4),m=t.extraColors?.[0]??i.accent,w=O([{x:-.22,y:-.2},{x:.22,y:-.2},{x:.22,y:.04},{x:0,y:.26},{x:-.22,y:.04}],.25);C.push({k:"group",x:p.x,y:p.y,rot:r.angle,s:c,items:[{k:"path",d:w,fill:m,stroke:i.outline,lw:b/c},{k:"group",x:0,y:.01,s:.12,items:[{k:"path",d:ye,fill:m===i.accent?"#ffffff":i.accent}]}]})}if(d("panel")){const p=k(0,x*.5);C.push({k:"rect",x:p.x,y:p.y,w:Y*1.2,h:.38*c,r:.1*c,rot:r.angle,fill:"#24323d",...y}),(t.extraColors??["#ff7a6b","#fbd46a","#7ff0ff"]).slice(0,3).forEach((w,S)=>{const E=k((S-1)*Y*.34,x*.5);C.push({k:"circle",x:E.x,y:E.y,r:.075*c,fill:w})})}if(d("badge")){const p=k(-Y*.42,x*.36);C.push({k:"circle",x:p.x,y:p.y,r:.15*c,fill:i.accent,...y}),C.push({k:"group",x:p.x,y:p.y,rot:r.angle,s:.09*c,items:[{k:"path",d:ye,fill:"#ffffff"}]})}if(d("star")){const p=k(-Y*.5,x*.3),m=.15*c;C.push({k:"group",x:p.x,y:p.y,rot:r.angle-.2,s:m,items:[{k:"path",d:ye,fill:t.extraColors?.[0]??"#ffd84a",stroke:i.outline,lw:b*.8/m}]})}if(d("scarf")){const p=Math.max(.04,n.head*(1-n.neck)-.06)*c,m=k(0,p),w=t.extraColors?.[0]??i.accent,S=k(M*.45,p+.28*c);C.push({k:"rect",x:S.x,y:S.y,w:.16*c,h:.42*c,r:.06*c,rot:r.angle+.15,fill:w,...y}),C.push({k:"rect",x:m.x,y:m.y,w:M*2.05,h:.2*c,r:.1*c,rot:r.angle,fill:w,...y})}const Fa={k:"group",x:r.head.x,y:r.head.y,rot:r.headRot,s:r.headR,items:ua(t,b/r.headR)};return[...K,...xe,...C,...me,Fa,...ht]}var Je=new WeakMap,ha=64;function ua(e,t){const a=Number(t.toPrecision(4));let o=Je.get(e);o||Je.set(e,o=new Map);let s=o.get(a);return s||(o.size>=ha&&o.clear(),o.set(a,s=Ze(e,a))),s}function da(e,t,a,o,s,n){const r=e.palette,{d:h,r:i}=a,f=a.U*n,l=q(q(t,I(h,.07*f)),I(i,o*.06*f)),u={stroke:r.outline,lw:s},c=r.feet??r.limbs;if(e.bodyExtras.includes("fins")){const x=O([{x:-.13,y:-.06},{x:.13,y:-.06},{x:.24,y:.46},{x:-.24,y:.46}],.22);return{k:"group",x:l.x,y:l.y,rot:a.angle,s:f,items:[{k:"path",d:x,fill:c,stroke:r.outline,lw:s/f},{k:"line",pts:[0,.06,0,.38],stroke:r.outline,lw:s/f,alpha:.5}]}}return e.bodyExtras.includes("flippers")?{k:"ellipse",x:l.x,y:l.y,rx:.27*f,ry:.11*f,rot:a.angle,fill:c,...u}:e.bodyExtras.includes("boots")?{k:"rect",x:l.x,y:l.y,w:.4*f,h:.24*f,r:.09*f,rot:a.angle,fill:c,...u}:{k:"ellipse",x:l.x,y:l.y,rx:.2*f,ry:.13*f,rot:a.angle,fill:c,...u}}function pa(e,t,a,o){const s=e.palette,{U:n,L:r,S:h,r:i,d:f}=t,l=(b,y)=>({x:h.x+i.x*b+f.x*y,y:h.y+i.y*b+f.y*y}),u=b=>b.map(([y,k])=>l(y,k)),c={stroke:s.outline,lw:o},x=(b,y,k)=>[{k:"path",d:le(b),stroke:s.outline,lw:y+o*2},{k:"path",d:le(b),stroke:k,lw:y}],d=[];switch(e.tail){case"none":break;case"fluffy":{const b=u([[a*.5,r*.95],[a+.28*n,r*1],[a+.72*n,r*.62],[a+.78*n,r*.12],[a+.52*n,r*.32],[a+.3*n,r*.6],[a*.6,r*.7]]);d.push({k:"path",d:P(b),fill:s.body,...c});const y=l(a+.72*n,r*.2);d.push({k:"ellipse",x:y.x,y:y.y,rx:.13*n,ry:.2*n,rot:t.angle+.25,fill:s.belly,...c});break}case"brush":{const b=u([[a*.4,r*.98],[a+.42*n,r*1.06],[a+.98*n,r*.66],[a+1.06*n,r*.12],[a+.86*n,-.04*n],[a+.66*n,r*.36],[a+.3*n,r*.66],[a*.5,r*.68]]);d.push({k:"path",d:P(b),fill:s.body,...c});const y=u([[a+1.03*n,r*.36],[a+1.06*n,r*.12],[a+.86*n,-.04*n],[a+.72*n,r*.24],[a+.86*n,r*.34]]);d.push({k:"path",d:P(y),fill:s.belly,...c});break}case"pom":{const b=l(a+.06*n,r*.88);d.push({k:"circle",x:b.x,y:b.y,r:.2*n,fill:s.belly,...c});break}case"long":case"striped":case"tuft":{const b=u([[a*.6,r*.9],[a+.35*n,r*.85],[a+.58*n,r*.4],[a+.5*n,-.02*n]]);if(d.push(...x(b,.14*n,s.body)),e.tail==="tuft"){const y=b[b.length-1];d.push({k:"circle",x:y.x,y:y.y,r:.16*n,fill:e.extraColors?.[0]??s.accent,...c})}if(e.tail==="striped"){for(const k of[.35,.6,.85]){const g=l(a+.35*n+.22999999999999998*n*(k*1.4>1?1:k*1.4),r*(.85-.85*k));d.push({k:"line",pts:[g.x-i.x*.08*n,g.y-i.y*.08*n,g.x+i.x*.08*n,g.y+i.y*.08*n],stroke:e.extraColors?.[0]??s.outline,lw:.06*n})}const y=b[b.length-1];d.push({k:"circle",x:y.x,y:y.y,r:.07*n,fill:e.extraColors?.[0]??s.outline})}break}case"curl":{const b=u([[a*.6,r*.9],[a+.4*n,r*.88],[a+.62*n,r*.45],[a+.5*n,r*.12],[a+.3*n,r*.24],[a+.36*n,r*.42]]);d.push(...x(b,.12*n,s.limbs));break}case"fish":{const b=u([[a*.6,r*.9],[a+.36*n,r*.86],[a+.6*n,r*.5]]);d.push(...x(b,.17*n,s.body));const y=b[b.length-1],k=O([{x:0,y:.06},{x:-.26,y:-.34},{x:.02,y:-.12},{x:.32,y:-.3}],.2);d.push({k:"group",x:y.x,y:y.y,rot:t.angle+.35,s:n,items:[{k:"path",d:k,fill:s.body,stroke:s.outline,lw:o/n}]});break}case"plume":{const b=e.extraColors??[s.accent];[0,1,2].forEach(y=>{const k=l(a+(.12+y*.13)*n,r+(.32-y*.06)*n);d.push({k:"ellipse",x:k.x,y:k.y,rx:.11*n,ry:.44*n,rot:t.angle-.55+y*.28,fill:b[(y+1)%b.length],...c})});break}case"spiky":case"arrow":{const b=u([[a*.3,r*.55],[a+.35*n,r*.68],[a+.95*n,r*.86],[a+.35*n,r*1.08],[a*.3,r*1.08]]);if(e.tail==="spiky"){for(const y of[.15,.45,.72]){const k=a+(.2+y*.7)*n,g=r*(.66+y*.19);d.push({k:"path",d:O(u([[k-.12*n,g+.05*n],[k,g-.2*n],[k+.12*n,g+.07*n]]),.2),fill:s.accent,...c})}d.push({k:"path",d:P(b,.7),fill:s.body,...c})}else{const y=u([[a*.6,r*.9],[a+.4*n,r*.92],[a+.62*n,r*.5],[a+.62*n,r*.18]]);d.push(...x(y,.13*n,s.body));const k=y[y.length-1];d.push({k:"group",x:k.x,y:k.y,rot:t.angle,s:n,items:[{k:"path",d:O([{x:-.15,y:.04},{x:0,y:-.22},{x:.15,y:.04}],.2),fill:s.accent,stroke:s.outline,lw:o/n}]})}break}}return d}var ya={nose:[0,-.62],leftShoulder:[-.42,0],rightShoulder:[.42,0],leftElbow:[-.58,.5],rightElbow:[.58,.5],leftWrist:[-.66,.98],rightWrist:[.66,.98],leftHip:[-.27,1],rightHip:[.27,1],leftKnee:[-.31,1.6],rightKnee:[.31,1.6],leftAnkle:[-.33,2.18],rightAnkle:[.33,2.18]};function ba(e,{cx:t=.5,cy:a=.36,T:o=.18}={}){const s={...ya,...e},n=new Array(Ie*3).fill(0),r=(f,[l,u],c=.99)=>{n[f*3]=t+l*o,n[f*3+1]=a+u*o,n[f*3+2]=c};for(const f of Object.keys(T))r(T[f],s[f]);const h=s.tilt??0,i=(f,l)=>[s.nose[0]+f*Math.cos(h)-l*Math.sin(h),s.nose[1]+f*Math.sin(h)+l*Math.cos(h)];return r(X.leftEye,i(-.1,-.08)),r(X.rightEye,i(.1,-.08)),r(X.leftEar,i(-.22,-.02)),r(X.rightEar,i(.22,-.02)),n}var ka=()=>ba({}),et=.5,xa=.15,ma=class{constructor(e={}){D(this,"tracks",new Map),D(this,"offset",NaN),D(this,"lastArrival",NaN),D(this,"interval",33),D(this,"lastT",NaN),D(this,"lostMs"),D(this,"maxExtrapolateMs"),this.lostMs=e.lostMs??250,this.maxExtrapolateMs=e.maxExtrapolateMs??25}get delayMs(){return this.interval}push(e,t,a,o=tt()){Number.isFinite(t)||(t=o),this.clock(t,o);const s=this.tracks.get(e);if(!s||t-s.tb>this.lostMs||t<s.tb-this.lostMs||a.length!==s.b.length){this.tracks.set(e,{a:null,ta:t,b:a,tb:t,out:null,outAt:NaN});return}if(a===s.b||t<=s.tb){t===s.tb&&a!==s.b&&(s.b=a,s.out=null);return}s.a=s.b,s.ta=s.tb,s.b=a,s.tb=t,s.out=null}at(e,t=tt()){const a=this.tracks.get(e);if(!a)return null;if(!a.a)return a.b;if(a.out&&a.outAt===t)return a.out;const o=t-this.offset-this.interval,s=a.tb-a.ta,n=Math.min(s*.5,this.maxExtrapolateMs),r=Math.min(Math.max((o-a.ta)/s,0),1+n/s);return a.out=wa(a.a,a.b,r),a.outAt=t,a.out}forget(e){this.tracks.delete(e)}clear(){this.tracks.clear()}clock(e,t){const a=t-e;if(!Number.isFinite(this.offset)||a<this.offset||a>this.offset+1e3?this.offset=a:Number.isFinite(this.lastArrival)&&(this.offset+=Math.min(a-this.offset,(t-this.lastArrival)/1e3)),this.lastArrival=t,Number.isFinite(this.lastT)&&e>this.lastT){const o=e-this.lastT;o<this.interval*3+20&&(this.interval+=(Math.min(Math.max(o,8),100)-this.interval)*.1)}e<=this.lastT||(this.lastT=e)}},tt=()=>globalThis.performance?.now()??Date.now();function wa(e,t,a){const o=t.slice(),s=a<.5?e:t;for(let n=0;n+2<t.length;n+=3){const r=e[n],h=e[n+1],i=t[n],f=t[n+1];e[n+2]>=et&&t[n+2]>=et&&Math.abs(i-r)+Math.abs(f-h)<xa?(o[n]=r+(i-r)*a,o[n+1]=h+(f-h)*a,o[n+2]=e[n+2]+(t[n+2]-e[n+2])*Math.min(a,1)):(o[n]=s[n],o[n+1]=s[n+1],o[n+2]=s[n+2])}return o}var Ua=$e.map(e=>e.id),ke=new Map($e.map(e=>[e.id,e])),at=ke.get("fox"),ga=e=>typeof e=="string"&&ke.has(e),va=e=>ke.get(e),ot=e=>typeof e=="string"?ke.get(e)??at:e;function Ea(e,t,a,o,s={}){const n=Ce(t,ot(a),o,{mirrored:s.mirrored});return n.length?(e.save(),s.alpha!==void 0&&(e.globalAlpha*=Math.min(Math.max(s.alpha,0),1)),ve(e,n),e.restore(),!0):!1}function Ma(e,t){const a=ot(e),o=ka(),s=Ke(a),n=Ae(o,{x:0,y:0,w:1,h:1},{band:s}),r=-st(Ze(a,.05)).minY,i=Math.min(.27,.43/Math.max(r,1))*t/V[s].head/n.U,f=.5*t+Math.min(0,(r-1.6)*.06*t),l={x:t/2-n.head.x*i,y:f-n.head.y*i,w:i,h:i};return Ce(o,a,l,{portrait:!0})}function Aa(e,t,a=.5){if(!e||e.length!==t.length)return t.slice();const o=t.slice();for(let s=0;s+2<t.length;s+=3){const n=e[s+2],r=t[s+2],h=n>=.5,i=r>=.5;h&&r>=.3&&(o[s+2]=Math.max(r,.5)),h&&i&&Math.hypot(t[s]-e[s],t[s+1]-e[s+1])<.15?(o[s]=e[s]+(t[s]-e[s])*a,o[s+1]=e[s+1]+(t[s+1]-e[s+1])*a):h&&!i&&o[s+2]>=.5&&(o[s]=e[s],o[s+1]=e[s+1])}return Ta(e,t,o,a*Ca),o}var Ca=.35,Sa=11;function Ta(e,t,a,o){const s=T.leftShoulder*3,n=T.rightShoulder*3,r=(u,c)=>u[c+2]>=.5;if(!r(e,s)||!r(e,n)||!r(t,s)||!r(t,n))return;const h=(u,c)=>(u[s+c]+u[n+c])/2,i=[h(e,0),h(e,1)],f=[h(t,0),h(t,1)],l=[h(a,0),h(a,1)];for(let u=0;u<Sa&&u*3+2<t.length;u++){const c=u*3;if(!r(e,c)||!r(t,c))continue;const x=[e[c]-i[0],e[c+1]-i[1]],d=[t[c]-f[0],t[c+1]-f[1]];Math.hypot(d[0]-x[0],d[1]-x[1])>=.15||(a[c]=l[0]+x[0]+(d[0]-x[0])*o,a[c+1]=l[1]+x[1]+(d[1]-x[1])*o)}}function st(e){const t={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=(o,s)=>{t.minX=Math.min(t.minX,o),t.minY=Math.min(t.minY,s),t.maxX=Math.max(t.maxX,o),t.maxY=Math.max(t.maxY,s)};for(const o of e){const s="lw"in o&&o.stroke?(o.lw??1)/2:0;switch(o.k){case"circle":a(o.x-o.r-s,o.y-o.r-s),a(o.x+o.r+s,o.y+o.r+s);break;case"ellipse":case"rect":{const n=o.k==="ellipse"?o.rx:o.w/2,r=o.k==="ellipse"?o.ry:o.h/2,h=Math.max(n,r)+s;a(o.x-h,o.y-h),a(o.x+h,o.y+h);break}case"path":{const n=$t(o.d);for(let r=0;r+1<n.length;r+=2)a(n[r]-s,n[r+1]-s),a(n[r]+s,n[r+1]+s);break}case"line":for(let n=0;n+1<o.pts.length;n+=2)a(o.pts[n]-s,o.pts[n+1]-s),a(o.pts[n]+s,o.pts[n+1]+s);break;case"group":{const n=st(o.items);if(!Number.isFinite(n.minX))break;const r=o.s??1,h=Math.cos(o.rot??0),i=Math.sin(o.rot??0);for(const[f,l]of[[n.minX,n.minY],[n.maxX,n.minY],[n.minX,n.maxY],[n.maxX,n.maxY]])a(o.x+(f*h-l*i)*r,o.y+(f*i+l*h)*r);break}}}return t}var za=()=>{const e=typeof document<"u"?document.timeline?.currentTime:null;return typeof e=="number"&&Number.isFinite(e)?e:globalThis.performance?.now()??Date.now()},nt=()=>globalThis.performance?.now()??Date.now(),rt=class{constructor(e=za){D(this,"now",e),D(this,"known",new Map),D(this,"smoothed",new Map),D(this,"times",new WeakMap),D(this,"lerp",new ma),D(this,"drawnAt",NaN),D(this,"drawn",0),D(this,"smoothedBody",(t,a={})=>{const o=a.interpolate!==!1;if(typeof t=="number"){const s=this.smoothed.get(t);return s?o?this.lerp.at(t,this.tick())??s.body:s.body:null}return typeof t!="object"||t===null||!Array.isArray(t.body)?null:this.posed(t.id,t.body,lt(a.smooth),o)})}note(e,t,a=nt()){for(const o of e)this.known.set(o.id,this.resolve(o.id,o.avatar)),t!==void 0&&Number.isFinite(t)&&Array.isArray(o.body)&&this.times.set(o.body,{t,arrival:a})}of(e){return typeof e=="object"&&e!==null?e.avatar!==void 0?this.resolve(e.id,e.avatar):this.of(e.id):this.known.get(e)??Qe(e-1)}posed(e,t,a,o=!0){const s=this.smooth(e,t,a);return o?this.lerp.at(e,this.tick())??s:s}smooth(e,t,a){const o=this.smoothed.get(e);if(o&&o.raw===t&&o.amount===a)return o.body;o&&o.amount!==a&&this.lerp.forget(e);const s=a<1?Aa(o?.body,t,a):t;this.smoothed.set(e,{raw:t,body:s,amount:a});const n=this.times.get(t),r=n?.arrival??nt();return this.lerp.push(e,n?.t??r,s,r),s}takeDrawn(){const e=this.drawn;return this.drawn=0,e}tick(){const e=this.now();return e!==this.drawnAt&&(this.drawnAt=e,this.drawn++),e}resolve(e,t){return ga(t)?t:Qe(e-1)}};function Pa(e,t){const a=typeof e.getTransform=="function"?e.getTransform():null,o=a&&Math.hypot(a.a,a.b)||1,s=a&&Math.hypot(a.c,a.d)||1,n=(e.canvas?.width??0)/o,r=(e.canvas?.height??0)/s;return t?{x:t.x*n,y:t.y*r,w:t.w*n,h:t.h*r}:{x:0,y:0,w:n,h:r}}var lt=e=>e===!1?1:typeof e=="number"?Math.min(Math.max(e,.05),1):.5;function it(e,t){return(a,o,s,n,r={})=>{const h=Array.isArray(o)?null:o,i=h?h.body:o;if(!Array.isArray(i))return null;const f=typeof s=="string"?s:e.of(typeof s=="number"?s:h??1),l=typeof s=="number"?s:h?.id,u=l!==void 0?e.posed(l,i,lt(r.smooth),r.interpolate!==!1):i;return Ea(a,u,f,n??Pa(a,t().view),r.alpha!==void 0?{alpha:r.alpha}:{})?u:null}}function Oa(e){const t=new Map,a=(i,f)=>t.get(i)?.forEach(l=>l(f));let o=null;const s=[],n=i=>o?i(o):s.push(i),r=new rt,h=it(r,()=>({view:null}));return e.then(i=>{o=i;const f=new Map;i.on("gesture",l=>a(l.gesture,{player:l.player})),i.on("pause",l=>a("pause",{reason:l.reason==="distance"?"distance":"user"})),i.on("resume",()=>a("resume",{})),i.on("break-start",()=>a("break-start",{})),i.on("break-done",l=>a("break-end",{shown:l.shown})),i.onBackdrop((l,u)=>a("backdrop",{backdrop:l,view:u})),i.on("frame",l=>{a("players",{players:l.players});for(const u of l.players)a("hands",{player:u.id,left:u.leftHand,right:u.rightHand}),f.get(u.id)!==u.shape&&(f.set(u.id,u.shape),a("shape",{player:u.id,shape:u.shape}))}),a("start",ct(i)),s.splice(0).forEach(l=>l(i))}),{on(i,f){const l=t.get(i)??new Set;return t.set(i,l),l.add(f),i==="start"&&o&&f(ct(o)),()=>{l.delete(f)}},ready:()=>n(i=>i.ready()),score:(i,f=1)=>n(l=>l.score(f,i)),break:i=>new Promise(f=>n(l=>{l.break(i).then(f)})),end:i=>n(f=>f.end(typeof i=="number"?[{player:1,score:i,stars:2}]:i.map(l=>({player:l.player,score:l.score,stars:l.stars??2})))),keys:(i,f)=>n(l=>{zt(l,i,f)}),pointer:i=>n(f=>{Ot(f,i)}),get view(){return o?.view??null},get device(){return o?.device??null},reportStats:i=>o?.reportStats(i),toScreen:i=>o?o.toScreen(i):He(null,i),avatarOf:i=>o?o.avatarOf(i):r.of(i),drawAvatar:(...i)=>o?o.drawAvatar(...i):h(...i),smoothedBody:(...i)=>o?o.smoothedBody(...i):r.smoothedBody(...i)}}var ct=e=>({ageRange:e.ageRange,players:e.players,locale:e.locale,mode:e.mode,backdrop:e.backdrop,view:e.view,device:e.device}),La=(e=window)=>({post:t=>e.parent.postMessage(t,"*"),listen:t=>e.addEventListener("message",a=>a.source===e.parent&&t(a.data))}),_a=1e4,Da=1e3;function Na(e=La()){return new Promise((t,a)=>{const o=new Map,s=[];let n=!1,r="none",h=null;const i=new Set,f=new rt,l=it(f,()=>({view:h})),u=f.smoothedBody,c=setTimeout(()=>a(new Error("Fabi Play: no host, is the game opened from Fabi Play?")),_a);e.listen(x=>{if(typeof x!="object"||x===null||x.ns!==Be)return;const d=x;if(d.type==="init"&&!n){if(d.v!==Ne)return clearTimeout(c),a(new Error(`Fabi Play: protocol ${d.v}, this SDK speaks ${Ne}`));n=!0,clearTimeout(c),r=d.backdrop==="video"?"video":"none",h=Fe(d.view)??null;const b=It(d.device)??null;let y={};if(d.stats===!0){let k=performance.now();setInterval(()=>{const z=performance.now();e.post(ne({type:"stats",renderFps:Math.round(f.takeDrawn()*1e3/Math.max(z-k,1)),...y})),k=z},Da).unref?.()}t({locale:d.locale,mode:d.mode,players:d.players,muted:d.muted,ageRange:d.ageRange??"6-8",get backdrop(){return r},get view(){return h},device:b,reportStats:k=>{y=Rt(k)},toScreen:k=>He(h,k),avatarOf:k=>f.of(k),drawAvatar:l,smoothedBody:u,onBackdrop(k){return i.add(k),()=>{i.delete(k)}},on(k,g){const z=o.get(k)??new Set;return o.set(k,z),z.add(g),()=>{z.delete(g)}},ready:()=>e.post(ne({type:"ready"})),score:(k,g)=>e.post(ne({type:"score",player:k,score:g})),break:(k="level")=>new Promise(g=>{s.push(g),e.post(ne({type:"break",reason:k}))}),end:k=>e.post(ne({type:"end",scores:k}))})}else if(n){let b=d;if(d.type==="frame"&&Array.isArray(d.players)&&f.note(d.players,d.t),d.type==="backdrop"){if(d.backdrop!=="video"&&d.backdrop!=="none")return;const y=Fe(d.view)??null;if(d.backdrop===r&&Ia(y,h))return;r=d.backdrop,h=y,b={type:"backdrop",backdrop:r,...h?{view:h}:{}};for(const k of[...i])k(r,h)}for(const y of o.get(d.type)??[])y(b);d.type==="break-done"&&s.shift()?.(d.shown)}else return})})}var Ia=(e,t)=>e===t||e!==null&&t!==null&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,ft={};Oe(ft,{BAND_BODY:()=>V,DEFAULT_AVATAR:()=>at,avatarById:()=>va,avatarShapes:()=>Ce,drawShapes:()=>ve,frameOf:()=>Ae,iconShapes:()=>Ma});function Ra(e){const t=Na(),a=Oa(t);e?.dataset.mute!=="manual"&&Et(t);const o=Object.assign(a,{avatars:{...ft}});window.FabiPlay=o;const s=e?.dataset.keys;s&&a.keys(At(s));const n=e?.dataset.pointer;return n&&a.pointer({hand:n==="left"||n==="right"?n:"any"}),e?.dataset.ready!=="manual"&&(document.readyState==="complete"?a.ready():window.addEventListener("load",()=>a.ready(),{once:!0})),o}return G.exports.install(we)});
package/dist/index.d.ts CHANGED
@@ -307,7 +307,11 @@ export type Movement = "hands" | "jump" | "squat" | "clap" | "freeze" | "lanes"
307
307
  * "title": { "it": "Acchiappastelle", "en": "Star catcher" },
308
308
  * "description": { "it": "Prendi le stelle con le mani.", "en": "Catch the stars with your hands." },
309
309
  * "ageRanges": ["3-5", "6-8"], "movements": ["hands"], "players": { "min": 1, "max": 2 },
310
- * "minutes": 3, "entry": "index.html", "sdk": 1
310
+ * "minutes": 3, "entry": "index.html", "sdk": 1,
311
+ * "intro": { "steps": [
312
+ * { "say": { "it": "Prendi le stelle!", "en": "Catch the stars!" }, "image": "intro/stars.jpg" },
313
+ * { "say": { "it": "Alza le braccia!", "en": "Arms up!" }, "move": "arms-up", "practice": true }
314
+ * ] }
311
315
  * }
312
316
  */
313
317
  export interface GameManifest {
@@ -332,15 +336,45 @@ export interface GameManifest {
332
336
  };
333
337
  /** Minutes of a typical game, 1 to 20. */
334
338
  minutes: number;
335
- /** Page that starts the game, an .html file relative to the game's address (same site, no ".."). */
339
+ /**
340
+ * Page that starts the game: a path relative to the game's address (no scheme, no leading /, no "." or ".."
341
+ * segments, up to 200 characters), of letters, digits, _ and -, ending in lowercase .html: index.html, play/index.html.
342
+ */
336
343
  entry: string;
337
344
  /** Protocol version of the SDK it was built with: 1 (PROTOCOL_VERSION). */
338
345
  sdk: number;
339
346
  /** Optional: the backdrops it can draw over besides its own; ['video'] opts in to mirror mode. */
340
347
  backdrop?: GameBackdrop[];
348
+ /** Optional: Fabi explains the game on the TV before calibration (see GameIntro). Absent: straight to calibration. */
349
+ intro?: GameIntro;
341
350
  }
342
351
  /** The backdrops a game may declare in its manifest (its own background is always supported). */
343
352
  export type GameBackdrop = Exclude<Backdrop, "none">;
353
+ /** The moves an intro step can show; the platform draws them with each child's avatar. Same names the SDK detects. */
354
+ export type IntroMove = "jump" | "squat" | "clap" | "lane-left" | "lane-right" | "arms-up" | "arms-wide" | "arms-v" | "star";
355
+ /** One sentence in every language, or one per age range (each with every language). */
356
+ export type IntroText = Record<Locale, string> | Partial<Record<AgeRange, Record<Locale, string>>>;
357
+ /** One step of the intro: Fabi says one sentence, over an image of the game or a move shown with the avatars. */
358
+ export interface IntroStep {
359
+ say: IntroText;
360
+ /**
361
+ * An image of the game, 16:9: a path relative to the game's address with the same rules as entry (no scheme, no
362
+ * leading /, no "." or ".." segments), ending in lowercase .jpg or .png (no WebP: old TV browsers may not decode it): intro/track.jpg.
363
+ */
364
+ image?: string;
365
+ /** Or a move, shown with the avatars. Exactly one of image and move. */
366
+ move?: IntroMove;
367
+ /** Only with move: the children try it and each gets a tick; the step moves on when all did, or after 8 s. Default false: Fabi only shows it. */
368
+ practice?: boolean;
369
+ }
370
+ /**
371
+ * Fabi explains the game on the TV, before calibration, in 1 to 4 steps (the platform adds its own final "ready"
372
+ * step). Only data: Fabi Play draws it, and speaks each sentence with a voice clip generated at publication from the
373
+ * text (voiceKey); a text without its clip yet is shown in the bubble only.
374
+ */
375
+ export interface GameIntro {
376
+ steps: IntroStep[];
377
+ }
344
378
  /** Where player space (0–1) lands on the canvas. */
345
379
  export interface Box {
346
380
  /** Left edge, canvas units. */
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  smoothBody,
13
13
  toScreen,
14
14
  wire
15
- } from "./chunks/chunk-QJPCNRFI.js";
15
+ } from "./chunks/chunk-57WXWAXG.js";
16
16
 
17
17
  // src/adapters.ts
18
18
  function muteDuringBreaks(play, win = window) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "package": "@fabi-play/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "algorithm": "sha384",
5
5
  "files": {
6
- "fabi-play.js": "sha384-vwHpIsx7Fav+S6/jNTY6qYfWT1zq3p2NIq9zD4T56qXw+/ogk6jfdwJIs0/gFNy3",
7
- "fabi-play.umd.js": "sha384-YDcTw2S3gcyQYGCn1cRcqui3DaqF1ByJ4cvS4HBP++xY7bSuLmSc6yhRH1RQ0b9G",
8
- "fabi-play.umd.min.js": "sha384-Hhlc2ZXMa3NvLOfsHXMTXlWxSMzw8GwJgMHID4I++red4Xmg2a8n3c67alpHgPlD",
9
- "fabi-play.d.ts": "sha384-NjFh/5P1gigt+yi1P58WplUgGh2CQUSJd77W+4puFk+r1/hDB7mkXK5tYoRKTYWB",
10
- "fabi-play.schema.json": "sha384-tHySTbbJnqrjp7H93Y/NxsyIqU1QUHnMqCbx4N7hOzfUzgvXpDYOpzZLXgWTOHAU"
6
+ "fabi-play.js": "sha384-q1iuDi35LU3t+xtPL5vtoWd2pTTjZeKeNdtsickjpqwRGrkIqVxG48cIaGUWCoFP",
7
+ "fabi-play.umd.js": "sha384-XhDlQuvhNDkT6sTpHWV3o24704da4bk5EfH4Jq3ofz+rg3C+QNu6git9XB/icMI5",
8
+ "fabi-play.umd.min.js": "sha384-nyM7yG3J5Dt/2g00hGsZSe/eiMTrk7bQRYtQ0CIZhB0WJoO0aGjb7T8yy6Yr3nG4",
9
+ "fabi-play.d.ts": "sha384-V23/J4JFAiTVaw+nSfWHhsRyWELfql7EU5mhtQd/caA3qpNyNr2Dz6Hb8I6Lu3Zl",
10
+ "fabi-play.schema.json": "sha384-dLS2VzWC6Q+BI64galOdzvfoycQ+n6KjFXIajrirk15dwjvAgrDMuszeld/BhQgc"
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabi-play/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "What a game imports: players, movements and the end of the game, from inside its sandboxed frame.",
5
5
  "keywords": [
6
6
  "fabi-play",
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "devDependencies": {
39
- "@fabi-play/avatars": "^0.1.0",
40
- "@fabi-play/protocol": "^0.1.0",
39
+ "@fabi-play/avatars": "^0.2.0",
40
+ "@fabi-play/protocol": "^0.2.0",
41
41
  "dts-bundle-generator": "9.5.1",
42
42
  "esbuild": "0.28.2",
43
43
  "tsx": "4.23.15",