// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later
// @source: https://gitlab.com/soapbox-pub/ditto/-/tree/f0a3877c
import{n as e}from"./blobbi-shop-items-gin9pdH4.js";var t=4,n=10;function r(e,t,n){return Math.max(t,Math.min(n,e))}function i(e,t){return Math.ceil(e/100*t)||1}function a(e){return e<=25?`urgent`:e<=50?`attention`:e<=75?`okay`:`good`}function o(e){return e<=30?`urgent`:e<=60?`attention`:e<=70?`okay`:`good`}function s(e){return{shouldShowBadge:e===`attention`||e===`urgent`,shouldPulse:e===`urgent`,isLow:e===`attention`||e===`urgent`,isUrgent:e===`urgent`}}function c(e){let c=r(e.value,1,100);if(e.stage===`egg`)return{value:c,filled:t,max:t,careState:`protected`,shouldShowBadge:!1,shouldPulse:!1,isLow:!1,isUrgent:!1};if(e.stage===`baby`){let e=i(c,t),n=a(c);return{value:c,filled:e,max:t,careState:n,...s(n)}}let l=i(c,n),u=o(c);return{value:c,filled:l,max:n,careState:u,...s(u)}}var l={feed:`food`,play:`toy`,clean:`hygiene`,medicine:`medicine`,boost:`energy`},u={feed:{label:`Feed`,description:`Feed your Blobbi`,icon:`🍎`},play:{label:`Play`,description:`Play with your Blobbi`,icon:`⚽`},clean:{label:`Clean`,description:`Clean your Blobbi`,icon:`🧼`},medicine:{label:`Medicine`,description:`Heal your Blobbi`,icon:`💊`},boost:{label:`Boost`,description:`Recharge your Blobbi's energy`,icon:`⚡`}},d={play_music:{label:`Play Music`,description:`Play music for your Blobbi`,icon:`🎵`},sing:{label:`Sing`,description:`Sing to your Blobbi`,icon:`🎤`}};({...u,...d});function f(e){return e===void 0?1:Math.max(1,Math.min(100,Math.round(e)))}function p(e,t){return f((e??1)+t)}function m(e,t){let n={...e};return t.hunger!==void 0&&(n.hunger=p(e.hunger,t.hunger)),t.happiness!==void 0&&(n.happiness=p(e.happiness,t.happiness)),t.energy!==void 0&&(n.energy=p(e.energy,t.energy)),t.hygiene!==void 0&&(n.hygiene=p(e.hygiene,t.hygiene)),t.health!==void 0&&(n.health=p(e.health,t.health)),n}var h=`med_shell_repair`;function g(t,n){let r=e(t);if(!r)return{canUse:!1,reason:`Item not found`};let i=n===`egg`;return t===`med_shell_repair`?i?{canUse:!0}:{canUse:!1,reason:`Only usable for eggs`}:r.type===`food`?i?{canUse:!1,reason:`Eggs cannot eat food`}:{canUse:!0}:r.type===`toy`?i?{canUse:!1,reason:`Eggs cannot use toys`}:{canUse:!0}:r.type===`medicine`?v(r.effect)?{canUse:!0}:{canUse:!1,reason:`This medicine has no effect`}:r.type===`hygiene`?!y(r.effect)&&!b(r.effect)?{canUse:!1,reason:`This item has no cleaning effect`}:{canUse:!0}:r.type===`energy`&&i?{canUse:!1,reason:`Eggs do not need energy boosts`}:{canUse:!0}}function _(t){let n=e(t);return n?{food:`feed`,toy:`play`,hygiene:`clean`,medicine:`medicine`,energy:`boost`}[n.type]??null:null}function v(e){return e?e.health!==void 0&&e.health!==0:!1}function y(e){return e?e.hygiene!==void 0&&e.hygiene!==0:!1}function b(e){return e?e.happiness!==void 0&&e.happiness!==0:!1}var x=[`medicine`,`clean`],S=[`clean`,`medicine`,`play_music`,`sing`];function C(e,t){return!0}function w(e,t){return e===`egg`?S.includes(t):!0}function T(e,t){return e.stage===`egg`?t&&x.includes(t)?null:`Eggs cannot use this item. Wait for your Blobbi to hatch!`:null}function E(e,t,n){if(!t)return[];let r=[];for(let i of[`hunger`,`happiness`,`energy`,`hygiene`,`health`]){let a=t[i];if(a===void 0||a===0)continue;let o=f(e[i]??0),s=f(o+a),l=c({stage:n,stat:i,value:o}),u=c({stage:n,stat:i,value:s});r.push({stat:i,delta:a,beforeValue:o,afterValue:s,beforeSegments:l.filled,afterSegments:u.filled,segmentDelta:u.filled-l.filled,maxSegments:l.max,beforeCareState:l.careState,afterCareState:u.careState})}return r}export{c as _,m as a,g as c,T as d,b as f,E as g,w as h,h as i,f as l,v as m,l as n,p as o,y as p,d as r,C as s,u as t,_ as u};
// @license-end
