@knapsack/types 4.70.5--canary.4921.ef6d5e7.0 → 4.70.5--canary.4921.a127e88.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ function _interopNamespace(e) {
28
28
  var t__namespace = /*#__PURE__*/_interopNamespace(t);
29
29
  var Re__default = /*#__PURE__*/_interopDefault(Re);
30
30
 
31
- var Ie=Object.defineProperty;var o=(e,r)=>Ie(e,"name",{value:r,configurable:!0});function Ne(e){if(typeof e!="string")return !1;try{return !!Re__default.default.get(e)}catch{return !1}}o(Ne,"isColor");var F=t.define("ColorStringStruct",e=>typeof e=="string"&&Ne(e)),p=t.union([t.type({type:t.literal("value"),colorValue:F}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),rn=t.type({type:t.literal("design-token"),tokenName:t.string()});var un=["h1","h2","h3","h4","h5","h6"],ue=t.object({unit:t.enums(["rem","px"]),value:t.number()}),fe=t.union([t.string(),t.number()]),Fe=(i=>(i.woff2="woff2",i.woff="woff",i))(Fe||{}),Ue=t.enums(["woff2","woff"]),ze=t.type({format:Ue,type:t.literal("url"),path:t.string()}),N=t.type({family:t.optional(t.string()),weight:t.optional(t.union([fe,t.size(t.array(fe),2)])),src:t.optional(t.array(ze)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),Me=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(Me||{}),je=(g=>(g["ultra-condensed"]="Ultra-condensed",g["extra-condensed"]="Extra-condensed",g.condensed="Condensed",g["semi-condensed"]="Semi-condensed",g.normal="Normal",g["semi-expanded"]="Semi-expanded",g.expanded="Expanded",g["extra-expanded"]="Extra-expanded",g["ultra-expanded"]="Ultra-expanded",g))(je||{}),w=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(p),hoverColor:t.optional(p),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),We=t.type({min:ue,max:t.optional(ue)}),a=t.type({fontSize:t.optional(We),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(p),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},me={},fn={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:me},mn={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:me};var I=t.union([a,t.type({accentColor:t.optional(p)})]),j=t.union([I,t.type({hoverColor:t.optional(p),backgroundColor:t.optional(p)})]),W=t.union([I,t.type({backgroundColor:t.optional(p)})]),_e={},Le={},Ge={},bn={primaryNav:Ge,secondaryNav:Le,tabs:_e};var An=t.object({version:t.literal(1),oldSillySidebarBgColor:F}),Kn=t.object({version:t.literal(2),anotherSillySidebarBgColor:F}),On=t.object({version:t.literal(3),sidebarBgColor:F}),Fn=t.object({version:t.literal(4),primaryColor:p,darkColor:p,lightColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0))}),Un=t.object({version:t.literal(5),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0))}),zn=t.object({version:t.literal(6),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0)),appearance:t.type({customFonts:t.optional(t.array(N)),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Mn=t.object({version:t.literal(7),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0)),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),jn=t.object({version:t.literal(8),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Wn=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),$e=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingXLarge:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),headingXSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),_n=$e;var Hn=["large","medium","small"],Jn=["large","medium","small"];var qn={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var Qn=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function He(e){return typeof e!="string"?!1:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}o(He,"isTokenReference");function b(e){return typeof e=="string"&&e.includes("{")}o(b,"hasTokenReferences");function Je(e){return !He(e)}o(Je,"isNotTokenReference");var l=t__namespace.define("Token Reference",e=>typeof e!="string"?!1:Je(e)?"Must start and end with curly braces":!0),Ye={border:"border",shadow:"shadow",transition:"transition"},qe=Object.values(Ye),Xe={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},Qe=Object.values(Xe);function J(e){return qe.includes(e)}o(J,"isTokenTypeComposite");function ye(e){return Qe.includes(e)}o(ye,"isTokenTypeSingular");utils.expectType([{inset:!1,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:!0}]);var c=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function co(e){return J(e.type)}o(co,"isTokenDataComposite");utils.expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:!0,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function et(e){return typeof e=="string"&&!b(e)}o(et,"isTokenValueColor");var A=t__namespace.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":b(e)?"Value must not contain {} (token references)":!0),tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),c),nt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function Y(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!b(e)}o(Y,"isTokenValueDimension");var D=t__namespace.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":b(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":!0),ot=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:D,kind:t__namespace.literal("static"),originalValue:D}),c),rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:D,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function go(e){return typeof e=="string"&&e.endsWith("ms")&&!b(e)}o(go,"isTokenValueDuration");var R=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":b(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?!0:'Value must be a number followed by "ms" (e.g., "100ms")'),it=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("static"),originalValue:R}),c),at=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function uo(e){return (typeof e=="string"||typeof e=="number")&&!b(e)}o(uo,"isTokenValueFontWeight");var ae=t__namespace.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":b(e)?"Value must not contain {} (token references)":!0),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:ae,kind:t__namespace.literal("static"),originalValue:ae}),c),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:ae,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),L=t__namespace.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":!0:"Value must be an array"),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:L,kind:t__namespace.literal("static"),originalValue:L}),c),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:L,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function gt(e){return utils.isObject(e)&&et(e.color)&&Y(e.offsetX)&&Y(e.offsetY)&&Y(e.blur)&&Y(e.spread)}o(gt,"isTokenValueShadow");var ke=t__namespace.define("Shadow Value",e=>gt(e)?!0:`Expected a shadow value, got ${JSON.stringify(e)}`),ut=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:ke,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,l]),offsetX:t__namespace.union([D,l]),offsetY:t__namespace.union([D,l]),blur:t__namespace.union([D,l]),spread:t__namespace.union([D,l]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),l])})}),c),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:ke,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),K=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function mt(e){return utils.isObject(e)&&A.is(e.color)&&K.is(e.style)&&D.is(e.width)}o(mt,"isTokenValueBorder");var Te=t__namespace.define("Border Value",mt),dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Te,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,l]),style:t__namespace.union([K,l]),width:t__namespace.union([D,l])})}),c),yt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Te,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function kt(e){return utils.isObject(e)&&L.is(e.timingFunction)&&R.is(e.duration)&&R.is(e.delay)}o(kt,"isTokenValueTransition");var Se=t__namespace.define("Transition Value",kt),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:Se,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([L,l]),duration:t__namespace.union([R,l]),delay:t__namespace.union([R,l])})}),c),St=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:Se,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),c),xt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("static"),originalValue:K}),c),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:K}),c),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),c),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),c),vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),fo=o(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,i=e.kind;try{switch(r){case"boolean":i==="ref"?vt.assert(e):Pt.assert(e);return;case"border":i==="ref"?yt.assert(e):dt.assert(e);return;case"color":i==="ref"?nt.assert(e):tt.assert(e);return;case"cubicBezier":i==="ref"?ct.assert(e):lt.assert(e);return;case"dimension":i==="ref"?rt.assert(e):ot.assert(e);return;case"duration":i==="ref"?at.assert(e):it.assert(e);return;case"fontWeight":i==="ref"?pt.assert(e):st.assert(e);return;case"number":i==="ref"?Vt.assert(e):ht.assert(e);return;case"shadow":i==="ref"?ft.assert(e):ut.assert(e);return;case"string":i==="ref"?xt.assert(e):Ct.assert(e);return;case"strokeStyle":i==="ref"?Dt.assert(e):bt.assert(e);return;case"transition":i==="ref"?St.assert(e):Tt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(g){throw g instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${g.message}. Received this data: "${JSON.stringify(e)}"`):g}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);utils.expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Do(e){return ye(e?.type)}o(Do,"isTokenSrcValueInfoSingular");function ho(e){return J(e?.type)}o(ho,"isTokenSrcValueInfoComposite");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Rt(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}o(Rt,"isTokenSrcExtensions");utils.expectType(["#ddd",!0,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:!0,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function Ro(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}o(Ro,"isTokenSrc");function Bt(e){return utils.isObject(e)&&!Rt(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}o(Bt,"isTokenGroup");function Bo(e){if(Bt(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return !0}return !1}o(Bo,"isTokenTypeVarRef");function Ao(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}o(Ao,"getPrimitiveValue");var Ko=o(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function Oo(e){let{value:r,unit:i}=utils.parseNumberWithUnit(e);if(!i)return {value:r};if(i!=="px"&&i!=="rem"&&i!=="em"&&i!=="%")throw new Error(`Invalid unit "${i}" for value: ${r}`);return {value:r,unit:i}}o(Oo,"parseTokenDimensionValue");var Mo=o(e=>utils.isObject(e)&&e.type==="text","isSlottedText");function jo(e){return utils.isObject(e)&&e.type==="template-demo"}o(jo,"isSlottedTemplateDemo");function Wo(e){return utils.isObject(e)&&e.type==="template-reference"}o(Wo,"isSlottedTemplateReference");var Nt=(i=>(i.portrait="portrait",i.landscape="landscape",i))(Nt||{});function _o(e){return e?.type==="data"}o(_o,"isDataDemo");function Lo(e){return e?.type==="template"}o(Lo,"isTemplateDemo");var Ce=(y=>(y.auto="auto",y.small="small",y.medium="medium",y.large="large",y.full="full",y))(Ce||{});function At(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(i=>utils.isObjKey(i,e))?!1:!utils.isObjKey("metaState",e)}o(At,"isKsAppClientDataNoMeta");var Xo=t.define("KsAppClientDataNoMeta",At);function Kt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(i=>utils.isObjKey(i,e)):!1}o(Kt,"isKsAppClientDataAndMeta");var Qo=t.define("KsAppClientDataAndMeta",Kt),Ot=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),Zo=Ot.is;function Ut(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(i=>utils.isObjKey(i,e))?!1:!utils.isObjKey("metaState",e)}o(Ut,"isKsAppClientDataNoMetaV3");var dr=t.define("KsAppClientDataNoMeta",Ut);function zt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(i=>utils.isObjKey(i,e)):!1}o(zt,"isKsAppClientDataAndMetaV3");var yr=t.define("KsAppClientDataAndMeta",zt),Mt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),kr=Mt.is;var Ve={version:"4.1.7",checkIfNeeded:o(e=>!0,"checkIfNeeded"),migrate:o(e=>{if(!immer.isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([i,g])=>{r.data.slots[i]=g.map(f=>typeof f=="string"?{type:"text",text:f}:(f.type==="template-reference"||f.type==="text"||(f.type="template-demo"),f));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:i,templates:g=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:y=[]}of g)if(y.includes(r.id)){r.patternId=i,r.templateId=f;return}})());});},"migrate")};var hr=[Ve];var Wt=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.unknown="unknown",k))(Wt||{}),Pr=o(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),vr=o(e=>"type"in e&&e.type==="number","isNumberProp"),Ir=o(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Rr=o(e=>"enum"in e,"isOptionsProp"),Br=o(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Er=o(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Nr=o(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),wr=o(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),Ar=o(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp");var Pe=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),_t=Pe,Fr=o(e=>_t.is(e),"isPatch"),le=t__namespace.array(Pe),Lt=le,Ur=o(e=>Lt.is(e),"isPatches"),ve=t__namespace.type({patches:le,inversePatches:t__namespace.optional(le),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Gt=ve,zr=o(e=>Gt.is(e),"isKsRemoteChange"),$t=t__namespace.array(ve),Ht=$t,Mr=o(e=>Ht.is(e),"isKsRemoteChanges");var _r={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"};var Jt=(r=>(r.ready="ready",r))(Jt||{}),Gr="ks-meta";var Hr={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var Yt=(y=>(y.GitHub="GitHub",y.GitLab="GitLab",y.GitLabRest="GitLabRest",y.Bitbucket="Bitbucket",y.Azure="Azure",y))(Yt||{}),qt=(g=>(g.Conflicting="CONFLICTING",g.Mergeable="MERGEABLE",g.Unknown="UNKNOWN",g))(qt||{}),Xt=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(Xt||{}),Qt=(i=>(i.Base64="BASE64",i.Text="TEXT",i))(Qt||{});var Zt={ADMIN:"ADMIN",ANONYMOUS:"ANONYMOUS",CONTRIBUTOR:"CONTRIBUTOR",EDITOR:"EDITOR",MANAGER:"MANAGER",VIEWER:"VIEWER"},qr=Object.values(Zt);
31
+ var Ie=Object.defineProperty;var n=(e,r)=>Ie(e,"name",{value:r,configurable:!0});function Ne(e){if(typeof e!="string")return !1;try{return !!Re__default.default.get(e)}catch{return !1}}n(Ne,"isColor");var F=t.define("ColorStringStruct",e=>typeof e=="string"&&Ne(e)),p=t.union([t.type({type:t.literal("value"),colorValue:F}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),ro=t.type({type:t.literal("design-token"),tokenName:t.string()});var uo=["h1","h2","h3","h4","h5","h6"],ge=t.object({unit:t.enums(["rem","px"]),value:t.number()}),fe=t.union([t.string(),t.number()]),Fe=(i=>(i.woff2="woff2",i.woff="woff",i))(Fe||{}),Ue=t.enums(["woff2","woff"]),ze=t.type({format:Ue,type:t.literal("url"),path:t.string()}),N=t.type({family:t.optional(t.string()),weight:t.optional(t.union([fe,t.size(t.array(fe),2)])),src:t.optional(t.array(ze)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),Me=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(Me||{}),je=(u=>(u["ultra-condensed"]="Ultra-condensed",u["extra-condensed"]="Extra-condensed",u.condensed="Condensed",u["semi-condensed"]="Semi-condensed",u.normal="Normal",u["semi-expanded"]="Semi-expanded",u.expanded="Expanded",u["extra-expanded"]="Extra-expanded",u["ultra-expanded"]="Ultra-expanded",u))(je||{}),w=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(p),hoverColor:t.optional(p),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),We=t.type({min:ge,max:t.optional(ge)}),a=t.type({fontSize:t.optional(We),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(p),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},me={},go={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:me},fo={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:me};var I=t.union([a,t.type({accentColor:t.optional(p)})]),j=t.union([I,t.type({hoverColor:t.optional(p),backgroundColor:t.optional(p)})]),W=t.union([I,t.type({backgroundColor:t.optional(p)})]),_e={},Le={},Ge={},xo={primaryNav:Ge,secondaryNav:Le,tabs:_e};var Ao=t.object({version:t.literal(1),oldSillySidebarBgColor:F}),Oo=t.object({version:t.literal(2),anotherSillySidebarBgColor:F}),Ko=t.object({version:t.literal(3),sidebarBgColor:F}),Fo=t.object({version:t.literal(4),primaryColor:p,darkColor:p,lightColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0))}),Uo=t.object({version:t.literal(5),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0))}),zo=t.object({version:t.literal(6),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0)),appearance:t.type({customFonts:t.optional(t.array(N)),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Mo=t.object({version:t.literal(7),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0)),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),jo=t.object({version:t.literal(8),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Wo=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),$e=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingXLarge:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),headingXSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),_o=$e;var Ho=["large","medium","small"],Jo=["large","medium","small"];var qo={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var Qo=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function He(e){return typeof e!="string"?!1:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(He,"isTokenReference");function x(e){return typeof e=="string"&&e.includes("{")}n(x,"hasTokenReferences");function Je(e){return !He(e)}n(Je,"isNotTokenReference");var l=t__namespace.define("Token Reference",e=>typeof e!="string"?!1:Je(e)?"Must start and end with curly braces":!0),Ye={border:"border",shadow:"shadow",transition:"transition"},qe=Object.values(Ye),Xe={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},Qe=Object.values(Xe);function J(e){return qe.includes(e)}n(J,"isTokenTypeComposite");function de(e){return Qe.includes(e)}n(de,"isTokenTypeSingular");utils.expectType([{inset:!1,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:!0}]);var c=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function un(e){return J(e.type)}n(un,"isTokenDataComposite");utils.expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:!0,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function et(e){return typeof e=="string"&&!x(e)}n(et,"isTokenValueColor");var A=t__namespace.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":x(e)?"Value must not contain {} (token references)":!0),tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),c),ot=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function Y(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!x(e)}n(Y,"isTokenValueDimension");var D=t__namespace.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":!0),nt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:D,kind:t__namespace.literal("static"),originalValue:D}),c),rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:D,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function gn(e){return typeof e=="string"&&e.endsWith("ms")&&!x(e)}n(gn,"isTokenValueDuration");var R=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?!0:'Value must be a number followed by "ms" (e.g., "100ms")'),it=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("static"),originalValue:R}),c),at=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function fn(e){return (typeof e=="string"||typeof e=="number")&&!x(e)}n(fn,"isTokenValueFontWeight");var ae=t__namespace.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":x(e)?"Value must not contain {} (token references)":!0),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:ae,kind:t__namespace.literal("static"),originalValue:ae}),c),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:ae,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),L=t__namespace.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":!0:"Value must be an array"),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:L,kind:t__namespace.literal("static"),originalValue:L}),c),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:L,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function ut(e){return utils.isObject(e)&&et(e.color)&&Y(e.offsetX)&&Y(e.offsetY)&&Y(e.blur)&&Y(e.spread)}n(ut,"isTokenValueShadow");var ke=t__namespace.define("Shadow Value",e=>ut(e)?!0:`Expected a shadow value, got ${JSON.stringify(e)}`),gt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:ke,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,l]),offsetX:t__namespace.union([D,l]),offsetY:t__namespace.union([D,l]),blur:t__namespace.union([D,l]),spread:t__namespace.union([D,l]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),l])})}),c),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:ke,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),O=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function mt(e){return utils.isObject(e)&&A.is(e.color)&&O.is(e.style)&&D.is(e.width)}n(mt,"isTokenValueBorder");var Te=t__namespace.define("Border Value",mt),yt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Te,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,l]),style:t__namespace.union([O,l]),width:t__namespace.union([D,l])})}),c),dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Te,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function kt(e){return utils.isObject(e)&&L.is(e.timingFunction)&&R.is(e.duration)&&R.is(e.delay)}n(kt,"isTokenValueTransition");var Se=t__namespace.define("Transition Value",kt),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:Se,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([L,l]),duration:t__namespace.union([R,l]),delay:t__namespace.union([R,l])})}),c),St=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:Se,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),c),bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),xt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:O,kind:t__namespace.literal("static"),originalValue:O}),c),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:O,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:O}),c),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),c),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),c),vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),mn=n(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,i=e.kind;try{switch(r){case"boolean":i==="ref"?vt.assert(e):Pt.assert(e);return;case"border":i==="ref"?dt.assert(e):yt.assert(e);return;case"color":i==="ref"?ot.assert(e):tt.assert(e);return;case"cubicBezier":i==="ref"?ct.assert(e):lt.assert(e);return;case"dimension":i==="ref"?rt.assert(e):nt.assert(e);return;case"duration":i==="ref"?at.assert(e):it.assert(e);return;case"fontWeight":i==="ref"?pt.assert(e):st.assert(e);return;case"number":i==="ref"?Vt.assert(e):ht.assert(e);return;case"shadow":i==="ref"?ft.assert(e):gt.assert(e);return;case"string":i==="ref"?bt.assert(e):Ct.assert(e);return;case"strokeStyle":i==="ref"?Dt.assert(e):xt.assert(e);return;case"transition":i==="ref"?St.assert(e):Tt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(u){throw u instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${u.message}. Received this data: "${JSON.stringify(e)}"`):u}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);utils.expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Dn(e){return de(e?.type)}n(Dn,"isTokenSrcValueInfoSingular");function hn(e){return J(e?.type)}n(hn,"isTokenSrcValueInfoComposite");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Rt(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}n(Rt,"isTokenSrcExtensions");utils.expectType(["#ddd",!0,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:!0,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function Rn(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}n(Rn,"isTokenSrc");function Bt(e){return utils.isObject(e)&&!Rt(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}n(Bt,"isTokenGroup");function Bn(e){if(Bt(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return !0}return !1}n(Bn,"isTokenTypeVarRef");function An(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}n(An,"getPrimitiveValue");var On=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function Kn(e){let{value:r,unit:i}=utils.parseNumberWithUnit(e);if(!i)return {value:r};if(i!=="px"&&i!=="rem"&&i!=="em"&&i!=="%")throw new Error(`Invalid unit "${i}" for value: ${r}`);return {value:r,unit:i}}n(Kn,"parseTokenDimensionValue");var Mn=n(e=>utils.isObject(e)&&e.type==="text","isSlottedText");function jn(e){return utils.isObject(e)&&e.type==="template-demo"}n(jn,"isSlottedTemplateDemo");function Wn(e){return utils.isObject(e)&&e.type==="template-reference"}n(Wn,"isSlottedTemplateReference");var Nt=(i=>(i.portrait="portrait",i.landscape="landscape",i))(Nt||{});function _n(e){return e?.type==="data"}n(_n,"isDataDemo");function Ln(e){return e?.type==="template"}n(Ln,"isTemplateDemo");var Ce=(d=>(d.auto="auto",d.small="small",d.medium="medium",d.large="large",d.full="full",d))(Ce||{});function At(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(i=>utils.isObjKey(i,e))?!1:!utils.isObjKey("metaState",e)}n(At,"isKsAppClientDataNoMeta");var Xn=t.define("KsAppClientDataNoMeta",At);function Ot(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(i=>utils.isObjKey(i,e)):!1}n(Ot,"isKsAppClientDataAndMeta");var Qn=t.define("KsAppClientDataAndMeta",Ot),Kt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),Zn=Kt.is;function Ut(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(i=>utils.isObjKey(i,e))?!1:!utils.isObjKey("metaState",e)}n(Ut,"isKsAppClientDataNoMetaV3");var yr=t.define("KsAppClientDataNoMeta",Ut);function zt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(i=>utils.isObjKey(i,e)):!1}n(zt,"isKsAppClientDataAndMetaV3");var dr=t.define("KsAppClientDataAndMeta",zt),Mt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),kr=Mt.is;var Ve={version:"4.1.7",checkIfNeeded:n(e=>!0,"checkIfNeeded"),migrate:n(e=>{if(!immer.isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([i,u])=>{r.data.slots[i]=u.map(f=>typeof f=="string"?{type:"text",text:f}:(f.type==="template-reference"||f.type==="text"||(f.type="template-demo"),f));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:i,templates:u=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:d=[]}of u)if(d.includes(r.id)){r.patternId=i,r.templateId=f;return}})());});},"migrate")};var hr=[Ve];var Wt=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.arrayOfNumbers="arrayOfNumbers",k.unknown="unknown",k))(Wt||{}),Pr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),vr=n(e=>"type"in e&&e.type==="number","isNumberProp"),Ir=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Rr=n(e=>"enum"in e,"isOptionsProp"),Br=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Er=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Nr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),wr=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),Ar=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),Or=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var Pe=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),_t=Pe,Ur=n(e=>_t.is(e),"isPatch"),le=t__namespace.array(Pe),Lt=le,zr=n(e=>Lt.is(e),"isPatches"),ve=t__namespace.type({patches:le,inversePatches:t__namespace.optional(le),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Gt=ve,Mr=n(e=>Gt.is(e),"isKsRemoteChange"),$t=t__namespace.array(ve),Ht=$t,jr=n(e=>Ht.is(e),"isKsRemoteChanges");var Lr={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"};var Jt=(r=>(r.ready="ready",r))(Jt||{}),$r="ks-meta";var Jr={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var Yt=(d=>(d.GitHub="GitHub",d.GitLab="GitLab",d.GitLabRest="GitLabRest",d.Bitbucket="Bitbucket",d.Azure="Azure",d))(Yt||{}),qt=(u=>(u.Conflicting="CONFLICTING",u.Mergeable="MERGEABLE",u.Unknown="UNKNOWN",u))(qt||{}),Xt=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(Xt||{}),Qt=(i=>(i.Base64="BASE64",i.Text="TEXT",i))(Qt||{});var Zt={ADMIN:"ADMIN",ANONYMOUS:"ANONYMOUS",CONTRIBUTOR:"CONTRIBUTOR",EDITOR:"EDITOR",MANAGER:"MANAGER",VIEWER:"VIEWER"},Xr=Object.values(Zt);
32
32
 
33
33
  Object.defineProperty(exports, "isObjKey", {
34
34
  enumerable: true,
@@ -38,26 +38,26 @@ Object.defineProperty(exports, "isObject", {
38
38
  enumerable: true,
39
39
  get: function () { return utils.isObject; }
40
40
  });
41
- exports.BlockSizes = Hn;
42
- exports.BlockSpacings = Jn;
41
+ exports.BlockSizes = Ho;
42
+ exports.BlockSpacings = Jo;
43
43
  exports.ColorConfigStruct = p;
44
44
  exports.ColorStringStruct = F;
45
- exports.ColorTokenConfigStruct = rn;
45
+ exports.ColorTokenConfigStruct = ro;
46
46
  exports.FontFaceConfigStruct = N;
47
47
  exports.FontFaceFormatsEnumStruct = Ue;
48
48
  exports.FontFaceSourceFormats = Fe;
49
49
  exports.FontFaceSourceStruct = ze;
50
50
  exports.FontFaceWeightStruct = fe;
51
51
  exports.FontSizeConfigStruct = We;
52
- exports.FontSizeConfigValStruct = ue;
52
+ exports.FontSizeConfigValStruct = ge;
53
53
  exports.FontStretches = je;
54
54
  exports.GitProviderType = Yt;
55
- exports.HeadingLevels = un;
56
- exports.KsAppClientDataAndMetaStruct = Qo;
57
- exports.KsAppClientDataAndMetaStructV3 = yr;
58
- exports.KsAppClientDataNoMetaStruct = Xo;
59
- exports.KsAppClientDataNoMetaStructV3 = dr;
60
- exports.KsMetaStateStruct = Ot;
55
+ exports.HeadingLevels = uo;
56
+ exports.KsAppClientDataAndMetaStruct = Qn;
57
+ exports.KsAppClientDataAndMetaStructV3 = dr;
58
+ exports.KsAppClientDataNoMetaStruct = Xn;
59
+ exports.KsAppClientDataNoMetaStructV3 = yr;
60
+ exports.KsMetaStateStruct = Kt;
61
61
  exports.KsMetaStateStructV3 = Mt;
62
62
  exports.KsRemoteChangesStruct = Ht;
63
63
  exports.KsRendererClientEvents = Jt;
@@ -77,78 +77,79 @@ exports.TokenValueCubicBezierStruct = L;
77
77
  exports.TokenValueDimensionStruct = D;
78
78
  exports.TokenValueDurationStruct = R;
79
79
  exports.TokenValueFontWeightStruct = ae;
80
- exports.TokenValueStrokeStyleStruct = K;
80
+ exports.TokenValueStrokeStyleStruct = O;
81
81
  exports.TypographyConfigStruct = a;
82
82
  exports.TypographyLinkConfigStruct = w;
83
- exports.UiConfigStruct = _n;
83
+ exports.UiConfigStruct = _o;
84
84
  exports.UiConfigV10Struct = $e;
85
- exports.UiConfigV1Struct = An;
86
- exports.UiConfigV2Struct = Kn;
87
- exports.UiConfigV3Struct = On;
88
- exports.UiConfigV4Struct = Fn;
89
- exports.UiConfigV5Struct = Un;
90
- exports.UiConfigV6Struct = zn;
91
- exports.UiConfigV7Struct = Mn;
92
- exports.UiConfigV8Struct = jn;
93
- exports.UiConfigV9Struct = Wn;
94
- exports.WS_EVENTS = Hr;
95
- exports.assertTokenData = fo;
96
- exports.customizableNavElements = bn;
97
- exports.getPrimitiveValue = Ao;
98
- exports.hasTokenReferences = b;
85
+ exports.UiConfigV1Struct = Ao;
86
+ exports.UiConfigV2Struct = Oo;
87
+ exports.UiConfigV3Struct = Ko;
88
+ exports.UiConfigV4Struct = Fo;
89
+ exports.UiConfigV5Struct = Uo;
90
+ exports.UiConfigV6Struct = zo;
91
+ exports.UiConfigV7Struct = Mo;
92
+ exports.UiConfigV8Struct = jo;
93
+ exports.UiConfigV9Struct = Wo;
94
+ exports.WS_EVENTS = Jr;
95
+ exports.assertTokenData = mn;
96
+ exports.customizableNavElements = xo;
97
+ exports.getPrimitiveValue = An;
98
+ exports.hasTokenReferences = x;
99
+ exports.isArrayOfNumbersProp = Or;
99
100
  exports.isArrayOfObjectsProp = Nr;
100
101
  exports.isArrayOfStringsProp = Ar;
101
102
  exports.isBooleanProp = Ir;
102
103
  exports.isCustomTypeScriptProp = Er;
103
- exports.isDataDemo = _o;
104
- exports.isDimensionString = Ko;
104
+ exports.isDataDemo = _n;
105
+ exports.isDimensionString = On;
105
106
  exports.isFunctionProp = Br;
106
- exports.isKsAppClientDataAndMeta = Kt;
107
+ exports.isKsAppClientDataAndMeta = Ot;
107
108
  exports.isKsAppClientDataAndMetaV3 = zt;
108
109
  exports.isKsAppClientDataNoMeta = At;
109
110
  exports.isKsAppClientDataNoMetaV3 = Ut;
110
- exports.isKsMetaState = Zo;
111
+ exports.isKsMetaState = Zn;
111
112
  exports.isKsMetaStateV3 = kr;
112
- exports.isKsRemoteChange = zr;
113
- exports.isKsRemoteChanges = Mr;
113
+ exports.isKsRemoteChange = Mr;
114
+ exports.isKsRemoteChanges = jr;
114
115
  exports.isNotTokenReference = Je;
115
116
  exports.isNumberProp = vr;
116
117
  exports.isObjectProp = wr;
117
118
  exports.isOptionsProp = Rr;
118
- exports.isPatch = Fr;
119
- exports.isPatches = Ur;
120
- exports.isSlottedTemplateDemo = jo;
121
- exports.isSlottedTemplateReference = Wo;
122
- exports.isSlottedText = Mo;
119
+ exports.isPatch = Ur;
120
+ exports.isPatches = zr;
121
+ exports.isSlottedTemplateDemo = jn;
122
+ exports.isSlottedTemplateReference = Wn;
123
+ exports.isSlottedText = Mn;
123
124
  exports.isStringProp = Pr;
124
- exports.isTemplateDemo = Lo;
125
- exports.isTokenDataComposite = co;
125
+ exports.isTemplateDemo = Ln;
126
+ exports.isTokenDataComposite = un;
126
127
  exports.isTokenGroup = Bt;
127
128
  exports.isTokenReference = He;
128
- exports.isTokenSrc = Ro;
129
+ exports.isTokenSrc = Rn;
129
130
  exports.isTokenSrcExtensions = Rt;
130
- exports.isTokenSrcValueInfoComposite = ho;
131
- exports.isTokenSrcValueInfoSingular = Do;
131
+ exports.isTokenSrcValueInfoComposite = hn;
132
+ exports.isTokenSrcValueInfoSingular = Dn;
132
133
  exports.isTokenTypeComposite = J;
133
- exports.isTokenTypeSingular = ye;
134
- exports.isTokenTypeVarRef = Bo;
134
+ exports.isTokenTypeSingular = de;
135
+ exports.isTokenTypeVarRef = Bn;
135
136
  exports.isTokenValueBorder = mt;
136
137
  exports.isTokenValueColor = et;
137
138
  exports.isTokenValueDimension = Y;
138
- exports.isTokenValueDuration = go;
139
- exports.isTokenValueFontWeight = uo;
140
- exports.isTokenValueShadow = gt;
139
+ exports.isTokenValueDuration = gn;
140
+ exports.isTokenValueFontWeight = fn;
141
+ exports.isTokenValueShadow = ut;
141
142
  exports.isTokenValueTransition = kt;
142
- exports.ksRendererClientMetaId = Gr;
143
+ exports.ksRendererClientMetaId = $r;
143
144
  exports.migrations = hr;
144
- exports.pageElements = fn;
145
- exports.pageElementsV2 = mn;
146
- exports.parseTokenDimensionValue = Oo;
147
- exports.rendererIds = _r;
148
- exports.roles = qr;
145
+ exports.pageElements = go;
146
+ exports.pageElementsV2 = fo;
147
+ exports.parseTokenDimensionValue = Kn;
148
+ exports.rendererIds = Lr;
149
+ exports.roles = Xr;
149
150
  exports.rolesById = Zt;
150
- exports.strokeStyleValues = Qn;
151
- exports.tokenNameDisplayFormats = qn;
151
+ exports.strokeStyleValues = Qo;
152
+ exports.tokenNameDisplayFormats = qo;
152
153
  exports.tokenTypeComposites = qe;
153
154
  exports.tokenTypeSingulars = Qe;
154
155
  //# sourceMappingURL=index.js.map