{"version":3,"file":"npm.jss-plugin-rule-value-function.js","mappings":"8OAGIA,IAAMC,KAAKD,MACXE,WAAa,WAAaF,IAC1BG,SAAW,aAAcH,IA8D7B,sBA5DqB,SAASI,iBAC5B,MAAO,CACLC,aAAc,SAASA,aAAaC,KAAMC,KAAMC,SAC9C,GAAoB,mBAATD,KAAqB,OAAO,KACvC,IAAIE,MAAO,uCAAWH,KAAM,GAAIE,SAEhC,OADAC,KAAKN,UAAYI,KACVE,MAETC,eAAgB,SAASA,eAAeC,MAAOF,MAK7C,GAAIP,cAAcO,MAAQN,YAAYM,KAAM,OAAOE,MACnD,IAAIC,SAAW,GAEf,IAAK,IAAIC,QAAQF,MAAO,CACtB,IAAIG,MAAQH,MAAME,MACG,mBAAVC,eACJH,MAAME,MACbD,SAASC,MAAQC,OAKnB,OADAL,KAAKP,YAAcU,SACZD,OAETI,SAAU,SAASA,SAASC,KAAMP,KAAMQ,MAAOT,SAC7C,IAAIU,UAAYT,KAEZU,OAASD,UAAUf,UAGnBgB,SAGFD,UAAUP,MAAQQ,OAAOH,OAAS,IAapC,IAAIJ,SAAWM,UAAUhB,YAEzB,GAAIU,SACF,IAAK,IAAIQ,SAASR,SAChBM,UAAUL,KAAKO,MAAOR,SAASQ,OAAOJ,MAAOR","sources":["webpack://giveeasy.cloud/./node_modules/jss-plugin-rule-value-function/dist/jss-plugin-rule-value-function.esm.js"],"sourcesContent":["import warning from 'tiny-warning';\nimport { createRule } from 'jss';\n\nvar now = Date.now();\nvar fnValuesNs = \"fnValues\" + now;\nvar fnRuleNs = \"fnStyle\" + ++now;\n\nvar functionPlugin = function functionPlugin() {\n return {\n onCreateRule: function onCreateRule(name, decl, options) {\n if (typeof decl !== 'function') return null;\n var rule = createRule(name, {}, options);\n rule[fnRuleNs] = decl;\n return rule;\n },\n onProcessStyle: function onProcessStyle(style, rule) {\n // We need to extract function values from the declaration, so that we can keep core unaware of them.\n // We need to do that only once.\n // We don't need to extract functions on each style update, since this can happen only once.\n // We don't support function values inside of function rules.\n if (fnValuesNs in rule || fnRuleNs in rule) return style;\n var fnValues = {};\n\n for (var prop in style) {\n var value = style[prop];\n if (typeof value !== 'function') continue;\n delete style[prop];\n fnValues[prop] = value;\n } // $FlowFixMe[prop-missing]\n\n\n rule[fnValuesNs] = fnValues;\n return style;\n },\n onUpdate: function onUpdate(data, rule, sheet, options) {\n var styleRule = rule; // $FlowFixMe[prop-missing]\n\n var fnRule = styleRule[fnRuleNs]; // If we have a style function, the entire rule is dynamic and style object\n // will be returned from that function.\n\n if (fnRule) {\n // Empty object will remove all currently defined props\n // in case function rule returns a falsy value.\n styleRule.style = fnRule(data) || {};\n\n if (process.env.NODE_ENV === 'development') {\n for (var prop in styleRule.style) {\n if (typeof styleRule.style[prop] === 'function') {\n process.env.NODE_ENV !== \"production\" ? warning(false, '[JSS] Function values inside function rules are not supported.') : void 0;\n break;\n }\n }\n }\n } // $FlowFixMe[prop-missing]\n\n\n var fnValues = styleRule[fnValuesNs]; // If we have a fn values map, it is a rule with function values.\n\n if (fnValues) {\n for (var _prop in fnValues) {\n styleRule.prop(_prop, fnValues[_prop](data), options);\n }\n }\n }\n };\n};\n\nexport default functionPlugin;\n"],"names":["now","Date","fnValuesNs","fnRuleNs","functionPlugin","onCreateRule","name","decl","options","rule","onProcessStyle","style","fnValues","prop","value","onUpdate","data","sheet","styleRule","fnRule","_prop"],"sourceRoot":""}