{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport { Color as RcColor } from '@rc-component/color-picker';\nexport const toHexFormat = (value, alpha) => (value === null || value === void 0 ? void 0 : value.replace(/[^\\w/]/g, '').slice(0, alpha ? 8 : 6)) || '';\nexport const getHex = (value, alpha) => value ? toHexFormat(value, alpha) : '';\nexport let AggregationColor = /*#__PURE__*/function () {\n  function AggregationColor(color) {\n    _classCallCheck(this, AggregationColor);\n    var _a;\n    this.cleared = false;\n    // Clone from another AggregationColor\n    if (color instanceof AggregationColor) {\n      this.metaColor = color.metaColor.clone();\n      this.colors = (_a = color.colors) === null || _a === void 0 ? void 0 : _a.map(info => ({\n        color: new AggregationColor(info.color),\n        percent: info.percent\n      }));\n      this.cleared = color.cleared;\n      return;\n    }\n    const isArray = Array.isArray(color);\n    if (isArray && color.length) {\n      this.colors = color.map(_ref => {\n        let {\n          color: c,\n          percent\n        } = _ref;\n        return {\n          color: new AggregationColor(c),\n          percent\n        };\n      });\n      this.metaColor = new RcColor(this.colors[0].color.metaColor);\n    } else {\n      this.metaColor = new RcColor(isArray ? '' : color);\n    }\n    if (!color || isArray && !this.colors) {\n      this.metaColor = this.metaColor.setA(0);\n      this.cleared = true;\n    }\n  }\n  return _createClass(AggregationColor, [{\n    key: \"toHsb\",\n    value: function toHsb() {\n      return this.metaColor.toHsb();\n    }\n  }, {\n    key: \"toHsbString\",\n    value: function toHsbString() {\n      return this.metaColor.toHsbString();\n    }\n  }, {\n    key: \"toHex\",\n    value: function toHex() {\n      return getHex(this.toHexString(), this.metaColor.a < 1);\n    }\n  }, {\n    key: \"toHexString\",\n    value: function toHexString() {\n      return this.metaColor.toHexString();\n    }\n  }, {\n    key: \"toRgb\",\n    value: function toRgb() {\n      return this.metaColor.toRgb();\n    }\n  }, {\n    key: \"toRgbString\",\n    value: function toRgbString() {\n      return this.metaColor.toRgbString();\n    }\n  }, {\n    key: \"isGradient\",\n    value: function isGradient() {\n      return !!this.colors && !this.cleared;\n    }\n  }, {\n    key: \"getColors\",\n    value: function getColors() {\n      return this.colors || [{\n        color: this,\n        percent: 0\n      }];\n    }\n  }, {\n    key: \"toCssString\",\n    value: function toCssString() {\n      const {\n        colors\n      } = this;\n      // CSS line-gradient\n      if (colors) {\n        const colorsStr = colors.map(c => `${c.color.toRgbString()} ${c.percent}%`).join(', ');\n        return `linear-gradient(90deg, ${colorsStr})`;\n      }\n      return this.metaColor.toRgbString();\n    }\n  }, {\n    key: \"equals\",\n    value: function equals(color) {\n      if (!color || this.isGradient() !== color.isGradient()) {\n        return false;\n      }\n      if (!this.isGradient()) {\n        return this.toHexString() === color.toHexString();\n      }\n      return this.colors.length === color.colors.length && this.colors.every((c, i) => {\n        const target = color.colors[i];\n        return c.percent === target.percent && c.color.equals(target.color);\n      });\n    }\n  }]);\n}();","map":{"version":3,"names":["_classCallCheck","_createClass","Color","RcColor","toHexFormat","value","alpha","replace","slice","getHex","AggregationColor","color","_a","cleared","metaColor","clone","colors","map","info","percent","isArray","Array","length","_ref","c","setA","key","toHsb","toHsbString","toHex","toHexString","a","toRgb","toRgbString","isGradient","getColors","toCssString","colorsStr","join","equals","every","i","target"],"sources":["/Users/nili/Documents/trae_projects/client/node_modules/antd/es/color-picker/color.js"],"sourcesContent":["import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport { Color as RcColor } from '@rc-component/color-picker';\nexport const toHexFormat = (value, alpha) => (value === null || value === void 0 ? void 0 : value.replace(/[^\\w/]/g, '').slice(0, alpha ? 8 : 6)) || '';\nexport const getHex = (value, alpha) => value ? toHexFormat(value, alpha) : '';\nexport let AggregationColor = /*#__PURE__*/function () {\n  function AggregationColor(color) {\n    _classCallCheck(this, AggregationColor);\n    var _a;\n    this.cleared = false;\n    // Clone from another AggregationColor\n    if (color instanceof AggregationColor) {\n      this.metaColor = color.metaColor.clone();\n      this.colors = (_a = color.colors) === null || _a === void 0 ? void 0 : _a.map(info => ({\n        color: new AggregationColor(info.color),\n        percent: info.percent\n      }));\n      this.cleared = color.cleared;\n      return;\n    }\n    const isArray = Array.isArray(color);\n    if (isArray && color.length) {\n      this.colors = color.map(({\n        color: c,\n        percent\n      }) => ({\n        color: new AggregationColor(c),\n        percent\n      }));\n      this.metaColor = new RcColor(this.colors[0].color.metaColor);\n    } else {\n      this.metaColor = new RcColor(isArray ? '' : color);\n    }\n    if (!color || isArray && !this.colors) {\n      this.metaColor = this.metaColor.setA(0);\n      this.cleared = true;\n    }\n  }\n  return _createClass(AggregationColor, [{\n    key: \"toHsb\",\n    value: function toHsb() {\n      return this.metaColor.toHsb();\n    }\n  }, {\n    key: \"toHsbString\",\n    value: function toHsbString() {\n      return this.metaColor.toHsbString();\n    }\n  }, {\n    key: \"toHex\",\n    value: function toHex() {\n      return getHex(this.toHexString(), this.metaColor.a < 1);\n    }\n  }, {\n    key: \"toHexString\",\n    value: function toHexString() {\n      return this.metaColor.toHexString();\n    }\n  }, {\n    key: \"toRgb\",\n    value: function toRgb() {\n      return this.metaColor.toRgb();\n    }\n  }, {\n    key: \"toRgbString\",\n    value: function toRgbString() {\n      return this.metaColor.toRgbString();\n    }\n  }, {\n    key: \"isGradient\",\n    value: function isGradient() {\n      return !!this.colors && !this.cleared;\n    }\n  }, {\n    key: \"getColors\",\n    value: function getColors() {\n      return this.colors || [{\n        color: this,\n        percent: 0\n      }];\n    }\n  }, {\n    key: \"toCssString\",\n    value: function toCssString() {\n      const {\n        colors\n      } = this;\n      // CSS line-gradient\n      if (colors) {\n        const colorsStr = colors.map(c => `${c.color.toRgbString()} ${c.percent}%`).join(', ');\n        return `linear-gradient(90deg, ${colorsStr})`;\n      }\n      return this.metaColor.toRgbString();\n    }\n  }, {\n    key: \"equals\",\n    value: function equals(color) {\n      if (!color || this.isGradient() !== color.isGradient()) {\n        return false;\n      }\n      if (!this.isGradient()) {\n        return this.toHexString() === color.toHexString();\n      }\n      return this.colors.length === color.colors.length && this.colors.every((c, i) => {\n        const target = color.colors[i];\n        return c.percent === target.percent && c.color.equals(target.color);\n      });\n    }\n  }]);\n}();"],"mappings":"AAAA,OAAOA,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,SAASC,KAAK,IAAIC,OAAO,QAAQ,4BAA4B;AAC7D,OAAO,MAAMC,WAAW,GAAGA,CAACC,KAAK,EAAEC,KAAK,KAAK,CAACD,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,KAAK,CAACE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,EAAEF,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE;AACvJ,OAAO,MAAMG,MAAM,GAAGA,CAACJ,KAAK,EAAEC,KAAK,KAAKD,KAAK,GAAGD,WAAW,CAACC,KAAK,EAAEC,KAAK,CAAC,GAAG,EAAE;AAC9E,OAAO,IAAII,gBAAgB,GAAG,aAAa,YAAY;EACrD,SAASA,gBAAgBA,CAACC,KAAK,EAAE;IAC/BX,eAAe,CAAC,IAAI,EAAEU,gBAAgB,CAAC;IACvC,IAAIE,EAAE;IACN,IAAI,CAACC,OAAO,GAAG,KAAK;IACpB;IACA,IAAIF,KAAK,YAAYD,gBAAgB,EAAE;MACrC,IAAI,CAACI,SAAS,GAAGH,KAAK,CAACG,SAAS,CAACC,KAAK,CAAC,CAAC;MACxC,IAAI,CAACC,MAAM,GAAG,CAACJ,EAAE,GAAGD,KAAK,CAACK,MAAM,MAAM,IAAI,IAAIJ,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,EAAE,CAACK,GAAG,CAACC,IAAI,KAAK;QACrFP,KAAK,EAAE,IAAID,gBAAgB,CAACQ,IAAI,CAACP,KAAK,CAAC;QACvCQ,OAAO,EAAED,IAAI,CAACC;MAChB,CAAC,C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