<commit_before>{Layer, layerProperty} = require "./Layer"
{Color} = require "./Color"

dashArrayTransform = (value) ->
	if _.isString value
		values = []
		if value.indexOf(",") isnt -1
			values = value.split(',')
		else
			values = value.split(" ")
		values = values.map((v) -> parseInt(v.trim()))
		return values
	return value

class SVGPath extends Layer
	@define "fill", layerProperty(@, "fill", "fill", null, Color.validColorValue, Color.toColor)
	@define "stroke", layerProperty(@, "stroke", "stroke", null, Color.validColorValue, Color.toColor)
	@define "strokeWidth", layerProperty(@, "strokeWidth", "strokeWidth", null, _.isNumber)
	@define "strokeDashoffset", layerProperty(@, "strokeDashoffset", "strokeDashoffset", null, _.isNumber)
	@define "strokeDasharray", layerProperty(@, "strokeDasharray", "strokeDasharray", [], _.isArray, dashArrayTransform)

	@define "length",
		get: ->
			@_length

<commit_msg>Added a bunch of path properties<commit_after>{Layer, layerProperty} = require "./Layer"
{Color} = require "./Color"

dashArrayTransform = (value) ->
	if _.isString value
		values = []
		if value.indexOf(",") isnt -1
			values = value.split(',')
		else
			values = value.split(" ")
		values = values.map((v) -> parseInt(v.trim()))
		return values
	return value

class SVGPath extends Layer
	@define "fill", layerProperty(@, "fill", "fill", null, Color.validColorValue, Color.toColor)
	@define "stroke", layerProperty(@, "stroke", "stroke", null, Color.validColorValue, Color.toColor)
	@define "strokeWidth", layerProperty(@, "strokeWidth", "strokeWidth", null, _.isNumber, parseFloat)
	@define "strokeDasharray", layerProperty(@, "strokeDasharray", "strokeDasharray", [], _.isArray, dashArrayTransform)
	@define "strokeDashoffset", layerProperty(@, "strokeDashoffset", "strokeDashoffset", null, _.isNumber, parseFloat)
	@define "strokeLength", layerProperty @, "strokeLength", null, null, _.isNumber, null, {}, (path, value) ->
		path._properties.strokeFraction = value / path.length
		if _.isEmpty path.strokeDasharray
			path.strokeDasharray = [path.length]
		path.strokeDashoffset = path.length - value
	@define "strokeFraction", layerProperty @, "strokeFraction", null, null, _.isNumber, null, {}, (path, value) ->
		path.strokeLength = path.length * value

	@define "length",
		get: ->
			@_length


{'fraction_non_alphanumeric': 0.16185966422729228, 'fraction_numerical': 0.0008609556607834697, 'mean_word_length': 5.332425068119891, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2932618', 'n_tokens_mistral': 754, 'n_tokens_neox': 724, 'n_words': 189}