Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tartan

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tartan - npm Package Compare versions

Comparing version 4.3.0 to 5.0.0

3

dist/tartan.min.js

@@ -1,3 +0,2 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("_")):"function"==typeof define&&define.amd?define(["_"],r):"object"==typeof exports?exports.tartan=r(require("_")):e.tartan=r(e._)}(this,function(e){return function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";var n=t(1);n.extend(e.exports,t(2)),e.exports.defaults=t(3),e.exports.parse=t(11),e.exports.filter=t(25),e.exports.transform=t(28),e.exports.syntax=t(36),e.exports.render=t(40),e.exports.schema=t(44),e.exports.utils=t(4)},function(r,t){r.exports=e},function(e,r){e.exports={version:"4.3.0"}},function(e,r,t){"use strict";var n=t(4);e.exports.weave={plain:[1,1],serge:[2,2]},e.exports.colors=n.color.buildColorMap({B:"#304080",G:"#004c00",K:"#000000",N:"#666666",R:"#c80000",T:"#603311",W:"#ffffff",Y:"#ffe600"}),e.exports.warpAndWeftSeparator="//",e.exports.insignificantTokens=["invalid","whitespace"]},function(e,r,t){"use strict";e.exports.error=t(5),e.exports.color=t(6),e.exports.token=t(7),e.exports.node=t(8),e.exports.sett=t(9),e.exports.repaint=t(10)},function(e,r){"use strict";var t={error:"error",warning:"warning",notice:"notice"},n={invalidToken:"Invalid token",zeroWidthStripe:"Zero-width stripe",unexpectedToken:"Unexpected token",orphanedPivot:"Orphaned pivot",multipleWarpAnWeftSeparator:"Only one warp/weft separator is allowed",unmatchedBlockStart:"Unmatched block start",unmatchedBlockEnd:"Unmatched block end",extraTokenInInputSequence:"Extra token in input sequence",invalidMultiplier:"Invalid multiplier value; replaced with default (1)"};e.exports.severity=t,e.exports.message=n},function(e,r,t){"use strict";function n(e,r){return r?/^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(e):/^#[0-9a-f]{6}$/i.test(e)}function o(e,r){return e=e.replace(/^\s*#/g,"").replace(/\s+$/g,"").toUpperCase(),r=r.replace(/^\s*#/g,"").replace(/\s+$/g,"").toUpperCase(),e==r}function i(e){return/^#?[0-9a-f]{6}$/i.test(e)?"#"+e.replace(/^#/,"").toUpperCase():/^#?[0-9a-f]{3}$/i.test(e)?"#"+e.replace(/^#/,"").replace(/[0-9a-f]/gi,"$&$&").toUpperCase():e}function a(e){var r={};return s.isArray(e)?s.each(e,function(e){r[e.name.toUpperCase()]={value:i(e.color),comment:s.isString(e.comment)?e.comment:""}}):s.isObject(e)&&s.each(e,function(e,t){r[t.toUpperCase()]={value:i(e),comment:""}}),r}var s=t(1);e.exports.isValidColor=n,e.exports.isSameColor=o,e.exports.normalizeColor=i,e.exports.buildColorMap=a},function(e,r,t){"use strict";function n(e,r){return P.isObject(e)&&e.type==r}function o(e){return n(e,H.invalid)}function i(e){return n(e,H.whitespace)}function a(e){return n(e,H.color)}function s(e){return n(e,H.stripe)}function c(e){return n(e,H.pivot)}function u(e){return n(e,H.literal)}function l(e){return n(e,H.repeat)}function f(e){return u(e)&&("["==e.value||"]"==e.value)}function p(e){return u(e)&&"["==e.value}function m(e){return u(e)&&"]"==e.value}function d(e){return u(e)&&("("==e.value||")"==e.value)}function h(e){return u(e)&&"("==e.value}function v(e){return u(e)&&")"==e.value}function w(e){return c(e)&&(e=P.clone(e),e.type=H.stripe),e}function x(e){return s(e)&&(e=P.clone(e),e.type=H.pivot),e}function g(e,r){var t={type:e,source:"",offset:-1,length:-1};return P.isString(r)&&(t.value=r,t.length=r.length),t}function S(e){return g(H.invalid,e)}function k(e){return g(H.whitespace,e)}function y(e,r){var t=g(H.color);return t.name=e,t.color=r,t}function b(e,r){r=parseInt(r,10)||0,r<0&&(r=0);var t=g(H.stripe);return t.name=e,t.count=r,t}function A(e,r){r=parseInt(r,10)||0,r<0&&(r=0);var t=g(H.pivot);return t.name=e,t.count=r,t}function B(e){return g(H.literal,e)}function W(){return g(H.literal,"[")}function T(){return g(H.literal,"]")}function O(e){return g(H.literal,e)}function C(){return g(H.literal,"(")}function j(){return g(H.literal,")")}function F(e){return g(H.literal,e)}function R(e){var r=g(H.repeat);return r.count=parseInt(e,10)||0,r.count<=0&&(r.count=1),r}var P=t(1),H={invalid:"invalid",whitespace:"whitespace",color:"color",stripe:"stripe",pivot:"pivot",literal:"literal",repeat:"repeat"};e.exports=H,e.exports.isToken=n,e.exports.isInvalid=o,e.exports.isWhitespace=i,e.exports.isColor=a,e.exports.isStripe=s,e.exports.isPivot=c,e.exports.isSquareBracket=f,e.exports.isOpeningSquareBracket=p,e.exports.isClosingSquareBracket=m,e.exports.isParenthesis=d,e.exports.isOpeningParenthesis=h,e.exports.isClosingParenthesis=v,e.exports.isLiteral=u,e.exports.isRepeat=l,e.exports.pivotToStripe=w,e.exports.stripeToPivot=x,e.exports.newToken=g,e.exports.newInvalid=S,e.exports.newWhitespace=k,e.exports.newColor=y,e.exports.newStripe=b,e.exports.newPivot=A,e.exports.newSquareBracket=B,e.exports.newOpeningSquareBracket=W,e.exports.newClosingSquareBracket=T,e.exports.newParenthesis=O,e.exports.newOpeningParenthesis=C,e.exports.newClosingParenthesis=j,e.exports.newLiteral=F,e.exports.newRepeat=R},function(e,r,t){"use strict";function n(e){return{isStripe:!0,name:e.name,count:e.count}}function o(e,r,t){return t=parseInt(t,10)||0,{isBlock:!0,items:l.filter(e,l.isObject),reflect:!!r,repeat:t>=1?t:1}}function i(e,r,t){var n=o(e,r,t);return n.isRoot=!0,n}function a(e){var r=parseInt(e,10)||0;return r>1?r:1}function s(e){return l.isObject(e)?e.isStripe&&e.count>0?e.name+e.count*a(e.repeat):e.isBlock&&l.isArray(e.items)&&e.items.length>0?"["+(e.isRoot?"R":"B")+"*"+a(e.repeat)+"/"+(e.reflect?"RF":"RP")+":"+l.chain(e.items).map(s).join("").value()+"]":"":""}function c(e,r){var t=0,n=0;if(l.isObject(e)&&(e.isStripe&&t++,e.isBlock&&l.isArray(e.items)&&e.items.length>0)){e.isRoot||n++;var o=e.reflect?2:1;l.each(e.items,function(r){if(l.isObject(r)){if(r.isBlock){var i=c(r,!0);n+=i.blocks*o}r.isStripe&&e.isRoot&&!e.reflect&&t++}})}return r?{blocks:n,stripes:t}:0==n&&0==t?e.isRoot?0:Number.MAX_VALUE:Math.sqrt(n*n+t*t)}function u(e,r){if(!l.isObject(e)||!l.isObject(r))return!1;if(e.isStripe&&r.isStripe)return e.name==r.name&&e.count*a(e.repeat)==r.count*a(r.repeat);if(e.isBlock&&r.isBlock){if(e.isRoot!=r.isRoot)return!1;if(e.reflect!=r.reflect)return!1;if(a(e.repeat)!=a(r.repeat))return!1;if(!l.isArray(e.items)||!l.isArray(r.items))return!1;if(e.items.length!=r.items.length)return!1;var t=!0;return l.each(e.items,function(e,n){var o=r.items[n];if(!u(e,o))return t=!1,!1}),t}return!1}var l=t(1);e.exports.newStripe=n,e.exports.newBlock=o,e.exports.newRootBlock=i,e.exports.isSameNode=u,e.exports.calculateNodeHash=s,e.exports.calculateNodeWeight=c},function(e,r,t){"use strict";function n(e,r,t){var n=r[e];return s.isObject(n)&&c.isValidColor(n.value)?n.value:(n=t[e],s.isObject(n)&&c.isValidColor(n.value)?n.value:null)}function o(e,r,t){return r=s.extend({},r),t=s.extend({},t),s.chain(e).map(function(e){if(s.isObject(e)&&e.isStripe){var o=parseInt(e.count,10)||0;if(o>0){var i=n(e.name,r,t);if(i)return[i,o]}}return null}).filter().reduce(function(e,r){var t=s.last(e);return t&&c.isSameColor(t[0],r[0])?(t[1]+=r[1],e):(e.push(r),e)},[]).value()}function i(e,r){r=!s.isArray(r)||r.length<2?[1,1]:r.slice(0,2),e=s.filter(e,function(e){return s.isArray(e)&&e.length>=2&&e[1]>0});var t=0,n=0;if(e.length>0){t=s.reduce(e,function(e,r){return e+r[1]},0);var o=s.sum(r);for(n=t;n%o!=0;)n+=t}return{length:t,fullCycle:n}}function a(e){var r=e.items,t=e.repeat,n=e.reflect;if(r.length<=1){if(1==r.length&&t>1){var o=s.clone(r[0]);o.count*=t,e=s.clone(e),e.items=[o]}return e}var i,a;n?(a=r.slice(1,-1),a.reverse(),i=r.concat(a)):i=r,a=[];for(var c=1;c<=t;c++)[].push.apply(a,i);return i=a,n&&!e.isRoot&&i.push(r[0]),e=s.clone(e),e.items=i,e.reflect=!1,e.repeat=1,e}var s=t(1),c=t(6);e.exports.compile=o,e.exports.getPatternMetrics=i,e.exports.reflectAndRepeat=a},function(e,r,t){"use strict";function n(e){function r(){t=null,n=null,e(n)}if(!o.isFunction(e))return o.identity;var t=null,n=null,s=function(e){t||(t=i(r),n=e)};return s.cancel=function(){return t&&a(t),t=null,n=null,this},s}var o=t(1),i=function(){var e=null;return"undefined"!=typeof window&&o.isObject(window)&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame),e||setTimeout}(),a=function(){var e=null;return"undefined"!=typeof window&&o.isObject(window)&&(e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame),e||clearTimeout}();e.exports=n},function(e,r,t){"use strict";function n(e){var r=s.filter(e,function(e){return s.isString(e)&&e.length>0});return r.length>0?s.first(r):""}function o(e){var r=s.filter(e,function(e){return s.isObject(e)&&e.isBlock&&e.isRoot&&s.isArrayLike(e.items)});return r.length>0?s.first(r):l.node.newRootBlock([])}function i(e,r,t){var n=u(r,e,t),o=n.parse();return s.isFunction(t.processTokens)&&(o=t.processTokens(o)),s.isFunction(t.buildSyntaxTree)&&(o=t.buildSyntaxTree(o)),o}function a(e,r){return r=s.extend({},p,r),function(t){t=c(t);var a;if(s.isString(t.warp)||s.isString(t.weft)){var u=s.trim(n([t.warp,t.weft])),f=s.trim(n([t.weft,t.warp])),p=u==f;u=i(e,u,r),p?(a={meta:s.extend({},u.meta),warp:o([u.warp,u.weft])},a.weft=a.warp):(f=i(e,f,r),s.isArrayLike(u)&&s.isArrayLike(f)?a=s.concat(u,l.token.newLiteral(r.warpAndWeftSeparator),f):s.isObject(u)&&s.isObject(f)&&(a={meta:s.extend({},u.meta,f.meta),warp:o([u.warp,u.weft]),weft:o([f.warp,f.weft])}))}else if(s.isString(t.threadcount)||s.isString(t.sett)){var m=n([t.threadcount,t.sett]);a=i(e,m,r)}else a=i(e,"",r);if(s.isString(t.palette)||s.isString(t.colors)){var d=n([t.palette,t.colors]);d=i(e,d,r),s.isArrayLike(a)?s.isArrayLike(d)&&(a=s.concat(d,a)):s.isObject(a)&&s.isObject(d)&&(a.colors=d.colors,a.meta=s.extend({},d.meta,a.meta))}return s.isObject(a)&&(a.colors=s.extend({},a.colors),s.isFunction(r.getSourceMeta)?a.meta=s.extend({},a.meta,r.getSourceMeta(t)):a.meta=s.extend({},a.meta)),a}}var s=t(1),c=t(12),u=t(15),l=t(4),f=t(3),p={errorHandler:null,processTokens:null,buildSyntaxTree:null,foreseeLimit:1,getSourceMeta:function(e){return s.omit(e,["warp","weft","threadcount","sett","palette","colors"])},warpAndWeftSeparator:f.warpAndWeftSeparator};e.exports=a,e.exports.source=t(18),e.exports.color=t(20),e.exports.stripe=t(21),e.exports.pivot=t(22),e.exports.repeat=t(23),e.exports.literal=t(24)},function(e,r,t){"use strict";function n(e){return o.isFunction(e)&&(e=e()),o.isString(e)?i(e):a(e)}var o=t(1),i=t(13),a=t(14);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"autodetect"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"Autodetect"})},function(e,r,t){"use strict";function n(e){return{threadcount:o.isString(e)?e:""}}var o=t(1);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"string"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"String"})},function(e,r,t){"use strict";function n(e){return o.extend({threadcount:""},e)}var o=t(1);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"object"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"Object"})},function(e,r,t){"use strict";function n(e,r,t){this.source=a.isString(e)?e:"",r=a.filter(r,a.isFunction),r.splice(0,0,s()),r.push(c()),this.parsers=r,this.options=t,this.inForesee=0,a.isFunction(t.errorHandler)&&(this.errorHandler=function(e,r,n){t.errorHandler(e,r,n||"error")})}function o(e,r){var t=null;return a.each(e.parsers,function(n){if(t=n(e,r),a.isObject(t))return t.offset=t.offset||r,!1}),t}function i(e,r,t){return t=a.extend({},t),t.foreseeLimit=parseInt(t.foreseeLimit,10)||0,t.foreseeLimit<1&&(t.foreseeLimit=1),new n(e,r,t)}var a=t(1),s=t(16),c=t(17);n.prototype={},n.prototype.errorHandler=function(e,r,t){},n.prototype.foresee=function(e){var r=this.options.foreseeLimit;if(this.inForesee>=r)return null;if(e=parseInt(e,10)||0,e<0&&(e=0),e<=this.offset)return this.errorHandler(new Error("Parser should not go back."),{currentOffset:this.offset,requestedOffset:e,source:this.source}),null;this.inForesee++;var t=o(this,e);return this.inForesee>0&&this.inForesee--,t},n.prototype.parse=function(e){var r=[];for(e=parseInt(e,10)||0,e<0&&(e=0);e<this.source.length;){this.offset=e;var t=o(this,e);a.isObject(t)&&(r.push(t),e=t.offset+t.length)}return r},e.exports=i},function(e,r,t){"use strict";function n(e,r){for(var t=e.source,n=10,o="";;){var s=t.substr(r,n),c=i.exec(s);if(!c)break;if(o+=c[0],c[0].length<n)break}if(""!=o)return{type:a.token.whitespace,value:o,length:o.length}}function o(){return n}var i=/^\s+/i,a=t(4);e.exports=o},function(e,r,t){"use strict";function n(e,r){var t=e.source,n=t.charAt(r);if(!e.inForesee)for(var o=r+1;;){var s=e.foresee(o);{if(!i.isObject(s)||"invalid"!=s.type)break;n+=s.value,o+=s.length}}if(""!=n)return n={type:a.token.invalid,value:n,length:n.length},e.inForesee||e.errorHandler(new Error(a.error.message.invalidToken),{token:n},a.error.severity.error),n}function o(){return n}var i=t(1),a=t(4);e.exports=o},function(e,r,t){"use strict";e.exports.autodetect=t(12),e.exports.string=t(13),e.exports.object=t(14),e.exports.json=t(19)},function(e,r,t){"use strict";function n(e){return o.extend({threadcount:""},o.isString(e)?JSON.parse(e):e)}var o=t(1);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"json"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"JSON"})},function(e,r,t){"use strict";function n(e){if(e.colorFormat=s.trim((""+e.colorFormat).toLowerCase()),["long","short","both"].indexOf(e.colorFormat)==-1&&(e.colorFormat=u.colorFormat),e.colorPrefix instanceof RegExp?e.colorPrefix=e.colorPrefix.source:s.isString(e.colorPrefix)||(e.colorPrefix=""),e.colorSuffix instanceof RegExp?e.colorSuffix=e.colorSuffix.source:s.isString(e.colorSuffix)||(e.colorSuffix=""),e.commentSuffix instanceof RegExp){var r=e.commentSuffix.ignoreCase?"i":"";e.commentSuffix=new RegExp("^"+e.commentSuffix.source,r)}else e.commentSuffix=null;return e.commentFormat instanceof RegExp||(e.commentFormat=null),e}function o(e){var r=["^"],t="[a-z]";switch(e.allowLongNames&&(t+="{1,100}"),r.push("("+t+")"),r.push("("+e.colorPrefix+")"),e.colorFormat){case"long":r.push("([0-9a-f]{6})");break;case"short":r.push("([0-9a-f]{3})");break;case"both":r.push("([0-9a-f]{6}|[0-9a-f]{3})")}return r.push(e.colorSuffix),new RegExp(r.join(""),"i")}function i(e,r,t,n){var o,i,a,u=e.source;if(i=u.substr(r,200),o=t.exec(i)){var l={type:c.token.color,name:o[1].toUpperCase(),color:c.color.normalizeColor(o[3]),comment:"",length:o[0].length};if(!e.inForesee){if(n.allowComment){var f=r+l.length;if(n.commentSuffix&&n.requireCommentSuffix){for(a=f;a<u.length;a++)if(i=u.substr(a,10),o=n.commentSuffix.exec(i)){l.comment=u.substr(f,a-f+o[0].length);break}a>=u.length&&(l.comment=u.substr(f,u.length))}else{var p=["whitespace","invalid"];for(a=f;a<u.length;a++){if(i=u.substr(a,10),o=n.commentSuffix.exec(i)){l.comment=u.substr(f,a-f+o[0].length);break}var m=e.foresee(a);if(s.isObject(m)&&p.indexOf(m.type)==-1){l.comment=u.substr(f,a-f);break}}a>=u.length&&(l.comment=u.substr(f,u.length))}}l.length+=l.comment.length,n.commentFormat&&(o=n.commentFormat.exec(l.comment),o&&s.isString(o[1])&&(l.comment=o[1])),l.comment=s.trim(l.comment)}return l}}function a(e){e=n(s.extend({},u,e));var r=o(e);return function(t,n){return i(t,n,r,e)}}var s=t(1),c=t(4),u={allowLongNames:!0,colorPrefix:/[=]?[#]/,colorSuffix:/;?/,colorFormat:"both",allowComment:!1,commentSuffix:/;/,requireCommentSuffix:!0,commentFormat:/^\s*(.*)\s*;\s*$/};e.exports=a},function(e,r,t){"use strict";function n(e){var r=["^"],t="[a-z]";return e.allowLongNames&&(t+="{1,100}"),r.push("("+t+")"),r.push("([0-9]+)"),new RegExp(r.join(""),"i")}function o(e,r,t,n){var o=e.source,i=t.exec(o.substr(r,20));if(i){var a=parseInt(i[2],10)||0;a<0&&(a=0);var c={type:s.token.stripe,name:i[1].toUpperCase(),count:a,length:i[0].length};return 0==c.count&&e.errorHandler(new Error(s.error.message.zeroWidthStripe),{token:c},s.error.severity.warning),c}}function i(e){e=a.extend({},c,e);var r=n(e);return function(t,n){return o(t,n,r,e)}}var a=t(1),s=t(4),c={allowLongNames:!0};e.exports=i},function(e,r,t){"use strict";function n(e){var r=["^"],t="[a-z]";return e.allowLongNames&&(t+="{1,100}"),r.push("("+t+")"),r.push("/([0-9]+)"),new RegExp(r.join(""),"i")}function o(e,r,t,n){var o=e.source,i=t.exec(o.substr(r,20));if(i){var a=parseInt(i[2],10)||0;a<0&&(a=0);var c={type:s.token.pivot,name:i[1].toUpperCase(),count:a,length:i[0].length};return 0==c.count&&e.errorHandler(new Error(s.error.message.zeroWidthStripe),{token:c},s.error.severity.warning),c}}function i(e){e=a.extend({},c,e);var r=n(e);return function(t,n){return o(t,n,r,e)}}var a=t(1),s=t(4),c={allowLongNames:!0};e.exports=i},function(e,r,t){"use strict";function n(e,r,t){var n=e.source,o=null,s=!1,l=!1;if(t.allowAsPrefix&&(o=c.exec(n.substr(r,20)),s=!!o),t.allowAsSuffix&&!o&&(o=u.exec(n.substr(r,20)),l=!!o),o){var f=parseInt(o[1],10)||0;f<=0&&(f=1);var p={type:a.token.repeat,count:f>=1?f:1,isPrefix:s,isSuffix:l,length:o[0].length};return f<1&&e.errorHandler(new Error(a.error.message.invalidMultiplier),{token:i.extend({},p,{count:f})},a.error.severity.warning),p}}function o(e){return e=i.extend({},s,e),function(r,t){return n(r,t,e)}}var i=t(1),a=t(4),s={allowAsPrefix:!0,allowAsSuffix:!0},c=/^([0-9]+)\s*[*]/i,u=/^[*]\s*([0-9]+)/i;e.exports=o},function(e,r,t){"use strict";function n(e,r,t){var n=e.source;if(""!=t.string){var o=n.substr(r,t.string.length),i=t.ignoreCase?o.toUpperCase():o;if(i==t.string)return{type:a.token.literal,value:o,length:o.length}}}function o(e){return i.isString(e)&&(e={string:e}),e=i.extend({},s,e),i.isString(e.string)||(e.string=""),e.ignoreCase&&(e.string=e.string.toUpperCase()),function(r,t){return n(r,t,e)}}var i=t(1),a=t(4),s={string:"",ignoreCase:!1};e.exports=o},function(e,r,t){"use strict";function n(e){return e=o.filter(e,o.isFunction),function(r){if(o.isArray(r))for(var t=0;t<e.length;t++)r=e[t](r);return r}}var o=t(1);e.exports=n,e.exports.classify=t(26),e.exports.removeTokens=t(27)},function(e,r,t){"use strict";function n(e,r,t){return!1}function o(e,r){return a.map(e,function(t,n){var o=a.clone(t);return a.each(r,function(r,i){o[i]=r(t,n,e)}),o})}function i(e){return e=a.extend({},u,e),a.each(u,function(r,t){a.isFunction(e[t])||(e[t]=n)}),function(r){return o(r,e)}}var a=t(1),s=t(4),c=t(3),u={isColor:function(e,r,t){return s.token.isColor(e)},isStripe:function(e,r,t){return s.token.isStripe(e)},isPivot:function(e,r,t){return s.token.isPivot(e)},isRepeat:function(e,r,t){return s.token.isRepeat(e)},isWarpAndWeftSeparator:function(e,r,t){return s.token.isLiteral(e)&&e.value==c.warpAndWeftSeparator},isBlockStart:function(e,r,t){return s.token.isOpeningSquareBracket(e)||s.token.isOpeningParenthesis(e)},isBlockEnd:function(e,r,t){return s.token.isClosingSquareBracket(e)||s.token.isClosingParenthesis(e)}};e.exports=i},function(e,r,t){"use strict";function n(e){return i.isFunction(e)?e:(i.isArray(e)||(e=a.insignificantTokens),function(r){return!i.isObject(r)||e.indexOf(r.type)>=0})}function o(e){var r=n(e);return function(e){return i.filter(e,function(e){return!r(e)})}}var i=t(1),a=t(3);e.exports=o},function(e,r,t){"use strict";function n(e){return e=o.filter(e,o.isFunction),function(r){return o.isObject(r)&&o.each(e,function(e){r=e(r)}),r}}var o=t(1);e.exports=n,e.exports.flatten=t(29),e.exports.flattenSimpleBlocks=t(30),e.exports.fold=t(31),e.exports.mergeStripes=t(32),e.exports.removeEmptyBlocks=t(33),e.exports.removeZeroWidthStripes=t(34),e.exports.optimize=t(35)},function(e,r,t){"use strict";function n(e){var r=[];return a.each(e.items,function(e){e.isBlock?(e=n(e),[].push.apply(r,e.items)):r.push(e)}),e=a.clone(e),e.items=r,s.sett.reflectAndRepeat(e)}function o(e){var r=a.clone(e),t=e.warp==e.weft;return a.isObject(e.warp)&&(r.warp=n(e.warp)),a.isObject(e.weft)&&(t?r.weft=r.warp:r.weft=n(e.weft)),r}function i(){return o}var a=t(1),s=t(4);e.exports=i},function(e,r,t){"use strict";function n(e){var r=null,t=!0;return s.each(e.items,function(e){if(e.isStripe){if(0==e.count)return;if(null===r)return void(r=e.name);if(e.name==r)return}return t=!1,!1}),t&&null!==r&&(e=c.sett.reflectAndRepeat(e),e.items=[c.node.newStripe(c.token.newStripe(r,s.sumBy(e.items,function(e){return e.count})))]),e}function o(e){return e=s.clone(e),e.items=s.chain(e.items).reduce(function(e,r){return r.isBlock&&!r.isRoot&&!r.reflect&&r.repeat<=1?[].push.apply(e,r.items):e.push(r),e},[]).map(function(e){if(e.isBlock){if(0==e.items.length)return null;if(e=o(e),0==e.items.length)return null;if(1==e.items.length)return s.first(e.items)}return e}).filter().value(),n(e)}function i(e){var r=s.clone(e),t=e.warp==e.weft;return s.isObject(e.warp)&&(r.warp=o(e.warp)),s.isObject(e.weft)&&(t?r.weft=r.warp:r.weft=o(e.weft)),r}function a(){return i}var s=t(1),c=t(4);e.exports=a},function(e,r,t){"use strict";function n(e){if(!(e.length<5||e.length%2!=1)){for(var r,t,n=[],o=0,i=e.length-1;;){if(r=e[o],t=e[i],!h.node.isSameNode(r,t))return;if(n.push(r),o==i)break;o++,i--}return n}}function o(e,r,t){if(!e.reflect&&0!=e.items.length){var o=d.concat(e.items,e.items[0]),i=n(o);if(d.isArray(i)){var a=d.clone(e);a.items=i,a.reflect=!0,t.push({node:a,hash:h.node.calculateNodeHash(a),weight:r.calculateNodeWeight(a)})}}}function i(e,r){var t=[e];if(e.reflect||0==e.items.length||!r.allowRootReorder)return t;var n,o=d.clone(e.items);for(n=0;n<o.length-1;n++){var i=o[0];o.splice(0,1),o.push(i);var a=d.clone(e);a.items=d.clone(o),t.push(a)}return t}function a(e,r,t,n){if(t.push(e),!(n<=0)&&e.length>=2*r.minBlockSize-1)for(var o=r.minBlockSize-1,i=e.length-r.minBlockSize,a=o;a<=i;a++)c(a,e,d.extend({},r,{allowSplitStripe:!1}),t,n-1),r.allowSplitStripe&&c(a,e,d.extend({},r,{allowSplitStripe:!0}),t,n-1)}function s(e,r,t,n,o,i,s,c,u){if(!(n.length<s.minBlockSize)){var l=e.slice(0,r>=0?r+1:0);o&&l.push(o);var f=[];a(n,s,f,u);var p=e.slice(t,e.length);i&&p.splice(0,0,i);var m=[];a(p,s,m,u),d.each(m,function(e){d.each(f,function(r){c.push(d.concat(l,h.node.newBlock(r,!0),e))})})}}function c(e,r,t,n,o){var i,a;i=e-1,a=e+1;for(var c=null,u=null,l=[r[e]],f=!1;i>=0&&a<r.length;){if(!h.node.isSameNode(r[i],r[a])){if(t.allowSplitStripe&&r[i].isStripe&&r[a].isStripe&&r[i].name==r[a].name){var p=r[i].count-r[a].count;p>0?c=h.node.newStripe({name:r[i].name,count:Math.abs(p)}):u=h.node.newStripe({name:r[i].name,count:Math.abs(p)});var m=d.clone(r[i]);m.count=Math.min(r[i].count,r[a].count),l.splice(0,0,m),i--,a++,f=!0;break}f=!0;break}l.splice(0,0,r[i]),i--,a++,t.greedy&&s(r,i,a,l,c,u,t,n,o)}!f&&t.greedy||s(r,i,a,l,c,u,t,n,o)}function u(e,r,t){if(!(e.items.length<2*r.minBlockSize-1)){var n=[];a(e.items,r,n,r.maxFoldLevels),d.each(n,function(n){var o=d.clone(e);o.items=n,t.push({node:o,hash:h.node.calculateNodeHash(o),weight:r.calculateNodeWeight(o)})})}}function l(e,r,t){if(t.push(e),r.allowNestedBlocks&&r.processExistingBlocks&&r.maxFoldLevels>1){var n=[],o=[],i=d.clone(r);i.allowRootReorder=!1,i.maxFoldLevels-=1,d.each(e.items,function(e){if(e.isBlock){e=d.clone(e),e.isRoot=!0;var r=f(e,i,!0),t=n;n=[],d.each(r,function(e){e=d.clone(e.node),e.isRoot=!1,t.length>0?d.each(t,function(r){n.push(d.concat(r,o,e))}):n.push(d.concat(o,e))}),o=[]}else o.push(e)}),d.each(n,function(r){var n=d.clone(e);n.items=d.concat(r,o),t.push(n)})}}function f(e,r,t){var n=[{node:e,hash:h.node.calculateNodeHash(e),weight:h.node.calculateNodeWeight(e)}],a=[];l(e,r,a);var s=[];return d.each(a,function(e){var t=i(e,r);d.each(d.drop(t),function(e){s.push({hash:h.node.calculateNodeHash(e)})}),d.each(t,function(e){o(e,r,n),r.allowNestedBlocks&&u(e,r,n)})}),d.chain(n).differenceBy(s,function(e){return e.hash}).uniqBy(function(e){return e.hash}).sortBy(function(e){return e.weight}).each(function(e){t||console.log(e.weight.toFixed(4),e.hash.replace(/\[R\*[0-9]+\/R[PF]:/g,"").replace(/B\*[0-9]+\/R[PF]:/g,"").replace(/]$/g,"").replace(/[0-9]+/g,""))}).value()}function p(e,r){var t=d.clone(e),n=e.warp===e.weft;return d.isObject(e.warp)&&(t.warpVariants=f(e.warp,r,!0)),d.isObject(e.weft)&&(n?t.weftVariants=t.warpVariants:t.weftVariants=f(e.weft,r,!0)),t.warp=d.first(t.warpVariants).node,t.weft=d.first(t.weftVariants).node,t}function m(e){return e=d.extend({},v,e),e.minBlockSize<1&&(e.minBlockSize=1),e.maxFoldLevels<=0&&(e.maxFoldLevels=2e8),function(r){return p(r,e)}}var d=t(1),h=t(4),v={allowRootReorder:!0,allowNestedBlocks:!1,maxFoldLevels:2,minBlockSize:3,greedy:!1,allowSplitStripe:!0,processExistingBlocks:!0,calculateNodeWeight:h.node.calculateNodeWeight};e.exports=m},function(e,r,t){"use strict";function n(e){var r=e.reflect&&(e.isRoot||e.repeat>1)?a.first(e.items):null,t=e.reflect?a.last(e.items):null;return e=a.clone(e),e.items=a.reduce(e.items,function(e,o){if(o.isBlock)return e.push(n(o)),e;if(o.isStripe){if(o===t)return e.push(o),e;var i=a.last(e);if(i&&i.isStripe&&i!==r&&i.name==o.name)return i=a.clone(e.pop()),i.count+=o.count,e.push(i),e}return e.push(o),e},[]),e}function o(e,r){var t=a.clone(e),o=e.warp===e.weft;return a.isObject(e.warp)&&(t.warp=n(e.warp,r)),a.isObject(e.weft)&&(o?t.weft=t.warp:t.weft=n(e.weft,r)),t}function i(){return o}var a=t(1);e.exports=i},function(e,r,t){"use strict";function n(e){return e=a.clone(e),e.items=a.chain(e.items).map(function(e){return e.isBlock?(e=n(e),e.items.length>0?e:null):e}).filter().value(),e}function o(e){var r=a.clone(e),t=e.warp==e.weft;return a.isObject(e.warp)&&(r.warp=n(e.warp)),a.isObject(e.weft)&&(t?r.weft=r.warp:r.weft=n(e.weft)),r}function i(){return o}var a=t(1);e.exports=i},function(e,r,t){"use strict";function n(e,r){var t=e.reflect&&(e.isRoot||e.repeat>1)?a.first(e.items):null,o=e.reflect?a.last(e.items):null;if(e=a.clone(e),e.items=a.chain(e.items).map(function(e){return e.isBlock?(e=n(e,r),e.items.length>0?e:null):e.isStripe?e.count>0?e:!r.keepZeroWidthPivots||e!==t&&e!==o?null:e:e}).filter().value(),e.items.length>=2&&(o=a.last(e.items),o.isStripe&&o.count<=0)){e.items.pop();var i=a.last(e.items);i.isStripe?i.count*=2:e.items.push(o)}return e}function o(e,r){var t=a.clone(e),o=e.warp==e.weft;return a.isObject(e.warp)&&(t.warp=n(e.warp,r)),a.isObject(e.weft)&&(o?t.weft=t.warp:t.weft=n(e.weft,r)),t}function i(e){return e=a.extend({},s,e),function(r){return o(r,e)}}var a=t(1),s={keepZeroWidthPivots:!0};e.exports=i},function(e,r,t){"use strict";function n(e,r){return e=c()(e),r.simplifyBlocks&&(e=a()(e)),e=u(r)(e),r.simplifyStripes&&(e=s()(e)),e}function o(e){return e=i.extend({},l,e),function(r){return n(r,e)}}var i=t(1),a=t(30),s=t(32),c=t(33),u=t(34),l={simplifyBlocks:!0,simplifyStripes:!0};e.exports=o},function(e,r,t){"use strict";e.exports.extended=t(37),e.exports.classic=t(38),e.exports.weddslist=t(39)},function(e,r,t){"use strict";function n(e,r){return u.token.isOpeningSquareBracket(e)&&u.token.isClosingSquareBracket(r)||u.token.isOpeningParenthesis(e)&&u.token.isClosingParenthesis(r)}function o(e,r){var t,o,i=[{isRegularBlock:!0,items:[]}];for(c.each(e,function(e){if(e.isStripe)return t=c.last(i),void t.items.push(u.node.newStripe(e));if(e.isPivot)return t=c.last(i),void(t.isPivotBlock?(t.items.push(u.node.newStripe(e)),i.pop(),o=c.last(i),o.items.push(u.node.newBlock(t.items,!0))):i.push({isPivotBlock:!0,token:e,items:[u.node.newStripe(e)]}));if((e.isBlockStart||e.isBlockEnd)&&(t=c.last(i),t.isPivotBlock&&(r.errorHandler(new Error(u.error.message.orphanedPivot),{token:t.token},u.error.severity.warning),i.pop(),o=c.last(i),[].push.apply(o.items,t.items))),e.isBlockStart)return void i.push({isRegularBlock:!0,token:e,items:[]});if(e.isBlockEnd){if(i.length>1){if(t=i.pop(),n(t.token,e))return void(t.items.length>0&&(o=c.last(i),o.items.push(u.node.newBlock(t.items,u.token.isClosingSquareBracket(e),t.token.repeat*e.repeat))));i.push(t)}return void r.errorHandler(new Error(u.error.message.unmatchedBlockEnd),{token:e},u.error.severity.error)}r.errorHandler(new Error(u.error.message.unexpectedToken),{token:e},u.error.severity.error)});i.length>1;)t=i.pop(),o=c.last(i),t.items.length>0&&[].push.apply(o.items,t.items),t.isPivotBlock?r.errorHandler(new Error(u.error.message.orphanedPivot),{token:t.token},u.error.severity.warning):r.errorHandler(new Error(u.error.message.unmatchedBlockStart),{token:t.token},u.error.severity.error);t=c.first(i).items;var a=!1;return 1==t.length&&t[0].isBlock&&t[0].reflect&&(a=!0,t=t[0].items),u.node.newRootBlock(t,a)}function i(e,r){return c.chain(e).reduce(function(e,t){if(t.isRepeat&&t.isSuffix){var n=e.pop();n?(n=c.clone(n),n.repeat=n.repeat>1?n.repeat:1,n.repeat*=t.count,e.push(n)):r.errorHandler(new Error(u.error.message.unexpectedToken),{token:t},u.error.severity.error)}else t=c.clone(t),t.repeat=t.repeat>1?t.repeat:1,e.push(t);return e},[]).reduceRight(function(e,t){if(t.isRepeat&&t.isPrefix){var n=e.pop();n?(n=c.clone(n),n.repeat=n.repeat>1?n.repeat:1,n.repeat*=t.count,e.push(n)):r.errorHandler(new Error(u.error.message.unexpectedToken),{token:t},u.error.severity.error)}else t=c.clone(t),t.repeat=t.repeat>1?t.repeat:1,e.push(t);return e},[]).reverse().map(function(e){return(e.isStripe||e.isPivot)&&e.repeat>1&&(e=c.clone(e),e.count*=e.repeat,e.repeat=1),e}).value()}function a(e,r){if(!c.isArray(e))return e;if(c.isFunction(r.processTokens)&&(e=r.processTokens(e),!c.isArray(e)))return e;var t=[],n=[],a=[],s=n;c.each(e,function(e){return e.isColor?void t.push(e):void(e.isWarpAndWeftSeparator?(s===a&&r.errorHandler(new Error(u.error.message.multipleWarpAnWeftSeparator),{token:e},u.error.severity.warning),s=a):s.push(e))}),n=i(n,r),a=i(a,r),0==n.length&&(n=a,a=[]),0==a.length&&(a=n);var l={};return l.colors=u.color.buildColorMap(t),l.warp=o(n,r),a===n?l.weft=l.warp:l.weft=o(a,r),c.isFunction(r.transformSyntaxTree)&&(l=r.transformSyntaxTree(l)),l}function s(e){return e=c.extend({},l,e),c.isFunction(e.errorHandler)||(e.errorHandler=l.errorHandler),function(r){return a(r,e)}}var c=t(1),u=t(4),l={errorHandler:function(e,r,t){},processTokens:null,transformSyntaxTree:null};e.exports=s},function(e,r,t){"use strict";function n(e,r){var t=[],n=!1,o=null,i=null;return e.length>=2&&(o=a.first(e),i=a.last(e),o.isPivot&&i.isPivot&&(n=!0)),a.each(e,function(e){return e.isStripe?void t.push(s.node.newStripe(e)):e.isPivot?!n||e!==o&&e!==i?(r.errorHandler(new Error(s.error.message.orphanedPivot),{token:e},s.error.severity.warning),void t.push(s.node.newStripe(e))):void t.push(s.node.newStripe(e)):void r.errorHandler(new Error(s.error.message.unexpectedToken),{token:e},s.error.severity.error)}),s.node.newRootBlock(t,n)}function o(e,r){if(!a.isArray(e))return e;if(a.isFunction(r.processTokens)&&(e=r.processTokens(e),!a.isArray(e)))return e;var t=[],o=[],i=[],c=o;a.each(e,function(e){return e.isColor?void t.push(e):void(e.isWarpAndWeftSeparator?(c===i&&r.errorHandler(new Error(s.error.message.multipleWarpAnWeftSeparator),{token:e},s.error.severity.warning),c=i):c.push(e))}),0==o.length&&(o=i,i=[]),0==i.length&&(i=o);var u={};return u.colors=s.color.buildColorMap(t),u.warp=n(o,r),i===o?u.weft=u.warp:u.weft=n(i,r),a.isFunction(r.transformSyntaxTree)&&(u=r.transformSyntaxTree(u)),u}function i(e){return e=a.extend({},c,e),a.isFunction(e.errorHandler)||(e.errorHandler=c.errorHandler),function(r){return o(r,e)}}var a=t(1),s=t(4),c={errorHandler:function(e,r,t){},processTokens:null,transformSyntaxTree:null};e.exports=i},function(e,r,t){"use strict";function n(e,r){var t,n,o=!1;e=c.filter(e,function(e){return!e.isWarpStart&&!e.isWeftStart}),e.length>=2&&(t=c.first(e),n=c.last(e),t.isBlockBodyStart&&n.isBlockBodyEnd?(e.splice(0,1),e.splice(-1,1)):(t.isBlockBodyStart&&(r.errorHandler(new Error(u.error.message.unexpectedToken),{token:t},u.error.severity.error),e.splice(0,1)),n.isBlockBodyStart&&(r.errorHandler(new Error(u.error.message.unexpectedToken),{token:n},u.error.severity.error),e.splice(-1,1)))),e.length>=4&&(t=c.first(e),n=c.last(e),t.isStripe&&n.isStripe&&(t=e[1],n=e[e.length-2],t.isBlockBodyStart&&n.isBlockBodyEnd&&(o=!0,e.splice(1,1),e.splice(-2,1))));var i=c.chain(e).map(function(e){
return e.isStripe?u.node.newStripe(e):(r.errorHandler(new Error(u.error.message.unexpectedToken),{token:e},u.error.severity.error),null)}).filter().value();return i.length<=2&&(o=!1),u.node.newRootBlock(i,o)}function o(e,r,t,n){var o=c.first(e);c.each(e,function(e){return!n(e)&&(e.isWarpStart&&e!==o&&t.errorHandler(new Error(u.error.message.multipleWarpAnWeftSeparator),{token:e},u.error.severity.warning),void r.push(e))})}function i(e,r,t,n){if(0!=e.length){var i,a=!1;i=c.first(e),(i.isWarpStart||i.isStripe||i.isBlockBodyStart)&&(o(e,r,n,function(e){return e.isWeftStart}),e.splice(0,r.length),a=!0),i=c.first(e),i&&i.isWeftStart&&(o(e,t,n,function(e){return e.isWarpStart}),e.splice(0,t.length)),a||(i=c.first(e),i&&i.isWarpStart&&(o(e,r,n,function(e){return e.isWeftStart}),e.splice(0,r.length))),c.each(e,function(e){n.errorHandler(new Error(u.error.message.extraTokenInInputSequence),{token:e},u.error.severity.warning)})}}function a(e,r){if(!c.isArray(e))return e;if(c.isFunction(r.processTokens)&&(e=r.processTokens(e),!c.isArray(e)))return e;var t=c.filter(e,function(e){return e.isColor}),o=[],a=[];i(c.filter(e,function(e){return!e.isColor}),o,a,r),0==o.length&&(o=a,a=[]),0==a.length&&(a=o);var s={};return s.colors=u.color.buildColorMap(t),s.warp=n(o,r),a===o?s.weft=s.warp:s.weft=n(a,r),c.isFunction(r.transformSyntaxTree)&&(s=r.transformSyntaxTree(s)),s}function s(e){return e=c.extend({},l,e),c.isFunction(e.errorHandler)||(e.errorHandler=l.errorHandler),function(r){return a(r,e)}}var c=t(1),u=t(4),l={errorHandler:function(e,r,t){},processTokens:null,transformSyntaxTree:null};e.exports=s},function(e,r,t){"use strict";e.exports.canvas=t(41),e.exports.houseOfTartan=t(42),e.exports.format=t(43)},function(e,r,t){"use strict";function n(e,r){return r.repeat||(e.clearRect(0,0,r.width,r.height),r.width=Math.min(r.width,r.warp.lengthOfPattern),r.height=Math.min(r.height,r.warp.lengthOfPattern)),r}function o(e,r){var t,n,o,i=r.warp.pattern,a=r.zoom,s=r.offset.x;for(t=0;t<i.length;t++){if(o=i[t],s+o[1]*a>0){n=t;break}s+=o[1]*a}for(;s<=r.width;){for(t=n;t<i.length&&(o=i[t],e.fillStyle=o[0],e.fillRect(s,0,o[1]*a,r.height),s+=o[1]*a,!(s>=r.width));t++);if(n=0,!r.repeat)break}}function i(e,r){var t,n,o,i,a,s=r.weft.pattern,c=r.zoom,u=r.offset.y,l=r.offset.x,f=r.offset.y,m=p.sum(r.weave);for(t=0;t<s.length;t++){if(i=s[t],u+i[1]*c>0){o=t;break}u+=i[1]*c}for(e.setLineDash(p.map(r.weave,function(e){return e*c}));u<=r.height;){for(t=o;t<s.length;t++){for(i=s[t],e.strokeStyle=i[0],n=u<0?0:u,u+=i[1]*c,n;n<u;n++)a=m-Math.floor((n-f)/c)%m,a=a*c-l,e.lineDashOffset=a,e.beginPath(),e.moveTo(0,n+.5),e.lineTo(r.width,n+.5),e.stroke();if(u>=r.height)break}if(o=0,!r.repeat)break}}function a(e,r){return p.isArray(e)&&2==e.length?e:r}function s(e,r,t,n){var o=p.isObject(e)&&e.isBlock?e.items:[],i=[];o.length>0&&(i=d.sett.compile(o,t,n));var a=d.sett.getPatternMetrics(i,r);return{pattern:i,lengthOfPattern:a.length,lengthOfCycle:a.fullCycle}}function c(e,r,t,n){var o=0,i=0;return p.isObject(e)&&(o=parseInt(e.x,10)||0,i=parseInt(e.y,10)||0),o%=r.lengthOfCycle*n,o>0&&(o-=r.lengthOfCycle*n),i%=t.lengthOfCycle*n,i>0&&(i-=t.lengthOfCycle*n),{x:o,y:i}}function u(e,r,t){return{weave:e,warp:{length:r.lengthOfPattern,fullCycle:r.lengthOfCycle},weft:{length:t.lengthOfPattern,fullCycle:t.lengthOfCycle}}}function l(e){var r=e.offsetWidth,t=e.offsetHeight;if(r>0&&t>0){var n=e.getContext("2d");n.clearRect(0,0,r,t)}return{x:0,y:0}}function f(e,r){if(!p.isObject(e))return l;r=p.merge({},h,r);var t=r.hooks;p.isObject(r.hooks)||(t=r.hooks={}),p.each(h.hooks,function(e,r){p.isFunction(t[r])||(t[r]=h.hooks[r])}),p.isFunction(r.transformSyntaxTree)&&(e=r.transformSyntaxTree(e));var f=parseInt(r.zoom,10)||0;f<1&&(f=1);var d=e.weft===e.warp,v=a(r.weave,m.weave.serge),w=s(e.warp||e.weft,v,e.colors,r.defaultColors),x=w;if(d||(x=s(e.weft||e.warp,v,e.colors,r.defaultColors)),0==w.lengthOfPattern&&0==x.lengthOfPattern)return l;var g=function(e,r,a){a=2==arguments.length||!!a,r=a?c(r,w,x,f):{x:0,y:0};var s={warp:w,weft:x,weave:v,zoom:f,width:Math.ceil(parseFloat(e.width)||0),height:Math.ceil(parseFloat(e.height)||0),offset:r,repeat:a,canvas:e};if(t.configure(e,s),s.width>0&&s.height>0){var u=e.getContext("2d");t.render(u,s,!1),t.clear(u,s,!1),s=n(u,s),t.clear(u,s,!0),t.renderWarp(u,s,!1),o(u,s),t.renderWarp(u,s,!0),t.renderWeft(u,s,!1),i(u,s),t.renderWeft(u,s,!0),t.render(u,s,!0)}return r};return g.metrics=u(v,w,x),g}var p=t(1),m=t(3),d=t(4),h={weave:m.weave.serge,zoom:1,defaultColors:null,transformSyntaxTree:null,hooks:{configure:function(e){},clear:function(e,r,t){},render:function(e,r,t){},renderWarp:function(e,r,t){},renderWeft:function(e,r,t){}}};l.metrics=u(h.weave,s(null,h.weave,{},{}),s(null,h.weave,{},{})),e.exports=f,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"canvas"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"Simple"})},function(e,r,t){"use strict";function n(e,r,t){if(t&&2==r.zoom){var n=r.offset.x,o=r.offset.y;e.save(),e.translate(n,o),e.fillStyle=e.createPattern(c,"repeat"),e.fillRect(-n,-o,r.width,r.height),e.restore()}}function o(e,r){return a(e,i.extend(r,{weave:s.weave.serge,zoom:2,hooks:{renderWeft:n}}))}var i=t(1),a=t(41),s=t(3),c=new Image;c.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAABHNCSVQICAgIfAhkiAAAAFVJREFUGJV1jsENgEAIBGcTCvBrJbbi90qgEuu6buwAHx4mKjcfkg0MS0Qs3KyA5xy5m6TGmwPokk4AcnNm0gidPxvQn4uZyb4/i051+zQZsFft03QB/booYDTfo3wAAAAASUVORK5CYII=",e.exports=o,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"house-of-tartan"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"House of Tartan"})},function(e,r,t){"use strict";function n(e,r,t){var n=s.extend({},t.defaultColors),o=s.intersection(s.keys(r),s.keys(e));t.includeUnusedColors&&(o=s.keys(r)),t.includeDefaultColors&&(o=s.union(s.keys(r),s.keys(e)));var i=t.format;return s.isFunction(i.color)?s.chain(o).sortBy().map(function(e){var t=r[e]||n[e];return t?i.color(s.extend({name:e},t)):null}).filter(function(e){return s.isString(e)&&e.length>0}).value():[]}function o(e,r,t){var n=r.format;return s.isFunction(n.stripe)&&s.isFunction(n.block)?(e=s.clone(e),e.formattedItems=s.chain(e.items).map(function(e){return e.isStripe?(t[e.name]=!0,n.stripe(e)):e.isBlock?o(e,r,t):""}).filter(function(e){return e.length>0}).value(),s.isFunction(n.block)?n.block(e):""):""}function i(e,r){var t=e.warp===e.weft,i={},a=o(e.warp,r,i),c=a;t||(c=o(e.weft,r,i));var u=n(i,e.colors,r);return s.trim(r.join({colors:u,warp:a,weft:c},e))}function a(e){return e=s.merge({},c,e),function(r){return s.isObject(r)?(s.isFunction(e.transformSyntaxTree)&&(r=e.transformSyntaxTree(r)),i(r,e)):""}}var s=t(1),c={transformSyntaxTree:null,format:{color:function(e){var r=""!=e.comment?" "+e.comment:"";return e.name+e.value+r+";"},stripe:function(e){return e.name+e.count},block:function(e){var r=s.chain(e.formattedItems).join(" ").trim().value();if(""==r)return"";var t=e.repeat>1?"*"+e.repeat:"";return r=e.isRoot?e.reflect?"["+r+"]":r:e.reflect?"["+r+"]":"("+r+")",r+t}},join:function(e){var r=[];return e.colors.length>0&&r.push(e.colors.join(" ")),e.warp!=e.weft?r.push(e.warp+" // "+e.weft):r.push(e.warp),r.join("\n")},defaultColors:{},includeUnusedColors:!0,includeDefaultColors:!0};e.exports=a},function(e,r,t){"use strict";e.exports.classic=t(45),e.exports.extended=t(48),e.exports.stwr=t(51),e.exports.weddslist=t(54)},function(e,r,t){"use strict";var n=t(3);e.exports.id="classic",e.exports.name="Classic (strict syntax)",e.exports.parse=t(46),e.exports.format=t(47),e.exports.colors=n.colors,e.exports.warpAndWeftSeparator=n.warpAndWeftSeparator},function(e,r,t){"use strict";function n(e){return e=o.extend({},e),o.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=i.warpAndWeftSeparator),s([s.pivot(),s.stripe(),s.literal(e.warpAndWeftSeparator),s.color({allowLongNames:!0,colorPrefix:/[=]?[#]/,colorSuffix:null,colorFormat:"long",allowComment:!0,commentSuffix:/;/,requireCommentSuffix:!0,commentFormat:/^\s*(.*)\s*;\s*$/})],{errorHandler:e.errorHandler,processTokens:c([e.processTokens,c.removeTokens(a.insignificantTokens)]),buildSyntaxTree:u.classic({errorHandler:e.errorHandler,processTokens:c.classify({isWarpAndWeftSeparator:function(r){return l.token.isLiteral(r)&&r.value==e.warpAndWeftSeparator}}),transformSyntaxTree:e.transformSyntaxTree})})}var o=t(1),i=t(45),a=t(3),s=t(11),c=t(25),u=t(36),l=t(4);e.exports=n},function(e,r,t){"use strict";function n(e){return e.replace(/^([a-z]+)([0-9]+)$/i,"$1/$2")}function o(e){return e=i.extend({},e,u),i.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=a.warpAndWeftSeparator),e.transformSyntaxTree=c([e.transformSyntaxTree,c.flatten(),c.fold({allowRootReorder:!1,allowNestedBlocks:!1,maxFoldLevels:2,minBlockSize:3,greedy:!1,allowSplitStripe:!1,processExistingBlocks:!1})]),e.join=function(r){var t=[];return r.colors.length>0&&t.push(r.colors.join(" ")),r.warp!=r.weft?t.push(r.warp+" "+e.warpAndWeftSeparator+" "+r.weft):t.push(r.warp),t.join("\n")},s.format(e)}var i=t(1),a=t(45),s=t(40),c=t(28),u={format:{color:function(e){var r=""!=e.comment?" "+e.comment:"";return e.name+e.value+r+";"},stripe:function(e){return e.name+e.count},block:function(e){var r=e.formattedItems;return e.reflect&&r.length>=2&&(r[0]=n(r[0]),r[r.length-1]=n(r[r.length-1])),i.chain(r).join(" ").trim().value()}}};e.exports=o},function(e,r,t){"use strict";var n=t(3);e.exports.id="extended",e.exports.name="Extended syntax",e.exports.parse=t(49),e.exports.format=t(50),e.exports.colors=n.colors,e.exports.warpAndWeftSeparator=n.warpAndWeftSeparator},function(e,r,t){"use strict";function n(e){return e=o.extend({},e),o.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=i.warpAndWeftSeparator),s([s.pivot(),s.stripe(),s.literal("["),s.literal("]"),s.literal("("),s.literal(")"),s.literal(e.warpAndWeftSeparator),s.repeat({allowAsPrefix:!0,allowAsSuffix:!0}),s.color({allowLongNames:!0,colorPrefix:/[=]?[#]/,colorSuffix:null,colorFormat:"both",allowComment:!0,commentSuffix:/;/,requireCommentSuffix:!1,commentFormat:/^\s*(.*)\s*;\s*$/})],{errorHandler:e.errorHandler,processTokens:c([e.processTokens,c.removeTokens(a.insignificantTokens)]),buildSyntaxTree:u.extended({errorHandler:e.errorHandler,processTokens:c.classify({isWarpAndWeftSeparator:function(r){return l.token.isLiteral(r)&&r.value==e.warpAndWeftSeparator}}),transformSyntaxTree:e.transformSyntaxTree})})}var o=t(1),i=t(48),a=t(3),s=t(11),c=t(25),u=t(36),l=t(4);e.exports=n},function(e,r,t){"use strict";function n(e){return e=o.extend({},e,c),o.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=i.warpAndWeftSeparator),e.transformSyntaxTree=s([e.transformSyntaxTree,s.fold({allowRootReorder:!1,allowNestedBlocks:!1,maxFoldLevels:2,minBlockSize:3,greedy:!1,allowSplitStripe:!1,processExistingBlocks:!1})]),e.join=function(r){var t=[];return r.colors.length>0&&t.push(r.colors.join(" ")),r.warp!=r.weft?t.push(r.warp+" "+e.warpAndWeftSeparator+" "+r.weft):t.push(r.warp),t.join("\n")},a.format(e)}var o=t(1),i=t(48),a=t(40),s=t(28),c={format:{color:function(e){var r=""!=e.comment?" "+e.comment:"";return e.name+e.value+r+";"},stripe:function(e){return e.name+e.count},block:function(e){var r=o.chain(e.formattedItems).join(" ").trim().value();if(""==r)return"";var t=e.repeat>1?"*"+e.repeat:"";return r=e.isRoot?e.reflect?"["+r+"]":r:e.reflect?"["+r+"]":"("+r+")",r+t}}};e.exports=n},function(e,r,t){"use strict";var n=t(4);e.exports.id="stwr",e.exports.name="Scottish Register of Tartans / Scottish Tartans World Register",e.exports.parse=t(52),e.exports.format=t(53),e.exports.colors=n.color.buildColorMap({K:"#000000",LP:"#9966ff",P:"#9933ff",DP:"#990099",W:"#dddddd",DW:"#e1dfd0",LY:"#ffff66",Y:"#ffff00",DY:"#ffcc00",O:"#ddaa00",LT:"#ffce24",T:"#bb5e00",DT:"#663300",LN:"#999999",N:"#666666",DN:"#333333",R:"#fd024e",LR:"#ff6262",DR:"#ce0000",MR:"#a40004",LG:"#336633",G:"#339900",DG:"#1b5300",OG:"#484e05",BG:"#074b32",AB:"#229f7a",LB:"#88a8aa",B:"#333399",DB:"#1e1e5b",RB:"#171366",NB:"#171366"}),e.exports.warpAndWeftSeparator="."},function(e,r,t){"use strict";function n(e){return e=o.extend({},e),o.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=i.warpAndWeftSeparator),s([s.pivot(),s.stripe(),s.literal(e.warpAndWeftSeparator),s.color({allowLongNames:!0,colorPrefix:/[=][#]?/,colorSuffix:null,colorFormat:"long",allowComment:!0,commentSuffix:/;/,requireCommentSuffix:!0,commentFormat:/^\s*(.*)\s*;\s*$/})],{errorHandler:e.errorHandler,processTokens:c([e.processTokens,c.removeTokens(a.insignificantTokens)]),buildSyntaxTree:u.classic({errorHandler:e.errorHandler,processTokens:c.classify({isWarpAndWeftSeparator:function(r){return l.token.isLiteral(r)&&r.value==e.warpAndWeftSeparator}}),transformSyntaxTree:e.transformSyntaxTree})})}var o=t(1),i=t(51),a=t(3),s=t(11),c=t(25),u=t(36),l=t(4);e.exports=n},function(e,r,t){"use strict";function n(e){return e.replace(/^([a-z]+)([0-9]+)$/i,"$1/$2")}function o(e){return e=i.extend({},e,u),i.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=a.warpAndWeftSeparator),e.transformSyntaxTree=c([e.transformSyntaxTree,c.flatten(),c.fold({allowRootReorder:!1,allowNestedBlocks:!1,maxFoldLevels:2,minBlockSize:3,greedy:!1,allowSplitStripe:!1,processExistingBlocks:!1})]),e.join=function(r){var t=[];return r.colors.length>0&&t.push(r.colors.join(" ")),r.warp!=r.weft?t.push(r.warp+" "+e.warpAndWeftSeparator+" "+r.weft):t.push(r.warp),t.join("\n")},s.format(e)}var i=t(1),a=t(51),s=t(40),c=t(28),u={format:{color:function(e){var r=""!=e.comment?" "+e.comment:"";return e.name+"="+e.value+r+";"},stripe:function(e){return e.name+e.count},block:function(e){var r=e.formattedItems;return e.reflect&&r.length>=2&&(r[0]=n(r[0]),r[r.length-1]=n(r[r.length-1])),i.chain(r).join(" ").trim().value()}}};e.exports=o},function(e,r,t){"use strict";var n=t(4);e.exports.id="weddslist",e.exports.name="Syntax by Weddslist (TDF)",e.exports.parse=t(55),e.exports.format=t(56),e.exports.colors=n.color.buildColorMap({W:"#ffffff",TR:"#ffffe9",R:"#800000",A:"#80ffff",X:"#00ff00",D:"#404040",LG:"#80ff80",J:"#400080",Y:"#808000",U:"#ff00ff",K:"#000000",H:"#004080",G:"#008000",LB:"#8080ff",F:"#800040",T:"#00ffff",I:"#008040",E:"#c0c0c0",N:"#808080",V:"#ffff80",M:"#800080",S:"#ffff00",L:"#408000",P:"#ff0000",C:"#008080",Q:"#0000ff",B:"#000080",Z:"#ff7dff",LR:"#ff8080",O:"#804000"})},function(e,r,t){"use strict";function n(e){return e=o.extend({},e),a([a.stripe(),a.literal("("),a.literal(")"),a.literal("["),a.literal("]"),a.color({allowLongNames:!0,colorPrefix:/[#]/,colorSuffix:null,colorFormat:"long",allowComment:!1})],{errorHandler:e.errorHandler,processTokens:s([e.processTokens,s.removeTokens(i.insignificantTokens)]),buildSyntaxTree:c.weddslist({errorHandler:e.errorHandler,processTokens:s.classify({isWarpAndWeftSeparator:null,isPivot:null,isBlockStart:null,isBlockEnd:null,isWarpStart:function(e){return u.token.isLiteral(e)&&"["==e.value},isWeftStart:function(e){return u.token.isLiteral(e)&&"]"==e.value},isBlockBodyStart:function(e){return u.token.isLiteral(e)&&"("==e.value},isBlockBodyEnd:function(e){return u.token.isLiteral(e)&&")"==e.value}}),transformSyntaxTree:e.transformSyntaxTree})})}var o=t(1),i=t(3),a=t(11),s=t(25),c=t(36),u=t(4);e.exports=n},function(e,r,t){"use strict";function n(e){return e=o.extend({},e,s),e.transformSyntaxTree=a([e.transformSyntaxTree,a.flatten(),a.fold({allowRootReorder:!1,allowNestedBlocks:!1,maxFoldLevels:2,minBlockSize:3,greedy:!1,allowSplitStripe:!1,processExistingBlocks:!1})]),i.format(e)}var o=t(1),i=t(40),a=t(28),s={format:{color:function(e){return e.name+e.value},stripe:function(e){return e.name+e.count},block:function(e){var r=e.formattedItems;return e.reflect&&r.length>=3&&(r.splice(1,0,"("),r.splice(-1,0,")")),o.chain(r).join(" ").trim().value().replace(/\(\s+/g,"(").replace(/\s+\)/g,")")}},join:function(e){var r=[];e.colors.length>0&&r.push(e.colors.join(" "));var t=e.warp,n=e.weft;return""==t&&(t=n,n=""),e.warp==e.weft&&(n=""),""!=t&&r.push("[ "+t),""!=n&&r.push("] "+n),r.join("\n")}};e.exports=n}])});
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("_")):"function"==typeof define&&define.amd?define(["_"],r):"object"==typeof exports?exports.tartan=r(require("_")):e.tartan=r(e._)}(this,function(e){return function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";var n=t(1);n.extend(e.exports,t(2)),e.exports.defaults=t(3),e.exports.parse=t(11),e.exports.filter=t(25),e.exports.transform=t(28),e.exports.syntax=t(31),e.exports.render=t(33),e.exports.schema=t(35),e.exports.utils=t(4)},function(r,t){r.exports=e},function(e,r){e.exports={version:"5.0.0"}},function(e,r,t){"use strict";var n=t(4);e.exports.weave={plain:[1,1],serge:[2,2]},e.exports.colors=n.color.buildColorMap({B:"#304080",G:"#004c00",K:"#000000",N:"#666666",R:"#c80000",T:"#603311",W:"#ffffff",Y:"#ffe600"}),e.exports.warpAndWeftSeparator="//",e.exports.insignificantTokens=["invalid","whitespace"]},function(e,r,t){"use strict";e.exports.error=t(5),e.exports.color=t(6),e.exports.token=t(7),e.exports.node=t(8),e.exports.sett=t(9),e.exports.repaint=t(10)},function(e,r){"use strict";var t={error:"error",warning:"warning",notice:"notice"},n={invalidToken:"Invalid token",zeroWidthStripe:"Zero-width stripe",unexpectedToken:"Unexpected token",orphanedPivot:"Orphaned pivot",multipleWarpAnWeftSeparator:"Only one warp/weft separator is allowed",unmatchedBlockStart:"Unmatched block start",unmatchedBlockEnd:"Unmatched block end",extraTokenInInputSequence:"Extra token in input sequence",invalidMultiplier:"Invalid multiplier value; replaced with default (1)"};e.exports.severity=t,e.exports.message=n},function(e,r,t){"use strict";function n(e,r){return r?/^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(e):/^#[0-9a-f]{6}$/i.test(e)}function o(e,r){return e=e.replace(/^\s*#/g,"").replace(/\s+$/g,"").toUpperCase(),r=r.replace(/^\s*#/g,"").replace(/\s+$/g,"").toUpperCase(),e==r}function i(e){return/^#?[0-9a-f]{6}$/i.test(e)?"#"+e.replace(/^#/,"").toUpperCase():/^#?[0-9a-f]{3}$/i.test(e)?"#"+e.replace(/^#/,"").replace(/[0-9a-f]/gi,"$&$&").toUpperCase():e}function s(e){var r={};return a.isArray(e)?a.each(e,function(e){r[e.name.toUpperCase()]={value:i(e.color),comment:a.isString(e.comment)?e.comment:""}}):a.isObject(e)&&a.each(e,function(e,t){r[t.toUpperCase()]={value:i(e),comment:""}}),r}var a=t(1);e.exports.isValidColor=n,e.exports.isSameColor=o,e.exports.normalizeColor=i,e.exports.buildColorMap=s},function(e,r,t){"use strict";function n(e,r){return B.isObject(e)&&e.type==r}function o(e){return n(e,L.invalid)}function i(e){return n(e,L.whitespace)}function s(e){return n(e,L.color)}function a(e){return n(e,L.stripe)}function u(e){return n(e,L.pivot)}function c(e){return n(e,L.literal)}function f(e){return n(e,L.repeat)}function l(e){return c(e)&&("["==e.value||"]"==e.value)}function p(e){return c(e)&&"["==e.value}function m(e){return c(e)&&"]"==e.value}function x(e){return c(e)&&("("==e.value||")"==e.value)}function d(e){return c(e)&&"("==e.value}function v(e){return c(e)&&")"==e.value}function h(e){return u(e)&&(e=B.clone(e),e.type=L.stripe),e}function w(e){return a(e)&&(e=B.clone(e),e.type=L.pivot),e}function g(e,r){var t={type:e,source:"",offset:-1,length:-1};return B.isString(r)&&(t.value=r,t.length=r.length),t}function S(e){return g(L.invalid,e)}function k(e){return g(L.whitespace,e)}function b(e,r){var t=g(L.color);return t.name=e,t.color=r,t}function y(e,r){r=parseInt(r,10)||0,r<0&&(r=0);var t=g(L.stripe);return t.name=e,t.count=r,t}function A(e,r){r=parseInt(r,10)||0,r<0&&(r=0);var t=g(L.pivot);return t.name=e,t.count=r,t}function j(e){return g(L.literal,e)}function C(){return g(L.literal,"[")}function O(){return g(L.literal,"]")}function F(e){return g(L.literal,e)}function W(){return g(L.literal,"(")}function P(){return g(L.literal,")")}function T(e){return g(L.literal,e)}function R(e){var r=g(L.repeat);return r.count=parseInt(e,10)||0,r.count<=0&&(r.count=1),r}var B=t(1),L={invalid:"invalid",whitespace:"whitespace",color:"color",stripe:"stripe",pivot:"pivot",literal:"literal",repeat:"repeat"};e.exports=L,e.exports.isToken=n,e.exports.isInvalid=o,e.exports.isWhitespace=i,e.exports.isColor=s,e.exports.isStripe=a,e.exports.isPivot=u,e.exports.isSquareBracket=l,e.exports.isOpeningSquareBracket=p,e.exports.isClosingSquareBracket=m,e.exports.isParenthesis=x,e.exports.isOpeningParenthesis=d,e.exports.isClosingParenthesis=v,e.exports.isLiteral=c,e.exports.isRepeat=f,e.exports.pivotToStripe=h,e.exports.stripeToPivot=w,e.exports.newToken=g,e.exports.newInvalid=S,e.exports.newWhitespace=k,e.exports.newColor=b,e.exports.newStripe=y,e.exports.newPivot=A,e.exports.newSquareBracket=j,e.exports.newOpeningSquareBracket=C,e.exports.newClosingSquareBracket=O,e.exports.newParenthesis=F,e.exports.newOpeningParenthesis=W,e.exports.newClosingParenthesis=P,e.exports.newLiteral=T,e.exports.newRepeat=R},function(e,r,t){"use strict";function n(e){return{isStripe:!0,name:e.name,count:e.count}}function o(e,r,t){return t=parseInt(t,10)||0,{isBlock:!0,items:f.filter(e,f.isObject),reflect:!!r,repeat:t>=1?t:1}}function i(e,r,t){var n=o(e,r,t);return n.isRoot=!0,n}function s(e){var r=parseInt(e,10)||0;return r>1?r:1}function a(e){return f.isObject(e)?e.isStripe&&e.count>0?e.name+e.count*s(e.repeat):e.isBlock&&f.isArray(e.items)&&e.items.length>0?"["+(e.isRoot?"R":"B")+"*"+s(e.repeat)+"/"+(e.reflect?"RF":"RP")+":"+f.chain(e.items).map(a).join("").value()+"]":"":""}function u(e,r){var t=0,n=0;if(f.isObject(e)&&(e.isStripe&&t++,e.isBlock&&f.isArray(e.items)&&e.items.length>0)){e.isRoot||n++;var o=e.reflect?2:1;f.each(e.items,function(r){if(f.isObject(r)){if(r.isBlock){var i=u(r,!0);n+=i.blocks*o}r.isStripe&&e.isRoot&&!e.reflect&&t++}})}return r?{blocks:n,stripes:t}:0==n&&0==t?e.isRoot?0:Number.MAX_VALUE:Math.sqrt(n*n+t*t)}function c(e,r){if(!f.isObject(e)||!f.isObject(r))return!1;if(e.isStripe&&r.isStripe)return e.name==r.name&&e.count*s(e.repeat)==r.count*s(r.repeat);if(e.isBlock&&r.isBlock){if(e.isRoot!=r.isRoot)return!1;if(e.reflect!=r.reflect)return!1;if(s(e.repeat)!=s(r.repeat))return!1;if(!f.isArray(e.items)||!f.isArray(r.items))return!1;if(e.items.length!=r.items.length)return!1;var t=!0;return f.each(e.items,function(e,n){var o=r.items[n];if(!c(e,o))return t=!1,!1}),t}return!1}var f=t(1);e.exports.newStripe=n,e.exports.newBlock=o,e.exports.newRootBlock=i,e.exports.isSameNode=c,e.exports.calculateNodeHash=a,e.exports.calculateNodeWeight=u},function(e,r,t){"use strict";function n(e,r,t){var n=r[e];return a.isObject(n)&&u.isValidColor(n.value)?n.value:(n=t[e],a.isObject(n)&&u.isValidColor(n.value)?n.value:null)}function o(e,r,t){return r=a.extend({},r),t=a.extend({},t),a.chain(e).map(function(e){if(a.isObject(e)&&e.isStripe){var o=parseInt(e.count,10)||0;if(o>0){var i=n(e.name,r,t);if(i)return[i,o]}}return null}).filter().reduce(function(e,r){var t=a.last(e);return t&&u.isSameColor(t[0],r[0])?(t[1]+=r[1],e):(e.push(r),e)},[]).value()}function i(e,r){r=!a.isArray(r)||r.length<2?[1,1]:r.slice(0,2),e=a.filter(e,function(e){return a.isArray(e)&&e.length>=2&&e[1]>0});var t=0,n=0;if(e.length>0){t=a.reduce(e,function(e,r){return e+r[1]},0);var o=a.sum(r);for(n=t;n%o!=0;)n+=t}return{length:t,fullCycle:n}}function s(e){var r=e.items,t=e.repeat,n=e.reflect;if(r.length<=1){if(1==r.length&&t>1){var o=a.clone(r[0]);o.count*=t,e=a.clone(e),e.items=[o]}return e}var i,s;n?(s=r.slice(1,-1),s.reverse(),i=r.concat(s)):i=r,s=[];for(var u=1;u<=t;u++)[].push.apply(s,i);return i=s,n&&!e.isRoot&&i.push(r[0]),e=a.clone(e),e.items=i,e.reflect=!1,e.repeat=1,e}var a=t(1),u=t(6);e.exports.compile=o,e.exports.getPatternMetrics=i,e.exports.reflectAndRepeat=s},function(e,r,t){"use strict";function n(e){function r(){t=null,n=null,e(n)}if(!o.isFunction(e))return o.identity;var t=null,n=null,a=function(e){t||(t=i(r),n=e)};return a.cancel=function(){return t&&s(t),t=null,n=null,this},a}var o=t(1),i=function(){var e=null;return"undefined"!=typeof window&&o.isObject(window)&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame),e||setTimeout}(),s=function(){var e=null;return"undefined"!=typeof window&&o.isObject(window)&&(e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame),e||clearTimeout}();e.exports=n},function(e,r,t){"use strict";function n(e){var r=a.filter(e,function(e){return a.isString(e)&&e.length>0});return r.length>0?a.first(r):""}function o(e){var r=a.filter(e,function(e){return a.isObject(e)&&e.isBlock&&e.isRoot&&a.isArrayLike(e.items)});return r.length>0?a.first(r):f.node.newRootBlock([])}function i(e,r,t){var n=c(r,e,t),o=n.parse();return a.isFunction(t.processTokens)&&(o=t.processTokens(o)),a.isFunction(t.buildSyntaxTree)&&(o=t.buildSyntaxTree(o)),o}function s(e,r){return r=a.extend({},p,r),function(t){t=u(t);var s;if(a.isString(t.warp)||a.isString(t.weft)){var c=a.trim(n([t.warp,t.weft])),l=a.trim(n([t.weft,t.warp])),p=c==l;c=i(e,c,r),p?(s={meta:a.extend({},c.meta),warp:o([c.warp,c.weft])},s.weft=s.warp):(l=i(e,l,r),a.isArrayLike(c)&&a.isArrayLike(l)?s=a.concat(c,f.token.newLiteral(r.warpAndWeftSeparator),l):a.isObject(c)&&a.isObject(l)&&(s={meta:a.extend({},c.meta,l.meta),warp:o([c.warp,c.weft]),weft:o([l.warp,l.weft])}))}else if(a.isString(t.threadcount)||a.isString(t.sett)){var m=n([t.threadcount,t.sett]);s=i(e,m,r)}else s=i(e,"",r);if(a.isString(t.palette)||a.isString(t.colors)){var x=n([t.palette,t.colors]);x=i(e,x,r),a.isArrayLike(s)?a.isArrayLike(x)&&(s=a.concat(x,s)):a.isObject(s)&&a.isObject(x)&&(s.colors=x.colors,s.meta=a.extend({},x.meta,s.meta))}return a.isObject(s)&&(s.colors=a.extend({},s.colors),a.isFunction(r.getSourceMeta)?s.meta=a.extend({},s.meta,r.getSourceMeta(t)):s.meta=a.extend({},s.meta)),s}}var a=t(1),u=t(12),c=t(15),f=t(4),l=t(3),p={errorHandler:null,processTokens:null,buildSyntaxTree:null,foreseeLimit:1,getSourceMeta:function(e){return a.omit(e,["warp","weft","threadcount","sett","palette","colors"])},warpAndWeftSeparator:l.warpAndWeftSeparator};e.exports=s,e.exports.source=t(18),e.exports.color=t(20),e.exports.stripe=t(21),e.exports.pivot=t(22),e.exports.repeat=t(23),e.exports.literal=t(24)},function(e,r,t){"use strict";function n(e){return o.isFunction(e)&&(e=e()),o.isString(e)?i(e):s(e)}var o=t(1),i=t(13),s=t(14);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"autodetect"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"Autodetect"})},function(e,r,t){"use strict";function n(e){return{threadcount:o.isString(e)?e:""}}var o=t(1);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"string"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"String"})},function(e,r,t){"use strict";function n(e){return o.extend({threadcount:""},e)}var o=t(1);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"object"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"Object"})},function(e,r,t){"use strict";function n(e,r,t){this.source=s.isString(e)?e:"",r=s.filter(r,s.isFunction),r.splice(0,0,a()),r.push(u()),this.parsers=r,this.options=t,this.inForesee=0,s.isFunction(t.errorHandler)&&(this.errorHandler=function(e,r,n){t.errorHandler(e,r,n||"error")})}function o(e,r){var t=null;return s.each(e.parsers,function(n){if(t=n(e,r),s.isObject(t))return t.offset=t.offset||r,!1}),t}function i(e,r,t){return t=s.extend({},t),t.foreseeLimit=parseInt(t.foreseeLimit,10)||0,t.foreseeLimit<1&&(t.foreseeLimit=1),new n(e,r,t)}var s=t(1),a=t(16),u=t(17);n.prototype={},n.prototype.errorHandler=function(e,r,t){},n.prototype.foresee=function(e){var r=this.options.foreseeLimit;if(this.inForesee>=r)return null;if(e=parseInt(e,10)||0,e<0&&(e=0),e<=this.offset)return this.errorHandler(new Error("Parser should not go back."),{currentOffset:this.offset,requestedOffset:e,source:this.source}),null;this.inForesee++;var t=o(this,e);return this.inForesee>0&&this.inForesee--,t},n.prototype.parse=function(e){var r=[];for(e=parseInt(e,10)||0,e<0&&(e=0);e<this.source.length;){this.offset=e;var t=o(this,e);s.isObject(t)&&(r.push(t),e=t.offset+t.length)}return r},e.exports=i},function(e,r,t){"use strict";function n(e,r){for(var t=e.source,n=10,o="";;){var a=t.substr(r,n),u=i.exec(a);if(!u)break;if(o+=u[0],u[0].length<n)break}if(""!=o)return{type:s.token.whitespace,value:o,length:o.length}}function o(){return n}var i=/^\s+/i,s=t(4);e.exports=o},function(e,r,t){"use strict";function n(e,r){var t=e.source,n=t.charAt(r);if(!e.inForesee)for(var o=r+1;;){var a=e.foresee(o);{if(!i.isObject(a)||"invalid"!=a.type)break;n+=a.value,o+=a.length}}if(""!=n)return n={type:s.token.invalid,value:n,length:n.length},e.inForesee||e.errorHandler(new Error(s.error.message.invalidToken),{token:n},s.error.severity.error),n}function o(){return n}var i=t(1),s=t(4);e.exports=o},function(e,r,t){"use strict";e.exports.autodetect=t(12),e.exports.string=t(13),e.exports.object=t(14),e.exports.json=t(19)},function(e,r,t){"use strict";function n(e){return o.extend({threadcount:""},o.isString(e)?JSON.parse(e):e)}var o=t(1);e.exports=n,Object.defineProperty(e.exports,"id",{enumerable:!0,value:"json"}),Object.defineProperty(e.exports,"name",{enumerable:!0,value:"JSON"})},function(e,r,t){"use strict";function n(e){if(e.colorFormat=a.trim((""+e.colorFormat).toLowerCase()),["long","short","both"].indexOf(e.colorFormat)==-1&&(e.colorFormat=c.colorFormat),e.colorPrefix instanceof RegExp?e.colorPrefix=e.colorPrefix.source:a.isString(e.colorPrefix)||(e.colorPrefix=""),e.colorSuffix instanceof RegExp?e.colorSuffix=e.colorSuffix.source:a.isString(e.colorSuffix)||(e.colorSuffix=""),e.commentSuffix instanceof RegExp){var r=e.commentSuffix.ignoreCase?"i":"";e.commentSuffix=new RegExp("^"+e.commentSuffix.source,r)}else e.commentSuffix=null;return e.commentFormat instanceof RegExp||(e.commentFormat=null),e}function o(e){var r=["^"],t="[a-z]";switch(e.allowLongNames&&(t+="{1,100}"),r.push("("+t+")"),r.push("("+e.colorPrefix+")"),e.colorFormat){case"long":r.push("([0-9a-f]{6})");break;case"short":r.push("([0-9a-f]{3})");break;case"both":r.push("([0-9a-f]{6}|[0-9a-f]{3})")}return r.push(e.colorSuffix),new RegExp(r.join(""),"i")}function i(e,r,t,n){var o,i,s,c=e.source;if(i=c.substr(r,200),o=t.exec(i)){var f={type:u.token.color,name:o[1].toUpperCase(),color:u.color.normalizeColor(o[3]),comment:"",length:o[0].length};if(!e.inForesee){if(n.allowComment){var l=r+f.length;if(n.commentSuffix&&n.requireCommentSuffix){for(s=l;s<c.length;s++)if(i=c.substr(s,10),o=n.commentSuffix.exec(i)){f.comment=c.substr(l,s-l+o[0].length);break}s>=c.length&&(f.comment=c.substr(l,c.length))}else{var p=["whitespace","invalid"];for(s=l;s<c.length;s++){if(i=c.substr(s,10),o=n.commentSuffix.exec(i)){f.comment=c.substr(l,s-l+o[0].length);break}var m=e.foresee(s);if(a.isObject(m)&&p.indexOf(m.type)==-1){f.comment=c.substr(l,s-l);break}}s>=c.length&&(f.comment=c.substr(l,c.length))}}f.length+=f.comment.length,n.commentFormat&&(o=n.commentFormat.exec(f.comment),o&&a.isString(o[1])&&(f.comment=o[1])),f.comment=a.trim(f.comment)}return f}}function s(e){e=n(a.extend({},c,e));var r=o(e);return function(t,n){return i(t,n,r,e)}}var a=t(1),u=t(4),c={allowLongNames:!0,colorPrefix:/[=]?[#]/,colorSuffix:/;?/,colorFormat:"both",allowComment:!1,commentSuffix:/;/,requireCommentSuffix:!0,commentFormat:/^\s*(.*)\s*;\s*$/};e.exports=s},function(e,r,t){"use strict";function n(e){var r=["^"],t="[a-z]";return e.allowLongNames&&(t+="{1,100}"),r.push("("+t+")"),r.push("([0-9]+)"),new RegExp(r.join(""),"i")}function o(e,r,t,n){var o=e.source,i=t.exec(o.substr(r,20));if(i){var s=parseInt(i[2],10)||0;s<0&&(s=0);var u={type:a.token.stripe,name:i[1].toUpperCase(),count:s,length:i[0].length};return 0==u.count&&e.errorHandler(new Error(a.error.message.zeroWidthStripe),{token:u},a.error.severity.warning),u}}function i(e){e=s.extend({},u,e);var r=n(e);return function(t,n){return o(t,n,r,e)}}var s=t(1),a=t(4),u={allowLongNames:!0};e.exports=i},function(e,r,t){"use strict";function n(e){var r=["^"],t="[a-z]";return e.allowLongNames&&(t+="{1,100}"),r.push("("+t+")"),r.push("/([0-9]+)"),new RegExp(r.join(""),"i")}function o(e,r,t,n){var o=e.source,i=t.exec(o.substr(r,20));if(i){var s=parseInt(i[2],10)||0;s<0&&(s=0);var u={type:a.token.pivot,name:i[1].toUpperCase(),count:s,length:i[0].length};return 0==u.count&&e.errorHandler(new Error(a.error.message.zeroWidthStripe),{token:u},a.error.severity.warning),u}}function i(e){e=s.extend({},u,e);var r=n(e);return function(t,n){return o(t,n,r,e)}}var s=t(1),a=t(4),u={allowLongNames:!0};e.exports=i},function(e,r,t){"use strict";function n(e,r,t){var n=e.source,o=null,a=!1,f=!1;if(t.allowAsPrefix&&(o=u.exec(n.substr(r,20)),a=!!o),t.allowAsSuffix&&!o&&(o=c.exec(n.substr(r,20)),f=!!o),o){var l=parseInt(o[1],10)||0;l<=0&&(l=1);var p={type:s.token.repeat,count:l>=1?l:1,isPrefix:a,isSuffix:f,length:o[0].length};return l<1&&e.errorHandler(new Error(s.error.message.invalidMultiplier),{token:i.extend({},p,{count:l})},s.error.severity.warning),p}}function o(e){return e=i.extend({},a,e),function(r,t){return n(r,t,e)}}var i=t(1),s=t(4),a={allowAsPrefix:!0,allowAsSuffix:!0},u=/^([0-9]+)\s*[*]/i,c=/^[*]\s*([0-9]+)/i;e.exports=o},function(e,r,t){"use strict";function n(e,r,t){var n=e.source;if(""!=t.string){var o=n.substr(r,t.string.length),i=t.ignoreCase?o.toUpperCase():o;if(i==t.string)return{type:s.token.literal,value:o,length:o.length}}}function o(e){return i.isString(e)&&(e={string:e}),e=i.extend({},a,e),i.isString(e.string)||(e.string=""),e.ignoreCase&&(e.string=e.string.toUpperCase()),function(r,t){return n(r,t,e)}}var i=t(1),s=t(4),a={string:"",ignoreCase:!1};e.exports=o},function(e,r,t){"use strict";function n(e){return e=o.filter(e,o.isFunction),function(r){if(o.isArray(r))for(var t=0;t<e.length;t++)r=e[t](r);return r}}var o=t(1);e.exports=n,e.exports.classify=t(26),e.exports.removeTokens=t(27)},function(e,r,t){"use strict";function n(e,r,t){return!1}function o(e,r){return s.map(e,function(t,n){var o=s.clone(t);return s.each(r,function(r,i){o[i]=r(t,n,e)}),o})}function i(e){return e=s.extend({},c,e),s.each(c,function(r,t){s.isFunction(e[t])||(e[t]=n)}),function(r){return o(r,e)}}var s=t(1),a=t(4),u=t(3),c={isColor:function(e,r,t){return a.token.isColor(e)},isStripe:function(e,r,t){return a.token.isStripe(e)},isPivot:function(e,r,t){return a.token.isPivot(e)},isRepeat:function(e,r,t){return a.token.isRepeat(e)},isWarpAndWeftSeparator:function(e,r,t){return a.token.isLiteral(e)&&e.value==u.warpAndWeftSeparator},isBlockStart:function(e,r,t){return a.token.isOpeningSquareBracket(e)||a.token.isOpeningParenthesis(e)},isBlockEnd:function(e,r,t){return a.token.isClosingSquareBracket(e)||a.token.isClosingParenthesis(e)}};e.exports=i},function(e,r,t){"use strict";function n(e){return i.isFunction(e)?e:(i.isArray(e)||(e=s.insignificantTokens),function(r){return!i.isObject(r)||e.indexOf(r.type)>=0})}function o(e){var r=n(e);return function(e){return i.filter(e,function(e){return!r(e)})}}var i=t(1),s=t(3);e.exports=o},function(e,r,t){"use strict";function n(e){return e=o.filter(e,o.isFunction),function(r){return o.isObject(r)&&o.each(e,function(e){r=e(r)}),r}}var o=t(1);e.exports=n,e.exports.flatten=t(29),e.exports.fold=t(30)},function(e,r,t){"use strict";function n(e){var r=[];return s.each(e.items,function(e){e.isBlock?(e=n(e),[].push.apply(r,e.items)):r.push(e)}),e=s.clone(e),e.items=r,a.sett.reflectAndRepeat(e)}function o(e){var r=s.clone(e),t=e.warp==e.weft;return s.isObject(e.warp)&&(r.warp=n(e.warp)),s.isObject(e.weft)&&(t?r.weft=r.warp:r.weft=n(e.weft)),r}function i(){return o}var s=t(1),a=t(4);e.exports=i},function(e,r,t){"use strict";function n(e){if(!(e.length<5||e.length%2!=1)){for(var r,t,n=[],o=0,i=e.length-1;;){if(r=e[o],t=e[i],!c.node.isSameNode(r,t))return;if(n.push(r),o==i)break;o++,i--}return n}}function o(e,r,t){if(!e.reflect&&0!=e.items.length){var o=u.concat(e.items,e.items[0]),i=n(o);if(u.isArray(i)){var s=u.clone(e);s.items=i,s.reflect=!0,t.push({node:s,hash:c.node.calculateNodeHash(s),weight:r.calculateNodeWeight(s)})}}}function i(e,r,t){var n=[];return o(e,r,n),n.push({node:e,hash:c.node.calculateNodeHash(e),weight:r.calculateNodeWeight(e)}),n}function s(e,r){var t=u.clone(e),n=e.warp===e.weft;return u.isObject(e.warp)&&(t.warpVariants=i(e.warp,r,!0)),u.isObject(e.weft)&&(n?t.weftVariants=t.warpVariants:t.weftVariants=i(e.weft,r,!0)),t.warp=u.first(t.warpVariants).node,t.weft=u.first(t.weftVariants).node,t}function a(e){return e=u.extend({},f,e),function(r){return s(r,e)}}var u=t(1),c=t(4),f={calculateNodeWeight:c.node.calculateNodeWeight};e.exports=a},function(e,r,t){"use strict";e.exports.classic=t(32)},function(e,r,t){"use strict";function n(e,r){var t=[],n=!1,o=null,i=null;return e.length>=2&&(o=s.first(e),i=s.last(e),o.isPivot&&i.isPivot&&(n=!0)),s.each(e,function(e){return e.isStripe?void t.push(a.node.newStripe(e)):e.isPivot?!n||e!==o&&e!==i?(r.errorHandler(new Error(a.error.message.orphanedPivot),{token:e},a.error.severity.warning),void t.push(a.node.newStripe(e))):void t.push(a.node.newStripe(e)):void r.errorHandler(new Error(a.error.message.unexpectedToken),{token:e},a.error.severity.error)}),a.node.newRootBlock(t,n)}function o(e,r){if(!s.isArray(e))return e;if(s.isFunction(r.processTokens)&&(e=r.processTokens(e),!s.isArray(e)))return e;var t=[],o=[],i=[],u=o;s.each(e,function(e){return e.isColor?void t.push(e):void(e.isWarpAndWeftSeparator?(u===i&&r.errorHandler(new Error(a.error.message.multipleWarpAnWeftSeparator),{token:e},a.error.severity.warning),u=i):u.push(e))}),0==o.length&&(o=i,i=[]),0==i.length&&(i=o);var c={};return c.colors=a.color.buildColorMap(t),c.warp=n(o,r),i===o?c.weft=c.warp:c.weft=n(i,r),s.isFunction(r.transformSyntaxTree)&&(c=r.transformSyntaxTree(c)),c}function i(e){return e=s.extend({},u,e),s.isFunction(e.errorHandler)||(e.errorHandler=u.errorHandler),function(r){return o(r,e)}}var s=t(1),a=t(4),u={errorHandler:function(e,r,t){},processTokens:null,transformSyntaxTree:null};e.exports=i},function(e,r,t){"use strict";e.exports.format=t(34)},function(e,r,t){"use strict";function n(e,r,t){var n=a.extend({},t.defaultColors),o=a.intersection(a.keys(r),a.keys(e));t.includeUnusedColors&&(o=a.keys(r)),t.includeDefaultColors&&(o=a.union(a.keys(r),a.keys(e)));var i=t.format;return a.isFunction(i.color)?a.chain(o).sortBy().map(function(e){var t=r[e]||n[e];return t?i.color(a.extend({name:e},t)):null}).filter(function(e){return a.isString(e)&&e.length>0}).value():[]}function o(e,r,t){var n=r.format;return a.isFunction(n.stripe)&&a.isFunction(n.block)?(e=a.clone(e),e.formattedItems=a.chain(e.items).map(function(e){return e.isStripe?(t[e.name]=!0,n.stripe(e)):e.isBlock?o(e,r,t):""}).filter(function(e){return e.length>0}).value(),a.isFunction(n.block)?n.block(e):""):""}function i(e,r){var t=e.warp===e.weft,i={},s=o(e.warp,r,i),u=s;t||(u=o(e.weft,r,i));var c=n(i,e.colors,r);return a.trim(r.join({colors:c,warp:s,weft:u},e))}function s(e){return e=a.merge({},u,e),function(r){return a.isObject(r)?(a.isFunction(e.transformSyntaxTree)&&(r=e.transformSyntaxTree(r)),i(r,e)):""}}var a=t(1),u={transformSyntaxTree:null,format:{color:function(e){var r=""!=e.comment?" "+e.comment:"";return e.name+e.value+r+";"},stripe:function(e){return e.name+e.count},block:function(e){var r=a.chain(e.formattedItems).join(" ").trim().value();if(""==r)return"";var t=e.repeat>1?"*"+e.repeat:"";return r=e.isRoot?e.reflect?"["+r+"]":r:e.reflect?"["+r+"]":"("+r+")",r+t}},join:function(e){var r=[];return e.colors.length>0&&r.push(e.colors.join(" ")),e.warp!=e.weft?r.push(e.warp+" // "+e.weft):r.push(e.warp),r.join("\n")},defaultColors:{},includeUnusedColors:!0,includeDefaultColors:!0};e.exports=s},function(e,r,t){"use strict";e.exports.classic=t(36)},function(e,r,t){"use strict";var n=t(3);e.exports.id="classic",e.exports.name="Classic (strict syntax)",e.exports.parse=t(37),e.exports.format=t(38),e.exports.colors=n.colors,e.exports.warpAndWeftSeparator=n.warpAndWeftSeparator},function(e,r,t){"use strict";function n(e){return e=o.extend({},e),o.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=i.warpAndWeftSeparator),a([a.pivot(),a.stripe(),a.literal(e.warpAndWeftSeparator),a.color({allowLongNames:!0,colorPrefix:/[=]?[#]/,colorSuffix:null,colorFormat:"long",allowComment:!0,commentSuffix:/;/,requireCommentSuffix:!0,commentFormat:/^\s*(.*)\s*;\s*$/})],{errorHandler:e.errorHandler,processTokens:u([e.processTokens,u.removeTokens(s.insignificantTokens)]),buildSyntaxTree:c.classic({errorHandler:e.errorHandler,processTokens:u.classify({isWarpAndWeftSeparator:function(r){return f.token.isLiteral(r)&&r.value==e.warpAndWeftSeparator}}),transformSyntaxTree:e.transformSyntaxTree})})}var o=t(1),i=t(36),s=t(3),a=t(11),u=t(25),c=t(31),f=t(4);e.exports=n},function(e,r,t){"use strict";function n(e){return e.replace(/^([a-z]+)([0-9]+)$/i,"$1/$2")}function o(e){return e=i.extend({},e,c),i.isString(e.warpAndWeftSeparator)||(e.warpAndWeftSeparator=""),""==e.warpAndWeftSeparator&&(e.warpAndWeftSeparator=s.warpAndWeftSeparator),e.transformSyntaxTree=u([e.transformSyntaxTree,u.flatten(),u.fold({allowRootReorder:!1,allowNestedBlocks:!1,maxFoldLevels:2,minBlockSize:3,greedy:!1,allowSplitStripe:!1,processExistingBlocks:!1})]),e.join=function(r){var t=[];return r.colors.length>0&&t.push(r.colors.join(" ")),r.warp!=r.weft?t.push(r.warp+" "+e.warpAndWeftSeparator+" "+r.weft):t.push(r.warp),t.join("\n")},a.format(e)}var i=t(1),s=t(36),a=t(33),u=t(28),c={format:{color:function(e){var r=""!=e.comment?" "+e.comment:"";return e.name+e.value+r+";"},stripe:function(e){return e.name+e.count},block:function(e){var r=e.formattedItems;return e.reflect&&r.length>=2&&(r[0]=n(r[0]),r[r.length-1]=n(r[r.length-1])),i.chain(r).join(" ").trim().value()}}};e.exports=o}])});
//# sourceMappingURL=tartan.min.js.map
{
"name": "tartan",
"version": "4.3.0",
"version": "5.0.0",
"description": "This library allows to parse tartan threadcount.",

@@ -16,3 +16,2 @@ "keywords": [

"scripts": {
"start": "xdg-open index.html",
"test": "mocha tests/*.js tests/*/*.js",

@@ -19,0 +18,0 @@ "build:dev": "NODE_ENV=development webpack --hide-modules --config webpack.config.development.js",

'use strict';
module.exports.canvas = require('./canvas');
module.exports.houseOfTartan = require('./house-of-tartan');
module.exports.format = require('./format');
'use strict';
module.exports.classic = require('./classic');
module.exports.extended = require('./extended');
module.exports.stwr = require('./stwr');
module.exports.weddslist = require('./weddslist');
'use strict';
module.exports.extended = require('./extended');
module.exports.classic = require('./classic');
module.exports.weddslist = require('./weddslist');

@@ -7,27 +7,2 @@ 'use strict';

var defaultOptions = {
// treat root block as infinite - may detect non-obvious folds
allowRootReorder: true,
// Enables extended mode - search of sub-blocks
allowNestedBlocks: false, // fold only root
// Next options are applicable only to extended mode:
maxFoldLevels: 2, // fold root and up to 2 nested levels; 0 - unlimited
// detected blocks should contain at least 3 stripes when folded
minBlockSize: 3,
// Example: R10 K20 Y2 G2 Y2 K20 R10
// Non-greedy algorithm will capture only [R10 K20 Y2 G2]
// Greedy will also produce R10 [K20 Y2 G2] R10
greedy: false, // Capture only longest sequence
// R15 K10 Y2 K10 R10 => R5 R10 K10 Y2 K10 R10 => R5 [R10 K10 Y2]
allowSplitStripe: true,
// If sett already contains some nested blocks - try to fold them too
processExistingBlocks: true,
// Evaluation function - should return a number that will be used to
// compare blocks and choose the best variant
calculateNodeWeight: utils.node.calculateNodeWeight

@@ -87,261 +62,14 @@ };

function findRootBlockVariants(root, options) {
var results = [root];
if (root.reflect || (root.items.length == 0) || !options.allowRootReorder) {
return results;
}
var i;
var items = _.clone(root.items);
for (i = 0; i < items.length - 1; i++) {
// Move first node to the end
var temp = items[0];
items.splice(0, 1);
items.push(temp);
var result = _.clone(root);
result.items = _.clone(items);
results.push(result);
}
return results;
}
function findAllPossibleVariants(items, options, results, level) {
results.push(items);
if (level <= 0) {
return;
}
if (items.length >= options.minBlockSize * 2 - 1) {
var from = options.minBlockSize - 1;
var to = items.length - options.minBlockSize;
for (var i = from; i <= to; i++) {
tryFindNestedBlocks(i, items, _.extend({}, options, {
allowSplitStripe: false
}), results, level - 1);
if (options.allowSplitStripe) {
tryFindNestedBlocks(i, items, _.extend({}, options, {
allowSplitStripe: true
}), results, level - 1);
}
}
}
}
function processNestedVariants(items, left, right, middle, appendToPrefix,
prependToSuffix, options, results, level) {
if (middle.length < options.minBlockSize) {
return;
}
var prefix = items.slice(0, left >= 0 ? left + 1 : 0);
if (appendToPrefix) {
prefix.push(appendToPrefix);
}
var middleVariants = [];
findAllPossibleVariants(middle, options, middleVariants, level);
var suffix = items.slice(right, items.length);
if (prependToSuffix) {
suffix.splice(0, 0, prependToSuffix);
}
var suffixVariants = [];
findAllPossibleVariants(suffix, options, suffixVariants, level);
_.each(suffixVariants, function(variant) {
_.each(middleVariants, function(middle) {
results.push(_.concat(prefix,
utils.node.newBlock(middle, true),
variant));
});
});
}
function tryFindNestedBlocks(index, items, options, results, level) {
var left;
var right;
left = index - 1;
right = index + 1;
var appendToPrefix = null;
var prependToSuffix = null;
var middle = [items[index]];
var processLast = false;
while ((left >= 0) && (right < items.length)) {
if (utils.node.isSameNode(items[left], items[right])) {
middle.splice(0, 0, items[left]);
} else
if (
options.allowSplitStripe && items[left].isStripe &&
items[right].isStripe && (items[left].name == items[right].name)) {
var diff = items[left].count - items[right].count;
if (diff > 0) {
appendToPrefix = utils.node.newStripe({
name: items[left].name,
count: Math.abs(diff)
});
} else {
prependToSuffix = utils.node.newStripe({
name: items[left].name,
count: Math.abs(diff)
});
}
var node = _.clone(items[left]);
node.count = Math.min(items[left].count, items[right].count);
middle.splice(0, 0, node);
left--;
right++;
processLast = true;
break;
} else {
processLast = true;
break;
}
left--;
right++;
if (options.greedy) {
processNestedVariants(items, left, right, middle,
appendToPrefix, prependToSuffix, options, results, level);
}
}
if (processLast || !options.greedy) {
processNestedVariants(items, left, right, middle,
appendToPrefix, prependToSuffix, options, results, level);
}
}
function findNestedBlocks(block, options, results) {
if (block.items.length < options.minBlockSize * 2 - 1) {
// This block cannot be folded to contain `minBlockSize` stripes as it
// is too small
return;
}
function processTokens(root, options, doNotLog) {
var variants = [];
findAllPossibleVariants(block.items, options, variants,
options.maxFoldLevels);
_.each(variants, function(variant) {
var result = _.clone(block);
result.items = variant;
results.push({
node: result,
hash: utils.node.calculateNodeHash(result),
weight: options.calculateNodeWeight(result)
});
});
}
function processExistingBlocks(root, options, results) {
results.push(root);
if (
options.allowNestedBlocks && options.processExistingBlocks &&
options.maxFoldLevels > 1
) {
var prefixes = [];
var suffix = [];
var modifiedOptions = _.clone(options);
// Nested blocks are not real roots, so do not use extended algorithm
modifiedOptions.allowRootReorder = false;
// We already drilled down one level
modifiedOptions.maxFoldLevels -= 1;
_.each(root.items, function(item) {
if (item.isBlock) {
// Calculate variants of item
item = _.clone(item);
item.isRoot = true;
var variants = processTokens(item, modifiedOptions, true);
// Merge previous prefixes, variants of current block and suffix
var temp = prefixes;
prefixes = [];
_.each(variants, function(variant) {
variant = _.clone(variant.node);
variant.isRoot = false;
if (temp.length > 0) {
_.each(temp, function(prefix) {
prefixes.push(_.concat(prefix, suffix, variant));
});
} else {
prefixes.push(_.concat(suffix, variant));
}
});
// Suffix is already merged, reset it
suffix = [];
} else {
suffix.push(item);
}
});
_.each(prefixes, function(prefix) {
var result = _.clone(root);
result.items = _.concat(prefix, suffix);
results.push(result);
});
}
}
function processTokens(root, options, doNotLog) {
var variants = [{
foldRootBlock(root, options, variants);
variants.push({
node: root,
hash: utils.node.calculateNodeHash(root),
weight: utils.node.calculateNodeWeight(root)
}];
var rootVariants = [];
processExistingBlocks(root, options, rootVariants);
var excludeHashes = [];
_.each(rootVariants, function(root) {
var rootVariants = findRootBlockVariants(root, options);
// Exclude non-folded modified roots
_.each(_.drop(rootVariants), function(root) {
excludeHashes.push({hash: utils.node.calculateNodeHash(root)});
});
_.each(rootVariants, function(root) {
foldRootBlock(root, options, variants);
if (options.allowNestedBlocks) {
findNestedBlocks(root, options, variants);
}
});
weight: options.calculateNodeWeight(root)
});
return _.chain(variants)
.differenceBy(excludeHashes, function(item) {
return item.hash;
})
.uniqBy(function(item) {
return item.hash;
})
.sortBy(function(item) {
return item.weight;
})
.each(function(item) {
if (!doNotLog) {
// Debug code, let it be here for now
console.log(item.weight.toFixed(4),
item.hash
.replace(/\[R\*[0-9]+\/R[PF]:/g, '')
.replace(/B\*[0-9]+\/R[PF]:/g, '')
.replace(/]$/g, '')
.replace(/[0-9]+/g, '')
);
}
})
.value();
// There may be at most two variants: unfolded and folded;
// folded is better.
return variants;
}

@@ -373,8 +101,2 @@

options = _.extend({}, defaultOptions, options);
if (options.minBlockSize < 1) {
options.minBlockSize = 1;
}
if (options.maxFoldLevels <= 0) {
options.maxFoldLevels = 200000000; // Just a huge number
}
return function(sett) {

@@ -381,0 +103,0 @@ return transform(sett, options);

@@ -21,7 +21,2 @@ 'use strict';

module.exports.flatten = require('./flatten');
module.exports.flattenSimpleBlocks = require('./flatten-simple-blocks');
module.exports.fold = require('./fold');
module.exports.mergeStripes = require('./merge-stripes');
module.exports.removeEmptyBlocks = require('./remove-empty-blocks');
module.exports.removeZeroWidthStripes = require('./remove-zero-width-stripes');
module.exports.optimize = require('./optimize');

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc