domma-cms 1.6.59 → 1.7.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.
Files changed (143) hide show
  1. package/CHANGELOG.md +4344 -0
  2. package/README.md +1 -1
  3. package/admin/dist/domma/domma-tools.css +3 -3
  4. package/admin/dist/domma/domma-tools.min.js +3 -3
  5. package/admin/js/api.js +1 -1
  6. package/admin/js/app.js +2 -2
  7. package/admin/js/lib/draft-owner.js +1 -0
  8. package/admin/js/lib/effect-defs.js +1 -1
  9. package/admin/js/lib/effects-builder.js +2 -2
  10. package/admin/js/lib/page-editor-reference.js +5 -5
  11. package/admin/js/lib/shortcode-tags.js +1 -1
  12. package/admin/js/templates/docs/usage-shortcodes.html +39 -0
  13. package/admin/js/views/user-editor.js +1 -1
  14. package/docs/DommaFeatures.md +3005 -0
  15. package/docs/MultiTenant.md +176 -0
  16. package/docs/api-reference.md +1667 -0
  17. package/docs/cache.md +96 -0
  18. package/docs/configuration.md +1811 -0
  19. package/docs/editions-and-licences.md +190 -0
  20. package/docs/getting-started.md +201 -0
  21. package/docs/guides/form-triggers.md +260 -0
  22. package/docs/guides/mongodb-storage-adapter.md +282 -0
  23. package/docs/guides/multi-page-forms.md +121 -0
  24. package/docs/images/scribe-composer.png +0 -0
  25. package/docs/markdown-shortcodes.md +1738 -0
  26. package/docs/pentest-report-2026-04-03.md +181 -0
  27. package/docs/plans/2026-02-28-admin-topbar-login-forms.md +349 -0
  28. package/docs/plans/2026-02-28-domma-ui-polish.md +286 -0
  29. package/docs/plans/2026-02-28-reset-seed-fresh-commands.md +520 -0
  30. package/docs/plans/2026-03-02-cookie-consent-design.md +86 -0
  31. package/docs/plans/2026-03-02-cookie-consent-plugin.md +453 -0
  32. package/docs/plans/2026-03-02-tooltip-sweep-and-back-to-top-plugin-design.md +126 -0
  33. package/docs/plans/2026-03-02-tooltip-sweep-back-to-top.md +427 -0
  34. package/docs/plans/2026-03-05-cookie-consent-btt-core.md +115 -0
  35. package/docs/plans/2026-03-05-custom-css-migrate-to-core-design.md +35 -0
  36. package/docs/plans/2026-03-05-custom-css-migrate-to-core.md +352 -0
  37. package/docs/plans/2026-03-05-scribe-script-shortcode.md +373 -0
  38. package/docs/plans/2026-03-05-user-types-design.md +139 -0
  39. package/docs/plans/2026-03-05-user-types-implementation.md +1035 -0
  40. package/docs/plans/2026-03-09-page-editor-view-cta-inserts-design.md +78 -0
  41. package/docs/plans/2026-03-09-page-editor-view-cta-inserts.md +388 -0
  42. package/docs/plans/2026-03-09-pro-documentation-design.md +80 -0
  43. package/docs/plans/2026-03-09-pro-documentation.md +1017 -0
  44. package/docs/plans/2026-06-10-core-project-design.md +240 -0
  45. package/docs/plugin-development.md +827 -0
  46. package/docs/recruitment-recipe.md +501 -0
  47. package/docs/scaffolding.md +312 -0
  48. package/docs/screenshots/calculator-floating.png +0 -0
  49. package/docs/screenshots/calculator-standard.png +0 -0
  50. package/docs/screenshots/email-settings.png +0 -0
  51. package/docs/screenshots/messages-count.png +0 -0
  52. package/docs/structure/user-types.md +107 -0
  53. package/docs/superpowers/plans/2026-05-25-admin-sidebar-via-menus.md +1112 -0
  54. package/docs/superpowers/plans/2026-06-08-navbar-mobile-drawer-and-menu-enrichment.md +1161 -0
  55. package/docs/superpowers/plans/2026-06-25-domma-docs-project.md +695 -0
  56. package/docs/superpowers/plans/2026-06-26-surveys-HANDOFF.md +68 -0
  57. package/docs/superpowers/plans/2026-06-26-surveys-pro-plugin.md +1902 -0
  58. package/docs/superpowers/plans/2026-08-19-collection-context-sort-export.md +1577 -0
  59. package/docs/superpowers/plans/2026-10-09-content-api.md +1192 -0
  60. package/docs/superpowers/specs/2026-03-12-form-followup-actions-design.md +152 -0
  61. package/docs/superpowers/specs/2026-03-12-page-editor-form-insert-and-per-page-theme-design.md +115 -0
  62. package/docs/superpowers/specs/2026-03-17-nav-hidden-items-design.md +85 -0
  63. package/docs/superpowers/specs/2026-03-19-accordion-insert-design.md +175 -0
  64. package/docs/superpowers/specs/2026-03-25-static-block-shortcode-design.md +153 -0
  65. package/docs/superpowers/specs/2026-03-25-text-shortcode-design.md +168 -0
  66. package/docs/superpowers/specs/2026-04-05-card-builder-design.md +315 -0
  67. package/docs/superpowers/specs/2026-04-06-insert-builders-design.md +278 -0
  68. package/docs/superpowers/specs/2026-04-06-layouts-design.md +226 -0
  69. package/docs/superpowers/specs/2026-04-07-blog-plugin-design.md +300 -0
  70. package/docs/superpowers/specs/2026-04-07-calendar-plugin-design.md +538 -0
  71. package/docs/superpowers/specs/2026-04-17-components-area-design.md +368 -0
  72. package/docs/superpowers/specs/2026-05-02-effects-slideover-overhaul-design.md +193 -0
  73. package/docs/superpowers/specs/2026-05-06-dashboard-rebuild-design.md +257 -0
  74. package/docs/superpowers/specs/2026-05-24-menus-design.md +466 -0
  75. package/docs/superpowers/specs/2026-05-25-admin-sidebar-via-menus-design.md +358 -0
  76. package/docs/superpowers/specs/2026-05-25-projects-design.md +380 -0
  77. package/docs/superpowers/specs/2026-06-08-navbar-mobile-drawer-and-menu-enrichment-design.md +292 -0
  78. package/docs/superpowers/specs/2026-06-08-sidebar-tools-plugins-folders-design.md +59 -0
  79. package/docs/superpowers/specs/2026-06-25-domma-docs-project-design.md +192 -0
  80. package/docs/superpowers/specs/2026-06-26-domma-charts-upstream-proposal.md +44 -0
  81. package/docs/superpowers/specs/2026-06-26-manager-scheduler-upstream-proposal.md +46 -0
  82. package/docs/superpowers/specs/2026-06-26-surveys-pro-plugin-design.md +206 -0
  83. package/docs/superpowers/specs/2026-07-02-shortcode-context-menu-design.md +96 -0
  84. package/docs/superpowers/specs/2026-08-19-collection-context-sort-export-design.md +330 -0
  85. package/docs/superpowers/specs/2026-09-22-dcms-marketplace-design.md +1150 -0
  86. package/docs/superpowers/specs/2026-10-09-content-api-design.md +325 -0
  87. package/docs/superpowers/specs/plans/2026-03-12-form-followup-actions.md +624 -0
  88. package/docs/superpowers/specs/plans/2026-03-12-page-editor-form-insert-and-per-page-theme.md +125 -0
  89. package/docs/superpowers/specs/plans/2026-03-17-nav-hidden-items.md +578 -0
  90. package/docs/superpowers/specs/plans/2026-03-19-accordion-insert.md +635 -0
  91. package/docs/superpowers/specs/plans/2026-03-25-text-shortcode.md +545 -0
  92. package/docs/superpowers/specs/plans/2026-04-05-card-builder.md +1970 -0
  93. package/docs/superpowers/specs/plans/2026-04-06-insert-builders.md +1049 -0
  94. package/docs/superpowers/specs/plans/2026-04-06-layouts.md +1015 -0
  95. package/docs/superpowers/specs/plans/2026-04-07-calendar-plugin.md +1526 -0
  96. package/docs/superpowers/specs/plans/2026-04-08-plugin-monetisation-split.md +242 -0
  97. package/docs/superpowers/specs/plans/2026-04-17-components-area.md +2038 -0
  98. package/docs/superpowers/specs/plans/2026-05-02-effects-slideover-overhaul.md +2335 -0
  99. package/docs/superpowers/specs/plans/2026-05-06-dashboard-rebuild.md +1999 -0
  100. package/docs/superpowers/specs/plans/2026-05-17-cache-system.md +1436 -0
  101. package/docs/superpowers/specs/plans/2026-05-24-menus.md +3096 -0
  102. package/docs/superpowers/specs/plans/2026-05-25-projects.md +2869 -0
  103. package/docs/superpowers/specs/plans/2026-09-22-marketplace-step2-consolidation.md +505 -0
  104. package/docs/superpowers/specs/plans/2026-09-22-marketplace-step3-catalogue-and-key.md +154 -0
  105. package/docs/superpowers/specs/plans/2026-09-22-tools-promotion.md +260 -0
  106. package/docs/theming.md +320 -0
  107. package/package.json +2 -2
  108. package/plugins/_lib/admin/mail/keyboard.js +49 -0
  109. package/plugins/_lib/admin/mail/reader-view.js +4 -2
  110. package/public/js/celebrations/core/canvas.js +1 -1
  111. package/public/js/celebrations/index.js +1 -1
  112. package/public/js/celebrations/licenses/ABeeZee-Regular-OFL.txt +93 -0
  113. package/public/js/celebrations/licenses/Allura-Regular-OFL.txt +93 -0
  114. package/public/js/celebrations/message-attrs.mjs +1 -0
  115. package/public/js/celebrations/themes/anniversary.js +1 -0
  116. package/public/js/celebrations/themes/autumn.js +1 -0
  117. package/public/js/celebrations/themes/birthday.js +1 -0
  118. package/public/js/celebrations/themes/butterfly-flight.js +1 -0
  119. package/public/js/celebrations/themes/calendar.js +1 -0
  120. package/public/js/celebrations/themes/chinese-new-year-dates.js +1 -0
  121. package/public/js/celebrations/themes/chinese-new-year.js +1 -0
  122. package/public/js/celebrations/themes/christmas.js +1 -1
  123. package/public/js/celebrations/themes/easter.js +1 -0
  124. package/public/js/celebrations/themes/garden-drawing.js +1 -0
  125. package/public/js/celebrations/themes/garden.js +1 -0
  126. package/public/js/celebrations/themes/graduation.js +1 -0
  127. package/public/js/celebrations/themes/greeting.js +1 -0
  128. package/public/js/celebrations/themes/make-it-rain.js +1 -0
  129. package/public/js/celebrations/themes/money-rain.js +1 -0
  130. package/public/js/celebrations/themes/new-year.js +1 -0
  131. package/public/js/celebrations/themes/occasion-drawing.js +1 -0
  132. package/public/js/celebrations/themes/occasions.js +1 -0
  133. package/public/js/celebrations/themes/rain-control.js +1 -0
  134. package/public/js/celebrations/themes/sparkler-font-data.js +1 -0
  135. package/public/js/celebrations/themes/sparkler-font.js +1 -0
  136. package/public/js/celebrations/themes/sparkler-writing.js +1 -0
  137. package/public/js/celebrations/themes/summer-garden.js +1 -0
  138. package/public/js/celebrations/themes/winter.js +1 -0
  139. package/public/js/celebrations/trait-data.mjs +1 -1
  140. package/public/js/effects.js +1 -1
  141. package/scripts/build.js +4 -0
  142. package/server/services/markdown.js +5 -2
  143. package/server/templates/page.html +1 -1
@@ -6,4 +6,4 @@ export class CanvasManager{constructor(e={}){this.canvasId=e.canvasId||"celebrat
6
6
  height: 100vh;
7
7
  pointer-events: none;
8
8
  z-index: ${this.zIndex};
9
- `,this.ctx=this.canvas.getContext("2d",{alpha:!0}),this.resize(),document.body.appendChild(this.canvas),window.addEventListener("resize",this._handleResize))}resize(){this.canvas&&(this.canvas.width=window.innerWidth,this.canvas.height=window.innerHeight)}clear(){this.ctx&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}getDimensions(){return{width:this.canvas?.width||0,height:this.canvas?.height||0}}isMobile(){return window.innerWidth<768}destroy(){window.removeEventListener("resize",this._handleResize),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null,this.ctx=null}_handleResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resize(),this.resizeCallback&&this.resizeCallback()},250)}}
9
+ `,this.ctx=this.canvas.getContext("2d",{alpha:!0}),this.resize(),document.body.appendChild(this.canvas),window.addEventListener("resize",this._handleResize))}resize(){this.canvas&&(this.canvas.width=window.innerWidth,this.canvas.height=window.innerHeight)}clear(){this.ctx&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}getDimensions(){return{width:this.canvas?.width||0,height:this.canvas?.height||0}}isMobile(){return window.innerWidth<768}destroy(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=null,window.removeEventListener("resize",this._handleResize),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null,this.ctx=null}_handleResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resize(),this.resizeCallback&&this.resizeCallback()},250)}}
@@ -1 +1 @@
1
- var w=Object.defineProperty;var b=(u,e,i)=>e in u?w(u,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[e]=i;var v=(u,e,i)=>b(u,typeof e!="symbol"?e+"":e,i);export{mountCharacter,getCharacters,CHARACTER_SIZES}from"./characters.js";import{resolveCelebrationTraits as M}from"./trait-data.mjs";import{CanvasManager as P}from"./core/canvas.js";import{PhysicsEngine as C,updateMovingParticle as z,updateParticlePhysics as j}from"./core/physics.js";import{createParticle as F}from"./core/particles.js";const c=class c{static isDateInRange(e,i,s,o){const l=new Date,n=l.getMonth()+1,d=l.getDate();return s<e?n===e&&d>=i||n>e||n<e&&n<=s||n===s&&d<=o:(n>e||n===e&&d>=i)&&(n<s||n===s&&d<=o)}static getCurrentTheme(){for(const[e,i]of Object.entries(c.themes)){const[[s,o],[l,n]]=i.dates;if(c.isDateInRange(s,o,l,n))return e}return null}static isCelebrationSeason(){return c.getCurrentTheme()!==null}static getThemes(){return c.themes}constructor(e={}){this.options={theme:e.theme||"auto",intensity:e.intensity||"medium",enabled:e.enabled!==void 0?e.enabled:!0,zIndex:e.zIndex||999,overrides:e.overrides||{}},this.canvasManager=null,this.physicsEngine=null,this.themeModule=null,this.currentTheme=null,this.particles=[],this.specialParticles=[],this.animationFrame=null,this.lastTime=0,this.running=!1,this.initialized=!1}async init(){if(this.initialized){console.warn("[Celebrations] Already initialized");return}console.log("[Celebrations] Initializing...");let e=this.options.theme;if(e==="auto"&&(e=c.getCurrentTheme(),!e)){console.log("[Celebrations] No active celebration detected");return}if(!c.themes[e]){console.error(`[Celebrations] Unknown theme: ${e}`);return}this.currentTheme=e,console.log(`[Celebrations] Loading theme: ${e}`);try{const s=await import(c.themes[e].module);this.themeModule=s.default,console.log(`[Celebrations] Theme loaded: ${this.themeModule.displayName}`)}catch(i){console.error(`[Celebrations] Failed to load theme module: ${i.message}`);return}this.canvasManager=new P({canvasId:"celebrations-canvas",zIndex:this.options.zIndex}),this.canvasManager.create(),this.physicsEngine=new C({gustInterval:[5e3,15e3],gustStrength:[-2,2]}),window.addEventListener("resize",()=>{this.canvasManager.resize(),this.resetParticles()}),this.resetParticles(),this.initialized=!0,console.log("[Celebrations] Initialized successfully"),this.options.enabled&&this.start()}isParticleEnabled(e){return!this.disabledTypes?.has(e.type)}resetParticles(){const e=Object.assign({},this.themeModule.intensityConfig[this.options.intensity]),i=a=>String(a).toLowerCase().replace(/[^a-z0-9]/g,""),s=[...Object.keys(e),...this.themeModule.decorationKeys||[]],o=a=>s.find(r=>i(r)===i(a))||a,l=a=>["true","1","yes","on"].includes(String(a).toLowerCase()),n=this.themeModule.optInDecorations||{},d=Object.entries(this.options.overrides).some(([a,r])=>["snowonly","fallingonly"].includes(i(a))&&l(r));for(const a of Object.values(n))e[a.chance]=0;for(const[a,r]of Object.entries(this.options.overrides)){if((i(a)==="snowonly"||i(a)==="fallingonly")&&l(r)){for(const m of this.themeModule.decorationKeys||[])e[m]=0;continue}const p=Object.keys(n).find(m=>i(m)===i(a));if(p&&!d&&l(r)){const m=n[p];e[m.chance]=m.value}r==="off"&&(e[o(a)]=0)}const t=M(this.themeModule.name,this.options.overrides);Object.assign(e,t.config),this.disabledTypes=t.disabledTypes,this.disabledGlobals=t.disabledGlobals,this.config=e;const f=this.canvasManager.canvas.width,h=this.canvasManager.canvas.height;this.particles=[],this.specialParticles=[];const g=e.initialParticleRatio!==void 0?e.initialParticleRatio:1,y=Math.floor(e.count*g);if(this.themeModule.createFallingParticle)for(let a=0;a<y;a++){const r=this.themeModule.createFallingParticle(f,h,e);r.y=Math.random()*h,this.isParticleEnabled(r)&&this.particles.push(r)}else for(let a=0;a<y;a++){const r=F(e,f,h);r.y=Math.random()*h,this.isParticleEnabled(r)&&this.particles.push(r)}if(this.themeModule.createInitialDecorations){const a=this.themeModule.createInitialDecorations(f,h,e);this.specialParticles.push(...a.filter(r=>this.isParticleEnabled(r))),console.log(`[Celebrations] Created ${a.length} decorations`)}console.log(`[Celebrations] Created ${y}/${e.count} particles (${this.options.intensity}, ${Math.round(g*100)}% initial)`)}start(){if(!this.initialized){console.warn("[Celebrations] Cannot start - not initialized");return}if(this.running){console.warn("[Celebrations] Already running");return}console.log("[Celebrations] Starting animation"),this.running=!0,this.lastTime=performance.now(),this.animate()}pause(){this.running&&(console.log("[Celebrations] Pausing animation"),this.running=!1,this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null))}resume(){this.running||this.start()}destroy(){console.log("[Celebrations] Destroying effect"),this.pause(),this.canvasManager&&this.canvasManager.canvas&&this.canvasManager.canvas.remove(),this.particles=[],this.specialParticles=[],this.canvasManager=null,this.physicsEngine=null,this.themeModule=null,this.initialized=!1}setIntensity(e){if(!["light","medium","heavy"].includes(e)){console.error(`[Celebrations] Invalid intensity: ${e}`);return}console.log(`[Celebrations] Changing intensity to: ${e}`),this.options.intensity=e,this.resetParticles()}async setTheme(e){console.log(`[Celebrations] Changing theme to: ${e}`);const i=this.running;this.pause(),await new Promise(s=>setTimeout(s,20)),this.initialized=!1,this.canvasManager&&this.canvasManager.clear(),this.particles=[],this.specialParticles=[],this.canvasManager&&this.canvasManager.clear(),this.options.theme=e,await this.init(),i&&this.start()}animate(){if(!this.running)return;const e=performance.now(),i=e-this.lastTime;this.lastTime=e,this.canvasManager.clear();const s=this.canvasManager.ctx,o=this.canvasManager.canvas.width,l=this.canvasManager.canvas.height,n=this.config;this.physicsEngine.updateWind(e);const d=this.physicsEngine.getWindForce();if(this.particles.length<n.count&&Math.random()<.05&&this.themeModule.createFallingParticle){const t=this.themeModule.createFallingParticle(o,l,n);(t.y===void 0||t.y<0)&&(t.y=-20),this.isParticleEnabled(t)&&this.particles.push(t)}if(this.particles.forEach((t,f)=>{if(j(t,i,d),t.y>l+50&&(t.y=-20,t.x=Math.random()*o),t.x<-50&&(t.x=o+50),t.x>o+50&&(t.x=-50),this.themeModule.drawSnowflake&&t.type==="snowflake")this.themeModule.drawSnowflake(s,t);else if(this.themeModule["draw"+this.capitalizeFirst(t.type)]){const h="draw"+this.capitalizeFirst(t.type);this.themeModule[h](s,t,e)}else s.save(),s.globalAlpha=t.opacity,s.fillStyle=this.themeModule.colors?.primary||"#ffffff",s.beginPath(),s.arc(t.x,t.y,t.size,0,Math.PI*2),s.fill(),s.restore()}),this.themeModule.updateSpecialParticles&&this.themeModule.updateSpecialParticles(this.specialParticles,i,o,l),this.specialParticles=this.specialParticles.filter(t=>{if(!t.active||!this.isParticleEnabled(t))return!1;if(!t.static){z(t,i,e);const g=t.type==="train"?600:200;if(t.x<-g||t.x>o+g)return t.active=!1,!1}if(!isFinite(t.x)||!isFinite(t.y)||t.size&&!isFinite(t.size))return console.warn("[Celebrations] Invalid particle values, removing:",t.type),t.active=!1,!1;const h="draw"+this.capitalizeFirst(t.type);return this.themeModule[h]&&this.themeModule[h](s,t,e),!0}),this.themeModule.spawnSpecialParticle){const t=this.themeModule.spawnSpecialParticle(this.specialParticles,o,l,n);t&&this.isParticleEnabled(t)&&this.specialParticles.push(t)}this.themeModule.drawGlobalEffects&&!this.disabledGlobals?.has("lightning")&&this.themeModule.drawGlobalEffects(s,e,o,l),this.animationFrame=requestAnimationFrame(()=>this.animate())}capitalizeFirst(e){if(!e)return"";const i=e.replace(/-([a-z])/g,(s,o)=>o.toUpperCase());return i.charAt(0).toUpperCase()+i.slice(1)}};v(c,"themes",{christmas:{module:"./themes/christmas.js?v=20261003-characters",dates:[[12,1],[1,1]],displayName:"Christmas",emoji:"\u{1F384}"},halloween:{module:"./themes/halloween.js?v=20261003-characters",dates:[[10,26],[10,31]],displayName:"Halloween",emoji:"\u{1F383}"},valentines:{module:"./themes/valentines.js?v=20261003-characters",dates:[[2,9],[2,14]],displayName:"Valentine's Day",emoji:"\u{1F495}"},"guy-fawkes":{module:"./themes/guy-fawkes.js?v=20261003-characters",dates:[[11,1],[11,5]],displayName:"Guy Fawkes Night",emoji:"\u{1F386}"},"st-patricks":{module:"./themes/st-patricks.js?v=20261003-characters",dates:[[3,12],[3,17]],displayName:"St Patrick's Day",emoji:"\u2618\uFE0F"},"st-andrews":{module:"./themes/st-andrews.js?v=20261003-characters",dates:[[11,25],[11,30]],displayName:"St Andrew's Day",emoji:"\u{1F3F4}\u{E0067}\u{E0062}\u{E0073}\u{E0063}\u{E0074}\u{E007F}"},"st-davids":{module:"./themes/st-davids.js?v=20261003-characters",dates:[[2,24],[3,1]],displayName:"St David's Day",emoji:"\u{1F3F4}\u{E0067}\u{E0062}\u{E0077}\u{E006C}\u{E0073}\u{E007F}"},"st-georges":{module:"./themes/st-georges.js?v=20261003-characters",dates:[[4,18],[4,23]],displayName:"St George's Day",emoji:"\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}"}});export let CelebrationsEffect=c;export default CelebrationsEffect;
1
+ var M=Object.defineProperty;var b=(d,e,s)=>e in d?M(d,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[e]=s;var v=(d,e,s)=>b(d,typeof e!="symbol"?e+"":e,s);export{mountCharacter,getCharacters,CHARACTER_SIZES}from"./characters.js";import{launchMakeItRain as w}from"./themes/rain-control.js";import{isEasterSeason as P,isChineseNewYearSeason as j}from"./themes/calendar.js";import{resolveCelebrationTraits as C}from"./trait-data.mjs";import{CanvasManager as k}from"./core/canvas.js";import{PhysicsEngine as N,updateMovingParticle as S,updateParticlePhysics as I}from"./core/physics.js";import{createParticle as z}from"./core/particles.js";const h=class h{static isDateInRange(e,s,i,n,l=new Date){const o=l.getMonth()+1,c=l.getDate();return i<e?o===e&&c>=s||o>e||o<i||o===i&&c<=n:(o>e||o===e&&c>=s)&&(o<i||o===i&&c<=n)}static getCurrentTheme(e=new Date){for(const[s,i]of Object.entries(h.themes)){if(i.isInSeason){if(i.isInSeason(e))return s;continue}if(!i.dates)continue;const[[n,l],[o,c]]=i.dates;if(h.isDateInRange(n,l,o,c,e))return s}return null}static isCelebrationSeason(){return h.getCurrentTheme()!==null}static getThemes(){return h.themes}constructor(e={}){this.options={theme:e.theme||(e.message?"greeting":"auto"),intensity:e.intensity||"medium",enabled:e.enabled!==void 0?e.enabled:!0,zIndex:e.zIndex||999,overrides:{...e.overrides||{},...typeof e.message=="string"?{message:e.message}:{}}},this.canvasManager=null,this.physicsEngine=null,this.themeModule=null,this.currentTheme=null,this.particles=[],this.specialParticles=[],this.animationFrame=null,this.lastTime=0,this.running=!1,this.initialized=!1}async init(){if(this.initialized){console.warn("[Celebrations] Already initialized");return}console.log("[Celebrations] Initializing...");let e=this.options.theme;if(e==="auto"&&this.options.overrides.message&&(e="greeting"),e==="auto"&&(e=h.getCurrentTheme(),!e)){console.log("[Celebrations] No active celebration detected");return}if(!h.themes[e]){console.error(`[Celebrations] Unknown theme: ${e}`);return}this.currentTheme=e,console.log(`[Celebrations] Loading theme: ${e}`);try{const i=await import(h.themes[e].module);this.themeModule=i.default;const n=this.options.overrides.message||this.themeModule.defaultMessage;if(n){const{prepareSparklerFont:l}=await import("./themes/sparkler-font.js");await l(n)}console.log(`[Celebrations] Theme loaded: ${this.themeModule.displayName}`)}catch(s){console.error(`[Celebrations] Failed to load theme module: ${s.message}`);return}this.canvasManager=new k({canvasId:"celebrations-canvas",zIndex:this.options.zIndex,onResize:()=>{this.initialized&&this.resetParticles()}}),this.canvasManager.create(),this.physicsEngine=new N({gustInterval:[5e3,15e3],gustStrength:[-2,2]}),this.resetParticles(),this.initialized=!0,console.log("[Celebrations] Initialized successfully"),this.options.enabled&&this.start()}isParticleEnabled(e){return!this.disabledTypes?.has(e.type)}resetParticles(){const e=Object.assign({},this.themeModule.intensityConfig[this.options.intensity]);e.sparkler={message:this.options.overrides.message,style:this.options.overrides["sparkler-style"],colour:this.options.overrides["sparkler-colour"]||this.options.overrides["sparkler-color"],greeting:this.options.overrides["sparkler-greeting"],year:this.options.overrides["sparkler-year"]};const s=a=>String(a).toLowerCase().replace(/[^a-z0-9]/g,""),i=[...Object.keys(e),...this.themeModule.decorationKeys||[]],n=a=>i.find(r=>s(r)===s(a))||a,l=a=>["true","1","yes","on"].includes(String(a).toLowerCase()),o=this.themeModule.optInDecorations||{},c=Object.entries(this.options.overrides).some(([a,r])=>["snowonly","fallingonly"].includes(s(a))&&l(r));for(const a of Object.values(o))e[a.chance]=0;for(const[a,r]of Object.entries(this.options.overrides)){if((s(a)==="snowonly"||s(a)==="fallingonly")&&l(r)){for(const u of this.themeModule.decorationKeys||[])e[u]=0;continue}const p=Object.keys(o).find(u=>s(u)===s(a));if(p&&!c&&l(r)){const u=o[p];e[u.chance]=u.value}r==="off"&&(e[n(a)]=0)}const t=C(this.themeModule.name,this.options.overrides);Object.assign(e,t.config),this.disabledTypes=t.disabledTypes,this.disabledGlobals=t.disabledGlobals,this.config=e;const g=this.canvasManager.canvas.width,m=this.canvasManager.canvas.height;this.particles=[],this.specialParticles=[];const f=e.initialParticleRatio!==void 0?e.initialParticleRatio:1,y=Math.floor(e.count*f);if(this.themeModule.createFallingParticle)for(let a=0;a<y;a++){const r=this.themeModule.createFallingParticle(g,m,e);r.y=Math.random()*m,this.isParticleEnabled(r)&&this.particles.push(r)}else for(let a=0;a<y;a++){const r=z(e,g,m);r.y=Math.random()*m,this.isParticleEnabled(r)&&this.particles.push(r)}if(this.themeModule.createInitialDecorations){const a=this.themeModule.createInitialDecorations(g,m,e);this.specialParticles.push(...a.filter(r=>this.isParticleEnabled(r))),console.log(`[Celebrations] Created ${a.length} decorations`)}console.log(`[Celebrations] Created ${y}/${e.count} particles (${this.options.intensity}, ${Math.round(f*100)}% initial)`)}start(){if(!this.initialized){console.warn("[Celebrations] Cannot start - not initialized");return}if(this.running){console.warn("[Celebrations] Already running");return}console.log("[Celebrations] Starting animation"),this.running=!0,this.lastTime=performance.now(),this.animate()}pause(){this.running&&(console.log("[Celebrations] Pausing animation"),this.running=!1,this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null))}resume(){this.running||this.start()}destroy(){console.log("[Celebrations] Destroying effect"),this.pause(),this.canvasManager&&this.canvasManager.destroy(),this.particles=[],this.specialParticles=[],this.canvasManager=null,this.physicsEngine=null,this.themeModule=null,this.initialized=!1}setIntensity(e){if(!["light","medium","heavy"].includes(e)){console.error(`[Celebrations] Invalid intensity: ${e}`);return}console.log(`[Celebrations] Changing intensity to: ${e}`),this.options.intensity=e,this.resetParticles()}async setTheme(e){console.log(`[Celebrations] Changing theme to: ${e}`);const s=this.running;this.pause(),await new Promise(i=>setTimeout(i,20)),this.initialized=!1,this.canvasManager&&this.canvasManager.clear(),this.particles=[],this.specialParticles=[],this.canvasManager&&this.canvasManager.clear(),this.options.theme=e,await this.init(),s&&this.start()}animate(){if(!this.running)return;const e=performance.now(),s=e-this.lastTime;this.lastTime=e,this.canvasManager.clear();const i=this.canvasManager.ctx,n=this.canvasManager.canvas.width,l=this.canvasManager.canvas.height,o=this.config;this.physicsEngine.updateWind(e);const c=this.physicsEngine.getWindForce();if(this.particles.length<o.count&&Math.random()<.05&&this.themeModule.createFallingParticle){const t=this.themeModule.createFallingParticle(n,l,o);(t.y===void 0||t.y<0)&&(t.y=-20),this.isParticleEnabled(t)&&this.particles.push(t)}if(this.particles.forEach((t,g)=>{if(I(t,s,c),t.y>l+50&&(t.y=-20,t.x=Math.random()*n),t.x<-50&&(t.x=n+50),t.x>n+50&&(t.x=-50),this.themeModule.drawSnowflake&&t.type==="snowflake")this.themeModule.drawSnowflake(i,t);else if(this.themeModule["draw"+this.capitalizeFirst(t.type)]){const m="draw"+this.capitalizeFirst(t.type);this.themeModule[m](i,t,e)}else i.save(),i.globalAlpha=t.opacity,i.fillStyle=this.themeModule.colors?.primary||"#ffffff",i.beginPath(),i.arc(t.x,t.y,t.size,0,Math.PI*2),i.fill(),i.restore()}),this.themeModule.updateSpecialParticles&&this.themeModule.updateSpecialParticles(this.specialParticles,s,n,l),this.specialParticles=this.specialParticles.filter(t=>{if(!t.active||!this.isParticleEnabled(t))return!1;if(!t.static){S(t,s,e);const f=t.type==="train"?600:200;if(t.x<-f||t.x>n+f)return t.active=!1,!1}if(!isFinite(t.x)||!isFinite(t.y)||t.size&&!isFinite(t.size))return console.warn("[Celebrations] Invalid particle values, removing:",t.type),t.active=!1,!1;const m="draw"+this.capitalizeFirst(t.type);return this.themeModule[m]&&this.themeModule[m](i,t,e),!0}),this.themeModule.spawnSpecialParticle){const t=this.themeModule.spawnSpecialParticle(this.specialParticles,n,l,o);t&&this.isParticleEnabled(t)&&this.specialParticles.push(t)}this.themeModule.drawGlobalEffects&&!this.disabledGlobals?.has("lightning")&&this.themeModule.drawGlobalEffects(i,e,n,l),this.animationFrame=requestAnimationFrame(()=>this.animate())}capitalizeFirst(e){if(!e)return"";const s=e.replace(/-([a-z])/g,(i,n)=>n.toUpperCase());return s.charAt(0).toUpperCase()+s.slice(1)}};v(h,"themes",{"chinese-new-year":{module:"./themes/chinese-new-year.js?v=20261015-occasions",dates:null,isInSeason:j,displayName:"Chinese New Year",emoji:"\u{1F409}"},"new-year":{module:"./themes/new-year.js?v=20261015-occasions",dates:[[12,31],[1,2]],displayName:"New Year",emoji:"\u{1F389}"},easter:{module:"./themes/easter.js?v=20261015-occasions",dates:null,isInSeason:P,displayName:"Easter",emoji:"\u{1F423}"},"summer-garden":{module:"./themes/summer-garden.js?v=20261015-occasions",dates:[[6,1],[8,31]],displayName:"Summer Garden",emoji:"\u{1F33C}"},christmas:{module:"./themes/christmas.js?v=20261015-occasions",dates:[[12,1],[12,30]],displayName:"Christmas",emoji:"\u{1F384}"},halloween:{module:"./themes/halloween.js?v=20261003-characters",dates:[[10,26],[10,31]],displayName:"Halloween",emoji:"\u{1F383}"},valentines:{module:"./themes/valentines.js?v=20261003-characters",dates:[[2,9],[2,14]],displayName:"Valentine's Day",emoji:"\u{1F495}"},"guy-fawkes":{module:"./themes/guy-fawkes.js?v=20261003-characters",dates:[[11,1],[11,5]],displayName:"Guy Fawkes Night",emoji:"\u{1F386}"},"st-patricks":{module:"./themes/st-patricks.js?v=20261003-characters",dates:[[3,12],[3,17]],displayName:"St Patrick's Day",emoji:"\u2618\uFE0F"},"st-andrews":{module:"./themes/st-andrews.js?v=20261003-characters",dates:[[11,25],[11,30]],displayName:"St Andrew's Day",emoji:"\u{1F3F4}\u{E0067}\u{E0062}\u{E0073}\u{E0063}\u{E0074}\u{E007F}"},"st-davids":{module:"./themes/st-davids.js?v=20261003-characters",dates:[[2,24],[3,1]],displayName:"St David's Day",emoji:"\u{1F3F4}\u{E0067}\u{E0062}\u{E0077}\u{E006C}\u{E0073}\u{E007F}"},"st-georges":{module:"./themes/st-georges.js?v=20261003-characters",dates:[[4,18],[4,23]],displayName:"St George's Day",emoji:"\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}"}}),(()=>{h.themes.winter={module:"./themes/winter.js?v=20261015-occasions",dates:[[12,1],[2,28]],displayName:"Winter",emoji:"\u2744\uFE0F"},h.themes["make-it-rain"]={module:"./themes/make-it-rain.js?v=20261015-occasions",dates:null,displayName:"Make it rain",emoji:"\u{1F327}\uFE0F"},h.themes["money-rain"]={module:"./themes/money-rain.js?v=20261015-occasions",dates:null,displayName:"Money Rain",emoji:"\u{1F4B8}"};for(const[e,s,i]of[["graduation","Graduation","\u{1F393}"],["birthday","Birthday","\u{1F382}"],["anniversary","Anniversary","\u{1F48D}"],["greeting","Sparkler greeting","\u2728"]])h.themes[e]={module:`./themes/${e}.js?v=20261015-occasions`,dates:null,displayName:s,emoji:i};h.themes.autumn={module:"./themes/autumn.js?v=20261015-occasions",dates:[[9,1],[11,30]],displayName:"Autumn",emoji:"\u{1F342}"}})();export let CelebrationsEffect=h;export default CelebrationsEffect;export function makeItRain(d={}){return w(CelebrationsEffect,d)}export function moneyRain(d={}){return w(CelebrationsEffect,d,"money-rain")}
@@ -0,0 +1,93 @@
1
+ Copyright 2011 The ABeeZee Project Authors (https://github.com/googlefonts/abeezee), with Reserved Font Name 'ABeeZee'
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2010 The Allura Project Authors (https://github.com/googlefonts/allura)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1 @@
1
+ export function encodeMessageAttribute(t){const e={"&":"&amp;",'"':"&quot;","[":"&#91;","]":"&#93;","<":"&lt;",">":"&gt;"};return String(t).replace(/[&"\[\]<>]/g,n=>e[n])}export function decodeMessageAttribute(t){const e={amp:"&",quot:'"',apos:"'",lt:"<",gt:">","#91":"[","#93":"]"};return String(t).replace(/&(amp|quot|apos|lt|gt|#91|#93);/g,(n,o)=>e[o])}
@@ -0,0 +1 @@
1
+ import{createOccasionTheme as e}from"./occasions.js";export default e("anniversary");
@@ -0,0 +1 @@
1
+ const m=["#d98b39","#b9553b","#d8b74b","#a86438","#d77c4a"],t=(e,o,a,r,n={})=>({type:e,x:o,y:a,size:r,vx:0,vy:0,opacity:.95,static:!0,active:!0,phase:Math.random()*Math.PI*2,...n});function i(e,o){return![o.x,o.y,o.size].every(Number.isFinite)||o.size<=0?!1:(e.save(),e.translate(o.x,o.y),e.scale(o.size,o.size),e.globalAlpha*=o.opacity,e.lineCap="round",e.lineJoin="round",!0)}function l(e,o,a,r,n,s){e.beginPath(),e.ellipse(o,a,r,n,0,0,Math.PI*2),e.fillStyle=s,e.fill()}const u={name:"autumn",displayName:"Autumn",emoji:"\u{1F342}",colors:{primary:"#d98b39"},intensityConfig:{light:{count:20,speedRange:[.4,.8],sizeRange:[7,12],trees:2,acorns:3,mushrooms:2},medium:{count:40,speedRange:[.6,1.2],sizeRange:[9,16],trees:3,acorns:5,mushrooms:3},heavy:{count:70,speedRange:[.8,1.6],sizeRange:[12,20],trees:5,acorns:8,mushrooms:5}},particles:["maple-leaf","oak-leaf"],decorations:["autumn-tree","acorn","mushroom"],traits:{mapleLeaf:{label:"Maple leaves",types:["maple-leaf"],kind:"particle"},oakLeaf:{label:"Oak leaves",types:["oak-leaf"],kind:"particle"},tree:{label:"Autumn trees",types:["autumn-tree"],count:"trees"},acorn:{label:"Acorns",types:["acorn"],count:"acorns"},mushroom:{label:"Mushrooms",types:["mushroom"],count:"mushrooms"}},createFallingParticle(e,o,a){return t(Math.random()<.5?"maple-leaf":"oak-leaf",Math.random()*e,-30,a.sizeRange[0]+Math.random()*(a.sizeRange[1]-a.sizeRange[0]),{static:!1,speed:a.speedRange[0]+Math.random()*(a.speedRange[1]-a.speedRange[0]),windOffset:Math.random()*Math.PI*2,windSpeed:.018,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.022,color:m[Math.floor(Math.random()*m.length)]})},createInitialDecorations(e,o,a){const r=[],n=Math.min(1,e/600);for(let s=0;s<a.trees;s++)r.push(t("autumn-tree",(s+.5)*e/a.trees,o-3,(36+Math.random()*12)*n));for(let s=0;s<a.acorns;s++)r.push(t("acorn",(s+.8)*e/(a.acorns+1),o-4,12*n,{rotation:(Math.random()-.5)*.8}));for(let s=0;s<a.mushrooms;s++)r.push(t("mushroom",(s+.3)*e/a.mushrooms,o-2,(13+Math.random()*5)*n));return r},drawMapleLeaf(e,o,a){if(!i(e,o))return;e.rotate(o.rotation),e.scale(.35+Math.abs(Math.sin(a/800+o.phase))*.65,1);const r=[[0,-1],[.2,-.42],[.55,-.68],[.5,-.17],[1,-.22],[.72,.2],[.9,.36],[.15,.65],[0,.95],[-.15,.65],[-.9,.36],[-.72,.2],[-1,-.22],[-.5,-.17],[-.55,-.68],[-.2,-.42]];e.beginPath(),e.moveTo(...r[0]);for(const n of r.slice(1))e.lineTo(...n);e.closePath(),e.fillStyle=o.color,e.fill(),e.strokeStyle="#795334",e.lineWidth=.035,e.beginPath(),e.moveTo(0,1.2),e.lineTo(0,-.8);for(const n of[-1,1])e.moveTo(0,.5),e.lineTo(n*.77,.22),e.moveTo(0,.05),e.lineTo(n*.45,-.46);e.stroke(),e.restore()},drawOakLeaf(e,o,a){if(i(e,o)){e.rotate(o.rotation),e.scale(.4+Math.abs(Math.sin(a/950+o.phase))*.6,1),e.beginPath(),e.moveTo(0,-1.1);for(const r of[1,-1]){const n=r===1?[-.9,-.45,0,.45]:[.45,0,-.45,-.9];for(const s of n)e.quadraticCurveTo(r*.95,s+(r===1?.1:-.1),r*.27,s+(r===1?.35:-.35))}e.closePath(),e.fillStyle=o.color,e.fill(),e.beginPath(),e.moveTo(0,1.25),e.lineTo(0,-.95),e.strokeStyle="#856037",e.lineWidth=.035,e.stroke(),e.restore()}},drawAutumnTree(e,o){if(i(e,o)){e.strokeStyle="#74543b",e.lineWidth=.16,e.beginPath(),e.moveTo(0,0),e.lineTo(0,-1.75);for(const a of[-1,1])e.moveTo(0,-.65),e.lineTo(a*.65,-1.55),e.moveTo(0,-1.2),e.lineTo(a*.4,-2.1);e.stroke();for(const[a,r,n,s]of[[0,-2.1,.75,"#bf793b"],[-.63,-1.6,.65,"#d69442"],[.59,-1.67,.7,"#aa6035"],[0,-1.5,.65,"#d2a044"],[-.1,-2.45,.4,"#dfb457"]])l(e,a,r,n,n*.9,s);e.restore()}},drawAcorn(e,o){if(i(e,o)){e.rotate(o.rotation||0),l(e,0,-.55,.46,.65,"#bb8d54"),l(e,-.13,-.59,.25,.5,"#d4aa70"),l(e,0,-1.02,.56,.28,"#7d6446"),e.beginPath(),e.moveTo(0,-1.2),e.quadraticCurveTo(-.1,-1.5,.12,-1.5),e.strokeStyle="#70543b",e.lineWidth=.11,e.stroke();for(let a=-2;a<=2;a++)e.beginPath(),e.moveTo(a*.16-.08,-1.12),e.lineTo(a*.16+.08,-.95),e.strokeStyle="#a18a60",e.lineWidth=.025,e.stroke();e.restore()}},drawMushroom(e,o){if(i(e,o)){e.fillStyle="#e9d9b9",e.fillRect(-.16,-.95,.32,.95),l(e,0,-.88,.72,.2,"#e2cbaa"),e.beginPath(),e.moveTo(-.75,-.95),e.bezierCurveTo(-.65,-2.1,.65,-2.1,.75,-.95),e.quadraticCurveTo(0,-.78,-.75,-.95),e.fillStyle="#a66a4c",e.fill();for(const[a,r]of[[-.3,-1.3],[.2,-1.53],[.4,-1.18]])l(e,a,r,.1,.055,"#d7b48a");e.restore()}}};export default u;
@@ -0,0 +1 @@
1
+ import{createOccasionTheme as e}from"./occasions.js";export default e("birthday");
@@ -0,0 +1 @@
1
+ export const MEADOW_COLOURS=["#84cc16","#a3e635","#bbf7d0","#bae6fd","#fef08a","#ddd6fe"];const h=()=>MEADOW_COLOURS[Math.floor(Math.random()*MEADOW_COLOURS.length)];export function createGardenButterfly(a,d,e=1){const n=-Math.PI/2+(Math.random()-.5)*1.2;return{type:"garden-butterfly",static:!0,active:!0,x:Math.random()*a,y:d*(.6+Math.random()*.3),vx:0,vy:0,size:(20+Math.random()*12)*e,opacity:.95,heading:n,targetHeading:n,flightSpeed:.6+Math.random()*.8,wanderTimer:Math.random()*60,flapPhase:Math.random()*Math.PI*2,flapSpeed:.18+Math.random()*.12,colourUpper:h(),colourLower:h()}}export function updateGardenButterfly(a,d,e,n){const t=Math.min(100,Math.max(0,d))/16.666666666666668;a.wanderTimer-=t,a.wanderTimer<=0&&(a.targetHeading=-Math.PI/2+(Math.random()-.5)*1.4,a.wanderTimer=30+Math.random()*60);let r=a.targetHeading-a.heading;for(;r>Math.PI;)r-=Math.PI*2;for(;r<-Math.PI;)r+=Math.PI*2;a.heading+=r*(1-.95**t),a.x+=(Math.cos(a.heading)*a.flightSpeed+Math.sin(a.flapPhase)*.3)*t,a.y+=(Math.sin(a.heading)*a.flightSpeed-.4)*t,a.flapPhase+=a.flapSpeed*t,a.x>e+35&&(a.x=-35),a.x<-35&&(a.x=e+35),a.y<-a.size&&(a.y=n+a.size,a.x=Math.random()*e)}
@@ -0,0 +1 @@
1
+ import{CHINESE_NEW_YEAR_DATES as m}from"./chinese-new-year-dates.js";export function easterSunday(t){const e=t%19,n=Math.floor(t/100),o=t%100,a=Math.floor(n/4),c=n%4,r=Math.floor((n+8)/25),l=Math.floor((n-r+1)/3),s=(19*e+n-a-l+15)%30,h=Math.floor(o/4),D=o%4,f=(32+2*c+2*h-s-D)%7,u=Math.floor((e+11*s+22*f)/451),g=Math.floor((s+f-7*u+114)/31),M=(s+f-7*u+114)%31+1;return new Date(t,g-1,M,12)}export function isEasterSeason(t=new Date){const e=easterSunday(t.getFullYear()),n=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),o=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),a=(n-o)/864e5;return a>=-5&&a<=1}const i=new Map;export function chineseNewYear(t){const e=m[t];if(e)return new Date(t,e[0]-1,e[1],12);if(!i.has(t)){let o=null;try{const a=new Intl.DateTimeFormat("en-u-ca-chinese",{month:"numeric",day:"numeric",timeZone:"UTC"});if(a.resolvedOptions().calendar==="chinese")for(let c=21;c<=51;c++){const r=new Date(Date.UTC(t,0,c,12)),l=a.formatToParts(r);if(l.find(s=>s.type==="month")?.value==="1"&&l.find(s=>s.type==="day")?.value==="1"){o=[r.getUTCMonth(),r.getUTCDate()];break}}}catch{}i.set(t,o)}const n=i.get(t);return n?new Date(t,n[0],n[1],12):null}export function isChineseNewYearSeason(t=new Date){const e=chineseNewYear(t.getFullYear());if(!e)return!1;const n=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),o=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate());return n>=o&&n<=o+6*864e5}
@@ -0,0 +1 @@
1
+ export const CHINESE_NEW_YEAR_DATES={2020:[1,25],2021:[2,12],2022:[2,1],2023:[1,22],2024:[2,10],2025:[1,29],2026:[2,17],2027:[2,6],2028:[1,26],2029:[2,13],2030:[2,3],2031:[1,23],2032:[2,11],2033:[1,31],2034:[2,19],2035:[2,8],2036:[1,28],2037:[2,15],2038:[2,4],2039:[1,24],2040:[2,12],2041:[2,1],2042:[1,22],2043:[2,10],2044:[1,30],2045:[2,17],2046:[2,6],2047:[1,26],2048:[2,14],2049:[2,2],2050:[1,23]};
@@ -0,0 +1 @@
1
+ import d from"./new-year.js";import{createSparklerMessage as g}from"./sparkler-writing.js";const p=(e,r,i,n,a={})=>({type:e,x:r,y:i,size:n,opacity:1,active:!0,static:!0,vx:0,vy:0,phase:Math.random()*Math.PI*2,age:0,...a});function c(e,r){return![r.x,r.y,r.size].every(Number.isFinite)||r.size<=0?!1:(e.save(),e.translate(r.x,r.y),e.scale(r.size,r.size),e.globalAlpha*=r.opacity??1,e.lineCap="round",e.lineJoin="round",!0)}function f(e,r,i,n,a,o){e.beginPath(),e.ellipse(r,i,n,a,0,0,Math.PI*2),e.fillStyle=o,e.fill()}function t(e,r,i,n){e.beginPath(),e.moveTo(...r[0]);for(const a of r.slice(1))e.lineTo(...a);e.strokeStyle=i,e.lineWidth=n,e.stroke()}export default{name:"chinese-new-year",displayName:"Chinese New Year",emoji:"\u{1F409}",colors:{primary:"#d54339"},intensityConfig:{light:{count:20,speedRange:[.5,1],sizeRange:[3,6],lanterns:2,fireworkChance:.008},medium:{count:45,speedRange:[.7,1.3],sizeRange:[4,7],lanterns:4,fireworkChance:.015},heavy:{count:80,speedRange:[.9,1.6],sizeRange:[5,9],lanterns:6,fireworkChance:.025}},particles:["confetti"],decorations:["lantern","chinese-dragon","new-year-firework","sparkler-message"],traits:{confetti:{label:"Red and gold confetti",types:["confetti"],kind:"particle"},lantern:{label:"Red lanterns",types:["lantern"],count:"lanterns"},dragon:{label:"Chinese dragon",types:["chinese-dragon"]},firework:{label:"Fireworks",types:["new-year-firework"],chance:"fireworkChance"},sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]}},createFallingParticle(e,r,i){return{...d.createFallingParticle(e,r,i),type:"confetti",color:Math.random()<.55?"#d54339":"#efc764"}},createInitialDecorations(e,r,i){const n=Math.min(1,e/600),a=[g("\u65B0\u5E74\u5FEB\u4E50",e,r,i.sparkler),p("chinese-dragon",e*.72,r*.42,Math.min(32,e/20),{baseY:r*.42})];for(let o=0;o<i.lanterns;o++){const s=o%2;a.push(p("lantern",s?e-(35+o*16)*n:(35+o*16)*n,(90+o*32)*n,28*n))}return i.fireworkChance>0&&a.push(this.createFirework(e,r)),a},createFirework(e,r){return{...d.createFirework(e,r),color:Math.random()<.5?"#f0c354":"#e76647"}},spawnSpecialParticle:d.spawnSpecialParticle,updateSpecialParticles(e,r,i=1024){d.updateSpecialParticles(e,r);for(const n of e)n.type==="chinese-dragon"&&(n.age+=Math.max(0,r),n.x+=r*.025,n.y=n.baseY+Math.sin(n.age/1800)*n.size*.6,n.x>i+n.size*10&&(n.x=-n.size*2))},drawConfetti:d.drawConfetti,drawNewYearFirework:d.drawNewYearFirework,drawSparklerMessage:d.drawSparklerMessage,drawLantern(e,r,i){if(!c(e,r))return;e.rotate(Math.sin(i/1800+r.phase)*.065),t(e,[[0,-2.2],[0,-.9]],"#ae8644",.025);const n=e.createLinearGradient(-.8,0,.8,0);n.addColorStop(0,"#9f2b2c"),n.addColorStop(.45,"#ee6550"),n.addColorStop(1,"#ac3030"),f(e,0,0,.85,.95,n);for(const a of[-1,1])e.beginPath(),e.moveTo(a*.2,-.9),e.bezierCurveTo(a*.65,-.3,a*.65,.3,a*.2,.9),e.strokeStyle="#edbe62",e.lineWidth=.025,e.stroke();for(const a of[-.9,.9])e.fillStyle="#d9aa52",e.fillRect(-.3,a-.07,.6,.14);t(e,[[0,.95],[0,1.25]],"#d9aa52",.04),f(e,0,1.22,.09,.09,"#f0c96c");for(let a=-2;a<=2;a++)t(e,[[a*.035,1.3],[a*.07,1.85]],"#daba62",.025);e.restore()},drawChineseDragon(e,r){if(!c(e,r))return;const i=r.age/700+r.phase,n=a=>[-a*.46,Math.sin(a*.58-i)*.55];for(const a of[4,10]){const[o,s]=n(a);for(const l of[-1,1]){t(e,[[o,s],[o-.2,s+l*.6],[o+.25,s+l*.8]],"#b84635",.15);for(let h=0;h<3;h++)t(e,[[o+.2,s+l*.8],[o+.5,s+l*(.66+h*.12)]],"#e8bc64",.035)}}for(let a=17;a>=0;a--){const[o,s]=n(a),l=a>12?.34*(18-a)/6:.34;e.fillStyle="#efc35d",e.beginPath(),e.moveTo(o-.2,s-l),e.lineTo(o-.37,s-l-.3),e.lineTo(o+.17,s-l*.7),e.fill(),f(e,o,s,l*1.4,l,"#a7312d"),f(e,o,s-.07,l*1.25,l*.8,a%2?"#d14c38":"#df6243"),t(e,[[o-.13,s+l*.5],[o,s+l*.78],[o+.15,s+l*.5]],"#e8b85a",.035)}e.translate(.15,n(0)[1]);for(let a=0;a<8;a++){const o=a*Math.PI/7+Math.PI/2;t(e,[[Math.cos(o)*.35,Math.sin(o)*.4],[Math.cos(o)*.8-.15,Math.sin(o)*.8]],"#e7b856",.12)}t(e,[[-.1,-.3],[-.35,-1.05],[-.1,-1.3]],"#e8ca8a",.095),t(e,[[-.3,-.9],[-.6,-1.06]],"#e8ca8a",.065),t(e,[[.2,-.3],[.35,-.95],[.62,-1.08]],"#e8ca8a",.085),f(e,0,0,.57,.5,"#d94f37"),f(e,.53,.16,.54,.27,"#e2a44f"),f(e,.75,.05,.24,.17,"#b74330"),f(e,.85,0,.045,.04,"#513b30"),f(e,.25,-.18,.18,.14,"#f3d778"),f(e,.3,-.18,.055,.1,"#294d42"),f(e,.32,-.21,.022,.028,"#fff4d8"),t(e,[[.05,-.38],[.42,-.34]],"#e4bc62",.075),t(e,[[.35,.3],[.9,.3]],"#78382c",.03);for(const a of[-1,1])e.beginPath(),e.moveTo(.7,.22),e.bezierCurveTo(1.5,a*.8,1.65,a*.85,1.9,a*.3),e.strokeStyle="#efcf88",e.lineWidth=.035,e.stroke();e.restore()}};
@@ -1 +1 @@
1
- import{createParticle as T}from"./../core/particles.js";import{drawSleigh as c,drawTrain as C}from"./christmas-vehicles.js";import{drawTree as z,drawWreath as P,drawRobin as x,drawElf as b,drawSnowman as E,TREE_GIFTS as Y}from"./christmas-festive.js";import{drawMooningElf as R}from"./mooning-drawing.js";import{spawnMooningCharacter as I,updateMooningCharacter as X}from"./mooning-antics.js";import{spawnElfAntic as F,updateElfAntic as A}from"./christmas-antics.js";export default{name:"christmas",displayName:"Christmas",emoji:"\u{1F384}",intensityConfig:{light:{count:50,speedRange:[.5,1.5],sizeRange:[1,3],trees:3,wreaths:2,northStars:1,snowmen:2},medium:{count:150,speedRange:[.8,2.5],sizeRange:[1,4],trees:6,wreaths:3,northStars:1,snowmen:3},heavy:{count:300,speedRange:[1,3.5],sizeRange:[1,5],trees:10,wreaths:4,northStars:1,snowmen:4}},particles:["snowflake"],decorations:["tree","wreath","sleigh","robin","train","elf","firework","north-star","snowman","peeing-elf","thieving-elf","mooning-elf"],decorationKeys:["trees","wreaths","northStars","snowmen","sleigh","elf","train","firework","robin","peeingElfChance","thievingElfChance","mooningElfChance"],optInDecorations:{mooningElf:{chance:"mooningElfChance",value:7e-4},peeingElf:{chance:"peeingElfChance",value:7e-4},thievingElf:{chance:"thievingElfChance",value:.001}},colors:{primary:"#ffffff",secondary:"#228B22",accent:"#c00",gold:"#FFD700"},createSnowflakeParticle(t,n,o){const i=T(o,t,n);return i.type="snowflake",i},createFallingParticle(t,n,o){return this.createSnowflakeParticle(t,n,o)},createTree(t,n,o={}){return{type:"tree",gifts:Y.map(i=>({...i,stolen:!1,reserved:!1})),x:o.x!==void 0?o.x:Math.random()*t,y:o.y!==void 0?o.y:Math.random()*n,vx:0,vy:0,size:20+Math.random()*15,opacity:.6+Math.random()*.3,rotation:0,rotationSpeed:0,active:!0,static:!0}},createWreath(t,n,o={}){const i=[];for(let a=0;a<20;a++){const s=a/20*Math.PI*2;i.push({angle:s,radius:.9+Math.random()*.2,thickness:.2+Math.random()*.15,color:a%2===0?"#1a6b1a":"#228B22"})}return{type:"wreath",x:o.x!==void 0?o.x:Math.random()*t,y:o.y!==void 0?o.y:Math.random()*n,vx:0,vy:0,size:15+Math.random()*10,opacity:.7+Math.random()*.2,rotation:0,rotationSpeed:0,active:!0,static:!0,shape:i}},createNorthStar(t,n,o={}){return{type:"north-star",x:o.x!==void 0?o.x:t/2,y:o.y!==void 0?o.y:80,vx:0,vy:0,size:25,opacity:1,twinklePhase:Math.random()*Math.PI*2,twinkleSpeed:.003,active:!0,static:!0}},createSnowman(t,n,o={}){return{type:"snowman",x:o.x!==void 0?o.x:Math.random()*t,y:o.y!==void 0?o.y:n-50,vx:0,vy:0,size:15+Math.random()*10,opacity:1,time:Math.random()*1e3,wavePhase:Math.random()*Math.PI*2,active:!0,static:!0}},createInitialDecorations(t,n,o){const i=[],e=o.trees??6;for(let r=0;r<e;r++)i.push(this.createTree(t,n,{x:t/(e+1)*(r+1),y:n-60-Math.random()*20}));const a=o.wreaths??3;for(let r=0;r<a;r++)i.push(this.createWreath(t,n,{x:t/(a+1)*(r+1),y:50+Math.random()*100}));o.northStars!==0&&o.northStars&&i.push(this.createNorthStar(t,n,{x:t/2,y:60}));const s=o.snowmen??3;for(let r=0;r<s;r++)i.push(this.createSnowman(t,n,{x:t/(s+1)*(r+1),y:n-50-Math.random()*10}));return i},spawnSpecialParticle(t,n,o,i={}){const e=I(t,n,o,i,"mooning-elf","mooningElfChance");if(e)return e;const a=F(t,n,o,i);if(a)return a;const s=Math.random();if(s<5e-4){if(i.sleigh===0||t.some(d=>d.type==="sleigh"))return null;const r=Math.random()<.5,f=r?-100:n+100,h=100+Math.random()*(o*.3);return{type:"sleigh",x:f,startX:f,y:h,baseY:h,targetX:r?n+100:-100,canvasWidth:n,vx:r?3+Math.random()*2:-(3+Math.random()*2),vy:0,arcHeight:150+Math.random()*100,time:0,size:15+Math.random()*10,opacity:.9,rotation:0,active:!0,static:!1}}else if(s<.0013&&i.elf!==0){const r=Math.random()<.5;return{type:"elf",x:r?-50:n+50,y:o-30,baseY:o-30,vx:r?1.5+Math.random()*1:-(1.5+Math.random()*1),waveAmplitude:3,waveFrequency:.05,waveOffset:Math.random()*Math.PI*2,time:0,size:10+Math.random()*5,opacity:.95,rotation:0,active:!0,static:!1}}else if(s<.005&&i.train!==0){if(t.some(y=>y.type==="train"))return null;const r=Math.random()<.5,f=r?-500:n+500,h=21+Math.random()*9,d=h*.72,m=o-d-10;return{type:"train",x:f,y:m,baseY:m,vx:r?4+Math.random()*2:-(4+Math.random()*2),vy:0,size:h,opacity:1,time:0,smoke:[],active:!0,static:!1,carriages:2+Math.floor(Math.random()*2)}}else{if(s<.008&&i.firework!==0)return{type:"firework",x:Math.random()*n,y:o,vx:(Math.random()-.5)*4,vy:-10-Math.random()*5,size:2+Math.random()*2,opacity:1,active:!0,static:!1,time:0,exploded:!1,explosionTime:30+Math.random()*30};if(s<.012&&i.robin!==0){if(t.some(l=>l.type==="robin"))return null;const r=Math.random()<.5,f=Math.random()*(o*.2),h=r?-50:n+50,d=10+Math.random()*5,m=Math.max(d*3,Math.min(o*.6-d*2,o*.2+Math.random()*(o*.4))),y=Math.random()*(n*.6)+n*.2;return{type:"robin",state:"flying_in",x:h,y:f,startX:h,startY:f,targetX:y,targetY:m,vx:r?.5+Math.random()*.5:-(.5+Math.random()*.5),vy:0,size:d,opacity:.95,active:!0,static:!1,sitTime:3e3+Math.random()*2e3,sitStartTime:0,flightProgress:0,time:0,waveOffset:Math.random()*Math.PI*2}}}return null},updateSpecialParticles(t,n,o=1024,i=768){t.forEach(e=>{if(e.type==="mooning-elf"){X(e,n,o);return}switch(e.time!==void 0&&(e.time+=n),e.type){case"peeing-elf":case"thieving-elf":A(e,n,o);break;case"sleigh":(e.vx>0&&e.x>e.targetX||e.vx<0&&e.x<e.targetX)&&(e.active=!1);break;case"robin":switch(e.state){case"flying_in":const a=e.targetX-e.x,s=e.targetY-e.y,r=Math.sqrt(a*a+s*s);if(r<20)e.state="sitting",e.vx=0,e.vy=0,e.sitStartTime=e.time;else{const M=a/r,g=s/r,v=3;e.vx=M*v;const u=30,w=.008,k=Math.sin(e.time*w+e.waveOffset)*u,S=Math.cos(e.time*w+e.waveOffset)*u*w;e.vy=g*v*.3+S}break;case"sitting":if(e.vx=0,e.vy=0,e.time-e.sitStartTime>e.sitTime){e.state="flying_away";const M=e.x<o/2?-4:4;e.vx=M,e.flyAwayStartTime=e.time}break;case"flying_away":const f=e.vx>0?1:-1;e.vx=f*4;const h=25,d=.01,m=e.time-e.flyAwayStartTime,y=Math.sin(m*d+e.waveOffset)*h,l=Math.cos(m*d+e.waveOffset)*h*d;e.vy=-1.5+l,(e.x<-50||e.x>o+50||e.y<-50)&&(e.active=!1);break}break;case"train":if(e.smoke||(e.smoke=[]),(e.vx>0&&e.x>o+500||e.vx<0&&e.x<-500)&&(e.active=!1),e.lastSmokeTime||(e.lastSmokeTime=0),e.time-e.lastSmokeTime>150){e.lastSmokeTime=e.time;const s=e.size*1.8/20,r=e.vx>0?1:-1,f=s*8,h=s*7,d=s*10,l=-f-s-h-d*2-s*8,M=s*70,g=s*25,u=(M-g)*.7,w=e.x+u*r,k=e.y+l,S={x:w,y:k,vx:(Math.random()-.5)*.8,vy:-.8-Math.random()*.4,size:8+Math.random()*6,opacity:.7+Math.random()*.2,fadeRate:.012+Math.random()*.008};e.smoke.push(S)}e.smoke=e.smoke.filter(a=>(a.x+=a.vx,a.y+=a.vy,a.vy*=.99,a.size*=1.02,a.opacity-=a.fadeRate,a.opacity>0));break;case"firework":if(!e.exploded){const a=e.y<=e.targetY,s=e.time>=e.explosionTime;(a||s)&&(e.exploded=!0,this.explodeFirework(e,t),e.active=!1)}break}})},drawSnowflake(t,n){t.save(),t.translate(n.x,n.y),t.rotate(n.rotation),t.globalAlpha=n.opacity,t.fillStyle="#ffffff",t.strokeStyle="#ffffff",t.lineWidth=Math.max(n.size*.15,.5);const o=6,i=n.size;for(let e=0;e<o;e++){const a=Math.PI*2*e/o;t.beginPath(),t.moveTo(0,0),t.lineTo(Math.cos(a)*i,Math.sin(a)*i),t.stroke();const s=i*.4,r=Math.PI/6,f=Math.cos(a)*(i*.6),h=Math.sin(a)*(i*.6);t.beginPath(),t.moveTo(f,h),t.lineTo(f+Math.cos(a-r)*s,h+Math.sin(a-r)*s),t.stroke(),t.beginPath(),t.moveTo(f,h),t.lineTo(f+Math.cos(a+r)*s,h+Math.sin(a+r)*s),t.stroke()}t.restore()},drawTree:z,drawWreath:P,drawNorthStar(t,n,o){const i=n.x,e=n.y,a=n.size,s=.8+Math.sin(o*n.twinkleSpeed+n.twinklePhase)*.2;t.save(),t.translate(i,e);const r=a*4*s,f=t.createRadialGradient(0,0,0,0,0,r);f.addColorStop(0,"rgba(220, 230, 240, 0.4)"),f.addColorStop(.4,"rgba(200, 210, 220, 0.2)"),f.addColorStop(1,"rgba(180, 190, 200, 0)"),t.fillStyle=f,t.beginPath(),t.arc(0,0,r,0,Math.PI*2),t.fill();const h=a*1,d=a*1.5,m=a*.12,y=t.createRadialGradient(0,0,0,0,0,a);y.addColorStop(0,"#ffffff"),y.addColorStop(.3,"#f0f0f0"),y.addColorStop(.6,"#c0c0c0"),y.addColorStop(1,"#a0a0a0"),t.shadowColor="rgba(220, 230, 240, 0.9)",t.shadowBlur=a*.8*s,t.fillStyle=y,t.beginPath(),t.moveTo(0,-d),t.lineTo(m,-m),t.lineTo(h,0),t.lineTo(m,m),t.lineTo(0,d),t.lineTo(-m,m),t.lineTo(-h,0),t.lineTo(-m,-m),t.closePath(),t.fill(),t.shadowBlur=a*1.2*s,t.shadowColor="rgba(255, 255, 255, 1)";const l=t.createRadialGradient(0,0,0,0,0,a*.3);l.addColorStop(0,"#ffffff"),l.addColorStop(.6,"#f5f5f5"),l.addColorStop(1,"rgba(200, 200, 200, 0.8)"),t.fillStyle=l,t.beginPath(),t.arc(0,0,a*.3,0,Math.PI*2),t.fill(),t.shadowBlur=0,t.restore()},drawSleigh:c,drawElf:b,drawMooningElf:R,drawPeeingElf:b,drawThievingElf:b,drawTrain:C,drawFirework(t,n){t.fillStyle=n.color||"#ffffff",t.beginPath(),t.arc(n.x,n.y,n.size,0,Math.PI*2),t.fill()},explodeFirework(t,n){const o=50+Math.random()*50,i=["#ff0000","#ffff00","#00ff00","#0000ff","#ffffff"];for(let e=0;e<o;e++){const a=Math.random()*Math.PI*2,s=Math.random()*5+2;n.push({type:"spark",x:t.x,y:t.y,vx:Math.cos(a)*s,vy:Math.sin(a)*s,size:2+Math.random()*2,opacity:1,active:!0,static:!1,color:i[Math.floor(Math.random()*i.length)]})}},drawRobin:x,drawSnowman:E};
1
+ import{createParticle as T}from"./../core/particles.js";import{drawSleigh as c,drawTrain as C}from"./christmas-vehicles.js";import{drawTree as z,drawWreath as P,drawRobin as x,drawElf as b,drawSnowman as E,TREE_GIFTS as Y}from"./christmas-festive.js";import{drawMooningElf as R}from"./mooning-drawing.js";import{spawnMooningCharacter as I,updateMooningCharacter as X}from"./mooning-antics.js";import{spawnElfAntic as F,updateElfAntic as A}from"./christmas-antics.js";import{createSparklerMessage as D,updateSparklerMessage as L,drawSparklerMessage as B}from"./sparkler-writing.js";export default{name:"christmas",displayName:"Christmas",emoji:"\u{1F384}",intensityConfig:{light:{count:50,speedRange:[.5,1.5],sizeRange:[1,3],trees:3,wreaths:2,northStars:1,snowmen:2},medium:{count:150,speedRange:[.8,2.5],sizeRange:[1,4],trees:6,wreaths:3,northStars:1,snowmen:3},heavy:{count:300,speedRange:[1,3.5],sizeRange:[1,5],trees:10,wreaths:4,northStars:1,snowmen:4}},particles:["snowflake"],decorations:["tree","wreath","sleigh","robin","train","elf","firework","north-star","snowman","peeing-elf","thieving-elf","mooning-elf","sparkler-message"],decorationKeys:["trees","wreaths","northStars","snowmen","sleigh","elf","train","firework","robin","peeingElfChance","thievingElfChance","mooningElfChance"],optInDecorations:{mooningElf:{chance:"mooningElfChance",value:7e-4},peeingElf:{chance:"peeingElfChance",value:7e-4},thievingElf:{chance:"thievingElfChance",value:.001}},colors:{primary:"#ffffff",secondary:"#228B22",accent:"#c00",gold:"#FFD700"},createSnowflakeParticle(t,o,a){const i=T(a,t,o);return i.type="snowflake",i},createFallingParticle(t,o,a){return this.createSnowflakeParticle(t,o,a)},createTree(t,o,a={}){return{type:"tree",gifts:Y.map(i=>({...i,stolen:!1,reserved:!1})),x:a.x!==void 0?a.x:Math.random()*t,y:a.y!==void 0?a.y:Math.random()*o,vx:0,vy:0,size:20+Math.random()*15,opacity:.6+Math.random()*.3,rotation:0,rotationSpeed:0,active:!0,static:!0}},createWreath(t,o,a={}){const i=[];for(let n=0;n<20;n++){const s=n/20*Math.PI*2;i.push({angle:s,radius:.9+Math.random()*.2,thickness:.2+Math.random()*.15,color:n%2===0?"#1a6b1a":"#228B22"})}return{type:"wreath",x:a.x!==void 0?a.x:Math.random()*t,y:a.y!==void 0?a.y:Math.random()*o,vx:0,vy:0,size:15+Math.random()*10,opacity:.7+Math.random()*.2,rotation:0,rotationSpeed:0,active:!0,static:!0,shape:i}},createNorthStar(t,o,a={}){return{type:"north-star",x:a.x!==void 0?a.x:t/2,y:a.y!==void 0?a.y:80,vx:0,vy:0,size:25,opacity:1,twinklePhase:Math.random()*Math.PI*2,twinkleSpeed:.003,active:!0,static:!0}},createSnowman(t,o,a={}){return{type:"snowman",x:a.x!==void 0?a.x:Math.random()*t,y:a.y!==void 0?a.y:o-50,vx:0,vy:0,size:15+Math.random()*10,opacity:1,time:Math.random()*1e3,wavePhase:Math.random()*Math.PI*2,active:!0,static:!0}},createInitialDecorations(t,o,a){const i=[D("Merry Christmas",t,o,a.sparkler)],e=a.trees??6;for(let r=0;r<e;r++)i.push(this.createTree(t,o,{x:t/(e+1)*(r+1),y:o-60-Math.random()*20}));const n=a.wreaths??3;for(let r=0;r<n;r++)i.push(this.createWreath(t,o,{x:t/(n+1)*(r+1),y:50+Math.random()*100}));a.northStars!==0&&a.northStars&&i.push(this.createNorthStar(t,o,{x:t/2,y:60}));const s=a.snowmen??3;for(let r=0;r<s;r++)i.push(this.createSnowman(t,o,{x:t/(s+1)*(r+1),y:o-50-Math.random()*10}));return i},spawnSpecialParticle(t,o,a,i={}){const e=I(t,o,a,i,"mooning-elf","mooningElfChance");if(e)return e;const n=F(t,o,a,i);if(n)return n;const s=Math.random();if(s<5e-4){if(i.sleigh===0||t.some(d=>d.type==="sleigh"))return null;const r=Math.random()<.5,f=r?-100:o+100,h=100+Math.random()*(a*.3);return{type:"sleigh",x:f,startX:f,y:h,baseY:h,targetX:r?o+100:-100,canvasWidth:o,vx:r?3+Math.random()*2:-(3+Math.random()*2),vy:0,arcHeight:150+Math.random()*100,time:0,size:15+Math.random()*10,opacity:.9,rotation:0,active:!0,static:!1}}else if(s<.0013&&i.elf!==0){const r=Math.random()<.5;return{type:"elf",x:r?-50:o+50,y:a-30,baseY:a-30,vx:r?1.5+Math.random()*1:-(1.5+Math.random()*1),waveAmplitude:3,waveFrequency:.05,waveOffset:Math.random()*Math.PI*2,time:0,size:10+Math.random()*5,opacity:.95,rotation:0,active:!0,static:!1}}else if(s<.005&&i.train!==0){if(t.some(y=>y.type==="train"))return null;const r=Math.random()<.5,f=r?-500:o+500,h=21+Math.random()*9,d=h*.72,m=a-d-10;return{type:"train",x:f,y:m,baseY:m,vx:r?4+Math.random()*2:-(4+Math.random()*2),vy:0,size:h,opacity:1,time:0,smoke:[],active:!0,static:!1,carriages:2+Math.floor(Math.random()*2)}}else{if(s<.008&&i.firework!==0)return{type:"firework",x:Math.random()*o,y:a,vx:(Math.random()-.5)*4,vy:-10-Math.random()*5,size:2+Math.random()*2,opacity:1,active:!0,static:!1,time:0,exploded:!1,explosionTime:30+Math.random()*30};if(s<.012&&i.robin!==0){if(t.some(l=>l.type==="robin"))return null;const r=Math.random()<.5,f=Math.random()*(a*.2),h=r?-50:o+50,d=10+Math.random()*5,m=Math.max(d*3,Math.min(a*.6-d*2,a*.2+Math.random()*(a*.4))),y=Math.random()*(o*.6)+o*.2;return{type:"robin",state:"flying_in",x:h,y:f,startX:h,startY:f,targetX:y,targetY:m,vx:r?.5+Math.random()*.5:-(.5+Math.random()*.5),vy:0,size:d,opacity:.95,active:!0,static:!1,sitTime:3e3+Math.random()*2e3,sitStartTime:0,flightProgress:0,time:0,waveOffset:Math.random()*Math.PI*2}}}return null},updateSpecialParticles(t,o,a=1024,i=768){t.forEach(e=>{if(e.type==="sparkler-message"){L(e,o);return}if(e.type==="mooning-elf"){X(e,o,a);return}switch(e.time!==void 0&&(e.time+=o),e.type){case"peeing-elf":case"thieving-elf":A(e,o,a);break;case"sleigh":(e.vx>0&&e.x>e.targetX||e.vx<0&&e.x<e.targetX)&&(e.active=!1);break;case"robin":switch(e.state){case"flying_in":const n=e.targetX-e.x,s=e.targetY-e.y,r=Math.sqrt(n*n+s*s);if(r<20)e.state="sitting",e.vx=0,e.vy=0,e.sitStartTime=e.time;else{const M=n/r,g=s/r,v=3;e.vx=M*v;const w=30,u=.008,k=Math.sin(e.time*u+e.waveOffset)*w,S=Math.cos(e.time*u+e.waveOffset)*w*u;e.vy=g*v*.3+S}break;case"sitting":if(e.vx=0,e.vy=0,e.time-e.sitStartTime>e.sitTime){e.state="flying_away";const M=e.x<a/2?-4:4;e.vx=M,e.flyAwayStartTime=e.time}break;case"flying_away":const f=e.vx>0?1:-1;e.vx=f*4;const h=25,d=.01,m=e.time-e.flyAwayStartTime,y=Math.sin(m*d+e.waveOffset)*h,l=Math.cos(m*d+e.waveOffset)*h*d;e.vy=-1.5+l,(e.x<-50||e.x>a+50||e.y<-50)&&(e.active=!1);break}break;case"train":if(e.smoke||(e.smoke=[]),(e.vx>0&&e.x>a+500||e.vx<0&&e.x<-500)&&(e.active=!1),e.lastSmokeTime||(e.lastSmokeTime=0),e.time-e.lastSmokeTime>150){e.lastSmokeTime=e.time;const s=e.size*1.8/20,r=e.vx>0?1:-1,f=s*8,h=s*7,d=s*10,l=-f-s-h-d*2-s*8,M=s*70,g=s*25,w=(M-g)*.7,u=e.x+w*r,k=e.y+l,S={x:u,y:k,vx:(Math.random()-.5)*.8,vy:-.8-Math.random()*.4,size:8+Math.random()*6,opacity:.7+Math.random()*.2,fadeRate:.012+Math.random()*.008};e.smoke.push(S)}e.smoke=e.smoke.filter(n=>(n.x+=n.vx,n.y+=n.vy,n.vy*=.99,n.size*=1.02,n.opacity-=n.fadeRate,n.opacity>0));break;case"firework":if(!e.exploded){const n=e.y<=e.targetY,s=e.time>=e.explosionTime;(n||s)&&(e.exploded=!0,this.explodeFirework(e,t),e.active=!1)}break}})},drawSnowflake(t,o){t.save(),t.translate(o.x,o.y),t.rotate(o.rotation),t.globalAlpha=o.opacity,t.fillStyle="#ffffff",t.strokeStyle="#ffffff",t.lineWidth=Math.max(o.size*.15,.5);const a=6,i=o.size;for(let e=0;e<a;e++){const n=Math.PI*2*e/a;t.beginPath(),t.moveTo(0,0),t.lineTo(Math.cos(n)*i,Math.sin(n)*i),t.stroke();const s=i*.4,r=Math.PI/6,f=Math.cos(n)*(i*.6),h=Math.sin(n)*(i*.6);t.beginPath(),t.moveTo(f,h),t.lineTo(f+Math.cos(n-r)*s,h+Math.sin(n-r)*s),t.stroke(),t.beginPath(),t.moveTo(f,h),t.lineTo(f+Math.cos(n+r)*s,h+Math.sin(n+r)*s),t.stroke()}t.restore()},drawTree:z,drawSparklerMessage:B,drawWreath:P,drawNorthStar(t,o,a){const i=o.x,e=o.y,n=o.size,s=.8+Math.sin(a*o.twinkleSpeed+o.twinklePhase)*.2;t.save(),t.translate(i,e);const r=n*4*s,f=t.createRadialGradient(0,0,0,0,0,r);f.addColorStop(0,"rgba(220, 230, 240, 0.4)"),f.addColorStop(.4,"rgba(200, 210, 220, 0.2)"),f.addColorStop(1,"rgba(180, 190, 200, 0)"),t.fillStyle=f,t.beginPath(),t.arc(0,0,r,0,Math.PI*2),t.fill();const h=n*1,d=n*1.5,m=n*.12,y=t.createRadialGradient(0,0,0,0,0,n);y.addColorStop(0,"#ffffff"),y.addColorStop(.3,"#f0f0f0"),y.addColorStop(.6,"#c0c0c0"),y.addColorStop(1,"#a0a0a0"),t.shadowColor="rgba(220, 230, 240, 0.9)",t.shadowBlur=n*.8*s,t.fillStyle=y,t.beginPath(),t.moveTo(0,-d),t.lineTo(m,-m),t.lineTo(h,0),t.lineTo(m,m),t.lineTo(0,d),t.lineTo(-m,m),t.lineTo(-h,0),t.lineTo(-m,-m),t.closePath(),t.fill(),t.shadowBlur=n*1.2*s,t.shadowColor="rgba(255, 255, 255, 1)";const l=t.createRadialGradient(0,0,0,0,0,n*.3);l.addColorStop(0,"#ffffff"),l.addColorStop(.6,"#f5f5f5"),l.addColorStop(1,"rgba(200, 200, 200, 0.8)"),t.fillStyle=l,t.beginPath(),t.arc(0,0,n*.3,0,Math.PI*2),t.fill(),t.shadowBlur=0,t.restore()},drawSleigh:c,drawElf:b,drawMooningElf:R,drawPeeingElf:b,drawThievingElf:b,drawTrain:C,drawFirework(t,o){t.fillStyle=o.color||"#ffffff",t.beginPath(),t.arc(o.x,o.y,o.size,0,Math.PI*2),t.fill()},explodeFirework(t,o){const a=50+Math.random()*50,i=["#ff0000","#ffff00","#00ff00","#0000ff","#ffffff"];for(let e=0;e<a;e++){const n=Math.random()*Math.PI*2,s=Math.random()*5+2;o.push({type:"spark",x:t.x,y:t.y,vx:Math.cos(n)*s,vy:Math.sin(n)*s,size:2+Math.random()*2,opacity:1,active:!0,static:!1,color:i[Math.floor(Math.random()*i.length)]})}},drawRobin:x,drawSnowman:E};
@@ -0,0 +1 @@
1
+ import{createGardenTheme as e}from"./garden.js";export default e(!0);
@@ -0,0 +1 @@
1
+ import{drawIllustratedButterfly as b}from"./butterfly-drawing.js";function l(e,r,a=0,f=!1){return![r.x,r.y,r.size].every(Number.isFinite)||r.size<=0?!1:(e.save(),e.translate(r.x,r.y),e.scale(r.size,r.size),e.globalAlpha*=r.opacity??1,e.lineCap="round",e.lineJoin="round",f&&e.rotate(Math.sin(a/1700+(r.phase||0))*.035),!0)}function o(e,r,a,f,i,s,d=0){e.beginPath(),e.ellipse(r,a,f,i,d,0,Math.PI*2),e.fillStyle=s,e.fill()}function n(e,r,a,f){e.beginPath(),e.moveTo(...r[0]);for(const i of r.slice(1))e.lineTo(...i);e.strokeStyle=a,e.lineWidth=f,e.stroke()}export function drawBlossom(e,r){if(l(e,r)){e.rotate(r.rotation||0);for(let a=0;a<5;a++)e.rotate(Math.PI*2/5),o(e,0,-.38,.24,.43,r.color||"#f5b4cd");o(e,0,0,.17,.17,"#efc660"),e.restore()}}export function drawFlower(e,r,a){if(!l(e,r,a,!0))return;n(e,[[0,0],[.04,-.7],[0,-1.45]],"#598353",.055),o(e,-.19,-.55,.29,.095,"#80a75f",.5),o(e,.2,-.9,.29,.095,"#668f50",-.5),e.translate(0,-1.45);const f=e.createLinearGradient(-.5,-.5,.5,.5);f.addColorStop(0,"#fff7de"),f.addColorStop(1,r.color||"#efb8d1");for(let i=0;i<10;i++)e.rotate(Math.PI*2/10),o(e,0,-.3,.12,.33,f);o(e,0,0,.2,.2,"#d8a636"),o(e,-.04,-.04,.13,.13,"#f4ce65");for(let i=0;i<8;i++)o(e,Math.cos(i*2.4)*.12,Math.sin(i*2.4)*.12,.018,.018,"#b58b38");e.restore()}export function drawEasterEgg(e,r){if(!l(e,r))return;e.rotate(r.rotation||0);const a=e.createLinearGradient(-.5,-1.4,.6,0);a.addColorStop(0,"#fff4dc"),a.addColorStop(.35,r.color||"#d7a5c5"),a.addColorStop(1,"#967fba"),e.beginPath(),e.moveTo(0,-1.5),e.bezierCurveTo(.49,-1.5,.78,-.55,.48,-.17),e.bezierCurveTo(.29,.07,-.29,.07,-.48,-.17),e.bezierCurveTo(-.78,-.55,-.49,-1.5,0,-1.5),e.closePath(),e.fillStyle=a,e.fill(),e.save(),e.clip(),n(e,[[-.8,-.58],[-.4,-.8],[0,-.58],[.4,-.8],[.8,-.58]],"#fff2d1",.11),n(e,[[-.8,-.35],[.8,-.35]],"#f5d786",.07);for(let f=-1;f<=1;f++)o(e,f*.24,-1.05,.055,.055,"#fff4e5");o(e,-.23,-1.05,.065,.23,"#ffffff55",.35),e.restore(),e.restore()}export function drawBunny(e,r,a){if(!l(e,r))return;e.scale(r.facing==="right"?-1:1,1),r.hopping&&e.rotate((r.facing==="left"?1:-1)*Math.sin(r.age/700*Math.PI)*.1);const f=Math.sin(a/800+(r.phase||0))*.015;o(e,.55,-.35,.22,.22,"#fff7e8"),o(e,.05,-.45,.53,.64+f,"#d8c7b6"),o(e,-.17,-.43,.3,.49,"#f3e8da"),o(e,-.28,-1.63,.15,.6,"#d8c7b6",-.15),o(e,.08,-1.66,.15,.64,"#e6d7c6",.16),o(e,-.28,-1.65,.07,.43,"#dca9ad",-.15),o(e,.08,-1.69,.07,.46,"#e5b6b8",.16),o(e,-.13,-1.12,.43,.42,"#ecdfcf"),o(e,-.33,-1.16,.035,.045,"#4e423e"),o(e,.08,-1.16,.035,.045,"#4e423e"),o(e,-.12,-1.03,.055,.035,"#c78e90"),n(e,[[-.12,-1],[-.12,-.94]],"#8e7365",.018);for(const i of[-1,1])n(e,[[-.12+i*.13,-.99],[-.12+i*.48,-1.02]],"#a69080",.012),o(e,i*.3,-.04,.27,.12,"#e7d8c7");e.restore()}export function drawBee(e,r,a){if(!l(e,r))return;e.scale(r.facing==="left"?-1:1,1);const f=.4+Math.abs(Math.sin(a/35+(r.phase||0)))*.6;o(e,-.1,-.35,.22,.4*f,"#e7f0f3bb",-.5),o(e,.18,-.35,.22,.4*f,"#f8fcffcc",.5),o(e,0,0,.55,.32,"#edc65f"),e.save(),e.beginPath(),e.ellipse(0,0,.55,.32,0,0,Math.PI*2),e.clip();for(const i of[-.3,.02,.34])n(e,[[i,-.35],[i,.35]],"#4b413b",.12);e.restore(),o(e,.45,-.04,.22,.23,"#4b413b"),o(e,.53,-.11,.035,.035,"#fff8df"),n(e,[[.46,-.22],[.52,-.43],[.62,-.46]],"#4b413b",.025),e.restore()}export function drawLadybird(e,r){if(l(e,r)){o(e,0,-.18,.48,.38,"#b74d43"),o(e,-.1,-.25,.32,.27,"#dd6956"),n(e,[[0,-.55],[0,.18]],"#4a3935",.035);for(const a of[-1,1])o(e,a*.22,-.32,.075,.075,"#473a37"),o(e,a*.27,-.08,.065,.065,"#473a37");o(e,0,-.54,.2,.17,"#443b37"),e.restore()}}export function drawGardenButterfly(e,r,a){b(e,{...r,alpha:r.opacity})}
@@ -0,0 +1 @@
1
+ import{drawBlossom as h,drawFlower as M,drawEasterEgg as w,drawBunny as x,drawBee as v,drawLadybird as z,drawGardenButterfly as R}from"./garden-drawing.js";import{createGardenButterfly as B,updateGardenButterfly as T}from"./butterfly-flight.js";const c=["#f3c2d2","#e9db9f","#c7b8da","#eab48f"],u=r=>r[Math.floor(Math.random()*r.length)],f=(r,s,n,t,l={})=>({type:r,x:s,y:n,size:t,vx:0,vy:0,rotation:0,opacity:.95,active:!0,static:!0,phase:Math.random()*Math.PI*2,...l});export function createGardenTheme(r=!1){return{name:r?"easter":"summer-garden",displayName:r?"Easter":"Summer Garden",emoji:r?"\u{1F423}":"\u{1F33C}",colors:{primary:"#f3c2d2"},intensityConfig:{light:{count:18,speedRange:[.3,.6],sizeRange:[3,6],flowers:4,eggs:3,butterflies:2,bees:1,ladybirds:1},medium:{count:35,speedRange:[.4,.8],sizeRange:[4,8],flowers:7,eggs:5,butterflies:4,bees:2,ladybirds:2},heavy:{count:60,speedRange:[.5,1],sizeRange:[5,10],flowers:11,eggs:7,butterflies:6,bees:3,ladybirds:3}},particles:["blossom"],decorations:r?["flower","easter-egg","bunny","garden-butterfly"]:["flower","garden-butterfly","bee","ladybird"],traits:{blossom:{label:r?"Falling blossom":"Drifting petals",types:["blossom"],kind:"particle"},flower:{label:"Flowers",types:["flower"],count:"flowers"},butterfly:{label:"Butterflies",types:["garden-butterfly"],count:"butterflies"},...r?{easterEgg:{label:"Decorated eggs",types:["easter-egg"],count:"eggs"},bunny:{label:"Easter bunny",types:["bunny"]}}:{bee:{label:"Bumblebees",types:["bee"],count:"bees"},ladybird:{label:"Ladybirds",types:["ladybird"],count:"ladybirds"}}},createFallingParticle(s,n,t){return{...f("blossom",Math.random()*s,-20,t.sizeRange[0]+Math.random()*(t.sizeRange[1]-t.sizeRange[0])),static:!1,speed:t.speedRange[0]+Math.random()*(t.speedRange[1]-t.speedRange[0]),rotationSpeed:(Math.random()-.5)*.025,windOffset:Math.random()*6.28,windSpeed:.015,color:u(c),opacity:.65}},createInitialDecorations(s,n,t){const l=[],i=Math.min(1,s/600);for(let a=0;a<t.flowers;a++)l.push(f("flower",(a+.5)*s/t.flowers,n-3,(26+Math.random()*15)*i,{color:u(c)}));if(r){for(let a=0;a<t.eggs;a++)l.push(f("easter-egg",(a+.5)*s/t.eggs,n-4,(18+Math.random()*7)*i,{color:u(c)}));l.push(f("bunny",s*.13,n-4,45*i,{baseY:n-4,homeX:s*.13,age:0,hopping:!1,facing:"right"}))}else for(let a=0;a<t.ladybirds;a++)l.push(f("ladybird",(a+.7)*s/(t.ladybirds+1),n-10,12*i));for(const[a,e,d]of[["garden-butterfly",t.butterflies,26],["bee",r?0:t.bees,12]])for(let g=0;g<e;g++){if(a==="garden-butterfly"){l.push(B(s,n,i));continue}const o=n*(.6+Math.random()*.28);l.push(f(a,Math.random()*s,o,d*i,{static:!1,vx:.3+Math.random()*.4,baseY:o,waveAmplitude:15*i,waveFrequency:1.4,waveOffset:Math.random()*6.28,...a==="bee"?{static:!0,vx:0,targetIndex:g%Math.max(1,t.flowers),state:"flying",visitTime:0,age:0,facing:"right"}:{}}))}return l},updateSpecialParticles(s,n,t,l=800){const i=Math.min(100,Math.max(0,n)),a=s.filter(e=>e.type==="flower"&&e.active);for(const e of s){if(e.type==="garden-butterfly"&&T(e,n,t,l),e.type==="bee"){e.age+=i;const d=a[e.targetIndex%a.length];if(!d){e.x+=i*.035,e.y=e.baseY+Math.sin(e.age/700+e.phase)*10,e.x>t+35&&(e.x=-35),e.state="flying",e.facing="right";continue}const g=d.x+e.size*.25,o=d.y-d.size*1.45-e.size*.2;if(e.state==="visiting")e.visitTime+=i,e.x=g,e.y=o+Math.sin(e.age/160)*1.2,e.visitTime>=1600&&(e.targetIndex=(e.targetIndex+1)%a.length,e.state="flying",e.visitTime=0);else{const p=g-e.x,m=o-e.y,b=Math.hypot(p,m),y=Math.min(b,i*.085);b>0&&(e.x+=p/b*y,e.y+=m/b*y),e.facing=p<0?"left":"right",b<=y+.5&&(e.state="visiting",e.visitTime=0)}}if(e.type==="bunny"){e.age+=i;const d=2800,g=700;if(!e.hopping&&e.age>=d){e.hopping=!0,e.age=0;const o=e.homeX+e.size*2.5>t?-1:e.homeX-e.size*2.5<0?1:e.facing==="left"?-1:1;e.facing=o<0?"left":"right",e.hopTarget=e.homeX+o*e.size*1.7}if(e.hopping){const o=Math.min(1,e.age/g);e.x=e.homeX+(e.hopTarget-e.homeX)*o,e.y=e.baseY-Math.sin(o*Math.PI)*e.size*.85,o>=1&&(e.homeX=e.x,e.y=e.baseY,e.hopping=!1,e.age=0)}}}},drawBlossom:h,drawFlower:M,drawEasterEgg:w,drawBunny:x,drawBee:v,drawLadybird:z,drawGardenButterfly:R}}
@@ -0,0 +1 @@
1
+ import{createOccasionTheme as e}from"./occasions.js";export default e("graduation");
@@ -0,0 +1 @@
1
+ import{createOccasionTheme as e}from"./occasions.js";export default e("greeting");
@@ -0,0 +1 @@
1
+ export default{name:"make-it-rain",displayName:"Make it rain",emoji:"\u{1F327}\uFE0F",colors:{primary:"#b6d8ef"},intensityConfig:{light:{count:60,speedRange:[6,9],sizeRange:[8,14],splashes:4,splashChance:.1},medium:{count:120,speedRange:[8,12],sizeRange:[12,20],splashes:7,splashChance:.18},heavy:{count:220,speedRange:[11,16],sizeRange:[16,26],splashes:10,splashChance:.28}},particles:["raindrop"],decorations:["rain-splash"],traits:{raindrop:{label:"Raindrops",types:["raindrop"],kind:"particle"},splash:{label:"Rain splashes",types:["rain-splash"],count:"splashes",chance:"splashChance"}},createFallingParticle(a,e,s){const i=s.speedRange[0]+Math.random()*(s.speedRange[1]-s.speedRange[0]);return{type:"raindrop",x:Math.random()*a,y:-30,vx:i*.12,speed:i,size:s.sizeRange[0]+Math.random()*(s.sizeRange[1]-s.sizeRange[0]),opacity:.2+Math.random()*.45,static:!1,active:!0}},createSplash(a,e){return{type:"rain-splash",x:Math.random()*a,y:e-3-Math.random()*12,size:7+Math.random()*12,age:0,duration:650,opacity:.5,static:!0,active:!0}},createInitialDecorations(a,e,s){return Array.from({length:s.splashes},()=>({...this.createSplash(a,e),age:Math.random()*500}))},spawnSpecialParticle(a,e,s,i){return a.length>=i.splashes*2||Math.random()>=i.splashChance?null:this.createSplash(e,s)},updateSpecialParticles(a,e){for(const s of a)s.age+=Math.max(0,e),s.age>=s.duration&&(s.active=!1)},drawRaindrop(a,e){![e.x,e.y,e.size].every(Number.isFinite)||e.size<=0||(a.save(),a.globalAlpha*=e.opacity,a.strokeStyle="#bedff5",a.lineWidth=1,a.lineCap="round",a.beginPath(),a.moveTo(e.x-e.size*.12,e.y-e.size),a.lineTo(e.x,e.y),a.stroke(),a.restore())},drawRainSplash(a,e){if(![e.x,e.y,e.size].every(Number.isFinite)||e.size<=0)return;const s=Math.min(1,e.age/e.duration);if(a.save(),a.globalAlpha*=e.opacity*(1-s),a.strokeStyle="#c3e6fa",a.lineWidth=1,a.beginPath(),a.ellipse(e.x,e.y,Math.max(.01,e.size*s),Math.max(.01,e.size*s*.18),0,0,Math.PI*2),a.stroke(),s<.5)for(const i of[-1,1])a.beginPath(),a.moveTo(e.x+i*s*e.size,e.y-Math.sin(s*Math.PI*2)*5),a.lineTo(e.x+i*s*e.size*.7,e.y-Math.sin(s*Math.PI*2)*3),a.stroke();a.restore()}};
@@ -0,0 +1 @@
1
+ export default{name:"money-rain",displayName:"Money Rain",emoji:"\u{1F4B8}",colors:{primary:"#9ab89a"},intensityConfig:{light:{count:18,speedRange:[1.1,2],sizeRange:[22,34]},medium:{count:35,speedRange:[1.4,2.6],sizeRange:[26,42]},heavy:{count:65,speedRange:[1.8,3.3],sizeRange:[28,48]}},particles:["banknote"],decorations:[],traits:{banknote:{label:"Banknotes",types:["banknote"],kind:"particle"}},createFallingParticle(e,a,o){return{type:"banknote",x:Math.random()*e,y:-60,active:!0,static:!1,size:o.sizeRange[0]+Math.random()*(o.sizeRange[1]-o.sizeRange[0]),speed:o.speedRange[0]+Math.random()*(o.speedRange[1]-o.speedRange[0]),opacity:.92,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.035,windOffset:Math.random()*Math.PI*2,windSpeed:.025,phase:Math.random()*Math.PI*2,color:["#88aa8e","#9abda0","#b7c79a"][Math.floor(Math.random()*3)]}},createInitialDecorations(){return[]},drawBanknote(e,a,o){if(![a.x,a.y,a.size].every(Number.isFinite)||a.size<=0)return;e.save(),e.translate(a.x,a.y),e.rotate(a.rotation),e.scale(a.size,a.size*(.22+Math.abs(Math.cos(o/700+a.phase))*.78)),e.globalAlpha*=a.opacity;const n=e.createLinearGradient(-1,-.45,1,.45);n.addColorStop(0,"#d7dec5"),n.addColorStop(.35,a.color),n.addColorStop(.55,"#e1e7cd"),n.addColorStop(1,a.color),e.fillStyle=n,e.fillRect(-1,-.45,2,.9),e.strokeStyle="#44674e",e.lineWidth=.022,e.strokeRect(-.9,-.35,1.8,.7),e.beginPath(),e.ellipse(0,0,.27,.33,0,0,Math.PI*2),e.stroke(),e.beginPath(),e.ellipse(0,-.07,.11,.13,0,0,Math.PI*2),e.fillStyle="#658469",e.fill(),e.beginPath(),e.ellipse(0,.2,.18,.14,0,Math.PI,Math.PI*2),e.fill();for(const t of[-1,1]){for(let i=0;i<4;i++)e.beginPath(),e.moveTo(t*.4,-.16+i*.1),e.lineTo(t*.75,-.16+i*.1),e.stroke();e.beginPath(),e.arc(t*.76,t*.22,.065,0,Math.PI*2),e.stroke()}e.beginPath(),e.moveTo(.15,-.45),e.lineTo(.03,.45),e.strokeStyle="#ffffff44",e.lineWidth=.045,e.stroke(),e.restore()}};
@@ -0,0 +1 @@
1
+ import{createSparklerMessage as m,updateSparklerMessage as M,drawSparklerMessage as g}from"./sparkler-writing.js";const d=["#efc96b","#f3e9c9","#b8a0dd","#8cbec9","#dd98aa"],h=()=>d[Math.floor(Math.random()*d.length)],s=(e,a,r,o,l={})=>({type:e,x:a,y:r,size:o,vx:0,vy:0,rotation:0,opacity:.95,active:!0,static:!0,phase:Math.random()*Math.PI*2,...l});function t(e,a){return![a.x,a.y,a.size].every(Number.isFinite)||a.size<=0?!1:(e.save(),e.translate(a.x,a.y),e.scale(a.size,a.size),e.globalAlpha*=a.opacity??1,!0)}const k={name:"new-year",displayName:"New Year",emoji:"\u{1F389}",colors:{primary:"#efc96b"},intensityConfig:{light:{count:25,speedRange:[.6,1],sizeRange:[3,6],balloons:2,fireworkChance:.008},medium:{count:55,speedRange:[.8,1.5],sizeRange:[4,8],balloons:4,fireworkChance:.015},heavy:{count:95,speedRange:[1,2],sizeRange:[5,10],balloons:6,fireworkChance:.025}},particles:["confetti","streamer"],decorations:["new-year-firework","balloon","midnight-clock","sparkler-message"],traits:{confetti:{label:"Confetti",types:["confetti"],kind:"particle"},streamer:{label:"Streamers",types:["streamer"],kind:"particle"},firework:{label:"Fireworks",types:["new-year-firework"],chance:"fireworkChance"},balloon:{label:"Balloons",types:["balloon"],count:"balloons"},midnightClock:{label:"Midnight clock",types:["midnight-clock"]},sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]}},createFallingParticle(e,a,r){return s(Math.random()<.7?"confetti":"streamer",Math.random()*e,-30,r.sizeRange[0]+Math.random()*(r.sizeRange[1]-r.sizeRange[0]),{static:!1,speed:r.speedRange[0]+Math.random()*(r.speedRange[1]-r.speedRange[0]),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.05,windOffset:Math.random()*Math.PI*2,windSpeed:.02,color:h()})},createInitialDecorations(e,a,r){const o=Math.min(1,e/600),l=[s("midnight-clock",e/2,a-50*o,36*o),m("Happy New Year",e,a,r.sparkler)];for(let i=0;i<r.balloons;i++){const n=i%2===0;l.push(s("balloon",n?28+i*8:e-28-i*8,a-(100+i*28)*o,23*o,{color:h()}))}return r.fireworkChance>0&&l.push(this.createFirework(e,a)),l},createFirework(e,a){return s("new-year-firework",e*(.15+Math.random()*.7),a*(.12+Math.random()*.32),Math.min(e*.18,70+Math.random()*45),{age:0,duration:2100,color:h()})},spawnSpecialParticle(e,a,r,o){return e.filter(l=>l.type==="new-year-firework"&&l.active).length>=3?null:Math.random()<o.fireworkChance?this.createFirework(a,r):null},updateSpecialParticles(e,a){for(const r of e)r.type==="sparkler-message"&&M(r,a),r.type==="new-year-firework"&&(r.age+=a,r.age>=r.duration&&(r.active=!1))},drawSparklerMessage:g,drawConfetti(e,a,r){t(e,a)&&(e.rotate(a.rotation||0),e.scale(.25+Math.abs(Math.cos(r/400+a.phase))*.75,1),e.fillStyle=a.color,e.fillRect(-.5,-.35,1,.7),e.fillStyle="#ffffff66",e.fillRect(-.5,-.35,.25,.7),e.restore())},drawStreamer(e,a,r){if(t(e,a)){e.rotate(a.rotation||0),e.lineWidth=.2,e.strokeStyle=a.color,e.beginPath();for(let o=0;o<=24;o++){const l=Math.sin(o*.55+r/600+a.phase)*.45,i=o/7-1.7;o===0?e.moveTo(l,i):e.lineTo(l,i)}e.stroke(),e.restore()}},drawNewYearFirework(e,a){if(!t(e,a))return;const r=Math.min(1,a.age/a.duration),o=1-(1-r)**3;e.globalAlpha*=(1-r)**1.5,e.lineCap="round";for(let l=0;l<36;l++){const i=l*Math.PI*2/36+a.phase,n=o*(l%2?.78:1),f=r*r*.35;e.strokeStyle=l%3?a.color:"#fff4d6",e.lineWidth=.012,e.beginPath(),e.moveTo(Math.cos(i)*n*.65,Math.sin(i)*n*.65+f),e.lineTo(Math.cos(i)*n,Math.sin(i)*n+f),e.stroke(),e.fillStyle="#fff5da",e.beginPath(),e.arc(Math.cos(i)*n,Math.sin(i)*n+f,.018,0,Math.PI*2),e.fill()}e.restore()},drawBalloon(e,a,r){if(!t(e,a))return;e.rotate(Math.sin(r/1400+a.phase)*.08),e.strokeStyle="#a49476",e.lineWidth=.025,e.beginPath(),e.moveTo(0,.9),e.bezierCurveTo(-.3,1.4,.35,1.8,0,2.2),e.stroke();const o=e.createLinearGradient(-.7,-1,.7,.7);o.addColorStop(0,"#fff9dc"),o.addColorStop(.35,a.color),o.addColorStop(1,"#8a7398"),e.fillStyle=o,e.beginPath(),e.ellipse(0,-.1,.75,1,0,0,Math.PI*2),e.fill(),e.fillStyle=a.color,e.beginPath(),e.moveTo(0,.85),e.lineTo(-.12,1.05),e.lineTo(.12,1.05),e.closePath(),e.fill(),e.fillStyle="#ffffff77",e.beginPath(),e.ellipse(-.3,-.45,.1,.29,.4,0,Math.PI*2),e.fill(),e.restore()},drawMidnightClock(e,a){if(!t(e,a))return;const r=e.createLinearGradient(-1,-1,1,1);r.addColorStop(0,"#fff2bf"),r.addColorStop(.5,"#d8ac53"),r.addColorStop(1,"#a57936");for(const[o,l]of[[1,r],[.84,"#353448"],[.76,"#f6ecd4"]])e.fillStyle=l,e.beginPath(),e.arc(0,0,o,0,Math.PI*2),e.fill();e.strokeStyle="#67543c",e.lineWidth=.035;for(let o=0;o<12;o++){const l=o*Math.PI/6;e.beginPath(),e.moveTo(Math.sin(l)*.64,-Math.cos(l)*.64),e.lineTo(Math.sin(l)*.7,-Math.cos(l)*.7),e.stroke()}e.lineWidth=.055,e.lineCap="round",e.beginPath(),e.moveTo(0,.08),e.lineTo(0,-.57),e.stroke(),e.beginPath(),e.moveTo(0,0),e.lineTo(-.08,-.4),e.stroke(),e.fillStyle="#b38c42",e.beginPath(),e.arc(0,0,.07,0,Math.PI*2),e.fill(),e.restore()}};export default k;
@@ -0,0 +1 @@
1
+ function d(e,i){return![i.x,i.y,i.size].every(Number.isFinite)||i.size<=0?!1:(e.save(),e.translate(i.x,i.y),e.scale(i.size,i.size),e.rotate(i.rotation||0),e.globalAlpha*=i.opacity??1,e.lineCap="round",e.lineJoin="round",!0)}function n(e,i,l,o,r,a){e.beginPath(),e.ellipse(i,l,o,r,0,0,Math.PI*2),e.fillStyle=a,e.fill()}function f(e,i,l,o){e.beginPath(),e.moveTo(...i[0]);for(const r of i.slice(1))e.lineTo(...r);e.strokeStyle=l,e.lineWidth=o,e.stroke()}export function drawMortarboard(e,i,l){if(!d(e,i))return;e.fillStyle="#303b52",e.beginPath(),e.moveTo(-.48,-.05),e.lineTo(.48,-.05),e.lineTo(.4,.45),e.quadraticCurveTo(0,.67,-.4,.45),e.closePath(),e.fill();const o=e.createLinearGradient(-1,-.5,1,.4);o.addColorStop(0,"#525e77"),o.addColorStop(1,"#1d2639"),e.fillStyle=o,e.strokeStyle="#78829a",e.lineWidth=.025,e.beginPath(),e.moveTo(-1,-.1),e.lineTo(0,-.64),e.lineTo(1,-.1),e.lineTo(0,.4),e.closePath(),e.fill(),e.stroke();const r=Math.sin(l/220+i.phase)*.12;f(e,[[0,-.09],[.7,.13],[.77+r,.95]],"#d9b263",.045),n(e,0,-.09,.07,.05,"#edcb80");for(let a=-2;a<=2;a++)f(e,[[.77+r,.86],[.77+r+a*.04,1.14]],"#e7be6b",.025);e.restore()}export function drawDiploma(e,i){if(!d(e,i))return;const l=e.createLinearGradient(0,-.4,0,.4);l.addColorStop(0,"#fff4d9"),l.addColorStop(.6,"#e3d0ac"),l.addColorStop(1,"#bca680"),e.fillStyle=l,e.fillRect(-1,-.35,2,.7),n(e,-1,0,.12,.35,"#f8eacb"),n(e,1,0,.12,.35,"#d1bc94"),f(e,[[0,-.37],[0,.38]],"#a34353",.17);for(const o of[-1,1])e.beginPath(),e.moveTo(0,0),e.bezierCurveTo(o*.65,-.5,o*.66,.36,0,0),e.strokeStyle="#ba5864",e.lineWidth=.075,e.stroke(),f(e,[[0,.06],[o*.22,.65]],"#a34353",.1);e.restore()}export function drawBirthdayCake(e,i,l){if(d(e,i)){n(e,0,.08,1.3,.18,"#c1c9cf"),e.fillStyle="#b77e6d",e.fillRect(-1,-.9,2,.92),n(e,0,-.02,1,.16,"#bb8774"),e.fillStyle="#f3c2c4",e.fillRect(-1,-.94,2,.23),n(e,0,-.94,1,.2,"#f8d9d0");for(let o=0;o<9;o++){const r=-.88+o*.22;n(e,r,-.72,.11,.12+o%3*.035,"#f3c2c4"),f(e,[[r,-.44],[r+.05,-.36]],o%2?"#e6ce86":"#c7dbc3",.04)}for(const o of[-.52,0,.52]){e.fillStyle=o===0?"#99b9c9":"#d69ba9",e.fillRect(o-.05,-1.65,.1,.7);for(let a=0;a<3;a++)f(e,[[o-.04,-1.56+a*.2],[o+.04,-1.5+a*.2]],"#fff6da",.025);const r=1+Math.sin(l/120+o*8)*.1;n(e,o,-1.83,.1,.19*r,"#eab45c"),n(e,o,-1.79,.05,.1,"#fff0af")}e.restore()}}export function drawCelebrationHeart(e,i){if(!d(e,i))return;const l=e.createLinearGradient(-1,-1,1,1);l.addColorStop(0,"#f1b2bd"),l.addColorStop(1,"#b2617c"),e.fillStyle=l,e.beginPath(),e.moveTo(0,.85),e.bezierCurveTo(-1.45,-.1,-.62,-1.28,0,-.52),e.bezierCurveTo(.62,-1.28,1.45,-.1,0,.85),e.fill(),e.restore()}export function drawAnniversaryRings(e,i){if(!d(e,i))return;const l=e.createLinearGradient(-1,-1,1,.5);l.addColorStop(0,"#fff0b7"),l.addColorStop(.35,"#c89443"),l.addColorStop(.65,"#f2d38d"),l.addColorStop(1,"#a77c3b");for(const o of[-1,1])e.beginPath(),e.ellipse(o*.34,-.5,.59,.7,o*.25,0,Math.PI*2),e.strokeStyle=l,e.lineWidth=.15,e.stroke();e.fillStyle="#e9f6fa",e.beginPath(),e.moveTo(.25,-1.15),e.lineTo(.5,-1.48),e.lineTo(.74,-1.15),e.lineTo(.49,-.94),e.closePath(),e.fill(),f(e,[[.25,-1.15],[.74,-1.15],[.49,-.94],[.5,-1.48]],"#9fb9c6",.025),e.restore()}export function drawRibbonBow(e,i,l){if(d(e,i)){e.rotate(Math.sin(l/1600+i.phase)*.03);for(const o of[-1,1])e.fillStyle=o<0?"#bd7b8e":"#d59aab",e.beginPath(),e.moveTo(0,0),e.bezierCurveTo(o*1.6,-1.5,o*1.9,1,0,.2),e.closePath(),e.fill(),e.beginPath(),e.moveTo(0,.1),e.lineTo(o*.8,1.55),e.lineTo(o*.35,1.4),e.lineTo(o*.35,1.7),e.lineTo(-o*.15,.2),e.closePath(),e.fill();n(e,0,.1,.22,.26,"#a7657d"),e.restore()}}
@@ -0,0 +1 @@
1
+ import g from"./new-year.js";import{createSparklerMessage as u,updateSparklerMessage as f,drawSparklerMessage as M}from"./sparkler-writing.js";import{drawMortarboard as h,drawDiploma as v,drawBirthdayCake as w,drawCelebrationHeart as k,drawAnniversaryRings as R,drawRibbonBow as z}from"./occasion-drawing.js";const c=(o,m,y,b,i={})=>({type:o,x:m,y,size:b,opacity:1,active:!0,static:!0,vx:0,vy:0,phase:Math.random()*Math.PI*2,...i}),B={graduation:["Graduation","\u{1F393}","Congratulations!"],birthday:["Birthday","\u{1F382}","Happy Birthday!"],anniversary:["Anniversary","\u{1F48D}","Happy Anniversary!"],greeting:["Sparkler greeting","\u2728","Congratulations!"]};export function createOccasionTheme(o){const[m,y,b]=B[o],i=o==="greeting",l=o==="anniversary";return{name:o,displayName:m,emoji:y,defaultMessage:b,colors:{primary:"#e4c77f"},intensityConfig:{light:{count:i?0:18,speedRange:[.4,.8],sizeRange:[3,6],caps:3,diplomas:1,balloons:2},medium:{count:i?0:36,speedRange:[.6,1.1],sizeRange:[4,8],caps:5,diplomas:2,balloons:4},heavy:{count:i?0:60,speedRange:[.8,1.5],sizeRange:[5,10],caps:8,diplomas:3,balloons:6}},particles:i?[]:[l?"celebration-heart":"confetti"],decorations:["sparkler-message",...o==="graduation"?["mortarboard","diploma"]:o==="birthday"?["balloon","birthday-cake"]:l?["anniversary-rings","ribbon-bow"]:[]],traits:{sparklerMessage:{label:"Sparkler greeting",types:["sparkler-message"]},...i?{}:l?{heart:{label:"Falling hearts",types:["celebration-heart"],kind:"particle"}}:{confetti:{label:"Confetti",types:["confetti"],kind:"particle"}},...o==="graduation"?{mortarboard:{label:"Tossed mortarboards",types:["mortarboard"],count:"caps"},diploma:{label:"Diplomas",types:["diploma"],count:"diplomas"}}:o==="birthday"?{balloon:{label:"Balloons",types:["balloon"],count:"balloons"},cake:{label:"Birthday cake",types:["birthday-cake"]}}:l?{rings:{label:"Anniversary rings",types:["anniversary-rings"]},ribbon:{label:"Ribbon bows",types:["ribbon-bow"]}}:{}},createFallingParticle(t,s,n){const e=g.createFallingParticle(t,s,n);return{...e,type:l?"celebration-heart":"confetti",size:l?e.size*1.4:e.size}},createInitialDecorations(t,s,n){const e=Math.min(1,t/600),r=n.sparkler||{},d=r.message?.trim()||(r.greeting==="best-wishes"?void 0:b),p=[u(b,t,s,{...r,message:d})];if(o==="graduation"){for(let a=0;a<n.caps;a++)p.push(c("mortarboard",(a+.5)*t/n.caps,s*.7,(22+Math.random()*9)*e,{baseX:(a+.5)*t/n.caps,age:Math.random()*4e3,rotation:0}));for(let a=0;a<n.diplomas;a++)p.push(c("diploma",(a+.5)*t/n.diplomas,s-25*e,38*e,{rotation:(a%2?1:-1)*.08}))}else if(o==="birthday"){p.push(c("birthday-cake",t/2,s-12,50*e));for(let a=0;a<n.balloons;a++)p.push(c("balloon",a%2?t-32-a*5:32+a*5,s-(110+a*25)*e,24*e,{color:["#d997ad","#a1becf","#e4c77f"][a%3]}))}else if(l){p.push(c("anniversary-rings",t/2,s-16,55*e));for(const a of[t*.14,t*.86])p.push(c("ribbon-bow",a,s-55*e,23*e))}return p},updateSpecialParticles(t,s,n=1024,e=800){for(const r of t)if(r.type==="sparkler-message"&&f(r,s),r.type==="mortarboard"){r.age=(r.age+Math.min(100,Math.max(0,s)))%4200;const d=r.age/4200;r.x=r.baseX+Math.sin(d*Math.PI*2)*r.size*.55,r.y=e-r.size*1.3-Math.sin(d*Math.PI)*e*.55,r.rotation=Math.sin(d*Math.PI*2)*.75}},drawConfetti:g.drawConfetti,drawBalloon:g.drawBalloon,drawSparklerMessage:M,drawMortarboard:h,drawDiploma:v,drawBirthdayCake:w,drawCelebrationHeart:k,drawAnniversaryRings:R,drawRibbonBow:z}}
@@ -0,0 +1 @@
1
+ export async function launchMakeItRain(a,n={},d="make-it-rain"){if(n.respectMotionPreference!==!1&&typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return null;const e=new a({...n,theme:d});if(await e.init()===!1||!e.initialized)return e.destroy(),null;const i=Number(n.duration),r=Number.isFinite(i)&&i>=0?Math.min(i,6e5):8e3,o=e.destroy.bind(e);let t=null;return e.destroy=()=>{t!==null&&clearTimeout(t),t=null,o()},r>0&&(t=setTimeout(()=>e.destroy(),r)),e}