import BaseAmbientLight from"../../../common/documents/ambient-light.mjs";import ServerDocumentMixin from"../backend/server-document.mjs";import{isPlainObject}from"../../../common/utils/helpers.mjs";export default class AmbientLight extends(ServerDocumentMixin(BaseAmbientLight)){static _migrationRegistry=[...super._migrationRegistry,{fn:migrateFieldNameChanges,version:12},{fn:migrateNegativeRadius,version:12},{fn:migrateGradualToAttenuation,version:12},{fn:migrateZeroAngle,version:12},{fn:migrateSourceTypeFlags,version:12},{fn:migrateNegativeLuminosity,version:"12.319"}]}function migrateFieldNameChanges(i){let n=!1;const t={darknessThreshold:"darkness.min",dim:"config.dim",bright:"config.bright",angle:"config.angle",tintColor:"config.color",tintAlpha:"config.alpha",lightAnimation:"config.animation",darkness:"config.darkness"};for(const[e,a]of Object.entries(t)){const t=AmbientLight._addDataFieldMigration(i,e,a);n||=t}return n}function migrateSourceTypeFlags(i){return"t"in i&&("walls"in i||(i.walls="u"!==i.t),"vision"in i||(i.vision="l"!==i.t),delete i.t,!0)}function migrateNegativeRadius(i){const n=i.config;if(!isPlainObject(n))return!1;let t=!1;return n.dim<0&&(n.dim=Math.abs(n.dim),t=!0),n.bright<0&&(n.bright=Math.abs(n.bright),t=!0),!!t&&(n.luminosity=-1*Math.abs(n.luminosity??.5),!0)}function migrateGradualToAttenuation(i){const n=i.config;return!!isPlainObject(n)&&("gradual"in n&&(n.attenuation=n.gradual?.5:.3,delete n.gradual,!0))}function migrateZeroAngle(i){return!!isPlainObject(i.config)&&(0===i.config.angle&&(i.config.angle=360,!0))}function migrateNegativeLuminosity(i){const n=i.config;return!!isPlainObject(n)&&(n.luminosity<0&&(n.luminosity=.5,n.negative=!0,!0))}