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/node_modules/color-space/xyz.js","webpack://sakurairo-scripts/./node_modules/.pnpm/color-space@2.0.1/node_modules/color-space/lab.js","webpack://sakurairo-scripts/./node_modules/.pnpm/@kotorik+palette@3.0.4/node_modules/@kotorik/palette/dist/index.js","webpack://sakurairo-scripts/./node_modules/.pnpm/@kotorik+promise-worker@0.1.0/node_modules/@kotorik/promise-worker/dist/register.mjs","webpack://sakurairo-scripts/./src/app/theme-color/calc.ts"],"sourcesContent":["/**\n * CIE XYZ\n *\n * @module color-space/xyz\n */\nimport rgb from './rgb.js';\n\nvar xyz = {\n\tname: 'xyz',\n\tmin: [0,0,0],\n\tchannel: ['X','Y','Z'],\n\talias: ['XYZ', 'ciexyz', 'cie1931']\n};\n\n\n/**\n * Whitepoint reference values with observer/illuminant\n *\n * http://en.wikipedia.org/wiki/Standard_illuminant\n */\nxyz.whitepoint = {\n\t//1931 2°\n\t2: {\n\t\t//incadescent\n\t\tA:[109.85, 100, 35.585],\n\t\t// B:[],\n\t\tC: [98.074, 100, 118.232],\n\t\tD50: [96.422, 100, 82.521],\n\t\tD55: [95.682, 100, 92.149],\n\t\t//daylight\n\t\tD65: [95.045592705167, 100, 108.9057750759878],\n\t\tD75: [94.972, 100, 122.638],\n\t\t//flourescent\n\t\t// F1: [],\n\t\tF2: [99.187, 100, 67.395],\n\t\t// F3: [],\n\t\t// F4: [],\n\t\t// F5: [],\n\t\t// F6:[],\n\t\tF7: [95.044, 100, 108.755],\n\t\t// F8: [],\n\t\t// F9: [],\n\t\t// F10: [],\n\t\tF11: [100.966, 100, 64.370],\n\t\t// F12: [],\n\t\tE: [100,100,100]\n\t},\n\n\t//1964 10°\n\t10: {\n\t\t//incadescent\n\t\tA:[111.144, 100, 35.200],\n\t\tC: [97.285, 100, 116.145],\n\t\tD50: [96.720, 100, 81.427],\n\t\tD55: [95.799, 100, 90.926],\n\t\t//daylight\n\t\tD65: [94.811, 100, 107.304],\n\t\tD75: [94.416, 100, 120.641],\n\t\t//flourescent\n\t\tF2: [103.280, 100, 69.026],\n\t\tF7: [95.792, 100, 107.687],\n\t\tF11: [103.866, 100, 65.627],\n\t\tE: [100,100,100]\n\t}\n};\n\n\n/**\n * Top values are the whitepoint’s top values, default are D65\n */\nxyz.max = xyz.whitepoint[2].D65;\n\n\n/**\n * Transform xyz to rgb\n *\n * @param {Array} xyz Array of xyz values\n *\n * @return {Array} RGB values\n */\nxyz.rgb = function (_xyz, white) {\n\t//FIXME: make sure we have to divide like this. Probably we have to replace matrix as well then\n\twhite = white || xyz.whitepoint[2].E;\n\n\tvar x = _xyz[0] / white[0],\n\t\ty = _xyz[1] / white[1],\n\t\tz = _xyz[2] / white[2],\n\t\tr, g, b;\n\n\t// assume sRGB\n\t// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n\tr = (x * 3.240969941904521) + (y * -1.537383177570093) + (z * -0.498610760293);\n\tg = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175);\n\tb = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878);\n\n\tr = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n\t\t: r = (r * 12.92);\n\n\tg = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n\t\t: g = (g * 12.92);\n\n\tb = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n\t\t: b = (b * 12.92);\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n}\n\n\n\n/**\n * RGB to XYZ\n *\n * @param {Array} rgb RGB channels\n *\n * @return {Array} XYZ channels\n */\nrgb.xyz = function(rgb, white) {\n\tvar r = rgb[0] / 255,\n\t\t\tg = rgb[1] / 255,\n\t\t\tb = rgb[2] / 255;\n\n\t// assume sRGB\n\tr = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n\tvar x = (r * 0.41239079926595) + (g * 0.35758433938387) + (b * 0.18048078840183);\n\tvar y = (r * 0.21263900587151) + (g * 0.71516867876775) + (b * 0.072192315360733);\n\tvar z = (r * 0.019330818715591) + (g * 0.11919477979462) + (b * 0.95053215224966);\n\n\twhite = white || xyz.whitepoint[2].E;\n\n\treturn [x * white[0], y * white[1], z * white[2]];\n};\n\n\n\nexport default xyz;\n","/**\n * CIE LAB space model\n *\n * @module color-space/lab\n */\n\nimport xyz from './xyz.js';\n\nexport default {\n\tname: 'lab',\n\tmin: [0,-100,-100],\n\tmax: [100,100,100],\n\tchannel: ['lightness', 'a', 'b'],\n\talias: ['LAB', 'cielab'],\n\n\txyz: function(lab) {\n\t\tvar l = lab[0],\n\t\t\t\ta = lab[1],\n\t\t\t\tb = lab[2],\n\t\t\t\tx, y, z, y2;\n\n\t\tif (l <= 8) {\n\t\t\ty = (l * 100) / 903.3;\n\t\t\ty2 = (7.787 * (y / 100)) + (16 / 116);\n\t\t} else {\n\t\t\ty = 100 * Math.pow((l + 16) / 116, 3);\n\t\t\ty2 = Math.pow(y / 100, 1/3);\n\t\t}\n\n\t\tx = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3);\n\n\t\tz = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3);\n\n\t\treturn [x, y, z];\n\t}\n};\n\n\n//extend xyz\nxyz.lab = function(xyz){\n\tvar x = xyz[0],\n\t\t\ty = xyz[1],\n\t\t\tz = xyz[2],\n\t\t\tl, a, b;\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);\n\n\tl = (116 * y) - 16;\n\ta = 500 * (x - y);\n\tb = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n","import rgb from 'color-space/rgb.js';\nimport xyz from 'color-space/xyz.js';\nimport lab from 'color-space/lab.js';\n\nfunction _filled_array(fillWith, count) {\n const array = [];\n for (let i = 0; i < count; i++) {\n array.push(fillWith);\n }\n return array;\n}\nfunction euclidean_distance_squared_index(a, a_start, b) {\n const r = a[a_start++] - b[0];\n const g = a[a_start++] - b[1];\n const _b = a[a_start++] - b[2];\n return r ** 2 + g ** 2 + _b ** 2;\n}\nfunction kmeans(data, k, maxAttempt, thresold = 2, clipAlpha = false) {\n const cluster_sum = [];\n const thresold_squared = thresold ** 2;\n let pixelCount = data.length / 4;\n let cluster_centers = [];\n let new_cluster_centers = [];\n let iteration = 0;\n const isDataTypedArray = data instanceof Uint8ClampedArray;\n const PIXEL_LEN = clipAlpha ? 3 : 4;\n if (clipAlpha) {\n let j = 0;\n const dataNoAlpha = isDataTypedArray ? new Uint8ClampedArray(pixelCount * 3) : [];\n for (let i = 0; i < data.length; ) {\n if (data[i + 3] == 0) {\n i += 4;\n continue;\n }\n dataNoAlpha[j++] = data[i++];\n dataNoAlpha[j++] = data[i++];\n dataNoAlpha[j++] = data[i++];\n i++;\n }\n data = dataNoAlpha.slice(0, j);\n pixelCount = j / 3;\n }\n for (let i = 0; i < k; i++) {\n const start = Math.floor(1 * (pixelCount - 1)) * PIXEL_LEN;\n cluster_centers.push(\n /* Array.from */\n data.slice(start, start + 3)\n );\n new_cluster_centers.push(isDataTypedArray ? new Uint8ClampedArray(3) : _filled_array(0, 3));\n cluster_sum.push(_filled_array(0, 4));\n }\n while (iteration < maxAttempt) {\n for (let i = 0; i < data.length; ) {\n let cluster_index = 0;\n let _min_distance = euclidean_distance_squared_index(data, i, cluster_centers[0]);\n for (let j = 1; j < k; j++) {\n const distance = euclidean_distance_squared_index(data, i, cluster_centers[j]);\n if (distance < _min_distance) {\n _min_distance = distance;\n cluster_index = j;\n }\n }\n const sum = cluster_sum[cluster_index];\n sum[0] += data[i++];\n sum[1] += data[i++];\n sum[2] += data[i++];\n sum[3]++;\n if (PIXEL_LEN === 4) i++;\n }\n let allStabled = true;\n for (let i = 0; i < k; i++) {\n const rgbc = cluster_sum[i];\n const count = rgbc[3];\n if (count == 0) {\n const start = Math.floor(Math.random() * (pixelCount - 1)) * PIXEL_LEN;\n new_cluster_centers[i] = /* Array.from */\n data.slice(start, start + 3);\n allStabled = false;\n } else {\n let new_center = new_cluster_centers[i];\n let diffSquared = 0;\n for (let j = 0; j < 3; j++) {\n new_center[j] = rgbc[j] / count;\n diffSquared += (new_center[j] - cluster_centers[i][j]) ** 2;\n }\n if (diffSquared > thresold_squared) {\n allStabled = false;\n }\n }\n }\n if (allStabled) {\n return {\n centroid: new_cluster_centers,\n iteration,\n fit: true,\n label: cluster_sum.map((v) => v[3]),\n size: pixelCount\n };\n }\n const medium = cluster_centers;\n cluster_centers = new_cluster_centers;\n new_cluster_centers = medium;\n iteration++;\n for (let i = 0; i < k; i++) {\n cluster_sum[i].fill(0);\n }\n }\n return {\n centroid: cluster_centers,\n iteration,\n fit: false,\n label: cluster_sum.map((v) => v[3]),\n size: pixelCount\n };\n}\n\n/**\n * NeuQuant Neural-Network Quantization Algorithm\n *\n * Copyright (c) 1994 Anthony Dekker\n *\n * See \"Kohonen neural networks for optimal colour quantization\" in \"Network:\n * Computation in Neural Systems\" Vol. 5 (1994) pp 351-367. for a discussion of\n * the algorithm.\n *\n * See also http://members.ozemail.com.au/~dekker/NEUQUANT.HTML\n *\n * Any party obtaining a copy of these files from the author, directly or\n * indirectly, is granted, free of charge, a full and unrestricted irrevocable,\n * world-wide, paid up, royalty-free, nonexclusive right and license to deal in\n * this software and documentation files (the \"Software\"), including without\n * limitation the rights to use, copy, modify, merge, publish, distribute,\n * sublicense, and/or sell copies of the Software, and to permit persons who\n * receive copies from any such party to do so, with the only requirement being\n * that this copyright notice remain intact.\n *\n * Copyright (c) 2012 Johan Nordberg (JavaScript port)\n * Copyright (c) 2014 Devon Govett (JavaScript port)\n */\n\nconst prime1 = 499;\nconst prime2 = 491;\nconst prime3 = 487;\nconst prime4 = 503;\n\nconst maxprime = Math.max(prime1, prime2, prime3, prime4);\nconst minpicturebytes = (3 * maxprime);\n\nconst defaults = {\n ncycles: 100,\n netsize: 256,\n samplefac: 10\n};\n\nconst assign = function (target) {\n for (let i = 1, l = arguments.length; i < l; i++) {\n const nextSource = arguments[i];\n if (nextSource != null) {\n for (const nextKey in nextSource) {\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n target[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n return target\n};\n\nclass NeuQuant {\n constructor (pixels, options) {\n assign(this, defaults, {pixels}, options);\n\n if (this.netsize < 4 || this.netsize > 256) {\n throw new Error('Color count must be between 4 and 256')\n }\n\n if (this.samplefac < 1 || this.samplefac > 30) {\n throw new Error('Sampling factor must be between 1 and 30')\n }\n\n this.maxnetpos = this.netsize - 1;\n\n this.netbiasshift = 4;\n this.intbiasshift = 16;\n this.intbias = (1 << this.intbiasshift);\n this.gammashift = 10;\n this.gamma = (1 << this.gammashift);\n this.betashift = 10;\n this.beta = (this.intbias >> this.betashift);\n this.betagamma = (this.beta * this.gamma);\n\n this.initrad = (this.netsize >> 3);\n this.radiusbiasshift = 6;\n this.radiusbias = (1 << this.radiusbiasshift);\n this.initradius = (this.initrad * this.radiusbias);\n this.radiusdec = 30;\n\n this.alphabiasshift = 10;\n this.initalpha = (1 << this.alphabiasshift);\n\n this.radbiasshift = 8;\n this.radbias = (1 << this.radbiasshift);\n this.alpharadbshift = (this.alphabiasshift + this.radbiasshift);\n this.alpharadbias = (1 << this.alpharadbshift);\n\n this.network = [];\n this.netindex = new Uint32Array(256);\n this.bias = new Uint32Array(this.netsize);\n this.freq = new Uint32Array(this.netsize);\n this.radpower = new Uint32Array(this.netsize >> 3);\n\n for (let i = 0, l = this.netsize; i < l; i++) {\n let v = (i << (this.netbiasshift + 8)) / this.netsize;\n this.network[i] = new Float64Array([v, v, v, 0]);\n this.freq[i] = this.intbias / this.netsize;\n this.bias[i] = 0;\n }\n }\n\n unbiasnet () {\n for (let i = 0, l = this.netsize; i < l; i++) {\n this.network[i][0] >>= this.netbiasshift;\n this.network[i][1] >>= this.netbiasshift;\n this.network[i][2] >>= this.netbiasshift;\n this.network[i][3] = i;\n }\n }\n\n altersingle (alpha, i, b, g, r) {\n this.network[i][0] -= (alpha * (this.network[i][0] - b)) / this.initalpha;\n this.network[i][1] -= (alpha * (this.network[i][1] - g)) / this.initalpha;\n this.network[i][2] -= (alpha * (this.network[i][2] - r)) / this.initalpha;\n }\n\n alterneigh (radius, i, b, g, r) {\n const lo = Math.abs(i - radius);\n const hi = Math.min(i + radius, this.netsize);\n\n let j = i + 1;\n let k = i - 1;\n let m = 1;\n\n while ((j < hi) || (k > lo)) {\n const a = this.radpower[m++];\n\n if (j < hi) {\n const p = this.network[j++];\n p[0] -= (a * (p[0] - b)) / this.alpharadbias;\n p[1] -= (a * (p[1] - g)) / this.alpharadbias;\n p[2] -= (a * (p[2] - r)) / this.alpharadbias;\n }\n\n if (k > lo) {\n const p = this.network[k--];\n p[0] -= (a * (p[0] - b)) / this.alpharadbias;\n p[1] -= (a * (p[1] - g)) / this.alpharadbias;\n p[2] -= (a * (p[2] - r)) / this.alpharadbias;\n }\n }\n }\n\n contest (b, g, r) {\n let bestd = ~(1 << 31);\n let bestbiasd = bestd;\n let bestpos = -1;\n let bestbiaspos = bestpos;\n\n for (let i = 0, l = this.netsize; i < l; i++) {\n let n = this.network[i];\n\n let dist = Math.abs(n[0] - b) + Math.abs(n[1] - g) + Math.abs(n[2] - r);\n if (dist < bestd) {\n bestd = dist;\n bestpos = i;\n }\n\n let biasdist = dist - ((this.bias[i]) >> (this.intbiasshift - this.netbiasshift));\n if (biasdist < bestbiasd) {\n bestbiasd = biasdist;\n bestbiaspos = i;\n }\n\n let betafreq = (this.freq[i] >> this.betashift);\n this.freq[i] -= betafreq;\n this.bias[i] += (betafreq << this.gammashift);\n }\n\n this.freq[bestpos] += this.beta;\n this.bias[bestpos] -= this.betagamma;\n\n return bestbiaspos\n }\n\n inxbuild () {\n let previouscol = 0;\n let startpos = 0;\n\n for (let i = 0, l = this.netsize; i < l; i++) {\n let p = this.network[i];\n let q = null;\n let smallpos = i;\n let smallval = p[1];\n\n for (let j = i + 1; j < l; j++) {\n q = this.network[j];\n if (q[1] < smallval) {\n smallpos = j;\n smallval = q[1];\n }\n }\n q = this.network[smallpos];\n\n if (i !== smallpos) {\n [p[0], q[0]] = [q[0], p[0]];\n [p[1], q[1]] = [q[1], p[1]];\n [p[2], q[2]] = [q[2], p[2]];\n [p[3], q[3]] = [q[3], p[3]];\n }\n\n if (smallval !== previouscol) {\n this.netindex[previouscol] = (startpos + i) >> 1;\n for (let j = previouscol + 1; j < smallval; j++) {\n this.netindex[j] = i;\n }\n previouscol = smallval;\n startpos = i;\n }\n }\n\n this.netindex[previouscol] = (startpos + this.maxnetpos) >> 1;\n for (let i = previouscol + 1; i < 256; i++) {\n this.netindex[i] = this.maxnetpos;\n }\n }\n\n learn () {\n const lengthcount = this.pixels.length;\n const alphadec = 30 + ((this.samplefac - 1) / 3);\n const samplepixels = lengthcount / (3 * this.samplefac);\n\n let delta = samplepixels / this.ncycles | 0;\n let alpha = this.initalpha;\n let radius = this.initradius;\n\n let rad = radius >> this.radiusbiasshift;\n\n if (rad <= 1) {\n rad = 0;\n }\n\n for (let i = 0; i < rad; i++) {\n this.radpower[i] = alpha * (((rad * rad - i * i) * this.radbias) / (rad * rad));\n }\n\n let step;\n if (lengthcount < minpicturebytes) {\n this.samplefac = 1;\n step = 3;\n } else if ((lengthcount % prime1) !== 0) {\n step = 3 * prime1;\n } else if ((lengthcount % prime2) !== 0) {\n step = 3 * prime2;\n } else if ((lengthcount % prime3) !== 0) {\n step = 3 * prime3;\n } else {\n step = 3 * prime4;\n }\n\n let pix = 0;\n\n for (let i = 0; i < samplepixels;) {\n let b = (this.pixels[pix] & 0xff) << this.netbiasshift;\n let g = (this.pixels[pix + 1] & 0xff) << this.netbiasshift;\n let r = (this.pixels[pix + 2] & 0xff) << this.netbiasshift;\n\n let j = this.contest(b, g, r);\n this.altersingle(alpha, j, b, g, r);\n if (rad !== 0) {\n this.alterneigh(rad, j, b, g, r);\n }\n\n pix += step;\n if (pix >= lengthcount) {\n pix -= lengthcount;\n }\n\n if (delta === 0) {\n delta = 1;\n }\n\n if (++i % delta === 0) {\n alpha -= alpha / alphadec;\n radius -= radius / this.radiusdec;\n rad = radius >> this.radiusbiasshift;\n\n if (rad <= 1) {\n rad = 0;\n }\n\n for (let k = 0; k < rad; k++) {\n this.radpower[k] = alpha * (((rad * rad - k * k) * this.radbias) / (rad * rad));\n }\n }\n }\n }\n\n buildColorMap () {\n this.learn();\n this.unbiasnet();\n this.inxbuild();\n }\n\n getColorMap () {\n const map = new Uint8Array(this.netsize * 3);\n const index = new Uint8Array(this.netsize);\n\n for (let i = 0, l = this.netsize; i < l; i++) {\n index[this.network[i][3]] = i;\n }\n\n for (let i = 0, j = 0, k = 0, l = this.netsize; i < l; i++) {\n k = index[i];\n map[j++] = this.network[k][0] & 0xff;\n map[j++] = this.network[k][1] & 0xff;\n map[j++] = this.network[k][2] & 0xff;\n }\n\n return map\n }\n}\n\nfunction findClosest (palette, r, g, b) {\n let minpos = 0;\n let mind = 256 * 256 * 256;\n\n for (let i = 0, l = palette.length; i < l;) {\n const dr = r - palette[i++];\n const dg = g - palette[i++];\n const db = b - palette[i];\n const d = dr * dr + dg * dg + db * db;\n const pos = i / 3 | 0;\n\n if (d < mind) {\n mind = d;\n minpos = pos;\n }\n\n i++;\n }\n\n return minpos\n}\n\nfunction palette (pixels, options) {\n const nq = new NeuQuant(pixels, options);\n nq.buildColorMap();\n return nq.getColorMap()\n}\n\nfunction indexed (pixels, palette) {\n const indexed = new Uint8Array(pixels.length / 3);\n const memo = {};\n\n for (let i = 0, j = 0, l = pixels.length; i < l;) {\n const r = pixels[i++];\n const g = pixels[i++];\n const b = pixels[i++];\n const k = r << 16 | g << 8 | b;\n\n if (k in memo) {\n indexed[j++] = memo[k];\n } else {\n indexed[j++] = memo[k] = findClosest(palette, r, g, b);\n }\n }\n\n return indexed\n}\n\nfunction rgba2Rgb(data) {\n const rgb = new Uint8ClampedArray(data.length / 4 * 3);\n const len = data.length;\n let rgb_i = 0;\n for (let i = 0; i < len; ) {\n for (let j = 0; j < 3; j++) {\n rgb[rgb_i++] = data[i++];\n }\n i++;\n }\n return rgb;\n}\nfunction neuquant(img, k, samplefac = 1) {\n const img_rgb = rgba2Rgb(img);\n const palette$1 = palette(img_rgb, { netsize: k, samplefac });\n const indexed_pixel = indexed(img_rgb, palette$1);\n const pixel = [];\n const len = palette$1.length;\n for (let i = 0; i < len; ) {\n pixel.push([palette$1[i++], palette$1[i++], palette$1[i++], 255]);\n }\n return { centroid: pixel, label: count(k, indexed_pixel) };\n}\nfunction count(k, index) {\n const counts = new Array(k).fill(0);\n for (const i of index) {\n counts[i]++;\n }\n return counts;\n}\n\nfunction _prepare2DContext(width, height) {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n canvas.height = height;\n canvas.width = width;\n return ctx;\n}\nfunction _prepare2DContextAsync(width, height) {\n const canvas = new OffscreenCanvas(width, height);\n const ctx = canvas.getContext(\"2d\");\n return ctx;\n}\nfunction awaitImage(imgElement) {\n return new Promise((resolve, reject) => {\n if (imgElement.complete) {\n resolve();\n } else {\n imgElement.addEventListener(\"load\", (e) => {\n resolve(e);\n });\n imgElement.addEventListener(\"error\", (reason) => {\n reject(reason);\n });\n }\n });\n}\nfunction _readImage(prepareCtx, imgSource) {\n const { naturalWidth, naturalHeight } = imgSource;\n const ctx = prepareCtx(naturalWidth, naturalHeight);\n ctx.drawImage(imgSource, 0, 0, naturalWidth, naturalHeight);\n return ctx.getImageData(0, 0, naturalWidth, naturalHeight);\n}\nconst readImage = _readImage.bind(void 0, _prepare2DContext);\nconst readImageOffscreen = _readImage.bind(void 0, _prepare2DContextAsync);\nfunction _readImageDownsampling(prepareCtx, imgSource, maxSample) {\n let { naturalWidth: width, naturalHeight: height } = imgSource;\n const scale = width * height / maxSample;\n if (scale > 1) {\n const scaleSqrt = Math.sqrt(scale);\n width = width / scaleSqrt | 0;\n height = height / scaleSqrt | 0;\n }\n const ctx = prepareCtx(width, height);\n ctx.drawImage(imgSource, 0, 0, width, height);\n return ctx.getImageData(0, 0, width, height);\n}\nconst readImageDownsampling = _readImageDownsampling.bind(void 0, _prepare2DContext);\nconst readImageDownsamplingOffscreen = _readImageDownsampling.bind(void 0, _prepare2DContextAsync);\n\nfunction convertToLab(source) {\n const array = [];\n for (let i = 0; i < source.length; i += 4) {\n const pixel = source.slice(i, i + 4);\n const alpha = pixel[3];\n const pixel_rgb = pixel.slice(0, 3);\n const pixel_xyz = rgb.xyz(pixel_rgb);\n const pixel_lab = xyz.lab(pixel_xyz);\n array.push(...pixel_lab, alpha);\n }\n return array;\n}\nfunction labaToRGBA(laba) {\n const pixel_lab = laba.slice(0, 3);\n const alpha = laba[3];\n const pixel_xyz = lab.xyz(pixel_lab);\n const pixel_rgb = xyz.rgb(pixel_xyz);\n pixel_rgb.push(alpha);\n return pixel_rgb;\n}\n\nfunction max_min_of_three([a, b, c]) {\n if (a > b) {\n if (b > c) {\n return [a, c];\n } else {\n if (a > c) {\n return [a, b];\n } else {\n return [c, b];\n }\n }\n } else {\n if (b > c) {\n if (c > a) {\n return [b, a];\n } else {\n return [b, c];\n }\n } else {\n return [c, a];\n }\n }\n}\n\nfunction normalizeRGBA(rgba) {\n return rgba.map((v) => v / 255);\n}\nfunction rgbaToHSLA(rgba) {\n let h, s;\n const [max, min] = max_min_of_three(rgba);\n const diff = max - min;\n const light_2x = max + min;\n if (diff == 0) {\n h = 0;\n s = 0;\n } else {\n if (max == rgba[0]) {\n const temp_h = 60 * (rgba[1] - rgba[2]) / diff;\n if (temp_h < 0) {\n h = temp_h + 360;\n } else {\n h = temp_h;\n }\n } else if (max == rgba[1]) {\n h = 60 * (rgba[2] - rgba[0]) / diff + 120;\n } else {\n h = 60 * (rgba[0] - rgba[1]) / diff + 240;\n }\n if (light_2x == 0) {\n s = 0;\n } else if (light_2x <= 1) {\n s = diff / light_2x;\n } else {\n s = diff / (2 - light_2x);\n }\n }\n return [h, s, light_2x / 2, rgba[3]];\n}\nconst getVector4Comparer = (sort = [0, 1, 2, 3]) => (a, b) => {\n let result;\n for (const s of sort) {\n result = a[s] - b[s];\n if (result != 0) {\n return result;\n }\n }\n return result;\n};\nconst hslaCSSText = ([h, s, l, a]) => `hsla(${h}deg,${s * 100}%,${l * 100}%,${a})`;\nconst rgbaCSSText = (pixel) => `rgba(${pixel.map((v) => Math.floor(v)).join(\",\")})`;\n\nexport { awaitImage, convertToLab, getVector4Comparer, hslaCSSText, kmeans, labaToRGBA, neuquant, normalizeRGBA, readImage, readImageDownsampling, readImageDownsamplingOffscreen, readImageOffscreen, rgbaCSSText, rgbaToHSLA };\n","export default function registerPromiseWorker(callback) {\n self.addEventListener('message', async (e) => {\n const payload = e.data;\n const messageId = payload[0];\n const message = payload[1];\n try {\n const transferList = [];\n const callbackResult = await callback(message, (t) => transferList.push(t));\n self.postMessage([messageId, null, callbackResult], transferList.length ? { transfer: transferList } : undefined);\n }\n catch (error) {\n self.postMessage([messageId, {\n message: error.message\n }]);\n }\n });\n}\n","import { neuquant } from '@kotorik/palette';\nexport default function neuquantCalc(data) {\n const { label, centroid } = neuquant(data, 8);\n const max = Math.max(...label);\n const index = label.findIndex(value => value == max);\n return centroid[index];\n}\n"],"names":["name","min","channel","alias","A","C","D50","D55","D65","D75","F2","F7","F11","E","max","whitepoint","rgb","_xyz","white","r","g","b","x","y","z","Math","pow","lab","xyz","minpicturebytes","defaults","ncycles","netsize","samplefac","NeuQuant","constructor","pixels","options","target","i","l","arguments","length","nextSource","nextKey","Object","prototype","hasOwnProperty","call","this","Error","maxnetpos","netbiasshift","intbiasshift","intbias","gammashift","gamma","betashift","beta","betagamma","initrad","radiusbiasshift","radiusbias","initradius","radiusdec","alphabiasshift","initalpha","radbiasshift","radbias","alpharadbshift","alpharadbias","network","netindex","Uint32Array","bias","freq","radpower","v","Float64Array","unbiasnet","altersingle","alpha","alterneigh","radius","lo","abs","hi","j","k","m","a","p","contest","bestd","bestbiasd","bestpos","bestbiaspos","n","dist","biasdist","betafreq","inxbuild","previouscol","startpos","q","smallpos","smallval","learn","lengthcount","alphadec","samplepixels","step","delta","rad","pix","buildColorMap","getColorMap","map","Uint8Array","index","findClosest","palette","minpos","mind","dr","dg","db","d","neuquant","img","img_rgb","data","Uint8ClampedArray","len","rgb_i","rgba2Rgb","palette$1","nq","indexed_pixel","indexed","memo","pixel","push","centroid","label","count","counts","Array","fill","_prepare2DContext","width","height","canvas","document","createElement","ctx","getContext","_prepare2DContextAsync","OffscreenCanvas","_readImage","prepareCtx","imgSource","naturalWidth","naturalHeight","drawImage","getImageData","bind","_readImageDownsampling","maxSample","scale","scaleSqrt","sqrt","callback","findIndex","value","self","addEventListener","async","e","payload","messageId","message","transferList","callbackResult","t","postMessage","transfer","undefined","error"],"sourceRoot":""}