@udixio/theme 1.0.0-beta.18 → 1.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("awilix"),e=require("@material/material-color-utilities"),r=require("path"),n=require("node:fs"),o=require("tailwindcss/plugin"),i=function(){function t(t){var e=t.colorManagerService;this.colorManagerService=void 0,this.colorManagerService=e}var e=t.prototype;return e.getColors=function(){return this.colorManagerService.getAll()},e.addColor=function(t,e){return this.colorManagerService.createOrUpdate(t,e)},e.addColors=function(t){var e=this;Array.isArray(t)||(t=[t]),t.forEach((function(t){"function"==typeof t&&(t=t(e)),t.fromPalettes&&(Array.isArray(t.fromPalettes)||(t.fromPalettes=[t.fromPalettes]),t.fromPalettes.map((function(t){e.colorManagerService.addFromPalette(t)}))),t.colors&&Object.keys(t.colors).map((function(r){return e.addColor(r,t.colors[r])}))}))},e.getColor=function(t){return this.colorManagerService.get(t)},e.removeColor=function(t){return this.colorManagerService.remove(t)},e.updateColor=function(t,e){return this.colorManagerService.createOrUpdate(t,e)},t}();function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u.apply(null,arguments)}function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,l(t,e)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function f(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}var g,h=function(){function t(t,e,r,n){this.low=void 0,this.normal=void 0,this.medium=void 0,this.high=void 0,this.low=t,this.normal=e,this.medium=r,this.high=n}return t.prototype.get=function(t){return t<=-1?this.low:t<0?e.lerp(this.low,this.normal,(t- -1)/1):t<.5?e.lerp(this.normal,this.medium,(t-0)/.5):t<1?e.lerp(this.medium,this.high,(t-.5)/.5):this.high},t}(),p=function(){function t(t,e,r,n,o,i,a,s){if(this.name=void 0,this.palette=void 0,this.tone=void 0,this.isBackground=void 0,this.background=void 0,this.secondBackground=void 0,this.contrastCurve=void 0,this.toneDeltaPair=void 0,this.hctCache=new Map,this.name=t,this.palette=e,this.tone=r,this.isBackground=n,this.background=o,this.secondBackground=i,this.contrastCurve=a,this.toneDeltaPair=s,!o&&i)throw new Error("Color "+t+" has secondBackgrounddefined, but background is not defined.");if(!o&&a)throw new Error("Color "+t+" has contrastCurvedefined, but background is not defined.");if(o&&!a)throw new Error("Color "+t+" has backgrounddefined, but contrastCurve is not defined.")}t.fromPalette=function(e){var r,n;return new t(null!=(r=e.name)?r:"",e.palette,e.tone,null!=(n=e.isBackground)&&n,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)},t.foregroundTone=function(r,n){var o=e.Contrast.lighterUnsafe(r,n),i=e.Contrast.darkerUnsafe(r,n),a=e.Contrast.ratioOfTones(o,r),s=e.Contrast.ratioOfTones(i,r);if(t.tonePrefersLightForeground(r)){var u=Math.abs(a-s)<.1&&a<n&&s<n;return a>=n||a>=s||u?o:i}return s>=n||s>=a?i:o},t.tonePrefersLightForeground=function(t){return Math.round(t)<60},t.toneAllowsLightForeground=function(t){return Math.round(t)<=49},t.enableLightForeground=function(e){return t.tonePrefersLightForeground(e)&&!t.toneAllowsLightForeground(e)?49:e};var r=t.prototype;return r.getArgb=function(t){return this.getHct(t).toInt()},r.getHct=function(t){var e=this.hctCache.get(t);if(null!=e)return e;var r=this.getTone(t),n=this.palette(t).getHct(r);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,n),n},r.getTone=function(r){var n=r.contrastLevel<0;if(this.toneDeltaPair){var o=this.toneDeltaPair(r),i=o.roleA,a=o.roleB,s=o.delta,u=o.polarity,c=o.stayTogether,l=this.background(r).getTone(r),f="nearer"===u||"lighter"===u&&!r.isDark||"darker"===u&&r.isDark,g=f?i:a,h=f?a:i,p=this.name===g.name,d=r.isDark?1:-1,v=g.contrastCurve.get(r.contrastLevel),m=h.contrastCurve.get(r.contrastLevel),y=g.tone(r),C=e.Contrast.ratioOfTones(l,y)>=v?y:t.foregroundTone(l,v),S=h.tone(r),k=e.Contrast.ratioOfTones(l,S)>=m?S:t.foregroundTone(l,m);return n&&(C=t.foregroundTone(l,v),k=t.foregroundTone(l,m)),(k-C)*d>=s||((k=e.clampDouble(0,100,C+s*d))-C)*d>=s||(C=e.clampDouble(0,100,k-s*d)),50<=C&&C<60?d>0?(C=60,k=Math.max(k,C+s*d)):(C=49,k=Math.min(k,C+s*d)):50<=k&&k<60&&(c?d>0?(C=60,k=Math.max(k,C+s*d)):(C=49,k=Math.min(k,C+s*d)):k=d>0?60:49),p?C:k}var b=this.tone(r);if(null==this.background)return b;var P=this.background(r).getTone(r),x=this.contrastCurve.get(r.contrastLevel);if(e.Contrast.ratioOfTones(P,b)>=x||(b=t.foregroundTone(P,x)),n&&(b=t.foregroundTone(P,x)),this.isBackground&&50<=b&&b<60&&(b=e.Contrast.ratioOfTones(49,P)>=x?49:60),this.secondBackground){var D=[this.background,this.secondBackground],w=D[1],F=[(0,D[0])(r).getTone(r),w(r).getTone(r)],H=F[0],O=F[1],T=[Math.max(H,O),Math.min(H,O)],E=T[0],A=T[1];if(e.Contrast.ratioOfTones(E,b)>=x&&e.Contrast.ratioOfTones(A,b)>=x)return b;var M=e.Contrast.lighter(E,x),B=e.Contrast.darker(A,x),j=[];return-1!==M&&j.push(M),-1!==B&&j.push(B),t.tonePrefersLightForeground(H)||t.tonePrefersLightForeground(O)?M<0?100:M:1===j.length?j[0]:B<0?0:B}return b},t}(),d=function(t,e,r,n,o){this.roleA=void 0,this.roleB=void 0,this.delta=void 0,this.polarity=void 0,this.stayTogether=void 0,this.roleA=t,this.roleB=e,this.delta=r,this.polarity=n,this.stayTogether=o},v=function(){function t(t,e,r){this.option=void 0,this.schemeService=void 0,this.colorService=void 0,this.dynamicColor=null,this.option=t,this.schemeService=e,this.colorService=r}var r=t.prototype;return r.update=function(t){this.dynamicColor=null,this.option=u({},this.option,t)},r.getHex=function(){return e.hexFromArgb(this.getArgb())},r.getArgb=function(){return this.getDynamicColor().getArgb(this.schemeService.get())},r.getRgb=function(){return{r:(t=this.getArgb())>>16&255,g:t>>8&255,b:255&t};var t},r.getName=function(){return this.option.name.replace(/([A-Z])/g,"_$1").toLowerCase()},r.getDynamicColor=function(){return this.dynamicColor||(this.dynamicColor=p.fromPalette(u({},this.option,{name:this.getName()}))),this.dynamicColor},t}(),m=function(t,e){return e instanceof i?t.isDark?e.getColor("surfaceBright").getDynamicColor():e.getColor("surfaceDim").getDynamicColor():t.isDark?e.get("surfaceBright").getDynamicColor():e.get("surfaceDim").getDynamicColor()},y=function(){function t(t){var e=t.schemeService;this.colorMap=new Map,this.schemeService=void 0,this.schemeService=e}var e=t.prototype;return e.createOrUpdate=function(t,e){var r=this.colorMap.get(t);if(r)r.update(u({},e,{name:t})),this.colorMap.set(t,r);else{var n=e.palette,o=e.tone;if(!n||!o)throw new Error("Palette "+t+" does not exist");r=new v(u({},e,{palette:n,tone:o,name:t}),this.schemeService,this),this.colorMap.set(t,r)}return r},e.remove=function(t){return this.colorMap.delete(t)},e.get=function(t){var e=this.colorMap.get(t);if(e)return e;throw new Error("Color "+t+" does not exist")},e.getAll=function(){return this.colorMap},e.addFromPalette=function(t){var e,r=this,n=t,o=(e=t).charAt(0).toUpperCase()+e.slice(1),i="on"+o,a=n+"Container",s="on"+o+"Container",u="inverse"+o,c=n+"Fixed",l=n+"FixedDim",f="on"+o+"Fixed",g="on"+o+"FixedVariant";this.createOrUpdate(n,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?80:40},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(3,4.5,7,11),toneDeltaPair:function(t){return new d(r.get(a).getDynamicColor(),r.get(n).getDynamicColor(),15,"nearer",!1)}}),this.createOrUpdate(i,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?20:100},background:function(t){return r.get(n).getDynamicColor()},contrastCurve:new h(4.5,7,11,21)}),this.createOrUpdate(a,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?30:90},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(t){return new d(r.get(a).getDynamicColor(),r.get(n).getDynamicColor(),15,"nearer",!1)}}),this.createOrUpdate(s,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?90:10},background:function(t){return r.get(a).getDynamicColor()},contrastCurve:new h(4.5,7,11,21)}),this.createOrUpdate(u,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?40:80},background:function(t){return r.get("inverseSurface").getDynamicColor()},contrastCurve:new h(3,4.5,7,11)}),this.createOrUpdate(c,{palette:function(e){return e.getPalette(t)},tone:function(t){return 90},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(t){return new d(r.get(c).getDynamicColor(),r.get(l).getDynamicColor(),10,"lighter",!0)}}),this.createOrUpdate(l,{palette:function(e){return e.getPalette(t)},tone:function(t){return 80},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(t){return new d(r.get(c).getDynamicColor(),r.get(l).getDynamicColor(),10,"lighter",!0)}}),this.createOrUpdate(f,{palette:function(e){return e.getPalette(t)},tone:function(t){return 10},background:function(t){return r.get(l).getDynamicColor()},secondBackground:function(t){return r.get(c).getDynamicColor()},contrastCurve:new h(4.5,7,11,21)}),this.createOrUpdate(g,{palette:function(e){return e.getPalette(t)},tone:function(t){return 30},background:function(t){return r.get(l).getDynamicColor()},secondBackground:function(t){return r.get(c).getDynamicColor()},contrastCurve:new h(3,4.5,7,11)})},t}(),C={colorManagerService:t.asClass(y).singleton(),colorService:t.asClass(i).singleton()},S=function(){function t(t){this.options=void 0,this.options=t}var r,n;return t.prototype.getPalette=function(t){if(!this.options)throw new Error("Scheme options is not set");var e=this.options.palettes.get(t);if(!e)throw new Error("Palette "+t+" not found");return e},r=t,(n=[{key:"contrastLevel",get:function(){if(!this.options)throw new Error("Scheme options is not set");return this.options.contrastLevel}},{key:"isDark",get:function(){if(!this.options)throw new Error("Scheme options is not set");return this.options.isDark}},{key:"sourceColorHct",get:function(){if(!this.options)throw new Error("Scheme options is not set");return e.Hct.fromInt(this.options.sourceColorArgb)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(),k=function(){function t(){this.schemeEntity=void 0,this.options=void 0}var r=t.prototype;return r.createOrUpdate=function(t){var r,n;this.options=u({},this.options,t,{sourcesColorHex:u({},null==(r=this.options)?void 0:r.sourcesColorHex,t.sourcesColorHex),palettes:u({},null==(n=this.options)?void 0:n.palettes,t.palettes)});var o=new Map;if(!this.options.sourcesColorHex.primary)throw new Error("Primary source color is not set");var i=e.argbFromHex(this.options.sourcesColorHex.primary),a=e.Hct.fromInt(i);if(this.options.palettes){for(var s=0,c=Object.entries(this.options.palettes);s<c.length;s++){var l=c[s],f=l[0],g=l[1],h=g.sourceColorkey,p=g.tonalPalette,d=void 0;if(h){var v=e.argbFromHex(this.options.sourcesColorHex[h]);d=p(e.Hct.fromInt(v))}else d=p(a);o.set(f,d)}this.schemeEntity=new S(u({},this.options,{palettes:o,sourceColorArgb:i}))}},r.get=function(){if(!this.schemeEntity)throw new Error("Scheme is not created");return this.schemeEntity},t}(),b=function(){function t(t){var e=t.schemeService,r=t.variantService;this.schemeService=void 0,this.variantService=void 0,this.schemeService=e,this.variantService=r}var e=t.prototype;return e.create=function(t){this.schemeService.createOrUpdate(u({},t,{sourcesColorHex:{primary:t.sourceColorHex}})),this.variantService.set(t.variant)},e.update=function(t){var e=u({},t);t.sourceColorHex&&(e.sourcesColorHex={primary:t.sourceColorHex}),this.schemeService.createOrUpdate(e),t.variant&&this.variantService.set(t.variant)},e.addCustomPalette=function(t,e){this.variantService.addCustomPalette(t,e)},t}(),P=function(){function t(t){var e=t.schemeService;this.customPalettes={},this.variantEntity=void 0,this.schemeService=void 0,this.schemeService=e}var r=t.prototype;return r.addCustomPalette=function(t,e){this.customPalettes[t]=e,this.update()},r.set=function(t){this.variantEntity=t,t.palettes.error||(t.palettes.error=function(){return e.TonalPalette.fromHueAndChroma(25,84)}),this.update()},r.update=function(){var t=this;if(this.variantEntity){var e={};Object.keys(this.variantEntity.palettes).forEach((function(r){e[r]={tonalPalette:t.variantEntity.palettes[r]}})),this.variantEntity.customPalettes&&Object.keys(this.customPalettes).forEach((function(r){e[r]={sourceColorkey:r,tonalPalette:t.variantEntity.customPalettes}})),this.schemeService.createOrUpdate({sourcesColorHex:this.customPalettes,palettes:e})}},t}(),x={schemeService:t.asClass(k).singleton(),variantService:t.asClass(P).singleton(),themeService:t.asClass(b).singleton()},D=function(t){var e=t.colorService,r=t.themeService,n=t.pluginService;this.colorService=void 0,this.themeService=void 0,this.pluginService=void 0,this.pluginService=n,this.colorService=e,this.themeService=r},w={appService:t.asClass(D).singleton()},F=function(t){return{fromPalettes:["primary","secondary","tertiary"],colors:{background:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?6:98},isBackground:!0},onBackground:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?90:10},background:function(e){return t.getColor("background").getDynamicColor()},contrastCurve:new h(3,3,4.5,7)},surface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?6:98},isBackground:!0},surfaceDim:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?6:87},isBackground:!0},surfaceBright:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?24:98},isBackground:!0},surfaceContainerLowest:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?4:100},isBackground:!0},surfaceContainerLow:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?10:96},isBackground:!0},surfaceContainer:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?12:94},isBackground:!0},surfaceContainerHigh:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?17:92},isBackground:!0},surfaceContainerHighest:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?22:90},isBackground:!0},onSurface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?90:10},background:function(e){return m(e,t)},contrastCurve:new h(4.5,7,11,21)},surfaceVariant:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?30:90},isBackground:!0},onSurfaceVariant:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?80:30},background:function(e){return m(e,t)},contrastCurve:new h(3,4.5,7,11)},inverseSurface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?90:20}},inverseOnSurface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?20:95},background:function(e){return t.getColor("inverseSurface").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},outline:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?60:50},background:function(e){return m(e,t)},contrastCurve:new h(1.5,3,4.5,7)},outlineVariant:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?30:80},background:function(e){return m(e,t)},contrastCurve:new h(1,1,3,7)},shadow:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return 0}},scrim:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return 0}},surfaceTint:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?80:40},isBackground:!0},secondaryContainer:{tone:function(t){var r=t.isDark?30:90;return function(t,r,n,o){var i=n,a=e.Hct.from(t,r,n);if(a.chroma<r)for(var s=a.chroma;a.chroma<r;){var u=e.Hct.from(t,r,i+=o?-1:1);if(s>u.chroma)break;if(Math.abs(u.chroma-r)<.4)break;Math.abs(u.chroma-r)<Math.abs(a.chroma-r)&&(a=u),s=Math.max(s,u.chroma)}return i}(t.getPalette("secondary").hue,t.getPalette("secondary").chroma,r,!t.isDark)}},onSecondaryContainer:{tone:function(e){return p.foregroundTone(t.getColor("secondaryContainer").getDynamicColor().tone(e),4.5)}},tertiaryContainer:{palette:function(t){return t.getPalette("tertiary")},tone:function(t){var r=t.getPalette("tertiary").getHct(t.sourceColorHct.tone);return e.DislikeAnalyzer.fixIfDisliked(r).tone}},onTertiaryContainer:{palette:function(t){return t.getPalette("tertiary")},tone:function(e){return p.foregroundTone(t.getColor("tertiaryContainer").getDynamicColor().tone(e),4.5)}},error:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?80:40},isBackground:!0,background:function(e){return m(e,t)},contrastCurve:new h(3,4.5,7,11),toneDeltaPair:function(e){return new d(t.getColor("errorContainer").getDynamicColor(),t.getColor("error").getDynamicColor(),15,"nearer",!1)}},onError:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?20:100},background:function(e){return t.getColor("error").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},errorContainer:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?30:90},isBackground:!0,background:function(e){return m(e,t)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(e){return new d(t.getColor("errorContainer").getDynamicColor(),t.getColor("error").getDynamicColor(),15,"nearer",!1)}},onErrorContainer:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?90:10},background:function(e){return t.getColor("errorContainer").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},onTertiaryFixed:{palette:function(t){return t.getPalette("tertiary")},tone:function(t){return 10},background:function(e){return t.getColor("tertiaryFixedDim").getDynamicColor()},secondBackground:function(e){return t.getColor("tertiaryFixed").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},onTertiaryFixedVariant:{palette:function(t){return t.getPalette("tertiary")},tone:function(t){return 30},background:function(e){return t.getColor("tertiaryFixedDim").getDynamicColor()},secondBackground:function(e){return t.getColor("tertiaryFixed").getDynamicColor()},contrastCurve:new h(3,4.5,7,11)}}}},H=function(t,r,n){var o=t.hue;if(r.length!==n.length)throw new Error("mismatch between hue length "+r.length+" & rotations "+n.length);if(1===n.length)return e.sanitizeDegreesDouble(t.hue+n[0]);for(var i=r.length,a=0;a<=i-2;a++)if(r[a]<o&&o<r[a+1])return e.sanitizeDegreesDouble(o+n[a]);return o},O=function(){};g=O,O.tonalSpot={palettes:{primary:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,36)},secondary:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,16)},tertiary:function(t){return e.TonalPalette.fromHueAndChroma(e.sanitizeDegreesDouble(t.hue+60),24)},neutral:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,6)},neutralVariant:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,8)}},customPalettes:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,16)}},O.vibrant={palettes:{primary:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,200)},secondary:function(t){return e.TonalPalette.fromHueAndChroma(H(t,g.hues,g.secondaryRotations),24)},tertiary:function(t){return e.TonalPalette.fromHueAndChroma(H(t,g.hues,g.tertiaryRotations),32)},neutral:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,6)},neutralVariant:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,8)}},customPalettes:function(t){return e.TonalPalette.fromHueAndChroma(H(t,g.hues,g.secondaryRotations),24)}},O.hues=[0,41,61,101,131,181,251,301,360],O.secondaryRotations=[18,15,10,12,15,18,15,12,12],O.tertiaryRotations=[35,30,20,25,30,35,30,25,25];var T=function(){function t(t){var e=t.appService;this.configPath="./theme.config",this.appService=void 0,this.appService=e}var e=t.prototype;return e.loadConfig=function(){var t=this.appService,e=t.themeService,r=t.colorService,n=t.pluginService,o=this.getConfig(),i=o.contrastLevel,a=o.isDark,s=o.variant,u=o.palettes,c=o.colors,l=o.useDefaultColors,f=void 0===l||l,g=o.plugins;e.create({contrastLevel:void 0===i?0:i,isDark:void 0!==a&&a,sourceColorHex:o.sourceColor,variant:void 0===s?O.tonalSpot:s}),u&&Object.entries(u).forEach((function(t){return e.addCustomPalette(t[0],t[1])})),f&&r.addColors(F),c&&r.addColors(c),g&&(g.forEach((function(t){Array.isArray(t)?n.addPlugin(t[0],t[1]):n.addPlugin(t,{})})),n.loadPlugins(this.appService))},e.getConfig=function(){for(var t=r.resolve(this.configPath),e=null,o=0,i=[".js",".ts",".jms",".jcs"];o<i.length;o++){var a=t+i[o];if(n.existsSync(a)){e=require(a);break}}if(!e)throw new Error("Configuration file not found");return"default"in e?e.default:e},t}(),E={configService:t.asClass(T).singleton()},A=function(){function t(){this.pluginInstances=new Map,this.pluginConstructors=new Map}var e=t.prototype;return e.addPlugin=function(t,e){this.pluginConstructors.set(t.name,[t,e])},e.loadPlugins=function(t){var e=this,r=new Map(this.pluginConstructors),n=0;do{n=r.size,r.forEach((function(n,o){var i=n[0],a=n[1];0===i.dependencies.filter((function(t){return!e.pluginInstances.has(t.name)})).length&&(e.pluginInstances.set(i.name,new i(t,a)),r.delete(o))}))}while(0!=r.size&&r.size<n);r.size>0&&console.log("Some plugins couldn't be loaded due to missing dependencies: ",Array.from(r.keys()))},e.getPlugin=function(t){var e=this.pluginInstances.get(t.name);if(!e)throw new Error("Plugin "+t.name+" not found");return e},t}(),M={pluginService:t.asClass(A).singleton()};function B(t,e){return e.forEach((function(e){Object.entries(e).forEach((function(e){t.register(e[0],e[1])}))})),t}var j=t.createContainer({injectionMode:t.InjectionMode.PROXY});function z(t){var e=j.resolve("configService");return t&&(e.configPath=t),e.loadConfig(),j.resolve("appService")}B(j,[E,w,M,C,x]);var U,L=function(){};L.dependencies=[],exports.FontFamily=void 0,(U=exports.FontFamily||(exports.FontFamily={})).Expressive="expressive",U.Neutral="neutral";var W=function(t){function e(e,r){var n,o,i,a,s;return(s=t.call(this)||this).appService=void 0,s.options=void 0,s.fontFamily=void 0,s.fontStyles=void 0,s.appService=e,s.options=r,s.fontFamily={expressive:null!=(n=null==r||null==(o=r.fontFamily)?void 0:o.expressive)?n:["Roboto","sans-serif"],neutral:null!=(i=null==r||null==(a=r.fontFamily)?void 0:a.neutral)?i:["Roboto","sans-serif"]},s.fontStyles={display:{large:{fontWeight:400,fontSize:3.5625,lineHeight:4,letterSpacing:-.015625,fontFamily:exports.FontFamily.Expressive},medium:{fontWeight:400,fontSize:2.8125,lineHeight:3.25,fontFamily:exports.FontFamily.Expressive},small:{fontWeight:400,fontSize:2.25,lineHeight:2.75,fontFamily:exports.FontFamily.Expressive}},headline:{large:{fontWeight:400,fontSize:2,lineHeight:2.5,fontFamily:exports.FontFamily.Expressive},medium:{fontWeight:400,fontSize:1.75,lineHeight:2.25,fontFamily:exports.FontFamily.Expressive},small:{fontWeight:400,fontSize:1.5,lineHeight:2,fontFamily:exports.FontFamily.Expressive}},title:{large:{fontWeight:400,fontSize:1.375,lineHeight:1.75,fontFamily:exports.FontFamily.Neutral},medium:{fontWeight:500,fontSize:1,lineHeight:1.5,fontFamily:exports.FontFamily.Neutral,letterSpacing:.009375},small:{fontWeight:500,fontSize:.875,lineHeight:1.25,fontFamily:exports.FontFamily.Neutral,letterSpacing:.00625}},label:{large:{fontWeight:500,fontSize:.875,lineHeight:1.25,fontFamily:exports.FontFamily.Neutral,letterSpacing:.00625},medium:{fontWeight:500,fontSize:.75,lineHeight:1,fontFamily:exports.FontFamily.Neutral,letterSpacing:.03125},small:{fontWeight:500,fontSize:.6875,lineHeight:1,fontFamily:exports.FontFamily.Neutral,letterSpacing:.03125}},body:{large:{fontWeight:400,fontSize:1,lineHeight:1.5625,fontFamily:exports.FontFamily.Neutral,letterSpacing:.03125},medium:{fontWeight:400,fontSize:.875,lineHeight:1.25,fontFamily:exports.FontFamily.Neutral,letterSpacing:.015625},small:{fontWeight:400,fontSize:.75,lineHeight:1,fontFamily:exports.FontFamily.Neutral,letterSpacing:.025}}},r&&r.fontStyles&&Object.entries(r.fontStyles).forEach((function(t){var e=t[0];Object.entries(t[1]).forEach((function(t){var r=t[0],n=t[1];n&&(s.fontStyles[e][r]=u({},s.fontStyles[e][r],n))}))})),s}return c(e,t),e.config=function(t){return t},e.prototype.getFonts=function(){return{fontStyles:this.fontStyles,fontFamily:this.fontFamily}},e}(L),I=function(t){return o((function(e){V(e,{statePrefix:"state",disabledStyles:{textOpacity:.38,backgroundOpacity:.12},transition:{duration:150}},t)}),{})},V=function(t,e,r){for(var n=t.addComponents,o=e.statePrefix,i=e.disabledStyles,a=e.transition,u={},c=0,l=[!1,!0];c<l.length;c++)for(var f,g=l[c]?"group-":"",h=s(r);!(f=h()).done;){var p,d=f.value,v="."+g+o+"-"+d;u[v]=((p={})["@apply "+g+"hover:bg-"+d+"/[0.08]"]={},p["@apply "+g+"active:bg-"+d+"/[0.12]"]={},p["@apply "+g+"focus-visible:bg-"+d+"/[0.12]"]={},p),a&&(u[v]["@apply transition-colors"]={},u[v]["@apply duration-"+a.duration]={}),i&&(u[v]["@apply "+g+"disabled:text-on-surface/["+i.textOpacity+"]"]={},u[v]["@apply "+g+"disabled:bg-on-surface/["+i.backgroundOpacity+"]"]={})}for(var m,y=s(r);!(m=y()).done;)for(var C=m.value,S=0,k=["hover","active","focus","disabled"];S<k.length;S++){var b,P=k[S],x="."+P+"-"+o+"-"+C;if("active"===P||"focus"===P)u[x]=((b={})["@apply bg-"+C+"/[0.12]"]={},b);else if("hover"===P){var D;u[x]=((D={})["@apply bg-"+C+"/[0.08]"]={},D)}else if("disabled"===P){var w,F;u[x]=((w={})["@apply text-on-surface/["+i.textOpacity+"]"]={},w),u[x]=((F={})["@apply bg-on-surface/["+i.backgroundOpacity+"]"]={},F)}}n(u)},N=function(t,e){var r={defaultTheme:{extend:{colors:{}}},themes:[{name:"darkTheme",extend:{colors:{}}}]};return Object.entries(t).forEach((function(t){var e=t[0],n=t[1];r.defaultTheme.extend.colors[e]=n.light,r.themes[0].extend.colors[e]=n.dark})),r.themes[0].selectors="class"===e?[".dark-mode",'[data-theme="dark"]']:void 0,r.themes[0].mediaQuery="media"===e?"@media (prefers-color-scheme: dark)":void 0,require("tailwindcss-themer")(r)},R=function(t,e){return o((function(r){(0,r.addUtilities)(function(r){for(var n=r.theme,o="rem",i={},a=function(t){return{fontSize:t.fontSize+o,fontWeight:t.fontWeight,lineHeight:t.lineHeight+o,letterSpacing:t.letterSpacing?t.letterSpacing+o:null,fontFamily:n("fontFamily."+t.fontFamily)}},s=function(t,e,r){var i;return(i={})["@media (min-width: "+n("screens."+e,{})+")"]={fontSize:t.fontSize*r+o,lineHeight:t.lineHeight*r+o},i},c=0,l=Object.entries(t);c<l.length;c++)for(var f=l[c],g=f[0],h=function(){var t=d[p],r=t[1];i[".text-"+g+"-"+t[0]]=u({},a(r),Object.entries(e).reduce((function(t,e){return u({},t,s(r,e[0],e[1]))}),{}))},p=0,d=Object.entries(f[1]);p<d.length;p++)h();return i}({theme:r.theme}))}))},q=function(t){function e(e,r){var n;return(n=t.call(this)||this).appService=void 0,n.options=void 0,n.appService=e,n.options=r,n}return c(e,t),e.config=function(t){return t},e.prototype.getTheme=function(){for(var t={},e=0,r=[!1,!0];e<r.length;e++){var n=r[e];this.appService.themeService.update({isDark:n});for(var o,i=s(this.appService.colorService.getColors().entries());!(o=i()).done;){var a=o.value,u=a[1],c=a[0].replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();null!=t[c]||(t[c]={light:"",dark:""}),t[c][n?"dark":"light"]=u.getHex()}}var l=this.appService.pluginService.getPlugin(W).getFonts(),f=l.fontStyles;return{colors:{},fontFamily:l.fontFamily,plugins:[I(Object.keys(t)),N(t,this.options.darkMode),R(f,this.options.responsiveBreakPoints)]}},e}(L);q.dependencies=[W],exports.AppContainer=j,exports.AppModule=w,exports.AppService=D,exports.ColorEntity=v,exports.ColorManagerService=y,exports.ColorModule=C,exports.ColorService=i,exports.ConfigModule=E,exports.ConfigService=T,exports.ContrastCurve=h,exports.DynamicColor=p,exports.FontPlugin=W,exports.PluginAbstract=L,exports.PluginModule=M,exports.PluginService=A,exports.SchemeEntity=S,exports.SchemeService=k,exports.TailwindPlugin=q,exports.ThemeModule=x,exports.ThemeService=b,exports.ToneDeltaPair=d,exports.VariantEntity=function(t,e){void 0===t&&(t={}),this.palettes=void 0,this.customPalettes=void 0,this.palettes=t,this.customPalettes=e},exports.VariantModel=O,exports.VariantService=P,exports.bootstrap=function(){return j.resolve("appService")},exports.bootstrapFromConfig=z,exports.createTheme=function(){var t=z().pluginService.getPlugin(q);if(!t)throw new Error("Tailwind plugin not found");return t.getTheme()},exports.defaultColors=F,exports.defineConfig=function(t){if(!t||"object"!=typeof t)throw new Error("The configuration is missing or not an object");if(!("sourceColor"in t))throw new Error("Invalid configuration");return t},exports.getRotatedHue=H,exports.highestSurface=m,exports.importContainer=B,exports.state=I,exports.themer=N;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("awilix"),e=require("@material/material-color-utilities"),r=require("path"),n=require("node:fs"),o=require("tailwindcss/plugin"),i=function(){function t(t){var e=t.colorManagerService;this.colorManagerService=void 0,this.colorManagerService=e}var e=t.prototype;return e.getColors=function(){return this.colorManagerService.getAll()},e.addColor=function(t,e){return this.colorManagerService.createOrUpdate(t,e)},e.addColors=function(t){var e=this;Array.isArray(t)||(t=[t]),t.forEach((function(t){"function"==typeof t&&(t=t(e)),t.fromPalettes&&(Array.isArray(t.fromPalettes)||(t.fromPalettes=[t.fromPalettes]),t.fromPalettes.map((function(t){e.colorManagerService.addFromPalette(t)}))),t.colors&&Object.keys(t.colors).map((function(r){return e.addColor(r,t.colors[r])}))}))},e.getColor=function(t){return this.colorManagerService.get(t)},e.removeColor=function(t){return this.colorManagerService.remove(t)},e.updateColor=function(t,e){return this.colorManagerService.createOrUpdate(t,e)},t}();function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u.apply(null,arguments)}function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,l(t,e)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function f(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}var g,h=function(){function t(t,e,r,n){this.low=void 0,this.normal=void 0,this.medium=void 0,this.high=void 0,this.low=t,this.normal=e,this.medium=r,this.high=n}return t.prototype.get=function(t){return t<=-1?this.low:t<0?e.lerp(this.low,this.normal,(t- -1)/1):t<.5?e.lerp(this.normal,this.medium,(t-0)/.5):t<1?e.lerp(this.medium,this.high,(t-.5)/.5):this.high},t}(),p=function(){function t(t,e,r,n,o,i,a,s){if(this.name=void 0,this.palette=void 0,this.tone=void 0,this.isBackground=void 0,this.background=void 0,this.secondBackground=void 0,this.contrastCurve=void 0,this.toneDeltaPair=void 0,this.hctCache=new Map,this.name=t,this.palette=e,this.tone=r,this.isBackground=n,this.background=o,this.secondBackground=i,this.contrastCurve=a,this.toneDeltaPair=s,!o&&i)throw new Error("Color "+t+" has secondBackgrounddefined, but background is not defined.");if(!o&&a)throw new Error("Color "+t+" has contrastCurvedefined, but background is not defined.");if(o&&!a)throw new Error("Color "+t+" has backgrounddefined, but contrastCurve is not defined.")}t.fromPalette=function(e){var r,n;return new t(null!=(r=e.name)?r:"",e.palette,e.tone,null!=(n=e.isBackground)&&n,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)},t.foregroundTone=function(r,n){var o=e.Contrast.lighterUnsafe(r,n),i=e.Contrast.darkerUnsafe(r,n),a=e.Contrast.ratioOfTones(o,r),s=e.Contrast.ratioOfTones(i,r);if(t.tonePrefersLightForeground(r)){var u=Math.abs(a-s)<.1&&a<n&&s<n;return a>=n||a>=s||u?o:i}return s>=n||s>=a?i:o},t.tonePrefersLightForeground=function(t){return Math.round(t)<60},t.toneAllowsLightForeground=function(t){return Math.round(t)<=49},t.enableLightForeground=function(e){return t.tonePrefersLightForeground(e)&&!t.toneAllowsLightForeground(e)?49:e};var r=t.prototype;return r.getArgb=function(t){return this.getHct(t).toInt()},r.getHct=function(t){var e=this.hctCache.get(t);if(null!=e)return e;var r=this.getTone(t),n=this.palette(t).getHct(r);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,n),n},r.getTone=function(r){var n=r.contrastLevel<0;if(this.toneDeltaPair){var o=this.toneDeltaPair(r),i=o.roleA,a=o.roleB,s=o.delta,u=o.polarity,c=o.stayTogether,l=this.background(r).getTone(r),f="nearer"===u||"lighter"===u&&!r.isDark||"darker"===u&&r.isDark,g=f?i:a,h=f?a:i,p=this.name===g.name,d=r.isDark?1:-1,v=g.contrastCurve.get(r.contrastLevel),m=h.contrastCurve.get(r.contrastLevel),y=g.tone(r),C=e.Contrast.ratioOfTones(l,y)>=v?y:t.foregroundTone(l,v),S=h.tone(r),k=e.Contrast.ratioOfTones(l,S)>=m?S:t.foregroundTone(l,m);return n&&(C=t.foregroundTone(l,v),k=t.foregroundTone(l,m)),(k-C)*d>=s||((k=e.clampDouble(0,100,C+s*d))-C)*d>=s||(C=e.clampDouble(0,100,k-s*d)),50<=C&&C<60?d>0?(C=60,k=Math.max(k,C+s*d)):(C=49,k=Math.min(k,C+s*d)):50<=k&&k<60&&(c?d>0?(C=60,k=Math.max(k,C+s*d)):(C=49,k=Math.min(k,C+s*d)):k=d>0?60:49),p?C:k}var b=this.tone(r);if(null==this.background)return b;var P=this.background(r).getTone(r),x=this.contrastCurve.get(r.contrastLevel);if(e.Contrast.ratioOfTones(P,b)>=x||(b=t.foregroundTone(P,x)),n&&(b=t.foregroundTone(P,x)),this.isBackground&&50<=b&&b<60&&(b=e.Contrast.ratioOfTones(49,P)>=x?49:60),this.secondBackground){var D=[this.background,this.secondBackground],w=D[1],F=[(0,D[0])(r).getTone(r),w(r).getTone(r)],H=F[0],O=F[1],T=[Math.max(H,O),Math.min(H,O)],E=T[0],A=T[1];if(e.Contrast.ratioOfTones(E,b)>=x&&e.Contrast.ratioOfTones(A,b)>=x)return b;var M=e.Contrast.lighter(E,x),B=e.Contrast.darker(A,x),j=[];return-1!==M&&j.push(M),-1!==B&&j.push(B),t.tonePrefersLightForeground(H)||t.tonePrefersLightForeground(O)?M<0?100:M:1===j.length?j[0]:B<0?0:B}return b},t}(),d=function(t,e,r,n,o){this.roleA=void 0,this.roleB=void 0,this.delta=void 0,this.polarity=void 0,this.stayTogether=void 0,this.roleA=t,this.roleB=e,this.delta=r,this.polarity=n,this.stayTogether=o},v=function(){function t(t,e,r){this.option=void 0,this.schemeService=void 0,this.colorService=void 0,this.dynamicColor=null,this.option=t,this.schemeService=e,this.colorService=r}var r=t.prototype;return r.update=function(t){this.dynamicColor=null,this.option=u({},this.option,t)},r.getHex=function(){return e.hexFromArgb(this.getArgb())},r.getArgb=function(){return this.getDynamicColor().getArgb(this.schemeService.get())},r.getRgb=function(){return{r:(t=this.getArgb())>>16&255,g:t>>8&255,b:255&t};var t},r.getName=function(){return this.option.name.replace(/([A-Z])/g,"_$1").toLowerCase()},r.getDynamicColor=function(){return this.dynamicColor||(this.dynamicColor=p.fromPalette(u({},this.option,{name:this.getName()}))),this.dynamicColor},t}(),m=function(t,e){return e instanceof i?t.isDark?e.getColor("surfaceBright").getDynamicColor():e.getColor("surfaceDim").getDynamicColor():t.isDark?e.get("surfaceBright").getDynamicColor():e.get("surfaceDim").getDynamicColor()},y=function(){function t(t){var e=t.schemeService;this.colorMap=new Map,this.schemeService=void 0,this.schemeService=e}var e=t.prototype;return e.createOrUpdate=function(t,e){var r=this.colorMap.get(t);if(r)r.update(u({},e,{name:t})),this.colorMap.set(t,r);else{var n=e.palette,o=e.tone;if(!n||!o)throw new Error("Palette "+t+" does not exist");r=new v(u({},e,{palette:n,tone:o,name:t}),this.schemeService,this),this.colorMap.set(t,r)}return r},e.remove=function(t){return this.colorMap.delete(t)},e.get=function(t){var e=this.colorMap.get(t);if(e)return e;throw new Error("Color "+t+" does not exist")},e.getAll=function(){return this.colorMap},e.addFromPalette=function(t){var e,r=this,n=t,o=(e=t).charAt(0).toUpperCase()+e.slice(1),i="on"+o,a=n+"Container",s="on"+o+"Container",u="inverse"+o,c=n+"Fixed",l=n+"FixedDim",f="on"+o+"Fixed",g="on"+o+"FixedVariant";this.createOrUpdate(n,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?80:40},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(3,4.5,7,11),toneDeltaPair:function(t){return new d(r.get(a).getDynamicColor(),r.get(n).getDynamicColor(),15,"nearer",!1)}}),this.createOrUpdate(i,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?20:100},background:function(t){return r.get(n).getDynamicColor()},contrastCurve:new h(4.5,7,11,21)}),this.createOrUpdate(a,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?30:90},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(t){return new d(r.get(a).getDynamicColor(),r.get(n).getDynamicColor(),15,"nearer",!1)}}),this.createOrUpdate(s,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?90:10},background:function(t){return r.get(a).getDynamicColor()},contrastCurve:new h(4.5,7,11,21)}),this.createOrUpdate(u,{palette:function(e){return e.getPalette(t)},tone:function(t){return t.isDark?40:80},background:function(t){return r.get("inverseSurface").getDynamicColor()},contrastCurve:new h(3,4.5,7,11)}),this.createOrUpdate(c,{palette:function(e){return e.getPalette(t)},tone:function(t){return 90},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(t){return new d(r.get(c).getDynamicColor(),r.get(l).getDynamicColor(),10,"lighter",!0)}}),this.createOrUpdate(l,{palette:function(e){return e.getPalette(t)},tone:function(t){return 80},isBackground:!0,background:function(t){return m(t,r)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(t){return new d(r.get(c).getDynamicColor(),r.get(l).getDynamicColor(),10,"lighter",!0)}}),this.createOrUpdate(f,{palette:function(e){return e.getPalette(t)},tone:function(t){return 10},background:function(t){return r.get(l).getDynamicColor()},secondBackground:function(t){return r.get(c).getDynamicColor()},contrastCurve:new h(4.5,7,11,21)}),this.createOrUpdate(g,{palette:function(e){return e.getPalette(t)},tone:function(t){return 30},background:function(t){return r.get(l).getDynamicColor()},secondBackground:function(t){return r.get(c).getDynamicColor()},contrastCurve:new h(3,4.5,7,11)})},t}(),C={colorManagerService:t.asClass(y).singleton(),colorService:t.asClass(i).singleton()},S=function(){function t(t){this.options=void 0,this.options=t}var r,n;return t.prototype.getPalette=function(t){if(!this.options)throw new Error("Scheme options is not set");var e=this.options.palettes.get(t);if(!e)throw new Error("Palette "+t+" not found");return e},r=t,(n=[{key:"contrastLevel",get:function(){if(!this.options)throw new Error("Scheme options is not set");return this.options.contrastLevel}},{key:"isDark",get:function(){if(!this.options)throw new Error("Scheme options is not set");return this.options.isDark}},{key:"sourceColorHct",get:function(){if(!this.options)throw new Error("Scheme options is not set");return e.Hct.fromInt(this.options.sourceColorArgb)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(),k=function(){function t(){this.schemeEntity=void 0,this.options=void 0}var r=t.prototype;return r.createOrUpdate=function(t){var r,n;this.options=u({},this.options,t,{sourcesColorHex:u({},null==(r=this.options)?void 0:r.sourcesColorHex,t.sourcesColorHex),palettes:u({},null==(n=this.options)?void 0:n.palettes,t.palettes)});var o=new Map;if(!this.options.sourcesColorHex.primary)throw new Error("Primary source color is not set");var i=e.argbFromHex(this.options.sourcesColorHex.primary),a=e.Hct.fromInt(i);if(this.options.palettes){for(var s=0,c=Object.entries(this.options.palettes);s<c.length;s++){var l=c[s],f=l[0],g=l[1],h=g.sourceColorkey,p=g.tonalPalette,d=void 0;if(h){var v=e.argbFromHex(this.options.sourcesColorHex[h]);d=p(e.Hct.fromInt(v))}else d=p(a);o.set(f,d)}this.schemeEntity=new S(u({},this.options,{palettes:o,sourceColorArgb:i}))}},r.get=function(){if(!this.schemeEntity)throw new Error("Scheme is not created");return this.schemeEntity},t}(),b=function(){function t(t){var e=t.schemeService,r=t.variantService;this.schemeService=void 0,this.variantService=void 0,this.schemeService=e,this.variantService=r}var e=t.prototype;return e.create=function(t){this.schemeService.createOrUpdate(u({},t,{sourcesColorHex:{primary:t.sourceColorHex}})),this.variantService.set(t.variant)},e.update=function(t){var e=u({},t);t.sourceColorHex&&(e.sourcesColorHex={primary:t.sourceColorHex}),this.schemeService.createOrUpdate(e),t.variant&&this.variantService.set(t.variant)},e.addCustomPalette=function(t,e){this.variantService.addCustomPalette(t,e)},t}(),P=function(){function t(t){var e=t.schemeService;this.customPalettes={},this.variantEntity=void 0,this.schemeService=void 0,this.schemeService=e}var r=t.prototype;return r.addCustomPalette=function(t,e){this.customPalettes[t]=e,this.update()},r.set=function(t){this.variantEntity=t,t.palettes.error||(t.palettes.error=function(){return e.TonalPalette.fromHueAndChroma(25,84)}),this.update()},r.update=function(){var t=this;if(this.variantEntity){var e={};Object.keys(this.variantEntity.palettes).forEach((function(r){e[r]={tonalPalette:t.variantEntity.palettes[r]}})),this.variantEntity.customPalettes&&Object.keys(this.customPalettes).forEach((function(r){e[r]={sourceColorkey:r,tonalPalette:t.variantEntity.customPalettes}})),this.schemeService.createOrUpdate({sourcesColorHex:this.customPalettes,palettes:e})}},t}(),x={schemeService:t.asClass(k).singleton(),variantService:t.asClass(P).singleton(),themeService:t.asClass(b).singleton()},D=function(t){var e=t.colorService,r=t.themeService,n=t.pluginService;this.colorService=void 0,this.themeService=void 0,this.pluginService=void 0,this.pluginService=n,this.colorService=e,this.themeService=r},w={appService:t.asClass(D).singleton()},F=function(t){return{fromPalettes:["primary","secondary","tertiary"],colors:{background:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?6:98},isBackground:!0},onBackground:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?90:10},background:function(e){return t.getColor("background").getDynamicColor()},contrastCurve:new h(3,3,4.5,7)},surface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?6:98},isBackground:!0},surfaceDim:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?6:87},isBackground:!0},surfaceBright:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?24:98},isBackground:!0},surfaceContainerLowest:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?4:100},isBackground:!0},surfaceContainerLow:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?10:96},isBackground:!0},surfaceContainer:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?12:94},isBackground:!0},surfaceContainerHigh:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?17:92},isBackground:!0},surfaceContainerHighest:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?22:90},isBackground:!0},onSurface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?90:10},background:function(e){return m(e,t)},contrastCurve:new h(4.5,7,11,21)},surfaceVariant:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?30:90},isBackground:!0},onSurfaceVariant:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?80:30},background:function(e){return m(e,t)},contrastCurve:new h(3,4.5,7,11)},inverseSurface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?90:20}},inverseOnSurface:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?20:95},background:function(e){return t.getColor("inverseSurface").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},outline:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?60:50},background:function(e){return m(e,t)},contrastCurve:new h(1.5,3,4.5,7)},outlineVariant:{palette:function(t){return t.getPalette("neutralVariant")},tone:function(t){return t.isDark?30:80},background:function(e){return m(e,t)},contrastCurve:new h(1,1,3,7)},shadow:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return 0}},scrim:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return 0}},surfaceTint:{palette:function(t){return t.getPalette("neutral")},tone:function(t){return t.isDark?80:40},isBackground:!0},secondaryContainer:{tone:function(t){var r=t.isDark?30:90;return function(t,r,n,o){var i=n,a=e.Hct.from(t,r,n);if(a.chroma<r)for(var s=a.chroma;a.chroma<r;){var u=e.Hct.from(t,r,i+=o?-1:1);if(s>u.chroma)break;if(Math.abs(u.chroma-r)<.4)break;Math.abs(u.chroma-r)<Math.abs(a.chroma-r)&&(a=u),s=Math.max(s,u.chroma)}return i}(t.getPalette("secondary").hue,t.getPalette("secondary").chroma,r,!t.isDark)}},onSecondaryContainer:{tone:function(e){return p.foregroundTone(t.getColor("secondaryContainer").getDynamicColor().tone(e),4.5)}},tertiaryContainer:{palette:function(t){return t.getPalette("tertiary")},tone:function(t){var r=t.getPalette("tertiary").getHct(t.sourceColorHct.tone);return e.DislikeAnalyzer.fixIfDisliked(r).tone}},onTertiaryContainer:{palette:function(t){return t.getPalette("tertiary")},tone:function(e){return p.foregroundTone(t.getColor("tertiaryContainer").getDynamicColor().tone(e),4.5)}},error:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?80:40},isBackground:!0,background:function(e){return m(e,t)},contrastCurve:new h(3,4.5,7,11),toneDeltaPair:function(e){return new d(t.getColor("errorContainer").getDynamicColor(),t.getColor("error").getDynamicColor(),15,"nearer",!1)}},onError:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?20:100},background:function(e){return t.getColor("error").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},errorContainer:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?30:90},isBackground:!0,background:function(e){return m(e,t)},contrastCurve:new h(1,1,3,7),toneDeltaPair:function(e){return new d(t.getColor("errorContainer").getDynamicColor(),t.getColor("error").getDynamicColor(),15,"nearer",!1)}},onErrorContainer:{palette:function(t){return t.getPalette("error")},tone:function(t){return t.isDark?90:10},background:function(e){return t.getColor("errorContainer").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},onTertiaryFixed:{palette:function(t){return t.getPalette("tertiary")},tone:function(t){return 10},background:function(e){return t.getColor("tertiaryFixedDim").getDynamicColor()},secondBackground:function(e){return t.getColor("tertiaryFixed").getDynamicColor()},contrastCurve:new h(4.5,7,11,21)},onTertiaryFixedVariant:{palette:function(t){return t.getPalette("tertiary")},tone:function(t){return 30},background:function(e){return t.getColor("tertiaryFixedDim").getDynamicColor()},secondBackground:function(e){return t.getColor("tertiaryFixed").getDynamicColor()},contrastCurve:new h(3,4.5,7,11)}}}},H=function(t,r,n){var o=t.hue;if(r.length!==n.length)throw new Error("mismatch between hue length "+r.length+" & rotations "+n.length);if(1===n.length)return e.sanitizeDegreesDouble(t.hue+n[0]);for(var i=r.length,a=0;a<=i-2;a++)if(r[a]<o&&o<r[a+1])return e.sanitizeDegreesDouble(o+n[a]);return o},O=function(){};g=O,O.tonalSpot={palettes:{primary:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,36)},secondary:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,16)},tertiary:function(t){return e.TonalPalette.fromHueAndChroma(e.sanitizeDegreesDouble(t.hue+60),24)},neutral:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,6)},neutralVariant:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,8)}},customPalettes:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,16)}},O.vibrant={palettes:{primary:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,200)},secondary:function(t){return e.TonalPalette.fromHueAndChroma(H(t,g.hues,g.secondaryRotations),24)},tertiary:function(t){return e.TonalPalette.fromHueAndChroma(H(t,g.hues,g.tertiaryRotations),32)},neutral:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,6)},neutralVariant:function(t){return e.TonalPalette.fromHueAndChroma(t.hue,8)}},customPalettes:function(t){return e.TonalPalette.fromHueAndChroma(H(t,g.hues,g.secondaryRotations),24)}},O.hues=[0,41,61,101,131,181,251,301,360],O.secondaryRotations=[18,15,10,12,15,18,15,12,12],O.tertiaryRotations=[35,30,20,25,30,35,30,25,25];var T=function(){function t(t){var e=t.appService;this.configPath="./theme.config",this.appService=void 0,this.appService=e}var e=t.prototype;return e.loadConfig=function(){var t=this.appService,e=t.themeService,r=t.colorService,n=t.pluginService,o=this.getConfig(),i=o.contrastLevel,a=o.isDark,s=o.variant,u=o.palettes,c=o.colors,l=o.useDefaultColors,f=void 0===l||l,g=o.plugins;e.create({contrastLevel:void 0===i?0:i,isDark:void 0!==a&&a,sourceColorHex:o.sourceColor,variant:void 0===s?O.tonalSpot:s}),u&&Object.entries(u).forEach((function(t){return e.addCustomPalette(t[0],t[1])})),f&&r.addColors(F),c&&r.addColors(c),g&&(g.forEach((function(t){Array.isArray(t)?n.addPlugin(t[0],t[1]):n.addPlugin(t,{})})),n.loadPlugins(this.appService))},e.getConfig=function(){for(var t=r.resolve(this.configPath),e=null,o=0,i=[".js",".ts",".jms",".jcs"];o<i.length;o++){var a=t+i[o];if(n.existsSync(a)){e=require(a);break}}if(!e)throw new Error("Configuration file not found");return"default"in e?e.default:e},t}(),E={configService:t.asClass(T).singleton()},A=function(){function t(){this.pluginInstances=new Map,this.pluginConstructors=new Map}var e=t.prototype;return e.addPlugin=function(t,e){this.pluginConstructors.set(t.name,[t,e])},e.loadPlugins=function(t){var e=this,r=new Map(this.pluginConstructors),n=0;do{n=r.size,r.forEach((function(n,o){var i=n[0],a=n[1];0===i.dependencies.filter((function(t){return!e.pluginInstances.has(t.name)})).length&&(e.pluginInstances.set(i.name,new i(t,a)),r.delete(o))}))}while(0!=r.size&&r.size<n);r.size>0&&console.log("Some plugins couldn't be loaded due to missing dependencies: ",Array.from(r.keys()))},e.getPlugin=function(t){var e=this.pluginInstances.get(t.name);if(!e)throw new Error("Plugin "+t.name+" not found");return e},t}(),M={pluginService:t.asClass(A).singleton()};function B(t,e){return e.forEach((function(e){Object.entries(e).forEach((function(e){t.register(e[0],e[1])}))})),t}var j=t.createContainer({injectionMode:t.InjectionMode.PROXY});function z(t){var e=j.resolve("configService");return t&&(e.configPath=t),e.loadConfig(),j.resolve("appService")}B(j,[E,w,M,C,x]);var U,L=function(){};L.dependencies=[],exports.FontFamily=void 0,(U=exports.FontFamily||(exports.FontFamily={})).Expressive="expressive",U.Neutral="neutral";var W=function(t){function e(e,r){var n,o,i,a,s;return(s=t.call(this)||this).appService=void 0,s.options=void 0,s.fontFamily=void 0,s.fontStyles=void 0,s.appService=e,s.options=r,s.fontFamily={expressive:null!=(n=null==r||null==(o=r.fontFamily)?void 0:o.expressive)?n:["Roboto","sans-serif"],neutral:null!=(i=null==r||null==(a=r.fontFamily)?void 0:a.neutral)?i:["Roboto","sans-serif"]},s.fontStyles={display:{large:{fontWeight:400,fontSize:3.5625,lineHeight:4,letterSpacing:-.015625,fontFamily:exports.FontFamily.Expressive},medium:{fontWeight:400,fontSize:2.8125,lineHeight:3.25,fontFamily:exports.FontFamily.Expressive},small:{fontWeight:400,fontSize:2.25,lineHeight:2.75,fontFamily:exports.FontFamily.Expressive}},headline:{large:{fontWeight:400,fontSize:2,lineHeight:2.5,fontFamily:exports.FontFamily.Expressive},medium:{fontWeight:400,fontSize:1.75,lineHeight:2.25,fontFamily:exports.FontFamily.Expressive},small:{fontWeight:400,fontSize:1.5,lineHeight:2,fontFamily:exports.FontFamily.Expressive}},title:{large:{fontWeight:400,fontSize:1.375,lineHeight:1.75,fontFamily:exports.FontFamily.Neutral},medium:{fontWeight:500,fontSize:1,lineHeight:1.5,fontFamily:exports.FontFamily.Neutral,letterSpacing:.009375},small:{fontWeight:500,fontSize:.875,lineHeight:1.25,fontFamily:exports.FontFamily.Neutral,letterSpacing:.00625}},label:{large:{fontWeight:500,fontSize:.875,lineHeight:1.25,fontFamily:exports.FontFamily.Neutral,letterSpacing:.00625},medium:{fontWeight:500,fontSize:.75,lineHeight:1,fontFamily:exports.FontFamily.Neutral,letterSpacing:.03125},small:{fontWeight:500,fontSize:.6875,lineHeight:1,fontFamily:exports.FontFamily.Neutral,letterSpacing:.03125}},body:{large:{fontWeight:400,fontSize:1,lineHeight:1.5625,fontFamily:exports.FontFamily.Neutral,letterSpacing:.03125},medium:{fontWeight:400,fontSize:.875,lineHeight:1.25,fontFamily:exports.FontFamily.Neutral,letterSpacing:.015625},small:{fontWeight:400,fontSize:.75,lineHeight:1,fontFamily:exports.FontFamily.Neutral,letterSpacing:.025}}},r&&r.fontStyles&&Object.entries(r.fontStyles).forEach((function(t){var e=t[0];Object.entries(t[1]).forEach((function(t){var r=t[0],n=t[1];n&&(s.fontStyles[e][r]=u({},s.fontStyles[e][r],n))}))})),s}return c(e,t),e.config=function(t){return t},e.prototype.getFonts=function(){return{fontStyles:this.fontStyles,fontFamily:this.fontFamily}},e}(L),I=function(t){return o((function(e){V(e,{statePrefix:"state",disabledStyles:{textOpacity:.38,backgroundOpacity:.12},transition:{duration:150}},t)}),{})},V=function(t,e,r){for(var n=t.addComponents,o=e.statePrefix,i=e.disabledStyles,a=e.transition,u={},c=0,l=[!1,!0];c<l.length;c++)for(var f,g=l[c]?"group-":"",h=s(r);!(f=h()).done;){var p,d=f.value,v="."+g+o+"-"+d;u[v]=((p={})["@apply "+g+"hover:bg-"+d+"/[0.08]"]={},p["@apply "+g+"active:bg-"+d+"/[0.12]"]={},p["@apply "+g+"focus-visible:bg-"+d+"/[0.12]"]={},p),a&&(u[v]["@apply transition-colors"]={},u[v]["@apply duration-"+a.duration]={}),i&&(u[v]["@apply "+g+"disabled:text-on-surface/["+i.textOpacity+"]"]={},u[v]["@apply "+g+"disabled:bg-on-surface/["+i.backgroundOpacity+"]"]={})}for(var m,y=s(r);!(m=y()).done;)for(var C=m.value,S=0,k=["hover","active","focus","disabled"];S<k.length;S++){var b,P=k[S],x="."+P+"-"+o+"-"+C;if("active"===P||"focus"===P)u[x]=((b={})["@apply bg-"+C+"/[0.12]"]={},b);else if("hover"===P){var D;u[x]=((D={})["@apply bg-"+C+"/[0.08]"]={},D)}else if("disabled"===P){var w,F;u[x]=((w={})["@apply text-on-surface/["+i.textOpacity+"]"]={},w),u[x]=((F={})["@apply bg-on-surface/["+i.backgroundOpacity+"]"]={},F)}}n(u)},N=function(t,e){var r={defaultTheme:{extend:{colors:{}}},themes:[{name:"darkTheme",extend:{colors:{}}}]};return Object.entries(t).forEach((function(t){var e=t[0],n=t[1];r.defaultTheme.extend.colors[e]=n.light,r.themes[0].extend.colors[e]=n.dark})),r.themes[0].selectors="class"===e?[".dark-mode",'[data-theme="dark"]']:void 0,r.themes[0].mediaQuery="media"===e?"@media (prefers-color-scheme: dark)":void 0,require("tailwindcss-themer")(r)},R=function(t,e){return o((function(r){(0,r.addUtilities)(function(r){for(var n=r.theme,o="rem",i={},a=function(t){return{fontSize:t.fontSize+o,fontWeight:t.fontWeight,lineHeight:t.lineHeight+o,letterSpacing:t.letterSpacing?t.letterSpacing+o:null,fontFamily:n("fontFamily."+t.fontFamily)}},s=function(t,e,r){var i;return(i={})["@media (min-width: "+n("screens."+e,{})+")"]={fontSize:t.fontSize*r+o,lineHeight:t.lineHeight*r+o},i},c=0,l=Object.entries(t);c<l.length;c++)for(var f=l[c],g=f[0],h=function(){var t=d[p],r=t[1];i[".text-"+g+"-"+t[0]]=u({},a(r),Object.entries(e).reduce((function(t,e){return u({},t,s(r,e[0],e[1]))}),{}))},p=0,d=Object.entries(f[1]);p<d.length;p++)h();return i}({theme:r.theme}))}))},q=function(t){function e(e,r){var n;return null!=r.darkMode||(r.darkMode="class"),null!=r.responsiveBreakPoints||(r.responsiveBreakPoints={lg:1.125}),(n=t.call(this)||this).appService=void 0,n.options=void 0,n.appService=e,n.options=r,n}return c(e,t),e.config=function(t){return t},e.prototype.getTheme=function(){for(var t={},e=0,r=[!1,!0];e<r.length;e++){var n=r[e];this.appService.themeService.update({isDark:n});for(var o,i=s(this.appService.colorService.getColors().entries());!(o=i()).done;){var a=o.value,u=a[1],c=a[0].replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();null!=t[c]||(t[c]={light:"",dark:""}),t[c][n?"dark":"light"]=u.getHex()}}var l=this.appService.pluginService.getPlugin(W).getFonts(),f=l.fontStyles;return{colors:{},fontFamily:l.fontFamily,plugins:[I(Object.keys(t)),N(t,this.options.darkMode),R(f,this.options.responsiveBreakPoints)]}},e}(L);q.dependencies=[W],exports.AppContainer=j,exports.AppModule=w,exports.AppService=D,exports.ColorEntity=v,exports.ColorManagerService=y,exports.ColorModule=C,exports.ColorService=i,exports.ConfigModule=E,exports.ConfigService=T,exports.ContrastCurve=h,exports.DynamicColor=p,exports.FontPlugin=W,exports.PluginAbstract=L,exports.PluginModule=M,exports.PluginService=A,exports.SchemeEntity=S,exports.SchemeService=k,exports.TailwindPlugin=q,exports.ThemeModule=x,exports.ThemeService=b,exports.ToneDeltaPair=d,exports.VariantEntity=function(t,e){void 0===t&&(t={}),this.palettes=void 0,this.customPalettes=void 0,this.palettes=t,this.customPalettes=e},exports.VariantModel=O,exports.VariantService=P,exports.bootstrap=function(){return j.resolve("appService")},exports.bootstrapFromConfig=z,exports.createTheme=function(){var t=z().pluginService.getPlugin(q);if(!t)throw new Error("Tailwind plugin not found");return t.getTheme()},exports.defaultColors=F,exports.defineConfig=function(t){if(!t||"object"!=typeof t)throw new Error("The configuration is missing or not an object");if(!("sourceColor"in t))throw new Error("Invalid configuration");return t},exports.getRotatedHue=H,exports.highestSurface=m,exports.importContainer=B,exports.state=I,exports.themer=N;
2
2
  //# sourceMappingURL=theme.cjs.production.min.js.map