@knapsack/core 4.71.2 → 4.72.0--canary.4986.9e14d73.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js","../../../node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js","../../../node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js","../../../node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js","../src/users.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/env.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/errors.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/common.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/plugins.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/scope.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/finalize.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/proxy.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/immerClass.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/current.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/immer.ts","../../types/src/ui-config.ts","../../types/src/color-config.ts","../../types/src/typography-config.ts","../../types/src/nav-customization-config.ts","../../types/src/app-client-data/design-tokens-types/token-definitions.ts","../../types/src/app-client-data/design-tokens-types/token-data.ts","../../types/src/app-client-data/design-tokens-types/token-src-value-info.ts","../../types/src/app-client-data/design-tokens-types/token-src.ts","../../types/src/app-client-data/design-tokens-types/token-utils.ts","../../types/src/app-client-data/patterns.ts","../../types/src/app-client-data/page.header.ts","../../types/src/app-client-data/index.ts","../../types/src/app-client-data-v3/index.ts","../../types/src/app-client-data-migrations/4.1.7-demos.ts","../../types/src/json-schema.ts","../../types/src/changes.ts","../../types/src/renderer-client-types.ts","../../types/src/git-providers.ts","../../types/src/user-roles.ts","../src/webhooks.ts","../src/ks-urls.ts","../src/http-headers.ts"],"names":["require_color_name","__commonJSMin","exports","module","require_is_arrayish","__name","obj","require_simple_swizzle","isArrayish","concat","slice","swizzle","args","results","i","len","arg","fn","require_color_string","colorNames","hasOwnProperty","reverseNames","name","cs","string","prefix","val","model","abbr","hex","rgba","per","keyword","rgb","match","hexAlpha","i2","clamp","hsl","alpha","h","s","l","a","hwb","w","b","hexDouble","r","g","hsla","hwba","num","min","max","str","NOTHING","DRAFTABLE","DRAFT_STATE","errors","plugin","thing","data","die","error","e","msg","getPrototypeOf","isDraft","value","isDraftable","isPlainObject","isMap","isSet","objectCtorString","proto","Ctor","each","iter","getArchtype","key","entry","index","state","has","prop","set","propOrOldValue","t","is","x","y","target","latest","shallowCopy","base","strict","isPlain","descriptors","keys","desc","freeze","deep","isFrozen","dontMutateFrozenCollections","plugins","getPlugin","pluginKey","currentScope","getCurrentScope","createScope","parent_","immer_","usePatchesInScope","scope","patchListener","revokeScope","leaveScope","revokeDraft","enterScope","immer","draft","processResult","result","baseDraft","finalize","maybeFreeze","rootScope","path","childValue","finalizeProperty","resultEach","parentState","targetObject","rootPath","targetIsSet","res","createProxyProxy","parent","isArray","traps","objectTraps","arrayTraps","revoke","proxy","source","readPropFromProto","peek","prepareCopy","createProxy","getDescriptorFromProto","current","currentState","markChanged","owner","Immer","config","recipe","defaultBase","self","hasError","p","ip","patches","inversePatches","patch","applyPatchesImpl","currentImpl","copy","setUseStrictShallowCopy","applyPatches","Ie","n","isColor","color","colorString","ColorStringStruct","define","ColorConfigStruct","union","type","literal","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceSourceFormats","Fe","FontFaceFormatsEnumStruct","FontFaceSourceStruct","FontFaceConfigStruct","optional","size","array","TextTransforms","FontStretches","je","TypographyLinkConfigStruct","boolean","FontSizeConfigStruct","TypographyConfigStruct","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","UiConfigV3Struct","UiConfigV4Struct","defaulted","UiConfigV6Struct","UiConfigV7Struct","UiConfigV9Struct","UiConfigV10Struct","isTokenReference","hasTokenReferences","isNotTokenReference","TokenReferenceStruct","ye","compositeTypesRecord","tokenTypeComposites","singularTypesRecord","tokenTypeSingulars","isTokenTypeComposite","isTokenTypeSingular","expectType","TokenDataBaseStruct","isTokenDataComposite","tokenData","isTokenValueColor","TokenValueColorStruct","TokenDataColorNonRefStruct","TokenDataColorRefStruct","isTokenValueDimension","TokenValueDimensionStruct","TokenDataDimensionNonRefStruct","TokenDataDimensionRefStruct","isTokenValueDuration","TokenValueDurationStruct","TokenDataDurationNonRefStruct","TokenDataDurationRefStruct","isTokenValueFontWeight","TokenValueFontWeightStruct","TokenDataFontWeightNonRefStruct","TokenDataFontWeightRefStruct","TokenValueCubicBezierStruct","v","TokenDataCubicBezierNonRefStruct","TokenDataCubicBezierRefStruct","isTokenValueShadow","isObject","TokenValueShadowStruct","TokenDataShadowNonRefStruct","TokenDataShadowRefStruct","TokenValueStrokeStyleStruct","isTokenValueBorder","TokenValueBorderStruct","TokenDataBorderNonRefStruct","TokenDataBorderRefStruct","isTokenValueTransition","TokenValueTransitionStruct","TokenDataTransitionNonRefStruct","TokenDataTransitionRefStruct","TokenDataStringNonRefStruct","TokenDataStringRefStruct","TokenDataStrokeStyleNonRefStruct","TokenDataStrokeStyleRefStruct","TokenDataNumberNonRefStruct","TokenDataNumberRefStruct","TokenDataBooleanNonRefStruct","TokenDataBooleanRefStruct","isObjKey","kind","isTokenSrcValueInfoSingular","tokenSrcValueInfo","isTokenSrcValueInfoComposite","isTokenSrcExtensions","extensionsObj","isTokenSrc","tokenObject","isTokenGroup","isTokenTypeVarRef","varRefCollectionInfo","getPrimitiveValue","tokenValue","parseTokenDimensionValue","valueToParse","unit","parseNumberWithUnit","isSlottedText","slottedData","isSlottedTemplateDemo","isSlottedTemplateReference","StageLayouts","Nt","isDataDemo","demo","isTemplateDemo","PageHeaderSizes","Ce","isKsAppClientDataNoMeta","isKsAppClientDataAndMeta","KsAppClientDataAndMetaStruct","isKsMetaState","isKsAppClientDataNoMetaV3","isKsAppClientDataAndMetaV3","KsAppClientDataAndMetaStructV3","isKsMetaStateV3","appClientData","pattern","slotName","slotData","pId","templates","tId","demoIds","PropTypeNames","Wt","isNumberProp","isBooleanProp","isFunctionProp","isArrayOfObjectsProp","isObjectProp","PatchStructRuntime","PatchStruct","isPatch","PatchesStructRuntime","PatchesStruct","isPatches","KsRemoteChangeRuntime","KsRemoteChangeStruct","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes","KsRendererClientEvents","Jt","GitProviderType","MergeableState","qt","RestActions","Xt","TextEncoding","rolesById","roles","RolesEnums","Xr","RolesEnumsStruct","canRoleAdmin","role","rolesThatCanManageUsers","canRoleManageUsers","rolesThatCanDelete","canRoleDelete","rolesThatCanEdit","canRoleEdit","rolesThatCanPublish","canRolePublish","rolesThatCanView","canRoleView","isRoleValid","HasuraRoles","HasuraRolesStruct","HasuraClaimsStruct","KsClaimsStruct","record","JwtBaseStruct","HASURA_CLAIMS_NAMESPACE","KNAPSACK_CLAIMS_NAMESPACE","JwtCustomClaimsStruct","JwtWithCustomClaimsStruct","assign","expandSitesByRole","sitesByRole","cur","roleId","siteIds","siteId","defaultAnonymousKsClaims","getKsClaims","claims","ksClaims","siteRoleMap","siteDeployedWebhookEndpoint","gitHubOauthInternalEndpoint","KS_DB_URL","isUrl","dbUrl","dbGqlEndpoint","ksUrls","ksHttpHeaders"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,EAAA,CAAA,MAAA,CAAA,MAAA,CAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,M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pB,KAAA,CAAAF,EAKA,CAAA,aAAA,CAAAC,EACF,ECpBO,IAAME,EAAgB,CAAA,CAC3B,MAAQ,CAAA,cAAA,CACR,UAAY,CAAA,kBAAA,CACZ,iBAAkB,yBACpB","file":"index.js","sourcesContent":["'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","module.exports = function isArrayish(obj) {\n\tif (!obj || typeof obj === 'string') {\n\t\treturn false;\n\t}\n\n\treturn obj instanceof Array || Array.isArray(obj) ||\n\t\t(obj.length >= 0 && (obj.splice instanceof Function ||\n\t\t\t(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));\n};\n","'use strict';\n\nvar isArrayish = require('is-arrayish');\n\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\n\nvar swizzle = module.exports = function swizzle(args) {\n\tvar results = [];\n\n\tfor (var i = 0, len = args.length; i < len; i++) {\n\t\tvar arg = args[i];\n\n\t\tif (isArrayish(arg)) {\n\t\t\t// http://jsperf.com/javascript-array-concat-vs-push/98\n\t\t\tresults = concat.call(results, slice.call(arg));\n\t\t} else {\n\t\t\tresults.push(arg);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nswizzle.wrap = function (fn) {\n\treturn function () {\n\t\treturn fn(swizzle(arguments));\n\t};\n};\n","/* MIT license */\nvar colorNames = require('color-name');\nvar swizzle = require('simple-swizzle');\nvar hasOwnProperty = Object.hasOwnProperty;\n\nvar reverseNames = Object.create(null);\n\n// create a list of reverse color names\nfor (var name in colorNames) {\n\tif (hasOwnProperty.call(colorNames, name)) {\n\t\treverseNames[colorNames[name]] = name;\n\t}\n}\n\nvar cs = module.exports = {\n\tto: {},\n\tget: {}\n};\n\ncs.get = function (string) {\n\tvar prefix = string.substring(0, 3).toLowerCase();\n\tvar val;\n\tvar model;\n\tswitch (prefix) {\n\t\tcase 'hsl':\n\t\t\tval = cs.get.hsl(string);\n\t\t\tmodel = 'hsl';\n\t\t\tbreak;\n\t\tcase 'hwb':\n\t\t\tval = cs.get.hwb(string);\n\t\t\tmodel = 'hwb';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tval = cs.get.rgb(string);\n\t\t\tmodel = 'rgb';\n\t\t\tbreak;\n\t}\n\n\tif (!val) {\n\t\treturn null;\n\t}\n\n\treturn {model: model, value: val};\n};\n\ncs.get.rgb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar abbr = /^#([a-f0-9]{3,4})$/i;\n\tvar hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;\n\tvar rgba = /^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar keyword = /^(\\w+)$/;\n\n\tvar rgb = [0, 0, 0, 1];\n\tvar match;\n\tvar i;\n\tvar hexAlpha;\n\n\tif (match = string.match(hex)) {\n\t\thexAlpha = match[2];\n\t\tmatch = match[1];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\t// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19\n\t\t\tvar i2 = i * 2;\n\t\t\trgb[i] = parseInt(match.slice(i2, i2 + 2), 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(abbr)) {\n\t\tmatch = match[1];\n\t\thexAlpha = match[3];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i] + match[i], 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(rgba)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i + 1], 0);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(per)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(keyword)) {\n\t\tif (match[1] === 'transparent') {\n\t\t\treturn [0, 0, 0, 0];\n\t\t}\n\n\t\tif (!hasOwnProperty.call(colorNames, match[1])) {\n\t\t\treturn null;\n\t\t}\n\n\t\trgb = colorNames[match[1]];\n\t\trgb[3] = 1;\n\n\t\treturn rgb;\n\t} else {\n\t\treturn null;\n\t}\n\n\tfor (i = 0; i < 3; i++) {\n\t\trgb[i] = clamp(rgb[i], 0, 255);\n\t}\n\trgb[3] = clamp(rgb[3], 0, 1);\n\n\treturn rgb;\n};\n\ncs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};\n\ncs.get.hwb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hwb = /^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hwb);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar w = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar b = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\t\treturn [h, w, b, a];\n\t}\n\n\treturn null;\n};\n\ncs.to.hex = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn (\n\t\t'#' +\n\t\thexDouble(rgba[0]) +\n\t\thexDouble(rgba[1]) +\n\t\thexDouble(rgba[2]) +\n\t\t(rgba[3] < 1\n\t\t\t? (hexDouble(Math.round(rgba[3] * 255)))\n\t\t\t: '')\n\t);\n};\n\ncs.to.rgb = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'\n\t\t: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';\n};\n\ncs.to.rgb.percent = function () {\n\tvar rgba = swizzle(arguments);\n\n\tvar r = Math.round(rgba[0] / 255 * 100);\n\tvar g = Math.round(rgba[1] / 255 * 100);\n\tvar b = Math.round(rgba[2] / 255 * 100);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'\n\t\t: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';\n};\n\ncs.to.hsl = function () {\n\tvar hsla = swizzle(arguments);\n\treturn hsla.length < 4 || hsla[3] === 1\n\t\t? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'\n\t\t: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';\n};\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\ncs.to.hwb = function () {\n\tvar hwba = swizzle(arguments);\n\n\tvar a = '';\n\tif (hwba.length >= 4 && hwba[3] !== 1) {\n\t\ta = ', ' + hwba[3];\n\t}\n\n\treturn 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';\n};\n\ncs.to.keyword = function (rgb) {\n\treturn reverseNames[rgb.slice(0, 3)];\n};\n\n// helpers\nfunction clamp(num, min, max) {\n\treturn Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n\tvar str = Math.round(num).toString(16).toUpperCase();\n\treturn (str.length < 2) ? '0' + str : str;\n}\n","/**\n * @file\n *\n * All things involving low-level user JWT parsing, claims, roles.\n */\n\nimport {\n array,\n boolean,\n Describe,\n enums,\n number,\n object,\n optional,\n string,\n type,\n union,\n record,\n assign,\n} from 'superstruct';\nimport { roles, type Role } from '@knapsack/types';\n\n// Superstruct runtime validation for Role\nexport const RolesEnums = enums(roles);\nexport const RolesEnumsStruct: Describe<Role> = RolesEnums;\n\nexport const canRoleAdmin = (role: Role): boolean => role === 'ADMIN';\n\nexport const rolesThatCanManageUsers: Role[] = ['ADMIN', 'MANAGER'];\n\nexport const canRoleManageUsers = (role: Role): boolean =>\n rolesThatCanManageUsers.includes(role);\n\nexport const rolesThatCanDelete: Role[] = [\n ...rolesThatCanManageUsers,\n 'EDITOR',\n];\n\nexport const canRoleDelete = (role: Role): boolean =>\n rolesThatCanDelete.includes(role);\n\nexport const rolesThatCanEdit: Role[] = [...rolesThatCanDelete, 'CONTRIBUTOR'];\n\nexport const canRoleEdit = (role: Role): boolean =>\n rolesThatCanEdit.includes(role);\n\nexport const rolesThatCanPublish: Role[] = ['ADMIN'];\n\nexport const canRolePublish = (role: Role): boolean =>\n rolesThatCanPublish.includes(role);\n\nexport const rolesThatCanView: Role[] = [...rolesThatCanEdit, 'VIEWER'];\n\nexport const canRoleView = (role: Role): boolean =>\n rolesThatCanView.includes(role);\n\nexport const isRoleValid = (role: string): role is Role =>\n RolesEnumsStruct.is(role);\n\n/**\n * Please note that these are not the same as the \"roles\" used on a per-site\n * basis, these are roles for the entire DB.\n */\nexport enum HasuraRoles {\n // yes, `admin` exists but no reason anyone should have it, yet\n user = 'user',\n anonymous = 'anonymous',\n}\nconst HasuraRolesStruct = enums(Object.values(HasuraRoles));\n\nexport type HasuraClaims = {\n 'x-hasura-allowed-roles': HasuraRoles[];\n 'x-hasura-default-role': HasuraRoles;\n 'x-hasura-user-id'?: string;\n};\n// Superstruct runtime validation for HasuraClaims\nexport const HasuraClaimsStruct: Describe<HasuraClaims> = object({\n 'x-hasura-allowed-roles': array(HasuraRolesStruct),\n 'x-hasura-default-role': HasuraRolesStruct,\n 'x-hasura-user-id': optional(string()),\n});\n\n/**\n * The specific Knapsack claims that live at 'https://knapsack.cloud' within JWT\n */\nexport type KnapsackClaims = {\n userId: string;\n /** For email address that end in `knapsack.cloud` */\n isSuperAdmin: boolean;\n /**\n * Keys are roleId, value are array of siteId strings\n * Purposely kept small for JWT payloads. Often expanded.\n * @see {SiteRoleMap}\n * @see {expandSitesByRole}\n * @example\n * {\n * sitesByRole: {\n * EDITOR: ['ks-demo-bootstrap', 'ks-demo-tailwind'],\n * VIEWER: ['site-id-1'],\n * },\n * }\n */\n sitesByRole: {\n [roleId in Role]?: string[];\n };\n};\n// Superstruct runtime validation for KnapsackClaims\nexport const KsClaimsStruct: Describe<KnapsackClaims> = object({\n userId: string(),\n isSuperAdmin: boolean(),\n sitesByRole: record(RolesEnums, array(string())),\n});\n\n/**\n * The easier to work with & expanded version of `sitesByRole` in KsClaims,\n * which is kept as small as possible for JWT payloads.\n * @see {KnapsackClaims}\n */\nexport type SiteRoleMap = {\n [siteId: string]: Role;\n};\n\n/**\n * Base JWT\n */\nexport type JwtBase = {\n /* Token expiration time; usually 1 hour after issued at time (`iat`), in seconds (not ms) */\n exp: number;\n /* Email exists on ID token, but not AUTH token */\n email?: string;\n /* WARNING: email_verified is not guaranteed to exst on SSO tokens, and is boolean or string! */\n email_verified?: string | boolean;\n /* Issued at Time, in seconds (not ms) */\n iat: number;\n /* Issuer */\n iss: string;\n /* Subject (userId) */\n sub: string;\n /* Audience */\n aud: string | string[];\n};\n// Superstruct runtime validation for JwtBase. Use type() to ignore extra keys\nexport const JwtBaseStruct: Describe<JwtBase> = type({\n exp: number(),\n email: optional(string()),\n email_verified: optional(union([string(), boolean()])),\n iat: number(),\n iss: string(),\n sub: string(),\n aud: union([string(), array(string())]),\n});\n\n/**\n * Bring it all together to make a full JWT\n */\nexport const HASURA_CLAIMS_NAMESPACE = 'https://hasura.io/jwt/claims';\nexport const KNAPSACK_CLAIMS_NAMESPACE = 'https://knapsack.cloud';\n\n// Just custom claims\nexport type JwtCustomClaims = {\n [HASURA_CLAIMS_NAMESPACE]: HasuraClaims;\n [KNAPSACK_CLAIMS_NAMESPACE]: KnapsackClaims;\n};\n// Superstruct runtime validation for JwtCustomClaims\nexport const JwtCustomClaimsStruct: Describe<JwtCustomClaims> = object({\n [HASURA_CLAIMS_NAMESPACE]: HasuraClaimsStruct,\n [KNAPSACK_CLAIMS_NAMESPACE]: KsClaimsStruct,\n});\n\n// The entire JWT, custom claims + base root keys\nexport type JwtWithCustomClaims = JwtBase & JwtCustomClaims;\n// Superstruct runtime validation for JwtWithCustomClaims\nexport const JwtWithCustomClaimsStruct: Describe<JwtWithCustomClaims> = assign(\n JwtBaseStruct,\n JwtCustomClaimsStruct,\n);\n\n/**\n * Convert sitesByRole to be a map of siteId to roleId. This is the format we\n * actually use within the app to determine what sites a user can access.\n */\nexport function expandSitesByRole(\n sitesByRole: KnapsackClaims['sitesByRole'],\n): SiteRoleMap {\n return Object.entries(sitesByRole).reduce((cur, [roleId, siteIds]) => {\n if (!isRoleValid(roleId)) return cur;\n siteIds.forEach((siteId) => {\n cur[siteId] = roleId;\n });\n return cur;\n }, {} as SiteRoleMap);\n}\n\nexport type KsClaimsHelper = Omit<KnapsackClaims, 'sitesByRole'> & {\n siteRoleMap: SiteRoleMap;\n /** Get the User's Role for particular site */\n getSiteRole: (siteId: string) => Role;\n};\n\nexport const defaultAnonymousKsClaims: KsClaimsHelper = {\n isSuperAdmin: false,\n userId: '',\n siteRoleMap: {},\n getSiteRole: () => 'ANONYMOUS',\n};\n\n/**\n * Picks off the KsClaims from the JWT (since it has a weird to use\n * `https://knapsack.cloud` namespace) and then also converts the size-conscious\n * `sitesByRole` into the more usable format of `siteRoleMap\n */\nexport const getKsClaims = (claims: unknown): KsClaimsHelper => {\n if (!JwtWithCustomClaimsStruct.is(claims)) {\n return defaultAnonymousKsClaims;\n }\n const { sitesByRole, ...ksClaims } = claims[KNAPSACK_CLAIMS_NAMESPACE];\n const siteRoleMap = expandSitesByRole(sitesByRole);\n return {\n ...ksClaims,\n siteRoleMap,\n getSiteRole: (siteId) => {\n if (ksClaims.isSuperAdmin) return 'ADMIN';\n return siteRoleMap[siteId] || 'ANONYMOUS';\n },\n };\n};\n","// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original<T>(value: T): T | undefined\nexport function original(value: Drafted<any>): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each<T extends Objectish>(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze<T>(obj: T, deep?: boolean): T\nexport function freeze<T>(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_<T>(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_<T extends AnyMap>(target: T, parent?: ImmerState): T\n\t\tproxySet_<T extends AnySet>(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin<K extends keyof Plugins>(\n\tpluginKey: K\n): Exclude<Plugins[K], undefined> {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin<K extends keyof Plugins>(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map<any, boolean> | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted<AnyMap, MapState>\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map<any, Drafted> // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted<AnySet, SetState>\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude<ImmerState, SetState>).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted<AnyObject, ProxyObjectState>\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted<AnyArray, ProxyArrayState>\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy<T extends Objectish>(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted<T, ProxyState> {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler<object | Array<any>> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler<ProxyState> = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft<T extends Objectish>(base: T): Draft<T> {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft<D extends Draft<any>>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft<infer T> ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches<T extends Objectish>(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy<T extends Objectish>(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted<T, ImmerState> {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current<T>(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft<T>(value: T): Draft<T> {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable<T>(value: T): Immutable<T> {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n","import {\n type,\n Describe,\n literal,\n optional,\n defaulted,\n boolean,\n array,\n object,\n} from 'superstruct';\n\nimport { ExpandRecursively } from '@knapsack/utils';\n\nimport {\n ColorConfig,\n ColorConfigStruct,\n ColorStringStruct,\n} from './color-config';\n\nimport {\n FontFaceConfigStruct,\n FontFaceConfig,\n TypographyConfigStruct,\n TypographyLinkConfigStruct,\n pageElements,\n pageElementsV2,\n} from './typography-config';\n\nimport {\n customizableNavElements,\n NavCustomizationConfigStruct,\n PrimaryNavCustomizationConfigStruct,\n SecondaryNavCustomizationConfigStruct,\n} from './nav-customization-config';\n\nexport type UiConfigV1 = {\n version: 1;\n oldSillySidebarBgColor: string;\n};\n\nexport const UiConfigV1Struct: Describe<UiConfigV1> = object({\n version: literal(1),\n oldSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV2 = {\n version: 2;\n anotherSillySidebarBgColor: string;\n};\n\nexport const UiConfigV2Struct: Describe<UiConfigV2> = object({\n version: literal(2),\n anotherSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV3 = {\n version: 3;\n sidebarBgColor: string;\n};\n\nexport const UiConfigV3Struct: Describe<UiConfigV3> = object({\n version: literal(3),\n sidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV4 = {\n version: 4;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n enableSidebarIcons?: boolean;\n};\nexport const UiConfigV4Struct: Describe<UiConfigV4> = object({\n version: literal(4),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport type UiConfigV5 = {\n version: 5;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n linkColor: ColorConfig;\n enableSidebarIcons: boolean;\n};\nexport const UiConfigV5Struct: Describe<UiConfigV5> = object({\n version: literal(5),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport interface _UiConfigV6 extends Omit<UiConfigV5, 'version'> {\n version: 6;\n appearance: {\n customFonts?: FontFaceConfig[];\n pageElements: typeof pageElements;\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfigV6' is not assignable to type 'Record<string, unknown>'.\" error\nexport type UiConfigV6 = ExpandRecursively<_UiConfigV6>;\n\nexport const UiConfigV6Struct: Describe<UiConfigV6> = object({\n version: literal(6),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV7 extends Omit<UiConfigV6, 'version'> {\n version: 7;\n appearance: {\n navigation?: typeof customizableNavElements;\n customFonts?: UiConfigV6['appearance']['customFonts'];\n pageElements: UiConfigV6['appearance']['pageElements'];\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig7' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\nexport type UiConfigV7 = ExpandRecursively<_UiConfigV7>;\n\nexport const UiConfigV7Struct: Describe<UiConfigV7> = object({\n version: literal(7),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV8\n extends Omit<UiConfigV7, 'version' | 'enableSidebarIcons'> {\n version: 8;\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig8' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\n// TODO: move this to @knapsack/types\nexport type UiConfigV8 = ExpandRecursively<_UiConfigV8>;\n\nexport const UiConfigV8Struct: Describe<UiConfigV8> = object({\n version: literal(8),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV9\n extends Omit<\n UiConfigV8,\n 'version' | 'primaryColor' | 'darkColor' | 'lightColor' | 'linkColor'\n > {\n version: 9;\n}\nexport type UiConfigV9 = ExpandRecursively<_UiConfigV9>;\n\nexport const UiConfigV9Struct: Describe<UiConfigV9> = object({\n version: literal(9),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV10 extends Omit<UiConfigV9, 'version'> {\n version: 10;\n appearance: {\n navigation?: UiConfigV9['appearance']['navigation'];\n customFonts?: UiConfigV9['appearance']['customFonts'];\n pageElements: typeof pageElementsV2;\n };\n}\nexport type UiConfigV10 = ExpandRecursively<_UiConfigV10>;\n\nexport const UiConfigV10Struct: Describe<UiConfigV10> = object({\n version: literal(10),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingXLarge: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n headingXSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport type UiConfigVersions =\n | typeof UiConfigV1Struct.TYPE\n | typeof UiConfigV2Struct.TYPE\n | typeof UiConfigV3Struct.TYPE\n | typeof UiConfigV4Struct.TYPE\n | typeof UiConfigV5Struct.TYPE\n | typeof UiConfigV6Struct.TYPE\n | typeof UiConfigV7Struct.TYPE\n | typeof UiConfigV8Struct.TYPE\n | typeof UiConfigV9Struct.TYPE\n | typeof UiConfigV10Struct.TYPE;\n\n// ALIASES FOR LATEST VERSIONS\nexport type UiConfig = UiConfigV10;\nexport const UiConfigStruct: typeof UiConfigV10Struct = UiConfigV10Struct;\n\nexport type NavElementNames = keyof UiConfig['appearance']['navigation'];\n","import colorString from 'color-string';\nimport { define, Describe, literal, string, type, union } from 'superstruct'; // https://docs.superstructjs.org\n\n/** Use `import { isColor } from '@knapsack/color-utils'` if you can, need to duplicate this logic due to dep cycle */\nfunction isColor(color: unknown): color is string {\n if (typeof color !== 'string') return false;\n try {\n return !!colorString.get(color);\n } catch (e) {\n return false;\n }\n}\n\nexport type ColorTokenConfig = {\n type: 'design-token';\n /** Will be **either** `-` (old) or `.` (new) separated */\n tokenName: string;\n};\nexport type ColorConfig =\n | { type: 'value'; colorValue: string }\n | ColorTokenConfig;\n\nexport const ColorStringStruct = define<string>(\n 'ColorStringStruct',\n (value) => typeof value === 'string' && isColor(value),\n);\n\nexport const ColorConfigStruct: Describe<ColorConfig> = union([\n type({\n type: literal('value'),\n colorValue: ColorStringStruct,\n }),\n type({\n type: literal('design-token'),\n tokenName: string(),\n }),\n]);\n\n// so we can check if an object is not just a ColorConfig but specifically a token\nexport const ColorTokenConfigStruct: Describe<ColorTokenConfig> = type({\n type: literal('design-token'),\n tokenName: string(),\n});\n","import {\n Describe,\n string,\n type,\n union,\n number,\n enums,\n optional,\n literal,\n array,\n size,\n boolean,\n object,\n} from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\n\nexport const HeadingLevels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nexport type HeadingLevel = (typeof HeadingLevels)[number];\n\nexport type FontSizeConfigVal = {\n unit: 'px' | 'rem';\n value: number;\n};\n\nexport const FontSizeConfigValStruct: Describe<FontSizeConfigVal> = object({\n unit: enums(['rem', 'px']),\n value: number(),\n});\n\nexport type FontFaceWeight = number | string;\n\nexport const FontFaceWeightStruct: Describe<FontFaceWeight> = union([\n string(),\n number(),\n]);\n\nexport enum FontFaceSourceFormats {\n woff2 = 'woff2',\n woff = 'woff',\n}\n\nexport type FontFaceSource = {\n /**\n * Note: if /when we eventually add 'local' type support, format isn't used!\n */\n format: keyof typeof FontFaceSourceFormats;\n type: 'url';\n path: string;\n};\n\nexport const FontFaceFormatsEnumStruct = enums(['woff2', 'woff']);\n\nexport const FontFaceSourceStruct: Describe<FontFaceSource> = type({\n format: FontFaceFormatsEnumStruct,\n type: literal('url'),\n path: string(),\n});\n\nexport type FontFaceConfig = {\n /**\n * registered name of the custom font\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family @font-face's font-family property}\n */\n family?: string;\n\n /**\n * number between 1 and 1000.\n *\n * note: since two weights are allowed (with variable fonts), this type is an\n * optional array for easy parsing down the road.\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight @font-face's font-weight property}.\n */\n weight?: FontFaceWeight | FontFaceWeight[];\n\n /**\n * the collection of urls / paths pointing to font files\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src @font-face's src property}.\n */\n src?: FontFaceSource[];\n\n /**\n * the style of the custom font (ex. normal or italic)\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style See MDN docs on font-style}.\n */\n style?: string;\n\n // @todo: implement these later\n // display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n // variationSettings?: string;\n // unicodeRange?: string; // or ideally, URange; //\n // see https://drafts.csswg.org/css-syntax-3/#urange-syntax and\n // https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range\n};\n\nexport const FontFaceConfigStruct: Describe<FontFaceConfig> = type({\n family: optional(string()),\n weight: optional(\n union([FontFaceWeightStruct, size(array(FontFaceWeightStruct), 2)]),\n ),\n src: optional(array(FontFaceSourceStruct)),\n style: optional(string()),\n display: optional(enums(['auto', 'block', 'swap', 'fallback', 'optional'])),\n variationSettings: optional(string()),\n unicodeRange: optional(string()),\n});\n\nexport type FontSizeConfig = {\n min: FontSizeConfigVal;\n max?: FontSizeConfigVal;\n};\n\nexport enum TextTransforms {\n inherit = 'As typed',\n capitalize = 'Capitalize',\n lowercase = 'Lowercase',\n uppercase = 'Uppercase',\n}\n\nexport enum FontStretches {\n 'ultra-condensed' = 'Ultra-condensed',\n 'extra-condensed' = 'Extra-condensed',\n condensed = 'Condensed',\n 'semi-condensed' = 'Semi-condensed',\n normal = 'Normal',\n 'semi-expanded' = 'Semi-expanded',\n expanded = 'Expanded',\n 'extra-expanded' = 'Extra-expanded',\n 'ultra-expanded' = 'Ultra-expanded',\n}\n\nexport type TypographyConfig = {\n /**\n * min / max height used to future-proof way of supporting responsive typography\n */\n fontSize?: FontSizeConfig;\n\n /**\n * reminder: line-heights can also be unitless!\n */\n lineHeight?: string | number;\n fontWeight?: FontFaceWeight;\n\n /**\n * note: letter-spacing can't be unitless, unit required!\n */\n letterSpacing?: string;\n\n /**\n * if not specified, Knapsack default font, otherwise should allow for a stack of font strings + fallbacks (including the names of custom registered fonts)\n */\n fontFamily?: string;\n\n textColor?: ColorConfig;\n\n textTransform?: keyof typeof TextTransforms;\n\n fontStretch?: keyof typeof FontStretches;\n};\n\nexport interface TypographyLinkConfig {\n fontWeight?: FontFaceWeight;\n textColor?: ColorConfig;\n hoverColor?: ColorConfig;\n underline?: boolean;\n textTransform?: keyof typeof TextTransforms;\n fontStretch?: keyof typeof FontStretches;\n}\n\nexport const TypographyLinkConfigStruct: Describe<TypographyLinkConfig> = type({\n fontWeight: optional(union([string(), number()])),\n textColor: optional(ColorConfigStruct),\n hoverColor: optional(ColorConfigStruct),\n underline: optional(boolean()),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nexport const FontSizeConfigStruct: Describe<FontSizeConfig> = type({\n min: FontSizeConfigValStruct,\n max: optional(FontSizeConfigValStruct),\n});\n\nexport const TypographyConfigStruct: Describe<TypographyConfig> = type({\n fontSize: optional(FontSizeConfigStruct),\n lineHeight: optional(union([string(), number()])),\n fontWeight: optional(union([string(), number()])),\n letterSpacing: optional(string()),\n fontFamily: optional(string()),\n textColor: optional(ColorConfigStruct),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nconst pageElementConfig: TypographyConfig = {};\nconst pageLinkElementConfig: TypographyLinkConfig = {};\n\nexport const pageElements = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport const pageElementsV2 = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingXLarge: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n headingXSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport type PageElementNames = keyof typeof pageElementsV2;\nexport type PageElementConfig = (typeof pageElementsV2)[PageElementNames];\n","import { Describe, type, union, optional } from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\nimport { TypographyConfig, TypographyConfigStruct } from './typography-config';\n\nexport interface NavCustomizationConfig extends TypographyConfig {\n accentColor?: ColorConfig;\n}\n\nexport interface PrimaryNavCustomizationConfig extends NavCustomizationConfig {\n hoverColor?: ColorConfig;\n backgroundColor?: ColorConfig;\n}\n\nexport type SecondaryNavCustomizationConfig = Omit<\n PrimaryNavCustomizationConfig,\n 'hoverColor'\n>;\n\nexport const NavCustomizationConfigStruct: Describe<NavCustomizationConfig> =\n union([\n TypographyConfigStruct,\n type({\n accentColor: optional(ColorConfigStruct),\n }),\n ]);\n\n// hoverColor: optional(ColorConfigStruct),\nexport const PrimaryNavCustomizationConfigStruct: Describe<PrimaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n hoverColor: optional(ColorConfigStruct),\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nexport const SecondaryNavCustomizationConfigStruct: Describe<SecondaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nconst navCustomizationConfig: NavCustomizationConfig = {};\nconst secondaryNavCustomizationConfig: SecondaryNavCustomizationConfig = {};\nconst primaryNavCustomizationConfig: PrimaryNavCustomizationConfig = {};\n\nexport const customizableNavElements = {\n primaryNav: primaryNavCustomizationConfig,\n secondaryNav: secondaryNavCustomizationConfig,\n tabs: navCustomizationConfig,\n} as const;\n\nexport type CustomizableNavElementNames = keyof typeof customizableNavElements;\nexport type CustomizableNavElementConfig =\n (typeof customizableNavElements)[CustomizableNavElementNames];\n","import * as s from 'superstruct';\n\nexport const strokeStyleValues = [\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n 'inset',\n] as const;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionSingular}\n */\ntype TokenDefinitionSingularRaw =\n | { type: 'string'; value: string }\n | { type: 'number'; value: number }\n | { type: 'boolean'; value: boolean }\n | { type: 'color'; value: string }\n | {\n type: 'strokeStyle';\n value: (typeof strokeStyleValues)[number];\n }\n | { type: 'dimension'; value: `${number}${'px' | 'rem' | 'em' | '%'}` }\n | { type: 'duration'; value: `${number}ms` }\n // | { type: 'fontFamily'; value: string | string[] }\n | {\n type: 'fontWeight';\n // @TODO: Include union of possible strings https://tr.designtokens.org/format/#font-weight\n value: string | number;\n }\n | { type: 'cubicBezier'; value: [number, number, number, number] };\n\n/**\n * Definitions for both singular (non-composite) tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinitionSingular<'dimension'>\n * ```\n */\nexport type TokenDefinitionSingular<\n TheTokenType extends TokenDefinitionSingularRaw['type'] = TokenDefinitionSingularRaw['type'],\n> = Extract<TokenDefinitionSingularRaw, { type: TheTokenType }>;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionComposite}\n */\ntype TokenDefinitionCompositeRaw =\n | {\n type: 'border';\n value: {\n color: { type: 'color' };\n style: { type: 'strokeStyle' };\n width: { type: 'dimension' };\n };\n }\n | {\n type: 'shadow';\n value: {\n color: { type: 'color' };\n offsetX: { type: 'dimension' };\n offsetY: { type: 'dimension' };\n spread: { type: 'dimension' };\n blur: { type: 'dimension' };\n inset: { type: 'boolean' };\n };\n }\n | {\n type: 'transition';\n value: {\n duration: { type: 'duration' };\n delay: { type: 'duration' };\n timingFunction: { type: 'cubicBezier' };\n };\n };\n// | {\n// type: 'gradient';\n// value: {\n// color: { type: 'color' };\n// position: { type: 'dimension' };\n// }[];\n// };\n\n/**\n * Definitions for composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionShadow = TokenDefinitionComposite<'shadow'>\n * ```\n */\nexport type TokenDefinitionComposite<\n TheTokenType extends TokenDefinitionCompositeRaw['type'] = TokenDefinitionCompositeRaw['type'],\n> = Extract<TokenDefinitionCompositeRaw, { type: TheTokenType }>;\n\n/**\n * Definitions for both singular and composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinition<'dimension'>\n * ```\n */\nexport type TokenDefinition<\n TheTokenType extends\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'] =\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'],\n> = Extract<\n TokenDefinitionComposite | TokenDefinitionSingular,\n { type: TheTokenType }\n>;\n\nexport type TokenReference = `{${string}}`;\n/** ensures there is no `{}` */\nexport type NotTokenReference<T> = T extends TokenReference ? never : T;\n\nexport function isTokenReference(val: unknown): val is TokenReference {\n if (typeof val !== 'string') return false;\n // total times `{` appears in `val`\n // Handle situation `{a.b} {c.d}`. Ensure count of `{` and `}` === 1. This\n // guarantees we ONLY support a single reference, ie `{a.b}`\n const totalOpenBrackets = val.split('{').length - 1;\n return totalOpenBrackets === 1 && val.startsWith('{') && val.endsWith('}');\n}\n\nexport function hasTokenReferences(val: unknown): boolean {\n return typeof val === 'string' && val.includes('{');\n}\n\nexport function isNotTokenReference<T>(\n value: T,\n): value is NotTokenReference<T> {\n return !isTokenReference(value);\n}\n\nexport const TokenReferenceStruct = s.define<TokenReference>(\n 'Token Reference',\n (value) => {\n if (typeof value !== 'string') return false;\n if (isNotTokenReference(value)) {\n return 'Must start and end with curly braces';\n }\n return true;\n },\n);\n\nexport type TokenType = TokenDefinition['type'];\nexport type TokenTypeComposite = TokenDefinitionComposite['type'];\nexport type TokenTypeSingular = TokenDefinitionSingular['type'];\nexport type TokenValueSingular = TokenDefinitionSingular['value'];\n\n// We make a Record to ensure we have *every* possible value\n// b/c TS will yell at us if a new one is added but isn't included here\n// then we make an array out of them, so we can be sure we have *every* possible value\nconst compositeTypesRecord: Record<TokenTypeComposite, TokenTypeComposite> = {\n border: 'border',\n shadow: 'shadow',\n transition: 'transition',\n};\nexport const tokenTypeComposites = Object.values(compositeTypesRecord);\nconst singularTypesRecord: Record<TokenTypeSingular, TokenTypeSingular> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n color: 'color',\n dimension: 'dimension',\n duration: 'duration',\n // fontFamily: 'fontFamily',\n fontWeight: 'fontWeight',\n strokeStyle: 'strokeStyle',\n cubicBezier: 'cubicBezier',\n};\nexport const tokenTypeSingulars = Object.values(singularTypesRecord);\n/**\n * @deprecated You probably want `isTokenDataComposite`\n * @see {isTokenDataComposite}\n */\nexport function isTokenTypeComposite(\n type: TokenType,\n): type is TokenTypeComposite {\n return tokenTypeComposites.includes(type as TokenTypeComposite);\n}\n\nexport function isTokenTypeSingular(\n type: TokenType,\n): type is TokenTypeSingular {\n return tokenTypeSingulars.includes(type as TokenTypeSingular);\n}\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport * as s from 'superstruct';\nimport {\n NotTokenReference,\n TokenDefinition,\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenReferenceStruct,\n TokenType,\n hasTokenReferences,\n isTokenTypeComposite,\n} from './token-definitions';\nimport { TokenKsExtensions, TokenOrder } from './token-misc';\nimport { TokenSrcValue } from './token-src';\n\n/** Used for tokens AND groups */\ntype TokenDataBothCommon = {\n id: string;\n description?: string;\n};\n\n// Shows what a fully de-referenced `value` of a composite token would be\ntype CreateDataValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: TokenDefinitionSingular<\n ValueObj[Key]['type']\n >['value'];\n};\n\nexpectType<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>[]\n>([\n {\n inset: false,\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n },\n {\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n inset: true,\n },\n]);\n\ntype TokenDataCommon<\n Info extends {\n /** Basically the ID */\n type: TokenDefinition['type'];\n value: unknown;\n },\n> = TokenDataBothCommon & {\n type: Info['type'];\n value: Info['value'];\n /**\n * Extracted from `$extensions['cloud.knapsack'].token`\n */\n tokenConfig?: TokenKsExtensions['token'];\n /**\n * Tokens that are references by this token\n * @todo will need to change for shadow\n * @example\n * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n references?: Array<string[]>;\n /**\n * Tokens that use this as a reference token\n * @see {CreateTokenData.references}\n * @example\n * * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n // referencedBy?: Array<string[]>;\n};\n\ntype CreateTokenData<\n Info extends {\n type: TokenDefinition['type'];\n value: unknown;\n },\n> =\n | ({\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n originalValue: TokenReference;\n } & TokenDataCommon<Info>)\n | ({\n kind: 'static';\n originalValue: NotTokenReference<TokenSrcValue<Info['type']>>;\n } & TokenDataCommon<Info>);\n\nconst TokenDataBaseStruct: s.Describe<\n TokenDataBothCommon & {\n references?: Array<string[]>;\n tokenConfig?: TokenKsExtensions['token'];\n }\n> = s.type({\n id: s.string(),\n description: s.optional(s.string()),\n references: s.optional(s.array(s.array(s.string()))),\n tokenConfig: s.optional(\n s.type({\n purpose: s.optional(s.string()),\n }),\n ),\n});\n\ntype TokenDataSingularRaw = {\n // ignore the key, this makes a discriminated union out of the values\n [TokenDef in TokenDefinitionSingular as TokenDef['type']]: Simplify<\n CreateTokenData<TokenDef>\n >;\n}[TokenDefinitionSingular['type']];\n\nexport type TokenDataSingular<\n TT extends TokenDataSingularRaw['type'] = TokenDataSingularRaw['type'],\n> = Extract<TokenDataSingularRaw, { type: TT }>;\n\nexpectType<TokenDataSingular[]>([\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'static',\n },\n {\n type: 'duration',\n value: '1ms',\n kind: 'ref',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'ref',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n kind: 'static',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'static',\n id: '1',\n originalValue: '#000',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'ref',\n id: '1',\n originalValue: '{c.b}',\n referencedTokenId: 'c.b',\n },\n {\n type: 'cubicBezier',\n kind: 'static',\n value: [0, 0, 0, 1],\n originalValue: [0, 0, 0, 1],\n id: '1',\n },\n]);\n\ntype TokenDataCompositeRaw = {\n [TokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenData<{\n type: TokenType;\n value: Simplify<\n CreateDataValueForComposite<\n TokenDefinitionComposite<TokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\nexport type TokenDataComposite<\n TheTokenType extends TokenDataCompositeRaw['type'] = TokenDataCompositeRaw['type'],\n> = Extract<TokenDataCompositeRaw, { type: TheTokenType }>;\n\nexport function isTokenDataComposite(\n tokenData: TokenData,\n): tokenData is TokenDataComposite {\n return isTokenTypeComposite(tokenData.type);\n}\n\nexpectType<TokenDataComposite[]>([\n {\n type: 'border',\n kind: 'static',\n id: '1',\n value: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n originalValue: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n },\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n value: {\n color: 'red',\n style: 'dashed',\n width: '2px',\n },\n originalValue: '{a.b}',\n },\n {\n type: 'shadow',\n value: {\n color: '#000',\n offsetX: '1px',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n originalValue: {\n color: '#000',\n offsetX: '{a.a}',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n id: '1',\n kind: 'static',\n },\n {\n type: 'shadow',\n kind: 'ref',\n referencedTokenId: 'a.b',\n value: {\n inset: true,\n color: 'red',\n offsetX: '1px',\n blur: '2px',\n offsetY: '3px',\n spread: '4px',\n },\n originalValue: '{a.b}',\n id: '1',\n },\n {\n type: 'transition',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: '{a.b}',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '{a.c}',\n timingFunction: '{a.c}',\n },\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n id: '1',\n },\n]);\n\nexport type TokenData<\n TheTokenType extends TokenDataSingular['type'] | TokenDataComposite['type'] =\n | TokenDataSingular['type']\n | TokenDataComposite['type'],\n> = Extract<TokenDataSingular | TokenDataComposite, { type: TheTokenType }>;\n\nexport type TokenGroupData = Simplify<\n {\n type?: TokenType;\n /**\n * Extracted from `$extensions['cloud.knapsack'].group`\n */\n groupConfig?: TokenKsExtensions['group'];\n children: TokenOrder;\n } & TokenDataBothCommon\n>;\n\n/**\n * @deprecated Use `TokenValueColorStruct` instead\n */\nexport function isTokenValueColor(\n value: unknown,\n): value is TokenDefinitionSingular<'color'>['value'] {\n return typeof value === 'string' && !hasTokenReferences(value);\n}\n\nexport const TokenValueColorStruct = s.define<TokenData<'color'>['value']>(\n 'Color Value',\n (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (value === '') {\n return 'Value must not be empty';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n },\n);\n\nconst TokenDataColorNonRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('static'),\n originalValue: TokenValueColorStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataColorRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDimensionStruct` instead\n */\nexport function isTokenValueDimension(\n value: unknown,\n): value is TokenDefinitionSingular<'dimension'>['value'] {\n return (\n typeof value === 'string' &&\n (value.endsWith('px') || value.endsWith('rem')) &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDimensionStruct = s.define<\n TokenData<'dimension'>['value']\n>('Dimension Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n if (\n !value.endsWith('px') &&\n !value.endsWith('rem') &&\n !value.endsWith('em') &&\n !value.endsWith('%')\n ) {\n return 'Value must end with px, rem, em or %';\n }\n return true;\n});\n\nconst TokenDataDimensionNonRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDimensionStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDimensionRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDurationStruct` instead\n */\nexport function isTokenValueDuration(\n value: unknown,\n): value is TokenDefinitionSingular<'duration'>['value'] {\n return (\n typeof value === 'string' &&\n value.endsWith('ms') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDurationStruct = s.define<\n TokenData<'duration'>['value']\n>('Duration Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n\n const durationRegex = /^\\d+ms$/;\n if (!durationRegex.test(value)) {\n return 'Value must be a number followed by \"ms\" (e.g., \"100ms\")';\n }\n\n return true;\n});\n\nconst TokenDataDurationNonRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDurationStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDurationRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueFontWeightStruct` instead\n */\nexport function isTokenValueFontWeight(\n value: unknown,\n): value is TokenDefinitionSingular<'fontWeight'>['value'] {\n return (\n (typeof value === 'string' || typeof value === 'number') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueFontWeightStruct = s.define<\n TokenData<'fontWeight'>['value']\n>('Font Weight Value', (value) => {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return 'Value must be a string or number';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n});\n\nconst TokenDataFontWeightNonRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('static'),\n originalValue: TokenValueFontWeightStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataFontWeightRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueCubicBezierStruct = s.define<\n TokenData<'cubicBezier'>['value']\n>('Cubic Bezier Value', (value) => {\n if (!Array.isArray(value)) {\n return 'Value must be an array';\n }\n if (value.length !== 4) {\n return 'Value must be an array of 4 numbers';\n }\n if (!value.every((v) => typeof v === 'number')) {\n return 'Value must be an array of 4 numbers';\n }\n // check if the first and third values are between 0 and 1\n // cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )\n if (value[0] < 0 || value[0] > 1 || value[2] < 0 || value[2] > 1) {\n return 'The first and third cubicBezier values must be between 0 and 1';\n }\n return true;\n});\n\nconst TokenDataCubicBezierNonRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('static'),\n originalValue: TokenValueCubicBezierStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataCubicBezierRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"shadow\" token value AND totally de-referenced\n */\nexport function isTokenValueShadow(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>\n> {\n return (\n isObject(value) &&\n isTokenValueColor(value.color) &&\n isTokenValueDimension(value.offsetX) &&\n isTokenValueDimension(value.offsetY) &&\n isTokenValueDimension(value.blur) &&\n isTokenValueDimension(value.spread)\n );\n}\n\nconst TokenValueShadowStruct = s.define<TokenData<'shadow'>['value']>(\n 'Shadow Value',\n (value) => {\n if (isTokenValueShadow(value)) return true;\n return `Expected a shadow value, got ${JSON.stringify(value)}`;\n },\n);\n\nconst TokenDataShadowNonRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n offsetX: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n offsetY: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n blur: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n spread: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n inset: s.union([\n // marking this as optional b/c it could be `undefined` instead of `false`\n s.optional(s.boolean()),\n TokenReferenceStruct,\n ]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataShadowRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueStrokeStyleStruct = s.union([\n s.literal('solid'),\n s.literal('dashed'),\n s.literal('dotted'),\n s.literal('double'),\n s.literal('groove'),\n s.literal('ridge'),\n s.literal('outset'),\n s.literal('inset'),\n]);\n\n/**\n * Determines if it's a \"border\" token value AND totally de-referenced\n */\nexport function isTokenValueBorder(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'border'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueColorStruct.is(value.color) &&\n TokenValueStrokeStyleStruct.is(value.style) &&\n TokenValueDimensionStruct.is(value.width)\n );\n}\n\nconst TokenValueBorderStruct = s.define<TokenData<'border'>['value']>(\n 'Border Value',\n isTokenValueBorder,\n);\n\nconst TokenDataBorderNonRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n style: s.union([TokenValueStrokeStyleStruct, TokenReferenceStruct]),\n width: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBorderRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"transition\" token value AND totally de-referenced\n */\nexport function isTokenValueTransition(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'transition'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueCubicBezierStruct.is(value.timingFunction) &&\n TokenValueDurationStruct.is(value.duration) &&\n TokenValueDurationStruct.is(value.delay)\n );\n}\nconst TokenValueTransitionStruct = s.define<TokenData<'transition'>['value']>(\n 'Transition Value',\n isTokenValueTransition,\n);\n\nconst TokenDataTransitionNonRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n timingFunction: s.union([\n TokenValueCubicBezierStruct,\n TokenReferenceStruct,\n ]),\n duration: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n delay: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataTransitionRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringNonRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('static'),\n originalValue: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleNonRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('static'),\n originalValue: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n// const TokenDataFontFamilyNonRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'static' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('static'),\n// originalValue: s.union([s.string(), s.array(s.string())]),\n// }),\n// TokenDataBaseStruct,\n// );\n\n// const TokenDataFontFamilyRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'ref' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('ref'),\n// originalValue: TokenReferenceStruct,\n// referencedTokenId: s.string(),\n// }),\n// TokenDataBaseStruct,\n// );\n\nconst TokenDataNumberNonRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('static'),\n originalValue: s.number(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataNumberRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanNonRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('static'),\n originalValue: s.boolean(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n// Instead of using `s.union` to combine all the token data structs,\n// we first find out what \"type\" the token is\n// then we find out `kind` - which is our 2nd layer of discriminated union\n// and then use the specific struct\n// that way the errors are more specific to the actual declared token \"type\"\n// In a nutshell, `s.union` is not very good at discriminated unions errors\nexport const assertTokenData = (data: unknown): asserts data is TokenData => {\n if (!isObject(data)) {\n throw new Error(\n `Expected token data to be an object, got ${JSON.stringify(data)}`,\n );\n }\n if (!isObjKey('type', data)) {\n throw new Error(\n `Expected token data to have a \"type\" property, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n if (typeof data.type !== 'string') {\n throw new Error(\n `Expected token data \"type\" property to be a string, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n const type = data.type as TokenData['type'];\n const kind = data.kind as TokenData['kind'];\n try {\n switch (type) {\n case 'boolean':\n if (kind === 'ref') {\n TokenDataBooleanRefStruct.assert(data);\n } else {\n TokenDataBooleanNonRefStruct.assert(data);\n }\n return;\n case 'border':\n if (kind === 'ref') {\n TokenDataBorderRefStruct.assert(data);\n } else {\n TokenDataBorderNonRefStruct.assert(data);\n }\n return;\n case 'color':\n if (kind === 'ref') {\n TokenDataColorRefStruct.assert(data);\n } else {\n TokenDataColorNonRefStruct.assert(data);\n }\n return;\n case 'cubicBezier':\n if (kind === 'ref') {\n TokenDataCubicBezierRefStruct.assert(data);\n } else {\n TokenDataCubicBezierNonRefStruct.assert(data);\n }\n return;\n case 'dimension':\n if (kind === 'ref') {\n TokenDataDimensionRefStruct.assert(data);\n } else {\n TokenDataDimensionNonRefStruct.assert(data);\n }\n return;\n case 'duration':\n if (kind === 'ref') {\n TokenDataDurationRefStruct.assert(data);\n } else {\n TokenDataDurationNonRefStruct.assert(data);\n }\n return;\n case 'fontWeight':\n if (kind === 'ref') {\n TokenDataFontWeightRefStruct.assert(data);\n } else {\n TokenDataFontWeightNonRefStruct.assert(data);\n }\n return;\n case 'number':\n if (kind === 'ref') {\n TokenDataNumberRefStruct.assert(data);\n } else {\n TokenDataNumberNonRefStruct.assert(data);\n }\n return;\n case 'shadow':\n if (kind === 'ref') {\n TokenDataShadowRefStruct.assert(data);\n } else {\n TokenDataShadowNonRefStruct.assert(data);\n }\n return;\n case 'string':\n if (kind === 'ref') {\n TokenDataStringRefStruct.assert(data);\n } else {\n TokenDataStringNonRefStruct.assert(data);\n }\n return;\n case 'strokeStyle': // temp implementation\n if (kind === 'ref') {\n TokenDataStrokeStyleRefStruct.assert(data);\n } else {\n TokenDataStrokeStyleNonRefStruct.assert(data);\n }\n return;\n // case 'fontFamily':\n // if (kind === 'ref') {\n // TokenDataFontFamilyRefStruct.assert(data);\n // } else {\n // TokenDataFontFamilyNonRefStruct.assert(data);\n // }\n // return;\n case 'transition':\n if (kind === 'ref') {\n TokenDataTransitionRefStruct.assert(data);\n } else {\n TokenDataTransitionNonRefStruct.assert(data);\n }\n return;\n default: {\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown token data type: ${type}`);\n }\n }\n } catch (error) {\n if (!(error instanceof s.StructError)) throw error;\n throw new Error(\n `Invalid token data for type \"${type}\": ${\n error.message\n }. Received this data: \"${JSON.stringify(data)}\"`,\n );\n }\n};\n","import { Simplify, expectType } from '@knapsack/utils';\nimport {\n TokenType,\n TokenDefinitionSingular,\n TokenDefinitionComposite,\n isTokenTypeComposite,\n isTokenTypeSingular,\n} from './token-definitions';\n\ntype CreateTokenSrcValueInfo<\n T extends {\n type: TokenType;\n value: unknown;\n },\n> =\n | {\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n isVarRef?: boolean;\n type: T['type'];\n }\n | {\n kind: 'static';\n type: T['type'];\n value: T['value'];\n };\n\ntype TokenSrcValueInfoSingularRaw = {\n // Ignore the key, pay attention to the value\n // The values become the items in the discriminated union\n [TheTokenType in TokenDefinitionSingular as TheTokenType['type']]: Simplify<\n CreateTokenSrcValueInfo<TheTokenType>\n >;\n}[TokenDefinitionSingular['type']];\n\n// This helper allows us to just pass the type string in to get that\n// item out of the discriminated union: `TokenSrcValueInfoSingular<'color'>`\ntype TokenSrcValueInfoSingular<\n TT extends TokenSrcValueInfoSingularRaw['type'] = TokenSrcValueInfoSingularRaw['type'],\n> = Extract<TokenSrcValueInfoSingularRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoSingular<'dimension'>[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'dimension',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n]);\n\ntype CreateSrcValueInfoForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: Simplify<\n CreateTokenSrcValueInfo<{\n type: ValueObj[Key]['type'];\n value: TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n }>\n >;\n};\n\ntype TokenSrcValueInfoCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenSrcValueInfo<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueInfoForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueInfoComposite<\n TT extends TokenSrcValueInfoCompositeRaw['type'] = TokenSrcValueInfoCompositeRaw['type'],\n> = Extract<TokenSrcValueInfoCompositeRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoComposite<'border'>[]>([\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'border',\n kind: 'static',\n value: {\n color: {\n kind: 'static',\n type: 'color',\n value: 'red',\n },\n style: {\n kind: 'ref',\n type: 'strokeStyle',\n referencedTokenId: '', // FIX\n },\n width: {\n kind: 'static',\n type: 'dimension',\n value: '2px',\n },\n },\n },\n]);\n\nexpectType<TokenSrcValueInfoComposite<'transition'>[]>([\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\nexport type TokenSrcValueInfo<\n TT extends\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'] =\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'],\n TheKind extends\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'] =\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'],\n> = Extract<\n TokenSrcValueInfoComposite | TokenSrcValueInfoSingular,\n { type: TT; kind: TheKind }\n>;\n\nexport function isTokenSrcValueInfoSingular(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoSingular {\n return isTokenTypeSingular(tokenSrcValueInfo?.type);\n}\nexport function isTokenSrcValueInfoComposite(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoComposite {\n return isTokenTypeComposite(tokenSrcValueInfo?.type);\n}\n\nexpectType<TokenSrcValueInfo[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'ref',\n // @ts-expect-error - with `kind: 'ref'`, `value` is not allowed\n value: '1px',\n },\n {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\n/**\n * A common object that is used to represent a token in the app.\n * Used in functions for editing communication between UI forms, Xstate,\n * and `@knapsack/design-tokens-utils`.\n */\nexport type TokenInfo<\n TheTokenType extends TokenSrcValueInfo['type'] = TokenSrcValueInfo['type'],\n> = {\n tokenSrcValueInfo: TokenSrcValueInfo<TheTokenType>;\n tokenId: string;\n description?: string;\n};\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport {\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenType,\n TokenDefinition,\n} from './token-definitions';\nimport { TokenKsExtensions } from './token-misc';\n\nexport type TokenSrcCommon<TheType extends TokenType = TokenType> = {\n $type?: TokenDefinition<TheType>['type'];\n $description?: string;\n $extensions?: {\n 'cloud.knapsack'?: TokenKsExtensions;\n };\n};\n\nexport function isTokenSrcExtensions(\n extensionsObj: unknown,\n): extensionsObj is TokenSrcCommon['$extensions'] {\n return isObject(extensionsObj) && isObjKey('cloud.knapsack', extensionsObj);\n}\n\ntype CreateSrcValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]:\n | TokenReference\n | TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n};\n\ntype TokenSrcValueCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueComposite<\n TT extends TokenSrcValueCompositeRaw['type'] = TokenSrcValueCompositeRaw['type'],\n> = Extract<TokenSrcValueCompositeRaw, { type: TT }>;\n\ntype TokenSrcValueRaw = TokenDefinitionSingular | TokenSrcValueComposite;\n\nexport type TokenSrcValue<\n Type extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Extract<TokenSrcValueRaw, { type: Type }>['value'] | TokenReference;\n\nexpectType<TokenSrcValue[]>([\n '#ddd',\n true,\n [83, 1, 1, 1],\n {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n {\n inset: true,\n color: '#000',\n offsetX: '0px',\n offsetY: '{spacing.medium}',\n spread: '0px',\n blur: '0px',\n },\n {\n timingFunction: '{timing.ease}',\n duration: '{timing.duration.medium}',\n delay: '7ms',\n color: '#000',\n },\n]);\n\nexport type TokenSrc<\n TheType extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Simplify<\n {\n $value: TokenSrcValue<TheType>;\n } & TokenSrcCommon<TheType>\n>;\n\nexport function isTokenSrc(tokenObject: unknown): tokenObject is TokenSrc {\n if (isObject(tokenObject) && isObjKey('$value', tokenObject)) return true;\n return false;\n}\n\nexport type TokenSrcGroup = TokenSrcCommon & {\n [key: string]:\n | TokenSrcGroup\n | TokenSrc\n | TokenSrcCommon\n | TokenSrcCommon['$extensions'];\n};\n\nexport function isTokenGroup(\n tokenObject: unknown,\n): tokenObject is TokenSrcGroup {\n // @todo improve\n return (\n isObject(tokenObject) &&\n !isTokenSrcExtensions(tokenObject) &&\n !isObjKey('$value', tokenObject) &&\n // ensuring we are not in `$extensions` object\n !isObjKey('cloud.knapsack', tokenObject)\n );\n}\n\n// Token VAR references look like TokenSrcGroup\nexport function isTokenTypeVarRef(tokenObject: unknown) {\n // It's at least a TokenSrcGroup\n if (isTokenGroup(tokenObject)) {\n // The specific key within collectionInfo with the var reference\n const varRefCollectionInfo =\n tokenObject.$extensions['cloud.knapsack'].group.collectionInfo;\n if (\n isObjKey('type', varRefCollectionInfo) &&\n isObjKey('referenceId', varRefCollectionInfo)\n ) {\n return true;\n }\n }\n\n return false;\n}\n","import { parseNumberWithUnit } from '@knapsack/utils';\n\nexport function getPrimitiveValue(\n tokenValue: unknown,\n): 'string' | 'number' | 'boolean' {\n const type = typeof tokenValue;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return type;\n }\n throw new Error(\n `Invalid token value type: ${JSON.stringify(\n type,\n )}. Token value is: ${JSON.stringify(tokenValue)}`,\n );\n}\n\nexport type TokenDimensionUnit = 'px' | 'rem' | 'em' | '%';\n\n/**\n * Dimension strings require ending in 'px' or 'rem'\n * @see `libs/types/src/app-client-data/design-tokens-types/token-definitions.ts`\n */\nexport const isDimensionString = (\n value: string,\n): value is `${number}${'px' | 'rem' | 'em' | '%'}` =>\n value.includes('px') ||\n value.includes('rem') ||\n value.includes('em') ||\n value.includes('%');\n\n/**\n * Pass in values like `'12px'` to get detailed info\n * @throws if value is not a number or does not end in supported unit\n */\nexport function parseTokenDimensionValue(valueToParse: string | number): {\n value: number;\n unit?: TokenDimensionUnit;\n} {\n const { value, unit } = parseNumberWithUnit(valueToParse);\n if (!unit) {\n return { value };\n }\n if (unit !== 'px' && unit !== 'rem' && unit !== 'em' && unit !== '%') {\n throw new Error(`Invalid unit \"${unit}\" for value: ${value}`);\n }\n\n return { value, unit };\n}\n","import type { CSSProperties } from 'react';\nimport type { JsonSchemaObject } from '../json-schema';\nimport { RendererId } from '../renderers';\nimport { isObject } from '../type-utils';\nimport type { BlockConfig } from './blocks';\nimport type { Page, PageTab } from './page';\nimport { TokenSrcValueInfo } from './design-tokens-types/token-src-value-info';\n\nexport interface KsStatus {\n id: string;\n title: string;\n color?: string;\n}\n\nexport interface KsStatusSet {\n id: string;\n title: string;\n statuses: KsStatus[];\n}\n\n/**\n * Used by template renderers in addition to `path`\n * Twig: `@components/button.twig`\n * Web Components: `my-button` => `<my-button>`\n * React: a named export of the file if not `default`\n * @todo Replace this with `rendererOptions`\n */\ntype TemplateAlias = string;\n\nexport type SlottedTemplateDemo = {\n type: 'template-demo';\n /** @deprecated */\n patternId: string;\n /** @deprecated */\n templateId: string;\n /**\n * The demo referenced by `demoId` is inlined here before sending to server to\n * render, but is never stored in the json data. If this is present, it is\n * used instead of the demo referenced by `demoId`. This is done to ensure\n * server has all the latest data for a template demo by ensuring it includes\n * it's slotted children's data.\n * @see {inlineDemoData}\n */\n demo?: DataDemo;\n demoId: DemoBase['id'];\n};\n\n/**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {KsSlotInfo['isTemplateReference']}\n */\nexport type SlottedTemplateReference = {\n type: 'template-reference';\n patternId: string;\n templateId: string;\n};\n\nexport type SlottedText = {\n type: 'text';\n text: string;\n};\n\nexport type SlottedData =\n | SlottedText\n | SlottedTemplateDemo\n | SlottedTemplateReference;\n\n/** @deprecated - just check `type` */\nexport const isSlottedText = (\n slottedData: unknown,\n): slottedData is SlottedText =>\n isObject(slottedData) && slottedData.type === 'text';\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateDemo(\n slottedData: unknown,\n): slottedData is SlottedTemplateDemo {\n return isObject(slottedData) && slottedData.type === 'template-demo';\n}\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateReference(\n slottedData: unknown,\n): slottedData is SlottedTemplateReference {\n return isObject(slottedData) && slottedData.type === 'template-reference';\n}\n\n/**\n * Collection ID: Mode ID\n */\nexport type ThemeDefinition = {\n [collectionId: string]: string;\n};\n\nexport type SlotOptions = {\n /**\n * @default 'div'\n */\n wrappingElementName?: string;\n cssClasses?: string[];\n align?: {\n value:\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'left'\n | 'center'\n | 'right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n };\n layout?: {\n value: 'horizontal' | 'vertical' | 'wrap';\n };\n gap?: {\n value: TokenSrcValueInfo<'dimension'>;\n };\n paddingHorizontal?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n paddingVertical?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n /**\n * Collection ID: Mode ID\n */\n theme?: ThemeDefinition;\n};\n\n/**\n * These are created from {SlotOptions}\n * Only available in App Client for rendering - this is NOT saved in App Client Data\n */\nexport type SlotOptionsComputed = {\n styles: CSSProperties;\n cssClasses: string[];\n /**\n * @default 'div'\n */\n wrappingElementName: string;\n /**\n * can't be `style` or `class` or `className`\n */\n attributes: {\n [attributeName: string]: string;\n };\n};\n\nexport type KnapsackTemplateData = {\n /**\n * @todo Ideal would be `{ [key: string]: string | boolean | number }`\n */\n props: {\n [prop: string]: any;\n };\n slots?: {\n [slotName: string]: Array<SlottedData>;\n };\n /**\n * Settings from users are stored here and saved in App Client Data\n * This is used to dynamically create `slotsOptionsComputed`\n */\n slotsOptions?: {\n [slotName: string]: SlotOptions;\n };\n /**\n * Use `slotsOptions` to set & save styles on slotted children\n * Never set nor stored in App Client Data that gets saved\n * This is only inlined in the demo data for rendering so the App Client can\n * apply the styles to the slotted children\n * @see {inlineDemoData}\n */\n slotsOptionsComputed?: {\n [slotName: string]: SlotOptionsComputed;\n };\n};\n\ntype DemoType = 'data' | 'template';\n\ntype DemoBase = {\n id: string;\n title: string;\n description?: string;\n /**\n * Would override what was on the template\n */\n assetSetId?: string;\n width?: number;\n height?: number;\n type: DemoType;\n /** Collection ID: Mode ID */\n theme?: ThemeDefinition;\n};\n\n/**\n * Shows usage\n */\nexport type DataDemo = DemoBase & {\n type: 'data';\n patternId: string;\n templateId: string;\n data: KnapsackTemplateData;\n};\n\n/**\n * Shows source code\n */\nexport type TemplateDemo = DemoBase & {\n type: 'template';\n templateInfo: {\n alias?: TemplateAlias;\n path?: string;\n };\n};\n\nexport type Demo = TemplateDemo | DataDemo;\n\nexport type RenderDataDemo = Demo & {\n inlineStyles?: string;\n bodyAttributes?: Record<string, string>;\n};\n\n/** @deprecated */\nexport enum StageLayouts {\n portrait = 'portrait',\n landscape = 'landscape',\n}\n\nexport function isDataDemo(demo: TemplateDemo | DataDemo): demo is DataDemo {\n return demo?.type === 'data';\n}\n\nexport function isTemplateDemo(demo: Demo): demo is TemplateDemo {\n return demo?.type === 'template';\n}\n\nexport type KsSlotInfo = {\n title: string;\n description?: string;\n disallowText?: boolean;\n isRequired?: boolean;\n allowOnlyOne?: boolean;\n /**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {SlottedTemplateReference}\n */\n isTemplateReference?: boolean;\n allowedPatternIds?: string[];\n};\n\n/**\n * Supersedes `schema`\n */\nexport type KsTemplateSpec = {\n /**\n * Attempt to create the props & slots spec by reading the source file.\n * Prevents ability to use spec editor.\n *\n * If `true`, then uses the template `alias` & `path` to find the file.\n *\n * If a string, then that file path is used in place of the source file.\n *\n * Scenario: the `path` is used to point to a compiled file w types stripped\n * and this is used to point to either the source file w types or the compiled\n * `.d.ts` file. Currently only React is supported. The file extension\n * determines if TypeScript (ts/tsx) or PropTypes (js/jsx) is used for\n * inference.\n */\n isInferred?: boolean | string;\n /**\n * JSON Schema defining the serializable data passed in\n * The classic, formerly `schema`\n */\n props?: JsonSchemaObject;\n /**\n * Child component slots\n */\n slots?: {\n [name: string]: KsSlotInfo;\n };\n /**\n * @todo evaluate & refine\n */\n // cssProps?: {\n // [name: string]: {\n // title: string;\n // description: string;\n // };\n // };\n hidePropsTable?: boolean;\n hideSlotsTable?: boolean;\n /**\n * Extra Docs are each shown in their own table.\n * Useful for non-traditional spec docs that are more template language specific.\n * Examples: events, methods, etc\n */\n extraDocs?: {\n id: string;\n title: string;\n description?: string;\n tableRows?: {\n [columnTitle: string]: string;\n }[];\n }[];\n};\n\nexport interface KnapsackPatternTemplate {\n id: string;\n title?: string;\n /**\n * Relative file path to the template from the config file it is declared in\n */\n path: string;\n\n alias?: TemplateAlias;\n /**\n * Which template language? i.e. `twig`, `react` Replaces\n * KnapsackTemplateRenderer.test which ran a test on the file path (similar to\n * how WebPack loader `test` works)\n */\n templateLanguageId: RendererId;\n assetSetIds?: string[];\n spec?: KsTemplateSpec;\n /** Array of demo IDs, actual demo data is stored in `db.demos.demosById` */\n demoIds: Demo['id'][];\n /** Array of block IDs, actual block content is stored in db.blocks.blocksById */\n blockIds: BlockConfig['id'][];\n}\n\nexport type KnapsackPattern = Page & {\n $schema?: string;\n statuses?: {\n [statusSetId: string]: string;\n };\n templates?: KnapsackPatternTemplate[];\n subPages?: {\n id: string;\n title: string;\n blockIds: BlockConfig['id'][];\n }[];\n designSrcComponentsById?: Record<\n string,\n {\n id: string;\n title: string;\n componentId: string;\n fileId: string;\n }\n >;\n /** Controls order of `templates` & `subPages` on Pattern Page */\n tabs?: PageTab[];\n\n aliases?: string[];\n /**\n * Prevents pattern from appearing in System Overview and Status Table blocks\n */\n hideFromOverviewBlocks?: boolean;\n /**\n * Prevents pattern from appearing as an option in Component Embed and\n * Component Demo blocks\n */\n hideFromComponentBlocks?: boolean;\n};\n\nexport interface KnapsackPatternTemplateCode {\n html: string;\n data?: Record<string, any>;\n templateSrc: string;\n usage: string;\n language: string;\n}\n\nexport type KnapsackPatternsConfig = {\n $schema?: string;\n statusSets: KsStatusSet[];\n};\n\nexport interface TemplateRendererMeta {\n id: RendererId;\n title: string;\n version?: string;\n aliasTitle?: string;\n aliasDescription?: string;\n aliasUse: 'off' | 'optional' | 'required';\n aliasIsJsNamedExport?: boolean;\n syntaxHighlightingLanguage?: string;\n enableDataDemos: boolean;\n enableTemplateDemos: boolean;\n hasSlotsSupport: boolean;\n hasSlotOptionsSupport?: boolean;\n hasInferSpecSupport: boolean;\n hasTemplateSuggestionsSupport: boolean;\n prototypingTemplate?: {\n path: string;\n alias?: string;\n spec: Pick<KsTemplateSpec, 'props' | 'slots' | 'isInferred'>;\n };\n}\n\nexport type PatternsState = {\n patterns: {\n [id: string]: KnapsackPattern;\n };\n renderers: Partial<\n Record<\n RendererId,\n {\n meta: TemplateRendererMeta;\n }\n >\n >;\n} & KnapsackPatternsConfig;\n","import { ColorConfig } from '../color-config';\n\nexport enum PageHeaderSizes {\n auto = 'auto',\n small = 'small',\n medium = 'medium',\n large = 'large',\n full = 'full',\n}\n\nexport interface PageHeaderSettings {\n size?: `${PageHeaderSizes}`;\n backgroundImage?: string;\n backgroundColor?: ColorConfig;\n backgroundOverlay?: boolean;\n backgroundSize?: 'cover' | 'contain' | 'string';\n backgroundPosition?: 'left' | 'center' | 'right' | 'string';\n backgroundRepeat?: 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat';\n hideText?: boolean;\n textColorTitle?: ColorConfig;\n textColorDescription?: ColorConfig;\n}\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { TokenSrcGroup } from './design-tokens-types';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { BlockConfig } from './blocks';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { Demo, PatternsState } from './patterns';\nimport { UiConfig } from '../ui-config';\nimport { PagesSettings } from './page';\nimport { BlocksSettings } from './blocks.settings';\nimport { DesignSrcFile } from '../design-src.types';\n\nexport * from './asset-sets';\nexport * from './blocks';\nexport * from './custom-pages';\nexport * from './design-tokens';\nexport * from './design-tokens-types';\nexport * from './nav';\nexport * from './files';\nexport * from './meta';\nexport * from './patterns';\nexport { PageHeaderSizes } from './page.header';\nexport type { PageHeaderSettings } from './page.header';\nexport type { PageTab, PageType } from './page';\n\nexport interface KsAppClientData {\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensSrc: TokenSrcGroup;\n metaState?: MetaState;\n filesState: KsFiles;\n db: {\n blocks: {\n byId: Record<string, BlockConfig>;\n settings: BlocksSettings;\n };\n demos: {\n byId: Record<string, Demo>;\n // \"never\" for now until there are actual settings for demos\n settings: Record<string, never>;\n };\n settings: {\n title?: string;\n hideTitleInNavigation?: boolean;\n logoUrl?: string;\n favicon?: `https://${string}`;\n theme?: UiConfig;\n pages?: PagesSettings;\n designSrcs?: {\n files?: DesignSrcFile[];\n };\n tokens?: {\n theming?: {\n /** Which template languages theming controls will show up for next to the components preview stage. */\n enabledRendererIds?: string[];\n };\n };\n prototyping?: {\n patternId: string;\n };\n };\n };\n}\n\nexport type KsAppClientDataNoMeta = Omit<KsAppClientData, 'metaState'>;\nexport type KsAppClientDataAndMeta = Required<KsAppClientData>;\n\nexport function isKsAppClientDataNoMeta(\n data: unknown,\n): data is KsAppClientDataNoMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataNoMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'db',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStruct = define<KsAppClientDataNoMeta>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMeta,\n);\n\nexport function isKsAppClientDataAndMeta(\n data: unknown,\n): data is KsAppClientDataAndMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataAndMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'metaState',\n 'db',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStruct = define<KsAppClientDataAndMeta>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMeta,\n);\n\nexport const KsMetaStateStruct: Describe<KsAppClientData['metaState']> = type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n});\n\nexport const isKsMetaState = KsMetaStateStruct.is;\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { KsDesignTokensState } from './design-tokens';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { PatternsState } from './patterns';\nimport type { KnapsackSettings } from './settings';\n\nexport type {\n KsDesignToken,\n KsDesignTokenAttributes,\n KsDesignTokenData,\n KsDesignTokenDataGroup,\n KsDesignTokenSrc,\n KsDesignTokenSrcGroup,\n KsDesignTokensState,\n KsTokenType,\n KsTokenValue,\n KnapsackDesignToken,\n} from './design-tokens';\n\nexport interface KsAppClientDataV3 {\n settingsState: {\n settings: KnapsackSettings;\n };\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensState: KsDesignTokensState;\n metaState?: MetaState;\n filesState: KsFiles;\n}\n\nexport type KsAppClientDataNoMetaV3 = Omit<KsAppClientDataV3, 'metaState'>;\nexport type KsAppClientDataAndMetaV3 = Required<KsAppClientDataV3>;\n\nexport function isKsAppClientDataNoMetaV3(\n data: unknown,\n): data is KsAppClientDataNoMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataNoMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStructV3 = define<KsAppClientDataNoMetaV3>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMetaV3,\n);\n\nexport function isKsAppClientDataAndMetaV3(\n data: unknown,\n): data is KsAppClientDataAndMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataAndMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n 'metaState',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStructV3 = define<KsAppClientDataAndMetaV3>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMetaV3,\n);\n\nexport const KsMetaStateStructV3: Describe<KsAppClientDataV3['metaState']> =\n type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n });\n\nexport const isKsMetaStateV3 = KsMetaStateStructV3.is;\n","import { isDraft, type Draft } from 'immer';\nimport { Migration } from './migration.types';\nimport { KnapsackPattern, SlottedData } from '../app-client-data/patterns';\n\ntype Migration417DemosType = {\n version: string;\n checkIfNeeded: (appClientData: any) => boolean;\n migrate: (appClientData: Draft<any>) => void;\n};\n\nexport const migration417Demos: Migration417DemosType = {\n version: '4.1.7',\n checkIfNeeded: (appClientData) => {\n // this one will be tough to check for, so we'll just assume it's needed\n return true;\n },\n // note that `appClientData` is mutable since we're already in Immer\n migrate: (appClientData) => {\n if (!isDraft(appClientData)) {\n throw new Error(\n `Tried to run migrations on appClientData but it is not an Immer Draft`,\n );\n }\n Object.values(appClientData.patternsState.patterns).forEach(\n (\n pattern: Draft<\n KnapsackPattern & {\n demoSize?: string;\n }\n >,\n ) => {\n delete pattern.demoSize;\n },\n );\n\n Object.values(appClientData.db.demos.byId).forEach((demo) => {\n if (demo.type !== 'data') return;\n\n Object.entries(demo.data.slots ?? {}).forEach(([slotName, slotData]) => {\n demo.data.slots[slotName] = slotData.map(\n (slottedData: Draft<SlottedData | string>) => {\n // it used to be just a string\n if (typeof slottedData === 'string') {\n return {\n type: 'text',\n text: slottedData,\n };\n }\n if (\n // not doing anything with these\n slottedData.type === 'template-reference' ||\n // these already were migrated or made by the new editor\n slottedData.type === 'text'\n ) {\n return slottedData;\n }\n // these used to not have a type set\n slottedData.type = 'template-demo';\n return slottedData;\n },\n );\n });\n\n if (demo.patternId && demo.templateId) return;\n\n // using an IIFE so we can stop looping once we find it\n // would use `break` but it's a double loop\n (() => {\n for (const { id: pId, templates = [] } of Object.values(\n appClientData.patternsState.patterns,\n )) {\n for (const { id: tId, demoIds = [] } of templates) {\n if (demoIds.includes(demo.id)) {\n demo.patternId = pId;\n demo.templateId = tId;\n // found it - stop looking\n return;\n }\n }\n }\n })();\n });\n },\n} satisfies Migration;\n","// import { JSONSchema7 } from 'json-schema'; @todo consider using instead; though I'm not seeing it make it's way to the compiled JSON schema themselves via `convert-types-to-json-schmea.js`\n\ntype PropBase<Type = any> = {\n title?: string;\n description?: string;\n default?: Type;\n};\n\nexport enum PropTypeNames {\n 'string' = 'string',\n 'boolean' = 'boolean',\n 'number' = 'number',\n 'object' = 'object',\n 'options' = 'options',\n 'function' = 'function',\n 'customTypeScript' = 'customTypeScript',\n 'array' = 'array',\n 'arrayOfObjects' = 'arrayOfObjects',\n 'arrayOfStrings' = 'arrayOfStrings',\n 'arrayOfNumbers' = 'arrayOfNumbers',\n 'unknown' = 'unknown',\n}\nexport type PropTypeNamesList = keyof typeof PropTypeNames;\n\nexport type StringProp = {\n type: 'string';\n} & PropBase<string>;\n\nexport type BooleanProp = {\n type: 'boolean';\n} & PropBase<boolean>;\n\nexport type NumberProp = {\n type: 'number';\n} & PropBase<number>;\n\nexport type OptionsProp = {\n type: 'string';\n enum: string[];\n enumNames?: string[];\n} & PropBase<string>;\n\nexport type CustomTypeScriptProp = {\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n type?: never;\n default?: string;\n} & PropBase<string>;\n\nexport type FunctionProp = {\n typeof: 'function';\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n default?: string;\n type?: 'string';\n} & PropBase<string>;\n\nexport type ObjectProp = {\n type: 'object';\n additionalProperties?: boolean;\n required?: string[];\n properties: {\n [prop: string]: PropertyTypes;\n };\n} & PropBase;\n\nexport type ArrayProp = {\n type: 'array';\n items: PropertyTypes;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfStringsProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: StringProp;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfNumbersProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: NumberProp;\n} & PropBase<number[]>;\n\nexport type ArrayOfObjectsProp = {\n type: 'array';\n items: ObjectProp;\n} & PropBase<Array<Record<string, unknown>>>;\n\nexport type PropertyTypes =\n | StringProp\n | BooleanProp\n | NumberProp\n | OptionsProp\n | FunctionProp\n | CustomTypeScriptProp\n | ObjectProp\n | ArrayOfObjectsProp\n | ArrayOfStringsProp\n | ArrayOfNumbersProp\n | ArrayProp;\n\nexport const isStringProp = (prop: PropertyTypes): prop is StringProp =>\n 'type' in prop && prop.type === 'string' && !('enum' in prop);\nexport const isNumberProp = (prop: PropertyTypes): prop is NumberProp =>\n 'type' in prop && prop.type === 'number';\nexport const isBooleanProp = (prop: PropertyTypes): prop is BooleanProp =>\n 'type' in prop && prop.type === 'boolean';\nexport const isOptionsProp = (prop: PropertyTypes): prop is OptionsProp =>\n 'enum' in prop;\nexport const isFunctionProp = (prop: PropertyTypes): prop is FunctionProp =>\n 'typeof' in prop && prop?.typeof === 'function';\nexport const isCustomTypeScriptProp = (\n prop: PropertyTypes,\n): prop is CustomTypeScriptProp => !('typeof' in prop) && 'tsType' in prop;\nexport const isArrayOfObjectsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfObjectsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'object';\nexport const isObjectProp = (prop: PropertyTypes): prop is ObjectProp =>\n 'type' in prop &&\n prop.type === 'object' &&\n 'properties' in prop &&\n Object.keys(prop.properties).length > 0;\nexport const isArrayOfStringsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfStringsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'string';\nexport const isArrayOfNumbersProp = (\n prop: PropertyTypes,\n): prop is ArrayOfNumbersProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'number';\n\nexport interface PropTypeDataBase {\n type: any;\n id: string;\n isRequired?: boolean;\n data: any;\n}\n\nexport interface StringPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.string;\n data: StringProp;\n}\n\nexport interface BooleanPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.boolean;\n data: BooleanProp;\n}\n\nexport interface NumberPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.number;\n data: NumberProp;\n}\n\nexport interface OptionsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.options;\n data: OptionsProp;\n}\n\nexport interface FunctionPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.function;\n data: FunctionProp;\n}\n\nexport interface CustomTypeScriptPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.customTypeScript;\n data: CustomTypeScriptProp;\n}\n\nexport interface ObjectPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.object;\n data: ObjectProp;\n}\n\nexport interface ArrayOfObjectsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfObjects;\n data: ArrayOfObjectsProp;\n}\n\nexport interface ArrayOfStringsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfStrings;\n data: ArrayOfStringsProp;\n}\n\nexport interface ArrayOfNumbersPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfNumbers;\n data: ArrayOfNumbersProp;\n}\n\nexport interface ArrayPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.array;\n data: ArrayProp;\n}\n\nexport type PropTypeData =\n | StringPropTypeData\n | BooleanPropTypeData\n | NumberPropTypeData\n | OptionsPropTypeData\n | FunctionPropTypeData\n | CustomTypeScriptPropTypeData\n | ObjectPropTypeData\n | ArrayOfObjectsPropTypeData\n | ArrayOfStringsPropTypeData\n | ArrayOfNumbersPropTypeData;\n\nexport type JsonSchemaObject<PropNames extends string = string> = {\n $schema?: string;\n title?: string;\n description?: string;\n type: 'object';\n required?: PropNames[];\n properties: Record<PropNames, PropertyTypes>;\n examples?: Record<string, unknown>[];\n};\n","import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n id: UUID;\n date: DateString;\n};\nexport type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event'>;\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n","import type { FeedbackTypes } from './misc';\n\nexport enum KsRendererClientEvents {\n ready = 'ready',\n}\n\n/**\n * Message sent from the renderer client (in the iframe) to the App UI parent window\n * using `window.parent.postMessage()`.\n * Note that this likely will become a union type of all possible messages\n */\nexport type KsRendererClientMsg =\n | {\n /**\n * Sent when a `ResizeObserver` detects a change in the contents height or width.\n */\n type: 'ksRendererClient.contentResized';\n height: number;\n width: number;\n }\n | {\n type: 'ksRendererClient.showToast';\n msg: string;\n feedbackType?: FeedbackTypes;\n };\n\n/**\n * The meta data is stored in a script tag with this id\n * @see {KsRendererClientMeta}\n */\nexport const ksRendererClientMetaId = 'ks-meta';\n\n/**\n * Metadata about the current renderer client demo\n * @see {ksRendererClientMetaId} for the ID of the script tag\n */\nexport interface KsRendererClientMeta {\n patternId: string;\n templateId: string;\n demoId: string;\n assetSetId: string;\n isInIframe: boolean;\n websocketsPort: number;\n}\n","export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha: string;\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n","/**\n * The roles here are duplicates of the roles in the database.\n * It needs to be here, in the types package, so it can be used in all packages.\n * If we pull it in from `@knapsack/hasura-gql-client`, which is the source, we get a dependency cycle. So we do it this way.\n * If the roles change in the database, we need to change them here too. We will get a build error if we don't (see code in `@knapsack/hasura-gql-client`).\n */\n\nexport const rolesById = {\n ADMIN: 'ADMIN',\n ANONYMOUS: 'ANONYMOUS',\n CONTRIBUTOR: 'CONTRIBUTOR',\n EDITOR: 'EDITOR',\n MANAGER: 'MANAGER',\n VIEWER: 'VIEWER',\n} as const;\nexport const roles = Object.values(rolesById);\nexport type Role = keyof typeof rolesById;\n","import { KsAppClientDataAndMeta } from '@knapsack/types';\n\nexport type SiteDeployedWebhookBody = {\n siteId: string;\n appClientData: KsAppClientDataAndMeta;\n};\n\nexport const siteDeployedWebhookEndpoint = '/site-deployed';\n\nexport const gitHubOauthInternalEndpoint = '/github-auth';\n","import { isUrl } from '@knapsack/utils';\n\nconst { KS_DB_URL } = process.env;\nif (KS_DB_URL && !isUrl(KS_DB_URL)) {\n throw new Error(`KS_DB_URL is not a valid URL: '${KS_DB_URL}'`);\n}\nconst dbUrl = KS_DB_URL || 'https://db.knapsack.cloud';\nconst dbGqlEndpoint = new URL('/v1/graphql', dbUrl).toString();\n\nexport const ksUrls = {\n /**\n * Base URL for Knapsack DB (Hasura)\n * @default 'https://db.knapsack.cloud'\n */\n dbUrl,\n /**\n * App DB GraphQL endpoint for connecting to Hasura GraphQL.\n * @default 'https://db.knapsack.cloud/v1/graphql'\n */\n dbGqlEndpoint,\n};\n","export const ksHttpHeaders = {\n siteId: 'X-KS-Site-ID',\n instanceId: 'X-KS-Instance-Id',\n appClientVersion: 'X-KS-App-Client-Version',\n};\n"]}
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js","../../../node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js","../../../node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js","../../../node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js","../src/users.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/env.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/errors.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/common.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/utils/plugins.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/scope.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/finalize.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/proxy.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/immerClass.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/core/current.ts","../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/src/immer.ts","../../types/src/ui-config.ts","../../types/src/color-config.ts","../../types/src/typography-config.ts","../../types/src/nav-customization-config.ts","../../types/src/app-client-data/design-tokens-types/token-definitions.ts","../../types/src/app-client-data/design-tokens-types/token-data.ts","../../types/src/app-client-data/design-tokens-types/token-src-value-info.ts","../../types/src/app-client-data/design-tokens-types/token-src.ts","../../types/src/app-client-data/design-tokens-types/token-utils.ts","../../types/src/app-client-data/patterns.ts","../../types/src/app-client-data/page.header.ts","../../types/src/app-client-data/index.ts","../../types/src/app-client-data-v3/index.ts","../../types/src/app-client-data-migrations/4.1.7-demos.ts","../../types/src/json-schema.ts","../../types/src/changes.ts","../../types/src/renderer-client-types.ts","../../types/src/git-providers.ts","../../types/src/api/plugins.ts","../../types/src/api/files.ts","../../types/src/user-roles.ts","../src/webhooks.ts","../src/ks-urls.ts","../src/http-headers.ts"],"names":["require_color_name","__commonJSMin","exports","module","require_is_arrayish","__name","obj","require_simple_swizzle","isArrayish","concat","slice","swizzle","args","results","i","len","arg","fn","require_color_string","colorNames","hasOwnProperty","reverseNames","name","cs","string","prefix","val","model","abbr","hex","rgba","per","keyword","rgb","match","hexAlpha","i2","clamp","hsl","alpha","h","s","l","a","hwb","w","b","hexDouble","r","g","hsla","hwba","num","min","max","str","NOTHING","DRAFTABLE","DRAFT_STATE","errors","plugin","thing","data","die","error","e","msg","getPrototypeOf","isDraft","value","isDraftable","isPlainObject","isMap","isSet","objectCtorString","proto","Ctor","each","iter","getArchtype","key","entry","index","state","has","prop","set","propOrOldValue","t","is","x","y","target","latest","shallowCopy","base","strict","isPlain","descriptors","keys","desc","freeze","deep","isFrozen","dontMutateFrozenCollections","plugins","getPlugin","pluginKey","currentScope","getCurrentScope","createScope","parent_","immer_","usePatchesInScope","scope","patchListener","revokeScope","leaveScope","revokeDraft","enterScope","immer","draft","processResult","result","baseDraft","finalize","maybeFreeze","rootScope","path","childValue","finalizeProperty","resultEach","parentState","targetObject","rootPath","targetIsSet","res","createProxyProxy","parent","isArray","traps","objectTraps","arrayTraps","revoke","proxy","source","readPropFromProto","peek","prepareCopy","createProxy","getDescriptorFromProto","current","currentState","markChanged","owner","Immer","config","recipe","defaultBase","self","hasError","p","ip","patches","inversePatches","patch","applyPatchesImpl","currentImpl","copy","produce","setAutoFreeze","setUseStrictShallowCopy","ce","n","ue","isColor","color","colorString","ColorStringStruct","define","ColorConfigStruct","union","type","literal","ColorTokenConfigStruct","HeadingLevels","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceSourceFormats","FontFaceFormatsEnumStruct","FontFaceSourceStruct","FontFaceConfigStruct","optional","size","array","TextTransforms","Ge","FontStretches","$e","TypographyLinkConfigStruct","boolean","FontSizeConfigStruct","TypographyConfigStruct","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","defaulted","UiConfigV5Struct","UiConfigV7Struct","UiConfigV9Struct","isTokenReference","hasTokenReferences","isNotTokenReference","TokenReferenceStruct","compositeTypesRecord","tokenTypeComposites","singularTypesRecord","tokenTypeSingulars","isTokenTypeComposite","isTokenTypeSingular","expectType","TokenDataBaseStruct","isTokenDataComposite","tokenData","isTokenValueColor","TokenValueColorStruct","TokenDataColorNonRefStruct","TokenDataColorRefStruct","isTokenValueDimension","TokenValueDimensionStruct","TokenDataDimensionNonRefStruct","TokenDataDimensionRefStruct","isTokenValueDuration","TokenValueDurationStruct","TokenDataDurationNonRefStruct","TokenDataDurationRefStruct","isTokenValueFontWeight","TokenValueFontWeightStruct","TokenDataFontWeightNonRefStruct","TokenDataFontWeightRefStruct","TokenValueCubicBezierStruct","v","TokenDataCubicBezierNonRefStruct","TokenDataCubicBezierRefStruct","isTokenValueShadow","isObject","TokenValueShadowStruct","TokenDataShadowNonRefStruct","TokenDataShadowRefStruct","TokenValueStrokeStyleStruct","isTokenValueBorder","TokenValueBorderStruct","TokenDataBorderNonRefStruct","TokenDataBorderRefStruct","isTokenValueTransition","TokenValueTransitionStruct","TokenDataTransitionNonRefStruct","TokenDataTransitionRefStruct","TokenDataStringNonRefStruct","TokenDataStringRefStruct","TokenDataStrokeStyleNonRefStruct","TokenDataStrokeStyleRefStruct","TokenDataNumberNonRefStruct","TokenDataNumberRefStruct","TokenDataBooleanNonRefStruct","TokenDataBooleanRefStruct","assertTokenData","isObjKey","kind","isTokenSrcValueInfoSingular","tokenSrcValueInfo","isTokenSrcValueInfoComposite","isTokenSrcExtensions","extensionsObj","isTokenSrc","tokenObject","isTokenGroup","isTokenTypeVarRef","varRefCollectionInfo","getPrimitiveValue","tokenValue","parseTokenDimensionValue","valueToParse","unit","parseNumberWithUnit","slottedData","isSlottedTemplateDemo","isSlottedTemplateReference","StageLayouts","isDataDemo","demo","isTemplateDemo","PageHeaderSizes","isKsAppClientDataNoMeta","isKsAppClientDataAndMeta","isKsAppClientDataNoMetaV3","isKsAppClientDataAndMetaV3","KsMetaStateStructV3","appClientData","pattern","slotName","slotData","pId","templates","tId","demoIds","PropTypeNames","isStringProp","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfStringsProp","isArrayOfNumbersProp","PatchStructRuntime","PatchStruct","isPatch","PatchesStructRuntime","PatchesStruct","KsRemoteChangeRuntime","KsRemoteChangeStruct","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes","KsRendererClientEvents","ksRendererClientMetaId","GitProviderType","eo","MergeableState","RestActions","TextEncoding","no","plugins_exports","__export","ACTIONS","endpoint","files_exports","Ne","rolesById","roles","RolesEnums","ii","RolesEnumsStruct","canRoleAdmin","role","rolesThatCanManageUsers","canRoleManageUsers","rolesThatCanDelete","canRoleDelete","rolesThatCanEdit","canRoleEdit","rolesThatCanPublish","canRolePublish","rolesThatCanView","canRoleView","isRoleValid","HasuraRoles","HasuraRolesStruct","HasuraClaimsStruct","KsClaimsStruct","record","JwtBaseStruct","HASURA_CLAIMS_NAMESPACE","KNAPSACK_CLAIMS_NAMESPACE","JwtCustomClaimsStruct","JwtWithCustomClaimsStruct","assign","expandSitesByRole","sitesByRole","cur","roleId","siteIds","siteId","defaultAnonymousKsClaims","getKsClaims","claims","ksClaims","siteRoleMap","siteDeployedWebhookEndpoint","gitHubOauthInternalEndpoint","KS_DB_URL","isUrl","dbUrl","dbGqlEndpoint","ksUrls","ksHttpHeaders"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,EAAA,CAAA,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kBC,CAAAA,CAAW,CACjD,CAAA,OAAO,CACL,GAAGQ,CACH,CAAA,WAAA,CAAAC,EACA,WAAa1X,CAAAA,CAAAA,CAACqX,CACRI,EAAAA,CAAAA,CAAS,YAAqB,CAAA,OAAA,CAC3BC,CAAYL,CAAAA,CAAM,CAAK,EAAA,WAAA,CAFnB,aAIf,CAAA,CACF,CAd2B,CAAA,aAAA,EgC5MdM,IAAAA,EAAAA,CAA8B,iBAE9BC,EAA8B,CAAA,eCP3C,GAAM,CAAE,UAAAC,EAAU,CAAA,CAAI,OAAQ,CAAA,GAAA,CAC9B,GAAIA,EAAAA,EAAa,CAACC,WAAAA,CAAMD,EAAS,CAC/B,CAAA,MAAM,IAAI,KAAA,CAAM,CAAkCA,+BAAAA,EAAAA,EAAS,CAAG,CAAA,CAAA,CAAA,CAE1DE,IAAAA,EAAAA,CAAQF,EAAa,EAAA,2BAAA,CACrBG,EAAgB,CAAA,IAAI,GAAI,CAAA,aAAA,CAAeD,EAAK,CAAE,CAAA,QAAA,EAEvCE,CAAAA,EAAAA,CAAS,CAKpB,KAAA,CAAAF,EAKA,CAAA,aAAA,CAAAC,EACF,ECpBO,IAAME,EAAgB,CAAA,CAC3B,MAAQ,CAAA,cAAA,CACR,UAAY,CAAA,kBAAA,CACZ,iBAAkB,yBACpB","file":"index.js","sourcesContent":["'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","module.exports = function isArrayish(obj) {\n\tif (!obj || typeof obj === 'string') {\n\t\treturn false;\n\t}\n\n\treturn obj instanceof Array || Array.isArray(obj) ||\n\t\t(obj.length >= 0 && (obj.splice instanceof Function ||\n\t\t\t(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));\n};\n","'use strict';\n\nvar isArrayish = require('is-arrayish');\n\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\n\nvar swizzle = module.exports = function swizzle(args) {\n\tvar results = [];\n\n\tfor (var i = 0, len = args.length; i < len; i++) {\n\t\tvar arg = args[i];\n\n\t\tif (isArrayish(arg)) {\n\t\t\t// http://jsperf.com/javascript-array-concat-vs-push/98\n\t\t\tresults = concat.call(results, slice.call(arg));\n\t\t} else {\n\t\t\tresults.push(arg);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nswizzle.wrap = function (fn) {\n\treturn function () {\n\t\treturn fn(swizzle(arguments));\n\t};\n};\n","/* MIT license */\nvar colorNames = require('color-name');\nvar swizzle = require('simple-swizzle');\nvar hasOwnProperty = Object.hasOwnProperty;\n\nvar reverseNames = Object.create(null);\n\n// create a list of reverse color names\nfor (var name in colorNames) {\n\tif (hasOwnProperty.call(colorNames, name)) {\n\t\treverseNames[colorNames[name]] = name;\n\t}\n}\n\nvar cs = module.exports = {\n\tto: {},\n\tget: {}\n};\n\ncs.get = function (string) {\n\tvar prefix = string.substring(0, 3).toLowerCase();\n\tvar val;\n\tvar model;\n\tswitch (prefix) {\n\t\tcase 'hsl':\n\t\t\tval = cs.get.hsl(string);\n\t\t\tmodel = 'hsl';\n\t\t\tbreak;\n\t\tcase 'hwb':\n\t\t\tval = cs.get.hwb(string);\n\t\t\tmodel = 'hwb';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tval = cs.get.rgb(string);\n\t\t\tmodel = 'rgb';\n\t\t\tbreak;\n\t}\n\n\tif (!val) {\n\t\treturn null;\n\t}\n\n\treturn {model: model, value: val};\n};\n\ncs.get.rgb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar abbr = /^#([a-f0-9]{3,4})$/i;\n\tvar hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;\n\tvar rgba = /^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar keyword = /^(\\w+)$/;\n\n\tvar rgb = [0, 0, 0, 1];\n\tvar match;\n\tvar i;\n\tvar hexAlpha;\n\n\tif (match = string.match(hex)) {\n\t\thexAlpha = match[2];\n\t\tmatch = match[1];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\t// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19\n\t\t\tvar i2 = i * 2;\n\t\t\trgb[i] = parseInt(match.slice(i2, i2 + 2), 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(abbr)) {\n\t\tmatch = match[1];\n\t\thexAlpha = match[3];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i] + match[i], 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(rgba)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i + 1], 0);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(per)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(keyword)) {\n\t\tif (match[1] === 'transparent') {\n\t\t\treturn [0, 0, 0, 0];\n\t\t}\n\n\t\tif (!hasOwnProperty.call(colorNames, match[1])) {\n\t\t\treturn null;\n\t\t}\n\n\t\trgb = colorNames[match[1]];\n\t\trgb[3] = 1;\n\n\t\treturn rgb;\n\t} else {\n\t\treturn null;\n\t}\n\n\tfor (i = 0; i < 3; i++) {\n\t\trgb[i] = clamp(rgb[i], 0, 255);\n\t}\n\trgb[3] = clamp(rgb[3], 0, 1);\n\n\treturn rgb;\n};\n\ncs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};\n\ncs.get.hwb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hwb = /^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hwb);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar w = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar b = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\t\treturn [h, w, b, a];\n\t}\n\n\treturn null;\n};\n\ncs.to.hex = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn (\n\t\t'#' +\n\t\thexDouble(rgba[0]) +\n\t\thexDouble(rgba[1]) +\n\t\thexDouble(rgba[2]) +\n\t\t(rgba[3] < 1\n\t\t\t? (hexDouble(Math.round(rgba[3] * 255)))\n\t\t\t: '')\n\t);\n};\n\ncs.to.rgb = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'\n\t\t: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';\n};\n\ncs.to.rgb.percent = function () {\n\tvar rgba = swizzle(arguments);\n\n\tvar r = Math.round(rgba[0] / 255 * 100);\n\tvar g = Math.round(rgba[1] / 255 * 100);\n\tvar b = Math.round(rgba[2] / 255 * 100);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'\n\t\t: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';\n};\n\ncs.to.hsl = function () {\n\tvar hsla = swizzle(arguments);\n\treturn hsla.length < 4 || hsla[3] === 1\n\t\t? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'\n\t\t: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';\n};\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\ncs.to.hwb = function () {\n\tvar hwba = swizzle(arguments);\n\n\tvar a = '';\n\tif (hwba.length >= 4 && hwba[3] !== 1) {\n\t\ta = ', ' + hwba[3];\n\t}\n\n\treturn 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';\n};\n\ncs.to.keyword = function (rgb) {\n\treturn reverseNames[rgb.slice(0, 3)];\n};\n\n// helpers\nfunction clamp(num, min, max) {\n\treturn Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n\tvar str = Math.round(num).toString(16).toUpperCase();\n\treturn (str.length < 2) ? '0' + str : str;\n}\n","/**\n * @file\n *\n * All things involving low-level user JWT parsing, claims, roles.\n */\n\nimport {\n array,\n boolean,\n Describe,\n enums,\n number,\n object,\n optional,\n string,\n type,\n union,\n record,\n assign,\n} from 'superstruct';\nimport { roles, type Role } from '@knapsack/types';\n\n// Superstruct runtime validation for Role\nexport const RolesEnums = enums(roles);\nexport const RolesEnumsStruct: Describe<Role> = RolesEnums;\n\nexport const canRoleAdmin = (role: Role): boolean => role === 'ADMIN';\n\nexport const rolesThatCanManageUsers: Role[] = ['ADMIN', 'MANAGER'];\n\nexport const canRoleManageUsers = (role: Role): boolean =>\n rolesThatCanManageUsers.includes(role);\n\nexport const rolesThatCanDelete: Role[] = [\n ...rolesThatCanManageUsers,\n 'EDITOR',\n];\n\nexport const canRoleDelete = (role: Role): boolean =>\n rolesThatCanDelete.includes(role);\n\nexport const rolesThatCanEdit: Role[] = [...rolesThatCanDelete, 'CONTRIBUTOR'];\n\nexport const canRoleEdit = (role: Role): boolean =>\n rolesThatCanEdit.includes(role);\n\nexport const rolesThatCanPublish: Role[] = ['ADMIN'];\n\nexport const canRolePublish = (role: Role): boolean =>\n rolesThatCanPublish.includes(role);\n\nexport const rolesThatCanView: Role[] = [...rolesThatCanEdit, 'VIEWER'];\n\nexport const canRoleView = (role: Role): boolean =>\n rolesThatCanView.includes(role);\n\nexport const isRoleValid = (role: string): role is Role =>\n RolesEnumsStruct.is(role);\n\n/**\n * Please note that these are not the same as the \"roles\" used on a per-site\n * basis, these are roles for the entire DB.\n */\nexport enum HasuraRoles {\n // yes, `admin` exists but no reason anyone should have it, yet\n user = 'user',\n anonymous = 'anonymous',\n}\nconst HasuraRolesStruct = enums(Object.values(HasuraRoles));\n\nexport type HasuraClaims = {\n 'x-hasura-allowed-roles': HasuraRoles[];\n 'x-hasura-default-role': HasuraRoles;\n 'x-hasura-user-id'?: string;\n};\n// Superstruct runtime validation for HasuraClaims\nexport const HasuraClaimsStruct: Describe<HasuraClaims> = object({\n 'x-hasura-allowed-roles': array(HasuraRolesStruct),\n 'x-hasura-default-role': HasuraRolesStruct,\n 'x-hasura-user-id': optional(string()),\n});\n\n/**\n * The specific Knapsack claims that live at 'https://knapsack.cloud' within JWT\n */\nexport type KnapsackClaims = {\n userId: string;\n /** For email address that end in `knapsack.cloud` */\n isSuperAdmin: boolean;\n /**\n * Keys are roleId, value are array of siteId strings\n * Purposely kept small for JWT payloads. Often expanded.\n * @see {SiteRoleMap}\n * @see {expandSitesByRole}\n * @example\n * {\n * sitesByRole: {\n * EDITOR: ['ks-demo-bootstrap', 'ks-demo-tailwind'],\n * VIEWER: ['site-id-1'],\n * },\n * }\n */\n sitesByRole: {\n [roleId in Role]?: string[];\n };\n};\n// Superstruct runtime validation for KnapsackClaims\nexport const KsClaimsStruct: Describe<KnapsackClaims> = object({\n userId: string(),\n isSuperAdmin: boolean(),\n sitesByRole: record(RolesEnums, array(string())),\n});\n\n/**\n * The easier to work with & expanded version of `sitesByRole` in KsClaims,\n * which is kept as small as possible for JWT payloads.\n * @see {KnapsackClaims}\n */\nexport type SiteRoleMap = {\n [siteId: string]: Role;\n};\n\n/**\n * Base JWT\n */\nexport type JwtBase = {\n /* Token expiration time; usually 1 hour after issued at time (`iat`), in seconds (not ms) */\n exp: number;\n /* Email exists on ID token, but not AUTH token */\n email?: string;\n /* WARNING: email_verified is not guaranteed to exst on SSO tokens, and is boolean or string! */\n email_verified?: string | boolean;\n /* Issued at Time, in seconds (not ms) */\n iat: number;\n /* Issuer */\n iss: string;\n /* Subject (userId) */\n sub: string;\n /* Audience */\n aud: string | string[];\n};\n// Superstruct runtime validation for JwtBase. Use type() to ignore extra keys\nexport const JwtBaseStruct: Describe<JwtBase> = type({\n exp: number(),\n email: optional(string()),\n email_verified: optional(union([string(), boolean()])),\n iat: number(),\n iss: string(),\n sub: string(),\n aud: union([string(), array(string())]),\n});\n\n/**\n * Bring it all together to make a full JWT\n */\nexport const HASURA_CLAIMS_NAMESPACE = 'https://hasura.io/jwt/claims';\nexport const KNAPSACK_CLAIMS_NAMESPACE = 'https://knapsack.cloud';\n\n// Just custom claims\nexport type JwtCustomClaims = {\n [HASURA_CLAIMS_NAMESPACE]: HasuraClaims;\n [KNAPSACK_CLAIMS_NAMESPACE]: KnapsackClaims;\n};\n// Superstruct runtime validation for JwtCustomClaims\nexport const JwtCustomClaimsStruct: Describe<JwtCustomClaims> = object({\n [HASURA_CLAIMS_NAMESPACE]: HasuraClaimsStruct,\n [KNAPSACK_CLAIMS_NAMESPACE]: KsClaimsStruct,\n});\n\n// The entire JWT, custom claims + base root keys\nexport type JwtWithCustomClaims = JwtBase & JwtCustomClaims;\n// Superstruct runtime validation for JwtWithCustomClaims\nexport const JwtWithCustomClaimsStruct: Describe<JwtWithCustomClaims> = assign(\n JwtBaseStruct,\n JwtCustomClaimsStruct,\n);\n\n/**\n * Convert sitesByRole to be a map of siteId to roleId. This is the format we\n * actually use within the app to determine what sites a user can access.\n */\nexport function expandSitesByRole(\n sitesByRole: KnapsackClaims['sitesByRole'],\n): SiteRoleMap {\n return Object.entries(sitesByRole).reduce((cur, [roleId, siteIds]) => {\n if (!isRoleValid(roleId)) return cur;\n siteIds.forEach((siteId) => {\n cur[siteId] = roleId;\n });\n return cur;\n }, {} as SiteRoleMap);\n}\n\nexport type KsClaimsHelper = Omit<KnapsackClaims, 'sitesByRole'> & {\n siteRoleMap: SiteRoleMap;\n /** Get the User's Role for particular site */\n getSiteRole: (siteId: string) => Role;\n};\n\nexport const defaultAnonymousKsClaims: KsClaimsHelper = {\n isSuperAdmin: false,\n userId: '',\n siteRoleMap: {},\n getSiteRole: () => 'ANONYMOUS',\n};\n\n/**\n * Picks off the KsClaims from the JWT (since it has a weird to use\n * `https://knapsack.cloud` namespace) and then also converts the size-conscious\n * `sitesByRole` into the more usable format of `siteRoleMap\n */\nexport const getKsClaims = (claims: unknown): KsClaimsHelper => {\n if (!JwtWithCustomClaimsStruct.is(claims)) {\n return defaultAnonymousKsClaims;\n }\n const { sitesByRole, ...ksClaims } = claims[KNAPSACK_CLAIMS_NAMESPACE];\n const siteRoleMap = expandSitesByRole(sitesByRole);\n return {\n ...ksClaims,\n siteRoleMap,\n getSiteRole: (siteId) => {\n if (ksClaims.isSuperAdmin) return 'ADMIN';\n return siteRoleMap[siteId] || 'ANONYMOUS';\n },\n };\n};\n","// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original<T>(value: T): T | undefined\nexport function original(value: Drafted<any>): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each<T extends Objectish>(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze<T>(obj: T, deep?: boolean): T\nexport function freeze<T>(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_<T>(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_<T extends AnyMap>(target: T, parent?: ImmerState): T\n\t\tproxySet_<T extends AnySet>(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin<K extends keyof Plugins>(\n\tpluginKey: K\n): Exclude<Plugins[K], undefined> {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin<K extends keyof Plugins>(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map<any, boolean> | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted<AnyMap, MapState>\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map<any, Drafted> // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted<AnySet, SetState>\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude<ImmerState, SetState>).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted<AnyObject, ProxyObjectState>\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted<AnyArray, ProxyArrayState>\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy<T extends Objectish>(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted<T, ProxyState> {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler<object | Array<any>> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler<ProxyState> = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft<T extends Objectish>(base: T): Draft<T> {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft<D extends Draft<any>>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft<infer T> ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches<T extends Objectish>(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy<T extends Objectish>(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted<T, ImmerState> {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current<T>(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft<T>(value: T): Draft<T> {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable<T>(value: T): Immutable<T> {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n","import {\n type,\n Describe,\n literal,\n optional,\n defaulted,\n boolean,\n array,\n object,\n} from 'superstruct';\n\nimport { ExpandRecursively } from '@knapsack/utils';\n\nimport {\n ColorConfig,\n ColorConfigStruct,\n ColorStringStruct,\n} from './color-config';\n\nimport {\n FontFaceConfigStruct,\n FontFaceConfig,\n TypographyConfigStruct,\n TypographyLinkConfigStruct,\n pageElements,\n pageElementsV2,\n} from './typography-config';\n\nimport {\n customizableNavElements,\n NavCustomizationConfigStruct,\n PrimaryNavCustomizationConfigStruct,\n SecondaryNavCustomizationConfigStruct,\n} from './nav-customization-config';\n\nexport type UiConfigV1 = {\n version: 1;\n oldSillySidebarBgColor: string;\n};\n\nexport const UiConfigV1Struct: Describe<UiConfigV1> = object({\n version: literal(1),\n oldSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV2 = {\n version: 2;\n anotherSillySidebarBgColor: string;\n};\n\nexport const UiConfigV2Struct: Describe<UiConfigV2> = object({\n version: literal(2),\n anotherSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV3 = {\n version: 3;\n sidebarBgColor: string;\n};\n\nexport const UiConfigV3Struct: Describe<UiConfigV3> = object({\n version: literal(3),\n sidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV4 = {\n version: 4;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n enableSidebarIcons?: boolean;\n};\nexport const UiConfigV4Struct: Describe<UiConfigV4> = object({\n version: literal(4),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport type UiConfigV5 = {\n version: 5;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n linkColor: ColorConfig;\n enableSidebarIcons: boolean;\n};\nexport const UiConfigV5Struct: Describe<UiConfigV5> = object({\n version: literal(5),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport interface _UiConfigV6 extends Omit<UiConfigV5, 'version'> {\n version: 6;\n appearance: {\n customFonts?: FontFaceConfig[];\n pageElements: typeof pageElements;\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfigV6' is not assignable to type 'Record<string, unknown>'.\" error\nexport type UiConfigV6 = ExpandRecursively<_UiConfigV6>;\n\nexport const UiConfigV6Struct: Describe<UiConfigV6> = object({\n version: literal(6),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV7 extends Omit<UiConfigV6, 'version'> {\n version: 7;\n appearance: {\n navigation?: typeof customizableNavElements;\n customFonts?: UiConfigV6['appearance']['customFonts'];\n pageElements: UiConfigV6['appearance']['pageElements'];\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig7' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\nexport type UiConfigV7 = ExpandRecursively<_UiConfigV7>;\n\nexport const UiConfigV7Struct: Describe<UiConfigV7> = object({\n version: literal(7),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV8\n extends Omit<UiConfigV7, 'version' | 'enableSidebarIcons'> {\n version: 8;\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig8' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\n// TODO: move this to @knapsack/types\nexport type UiConfigV8 = ExpandRecursively<_UiConfigV8>;\n\nexport const UiConfigV8Struct: Describe<UiConfigV8> = object({\n version: literal(8),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV9\n extends Omit<\n UiConfigV8,\n 'version' | 'primaryColor' | 'darkColor' | 'lightColor' | 'linkColor'\n > {\n version: 9;\n}\nexport type UiConfigV9 = ExpandRecursively<_UiConfigV9>;\n\nexport const UiConfigV9Struct: Describe<UiConfigV9> = object({\n version: literal(9),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV10 extends Omit<UiConfigV9, 'version'> {\n version: 10;\n appearance: {\n navigation?: UiConfigV9['appearance']['navigation'];\n customFonts?: UiConfigV9['appearance']['customFonts'];\n pageElements: typeof pageElementsV2;\n };\n}\nexport type UiConfigV10 = ExpandRecursively<_UiConfigV10>;\n\nexport const UiConfigV10Struct: Describe<UiConfigV10> = object({\n version: literal(10),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingXLarge: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n headingXSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport type UiConfigVersions =\n | typeof UiConfigV1Struct.TYPE\n | typeof UiConfigV2Struct.TYPE\n | typeof UiConfigV3Struct.TYPE\n | typeof UiConfigV4Struct.TYPE\n | typeof UiConfigV5Struct.TYPE\n | typeof UiConfigV6Struct.TYPE\n | typeof UiConfigV7Struct.TYPE\n | typeof UiConfigV8Struct.TYPE\n | typeof UiConfigV9Struct.TYPE\n | typeof UiConfigV10Struct.TYPE;\n\n// ALIASES FOR LATEST VERSIONS\nexport type UiConfig = UiConfigV10;\nexport const UiConfigStruct: typeof UiConfigV10Struct = UiConfigV10Struct;\n\nexport type NavElementNames = keyof UiConfig['appearance']['navigation'];\n","import colorString from 'color-string';\nimport { define, Describe, literal, string, type, union } from 'superstruct'; // https://docs.superstructjs.org\n\n/** Use `import { isColor } from '@knapsack/color-utils'` if you can, need to duplicate this logic due to dep cycle */\nfunction isColor(color: unknown): color is string {\n if (typeof color !== 'string') return false;\n try {\n return !!colorString.get(color);\n } catch (e) {\n return false;\n }\n}\n\nexport type ColorTokenConfig = {\n type: 'design-token';\n /** Will be **either** `-` (old) or `.` (new) separated */\n tokenName: string;\n};\nexport type ColorConfig =\n | { type: 'value'; colorValue: string }\n | ColorTokenConfig;\n\nexport const ColorStringStruct = define<string>(\n 'ColorStringStruct',\n (value) => typeof value === 'string' && isColor(value),\n);\n\nexport const ColorConfigStruct: Describe<ColorConfig> = union([\n type({\n type: literal('value'),\n colorValue: ColorStringStruct,\n }),\n type({\n type: literal('design-token'),\n tokenName: string(),\n }),\n]);\n\n// so we can check if an object is not just a ColorConfig but specifically a token\nexport const ColorTokenConfigStruct: Describe<ColorTokenConfig> = type({\n type: literal('design-token'),\n tokenName: string(),\n});\n","import {\n Describe,\n string,\n type,\n union,\n number,\n enums,\n optional,\n literal,\n array,\n size,\n boolean,\n object,\n} from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\n\nexport const HeadingLevels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nexport type HeadingLevel = (typeof HeadingLevels)[number];\n\nexport type FontSizeConfigVal = {\n unit: 'px' | 'rem';\n value: number;\n};\n\nexport const FontSizeConfigValStruct: Describe<FontSizeConfigVal> = object({\n unit: enums(['rem', 'px']),\n value: number(),\n});\n\nexport type FontFaceWeight = number | string;\n\nexport const FontFaceWeightStruct: Describe<FontFaceWeight> = union([\n string(),\n number(),\n]);\n\nexport enum FontFaceSourceFormats {\n woff2 = 'woff2',\n woff = 'woff',\n}\n\nexport type FontFaceSource = {\n /**\n * Note: if /when we eventually add 'local' type support, format isn't used!\n */\n format: keyof typeof FontFaceSourceFormats;\n type: 'url';\n path: string;\n};\n\nexport const FontFaceFormatsEnumStruct = enums(['woff2', 'woff']);\n\nexport const FontFaceSourceStruct: Describe<FontFaceSource> = type({\n format: FontFaceFormatsEnumStruct,\n type: literal('url'),\n path: string(),\n});\n\nexport type FontFaceConfig = {\n /**\n * registered name of the custom font\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family @font-face's font-family property}\n */\n family?: string;\n\n /**\n * number between 1 and 1000.\n *\n * note: since two weights are allowed (with variable fonts), this type is an\n * optional array for easy parsing down the road.\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight @font-face's font-weight property}.\n */\n weight?: FontFaceWeight | FontFaceWeight[];\n\n /**\n * the collection of urls / paths pointing to font files\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src @font-face's src property}.\n */\n src?: FontFaceSource[];\n\n /**\n * the style of the custom font (ex. normal or italic)\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style See MDN docs on font-style}.\n */\n style?: string;\n\n // @todo: implement these later\n // display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n // variationSettings?: string;\n // unicodeRange?: string; // or ideally, URange; //\n // see https://drafts.csswg.org/css-syntax-3/#urange-syntax and\n // https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range\n};\n\nexport const FontFaceConfigStruct: Describe<FontFaceConfig> = type({\n family: optional(string()),\n weight: optional(\n union([FontFaceWeightStruct, size(array(FontFaceWeightStruct), 2)]),\n ),\n src: optional(array(FontFaceSourceStruct)),\n style: optional(string()),\n display: optional(enums(['auto', 'block', 'swap', 'fallback', 'optional'])),\n variationSettings: optional(string()),\n unicodeRange: optional(string()),\n});\n\nexport type FontSizeConfig = {\n min: FontSizeConfigVal;\n max?: FontSizeConfigVal;\n};\n\nexport enum TextTransforms {\n inherit = 'As typed',\n capitalize = 'Capitalize',\n lowercase = 'Lowercase',\n uppercase = 'Uppercase',\n}\n\nexport enum FontStretches {\n 'ultra-condensed' = 'Ultra-condensed',\n 'extra-condensed' = 'Extra-condensed',\n condensed = 'Condensed',\n 'semi-condensed' = 'Semi-condensed',\n normal = 'Normal',\n 'semi-expanded' = 'Semi-expanded',\n expanded = 'Expanded',\n 'extra-expanded' = 'Extra-expanded',\n 'ultra-expanded' = 'Ultra-expanded',\n}\n\nexport type TypographyConfig = {\n /**\n * min / max height used to future-proof way of supporting responsive typography\n */\n fontSize?: FontSizeConfig;\n\n /**\n * reminder: line-heights can also be unitless!\n */\n lineHeight?: string | number;\n fontWeight?: FontFaceWeight;\n\n /**\n * note: letter-spacing can't be unitless, unit required!\n */\n letterSpacing?: string;\n\n /**\n * if not specified, Knapsack default font, otherwise should allow for a stack of font strings + fallbacks (including the names of custom registered fonts)\n */\n fontFamily?: string;\n\n textColor?: ColorConfig;\n\n textTransform?: keyof typeof TextTransforms;\n\n fontStretch?: keyof typeof FontStretches;\n};\n\nexport interface TypographyLinkConfig {\n fontWeight?: FontFaceWeight;\n textColor?: ColorConfig;\n hoverColor?: ColorConfig;\n underline?: boolean;\n textTransform?: keyof typeof TextTransforms;\n fontStretch?: keyof typeof FontStretches;\n}\n\nexport const TypographyLinkConfigStruct: Describe<TypographyLinkConfig> = type({\n fontWeight: optional(union([string(), number()])),\n textColor: optional(ColorConfigStruct),\n hoverColor: optional(ColorConfigStruct),\n underline: optional(boolean()),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nexport const FontSizeConfigStruct: Describe<FontSizeConfig> = type({\n min: FontSizeConfigValStruct,\n max: optional(FontSizeConfigValStruct),\n});\n\nexport const TypographyConfigStruct: Describe<TypographyConfig> = type({\n fontSize: optional(FontSizeConfigStruct),\n lineHeight: optional(union([string(), number()])),\n fontWeight: optional(union([string(), number()])),\n letterSpacing: optional(string()),\n fontFamily: optional(string()),\n textColor: optional(ColorConfigStruct),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nconst pageElementConfig: TypographyConfig = {};\nconst pageLinkElementConfig: TypographyLinkConfig = {};\n\nexport const pageElements = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport const pageElementsV2 = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingXLarge: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n headingXSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport type PageElementNames = keyof typeof pageElementsV2;\nexport type PageElementConfig = (typeof pageElementsV2)[PageElementNames];\n","import { Describe, type, union, optional } from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\nimport { TypographyConfig, TypographyConfigStruct } from './typography-config';\n\nexport interface NavCustomizationConfig extends TypographyConfig {\n accentColor?: ColorConfig;\n}\n\nexport interface PrimaryNavCustomizationConfig extends NavCustomizationConfig {\n hoverColor?: ColorConfig;\n backgroundColor?: ColorConfig;\n}\n\nexport type SecondaryNavCustomizationConfig = Omit<\n PrimaryNavCustomizationConfig,\n 'hoverColor'\n>;\n\nexport const NavCustomizationConfigStruct: Describe<NavCustomizationConfig> =\n union([\n TypographyConfigStruct,\n type({\n accentColor: optional(ColorConfigStruct),\n }),\n ]);\n\n// hoverColor: optional(ColorConfigStruct),\nexport const PrimaryNavCustomizationConfigStruct: Describe<PrimaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n hoverColor: optional(ColorConfigStruct),\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nexport const SecondaryNavCustomizationConfigStruct: Describe<SecondaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nconst navCustomizationConfig: NavCustomizationConfig = {};\nconst secondaryNavCustomizationConfig: SecondaryNavCustomizationConfig = {};\nconst primaryNavCustomizationConfig: PrimaryNavCustomizationConfig = {};\n\nexport const customizableNavElements = {\n primaryNav: primaryNavCustomizationConfig,\n secondaryNav: secondaryNavCustomizationConfig,\n tabs: navCustomizationConfig,\n} as const;\n\nexport type CustomizableNavElementNames = keyof typeof customizableNavElements;\nexport type CustomizableNavElementConfig =\n (typeof customizableNavElements)[CustomizableNavElementNames];\n","import * as s from 'superstruct';\n\nexport const strokeStyleValues = [\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n 'inset',\n] as const;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionSingular}\n */\ntype TokenDefinitionSingularRaw =\n | { type: 'string'; value: string }\n | { type: 'number'; value: number }\n | { type: 'boolean'; value: boolean }\n | { type: 'color'; value: string }\n | {\n type: 'strokeStyle';\n value: (typeof strokeStyleValues)[number];\n }\n | { type: 'dimension'; value: `${number}${'px' | 'rem' | 'em' | '%'}` }\n | { type: 'duration'; value: `${number}ms` }\n // | { type: 'fontFamily'; value: string | string[] }\n | {\n type: 'fontWeight';\n // @TODO: Include union of possible strings https://tr.designtokens.org/format/#font-weight\n value: string | number;\n }\n | { type: 'cubicBezier'; value: [number, number, number, number] };\n\n/**\n * Definitions for both singular (non-composite) tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinitionSingular<'dimension'>\n * ```\n */\nexport type TokenDefinitionSingular<\n TheTokenType extends TokenDefinitionSingularRaw['type'] = TokenDefinitionSingularRaw['type'],\n> = Extract<TokenDefinitionSingularRaw, { type: TheTokenType }>;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionComposite}\n */\ntype TokenDefinitionCompositeRaw =\n | {\n type: 'border';\n value: {\n color: { type: 'color' };\n style: { type: 'strokeStyle' };\n width: { type: 'dimension' };\n };\n }\n | {\n type: 'shadow';\n value: {\n color: { type: 'color' };\n offsetX: { type: 'dimension' };\n offsetY: { type: 'dimension' };\n spread: { type: 'dimension' };\n blur: { type: 'dimension' };\n inset: { type: 'boolean' };\n };\n }\n | {\n type: 'transition';\n value: {\n duration: { type: 'duration' };\n delay: { type: 'duration' };\n timingFunction: { type: 'cubicBezier' };\n };\n };\n// | {\n// type: 'gradient';\n// value: {\n// color: { type: 'color' };\n// position: { type: 'dimension' };\n// }[];\n// };\n\n/**\n * Definitions for composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionShadow = TokenDefinitionComposite<'shadow'>\n * ```\n */\nexport type TokenDefinitionComposite<\n TheTokenType extends TokenDefinitionCompositeRaw['type'] = TokenDefinitionCompositeRaw['type'],\n> = Extract<TokenDefinitionCompositeRaw, { type: TheTokenType }>;\n\n/**\n * Definitions for both singular and composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinition<'dimension'>\n * ```\n */\nexport type TokenDefinition<\n TheTokenType extends\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'] =\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'],\n> = Extract<\n TokenDefinitionComposite | TokenDefinitionSingular,\n { type: TheTokenType }\n>;\n\nexport type TokenReference = `{${string}}`;\n/** ensures there is no `{}` */\nexport type NotTokenReference<T> = T extends TokenReference ? never : T;\n\nexport function isTokenReference(val: unknown): val is TokenReference {\n if (typeof val !== 'string') return false;\n // total times `{` appears in `val`\n // Handle situation `{a.b} {c.d}`. Ensure count of `{` and `}` === 1. This\n // guarantees we ONLY support a single reference, ie `{a.b}`\n const totalOpenBrackets = val.split('{').length - 1;\n return totalOpenBrackets === 1 && val.startsWith('{') && val.endsWith('}');\n}\n\nexport function hasTokenReferences(val: unknown): boolean {\n return typeof val === 'string' && val.includes('{');\n}\n\nexport function isNotTokenReference<T>(\n value: T,\n): value is NotTokenReference<T> {\n return !isTokenReference(value);\n}\n\nexport const TokenReferenceStruct = s.define<TokenReference>(\n 'Token Reference',\n (value) => {\n if (typeof value !== 'string') return false;\n if (isNotTokenReference(value)) {\n return 'Must start and end with curly braces';\n }\n return true;\n },\n);\n\nexport type TokenType = TokenDefinition['type'];\nexport type TokenTypeComposite = TokenDefinitionComposite['type'];\nexport type TokenTypeSingular = TokenDefinitionSingular['type'];\nexport type TokenValueSingular = TokenDefinitionSingular['value'];\n\n// We make a Record to ensure we have *every* possible value\n// b/c TS will yell at us if a new one is added but isn't included here\n// then we make an array out of them, so we can be sure we have *every* possible value\nconst compositeTypesRecord: Record<TokenTypeComposite, TokenTypeComposite> = {\n border: 'border',\n shadow: 'shadow',\n transition: 'transition',\n};\nexport const tokenTypeComposites = Object.values(compositeTypesRecord);\nconst singularTypesRecord: Record<TokenTypeSingular, TokenTypeSingular> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n color: 'color',\n dimension: 'dimension',\n duration: 'duration',\n // fontFamily: 'fontFamily',\n fontWeight: 'fontWeight',\n strokeStyle: 'strokeStyle',\n cubicBezier: 'cubicBezier',\n};\nexport const tokenTypeSingulars = Object.values(singularTypesRecord);\n/**\n * @deprecated You probably want `isTokenDataComposite`\n * @see {isTokenDataComposite}\n */\nexport function isTokenTypeComposite(\n type: TokenType,\n): type is TokenTypeComposite {\n return tokenTypeComposites.includes(type as TokenTypeComposite);\n}\n\nexport function isTokenTypeSingular(\n type: TokenType,\n): type is TokenTypeSingular {\n return tokenTypeSingulars.includes(type as TokenTypeSingular);\n}\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport * as s from 'superstruct';\nimport {\n NotTokenReference,\n TokenDefinition,\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenReferenceStruct,\n TokenType,\n hasTokenReferences,\n isTokenTypeComposite,\n} from './token-definitions';\nimport { TokenKsExtensions, TokenOrder } from './token-misc';\nimport { TokenSrcValue } from './token-src';\n\n/** Used for tokens AND groups */\ntype TokenDataBothCommon = {\n id: string;\n description?: string;\n};\n\n// Shows what a fully de-referenced `value` of a composite token would be\ntype CreateDataValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: TokenDefinitionSingular<\n ValueObj[Key]['type']\n >['value'];\n};\n\nexpectType<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>[]\n>([\n {\n inset: false,\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n },\n {\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n inset: true,\n },\n]);\n\ntype TokenDataCommon<\n Info extends {\n /** Basically the ID */\n type: TokenDefinition['type'];\n value: unknown;\n },\n> = TokenDataBothCommon & {\n type: Info['type'];\n value: Info['value'];\n /**\n * Extracted from `$extensions['cloud.knapsack'].token`\n */\n tokenConfig?: TokenKsExtensions['token'];\n /**\n * Tokens that are references by this token\n * @todo will need to change for shadow\n * @example\n * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n references?: Array<string[]>;\n /**\n * Tokens that use this as a reference token\n * @see {CreateTokenData.references}\n * @example\n * * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n // referencedBy?: Array<string[]>;\n};\n\ntype CreateTokenData<\n Info extends {\n type: TokenDefinition['type'];\n value: unknown;\n },\n> =\n | ({\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n originalValue: TokenReference;\n } & TokenDataCommon<Info>)\n | ({\n kind: 'static';\n originalValue: NotTokenReference<TokenSrcValue<Info['type']>>;\n } & TokenDataCommon<Info>);\n\nconst TokenDataBaseStruct: s.Describe<\n TokenDataBothCommon & {\n references?: Array<string[]>;\n tokenConfig?: TokenKsExtensions['token'];\n }\n> = s.type({\n id: s.string(),\n description: s.optional(s.string()),\n references: s.optional(s.array(s.array(s.string()))),\n tokenConfig: s.optional(\n s.type({\n purpose: s.optional(s.string()),\n }),\n ),\n});\n\ntype TokenDataSingularRaw = {\n // ignore the key, this makes a discriminated union out of the values\n [TokenDef in TokenDefinitionSingular as TokenDef['type']]: Simplify<\n CreateTokenData<TokenDef>\n >;\n}[TokenDefinitionSingular['type']];\n\nexport type TokenDataSingular<\n TT extends TokenDataSingularRaw['type'] = TokenDataSingularRaw['type'],\n> = Extract<TokenDataSingularRaw, { type: TT }>;\n\nexpectType<TokenDataSingular[]>([\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'static',\n },\n {\n type: 'duration',\n value: '1ms',\n kind: 'ref',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'ref',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n kind: 'static',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'static',\n id: '1',\n originalValue: '#000',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'ref',\n id: '1',\n originalValue: '{c.b}',\n referencedTokenId: 'c.b',\n },\n {\n type: 'cubicBezier',\n kind: 'static',\n value: [0, 0, 0, 1],\n originalValue: [0, 0, 0, 1],\n id: '1',\n },\n]);\n\ntype TokenDataCompositeRaw = {\n [TokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenData<{\n type: TokenType;\n value: Simplify<\n CreateDataValueForComposite<\n TokenDefinitionComposite<TokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\nexport type TokenDataComposite<\n TheTokenType extends TokenDataCompositeRaw['type'] = TokenDataCompositeRaw['type'],\n> = Extract<TokenDataCompositeRaw, { type: TheTokenType }>;\n\nexport function isTokenDataComposite(\n tokenData: TokenData,\n): tokenData is TokenDataComposite {\n return isTokenTypeComposite(tokenData.type);\n}\n\nexpectType<TokenDataComposite[]>([\n {\n type: 'border',\n kind: 'static',\n id: '1',\n value: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n originalValue: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n },\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n value: {\n color: 'red',\n style: 'dashed',\n width: '2px',\n },\n originalValue: '{a.b}',\n },\n {\n type: 'shadow',\n value: {\n color: '#000',\n offsetX: '1px',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n originalValue: {\n color: '#000',\n offsetX: '{a.a}',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n id: '1',\n kind: 'static',\n },\n {\n type: 'shadow',\n kind: 'ref',\n referencedTokenId: 'a.b',\n value: {\n inset: true,\n color: 'red',\n offsetX: '1px',\n blur: '2px',\n offsetY: '3px',\n spread: '4px',\n },\n originalValue: '{a.b}',\n id: '1',\n },\n {\n type: 'transition',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: '{a.b}',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '{a.c}',\n timingFunction: '{a.c}',\n },\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n id: '1',\n },\n]);\n\nexport type TokenData<\n TheTokenType extends TokenDataSingular['type'] | TokenDataComposite['type'] =\n | TokenDataSingular['type']\n | TokenDataComposite['type'],\n> = Extract<TokenDataSingular | TokenDataComposite, { type: TheTokenType }>;\n\nexport type TokenGroupData = Simplify<\n {\n type?: TokenType;\n /**\n * Extracted from `$extensions['cloud.knapsack'].group`\n */\n groupConfig?: TokenKsExtensions['group'];\n children: TokenOrder;\n } & TokenDataBothCommon\n>;\n\n/**\n * @deprecated Use `TokenValueColorStruct` instead\n */\nexport function isTokenValueColor(\n value: unknown,\n): value is TokenDefinitionSingular<'color'>['value'] {\n return typeof value === 'string' && !hasTokenReferences(value);\n}\n\nexport const TokenValueColorStruct = s.define<TokenData<'color'>['value']>(\n 'Color Value',\n (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (value === '') {\n return 'Value must not be empty';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n },\n);\n\nconst TokenDataColorNonRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('static'),\n originalValue: TokenValueColorStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataColorRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDimensionStruct` instead\n */\nexport function isTokenValueDimension(\n value: unknown,\n): value is TokenDefinitionSingular<'dimension'>['value'] {\n return (\n typeof value === 'string' &&\n (value.endsWith('px') || value.endsWith('rem')) &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDimensionStruct = s.define<\n TokenData<'dimension'>['value']\n>('Dimension Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n if (\n !value.endsWith('px') &&\n !value.endsWith('rem') &&\n !value.endsWith('em') &&\n !value.endsWith('%')\n ) {\n return 'Value must end with px, rem, em or %';\n }\n return true;\n});\n\nconst TokenDataDimensionNonRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDimensionStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDimensionRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDurationStruct` instead\n */\nexport function isTokenValueDuration(\n value: unknown,\n): value is TokenDefinitionSingular<'duration'>['value'] {\n return (\n typeof value === 'string' &&\n value.endsWith('ms') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDurationStruct = s.define<\n TokenData<'duration'>['value']\n>('Duration Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n\n const durationRegex = /^\\d+ms$/;\n if (!durationRegex.test(value)) {\n return 'Value must be a number followed by \"ms\" (e.g., \"100ms\")';\n }\n\n return true;\n});\n\nconst TokenDataDurationNonRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDurationStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDurationRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueFontWeightStruct` instead\n */\nexport function isTokenValueFontWeight(\n value: unknown,\n): value is TokenDefinitionSingular<'fontWeight'>['value'] {\n return (\n (typeof value === 'string' || typeof value === 'number') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueFontWeightStruct = s.define<\n TokenData<'fontWeight'>['value']\n>('Font Weight Value', (value) => {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return 'Value must be a string or number';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n});\n\nconst TokenDataFontWeightNonRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('static'),\n originalValue: TokenValueFontWeightStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataFontWeightRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueCubicBezierStruct = s.define<\n TokenData<'cubicBezier'>['value']\n>('Cubic Bezier Value', (value) => {\n if (!Array.isArray(value)) {\n return 'Value must be an array';\n }\n if (value.length !== 4) {\n return 'Value must be an array of 4 numbers';\n }\n if (!value.every((v) => typeof v === 'number')) {\n return 'Value must be an array of 4 numbers';\n }\n // check if the first and third values are between 0 and 1\n // cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )\n if (value[0] < 0 || value[0] > 1 || value[2] < 0 || value[2] > 1) {\n return 'The first and third cubicBezier values must be between 0 and 1';\n }\n return true;\n});\n\nconst TokenDataCubicBezierNonRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('static'),\n originalValue: TokenValueCubicBezierStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataCubicBezierRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"shadow\" token value AND totally de-referenced\n */\nexport function isTokenValueShadow(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>\n> {\n return (\n isObject(value) &&\n isTokenValueColor(value.color) &&\n isTokenValueDimension(value.offsetX) &&\n isTokenValueDimension(value.offsetY) &&\n isTokenValueDimension(value.blur) &&\n isTokenValueDimension(value.spread)\n );\n}\n\nconst TokenValueShadowStruct = s.define<TokenData<'shadow'>['value']>(\n 'Shadow Value',\n (value) => {\n if (isTokenValueShadow(value)) return true;\n return `Expected a shadow value, got ${JSON.stringify(value)}`;\n },\n);\n\nconst TokenDataShadowNonRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n offsetX: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n offsetY: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n blur: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n spread: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n inset: s.union([\n // marking this as optional b/c it could be `undefined` instead of `false`\n s.optional(s.boolean()),\n TokenReferenceStruct,\n ]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataShadowRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueStrokeStyleStruct = s.union([\n s.literal('solid'),\n s.literal('dashed'),\n s.literal('dotted'),\n s.literal('double'),\n s.literal('groove'),\n s.literal('ridge'),\n s.literal('outset'),\n s.literal('inset'),\n]);\n\n/**\n * Determines if it's a \"border\" token value AND totally de-referenced\n */\nexport function isTokenValueBorder(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'border'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueColorStruct.is(value.color) &&\n TokenValueStrokeStyleStruct.is(value.style) &&\n TokenValueDimensionStruct.is(value.width)\n );\n}\n\nconst TokenValueBorderStruct = s.define<TokenData<'border'>['value']>(\n 'Border Value',\n isTokenValueBorder,\n);\n\nconst TokenDataBorderNonRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n style: s.union([TokenValueStrokeStyleStruct, TokenReferenceStruct]),\n width: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBorderRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"transition\" token value AND totally de-referenced\n */\nexport function isTokenValueTransition(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'transition'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueCubicBezierStruct.is(value.timingFunction) &&\n TokenValueDurationStruct.is(value.duration) &&\n TokenValueDurationStruct.is(value.delay)\n );\n}\nconst TokenValueTransitionStruct = s.define<TokenData<'transition'>['value']>(\n 'Transition Value',\n isTokenValueTransition,\n);\n\nconst TokenDataTransitionNonRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n timingFunction: s.union([\n TokenValueCubicBezierStruct,\n TokenReferenceStruct,\n ]),\n duration: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n delay: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataTransitionRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringNonRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('static'),\n originalValue: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleNonRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('static'),\n originalValue: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n// const TokenDataFontFamilyNonRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'static' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('static'),\n// originalValue: s.union([s.string(), s.array(s.string())]),\n// }),\n// TokenDataBaseStruct,\n// );\n\n// const TokenDataFontFamilyRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'ref' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('ref'),\n// originalValue: TokenReferenceStruct,\n// referencedTokenId: s.string(),\n// }),\n// TokenDataBaseStruct,\n// );\n\nconst TokenDataNumberNonRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('static'),\n originalValue: s.number(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataNumberRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanNonRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('static'),\n originalValue: s.boolean(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n// Instead of using `s.union` to combine all the token data structs,\n// we first find out what \"type\" the token is\n// then we find out `kind` - which is our 2nd layer of discriminated union\n// and then use the specific struct\n// that way the errors are more specific to the actual declared token \"type\"\n// In a nutshell, `s.union` is not very good at discriminated unions errors\nexport const assertTokenData = (data: unknown): asserts data is TokenData => {\n if (!isObject(data)) {\n throw new Error(\n `Expected token data to be an object, got ${JSON.stringify(data)}`,\n );\n }\n if (!isObjKey('type', data)) {\n throw new Error(\n `Expected token data to have a \"type\" property, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n if (typeof data.type !== 'string') {\n throw new Error(\n `Expected token data \"type\" property to be a string, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n const type = data.type as TokenData['type'];\n const kind = data.kind as TokenData['kind'];\n try {\n switch (type) {\n case 'boolean':\n if (kind === 'ref') {\n TokenDataBooleanRefStruct.assert(data);\n } else {\n TokenDataBooleanNonRefStruct.assert(data);\n }\n return;\n case 'border':\n if (kind === 'ref') {\n TokenDataBorderRefStruct.assert(data);\n } else {\n TokenDataBorderNonRefStruct.assert(data);\n }\n return;\n case 'color':\n if (kind === 'ref') {\n TokenDataColorRefStruct.assert(data);\n } else {\n TokenDataColorNonRefStruct.assert(data);\n }\n return;\n case 'cubicBezier':\n if (kind === 'ref') {\n TokenDataCubicBezierRefStruct.assert(data);\n } else {\n TokenDataCubicBezierNonRefStruct.assert(data);\n }\n return;\n case 'dimension':\n if (kind === 'ref') {\n TokenDataDimensionRefStruct.assert(data);\n } else {\n TokenDataDimensionNonRefStruct.assert(data);\n }\n return;\n case 'duration':\n if (kind === 'ref') {\n TokenDataDurationRefStruct.assert(data);\n } else {\n TokenDataDurationNonRefStruct.assert(data);\n }\n return;\n case 'fontWeight':\n if (kind === 'ref') {\n TokenDataFontWeightRefStruct.assert(data);\n } else {\n TokenDataFontWeightNonRefStruct.assert(data);\n }\n return;\n case 'number':\n if (kind === 'ref') {\n TokenDataNumberRefStruct.assert(data);\n } else {\n TokenDataNumberNonRefStruct.assert(data);\n }\n return;\n case 'shadow':\n if (kind === 'ref') {\n TokenDataShadowRefStruct.assert(data);\n } else {\n TokenDataShadowNonRefStruct.assert(data);\n }\n return;\n case 'string':\n if (kind === 'ref') {\n TokenDataStringRefStruct.assert(data);\n } else {\n TokenDataStringNonRefStruct.assert(data);\n }\n return;\n case 'strokeStyle': // temp implementation\n if (kind === 'ref') {\n TokenDataStrokeStyleRefStruct.assert(data);\n } else {\n TokenDataStrokeStyleNonRefStruct.assert(data);\n }\n return;\n // case 'fontFamily':\n // if (kind === 'ref') {\n // TokenDataFontFamilyRefStruct.assert(data);\n // } else {\n // TokenDataFontFamilyNonRefStruct.assert(data);\n // }\n // return;\n case 'transition':\n if (kind === 'ref') {\n TokenDataTransitionRefStruct.assert(data);\n } else {\n TokenDataTransitionNonRefStruct.assert(data);\n }\n return;\n default: {\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown token data type: ${type}`);\n }\n }\n } catch (error) {\n if (!(error instanceof s.StructError)) throw error;\n throw new Error(\n `Invalid token data for type \"${type}\": ${\n error.message\n }. Received this data: \"${JSON.stringify(data)}\"`,\n );\n }\n};\n","import { Simplify, expectType } from '@knapsack/utils';\nimport {\n TokenType,\n TokenDefinitionSingular,\n TokenDefinitionComposite,\n isTokenTypeComposite,\n isTokenTypeSingular,\n} from './token-definitions';\n\ntype CreateTokenSrcValueInfo<\n T extends {\n type: TokenType;\n value: unknown;\n },\n> =\n | {\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n isVarRef?: boolean;\n type: T['type'];\n }\n | {\n kind: 'static';\n type: T['type'];\n value: T['value'];\n };\n\ntype TokenSrcValueInfoSingularRaw = {\n // Ignore the key, pay attention to the value\n // The values become the items in the discriminated union\n [TheTokenType in TokenDefinitionSingular as TheTokenType['type']]: Simplify<\n CreateTokenSrcValueInfo<TheTokenType>\n >;\n}[TokenDefinitionSingular['type']];\n\n// This helper allows us to just pass the type string in to get that\n// item out of the discriminated union: `TokenSrcValueInfoSingular<'color'>`\ntype TokenSrcValueInfoSingular<\n TT extends TokenSrcValueInfoSingularRaw['type'] = TokenSrcValueInfoSingularRaw['type'],\n> = Extract<TokenSrcValueInfoSingularRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoSingular<'dimension'>[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'dimension',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n]);\n\ntype CreateSrcValueInfoForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: Simplify<\n CreateTokenSrcValueInfo<{\n type: ValueObj[Key]['type'];\n value: TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n }>\n >;\n};\n\ntype TokenSrcValueInfoCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenSrcValueInfo<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueInfoForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueInfoComposite<\n TT extends TokenSrcValueInfoCompositeRaw['type'] = TokenSrcValueInfoCompositeRaw['type'],\n> = Extract<TokenSrcValueInfoCompositeRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoComposite<'border'>[]>([\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'border',\n kind: 'static',\n value: {\n color: {\n kind: 'static',\n type: 'color',\n value: 'red',\n },\n style: {\n kind: 'ref',\n type: 'strokeStyle',\n referencedTokenId: '', // FIX\n },\n width: {\n kind: 'static',\n type: 'dimension',\n value: '2px',\n },\n },\n },\n]);\n\nexpectType<TokenSrcValueInfoComposite<'transition'>[]>([\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\nexport type TokenSrcValueInfo<\n TT extends\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'] =\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'],\n TheKind extends\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'] =\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'],\n> = Extract<\n TokenSrcValueInfoComposite | TokenSrcValueInfoSingular,\n { type: TT; kind: TheKind }\n>;\n\nexport function isTokenSrcValueInfoSingular(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoSingular {\n return isTokenTypeSingular(tokenSrcValueInfo?.type);\n}\nexport function isTokenSrcValueInfoComposite(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoComposite {\n return isTokenTypeComposite(tokenSrcValueInfo?.type);\n}\n\nexpectType<TokenSrcValueInfo[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'ref',\n // @ts-expect-error - with `kind: 'ref'`, `value` is not allowed\n value: '1px',\n },\n {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\n/**\n * A common object that is used to represent a token in the app.\n * Used in functions for editing communication between UI forms, Xstate,\n * and `@knapsack/design-tokens-utils`.\n */\nexport type TokenInfo<\n TheTokenType extends TokenSrcValueInfo['type'] = TokenSrcValueInfo['type'],\n> = {\n tokenSrcValueInfo: TokenSrcValueInfo<TheTokenType>;\n tokenId: string;\n description?: string;\n};\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport {\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenType,\n TokenDefinition,\n} from './token-definitions';\nimport { TokenKsExtensions } from './token-misc';\n\nexport type TokenSrcCommon<TheType extends TokenType = TokenType> = {\n $type?: TokenDefinition<TheType>['type'];\n $description?: string;\n $extensions?: {\n 'cloud.knapsack'?: TokenKsExtensions;\n };\n};\n\nexport function isTokenSrcExtensions(\n extensionsObj: unknown,\n): extensionsObj is TokenSrcCommon['$extensions'] {\n return isObject(extensionsObj) && isObjKey('cloud.knapsack', extensionsObj);\n}\n\ntype CreateSrcValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]:\n | TokenReference\n | TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n};\n\ntype TokenSrcValueCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueComposite<\n TT extends TokenSrcValueCompositeRaw['type'] = TokenSrcValueCompositeRaw['type'],\n> = Extract<TokenSrcValueCompositeRaw, { type: TT }>;\n\ntype TokenSrcValueRaw = TokenDefinitionSingular | TokenSrcValueComposite;\n\nexport type TokenSrcValue<\n Type extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Extract<TokenSrcValueRaw, { type: Type }>['value'] | TokenReference;\n\nexpectType<TokenSrcValue[]>([\n '#ddd',\n true,\n [83, 1, 1, 1],\n {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n {\n inset: true,\n color: '#000',\n offsetX: '0px',\n offsetY: '{spacing.medium}',\n spread: '0px',\n blur: '0px',\n },\n {\n timingFunction: '{timing.ease}',\n duration: '{timing.duration.medium}',\n delay: '7ms',\n color: '#000',\n },\n]);\n\nexport type TokenSrc<\n TheType extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Simplify<\n {\n $value: TokenSrcValue<TheType>;\n } & TokenSrcCommon<TheType>\n>;\n\nexport function isTokenSrc(tokenObject: unknown): tokenObject is TokenSrc {\n if (isObject(tokenObject) && isObjKey('$value', tokenObject)) return true;\n return false;\n}\n\nexport type TokenSrcGroup = TokenSrcCommon & {\n [key: string]:\n | TokenSrcGroup\n | TokenSrc\n | TokenSrcCommon\n | TokenSrcCommon['$extensions'];\n};\n\nexport function isTokenGroup(\n tokenObject: unknown,\n): tokenObject is TokenSrcGroup {\n // @todo improve\n return (\n isObject(tokenObject) &&\n !isTokenSrcExtensions(tokenObject) &&\n !isObjKey('$value', tokenObject) &&\n // ensuring we are not in `$extensions` object\n !isObjKey('cloud.knapsack', tokenObject)\n );\n}\n\n// Token VAR references look like TokenSrcGroup\nexport function isTokenTypeVarRef(tokenObject: unknown) {\n // It's at least a TokenSrcGroup\n if (isTokenGroup(tokenObject)) {\n // The specific key within collectionInfo with the var reference\n const varRefCollectionInfo =\n tokenObject.$extensions['cloud.knapsack'].group.collectionInfo;\n if (\n isObjKey('type', varRefCollectionInfo) &&\n isObjKey('referenceId', varRefCollectionInfo)\n ) {\n return true;\n }\n }\n\n return false;\n}\n","import { parseNumberWithUnit } from '@knapsack/utils';\n\nexport function getPrimitiveValue(\n tokenValue: unknown,\n): 'string' | 'number' | 'boolean' {\n const type = typeof tokenValue;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return type;\n }\n throw new Error(\n `Invalid token value type: ${JSON.stringify(\n type,\n )}. Token value is: ${JSON.stringify(tokenValue)}`,\n );\n}\n\nexport type TokenDimensionUnit = 'px' | 'rem' | 'em' | '%';\n\n/**\n * Dimension strings require ending in 'px' or 'rem'\n * @see `libs/types/src/app-client-data/design-tokens-types/token-definitions.ts`\n */\nexport const isDimensionString = (\n value: string,\n): value is `${number}${'px' | 'rem' | 'em' | '%'}` =>\n value.includes('px') ||\n value.includes('rem') ||\n value.includes('em') ||\n value.includes('%');\n\n/**\n * Pass in values like `'12px'` to get detailed info\n * @throws if value is not a number or does not end in supported unit\n */\nexport function parseTokenDimensionValue(valueToParse: string | number): {\n value: number;\n unit?: TokenDimensionUnit;\n} {\n const { value, unit } = parseNumberWithUnit(valueToParse);\n if (!unit) {\n return { value };\n }\n if (unit !== 'px' && unit !== 'rem' && unit !== 'em' && unit !== '%') {\n throw new Error(`Invalid unit \"${unit}\" for value: ${value}`);\n }\n\n return { value, unit };\n}\n","import type { CSSProperties } from 'react';\nimport type { JsonSchemaObject } from '../json-schema';\nimport { RendererId } from '../renderers';\nimport { isObject } from '../type-utils';\nimport type { BlockConfig } from './blocks';\nimport type { Page, PageTab } from './page';\nimport { TokenSrcValueInfo } from './design-tokens-types/token-src-value-info';\n\nexport interface KsStatus {\n id: string;\n title: string;\n color?: string;\n}\n\nexport interface KsStatusSet {\n id: string;\n title: string;\n statuses: KsStatus[];\n}\n\n/**\n * Used by template renderers in addition to `path`\n * Twig: `@components/button.twig`\n * Web Components: `my-button` => `<my-button>`\n * React: a named export of the file if not `default`\n * @todo Replace this with `rendererOptions`\n */\ntype TemplateAlias = string;\n\nexport type SlottedTemplateDemo = {\n type: 'template-demo';\n /** @deprecated */\n patternId: string;\n /** @deprecated */\n templateId: string;\n /**\n * The demo referenced by `demoId` is inlined here before sending to server to\n * render, but is never stored in the json data. If this is present, it is\n * used instead of the demo referenced by `demoId`. This is done to ensure\n * server has all the latest data for a template demo by ensuring it includes\n * it's slotted children's data.\n * @see {inlineDemoData}\n */\n demo?: DataDemo;\n demoId: DemoBase['id'];\n};\n\n/**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {KsSlotInfo['isTemplateReference']}\n */\nexport type SlottedTemplateReference = {\n type: 'template-reference';\n patternId: string;\n templateId: string;\n};\n\nexport type SlottedText = {\n type: 'text';\n text: string;\n};\n\nexport type SlottedData =\n | SlottedText\n | SlottedTemplateDemo\n | SlottedTemplateReference;\n\n/** @deprecated - just check `type` */\nexport const isSlottedText = (\n slottedData: unknown,\n): slottedData is SlottedText =>\n isObject(slottedData) && slottedData.type === 'text';\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateDemo(\n slottedData: unknown,\n): slottedData is SlottedTemplateDemo {\n return isObject(slottedData) && slottedData.type === 'template-demo';\n}\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateReference(\n slottedData: unknown,\n): slottedData is SlottedTemplateReference {\n return isObject(slottedData) && slottedData.type === 'template-reference';\n}\n\n/**\n * Collection ID: Mode ID\n */\nexport type ThemeDefinition = {\n [collectionId: string]: string;\n};\n\nexport type SlotOptions = {\n /**\n * @default 'div'\n */\n wrappingElementName?: string;\n cssClasses?: string[];\n align?: {\n value:\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'left'\n | 'center'\n | 'right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n };\n layout?: {\n value: 'horizontal' | 'vertical' | 'wrap';\n };\n gap?: {\n value: TokenSrcValueInfo<'dimension'>;\n };\n paddingHorizontal?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n paddingVertical?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n /**\n * Collection ID: Mode ID\n */\n theme?: ThemeDefinition;\n};\n\n/**\n * These are created from {SlotOptions}\n * Only available in App Client for rendering - this is NOT saved in App Client Data\n */\nexport type SlotOptionsComputed = {\n styles: CSSProperties;\n cssClasses: string[];\n /**\n * @default 'div'\n */\n wrappingElementName: string;\n /**\n * can't be `style` or `class` or `className`\n */\n attributes: {\n [attributeName: string]: string;\n };\n};\n\nexport type KnapsackTemplateData = {\n /**\n * @todo Ideal would be `{ [key: string]: string | boolean | number }`\n */\n props: {\n [prop: string]: any;\n };\n slots?: {\n [slotName: string]: Array<SlottedData>;\n };\n /**\n * Settings from users are stored here and saved in App Client Data\n * This is used to dynamically create `slotsOptionsComputed`\n */\n slotsOptions?: {\n [slotName: string]: SlotOptions;\n };\n /**\n * Use `slotsOptions` to set & save styles on slotted children\n * Never set nor stored in App Client Data that gets saved\n * This is only inlined in the demo data for rendering so the App Client can\n * apply the styles to the slotted children\n * @see {inlineDemoData}\n */\n slotsOptionsComputed?: {\n [slotName: string]: SlotOptionsComputed;\n };\n};\n\ntype DemoType = 'data' | 'template';\n\ntype DemoBase = {\n id: string;\n title: string;\n description?: string;\n /**\n * Would override what was on the template\n */\n assetSetId?: string;\n width?: number;\n height?: number;\n type: DemoType;\n /** Collection ID: Mode ID */\n theme?: ThemeDefinition;\n};\n\n/**\n * Shows usage\n */\nexport type DataDemo = DemoBase & {\n type: 'data';\n patternId: string;\n templateId: string;\n data: KnapsackTemplateData;\n};\n\n/**\n * Shows source code\n */\nexport type TemplateDemo = DemoBase & {\n type: 'template';\n templateInfo: {\n alias?: TemplateAlias;\n path?: string;\n };\n};\n\nexport type Demo = TemplateDemo | DataDemo;\n\nexport type RenderDataDemo = Demo & {\n inlineStyles?: string;\n bodyAttributes?: Record<string, string>;\n};\n\n/** @deprecated */\nexport enum StageLayouts {\n portrait = 'portrait',\n landscape = 'landscape',\n}\n\nexport function isDataDemo(demo: TemplateDemo | DataDemo): demo is DataDemo {\n return demo?.type === 'data';\n}\n\nexport function isTemplateDemo(demo: Demo): demo is TemplateDemo {\n return demo?.type === 'template';\n}\n\nexport type KsSlotInfo = {\n title: string;\n description?: string;\n disallowText?: boolean;\n isRequired?: boolean;\n allowOnlyOne?: boolean;\n /**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {SlottedTemplateReference}\n */\n isTemplateReference?: boolean;\n allowedPatternIds?: string[];\n};\n\n/**\n * Supersedes `schema`\n */\nexport type KsTemplateSpec = {\n /**\n * Attempt to create the props & slots spec by reading the source file.\n * Prevents ability to use spec editor.\n *\n * If `true`, then uses the template `alias` & `path` to find the file.\n *\n * If a string, then that file path is used in place of the source file.\n *\n * Scenario: the `path` is used to point to a compiled file w types stripped\n * and this is used to point to either the source file w types or the compiled\n * `.d.ts` file. Currently only React is supported. The file extension\n * determines if TypeScript (ts/tsx) or PropTypes (js/jsx) is used for\n * inference.\n */\n isInferred?: boolean | string;\n /**\n * JSON Schema defining the serializable data passed in\n * The classic, formerly `schema`\n */\n props?: JsonSchemaObject;\n /**\n * Child component slots\n */\n slots?: {\n [name: string]: KsSlotInfo;\n };\n /**\n * @todo evaluate & refine\n */\n // cssProps?: {\n // [name: string]: {\n // title: string;\n // description: string;\n // };\n // };\n hidePropsTable?: boolean;\n hideSlotsTable?: boolean;\n /**\n * Extra Docs are each shown in their own table.\n * Useful for non-traditional spec docs that are more template language specific.\n * Examples: events, methods, etc\n */\n extraDocs?: {\n id: string;\n title: string;\n description?: string;\n tableRows?: {\n [columnTitle: string]: string;\n }[];\n }[];\n};\n\nexport interface KnapsackPatternTemplate {\n id: string;\n title?: string;\n /**\n * Relative file path to the template from the config file it is declared in\n */\n path: string;\n\n alias?: TemplateAlias;\n /**\n * Which template language? i.e. `twig`, `react` Replaces\n * KnapsackTemplateRenderer.test which ran a test on the file path (similar to\n * how WebPack loader `test` works)\n */\n templateLanguageId: RendererId;\n assetSetIds?: string[];\n spec?: KsTemplateSpec;\n /** Array of demo IDs, actual demo data is stored in `db.demos.demosById` */\n demoIds: Demo['id'][];\n /** Array of block IDs, actual block content is stored in db.blocks.blocksById */\n blockIds: BlockConfig['id'][];\n}\n\nexport type KnapsackPattern = Page & {\n $schema?: string;\n statuses?: {\n [statusSetId: string]: string;\n };\n templates?: KnapsackPatternTemplate[];\n subPages?: {\n id: string;\n title: string;\n blockIds: BlockConfig['id'][];\n }[];\n designSrcComponentsById?: Record<\n string,\n {\n id: string;\n title: string;\n componentId: string;\n fileId: string;\n }\n >;\n /** Controls order of `templates` & `subPages` on Pattern Page */\n tabs?: PageTab[];\n\n aliases?: string[];\n /**\n * Prevents pattern from appearing in System Overview and Status Table blocks\n */\n hideFromOverviewBlocks?: boolean;\n /**\n * Prevents pattern from appearing as an option in Component Embed and\n * Component Demo blocks\n */\n hideFromComponentBlocks?: boolean;\n};\n\nexport interface KnapsackPatternTemplateCode {\n html: string;\n data?: Record<string, any>;\n templateSrc: string;\n usage: string;\n language: string;\n}\n\nexport type KnapsackPatternsConfig = {\n $schema?: string;\n statusSets: KsStatusSet[];\n};\n\nexport interface TemplateRendererMeta {\n id: RendererId;\n title: string;\n version?: string;\n aliasTitle?: string;\n aliasDescription?: string;\n aliasUse: 'off' | 'optional' | 'required';\n aliasIsJsNamedExport?: boolean;\n syntaxHighlightingLanguage?: string;\n enableDataDemos: boolean;\n enableTemplateDemos: boolean;\n hasSlotsSupport: boolean;\n hasSlotOptionsSupport?: boolean;\n hasInferSpecSupport: boolean;\n hasTemplateSuggestionsSupport: boolean;\n prototypingTemplate?: {\n path: string;\n alias?: string;\n spec: Pick<KsTemplateSpec, 'props' | 'slots' | 'isInferred'>;\n };\n}\n\nexport type PatternsState = {\n patterns: {\n [id: string]: KnapsackPattern;\n };\n renderers: Partial<\n Record<\n RendererId,\n {\n meta: TemplateRendererMeta;\n }\n >\n >;\n} & KnapsackPatternsConfig;\n","import { ColorConfig } from '../color-config';\n\nexport enum PageHeaderSizes {\n auto = 'auto',\n small = 'small',\n medium = 'medium',\n large = 'large',\n full = 'full',\n}\n\nexport interface PageHeaderSettings {\n size?: `${PageHeaderSizes}`;\n backgroundImage?: string;\n backgroundColor?: ColorConfig;\n backgroundOverlay?: boolean;\n backgroundSize?: 'cover' | 'contain' | 'string';\n backgroundPosition?: 'left' | 'center' | 'right' | 'string';\n backgroundRepeat?: 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat';\n hideText?: boolean;\n textColorTitle?: ColorConfig;\n textColorDescription?: ColorConfig;\n}\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { TokenSrcGroup } from './design-tokens-types';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { BlockConfig } from './blocks';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { Demo, PatternsState } from './patterns';\nimport { UiConfig } from '../ui-config';\nimport { PagesSettings } from './page';\nimport { BlocksSettings } from './blocks.settings';\nimport { DesignSrcFile } from '../design-src.types';\n\nexport * from './asset-sets';\nexport * from './blocks';\nexport * from './custom-pages';\nexport * from './design-tokens';\nexport * from './design-tokens-types';\nexport * from './nav';\nexport * from './files';\nexport * from './meta';\nexport * from './patterns';\nexport { PageHeaderSizes } from './page.header';\nexport type { PageHeaderSettings } from './page.header';\nexport type { PageTab, PageType } from './page';\n\nexport interface KsAppClientData {\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensSrc: TokenSrcGroup;\n metaState?: MetaState;\n filesState: KsFiles;\n db: {\n blocks: {\n byId: Record<string, BlockConfig>;\n settings: BlocksSettings;\n };\n demos: {\n byId: Record<string, Demo>;\n // \"never\" for now until there are actual settings for demos\n settings: Record<string, never>;\n };\n settings: {\n title?: string;\n hideTitleInNavigation?: boolean;\n logoUrl?: string;\n favicon?: `https://${string}`;\n theme?: UiConfig;\n pages?: PagesSettings;\n designSrcs?: {\n files?: DesignSrcFile[];\n };\n tokens?: {\n theming?: {\n /** Which template languages theming controls will show up for next to the components preview stage. */\n enabledRendererIds?: string[];\n };\n };\n prototyping?: {\n patternId: string;\n };\n };\n };\n}\n\nexport type KsAppClientDataNoMeta = Omit<KsAppClientData, 'metaState'>;\nexport type KsAppClientDataAndMeta = Required<KsAppClientData>;\n\nexport function isKsAppClientDataNoMeta(\n data: unknown,\n): data is KsAppClientDataNoMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataNoMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'db',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStruct = define<KsAppClientDataNoMeta>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMeta,\n);\n\nexport function isKsAppClientDataAndMeta(\n data: unknown,\n): data is KsAppClientDataAndMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataAndMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'metaState',\n 'db',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStruct = define<KsAppClientDataAndMeta>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMeta,\n);\n\nexport const KsMetaStateStruct: Describe<KsAppClientData['metaState']> = type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n});\n\nexport const isKsMetaState = KsMetaStateStruct.is;\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { KsDesignTokensState } from './design-tokens';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { PatternsState } from './patterns';\nimport type { KnapsackSettings } from './settings';\n\nexport type {\n KsDesignToken,\n KsDesignTokenAttributes,\n KsDesignTokenData,\n KsDesignTokenDataGroup,\n KsDesignTokenSrc,\n KsDesignTokenSrcGroup,\n KsDesignTokensState,\n KsTokenType,\n KsTokenValue,\n KnapsackDesignToken,\n} from './design-tokens';\n\nexport interface KsAppClientDataV3 {\n settingsState: {\n settings: KnapsackSettings;\n };\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensState: KsDesignTokensState;\n metaState?: MetaState;\n filesState: KsFiles;\n}\n\nexport type KsAppClientDataNoMetaV3 = Omit<KsAppClientDataV3, 'metaState'>;\nexport type KsAppClientDataAndMetaV3 = Required<KsAppClientDataV3>;\n\nexport function isKsAppClientDataNoMetaV3(\n data: unknown,\n): data is KsAppClientDataNoMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataNoMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStructV3 = define<KsAppClientDataNoMetaV3>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMetaV3,\n);\n\nexport function isKsAppClientDataAndMetaV3(\n data: unknown,\n): data is KsAppClientDataAndMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataAndMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n 'metaState',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStructV3 = define<KsAppClientDataAndMetaV3>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMetaV3,\n);\n\nexport const KsMetaStateStructV3: Describe<KsAppClientDataV3['metaState']> =\n type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n });\n\nexport const isKsMetaStateV3 = KsMetaStateStructV3.is;\n","import { isDraft, type Draft } from 'immer';\nimport { Migration } from './migration.types';\nimport { KnapsackPattern, SlottedData } from '../app-client-data/patterns';\n\ntype Migration417DemosType = {\n version: string;\n checkIfNeeded: (appClientData: any) => boolean;\n migrate: (appClientData: Draft<any>) => void;\n};\n\nexport const migration417Demos: Migration417DemosType = {\n version: '4.1.7',\n checkIfNeeded: (appClientData) => {\n // this one will be tough to check for, so we'll just assume it's needed\n return true;\n },\n // note that `appClientData` is mutable since we're already in Immer\n migrate: (appClientData) => {\n if (!isDraft(appClientData)) {\n throw new Error(\n `Tried to run migrations on appClientData but it is not an Immer Draft`,\n );\n }\n Object.values(appClientData.patternsState.patterns).forEach(\n (\n pattern: Draft<\n KnapsackPattern & {\n demoSize?: string;\n }\n >,\n ) => {\n delete pattern.demoSize;\n },\n );\n\n Object.values(appClientData.db.demos.byId).forEach((demo) => {\n if (demo.type !== 'data') return;\n\n Object.entries(demo.data.slots ?? {}).forEach(([slotName, slotData]) => {\n demo.data.slots[slotName] = slotData.map(\n (slottedData: Draft<SlottedData | string>) => {\n // it used to be just a string\n if (typeof slottedData === 'string') {\n return {\n type: 'text',\n text: slottedData,\n };\n }\n if (\n // not doing anything with these\n slottedData.type === 'template-reference' ||\n // these already were migrated or made by the new editor\n slottedData.type === 'text'\n ) {\n return slottedData;\n }\n // these used to not have a type set\n slottedData.type = 'template-demo';\n return slottedData;\n },\n );\n });\n\n if (demo.patternId && demo.templateId) return;\n\n // using an IIFE so we can stop looping once we find it\n // would use `break` but it's a double loop\n (() => {\n for (const { id: pId, templates = [] } of Object.values(\n appClientData.patternsState.patterns,\n )) {\n for (const { id: tId, demoIds = [] } of templates) {\n if (demoIds.includes(demo.id)) {\n demo.patternId = pId;\n demo.templateId = tId;\n // found it - stop looking\n return;\n }\n }\n }\n })();\n });\n },\n} satisfies Migration;\n","// import { JSONSchema7 } from 'json-schema'; @todo consider using instead; though I'm not seeing it make it's way to the compiled JSON schema themselves via `convert-types-to-json-schmea.js`\n\ntype PropBase<Type = any> = {\n title?: string;\n description?: string;\n default?: Type;\n};\n\nexport enum PropTypeNames {\n 'string' = 'string',\n 'boolean' = 'boolean',\n 'number' = 'number',\n 'object' = 'object',\n 'options' = 'options',\n 'function' = 'function',\n 'customTypeScript' = 'customTypeScript',\n 'array' = 'array',\n 'arrayOfObjects' = 'arrayOfObjects',\n 'arrayOfStrings' = 'arrayOfStrings',\n 'arrayOfNumbers' = 'arrayOfNumbers',\n 'unknown' = 'unknown',\n}\nexport type PropTypeNamesList = keyof typeof PropTypeNames;\n\nexport type StringProp = {\n type: 'string';\n} & PropBase<string>;\n\nexport type BooleanProp = {\n type: 'boolean';\n} & PropBase<boolean>;\n\nexport type NumberProp = {\n type: 'number';\n} & PropBase<number>;\n\nexport type OptionsProp = {\n type: 'string';\n enum: string[];\n enumNames?: string[];\n} & PropBase<string>;\n\nexport type CustomTypeScriptProp = {\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n type?: never;\n default?: string;\n} & PropBase<string>;\n\nexport type FunctionProp = {\n typeof: 'function';\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n default?: string;\n type?: 'string';\n} & PropBase<string>;\n\nexport type ObjectProp = {\n type: 'object';\n additionalProperties?: boolean;\n required?: string[];\n properties: {\n [prop: string]: PropertyTypes;\n };\n} & PropBase;\n\nexport type ArrayProp = {\n type: 'array';\n items: PropertyTypes;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfStringsProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: StringProp;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfNumbersProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: NumberProp;\n} & PropBase<number[]>;\n\nexport type ArrayOfObjectsProp = {\n type: 'array';\n items: ObjectProp;\n} & PropBase<Array<Record<string, unknown>>>;\n\nexport type PropertyTypes =\n | StringProp\n | BooleanProp\n | NumberProp\n | OptionsProp\n | FunctionProp\n | CustomTypeScriptProp\n | ObjectProp\n | ArrayOfObjectsProp\n | ArrayOfStringsProp\n | ArrayOfNumbersProp\n | ArrayProp;\n\nexport const isStringProp = (prop: PropertyTypes): prop is StringProp =>\n 'type' in prop && prop.type === 'string' && !('enum' in prop);\nexport const isNumberProp = (prop: PropertyTypes): prop is NumberProp =>\n 'type' in prop && prop.type === 'number';\nexport const isBooleanProp = (prop: PropertyTypes): prop is BooleanProp =>\n 'type' in prop && prop.type === 'boolean';\nexport const isOptionsProp = (prop: PropertyTypes): prop is OptionsProp =>\n 'enum' in prop;\nexport const isFunctionProp = (prop: PropertyTypes): prop is FunctionProp =>\n 'typeof' in prop && prop?.typeof === 'function';\nexport const isCustomTypeScriptProp = (\n prop: PropertyTypes,\n): prop is CustomTypeScriptProp => !('typeof' in prop) && 'tsType' in prop;\nexport const isArrayOfObjectsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfObjectsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'object';\nexport const isObjectProp = (prop: PropertyTypes): prop is ObjectProp =>\n 'type' in prop &&\n prop.type === 'object' &&\n 'properties' in prop &&\n Object.keys(prop.properties).length > 0;\nexport const isArrayOfStringsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfStringsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'string';\nexport const isArrayOfNumbersProp = (\n prop: PropertyTypes,\n): prop is ArrayOfNumbersProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'number';\n\nexport interface PropTypeDataBase {\n type: any;\n id: string;\n isRequired?: boolean;\n data: any;\n}\n\nexport interface StringPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.string;\n data: StringProp;\n}\n\nexport interface BooleanPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.boolean;\n data: BooleanProp;\n}\n\nexport interface NumberPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.number;\n data: NumberProp;\n}\n\nexport interface OptionsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.options;\n data: OptionsProp;\n}\n\nexport interface FunctionPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.function;\n data: FunctionProp;\n}\n\nexport interface CustomTypeScriptPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.customTypeScript;\n data: CustomTypeScriptProp;\n}\n\nexport interface ObjectPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.object;\n data: ObjectProp;\n}\n\nexport interface ArrayOfObjectsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfObjects;\n data: ArrayOfObjectsProp;\n}\n\nexport interface ArrayOfStringsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfStrings;\n data: ArrayOfStringsProp;\n}\n\nexport interface ArrayOfNumbersPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfNumbers;\n data: ArrayOfNumbersProp;\n}\n\nexport interface ArrayPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.array;\n data: ArrayProp;\n}\n\nexport type PropTypeData =\n | StringPropTypeData\n | BooleanPropTypeData\n | NumberPropTypeData\n | OptionsPropTypeData\n | FunctionPropTypeData\n | CustomTypeScriptPropTypeData\n | ObjectPropTypeData\n | ArrayOfObjectsPropTypeData\n | ArrayOfStringsPropTypeData\n | ArrayOfNumbersPropTypeData;\n\nexport type JsonSchemaObject<PropNames extends string = string> = {\n $schema?: string;\n title?: string;\n description?: string;\n type: 'object';\n required?: PropNames[];\n properties: Record<PropNames, PropertyTypes>;\n examples?: Record<string, unknown>[];\n};\n","import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n id: UUID;\n date: DateString;\n};\nexport type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event'>;\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n","import type { FeedbackTypes } from './misc';\n\nexport enum KsRendererClientEvents {\n ready = 'ready',\n}\n\n/**\n * Message sent from the renderer client (in the iframe) to the App UI parent window\n * using `window.parent.postMessage()`.\n * Note that this likely will become a union type of all possible messages\n */\nexport type KsRendererClientMsg =\n | {\n /**\n * Sent when a `ResizeObserver` detects a change in the contents height or width.\n */\n type: 'ksRendererClient.contentResized';\n height: number;\n width: number;\n }\n | {\n type: 'ksRendererClient.showToast';\n msg: string;\n feedbackType?: FeedbackTypes;\n };\n\n/**\n * The meta data is stored in a script tag with this id\n * @see {KsRendererClientMeta}\n */\nexport const ksRendererClientMetaId = 'ks-meta';\n\n/**\n * Metadata about the current renderer client demo\n * @see {ksRendererClientMetaId} for the ID of the script tag\n */\nexport interface KsRendererClientMeta {\n patternId: string;\n templateId: string;\n demoId: string;\n assetSetId: string;\n isInIframe: boolean;\n websocketsPort: number;\n}\n","export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha: string;\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n","export const endpoint = `/plugins`;\n\nexport enum ACTIONS {\n getContent = 'getContent',\n}\n\nexport interface GetContentRequest {\n type: ACTIONS.getContent;\n pluginId: string;\n}\n\nexport interface GetContentResponse {\n type: ACTIONS.getContent;\n ok: boolean;\n message?: string;\n payload: Record<string, unknown>;\n}\n\nexport type ActionRequests = GetContentRequest;\n\nexport type ActionResponses = GetContentResponse;\n","import type { RendererId } from '../renderers';\n\nexport const endpoint = `/files`;\n\nexport enum ACTIONS {\n verify = 'verify',\n}\n\nexport interface VerifyData {\n type: ACTIONS.verify;\n payload: {\n path: string;\n rendererId: RendererId;\n };\n}\n\nexport interface VerifyDataResponse {\n type: ACTIONS.verify;\n payload: {\n exists: boolean;\n relativePath: string;\n absolutePath: string;\n type: 'absolute' | 'relative' | 'package' | 'unknown';\n };\n}\n\nexport type Actions = VerifyData;\n\nexport type ActionResponses = VerifyDataResponse;\n","/**\n * The roles here are duplicates of the roles in the database.\n * It needs to be here, in the types package, so it can be used in all packages.\n * If we pull it in from `@knapsack/hasura-gql-client`, which is the source, we get a dependency cycle. So we do it this way.\n * If the roles change in the database, we need to change them here too. We will get a build error if we don't (see code in `@knapsack/hasura-gql-client`).\n */\n\nexport const rolesById = {\n ADMIN: 'ADMIN',\n ANONYMOUS: 'ANONYMOUS',\n CONTRIBUTOR: 'CONTRIBUTOR',\n EDITOR: 'EDITOR',\n MANAGER: 'MANAGER',\n VIEWER: 'VIEWER',\n} as const;\nexport const roles = Object.values(rolesById);\nexport type Role = keyof typeof rolesById;\n","import { KsAppClientDataAndMeta } from '@knapsack/types';\n\nexport type SiteDeployedWebhookBody = {\n siteId: string;\n appClientData: KsAppClientDataAndMeta;\n};\n\nexport const siteDeployedWebhookEndpoint = '/site-deployed';\n\nexport const gitHubOauthInternalEndpoint = '/github-auth';\n","import { isUrl } from '@knapsack/utils';\n\nconst { KS_DB_URL } = process.env;\nif (KS_DB_URL && !isUrl(KS_DB_URL)) {\n throw new Error(`KS_DB_URL is not a valid URL: '${KS_DB_URL}'`);\n}\nconst dbUrl = KS_DB_URL || 'https://db.knapsack.cloud';\nconst dbGqlEndpoint = new URL('/v1/graphql', dbUrl).toString();\n\nexport const ksUrls = {\n /**\n * Base URL for Knapsack DB (Hasura)\n * @default 'https://db.knapsack.cloud'\n */\n dbUrl,\n /**\n * App DB GraphQL endpoint for connecting to Hasura GraphQL.\n * @default 'https://db.knapsack.cloud/v1/graphql'\n */\n dbGqlEndpoint,\n};\n","export const ksHttpHeaders = {\n siteId: 'X-KS-Site-ID',\n instanceId: 'X-KS-Instance-Id',\n appClientVersion: 'X-KS-App-Client-Version',\n};\n"]}
|