{"version":3,"file":"npm.jss-plugin-rule-value-function.js","mappings":";;;;;;;;;;;;AAAmC;AACF;;AAEjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,+CAAU,SAAS;AACpC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;;;AAGR;AACA;AACA,KAAK;AACL;AACA,4BAA4B;;AAE5B,wCAAwC;AACxC;;AAEA;AACA;AACA;AACA;;AAEA,YAAY,IAAsC;AAClD;AACA;AACA,cAAc,KAAqC,GAAG,wDAAO,4EAA4E,CAAM;AAC/I;AACA;AACA;AACA;AACA,QAAQ;;;AAGR,4CAA4C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+DAAe,cAAc,EAAC","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":[],"sourceRoot":""}