tailwind-clamp 4.2.2 → 4.3.1
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.
- package/README.md +82 -0
- package/dist/index.js +708 -664
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(U,I){typeof exports=="object"&&typeof module<"u"?module.exports=I():typeof define=="function"&&define.amd?define(I):(U=typeof globalThis<"u"?globalThis:U||self,U["tailwind-clamp"]=I())})(this,(function(){"use strict";var Zn=Object.defineProperty;var Kn=(U,I,te)=>I in U?Zn(U,I,{enumerable:!0,configurable:!0,writable:!0,value:te}):U[I]=te;var C=(U,I,te)=>Kn(U,typeof I!="symbol"?I+"":I,te);function U(t,e){return{handler:t,config:e}}U.withOptions=function(t,e=()=>({})){function n(r){return{handler:t(r),config:e(r)}}return n.__isOptionsFunction=!0,n};var I=U;const te=t=>{switch(t){case"p":return{type:"spacing",key:"padding",props:["padding"]};case"pt":return{type:"spacing",key:"padding",props:["paddingTop"]};case"pb":return{type:"spacing",key:"padding",props:["paddingBottom"]};case"pl":return{type:"spacing",key:"padding",props:["paddingLeft"]};case"ps":return{type:"spacing",key:"padding",props:["paddingInlineStart"]};case"pr":return{type:"spacing",key:"padding",props:["paddingRight"]};case"pe":return{type:"spacing",key:"padding",props:["paddingInlineEnd"]};case"px":return{type:"spacing",key:"padding",props:["paddingInline"]};case"py":return{type:"spacing",key:"padding",props:["paddingBlock"]};case"m":return{type:"spacing",key:"margin",props:["margin"]};case"mt":return{type:"spacing",key:"margin",props:["marginTop"]};case"mb":return{type:"spacing",key:"margin",props:["marginBottom"]};case"ml":return{type:"spacing",key:"margin",props:["marginLeft"]};case"ms":return{type:"spacing",key:"margin",props:["marginInlineStart"]};case"mr":return{type:"spacing",key:"margin",props:["marginRight"]};case"me":return{type:"spacing",key:"margin",props:["marginInlineEnd"]};case"mx":return{type:"spacing",key:"margin",props:["marginInline"]};case"my":return{type:"spacing",key:"margin",props:["marginBlock"]};case"inset":return{type:"spacing",key:"inset",props:["inset"]};case"inset-x":return{type:"spacing",key:"inset",props:["insetInline"]};case"inset-y":return{type:"spacing",key:"inset",props:["insetBlock"]};case"start":return{type:"spacing",key:"inset",props:["insetInlineStart"]};case"end":return{type:"spacing",key:"inset",props:["insetInlineEnd"]};case"top":return{type:"spacing",key:"inset",props:["top"]};case"left":return{type:"spacing",key:"inset",props:["left"]};case"right":return{type:"spacing",key:"inset",props:["right"]};case"bottom":return{type:"spacing",key:"inset",props:["bottom"]};case"gap":return{type:"spacing",key:"gap",props:["gap"]};case"gap-x":return{type:"spacing",key:"gap",props:["columnGap"]};case"gap-y":return{type:"spacing",key:"gap",props:["rowGap"]};case"w":return{type:"spacing",key:"width",props:["width"]};case"h":return{type:"spacing",key:"height",props:["height"]};case"size":return{type:"spacing",key:"size",props:["width","height"]};case"min-w":return{type:"spacing",key:"minWidth",props:["minWidth"]};case"min-h":return{type:"spacing",key:"minHeight",props:["minHeight"]};case"max-w":return{type:"spacing",key:"maxWidth",props:["maxWidth"]};case"max-h":return{type:"spacing",key:"maxHeight",props:["maxHeight"]};case"scroll-m":return{type:"spacing",key:"scrollMargin",props:["scrollMargin"]};case"scroll-mx":return{type:"spacing",key:"scrollMargin",props:["scrollMarginInline"]};case"scroll-my":return{type:"spacing",key:"scrollMargin",props:["scrollMarginBlock"]};case"scroll-ms":return{type:"spacing",key:"scrollMargin",props:["scrollMarginInlineStart"]};case"scroll-me":return{type:"spacing",key:"scrollMargin",props:["scrollMarginInlineEnd"]};case"scroll-mt":return{type:"spacing",key:"scrollMargin",props:["scrollMarginTop"]};case"scroll-mb":return{type:"spacing",key:"scrollMargin",props:["scrollMarginBottom"]};case"scroll-ml":return{type:"spacing",key:"scrollMargin",props:["scrollMarginLeft"]};case"scroll-mr":return{type:"spacing",key:"scrollMargin",props:["scrollMarginRight"]};case"scroll-p":return{type:"spacing",key:"scrollPadding",props:["scrollPadding"]};case"scroll-px":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingInline"]};case"scroll-py":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingBlock"]};case"scroll-ps":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingInlineStart"]};case"scroll-pe":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingInlineEnd"]};case"scroll-pt":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingTop"]};case"scroll-pb":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingBottom"]};case"scroll-pl":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingLeft"]};case"scroll-pr":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingRight"]};case"translate":return{type:"spacing",key:"translate",props:["--tw-translate-x","--tw-translate-y",{translate:"var(--tw-translate-x) var(--tw-translate-y)"}]};case"translate-x":return{type:"spacing",key:"translate",props:["--tw-translate-x",{translate:"var(--tw-translate-x) var(--tw-translate-y)"}]};case"translate-y":return{type:"spacing",key:"translate",props:["--tw-translate-y",{translate:"var(--tw-translate-x) var(--tw-translate-y)"}]};case"underline-offset":return{type:"regular",key:"textUnderlineOffset",props:["textUnderlineOffset"]};case"stroke":return{type:"regular",key:"strokeWidth",props:["strokeWidth"]};case"border":return{type:"regular",key:"borderWidth",props:["borderWidth"]};case"border-t":return{type:"regular",key:"borderWidth",props:["borderTopWidth"]};case"border-b":return{type:"regular",key:"borderWidth",props:["borderBottomWidth"]};case"border-l":return{type:"regular",key:"borderWidth",props:["borderLeftWidth"]};case"border-s":return{type:"regular",key:"borderWidth",props:["borderInlineStartWidth"]};case"border-r":return{type:"regular",key:"borderWidth",props:["borderRightWidth"]};case"border-e":return{type:"regular",key:"borderWidth",props:["borderInlineEndWidth"]};case"border-x":return{type:"regular",key:"borderWidth",props:["borderInlineWidth"]};case"border-y":return{type:"regular",key:"borderWidth",props:["borderBlockWidth"]};case"decoration":return{type:"regular",key:"textDecorationThickness",props:["textDecorationThickness"]};case"rounded":return{type:"regular",key:"borderRadius",props:["borderRadius"]};case"rounded-s":return{type:"regular",key:"borderRadius",props:["borderStartStartRadius","borderEndStartRadius"]};case"rounded-ss":return{type:"regular",key:"borderRadius",props:["borderStartStartRadius"]};case"rounded-se":return{type:"regular",key:"borderRadius",props:["borderStartEndRadius"]};case"rounded-e":return{type:"regular",key:"borderRadius",props:["borderStartEndRadius","borderEndEndRadius"]};case"rounded-ee":return{type:"regular",key:"borderRadius",props:["borderEndEndRadius"]};case"rounded-es":return{type:"regular",key:"borderRadius",props:["borderEndStartRadius"]};case"rounded-t":return{type:"regular",key:"borderRadius",props:["borderTopLeftRadius","borderTopRightRadius"]};case"rounded-r":return{type:"regular",key:"borderRadius",props:["borderTopRightRadius","borderBottomRightRadius"]};case"rounded-b":return{type:"regular",key:"borderRadius",props:["borderBottomLeftRadius","borderBottomRightRadius"]};case"rounded-l":return{type:"regular",key:"borderRadius",props:["borderTopLeftRadius","borderBottomLeftRadius"]};case"rounded-tl":return{type:"regular",key:"borderRadius",props:["borderTopLeftRadius"]};case"rounded-tr":return{type:"regular",key:"borderRadius",props:["borderTopRightRadius"]};case"rounded-bl":return{type:"regular",key:"borderRadius",props:["borderBottomLeftRadius"]};case"rounded-br":return{type:"regular",key:"borderRadius",props:["borderBottomRightRadius"]};case"leading":return{type:"regular",key:"lineHeight",props:["lineHeight"]};case"tracking":return{type:"regular",key:"letterSpacing",props:["letterSpacing"]};case"text":return{type:"fontSize",key:"fontSize",props:["fontSize"]};default:return null}},ve={error(){console.log("\x1B[31m",...arguments,"\x1B[0m")},warn(){console.log("\x1B[33m",...arguments,"\x1B[0m")},info(){console.log("\x1B[34m",...arguments,"\x1B[0m")},log(){console.log("\x1B[90m",...arguments,"\x1B[0m")}};class Pe extends Error{constructor(n,r,o,i){super(n);C(this,"sourceStart");C(this,"sourceEnd");C(this,"parserState");this.name="ParseError",this.sourceStart=r,this.sourceEnd=o,this.parserState=i}}class Z extends Pe{constructor(n,r,o,i,s){super(n,r,o,i);C(this,"token");this.token=s}}const j={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'};function G(...t){let e="";for(let n=0;n<t.length;n++)e+=t[n][1];return e}const ne=13,k=45,re=10,oe=43,K=65533;function ut(t){return t.source.codePointAt(t.cursor)===60&&t.source.codePointAt(t.cursor+1)===33&&t.source.codePointAt(t.cursor+2)===k&&t.source.codePointAt(t.cursor+3)===k}function W(t){return t>=48&&t<=57}function ct(t){return t>=65&&t<=90}function lt(t){return t>=97&&t<=122}function ie(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function dt(t){return lt(t)||ct(t)}function ae(t){return dt(t)||pt(t)||t===95}function xe(t){return ae(t)||W(t)||t===k}function pt(t){return t===183||t===8204||t===8205||t===8255||t===8256||t===8204||192<=t&&t<=214||216<=t&&t<=246||248<=t&&t<=893||895<=t&&t<=8191||8304<=t&&t<=8591||11264<=t&&t<=12271||12289<=t&&t<=55295||63744<=t&&t<=64975||65008<=t&&t<=65533||t===0||!!se(t)||t>=65536}function ke(t){return t===re||t===ne||t===12}function X(t){return t===32||t===re||t===9||t===ne||t===12}function se(t){return t>=55296&&t<=57343}function ue(t){return t.source.codePointAt(t.cursor)===92&&!ke(t.source.codePointAt(t.cursor+1)??-1)}function be(t,e){return e.source.codePointAt(e.cursor)===k?e.source.codePointAt(e.cursor+1)===k||!!ae(e.source.codePointAt(e.cursor+1)??-1)||e.source.codePointAt(e.cursor+1)===92&&!ke(e.source.codePointAt(e.cursor+2)??-1):!!ae(e.source.codePointAt(e.cursor)??-1)||ue(e)}function He(t){return t.source.codePointAt(t.cursor)===oe||t.source.codePointAt(t.cursor)===k?!!W(t.source.codePointAt(t.cursor+1)??-1)||t.source.codePointAt(t.cursor+1)===46&&W(t.source.codePointAt(t.cursor+2)??-1):t.source.codePointAt(t.cursor)===46?W(t.source.codePointAt(t.cursor+1)??-1):W(t.source.codePointAt(t.cursor)??-1)}function ft(t){return t.source.codePointAt(t.cursor)===47&&t.source.codePointAt(t.cursor+1)===42}function vt(t){return t.source.codePointAt(t.cursor)===k&&t.source.codePointAt(t.cursor+1)===k&&t.source.codePointAt(t.cursor+2)===62}var a,l,Se;function gt(t){switch(t){case a.OpenParen:return a.CloseParen;case a.CloseParen:return a.OpenParen;case a.OpenCurly:return a.CloseCurly;case a.CloseCurly:return a.OpenCurly;case a.OpenSquare:return a.CloseSquare;case a.CloseSquare:return a.OpenSquare;default:return null}}function mt(t){switch(t[0]){case a.OpenParen:return[a.CloseParen,")",-1,-1,void 0];case a.CloseParen:return[a.OpenParen,"(",-1,-1,void 0];case a.OpenCurly:return[a.CloseCurly,"}",-1,-1,void 0];case a.CloseCurly:return[a.OpenCurly,"{",-1,-1,void 0];case a.OpenSquare:return[a.CloseSquare,"]",-1,-1,void 0];case a.CloseSquare:return[a.OpenSquare,"[",-1,-1,void 0];default:return null}}function ht(t,e){for(e.advanceCodePoint(2);;){const n=e.readCodePoint();if(n===void 0){const r=[a.Comment,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new Z(j.UnexpectedEOFInComment,e.representationStart,e.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],r)),r}if(n===42&&e.source.codePointAt(e.cursor)!==void 0&&e.source.codePointAt(e.cursor)===47){e.advanceCodePoint();break}}return[a.Comment,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}function Ae(t,e){const n=e.readCodePoint();if(n===void 0)return t.onParseError(new Pe(j.UnexpectedEOFInEscapedCodePoint,e.representationStart,e.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),K;if(ie(n)){const r=[n];let o;for(;(o=e.source.codePointAt(e.cursor))!==void 0&&ie(o)&&r.length<6;)r.push(o),e.advanceCodePoint();X(e.source.codePointAt(e.cursor)??-1)&&(e.source.codePointAt(e.cursor)===ne&&e.source.codePointAt(e.cursor+1)===re&&e.advanceCodePoint(),e.advanceCodePoint());const i=parseInt(String.fromCodePoint(...r),16);return i===0||se(i)||i>1114111?K:i}return n===0||se(n)?K:n}function De(t,e){const n=[];for(;;){const r=e.source.codePointAt(e.cursor)??-1;if(r===0||se(r))n.push(K),e.advanceCodePoint(+(r>65535)+1);else if(xe(r))n.push(r),e.advanceCodePoint(+(r>65535)+1);else{if(!ue(e))return n;e.advanceCodePoint(),n.push(Ae(t,e))}}}function Ct(t,e){e.advanceCodePoint();const n=e.source.codePointAt(e.cursor);if(n!==void 0&&(xe(n)||ue(e))){let r=Se.Unrestricted;be(0,e)&&(r=Se.ID);const o=De(t,e);return[a.Hash,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...o),type:r}]}return[a.Delim,"#",e.representationStart,e.representationEnd,{value:"#"}]}function yt(t,e){let n=l.Integer;for(e.source.codePointAt(e.cursor)!==oe&&e.source.codePointAt(e.cursor)!==k||e.advanceCodePoint();W(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();if(e.source.codePointAt(e.cursor)===46&&W(e.source.codePointAt(e.cursor+1)??-1))for(e.advanceCodePoint(2),n=l.Number;W(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();if(e.source.codePointAt(e.cursor)===101||e.source.codePointAt(e.cursor)===69){if(W(e.source.codePointAt(e.cursor+1)??-1))e.advanceCodePoint(2);else{if(e.source.codePointAt(e.cursor+1)!==k&&e.source.codePointAt(e.cursor+1)!==oe||!W(e.source.codePointAt(e.cursor+2)??-1))return n;e.advanceCodePoint(3)}for(n=l.Number;W(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint()}return n}function Te(t,e){let n;{const i=e.source.codePointAt(e.cursor);i===k?n="-":i===oe&&(n="+")}const r=yt(0,e),o=parseFloat(e.source.slice(e.representationStart,e.representationEnd+1));if(be(0,e)){const i=De(t,e);return[a.Dimension,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:o,signCharacter:n,type:r,unit:String.fromCodePoint(...i)}]}return e.source.codePointAt(e.cursor)===37?(e.advanceCodePoint(),[a.Percentage,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:o,signCharacter:n}]):[a.Number,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:o,signCharacter:n,type:r}]}function Et(t){for(;X(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();return[a.Whitespace,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0]}(function(t){t.Comment="comment",t.AtKeyword="at-keyword-token",t.BadString="bad-string-token",t.BadURL="bad-url-token",t.CDC="CDC-token",t.CDO="CDO-token",t.Colon="colon-token",t.Comma="comma-token",t.Delim="delim-token",t.Dimension="dimension-token",t.EOF="EOF-token",t.Function="function-token",t.Hash="hash-token",t.Ident="ident-token",t.Number="number-token",t.Percentage="percentage-token",t.Semicolon="semicolon-token",t.String="string-token",t.URL="url-token",t.Whitespace="whitespace-token",t.OpenParen="(-token",t.CloseParen=")-token",t.OpenSquare="[-token",t.CloseSquare="]-token",t.OpenCurly="{-token",t.CloseCurly="}-token",t.UnicodeRange="unicode-range-token"})(a||(a={})),(function(t){t.Integer="integer",t.Number="number"})(l||(l={})),(function(t){t.Unrestricted="unrestricted",t.ID="id"})(Se||(Se={}));class Pt{constructor(e){C(this,"cursor",0);C(this,"source","");C(this,"representationStart",0);C(this,"representationEnd",-1);this.source=e}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(e!==void 0)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1}}function kt(t,e){let n="";const r=e.readCodePoint();for(;;){const o=e.readCodePoint();if(o===void 0){const i=[a.String,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];return t.onParseError(new Z(j.UnexpectedEOFInString,e.representationStart,e.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],i)),i}if(ke(o)){e.unreadCodePoint();const i=[a.BadString,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new Z(j.UnexpectedNewLineInString,e.representationStart,e.source.codePointAt(e.cursor)===ne&&e.source.codePointAt(e.cursor+1)===re?e.representationEnd+2:e.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],i)),i}if(o===r)return[a.String,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];if(o!==92)o===0||se(o)?n+=String.fromCodePoint(K):n+=String.fromCodePoint(o);else{if(e.source.codePointAt(e.cursor)===void 0)continue;if(ke(e.source.codePointAt(e.cursor)??-1)){e.source.codePointAt(e.cursor)===ne&&e.source.codePointAt(e.cursor+1)===re&&e.advanceCodePoint(),e.advanceCodePoint();continue}n+=String.fromCodePoint(Ae(t,e))}}}function bt(t){return!(t.length!==3||t[0]!==117&&t[0]!==85||t[1]!==114&&t[1]!==82||t[2]!==108&&t[2]!==76)}function Oe(t,e){for(;;){const n=e.source.codePointAt(e.cursor);if(n===void 0)return;if(n===41)return void e.advanceCodePoint();ue(e)?(e.advanceCodePoint(),Ae(t,e)):e.advanceCodePoint()}}function St(t,e){for(;X(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();let n="";for(;;){if(e.source.codePointAt(e.cursor)===void 0){const i=[a.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];return t.onParseError(new Z(j.UnexpectedEOFInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],i)),i}if(e.source.codePointAt(e.cursor)===41)return e.advanceCodePoint(),[a.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];if(X(e.source.codePointAt(e.cursor)??-1)){for(e.advanceCodePoint();X(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();if(e.source.codePointAt(e.cursor)===void 0){const i=[a.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];return t.onParseError(new Z(j.UnexpectedEOFInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],i)),i}return e.source.codePointAt(e.cursor)===41?(e.advanceCodePoint(),[a.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}]):(Oe(t,e),[a.BadURL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0])}const o=e.source.codePointAt(e.cursor);if(o===34||o===39||o===40||(r=o??-1)===11||r===127||0<=r&&r<=8||14<=r&&r<=31){Oe(t,e);const i=[a.BadURL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new Z(j.UnexpectedCharacterInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token",`Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`],i)),i}if(o===92){if(ue(e)){e.advanceCodePoint(),n+=String.fromCodePoint(Ae(t,e));continue}Oe(t,e);const i=[a.BadURL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new Z(j.InvalidEscapeSequenceInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],i)),i}e.source.codePointAt(e.cursor)===0||se(e.source.codePointAt(e.cursor)??-1)?(n+=String.fromCodePoint(K),e.advanceCodePoint()):(n+=e.source[e.cursor],e.advanceCodePoint())}var r}function Me(t,e){const n=De(t,e);if(e.source.codePointAt(e.cursor)!==40)return[a.Ident,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...n)}];if(bt(n)){e.advanceCodePoint();let r=0;for(;;){const o=X(e.source.codePointAt(e.cursor)??-1),i=X(e.source.codePointAt(e.cursor+1)??-1);if(o&&i){r+=1,e.advanceCodePoint(1);continue}const s=o?e.source.codePointAt(e.cursor+1):e.source.codePointAt(e.cursor);if(s===34||s===39)return r>0&&e.unreadCodePoint(r),[a.Function,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...n)}];break}return St(t,e)}return e.advanceCodePoint(),[a.Function,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...n)}]}function At(t){return!(t.source.codePointAt(t.cursor)!==117&&t.source.codePointAt(t.cursor)!==85||t.source.codePointAt(t.cursor+1)!==oe||t.source.codePointAt(t.cursor+2)!==63&&!ie(t.source.codePointAt(t.cursor+2)??-1))}function Dt(t,e){e.advanceCodePoint(2);const n=[],r=[];let o;for(;(o=e.source.codePointAt(e.cursor))!==void 0&&n.length<6&&ie(o);)n.push(o),e.advanceCodePoint();for(;(o=e.source.codePointAt(e.cursor))!==void 0&&n.length<6&&o===63;)r.length===0&&r.push(...n),n.push(48),r.push(70),e.advanceCodePoint();if(!r.length&&e.source.codePointAt(e.cursor)===k&&ie(e.source.codePointAt(e.cursor+1)??-1))for(e.advanceCodePoint();(o=e.source.codePointAt(e.cursor))!==void 0&&r.length<6&&ie(o);)r.push(o),e.advanceCodePoint();if(!r.length){const u=parseInt(String.fromCodePoint(...n),16);return[a.UnicodeRange,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{startOfRange:u,endOfRange:u}]}const i=parseInt(String.fromCodePoint(...n),16),s=parseInt(String.fromCodePoint(...r),16);return[a.UnicodeRange,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{startOfRange:i,endOfRange:s}]}function Bt(t,e){const n=Ft(t),r=[];for(;!n.endOfFile();)r.push(n.nextToken());return r.push(n.nextToken()),r}function Ft(t,e){const n=t.css.valueOf(),r=t.unicodeRangesAllowed??!1,o=new Pt(n),i={onParseError:Nt};return{nextToken:function(){o.resetRepresentation();const u=o.source.codePointAt(o.cursor);if(u===void 0)return[a.EOF,"",-1,-1,void 0];if(u===47&&ft(o))return ht(i,o);if(r&&(u===117||u===85)&&At(o))return Dt(0,o);if(ae(u))return Me(i,o);if(W(u))return Te(i,o);switch(u){case 44:return o.advanceCodePoint(),[a.Comma,",",o.representationStart,o.representationEnd,void 0];case 58:return o.advanceCodePoint(),[a.Colon,":",o.representationStart,o.representationEnd,void 0];case 59:return o.advanceCodePoint(),[a.Semicolon,";",o.representationStart,o.representationEnd,void 0];case 40:return o.advanceCodePoint(),[a.OpenParen,"(",o.representationStart,o.representationEnd,void 0];case 41:return o.advanceCodePoint(),[a.CloseParen,")",o.representationStart,o.representationEnd,void 0];case 91:return o.advanceCodePoint(),[a.OpenSquare,"[",o.representationStart,o.representationEnd,void 0];case 93:return o.advanceCodePoint(),[a.CloseSquare,"]",o.representationStart,o.representationEnd,void 0];case 123:return o.advanceCodePoint(),[a.OpenCurly,"{",o.representationStart,o.representationEnd,void 0];case 125:return o.advanceCodePoint(),[a.CloseCurly,"}",o.representationStart,o.representationEnd,void 0];case 39:case 34:return kt(i,o);case 35:return Ct(i,o);case oe:case 46:return He(o)?Te(i,o):(o.advanceCodePoint(),[a.Delim,o.source[o.representationStart],o.representationStart,o.representationEnd,{value:o.source[o.representationStart]}]);case re:case ne:case 12:case 9:case 32:return Et(o);case k:return He(o)?Te(i,o):vt(o)?(o.advanceCodePoint(3),[a.CDC,"-->",o.representationStart,o.representationEnd,void 0]):be(0,o)?Me(i,o):(o.advanceCodePoint(),[a.Delim,"-",o.representationStart,o.representationEnd,{value:"-"}]);case 60:return ut(o)?(o.advanceCodePoint(4),[a.CDO,"<!--",o.representationStart,o.representationEnd,void 0]):(o.advanceCodePoint(),[a.Delim,"<",o.representationStart,o.representationEnd,{value:"<"}]);case 64:if(o.advanceCodePoint(),be(0,o)){const c=De(i,o);return[a.AtKeyword,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:String.fromCodePoint(...c)}]}return[a.Delim,"@",o.representationStart,o.representationEnd,{value:"@"}];case 92:{if(ue(o))return Me(i,o);o.advanceCodePoint();const c=[a.Delim,"\\",o.representationStart,o.representationEnd,{value:"\\"}];return i.onParseError(new Z(j.InvalidEscapeSequenceAfterBackslash,o.representationStart,o.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],c)),c}}return o.advanceCodePoint(),[a.Delim,o.source[o.representationStart],o.representationStart,o.representationEnd,{value:o.source[o.representationStart]}]},endOfFile:function(){return o.source.codePointAt(o.cursor)===void 0}}}function Nt(){}function wt(t,e){const n=[];for(const u of e)n.push(u.codePointAt(0));const r=It(n);r[0]===101&&Re(r,0,r[0]);const o=String.fromCodePoint(...r),i=t[4].signCharacter==="+"?t[4].signCharacter:"",s=t[4].value.toString();t[1]=`${i}${s}${o}`,t[4].unit=e}function It(t){let e=0;if(t[0]===0)t.splice(0,1,K),e=1;else if(t[0]===k&&t[1]===k)e=2;else if(t[0]===k&&t[1])e=2,ae(t[1])||(e+=Re(t,1,t[1]));else{if(t[0]===k&&!t[1])return[92,t[0]];ae(t[0])?e=1:(e=1,e+=Re(t,0,t[0]))}for(let n=e;n<t.length;n++)t[n]!==0?xe(t[n])||(n+=xt(t,n,t[n])):(t.splice(n,1,K),n++);return t}function xt(t,e,n){return t.splice(e,1,92,n),1}function Re(t,e,n){const r=n.toString(16),o=[];for(const i of r)o.push(i.codePointAt(0));return t.splice(e,1,92,...o,32),1+o.length}const Tt=Object.values(a);function Ve(t){return!!Array.isArray(t)&&!(t.length<4)&&!!Tt.includes(t[0])&&typeof t[1]=="string"&&typeof t[2]=="number"&&typeof t[3]=="number"}function b(t){if(!t)return!1;switch(t[0]){case a.Dimension:case a.Number:case a.Percentage:return!0;default:return!1}}function je(t){if(!t)return!1;switch(t[0]){case a.Whitespace:case a.Comment:return!0;default:return!1}}function ce(t){return!!t&&t[0]===a.Comma}function Ge(t){return!!t&&t[0]===a.Comment}function Je(t){return!!t&&t[0]===a.Delim}function y(t){return!!t&&t[0]===a.Dimension}function Q(t){return!!t&&t[0]===a.EOF}function Ot(t){return!!t&&t[0]===a.Function}function ge(t){return!!t&&t[0]===a.Ident}function g(t){return!!t&&t[0]===a.Number}function P(t){return!!t&&t[0]===a.Percentage}function Ue(t){return!!t&&t[0]===a.Whitespace}function Ye(t){return!!t&&t[0]===a.OpenParen}function Mt(t){return!!t&&t[0]===a.CloseParen}function Rt(t){return!!t&&t[0]===a.OpenSquare}function Ut(t){return!!t&&t[0]===a.OpenCurly}var L;function Ze(t){let e=t.slice();return(n,r,o)=>{let i=-1;for(let s=e.indexOf(r);s<e.length&&(i=n.indexOf(e[s]),i===-1||i<o);s++);return i===-1||i===o&&r===n[o]&&(i++,i>=n.length)?-1:(e=n.slice(),i)}}function We(t,e){const n=e[0];if(Ye(n)||Ut(n)||Rt(n)){const r=Lt(t,e);return{advance:r.advance,node:r.node}}if(Ot(n)){const r=Wt(t,e);return{advance:r.advance,node:r.node}}if(Ue(n)){const r=Qe(t,e);return{advance:r.advance,node:r.node}}if(Ge(n)){const r=$t(t,e);return{advance:r.advance,node:r.node}}return{advance:1,node:new d(n)}}(function(t){t.Function="function",t.SimpleBlock="simple-block",t.Whitespace="whitespace",t.Comment="comment",t.Token="token"})(L||(L={}));class Ke{constructor(){C(this,"value",[])}indexOf(e){return this.value.indexOf(e)}at(e){if(typeof e=="number")return e<0&&(e=this.value.length+e),this.value[e]}forEach(e,n){if(this.value.length===0)return;const r=Ze(this.value);let o=0;for(;o<this.value.length;){const i=this.value[o];let s;if(n&&(s={...n}),e({node:i,parent:this,state:s},o)===!1)return!1;if(o=r(this.value,i,o),o===-1)break}}walk(e,n){this.value.length!==0&&this.forEach(((r,o)=>e(r,o)!==!1&&(!("walk"in r.node)||!this.value.includes(r.node)||r.node.walk(e,r.state)!==!1)&&void 0),n)}}class B extends Ke{constructor(n,r,o){super();C(this,"type",L.Function);C(this,"name");C(this,"endToken");this.name=n,this.endToken=r,this.value=o}getName(){return this.name[4].value}normalize(){Q(this.endToken)&&(this.endToken=[a.CloseParen,")",-1,-1,void 0])}tokens(){return Q(this.endToken)?[this.name,...this.value.flatMap((n=>n.tokens()))]:[this.name,...this.value.flatMap((n=>n.tokens())),this.endToken]}toString(){const n=this.value.map((r=>Ve(r)?G(r):r.toString())).join("");return G(this.name)+n+G(this.endToken)}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map((n=>n.toJSON()))}}isFunctionNode(){return B.isFunctionNode(this)}static isFunctionNode(n){return!!n&&n instanceof B&&n.type===L.Function}}function Wt(t,e){const n=[];let r=1;for(;;){const o=e[r];if(!o||Q(o))return t.onParseError(new Pe("Unexpected EOF while consuming a function.",e[0][2],e[e.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:e.length,node:new B(e[0],o,n)};if(Mt(o))return{advance:r+1,node:new B(e[0],o,n)};if(je(o)){const s=Xe(t,e.slice(r));r+=s.advance,n.push(...s.nodes);continue}const i=We(t,e.slice(r));r+=i.advance,n.push(i.node)}}class le extends Ke{constructor(n,r,o){super();C(this,"type",L.SimpleBlock);C(this,"startToken");C(this,"endToken");this.startToken=n,this.endToken=r,this.value=o}normalize(){if(Q(this.endToken)){const n=mt(this.startToken);n&&(this.endToken=n)}}tokens(){return Q(this.endToken)?[this.startToken,...this.value.flatMap((n=>n.tokens()))]:[this.startToken,...this.value.flatMap((n=>n.tokens())),this.endToken]}toString(){const n=this.value.map((r=>Ve(r)?G(r):r.toString())).join("");return G(this.startToken)+n+G(this.endToken)}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map((n=>n.toJSON()))}}isSimpleBlockNode(){return le.isSimpleBlockNode(this)}static isSimpleBlockNode(n){return!!n&&n instanceof le&&n.type===L.SimpleBlock}}function Lt(t,e){const n=gt(e[0][0]);if(!n)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const r=[];let o=1;for(;;){const i=e[o];if(!i||Q(i))return t.onParseError(new Pe("Unexpected EOF while consuming a simple block.",e[0][2],e[e.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:e.length,node:new le(e[0],i,r)};if(i[0]===n)return{advance:o+1,node:new le(e[0],i,r)};if(je(i)){const u=Xe(t,e.slice(o));o+=u.advance,r.push(...u.nodes);continue}const s=We(t,e.slice(o));o+=s.advance,r.push(s.node)}}class x{constructor(e){C(this,"type",L.Whitespace);C(this,"value");this.value=e}tokens(){return this.value}toString(){return G(...this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isWhitespaceNode(){return x.isWhitespaceNode(this)}static isWhitespaceNode(e){return!!e&&e instanceof x&&e.type===L.Whitespace}}function Qe(t,e){let n=0;for(;;){const r=e[n];if(!Ue(r))return{advance:n,node:new x(e.slice(0,n))};n++}}class de{constructor(e){C(this,"type",L.Comment);C(this,"value");this.value=e}tokens(){return[this.value]}toString(){return G(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isCommentNode(){return de.isCommentNode(this)}static isCommentNode(e){return!!e&&e instanceof de&&e.type===L.Comment}}function $t(t,e){return{advance:1,node:new de(e[0])}}function Xe(t,e){const n=[];let r=0;for(;;)if(Ue(e[r])){const o=Qe(0,e.slice(r));r+=o.advance,n.push(o.node)}else{if(!Ge(e[r]))return{advance:r,nodes:n};n.push(new de(e[r])),r++}}class d{constructor(e){C(this,"type",L.Token);C(this,"value");this.value=e}tokens(){return[this.value]}toString(){return this.value[1]}toJSON(){return{type:this.type,tokens:this.tokens()}}isTokenNode(){return d.isTokenNode(this)}static isTokenNode(e){return!!e&&e instanceof d&&e.type===L.Token}}function qt(t,e){const n={onParseError:(e==null?void 0:e.onParseError)??(()=>{})},r=[...t];if(t.length===0)return[];Q(r[r.length-1])&&r.push([a.EOF,"",r[r.length-1][2],r[r.length-1][3],void 0]);const o=[];let i=[],s=0;for(;;){if(!r[s]||Q(r[s]))return i.length&&o.push(i),o;if(ce(r[s])){o.push(i),i=[],s++;continue}const u=We(n,t.slice(s));i.push(u.node),s+=u.advance}}function zt(t,e,n){if(t.length===0)return;const r=Ze(t);let o=0;for(;o<t.length;){const i=t[o];if(e({node:i,parent:{value:t},state:void 0},o)===!1)return!1;if(o=r(t,i,o),o===-1)break}}function Ht(t,e,n){t.length!==0&&zt(t,((r,o)=>e(r,o)!==!1&&(!("walk"in r.node)||!t.includes(r.node)||r.node.walk(e,r.state)!==!1)&&void 0))}function Vt(t,e){for(let n=0;n<t.length;n++)Ht(t[n],((r,o)=>{if(typeof o!="number")return;const i=e(r.node);i&&(Array.isArray(i)?r.parent.value.splice(o,1,...i):r.parent.value.splice(o,1,i))}));return t}function jt(t){return le.isSimpleBlockNode(t)}function pe(t){return B.isFunctionNode(t)}function _e(t){return x.isWhitespaceNode(t)}function et(t){return de.isCommentNode(t)}function _(t){return _e(t)||et(t)}function m(t){return d.isTokenNode(t)}const Gt=/[A-Z]/g;function T(t){return t.replace(Gt,(e=>String.fromCharCode(e.charCodeAt(0)+32)))}const Jt=new Map([["cm",t=>t],["mm",t=>10*t],["q",t=>40*t],["in",t=>t/2.54],["pc",t=>t/2.54*6],["pt",t=>t/2.54*72],["px",t=>t/2.54*96]]),Be=new Map([["deg",t=>t],["grad",t=>t/.9],["rad",t=>t/180*Math.PI],["turn",t=>t/360]]),me=new Map([["deg",t=>.9*t],["grad",t=>t],["rad",t=>.9*t/180*Math.PI],["turn",t=>.9*t/360]]),Yt=new Map([["hz",t=>t],["khz",t=>t/1e3]]),Zt=new Map([["cm",t=>2.54*t],["mm",t=>25.4*t],["q",t=>25.4*t*4],["in",t=>t],["pc",t=>6*t],["pt",t=>72*t],["px",t=>96*t]]),Kt=new Map([["hz",t=>1e3*t],["khz",t=>t]]),Qt=new Map([["cm",t=>t/10],["mm",t=>t],["q",t=>4*t],["in",t=>t/25.4],["pc",t=>t/25.4*6],["pt",t=>t/25.4*72],["px",t=>t/25.4*96]]),Xt=new Map([["ms",t=>t],["s",t=>t/1e3]]),_t=new Map([["cm",t=>t/6*2.54],["mm",t=>t/6*25.4],["q",t=>t/6*25.4*4],["in",t=>t/6],["pc",t=>t],["pt",t=>t/6*72],["px",t=>t/6*96]]),en=new Map([["cm",t=>t/72*2.54],["mm",t=>t/72*25.4],["q",t=>t/72*25.4*4],["in",t=>t/72],["pc",t=>t/72*6],["pt",t=>t],["px",t=>t/72*96]]),tn=new Map([["cm",t=>t/96*2.54],["mm",t=>t/96*25.4],["q",t=>t/96*25.4*4],["in",t=>t/96],["pc",t=>t/96*6],["pt",t=>t/96*72],["px",t=>t]]),nn=new Map([["cm",t=>t/4/10],["mm",t=>t/4],["q",t=>t],["in",t=>t/4/25.4],["pc",t=>t/4/25.4*6],["pt",t=>t/4/25.4*72],["px",t=>t/4/25.4*96]]),tt=new Map([["deg",t=>180*t/Math.PI],["grad",t=>180*t/Math.PI/.9],["rad",t=>t],["turn",t=>180*t/Math.PI/360]]),rn=new Map([["ms",t=>1e3*t],["s",t=>t]]),he=new Map([["deg",t=>360*t],["grad",t=>360*t/.9],["rad",t=>360*t/180*Math.PI],["turn",t=>t]]),on=new Map([["cm",Jt],["mm",Qt],["q",nn],["in",Zt],["pc",_t],["pt",en],["px",tn],["ms",Xt],["s",rn],["deg",Be],["grad",me],["rad",tt],["turn",he],["hz",Yt],["khz",Kt]]);function O(t,e){if(!y(t)||!y(e))return e;const n=T(t[4].unit),r=T(e[4].unit);if(n===r)return e;const o=on.get(r);if(!o)return e;const i=o.get(n);if(!i)return e;const s=i(e[4].value),u=[a.Dimension,"",e[2],e[3],{...e[4],signCharacter:s<0?"-":void 0,type:Number.isInteger(s)?l.Integer:l.Number,value:s}];return wt(u,t[4].unit),u}function an(t){if(t.length!==2)return-1;const e=t[0].value;let n=t[1].value;if(g(e)&&g(n)){const r=e[4].value+n[4].value;return new d([a.Number,r.toString(),e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number}])}if(P(e)&&P(n)){const r=e[4].value+n[4].value;return new d([a.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(y(e)&&y(n)&&(n=O(e,n),T(e[4].unit)===T(n[4].unit))){const r=e[4].value+n[4].value;return new d([a.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number,unit:e[4].unit}])}return-1}function sn(t){if(t.length!==2)return-1;const e=t[0].value,n=t[1].value;if(g(e)&&g(n)){const r=e[4].value/n[4].value;return new d([a.Number,r.toString(),e[2],n[3],{value:r,type:Number.isInteger(r)?l.Integer:l.Number}])}if(P(e)&&g(n)){const r=e[4].value/n[4].value;return new d([a.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(y(e)&&g(n)){const r=e[4].value/n[4].value;return new d([a.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:Number.isInteger(r)?l.Integer:l.Number,unit:e[4].unit}])}return-1}function ee(t){return!!t&&typeof t=="object"&&"inputs"in t&&Array.isArray(t.inputs)&&"operation"in t}function N(t){if(t===-1)return-1;const e=[];for(let n=0;n<t.inputs.length;n++){const r=t.inputs[n];if(m(r)){e.push(r);continue}const o=N(r);if(o===-1)return-1;e.push(o)}return t.operation(e)}function un(t){if(t.length!==2)return-1;const e=t[0].value,n=t[1].value;if(g(e)&&g(n)){const r=e[4].value*n[4].value;return new d([a.Number,r.toString(),e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number}])}if(P(e)&&g(n)){const r=e[4].value*n[4].value;return new d([a.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(g(e)&&P(n)){const r=e[4].value*n[4].value;return new d([a.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(y(e)&&g(n)){const r=e[4].value*n[4].value;return new d([a.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number,unit:e[4].unit}])}if(g(e)&&y(n)){const r=e[4].value*n[4].value;return new d([a.Dimension,r.toString()+n[4].unit,e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number,unit:n[4].unit}])}return-1}function fe(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(!m(r))continue;const o=r.value;if(!ge(o))continue;const i=T(o[4].value);switch(i){case"e":t.splice(n,1,new d([a.Number,Math.E.toString(),o[2],o[3],{value:Math.E,type:l.Number}]));break;case"pi":t.splice(n,1,new d([a.Number,Math.PI.toString(),o[2],o[3],{value:Math.PI,type:l.Number}]));break;case"infinity":t.splice(n,1,new d([a.Number,"infinity",o[2],o[3],{value:1/0,type:l.Number}]));break;case"-infinity":t.splice(n,1,new d([a.Number,"-infinity",o[2],o[3],{value:-1/0,type:l.Number}]));break;case"nan":t.splice(n,1,new d([a.Number,"NaN",o[2],o[3],{value:Number.NaN,type:l.Number}]));break;default:if(e.has(i)){const s=e.get(i);t.splice(n,1,new d(s))}}}return t}function Fe(t){if(t.length!==1)return-1;const e=t[0].value;return b(e)?t[0]:-1}function w(t,e,n){return y(e)?Ce(t,e[4].unit,n):P(e)?cn(t,n):g(e)?q(t,n):-1}function Ce(t,e,n){const r=t.tokens();return{inputs:[new d([a.Dimension,n.toString()+e,r[0][2],r[r.length-1][3],{value:n,type:Number.isInteger(n)?l.Integer:l.Number,unit:e}])],operation:Fe}}function cn(t,e){const n=t.tokens();return{inputs:[new d([a.Percentage,e.toString()+"%",n[0][2],n[n.length-1][3],{value:e}])],operation:Fe}}function q(t,e){const n=t.tokens();return{inputs:[new d([a.Number,e.toString(),n[0][2],n[n.length-1][3],{value:e,type:Number.isInteger(e)?l.Integer:l.Number}])],operation:Fe}}function ln(t,e){const n=e.value;return g(n)?Ce(t,"rad",Math.acos(n[4].value)):-1}function dn(t,e){const n=e.value;return g(n)?Ce(t,"rad",Math.asin(n[4].value)):-1}function pn(t,e){const n=e.value;return g(n)?Ce(t,"rad",Math.atan(n[4].value)):-1}function Ne(t){return y(t)||g(t)}function Le(t){if(t.length===0)return!0;const e=t[0];if(!b(e))return!1;if(t.length===1)return!0;if(y(e)){const n=T(e[4].unit);for(let r=1;r<t.length;r++){const o=t[r];if(e[0]!==o[0]||n!==T(o[4].unit))return!1}return!0}for(let n=1;n<t.length;n++){const r=t[n];if(e[0]!==r[0])return!1}return!0}function J(t,e){return!!b(t)&&(y(t)?t[0]===e[0]&&T(t[4].unit)===T(e[4].unit):t[0]===e[0])}function fn(t,e,n){const r=e.value;if(!Ne(r))return-1;const o=O(r,n.value);return J(r,o)?Ce(t,"rad",Math.atan2(r[4].value,o[4].value)):-1}function vn(t,e,n){const r=e.value;return!b(r)||!n.rawPercentages&&P(r)?-1:w(t,r,Math.abs(r[4].value))}function gn(t,e,n,r,o){if(!m(e)||!m(n)||!m(r))return-1;const i=e.value;if(!b(i)||!o.rawPercentages&&P(i))return-1;const s=O(i,n.value);if(!J(i,s))return-1;const u=O(i,r.value);return J(i,u)?w(t,i,Math.max(i[4].value,Math.min(s[4].value,u[4].value))):-1}function mn(t,e){const n=e.value;if(!Ne(n))return-1;let r=n[4].value;if(y(n))switch(n[4].unit.toLowerCase()){case"rad":break;case"deg":r=Be.get("rad")(n[4].value);break;case"grad":r=me.get("rad")(n[4].value);break;case"turn":r=he.get("rad")(n[4].value);break;default:return-1}return r=Math.cos(r),q(t,r)}function hn(t,e){const n=e.value;return g(n)?q(t,Math.exp(n[4].value)):-1}function Cn(t,e,n){if(!e.every(m))return-1;const r=e[0].value;if(!b(r)||!n.rawPercentages&&P(r))return-1;const o=e.map((u=>O(r,u.value)));if(!Le(o))return-1;const i=o.map((u=>u[4].value)),s=Math.hypot(...i);return w(t,r,s)}function nt(t,e,n){if(!e.every(m))return-1;const r=e[0].value;if(!b(r)||!n.rawPercentages&&P(r))return-1;const o=e.map((u=>O(r,u.value)));if(!Le(o))return-1;const i=o.map((u=>u[4].value)),s=Math.max(...i);return w(t,r,s)}function rt(t,e,n){if(!e.every(m))return-1;const r=e[0].value;if(!b(r)||!n.rawPercentages&&P(r))return-1;const o=e.map((u=>O(r,u.value)));if(!Le(o))return-1;const i=o.map((u=>u[4].value)),s=Math.min(...i);return w(t,r,s)}function yn(t,e,n){const r=e.value;if(!b(r))return-1;const o=O(r,n.value);if(!J(r,o))return-1;let i;return i=o[4].value===0?Number.NaN:Number.isFinite(r[4].value)&&(Number.isFinite(o[4].value)||(o[4].value!==Number.POSITIVE_INFINITY||r[4].value!==Number.NEGATIVE_INFINITY&&!Object.is(0*r[4].value,-0))&&(o[4].value!==Number.NEGATIVE_INFINITY||r[4].value!==Number.POSITIVE_INFINITY&&!Object.is(0*r[4].value,0)))?Number.isFinite(o[4].value)?(r[4].value%o[4].value+o[4].value)%o[4].value:r[4].value:Number.NaN,w(t,r,i)}function En(t,e,n){const r=e.value,o=n.value;return!g(r)||!J(r,o)?-1:q(t,Math.pow(r[4].value,o[4].value))}function Pn(t,e,n){const r=e.value;if(!b(r))return-1;const o=O(r,n.value);if(!J(r,o))return-1;let i;return i=o[4].value===0?Number.NaN:Number.isFinite(r[4].value)?Number.isFinite(o[4].value)?r[4].value%o[4].value:r[4].value:Number.NaN,w(t,r,i)}function kn(t,e,n,r,o){const i=n.value;if(!b(i)||!o.rawPercentages&&P(i))return-1;const s=O(i,r.value);if(!J(i,s))return-1;let u;if(s[4].value===0)u=Number.NaN;else if(Number.isFinite(i[4].value)||Number.isFinite(s[4].value))if(!Number.isFinite(i[4].value)&&Number.isFinite(s[4].value))u=i[4].value;else if(Number.isFinite(i[4].value)&&!Number.isFinite(s[4].value))switch(e){case"down":u=i[4].value<0?-1/0:Object.is(-0,0*i[4].value)?-0:0;break;case"up":u=i[4].value>0?1/0:Object.is(0,0*i[4].value)?0:-0;break;default:u=Object.is(0,0*i[4].value)?0:-0}else if(Number.isFinite(s[4].value))switch(e){case"down":u=Math.floor(i[4].value/s[4].value)*s[4].value;break;case"up":u=Math.ceil(i[4].value/s[4].value)*s[4].value;break;case"to-zero":u=Math.trunc(i[4].value/s[4].value)*s[4].value;break;default:{let c=Math.floor(i[4].value/s[4].value)*s[4].value,p=Math.ceil(i[4].value/s[4].value)*s[4].value;if(c>p){const A=c;c=p,p=A}const f=Math.abs(i[4].value-c),v=Math.abs(i[4].value-p);u=f===v?p:f<v?c:p;break}}else u=i[4].value;else u=Number.NaN;return w(t,i,u)}function bn(t,e,n){const r=e.value;return!b(r)||!n.rawPercentages&&P(r)?-1:q(t,Math.sign(r[4].value))}function Sn(t,e){const n=e.value;if(!Ne(n))return-1;let r=n[4].value;if(y(n))switch(T(n[4].unit)){case"rad":break;case"deg":r=Be.get("rad")(n[4].value);break;case"grad":r=me.get("rad")(n[4].value);break;case"turn":r=he.get("rad")(n[4].value);break;default:return-1}return r=Math.sin(r),q(t,r)}function An(t,e){const n=e.value;return g(n)?q(t,Math.sqrt(n[4].value)):-1}function Dn(t,e){const n=e.value;if(!Ne(n))return-1;const r=n[4].value;let o=0,i=n[4].value;if(y(n))switch(T(n[4].unit)){case"rad":o=tt.get("deg")(r);break;case"deg":o=r,i=Be.get("rad")(r);break;case"grad":o=me.get("deg")(r),i=me.get("rad")(r);break;case"turn":o=he.get("deg")(r),i=he.get("rad")(r);break;default:return-1}const s=o/90;return i=o%90==0&&s%2!=0?s>0?1/0:-1/0:Math.tan(i),q(t,i)}function Bn(t){if(t.length!==2)return-1;const e=t[0].value;let n=t[1].value;if(g(e)&&g(n)){const r=e[4].value-n[4].value;return new d([a.Number,r.toString(),e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number}])}if(P(e)&&P(n)){const r=e[4].value-n[4].value;return new d([a.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(y(e)&&y(n)&&(n=O(e,n),T(e[4].unit)===T(n[4].unit))){const r=e[4].value-n[4].value;return new d([a.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:e[4].type===l.Integer&&n[4].type===l.Integer?l.Integer:l.Number,unit:e[4].unit}])}return-1}function Fn(t,e){if(e.length===1){const n=e[0];if(!n||!m(n))return-1;const r=n.value;return g(r)?q(t,Math.log(r[4].value)):-1}if(e.length===2){const n=e[0];if(!n||!m(n))return-1;const r=n.value;if(!g(r))return-1;const o=e[1];if(!o||!m(o))return-1;const i=o.value;return g(i)?q(t,Math.log(r[4].value)/Math.log(i[4].value)):-1}return-1}const Nn=/^none$/i;function $e(t){if(Array.isArray(t)){const n=t.filter((r=>!(_e(r)&&et(r))));return n.length===1&&$e(n[0])}if(!m(t))return!1;const e=t.value;return!!ge(e)&&Nn.test(e[4].value)}const wn=String.fromCodePoint(0);function In(t,e,n,r,o,i){var E;if(e.fixed===-1&&!i.randomCaching)return-1;i.randomCaching||(i.randomCaching={propertyName:"",propertyN:0,elementID:"",documentID:""}),i.randomCaching&&!i.randomCaching.propertyN&&(i.randomCaching.propertyN=0);const s=n.value;if(!b(s))return-1;const u=O(s,r.value);if(!J(s,u))return-1;let c=null;if(o&&(c=O(s,o.value),!J(s,c)))return-1;if(!Number.isFinite(s[4].value)||!Number.isFinite(u[4].value)||!Number.isFinite(u[4].value-s[4].value))return w(t,s,Number.NaN);if(c&&!Number.isFinite(c[4].value))return w(t,s,s[4].value);const p=e.fixed===-1?xn(Tn([e.dashedIdent?e.dashedIdent:`${(E=i.randomCaching)==null?void 0:E.propertyName} ${i.randomCaching.propertyN++}`,e.elementShared?"":i.randomCaching.elementID,i.randomCaching.documentID].join(wn))):()=>e.fixed;let f=s[4].value,v=u[4].value;if(f>v&&([f,v]=[v,f]),c&&(c[4].value<=0||Math.abs(f-v)/c[4].value>1e10)&&(c=null),c){const R=Math.max(c[4].value/1e3,1e-9),h=[f];let V=0;for(;;){V+=c[4].value;const ye=f+V;if(!(ye+R<v)){h.push(v);break}if(h.push(ye),ye+c[4].value-R>v)break}const Y=p();return w(t,s,Number(h[Math.floor(h.length*Y)].toFixed(5)))}const A=p();return w(t,s,Number((A*(v-f)+f).toFixed(5)))}function xn(t=.34944106645296036,e=.19228640875738723,n=.8784393832007205,r=.04850964319275053){return()=>{const o=((t|=0)+(e|=0)|0)+(r|=0)|0;return r=r+1|0,t=e^e>>>9,e=(n|=0)+(n<<3)|0,n=(n=n<<21|n>>>11)+o|0,(o>>>0)/4294967296}}function Tn(t){let e=0,n=0,r=0;e^=-1;for(let o=0,i=t.length;o<i;o++)r=255&(e^t.charCodeAt(o)),n=+("0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substring(9*r,9*r+8)),e=e>>>8^n;return(-1^e)>>>0}const qe=new Map([["abs",function(e,n,r){return z(e,n,r,vn)}],["acos",function(e,n,r){return z(e,n,r,ln)}],["asin",function(e,n,r){return z(e,n,r,dn)}],["atan",function(e,n,r){return z(e,n,r,pn)}],["atan2",function(e,n,r){return we(e,n,r,fn)}],["calc",F],["clamp",function(e,n,r){const o=fe([...e.value.filter((h=>!_(h)))],n),i=[],s=[],u=[];{let h=i;for(let V=0;V<o.length;V++){const Y=o[V];if(m(Y)&&ce(Y.value)){if(h===u)return-1;if(h===s){h=u;continue}if(h===i){h=s;continue}return-1}h.push(Y)}}const c=$e(i),p=$e(u);if(c&&p)return F(M(s),n,r);const f=N(F(M(s),n,r));if(f===-1)return-1;if(c){const h=N(F(M(u),n,r));return h===-1?-1:rt((v=f,A=h,new B([a.Function,"min(",-1,-1,{value:"min"}],[a.CloseParen,")",-1,-1,void 0],[v,new d([a.Comma,",",-1,-1,void 0]),A])),[f,h],r)}if(p){const h=N(F(M(i),n,r));return h===-1?-1:nt(Wn(h,f),[h,f],r)}var v,A;const E=N(F(M(i),n,r));if(E===-1)return-1;const R=N(F(M(u),n,r));return R===-1?-1:gn(e,E,f,R,r)}],["cos",function(e,n,r){return z(e,n,r,mn)}],["exp",function(e,n,r){return z(e,n,r,hn)}],["hypot",function(e,n,r){return Ie(e,e.value,n,r,Cn)}],["log",function(e,n,r){return Ie(e,e.value,n,r,Fn)}],["max",function(e,n,r){return Ie(e,e.value,n,r,nt)}],["min",function(e,n,r){return Ie(e,e.value,n,r,rt)}],["mod",function(e,n,r){return we(e,n,r,yn)}],["pow",function(e,n,r){return we(e,n,r,En)}],["random",function(e,n,r){const o=Un(e.value.filter((v=>!_(v))),n,r);if(o===-1)return-1;const[i,s]=o,u=ot(s,n,r);if(u===-1)return-1;const[c,p,f]=u;return!c||!p?-1:In(e,i,c,p,f,r)}],["rem",function(e,n,r){return we(e,n,r,Pn)}],["round",function(e,n,r){const o=fe([...e.value.filter((v=>!_(v)))],n);let i="",s=!1;const u=[],c=[];{let v=u;for(let A=0;A<o.length;A++){const E=o[A];if(!i&&u.length===0&&c.length===0&&m(E)&&ge(E.value)){const R=E.value[4].value.toLowerCase();if(Rn.has(R)){i=R;continue}}if(m(E)&&ce(E.value)){if(v===c)return-1;if(v===u&&i&&u.length===0)continue;if(v===u){s=!0,v=c;continue}return-1}v.push(E)}}const p=N(F(M(u),n,r));if(p===-1)return-1;s||c.length!==0||c.push(new d([a.Number,"1",-1,-1,{value:1,type:l.Integer}]));const f=N(F(M(c),n,r));return f===-1?-1:(i||(i="nearest"),kn(e,i,p,f,r))}],["sign",function(e,n,r){return z(e,n,r,bn)}],["sin",function(e,n,r){return z(e,n,r,Sn)}],["sqrt",function(e,n,r){return z(e,n,r,An)}],["tan",function(e,n,r){return z(e,n,r,Dn)}]]);function F(t,e,n){const r=fe([...t.value.filter((i=>!_(i)))],e);if(r.length===1&&m(r[0]))return{inputs:[r[0]],operation:Fe};let o=0;for(;o<r.length;){const i=r[o];if(jt(i)&&Ye(i.startToken)){const s=F(i,e,n);if(s===-1)return-1;r.splice(o,1,s)}else if(pe(i)){const s=qe.get(i.getName().toLowerCase());if(!s)return-1;const u=s(i,e,n);if(u===-1)return-1;r.splice(o,1,u)}else o++}if(o=0,r.length===1&&ee(r[0]))return r[0];for(;o<r.length;){const i=r[o];if(!i||!m(i)&&!ee(i)){o++;continue}const s=r[o+1];if(!s||!m(s)){o++;continue}const u=s.value;if(!Je(u)||u[4].value!=="*"&&u[4].value!=="/"){o++;continue}const c=r[o+2];if(!c||!m(c)&&!ee(c))return-1;u[4].value!=="*"?u[4].value!=="/"?o++:r.splice(o,3,{inputs:[i,c],operation:sn}):r.splice(o,3,{inputs:[i,c],operation:un})}if(o=0,r.length===1&&ee(r[0]))return r[0];for(;o<r.length;){const i=r[o];if(!i||!m(i)&&!ee(i)){o++;continue}const s=r[o+1];if(!s||!m(s)){o++;continue}const u=s.value;if(!Je(u)||u[4].value!=="+"&&u[4].value!=="-"){o++;continue}const c=r[o+2];if(!c||!m(c)&&!ee(c))return-1;u[4].value!=="+"?u[4].value!=="-"?o++:r.splice(o,3,{inputs:[i,c],operation:Bn}):r.splice(o,3,{inputs:[i,c],operation:an})}return r.length===1&&ee(r[0])?r[0]:-1}function z(t,e,n,r){const o=On(t.value,e,n);return o===-1?-1:r(t,o,n)}function On(t,e,n){const r=N(F(M(fe([...t.filter((o=>!_(o)))],e)),e,n));return r===-1?-1:r}function we(t,e,n,r){const o=Mn(t.value,e,n);if(o===-1)return-1;const[i,s]=o;return r(t,i,s,n)}function Mn(t,e,n){const r=fe([...t.filter((c=>!_(c)))],e),o=[],i=[];{let c=o;for(let p=0;p<r.length;p++){const f=r[p];if(m(f)&&ce(f.value)){if(c===i)return-1;if(c===o){c=i;continue}return-1}c.push(f)}}const s=N(F(M(o),e,n));if(s===-1)return-1;const u=N(F(M(i),e,n));return u===-1?-1:[s,u]}function Ie(t,e,n,r,o){const i=ot(t.value,n,r);return i===-1?-1:o(t,i,r)}function ot(t,e,n){const r=fe([...t.filter((i=>!_(i)))],e),o=[];{const i=[];let s=[];for(let u=0;u<r.length;u++){const c=r[u];m(c)&&ce(c.value)?(i.push(s),s=[]):s.push(c)}i.push(s);for(let u=0;u<i.length;u++){if(i[u].length===0)return-1;const c=N(F(M(i[u]),e,n));if(c===-1)return-1;o.push(c)}}return o}const Rn=new Set(["nearest","up","down","to-zero"]);function Un(t,e,n){const r={isAuto:!1,dashedIdent:"",fixed:-1,elementShared:!1},o=t[0];if(!m(o)||!ge(o.value))return[r,t];for(let i=0;i<t.length;i++){const s=t[i];if(!m(s))return-1;if(ce(s.value))return[r,t.slice(i+1)];if(!ge(s.value))return-1;const u=s.value[4].value.toLowerCase();if(u!=="element-shared")if(u!=="fixed")if(u!=="auto"){if(u.startsWith("--")){if(r.fixed!==-1||r.isAuto)return-1;r.dashedIdent=u}}else{if(r.fixed!==-1||r.dashedIdent)return-1;r.isAuto=!0}else{if(r.elementShared||r.dashedIdent||r.isAuto)return-1;i++;const c=t[i];if(!c)return-1;const p=N(F(M([c]),e,n));if(p===-1||!g(p.value)||p.value[4].value<0||p.value[4].value>1)return-1;r.fixed=Math.max(0,Math.min(p.value[4].value,1-1e-9))}else{if(r.fixed!==-1)return-1;r.elementShared=!0}}return-1}function M(t){return new B([a.Function,"calc(",-1,-1,{value:"calc"}],[a.CloseParen,")",-1,-1,void 0],t)}function Wn(t,e){return new B([a.Function,"max(",-1,-1,{value:"max"}],[a.CloseParen,")",-1,-1,void 0],[t,new d([a.Comma,",",-1,-1,void 0]),e])}function Ln(t){if(t===-1)return-1;if(pe(t))return t;const e=t.value;return b(e)&&Number.isNaN(e[4].value)?g(e)?new B([a.Function,"calc(",e[2],e[3],{value:"calc"}],[a.CloseParen,")",e[2],e[3],void 0],[new d([a.Ident,"NaN",e[2],e[3],{value:"NaN"}])]):y(e)?new B([a.Function,"calc(",e[2],e[3],{value:"calc"}],[a.CloseParen,")",e[2],e[3],void 0],[new d([a.Ident,"NaN",e[2],e[3],{value:"NaN"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Delim,"*",e[2],e[3],{value:"*"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Dimension,"1"+e[4].unit,e[2],e[3],{value:1,type:l.Integer,unit:e[4].unit}])]):P(e)?new B([a.Function,"calc(",e[2],e[3],{value:"calc"}],[a.CloseParen,")",e[2],e[3],void 0],[new d([a.Ident,"NaN",e[2],e[3],{value:"NaN"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Delim,"*",e[2],e[3],{value:"*"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Percentage,"1%",e[2],e[3],{value:1}])]):-1:t}function $n(t){if(t===-1)return-1;if(pe(t))return t;const e=t.value;if(!b(e)||Number.isFinite(e[4].value)||Number.isNaN(e[4].value))return t;let n="";return Number.NEGATIVE_INFINITY===e[4].value&&(n="-"),g(e)?new B([a.Function,"calc(",e[2],e[3],{value:"calc"}],[a.CloseParen,")",e[2],e[3],void 0],[new d([a.Ident,n+"infinity",e[2],e[3],{value:n+"infinity"}])]):y(e)?new B([a.Function,"calc(",e[2],e[3],{value:"calc"}],[a.CloseParen,")",e[2],e[3],void 0],[new d([a.Ident,n+"infinity",e[2],e[3],{value:n+"infinity"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Delim,"*",e[2],e[3],{value:"*"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Dimension,"1"+e[4].unit,e[2],e[3],{value:1,type:l.Integer,unit:e[4].unit}])]):new B([a.Function,"calc(",e[2],e[3],{value:"calc"}],[a.CloseParen,")",e[2],e[3],void 0],[new d([a.Ident,n+"infinity",e[2],e[3],{value:n+"infinity"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Delim,"*",e[2],e[3],{value:"*"}]),new x([[a.Whitespace," ",e[2],e[3],void 0]]),new d([a.Percentage,"1%",e[2],e[3],{value:1}])])}function qn(t){if(t===-1)return-1;if(pe(t))return t;const e=t.value;return b(e)&&Object.is(-0,e[4].value)&&(e[1]==="-0"||(P(e)?e[1]="-0%":y(e)?e[1]="-0"+e[4].unit:e[1]="-0")),t}function zn(t,e=13){if(t===-1)return-1;if(e<=0||pe(t))return t;const n=t.value;if(!b(n)||Number.isInteger(n[4].value))return t;const r=Number(n[4].value.toFixed(e)).toString();return g(n)?n[1]=r:P(n)?n[1]=r+"%":y(n)&&(n[1]=r+n[4].unit),t}function Hn(t,e){let n=t;return n=zn(n,e==null?void 0:e.precision),n=qn(n),n=Ln(n),n=$n(n),n}function Vn(t){return new Map}function jn(t,e){return Gn(qt(Bt({css:t}),{}),e).map((n=>n.map((r=>G(...r.tokens()))).join(""))).join(",")}function Gn(t,e){const n=Vn();return Vt(t,(r=>{if(!pe(r))return;const o=qe.get(r.getName().toLowerCase());if(!o)return;const i=Hn(N(o(r,n,{})),e);return i!==-1?i:void 0}))}new Set(qe.keys());const H=t=>{const e=`${t}`,n=parseFloat(e);let r="unsupported";const o=e.match(/px|rem|em/);return o&&(r=o[0]),n===0&&r==="unsupported"&&(r="zero"),{number:n,unit:r}},it=t=>{const e={};if(typeof t=="string")e.fontSize=H(t);else if(Array.isArray(t)){if(e.fontSize=H(t[0]),typeof t[1]=="string")e.lineHeight=H(t[1]);else if(typeof t[1]=="object"){if("lineHeight"in t[1]){let n=t[1].lineHeight;typeof n=="string"&&n.includes("calc")&&(n=jn(n));const r=H(n);r.unit==="unsupported"?e.lineHeight={number:n*e.fontSize.number,unit:e.fontSize.unit}:e.lineHeight=r}"letterSpacing"in t[1]&&(e.letterSpacing=H(t[1].letterSpacing))}}return e},ze=(t,e,n,r=null)=>t.number===e.number?(ve.error(`Same value for start an end${r?` (${r})`:""}: "clamp-[${n}]".`),null):t.unit!==e.unit&&t.unit!=="zero"&&e.unit!=="zero"?(ve.error(`Units need to match${r?` (${r})`:""}: "clamp-[${n}]" ${t.unit} !== ${e.unit}.`),null):t.unit==="unsupported"||e.unit==="unsupported"?(ve.error(`Only px, rem and em units are supported${r?` (${r})`:""}: "clamp-[${n}]".`),null):!0,at=(t,e,n={number:23.4375,unit:"rem"},r={number:90,unit:"rem"},o=!1)=>{const i=t.unit==="zero"?e.unit:t.unit,s=i==="px";let u=t.number,c=e.number,p=!1,f=n.number,v=r.number;n.unit!=="px"&&s&&(f=n.number*16),n.unit==="px"&&!s&&(f=n.number/16),r.unit!=="px"&&s&&(v=r.number*16),r.unit==="px"&&!s&&(v=r.number/16),c<u&&u<0&&c<0?(u=Math.abs(u),c=Math.abs(c),p=!0):c<u&&u>0&&c>0?(u=u*-1,c=c*-1,p=!0):c<u&&(u=Math.abs(u)*-1,c=Math.abs(c),p=!0);const A=(c-u)/(v-f),E=`${(u-f*A).toFixed(6)}${i} + ${(100*A).toFixed(6)}${o?"cqw":"vw"}`,R=`clamp(${u}${i}, ${E}, ${c}${i})`;return p?`calc(${R} * -1)`:R},Jn={minSize:"23.4375rem",maxSize:"90rem"};function st(t,e,n,r){if(!t)return{...H(e),isContainer:!1};const o=t.startsWith("@"),i=o?t.slice(1):t,s=o?r[i]||i:n[i]||i;return{...H(s),isContainer:o}}return I.withOptions(function(t={}){const e={...Jn,...t};return function({matchUtilities:n,theme:r,config:o}){n({clamp:i=>{const s=i.split(",");if(s.length<3)return ve.error(`The clamp utility requires at least 3 arguments: "clamp-[${i}]".`),{};const u=r("screens"),c=r("containers"),p=st(s[3],e.minSize,u,c),f=st(s[4],e.maxSize,u,c);if(!ze(p,f,i))return{};const v=p.isContainer,A=te(s[0]);if(!A)return ve.error(`Property "${s[0]}" is not supported: "clamp-[${i}]".`),{};const{key:E,props:R,type:h}=A;if(h==="fontSize"){const S=it(o().theme[E][s[1]]||s[1]),$=it(o().theme[E][s[2]]||s[2]),Ee={};return Object.keys(S).forEach(D=>{if(D in $){if((D==="letterSpacing"||D==="lineHeight")&&S[D].number===$[D].number&&S[D].unit===$[D].unit)Ee[D]=`${S[D].number}${S[D].unit}`;else if(ze(S[D],$[D],i,D)){const Yn=at(S[D],$[D],p,f,v);Ee[D]=Yn}}}),Ee}let V=H(o().theme[E][s[1]]||s[1]),Y=H(o().theme[E][s[2]]||s[2]);if(h==="spacing"){const S=H(typeof r("spacing")=="string"?r("spacing"):r("spacing.1")),$=/^-?\d*\.?\d+$/.test(s[1]),Ee=/^-?\d*\.?\d+$/.test(s[2]);$&&(V={number:S.number*parseFloat(s[1]),unit:S.unit}),Ee&&(Y={number:S.number*parseFloat(s[2]),unit:S.unit})}if(!ze(V,Y,i))return{};const ye=at(V,Y,p,f,v);return R.reduce((S,$)=>(typeof $=="string"?S[$]=ye:S={...S,...$},S),{})}},{values:r("clamp")},{supportsNegativeValues:!1,modifiers:{pattern:/[\w-]+(?:,[\w-]+){2}/}})}})}));
|
|
1
|
+
(function(W,x){typeof exports=="object"&&typeof module<"u"?module.exports=x():typeof define=="function"&&define.amd?define(x):(W=typeof globalThis<"u"?globalThis:W||self,W["tailwind-clamp"]=x())})(this,(function(){"use strict";var rr=Object.defineProperty;var or=(W,x,ne)=>x in W?rr(W,x,{enumerable:!0,configurable:!0,writable:!0,value:ne}):W[x]=ne;var C=(W,x,ne)=>or(W,typeof x!="symbol"?x+"":x,ne);function W(t,e){return{handler:t,config:e}}W.withOptions=function(t,e=()=>({})){function n(r){return{handler:t(r),config:e(r)}}return n.__isOptionsFunction=!0,n};var x=W;const ne=t=>{switch(t){case"p":return{type:"spacing",key:"padding",props:["padding"]};case"pt":return{type:"spacing",key:"padding",props:["paddingTop"]};case"pb":return{type:"spacing",key:"padding",props:["paddingBottom"]};case"pl":return{type:"spacing",key:"padding",props:["paddingLeft"]};case"ps":return{type:"spacing",key:"padding",props:["paddingInlineStart"]};case"pr":return{type:"spacing",key:"padding",props:["paddingRight"]};case"pe":return{type:"spacing",key:"padding",props:["paddingInlineEnd"]};case"px":return{type:"spacing",key:"padding",props:["paddingInline"]};case"py":return{type:"spacing",key:"padding",props:["paddingBlock"]};case"m":return{type:"spacing",key:"margin",props:["margin"]};case"mt":return{type:"spacing",key:"margin",props:["marginTop"]};case"mb":return{type:"spacing",key:"margin",props:["marginBottom"]};case"ml":return{type:"spacing",key:"margin",props:["marginLeft"]};case"ms":return{type:"spacing",key:"margin",props:["marginInlineStart"]};case"mr":return{type:"spacing",key:"margin",props:["marginRight"]};case"me":return{type:"spacing",key:"margin",props:["marginInlineEnd"]};case"mx":return{type:"spacing",key:"margin",props:["marginInline"]};case"my":return{type:"spacing",key:"margin",props:["marginBlock"]};case"inset":return{type:"spacing",key:"inset",props:["inset"]};case"inset-x":return{type:"spacing",key:"inset",props:["insetInline"]};case"inset-y":return{type:"spacing",key:"inset",props:["insetBlock"]};case"start":return{type:"spacing",key:"inset",props:["insetInlineStart"]};case"end":return{type:"spacing",key:"inset",props:["insetInlineEnd"]};case"top":return{type:"spacing",key:"inset",props:["top"]};case"left":return{type:"spacing",key:"inset",props:["left"]};case"right":return{type:"spacing",key:"inset",props:["right"]};case"bottom":return{type:"spacing",key:"inset",props:["bottom"]};case"gap":return{type:"spacing",key:"gap",props:["gap"]};case"gap-x":return{type:"spacing",key:"gap",props:["columnGap"]};case"gap-y":return{type:"spacing",key:"gap",props:["rowGap"]};case"w":return{type:"spacing",key:"width",props:["width"]};case"h":return{type:"spacing",key:"height",props:["height"]};case"size":return{type:"spacing",key:"size",props:["width","height"]};case"min-w":return{type:"spacing",key:"minWidth",props:["minWidth"]};case"min-h":return{type:"spacing",key:"minHeight",props:["minHeight"]};case"max-w":return{type:"spacing",key:"maxWidth",props:["maxWidth"]};case"max-h":return{type:"spacing",key:"maxHeight",props:["maxHeight"]};case"scroll-m":return{type:"spacing",key:"scrollMargin",props:["scrollMargin"]};case"scroll-mx":return{type:"spacing",key:"scrollMargin",props:["scrollMarginInline"]};case"scroll-my":return{type:"spacing",key:"scrollMargin",props:["scrollMarginBlock"]};case"scroll-ms":return{type:"spacing",key:"scrollMargin",props:["scrollMarginInlineStart"]};case"scroll-me":return{type:"spacing",key:"scrollMargin",props:["scrollMarginInlineEnd"]};case"scroll-mt":return{type:"spacing",key:"scrollMargin",props:["scrollMarginTop"]};case"scroll-mb":return{type:"spacing",key:"scrollMargin",props:["scrollMarginBottom"]};case"scroll-ml":return{type:"spacing",key:"scrollMargin",props:["scrollMarginLeft"]};case"scroll-mr":return{type:"spacing",key:"scrollMargin",props:["scrollMarginRight"]};case"scroll-p":return{type:"spacing",key:"scrollPadding",props:["scrollPadding"]};case"scroll-px":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingInline"]};case"scroll-py":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingBlock"]};case"scroll-ps":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingInlineStart"]};case"scroll-pe":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingInlineEnd"]};case"scroll-pt":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingTop"]};case"scroll-pb":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingBottom"]};case"scroll-pl":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingLeft"]};case"scroll-pr":return{type:"spacing",key:"scrollPadding",props:["scrollPaddingRight"]};case"translate":return{type:"spacing",key:"translate",props:["--tw-translate-x","--tw-translate-y",{translate:"var(--tw-translate-x) var(--tw-translate-y)"}]};case"translate-x":return{type:"spacing",key:"translate",props:["--tw-translate-x",{translate:"var(--tw-translate-x) var(--tw-translate-y)"}]};case"translate-y":return{type:"spacing",key:"translate",props:["--tw-translate-y",{translate:"var(--tw-translate-x) var(--tw-translate-y)"}]};case"underline-offset":return{type:"regular",key:"textUnderlineOffset",props:["textUnderlineOffset"]};case"stroke":return{type:"regular",key:"strokeWidth",props:["strokeWidth"]};case"border":return{type:"regular",key:"borderWidth",props:["borderWidth"]};case"border-t":return{type:"regular",key:"borderWidth",props:["borderTopWidth"]};case"border-b":return{type:"regular",key:"borderWidth",props:["borderBottomWidth"]};case"border-l":return{type:"regular",key:"borderWidth",props:["borderLeftWidth"]};case"border-s":return{type:"regular",key:"borderWidth",props:["borderInlineStartWidth"]};case"border-r":return{type:"regular",key:"borderWidth",props:["borderRightWidth"]};case"border-e":return{type:"regular",key:"borderWidth",props:["borderInlineEndWidth"]};case"border-x":return{type:"regular",key:"borderWidth",props:["borderInlineWidth"]};case"border-y":return{type:"regular",key:"borderWidth",props:["borderBlockWidth"]};case"decoration":return{type:"regular",key:"textDecorationThickness",props:["textDecorationThickness"]};case"rounded":return{type:"regular",key:"borderRadius",props:["borderRadius"]};case"rounded-s":return{type:"regular",key:"borderRadius",props:["borderStartStartRadius","borderEndStartRadius"]};case"rounded-ss":return{type:"regular",key:"borderRadius",props:["borderStartStartRadius"]};case"rounded-se":return{type:"regular",key:"borderRadius",props:["borderStartEndRadius"]};case"rounded-e":return{type:"regular",key:"borderRadius",props:["borderStartEndRadius","borderEndEndRadius"]};case"rounded-ee":return{type:"regular",key:"borderRadius",props:["borderEndEndRadius"]};case"rounded-es":return{type:"regular",key:"borderRadius",props:["borderEndStartRadius"]};case"rounded-t":return{type:"regular",key:"borderRadius",props:["borderTopLeftRadius","borderTopRightRadius"]};case"rounded-r":return{type:"regular",key:"borderRadius",props:["borderTopRightRadius","borderBottomRightRadius"]};case"rounded-b":return{type:"regular",key:"borderRadius",props:["borderBottomLeftRadius","borderBottomRightRadius"]};case"rounded-l":return{type:"regular",key:"borderRadius",props:["borderTopLeftRadius","borderBottomLeftRadius"]};case"rounded-tl":return{type:"regular",key:"borderRadius",props:["borderTopLeftRadius"]};case"rounded-tr":return{type:"regular",key:"borderRadius",props:["borderTopRightRadius"]};case"rounded-bl":return{type:"regular",key:"borderRadius",props:["borderBottomLeftRadius"]};case"rounded-br":return{type:"regular",key:"borderRadius",props:["borderBottomRightRadius"]};case"leading":return{type:"regular",key:"lineHeight",props:["lineHeight"]};case"tracking":return{type:"regular",key:"letterSpacing",props:["letterSpacing"]};case"text":return{type:"fontSize",key:"fontSize",props:["fontSize"]};default:return null}},re={error(){console.log("\x1B[31m",...arguments,"\x1B[0m")},warn(){console.log("\x1B[33m",...arguments,"\x1B[0m")},info(){console.log("\x1B[34m",...arguments,"\x1B[0m")},log(){console.log("\x1B[90m",...arguments,"\x1B[0m")}};class ke extends Error{constructor(n,r,o,i){super(n);C(this,"sourceStart");C(this,"sourceEnd");C(this,"parserState");this.name="ParseError",this.sourceStart=r,this.sourceEnd=o,this.parserState=i}}class K extends ke{constructor(n,r,o,i,a){super(n,r,o,i);C(this,"token");this.token=a}}const J={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'};function Y(...t){let e="";for(let n=0;n<t.length;n++)e+=t[n][1];return e}const oe=13,S=45,ie=10,se=43,Q=65533;function vt(t){return t.source.codePointAt(t.cursor)===60&&t.source.codePointAt(t.cursor+1)===33&&t.source.codePointAt(t.cursor+2)===S&&t.source.codePointAt(t.cursor+3)===S}function L(t){return t>=48&&t<=57}function mt(t){return t>=65&&t<=90}function gt(t){return t>=97&&t<=122}function ae(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function ht(t){return gt(t)||mt(t)}function ue(t){return ht(t)||Ct(t)||t===95}function Me(t){return ue(t)||L(t)||t===S}function Ct(t){return t===183||t===8204||t===8205||t===8255||t===8256||t===8204||192<=t&&t<=214||216<=t&&t<=246||248<=t&&t<=893||895<=t&&t<=8191||8304<=t&&t<=8591||11264<=t&&t<=12271||12289<=t&&t<=55295||63744<=t&&t<=64975||65008<=t&&t<=65533||t===0||!!ce(t)||t>=65536}function be(t){return t===ie||t===oe||t===12}function _(t){return t===32||t===ie||t===9||t===oe||t===12}function ce(t){return t>=55296&&t<=57343}function le(t){return t.source.codePointAt(t.cursor)===92&&!be(t.source.codePointAt(t.cursor+1)??-1)}function Se(t,e){return e.source.codePointAt(e.cursor)===S?e.source.codePointAt(e.cursor+1)===S||!!ue(e.source.codePointAt(e.cursor+1)??-1)||e.source.codePointAt(e.cursor+1)===92&&!be(e.source.codePointAt(e.cursor+2)??-1):!!ue(e.source.codePointAt(e.cursor)??-1)||le(e)}function Ze(t){return t.source.codePointAt(t.cursor)===se||t.source.codePointAt(t.cursor)===S?!!L(t.source.codePointAt(t.cursor+1)??-1)||t.source.codePointAt(t.cursor+1)===46&&L(t.source.codePointAt(t.cursor+2)??-1):t.source.codePointAt(t.cursor)===46?L(t.source.codePointAt(t.cursor+1)??-1):L(t.source.codePointAt(t.cursor)??-1)}function yt(t){return t.source.codePointAt(t.cursor)===47&&t.source.codePointAt(t.cursor+1)===42}function Et(t){return t.source.codePointAt(t.cursor)===S&&t.source.codePointAt(t.cursor+1)===S&&t.source.codePointAt(t.cursor+2)===62}var s,d,Ae;function Pt(t){switch(t){case s.OpenParen:return s.CloseParen;case s.CloseParen:return s.OpenParen;case s.OpenCurly:return s.CloseCurly;case s.CloseCurly:return s.OpenCurly;case s.OpenSquare:return s.CloseSquare;case s.CloseSquare:return s.OpenSquare;default:return null}}function kt(t){switch(t[0]){case s.OpenParen:return[s.CloseParen,")",-1,-1,void 0];case s.CloseParen:return[s.OpenParen,"(",-1,-1,void 0];case s.OpenCurly:return[s.CloseCurly,"}",-1,-1,void 0];case s.CloseCurly:return[s.OpenCurly,"{",-1,-1,void 0];case s.OpenSquare:return[s.CloseSquare,"]",-1,-1,void 0];case s.CloseSquare:return[s.OpenSquare,"[",-1,-1,void 0];default:return null}}function bt(t,e){for(e.advanceCodePoint(2);;){const n=e.readCodePoint();if(n===void 0){const r=[s.Comment,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new K(J.UnexpectedEOFInComment,e.representationStart,e.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],r)),r}if(n===42&&e.source.codePointAt(e.cursor)!==void 0&&e.source.codePointAt(e.cursor)===47){e.advanceCodePoint();break}}return[s.Comment,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}function De(t,e){const n=e.readCodePoint();if(n===void 0)return t.onParseError(new ke(J.UnexpectedEOFInEscapedCodePoint,e.representationStart,e.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),Q;if(ae(n)){const r=[n];let o;for(;(o=e.source.codePointAt(e.cursor))!==void 0&&ae(o)&&r.length<6;)r.push(o),e.advanceCodePoint();_(e.source.codePointAt(e.cursor)??-1)&&(e.source.codePointAt(e.cursor)===oe&&e.source.codePointAt(e.cursor+1)===ie&&e.advanceCodePoint(),e.advanceCodePoint());const i=parseInt(String.fromCodePoint(...r),16);return i===0||ce(i)||i>1114111?Q:i}return n===0||ce(n)?Q:n}function Be(t,e){const n=[];for(;;){const r=e.source.codePointAt(e.cursor)??-1;if(r===0||ce(r))n.push(Q),e.advanceCodePoint(+(r>65535)+1);else if(Me(r))n.push(r),e.advanceCodePoint(+(r>65535)+1);else{if(!le(e))return n;e.advanceCodePoint(),n.push(De(t,e))}}}function St(t,e){e.advanceCodePoint();const n=e.source.codePointAt(e.cursor);if(n!==void 0&&(Me(n)||le(e))){let r=Ae.Unrestricted;Se(0,e)&&(r=Ae.ID);const o=Be(t,e);return[s.Hash,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...o),type:r}]}return[s.Delim,"#",e.representationStart,e.representationEnd,{value:"#"}]}function At(t,e){let n=d.Integer;for(e.source.codePointAt(e.cursor)!==se&&e.source.codePointAt(e.cursor)!==S||e.advanceCodePoint();L(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();if(e.source.codePointAt(e.cursor)===46&&L(e.source.codePointAt(e.cursor+1)??-1))for(e.advanceCodePoint(2),n=d.Number;L(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();if(e.source.codePointAt(e.cursor)===101||e.source.codePointAt(e.cursor)===69){if(L(e.source.codePointAt(e.cursor+1)??-1))e.advanceCodePoint(2);else{if(e.source.codePointAt(e.cursor+1)!==S&&e.source.codePointAt(e.cursor+1)!==se||!L(e.source.codePointAt(e.cursor+2)??-1))return n;e.advanceCodePoint(3)}for(n=d.Number;L(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint()}return n}function Re(t,e){let n;{const i=e.source.codePointAt(e.cursor);i===S?n="-":i===se&&(n="+")}const r=At(0,e),o=parseFloat(e.source.slice(e.representationStart,e.representationEnd+1));if(Se(0,e)){const i=Be(t,e);return[s.Dimension,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:o,signCharacter:n,type:r,unit:String.fromCodePoint(...i)}]}return e.source.codePointAt(e.cursor)===37?(e.advanceCodePoint(),[s.Percentage,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:o,signCharacter:n}]):[s.Number,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:o,signCharacter:n,type:r}]}function Dt(t){for(;_(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();return[s.Whitespace,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0]}(function(t){t.Comment="comment",t.AtKeyword="at-keyword-token",t.BadString="bad-string-token",t.BadURL="bad-url-token",t.CDC="CDC-token",t.CDO="CDO-token",t.Colon="colon-token",t.Comma="comma-token",t.Delim="delim-token",t.Dimension="dimension-token",t.EOF="EOF-token",t.Function="function-token",t.Hash="hash-token",t.Ident="ident-token",t.Number="number-token",t.Percentage="percentage-token",t.Semicolon="semicolon-token",t.String="string-token",t.URL="url-token",t.Whitespace="whitespace-token",t.OpenParen="(-token",t.CloseParen=")-token",t.OpenSquare="[-token",t.CloseSquare="]-token",t.OpenCurly="{-token",t.CloseCurly="}-token",t.UnicodeRange="unicode-range-token"})(s||(s={})),(function(t){t.Integer="integer",t.Number="number"})(d||(d={})),(function(t){t.Unrestricted="unrestricted",t.ID="id"})(Ae||(Ae={}));class Bt{constructor(e){C(this,"cursor",0);C(this,"source","");C(this,"representationStart",0);C(this,"representationEnd",-1);this.source=e}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(e!==void 0)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1}}function Ft(t,e){let n="";const r=e.readCodePoint();for(;;){const o=e.readCodePoint();if(o===void 0){const i=[s.String,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];return t.onParseError(new K(J.UnexpectedEOFInString,e.representationStart,e.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],i)),i}if(be(o)){e.unreadCodePoint();const i=[s.BadString,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new K(J.UnexpectedNewLineInString,e.representationStart,e.source.codePointAt(e.cursor)===oe&&e.source.codePointAt(e.cursor+1)===ie?e.representationEnd+2:e.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],i)),i}if(o===r)return[s.String,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];if(o!==92)o===0||ce(o)?n+=String.fromCodePoint(Q):n+=String.fromCodePoint(o);else{if(e.source.codePointAt(e.cursor)===void 0)continue;if(be(e.source.codePointAt(e.cursor)??-1)){e.source.codePointAt(e.cursor)===oe&&e.source.codePointAt(e.cursor+1)===ie&&e.advanceCodePoint(),e.advanceCodePoint();continue}n+=String.fromCodePoint(De(t,e))}}}function wt(t){return!(t.length!==3||t[0]!==117&&t[0]!==85||t[1]!==114&&t[1]!==82||t[2]!==108&&t[2]!==76)}function Ue(t,e){for(;;){const n=e.source.codePointAt(e.cursor);if(n===void 0)return;if(n===41)return void e.advanceCodePoint();le(e)?(e.advanceCodePoint(),De(t,e)):e.advanceCodePoint()}}function Nt(t,e){for(;_(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();let n="";for(;;){if(e.source.codePointAt(e.cursor)===void 0){const i=[s.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];return t.onParseError(new K(J.UnexpectedEOFInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],i)),i}if(e.source.codePointAt(e.cursor)===41)return e.advanceCodePoint(),[s.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];if(_(e.source.codePointAt(e.cursor)??-1)){for(e.advanceCodePoint();_(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();if(e.source.codePointAt(e.cursor)===void 0){const i=[s.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}];return t.onParseError(new K(J.UnexpectedEOFInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],i)),i}return e.source.codePointAt(e.cursor)===41?(e.advanceCodePoint(),[s.URL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:n}]):(Ue(t,e),[s.BadURL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0])}const o=e.source.codePointAt(e.cursor);if(o===34||o===39||o===40||(r=o??-1)===11||r===127||0<=r&&r<=8||14<=r&&r<=31){Ue(t,e);const i=[s.BadURL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new K(J.UnexpectedCharacterInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token",`Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`],i)),i}if(o===92){if(le(e)){e.advanceCodePoint(),n+=String.fromCodePoint(De(t,e));continue}Ue(t,e);const i=[s.BadURL,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0];return t.onParseError(new K(J.InvalidEscapeSequenceInURL,e.representationStart,e.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],i)),i}e.source.codePointAt(e.cursor)===0||ce(e.source.codePointAt(e.cursor)??-1)?(n+=String.fromCodePoint(Q),e.advanceCodePoint()):(n+=e.source[e.cursor],e.advanceCodePoint())}var r}function We(t,e){const n=Be(t,e);if(e.source.codePointAt(e.cursor)!==40)return[s.Ident,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...n)}];if(wt(n)){e.advanceCodePoint();let r=0;for(;;){const o=_(e.source.codePointAt(e.cursor)??-1),i=_(e.source.codePointAt(e.cursor+1)??-1);if(o&&i){r+=1,e.advanceCodePoint(1);continue}const a=o?e.source.codePointAt(e.cursor+1):e.source.codePointAt(e.cursor);if(a===34||a===39)return r>0&&e.unreadCodePoint(r),[s.Function,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...n)}];break}return Nt(t,e)}return e.advanceCodePoint(),[s.Function,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{value:String.fromCodePoint(...n)}]}function It(t){return!(t.source.codePointAt(t.cursor)!==117&&t.source.codePointAt(t.cursor)!==85||t.source.codePointAt(t.cursor+1)!==se||t.source.codePointAt(t.cursor+2)!==63&&!ae(t.source.codePointAt(t.cursor+2)??-1))}function xt(t,e){e.advanceCodePoint(2);const n=[],r=[];let o;for(;(o=e.source.codePointAt(e.cursor))!==void 0&&n.length<6&&ae(o);)n.push(o),e.advanceCodePoint();for(;(o=e.source.codePointAt(e.cursor))!==void 0&&n.length<6&&o===63;)r.length===0&&r.push(...n),n.push(48),r.push(70),e.advanceCodePoint();if(!r.length&&e.source.codePointAt(e.cursor)===S&&ae(e.source.codePointAt(e.cursor+1)??-1))for(e.advanceCodePoint();(o=e.source.codePointAt(e.cursor))!==void 0&&r.length<6&&ae(o);)r.push(o),e.advanceCodePoint();if(!r.length){const u=parseInt(String.fromCodePoint(...n),16);return[s.UnicodeRange,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{startOfRange:u,endOfRange:u}]}const i=parseInt(String.fromCodePoint(...n),16),a=parseInt(String.fromCodePoint(...r),16);return[s.UnicodeRange,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,{startOfRange:i,endOfRange:a}]}function Ot(t,e){const n=Tt(t),r=[];for(;!n.endOfFile();)r.push(n.nextToken());return r.push(n.nextToken()),r}function Tt(t,e){const n=t.css.valueOf(),r=t.unicodeRangesAllowed??!1,o=new Bt(n),i={onParseError:Mt};return{nextToken:function(){o.resetRepresentation();const u=o.source.codePointAt(o.cursor);if(u===void 0)return[s.EOF,"",-1,-1,void 0];if(u===47&&yt(o))return bt(i,o);if(r&&(u===117||u===85)&&It(o))return xt(0,o);if(ue(u))return We(i,o);if(L(u))return Re(i,o);switch(u){case 44:return o.advanceCodePoint(),[s.Comma,",",o.representationStart,o.representationEnd,void 0];case 58:return o.advanceCodePoint(),[s.Colon,":",o.representationStart,o.representationEnd,void 0];case 59:return o.advanceCodePoint(),[s.Semicolon,";",o.representationStart,o.representationEnd,void 0];case 40:return o.advanceCodePoint(),[s.OpenParen,"(",o.representationStart,o.representationEnd,void 0];case 41:return o.advanceCodePoint(),[s.CloseParen,")",o.representationStart,o.representationEnd,void 0];case 91:return o.advanceCodePoint(),[s.OpenSquare,"[",o.representationStart,o.representationEnd,void 0];case 93:return o.advanceCodePoint(),[s.CloseSquare,"]",o.representationStart,o.representationEnd,void 0];case 123:return o.advanceCodePoint(),[s.OpenCurly,"{",o.representationStart,o.representationEnd,void 0];case 125:return o.advanceCodePoint(),[s.CloseCurly,"}",o.representationStart,o.representationEnd,void 0];case 39:case 34:return Ft(i,o);case 35:return St(i,o);case se:case 46:return Ze(o)?Re(i,o):(o.advanceCodePoint(),[s.Delim,o.source[o.representationStart],o.representationStart,o.representationEnd,{value:o.source[o.representationStart]}]);case ie:case oe:case 12:case 9:case 32:return Dt(o);case S:return Ze(o)?Re(i,o):Et(o)?(o.advanceCodePoint(3),[s.CDC,"-->",o.representationStart,o.representationEnd,void 0]):Se(0,o)?We(i,o):(o.advanceCodePoint(),[s.Delim,"-",o.representationStart,o.representationEnd,{value:"-"}]);case 60:return vt(o)?(o.advanceCodePoint(4),[s.CDO,"<!--",o.representationStart,o.representationEnd,void 0]):(o.advanceCodePoint(),[s.Delim,"<",o.representationStart,o.representationEnd,{value:"<"}]);case 64:if(o.advanceCodePoint(),Se(0,o)){const c=Be(i,o);return[s.AtKeyword,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:String.fromCodePoint(...c)}]}return[s.Delim,"@",o.representationStart,o.representationEnd,{value:"@"}];case 92:{if(le(o))return We(i,o);o.advanceCodePoint();const c=[s.Delim,"\\",o.representationStart,o.representationEnd,{value:"\\"}];return i.onParseError(new K(J.InvalidEscapeSequenceAfterBackslash,o.representationStart,o.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],c)),c}}return o.advanceCodePoint(),[s.Delim,o.source[o.representationStart],o.representationStart,o.representationEnd,{value:o.source[o.representationStart]}]},endOfFile:function(){return o.source.codePointAt(o.cursor)===void 0}}}function Mt(){}function Rt(t,e){const n=[];for(const u of e)n.push(u.codePointAt(0));const r=Ut(n);r[0]===101&&Le(r,0,r[0]);const o=String.fromCodePoint(...r),i=t[4].signCharacter==="+"?t[4].signCharacter:"",a=t[4].value.toString();t[1]=`${i}${a}${o}`,t[4].unit=e}function Ut(t){let e=0;if(t[0]===0)t.splice(0,1,Q),e=1;else if(t[0]===S&&t[1]===S)e=2;else if(t[0]===S&&t[1])e=2,ue(t[1])||(e+=Le(t,1,t[1]));else{if(t[0]===S&&!t[1])return[92,t[0]];ue(t[0])?e=1:(e=1,e+=Le(t,0,t[0]))}for(let n=e;n<t.length;n++)t[n]!==0?Me(t[n])||(n+=Wt(t,n,t[n])):(t.splice(n,1,Q),n++);return t}function Wt(t,e,n){return t.splice(e,1,92,n),1}function Le(t,e,n){const r=n.toString(16),o=[];for(const i of r)o.push(i.codePointAt(0));return t.splice(e,1,92,...o,32),1+o.length}const Lt=Object.values(s);function Ke(t){return!!Array.isArray(t)&&!(t.length<4)&&!!Lt.includes(t[0])&&typeof t[1]=="string"&&typeof t[2]=="number"&&typeof t[3]=="number"}function A(t){if(!t)return!1;switch(t[0]){case s.Dimension:case s.Number:case s.Percentage:return!0;default:return!1}}function Qe(t){if(!t)return!1;switch(t[0]){case s.Whitespace:case s.Comment:return!0;default:return!1}}function de(t){return!!t&&t[0]===s.Comma}function Xe(t){return!!t&&t[0]===s.Comment}function _e(t){return!!t&&t[0]===s.Delim}function k(t){return!!t&&t[0]===s.Dimension}function X(t){return!!t&&t[0]===s.EOF}function $t(t){return!!t&&t[0]===s.Function}function ge(t){return!!t&&t[0]===s.Ident}function m(t){return!!t&&t[0]===s.Number}function b(t){return!!t&&t[0]===s.Percentage}function $e(t){return!!t&&t[0]===s.Whitespace}function et(t){return!!t&&t[0]===s.OpenParen}function qt(t){return!!t&&t[0]===s.CloseParen}function zt(t){return!!t&&t[0]===s.OpenSquare}function Vt(t){return!!t&&t[0]===s.OpenCurly}var $;function tt(t){let e=t.slice();return(n,r,o)=>{let i=-1;for(let a=e.indexOf(r);a<e.length&&(i=n.indexOf(e[a]),i===-1||i<o);a++);return i===-1||i===o&&r===n[o]&&(i++,i>=n.length)?-1:(e=n.slice(),i)}}function qe(t,e){const n=e[0];if(et(n)||Vt(n)||zt(n)){const r=Ht(t,e);return{advance:r.advance,node:r.node}}if($t(n)){const r=jt(t,e);return{advance:r.advance,node:r.node}}if($e(n)){const r=rt(t,e);return{advance:r.advance,node:r.node}}if(Xe(n)){const r=Gt(t,e);return{advance:r.advance,node:r.node}}return{advance:1,node:new f(n)}}(function(t){t.Function="function",t.SimpleBlock="simple-block",t.Whitespace="whitespace",t.Comment="comment",t.Token="token"})($||($={}));class nt{constructor(){C(this,"value",[])}indexOf(e){return this.value.indexOf(e)}at(e){if(typeof e=="number")return e<0&&(e=this.value.length+e),this.value[e]}forEach(e,n){if(this.value.length===0)return;const r=tt(this.value);let o=0;for(;o<this.value.length;){const i=this.value[o];let a;if(n&&(a={...n}),e({node:i,parent:this,state:a},o)===!1)return!1;if(o=r(this.value,i,o),o===-1)break}}walk(e,n){this.value.length!==0&&this.forEach(((r,o)=>e(r,o)!==!1&&(!("walk"in r.node)||!this.value.includes(r.node)||r.node.walk(e,r.state)!==!1)&&void 0),n)}}class F extends nt{constructor(n,r,o){super();C(this,"type",$.Function);C(this,"name");C(this,"endToken");this.name=n,this.endToken=r,this.value=o}getName(){return this.name[4].value}normalize(){X(this.endToken)&&(this.endToken=[s.CloseParen,")",-1,-1,void 0])}tokens(){return X(this.endToken)?[this.name,...this.value.flatMap((n=>n.tokens()))]:[this.name,...this.value.flatMap((n=>n.tokens())),this.endToken]}toString(){const n=this.value.map((r=>Ke(r)?Y(r):r.toString())).join("");return Y(this.name)+n+Y(this.endToken)}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map((n=>n.toJSON()))}}isFunctionNode(){return F.isFunctionNode(this)}static isFunctionNode(n){return!!n&&n instanceof F&&n.type===$.Function}}function jt(t,e){const n=[];let r=1;for(;;){const o=e[r];if(!o||X(o))return t.onParseError(new ke("Unexpected EOF while consuming a function.",e[0][2],e[e.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:e.length,node:new F(e[0],o,n)};if(qt(o))return{advance:r+1,node:new F(e[0],o,n)};if(Qe(o)){const a=ot(t,e.slice(r));r+=a.advance,n.push(...a.nodes);continue}const i=qe(t,e.slice(r));r+=i.advance,n.push(i.node)}}class pe extends nt{constructor(n,r,o){super();C(this,"type",$.SimpleBlock);C(this,"startToken");C(this,"endToken");this.startToken=n,this.endToken=r,this.value=o}normalize(){if(X(this.endToken)){const n=kt(this.startToken);n&&(this.endToken=n)}}tokens(){return X(this.endToken)?[this.startToken,...this.value.flatMap((n=>n.tokens()))]:[this.startToken,...this.value.flatMap((n=>n.tokens())),this.endToken]}toString(){const n=this.value.map((r=>Ke(r)?Y(r):r.toString())).join("");return Y(this.startToken)+n+Y(this.endToken)}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map((n=>n.toJSON()))}}isSimpleBlockNode(){return pe.isSimpleBlockNode(this)}static isSimpleBlockNode(n){return!!n&&n instanceof pe&&n.type===$.SimpleBlock}}function Ht(t,e){const n=Pt(e[0][0]);if(!n)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const r=[];let o=1;for(;;){const i=e[o];if(!i||X(i))return t.onParseError(new ke("Unexpected EOF while consuming a simple block.",e[0][2],e[e.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:e.length,node:new pe(e[0],i,r)};if(i[0]===n)return{advance:o+1,node:new pe(e[0],i,r)};if(Qe(i)){const u=ot(t,e.slice(o));o+=u.advance,r.push(...u.nodes);continue}const a=qe(t,e.slice(o));o+=a.advance,r.push(a.node)}}class O{constructor(e){C(this,"type",$.Whitespace);C(this,"value");this.value=e}tokens(){return this.value}toString(){return Y(...this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isWhitespaceNode(){return O.isWhitespaceNode(this)}static isWhitespaceNode(e){return!!e&&e instanceof O&&e.type===$.Whitespace}}function rt(t,e){let n=0;for(;;){const r=e[n];if(!$e(r))return{advance:n,node:new O(e.slice(0,n))};n++}}class fe{constructor(e){C(this,"type",$.Comment);C(this,"value");this.value=e}tokens(){return[this.value]}toString(){return Y(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isCommentNode(){return fe.isCommentNode(this)}static isCommentNode(e){return!!e&&e instanceof fe&&e.type===$.Comment}}function Gt(t,e){return{advance:1,node:new fe(e[0])}}function ot(t,e){const n=[];let r=0;for(;;)if($e(e[r])){const o=rt(0,e.slice(r));r+=o.advance,n.push(o.node)}else{if(!Xe(e[r]))return{advance:r,nodes:n};n.push(new fe(e[r])),r++}}class f{constructor(e){C(this,"type",$.Token);C(this,"value");this.value=e}tokens(){return[this.value]}toString(){return this.value[1]}toJSON(){return{type:this.type,tokens:this.tokens()}}isTokenNode(){return f.isTokenNode(this)}static isTokenNode(e){return!!e&&e instanceof f&&e.type===$.Token}}function Jt(t,e){const n={onParseError:(e==null?void 0:e.onParseError)??(()=>{})},r=[...t];if(t.length===0)return[];X(r[r.length-1])&&r.push([s.EOF,"",r[r.length-1][2],r[r.length-1][3],void 0]);const o=[];let i=[],a=0;for(;;){if(!r[a]||X(r[a]))return i.length&&o.push(i),o;if(de(r[a])){o.push(i),i=[],a++;continue}const u=qe(n,t.slice(a));i.push(u.node),a+=u.advance}}function Yt(t,e,n){if(t.length===0)return;const r=tt(t);let o=0;for(;o<t.length;){const i=t[o];if(e({node:i,parent:{value:t},state:void 0},o)===!1)return!1;if(o=r(t,i,o),o===-1)break}}function Zt(t,e,n){t.length!==0&&Yt(t,((r,o)=>e(r,o)!==!1&&(!("walk"in r.node)||!t.includes(r.node)||r.node.walk(e,r.state)!==!1)&&void 0))}function Kt(t,e){for(let n=0;n<t.length;n++)Zt(t[n],((r,o)=>{if(typeof o!="number")return;const i=e(r.node);i&&(Array.isArray(i)?r.parent.value.splice(o,1,...i):r.parent.value.splice(o,1,i))}));return t}function Qt(t){return pe.isSimpleBlockNode(t)}function ve(t){return F.isFunctionNode(t)}function it(t){return O.isWhitespaceNode(t)}function st(t){return fe.isCommentNode(t)}function ee(t){return it(t)||st(t)}function h(t){return f.isTokenNode(t)}const Xt=/[A-Z]/g;function T(t){return t.replace(Xt,(e=>String.fromCharCode(e.charCodeAt(0)+32)))}const _t=new Map([["cm",t=>t],["mm",t=>10*t],["q",t=>40*t],["in",t=>t/2.54],["pc",t=>t/2.54*6],["pt",t=>t/2.54*72],["px",t=>t/2.54*96]]),Fe=new Map([["deg",t=>t],["grad",t=>t/.9],["rad",t=>t/180*Math.PI],["turn",t=>t/360]]),he=new Map([["deg",t=>.9*t],["grad",t=>t],["rad",t=>.9*t/180*Math.PI],["turn",t=>.9*t/360]]),en=new Map([["hz",t=>t],["khz",t=>t/1e3]]),tn=new Map([["cm",t=>2.54*t],["mm",t=>25.4*t],["q",t=>25.4*t*4],["in",t=>t],["pc",t=>6*t],["pt",t=>72*t],["px",t=>96*t]]),nn=new Map([["hz",t=>1e3*t],["khz",t=>t]]),rn=new Map([["cm",t=>t/10],["mm",t=>t],["q",t=>4*t],["in",t=>t/25.4],["pc",t=>t/25.4*6],["pt",t=>t/25.4*72],["px",t=>t/25.4*96]]),on=new Map([["ms",t=>t],["s",t=>t/1e3]]),sn=new Map([["cm",t=>t/6*2.54],["mm",t=>t/6*25.4],["q",t=>t/6*25.4*4],["in",t=>t/6],["pc",t=>t],["pt",t=>t/6*72],["px",t=>t/6*96]]),an=new Map([["cm",t=>t/72*2.54],["mm",t=>t/72*25.4],["q",t=>t/72*25.4*4],["in",t=>t/72],["pc",t=>t/72*6],["pt",t=>t],["px",t=>t/72*96]]),un=new Map([["cm",t=>t/96*2.54],["mm",t=>t/96*25.4],["q",t=>t/96*25.4*4],["in",t=>t/96],["pc",t=>t/96*6],["pt",t=>t/96*72],["px",t=>t]]),cn=new Map([["cm",t=>t/4/10],["mm",t=>t/4],["q",t=>t],["in",t=>t/4/25.4],["pc",t=>t/4/25.4*6],["pt",t=>t/4/25.4*72],["px",t=>t/4/25.4*96]]),at=new Map([["deg",t=>180*t/Math.PI],["grad",t=>180*t/Math.PI/.9],["rad",t=>t],["turn",t=>180*t/Math.PI/360]]),ln=new Map([["ms",t=>1e3*t],["s",t=>t]]),Ce=new Map([["deg",t=>360*t],["grad",t=>360*t/.9],["rad",t=>360*t/180*Math.PI],["turn",t=>t]]),dn=new Map([["cm",_t],["mm",rn],["q",cn],["in",tn],["pc",sn],["pt",an],["px",un],["ms",on],["s",ln],["deg",Fe],["grad",he],["rad",at],["turn",Ce],["hz",en],["khz",nn]]);function M(t,e){if(!k(t)||!k(e))return e;const n=T(t[4].unit),r=T(e[4].unit);if(n===r)return e;const o=dn.get(r);if(!o)return e;const i=o.get(n);if(!i)return e;const a=i(e[4].value),u=[s.Dimension,"",e[2],e[3],{...e[4],signCharacter:a<0?"-":void 0,type:Number.isInteger(a)?d.Integer:d.Number,value:a}];return Rt(u,t[4].unit),u}function pn(t){if(t.length!==2)return-1;const e=t[0].value;let n=t[1].value;if(m(e)&&m(n)){const r=e[4].value+n[4].value;return new f([s.Number,r.toString(),e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number}])}if(b(e)&&b(n)){const r=e[4].value+n[4].value;return new f([s.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(k(e)&&k(n)&&(n=M(e,n),T(e[4].unit)===T(n[4].unit))){const r=e[4].value+n[4].value;return new f([s.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number,unit:e[4].unit}])}return-1}function fn(t){if(t.length!==2)return-1;const e=t[0].value,n=t[1].value;if(m(e)&&m(n)){const r=e[4].value/n[4].value;return new f([s.Number,r.toString(),e[2],n[3],{value:r,type:Number.isInteger(r)?d.Integer:d.Number}])}if(b(e)&&m(n)){const r=e[4].value/n[4].value;return new f([s.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(k(e)&&m(n)){const r=e[4].value/n[4].value;return new f([s.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:Number.isInteger(r)?d.Integer:d.Number,unit:e[4].unit}])}return-1}function te(t){return!!t&&typeof t=="object"&&"inputs"in t&&Array.isArray(t.inputs)&&"operation"in t}function N(t){if(t===-1)return-1;const e=[];for(let n=0;n<t.inputs.length;n++){const r=t.inputs[n];if(h(r)){e.push(r);continue}const o=N(r);if(o===-1)return-1;e.push(o)}return t.operation(e)}function vn(t){if(t.length!==2)return-1;const e=t[0].value,n=t[1].value;if(m(e)&&m(n)){const r=e[4].value*n[4].value;return new f([s.Number,r.toString(),e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number}])}if(b(e)&&m(n)){const r=e[4].value*n[4].value;return new f([s.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(m(e)&&b(n)){const r=e[4].value*n[4].value;return new f([s.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(k(e)&&m(n)){const r=e[4].value*n[4].value;return new f([s.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number,unit:e[4].unit}])}if(m(e)&&k(n)){const r=e[4].value*n[4].value;return new f([s.Dimension,r.toString()+n[4].unit,e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number,unit:n[4].unit}])}return-1}function me(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(!h(r))continue;const o=r.value;if(!ge(o))continue;const i=T(o[4].value);switch(i){case"e":t.splice(n,1,new f([s.Number,Math.E.toString(),o[2],o[3],{value:Math.E,type:d.Number}]));break;case"pi":t.splice(n,1,new f([s.Number,Math.PI.toString(),o[2],o[3],{value:Math.PI,type:d.Number}]));break;case"infinity":t.splice(n,1,new f([s.Number,"infinity",o[2],o[3],{value:1/0,type:d.Number}]));break;case"-infinity":t.splice(n,1,new f([s.Number,"-infinity",o[2],o[3],{value:-1/0,type:d.Number}]));break;case"nan":t.splice(n,1,new f([s.Number,"NaN",o[2],o[3],{value:Number.NaN,type:d.Number}]));break;default:if(e.has(i)){const a=e.get(i);t.splice(n,1,new f(a))}}}return t}function we(t){if(t.length!==1)return-1;const e=t[0].value;return A(e)?t[0]:-1}function I(t,e,n){return k(e)?ye(t,e[4].unit,n):b(e)?mn(t,n):m(e)?j(t,n):-1}function ye(t,e,n){const r=t.tokens();return{inputs:[new f([s.Dimension,n.toString()+e,r[0][2],r[r.length-1][3],{value:n,type:Number.isInteger(n)?d.Integer:d.Number,unit:e}])],operation:we}}function mn(t,e){const n=t.tokens();return{inputs:[new f([s.Percentage,e.toString()+"%",n[0][2],n[n.length-1][3],{value:e}])],operation:we}}function j(t,e){const n=t.tokens();return{inputs:[new f([s.Number,e.toString(),n[0][2],n[n.length-1][3],{value:e,type:Number.isInteger(e)?d.Integer:d.Number}])],operation:we}}function gn(t,e){const n=e.value;return m(n)?ye(t,"rad",Math.acos(n[4].value)):-1}function hn(t,e){const n=e.value;return m(n)?ye(t,"rad",Math.asin(n[4].value)):-1}function Cn(t,e){const n=e.value;return m(n)?ye(t,"rad",Math.atan(n[4].value)):-1}function Ne(t){return k(t)||m(t)}function ze(t){if(t.length===0)return!0;const e=t[0];if(!A(e))return!1;if(t.length===1)return!0;if(k(e)){const n=T(e[4].unit);for(let r=1;r<t.length;r++){const o=t[r];if(e[0]!==o[0]||n!==T(o[4].unit))return!1}return!0}for(let n=1;n<t.length;n++){const r=t[n];if(e[0]!==r[0])return!1}return!0}function Z(t,e){return!!A(t)&&(k(t)?t[0]===e[0]&&T(t[4].unit)===T(e[4].unit):t[0]===e[0])}function yn(t,e,n){const r=e.value;if(!Ne(r))return-1;const o=M(r,n.value);return Z(r,o)?ye(t,"rad",Math.atan2(r[4].value,o[4].value)):-1}function En(t,e,n){const r=e.value;return!A(r)||!n.rawPercentages&&b(r)?-1:I(t,r,Math.abs(r[4].value))}function Pn(t,e,n,r,o){if(!h(e)||!h(n)||!h(r))return-1;const i=e.value;if(!A(i)||!o.rawPercentages&&b(i))return-1;const a=M(i,n.value);if(!Z(i,a))return-1;const u=M(i,r.value);return Z(i,u)?I(t,i,Math.max(i[4].value,Math.min(a[4].value,u[4].value))):-1}function kn(t,e){const n=e.value;if(!Ne(n))return-1;let r=n[4].value;if(k(n))switch(n[4].unit.toLowerCase()){case"rad":break;case"deg":r=Fe.get("rad")(n[4].value);break;case"grad":r=he.get("rad")(n[4].value);break;case"turn":r=Ce.get("rad")(n[4].value);break;default:return-1}return r=Math.cos(r),j(t,r)}function bn(t,e){const n=e.value;return m(n)?j(t,Math.exp(n[4].value)):-1}function Sn(t,e,n){if(!e.every(h))return-1;const r=e[0].value;if(!A(r)||!n.rawPercentages&&b(r))return-1;const o=e.map((u=>M(r,u.value)));if(!ze(o))return-1;const i=o.map((u=>u[4].value)),a=Math.hypot(...i);return I(t,r,a)}function ut(t,e,n){if(!e.every(h))return-1;const r=e[0].value;if(!A(r)||!n.rawPercentages&&b(r))return-1;const o=e.map((u=>M(r,u.value)));if(!ze(o))return-1;const i=o.map((u=>u[4].value)),a=Math.max(...i);return I(t,r,a)}function ct(t,e,n){if(!e.every(h))return-1;const r=e[0].value;if(!A(r)||!n.rawPercentages&&b(r))return-1;const o=e.map((u=>M(r,u.value)));if(!ze(o))return-1;const i=o.map((u=>u[4].value)),a=Math.min(...i);return I(t,r,a)}function An(t,e,n){const r=e.value;if(!A(r))return-1;const o=M(r,n.value);if(!Z(r,o))return-1;let i;return i=o[4].value===0?Number.NaN:Number.isFinite(r[4].value)&&(Number.isFinite(o[4].value)||(o[4].value!==Number.POSITIVE_INFINITY||r[4].value!==Number.NEGATIVE_INFINITY&&!Object.is(0*r[4].value,-0))&&(o[4].value!==Number.NEGATIVE_INFINITY||r[4].value!==Number.POSITIVE_INFINITY&&!Object.is(0*r[4].value,0)))?Number.isFinite(o[4].value)?(r[4].value%o[4].value+o[4].value)%o[4].value:r[4].value:Number.NaN,I(t,r,i)}function Dn(t,e,n){const r=e.value,o=n.value;return!m(r)||!Z(r,o)?-1:j(t,Math.pow(r[4].value,o[4].value))}function Bn(t,e,n){const r=e.value;if(!A(r))return-1;const o=M(r,n.value);if(!Z(r,o))return-1;let i;return i=o[4].value===0?Number.NaN:Number.isFinite(r[4].value)?Number.isFinite(o[4].value)?r[4].value%o[4].value:r[4].value:Number.NaN,I(t,r,i)}function Fn(t,e,n,r,o){const i=n.value;if(!A(i)||!o.rawPercentages&&b(i))return-1;const a=M(i,r.value);if(!Z(i,a))return-1;let u;if(a[4].value===0)u=Number.NaN;else if(Number.isFinite(i[4].value)||Number.isFinite(a[4].value))if(!Number.isFinite(i[4].value)&&Number.isFinite(a[4].value))u=i[4].value;else if(Number.isFinite(i[4].value)&&!Number.isFinite(a[4].value))switch(e){case"down":u=i[4].value<0?-1/0:Object.is(-0,0*i[4].value)?-0:0;break;case"up":u=i[4].value>0?1/0:Object.is(0,0*i[4].value)?0:-0;break;default:u=Object.is(0,0*i[4].value)?0:-0}else if(Number.isFinite(a[4].value))switch(e){case"down":u=Math.floor(i[4].value/a[4].value)*a[4].value;break;case"up":u=Math.ceil(i[4].value/a[4].value)*a[4].value;break;case"to-zero":u=Math.trunc(i[4].value/a[4].value)*a[4].value;break;default:{let c=Math.floor(i[4].value/a[4].value)*a[4].value,p=Math.ceil(i[4].value/a[4].value)*a[4].value;if(c>p){const y=c;c=p,p=y}const l=Math.abs(i[4].value-c),v=Math.abs(i[4].value-p);u=l===v?p:l<v?c:p;break}}else u=i[4].value;else u=Number.NaN;return I(t,i,u)}function wn(t,e,n){const r=e.value;return!A(r)||!n.rawPercentages&&b(r)?-1:j(t,Math.sign(r[4].value))}function Nn(t,e){const n=e.value;if(!Ne(n))return-1;let r=n[4].value;if(k(n))switch(T(n[4].unit)){case"rad":break;case"deg":r=Fe.get("rad")(n[4].value);break;case"grad":r=he.get("rad")(n[4].value);break;case"turn":r=Ce.get("rad")(n[4].value);break;default:return-1}return r=Math.sin(r),j(t,r)}function In(t,e){const n=e.value;return m(n)?j(t,Math.sqrt(n[4].value)):-1}function xn(t,e){const n=e.value;if(!Ne(n))return-1;const r=n[4].value;let o=0,i=n[4].value;if(k(n))switch(T(n[4].unit)){case"rad":o=at.get("deg")(r);break;case"deg":o=r,i=Fe.get("rad")(r);break;case"grad":o=he.get("deg")(r),i=he.get("rad")(r);break;case"turn":o=Ce.get("deg")(r),i=Ce.get("rad")(r);break;default:return-1}const a=o/90;return i=o%90==0&&a%2!=0?a>0?1/0:-1/0:Math.tan(i),j(t,i)}function On(t){if(t.length!==2)return-1;const e=t[0].value;let n=t[1].value;if(m(e)&&m(n)){const r=e[4].value-n[4].value;return new f([s.Number,r.toString(),e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number}])}if(b(e)&&b(n)){const r=e[4].value-n[4].value;return new f([s.Percentage,r.toString()+"%",e[2],n[3],{value:r}])}if(k(e)&&k(n)&&(n=M(e,n),T(e[4].unit)===T(n[4].unit))){const r=e[4].value-n[4].value;return new f([s.Dimension,r.toString()+e[4].unit,e[2],n[3],{value:r,type:e[4].type===d.Integer&&n[4].type===d.Integer?d.Integer:d.Number,unit:e[4].unit}])}return-1}function Tn(t,e){if(e.length===1){const n=e[0];if(!n||!h(n))return-1;const r=n.value;return m(r)?j(t,Math.log(r[4].value)):-1}if(e.length===2){const n=e[0];if(!n||!h(n))return-1;const r=n.value;if(!m(r))return-1;const o=e[1];if(!o||!h(o))return-1;const i=o.value;return m(i)?j(t,Math.log(r[4].value)/Math.log(i[4].value)):-1}return-1}const Mn=/^none$/i;function Ve(t){if(Array.isArray(t)){const n=t.filter((r=>!(it(r)&&st(r))));return n.length===1&&Ve(n[0])}if(!h(t))return!1;const e=t.value;return!!ge(e)&&Mn.test(e[4].value)}const Rn=String.fromCodePoint(0);function Un(t,e,n,r,o,i){var E;if(e.fixed===-1&&!i.randomCaching)return-1;i.randomCaching||(i.randomCaching={propertyName:"",propertyN:0,elementID:"",documentID:""}),i.randomCaching&&!i.randomCaching.propertyN&&(i.randomCaching.propertyN=0);const a=n.value;if(!A(a))return-1;const u=M(a,r.value);if(!Z(a,u))return-1;let c=null;if(o&&(c=M(a,o.value),!Z(a,c)))return-1;if(!Number.isFinite(a[4].value)||!Number.isFinite(u[4].value)||!Number.isFinite(u[4].value-a[4].value))return I(t,a,Number.NaN);if(c&&!Number.isFinite(c[4].value))return I(t,a,a[4].value);const p=e.fixed===-1?Wn(Ln([e.dashedIdent?e.dashedIdent:`${(E=i.randomCaching)==null?void 0:E.propertyName} ${i.randomCaching.propertyN++}`,e.elementShared?"":i.randomCaching.elementID,i.randomCaching.documentID].join(Rn))):()=>e.fixed;let l=a[4].value,v=u[4].value;if(l>v&&([l,v]=[v,l]),c&&(c[4].value<=0||Math.abs(l-v)/c[4].value>1e10)&&(c=null),c){const P=Math.max(c[4].value/1e3,1e-9),g=[l];let G=0;for(;;){G+=c[4].value;const U=l+G;if(!(U+P<v)){g.push(v);break}if(g.push(U),U+c[4].value-P>v)break}const z=p();return I(t,a,Number(g[Math.floor(g.length*z)].toFixed(5)))}const y=p();return I(t,a,Number((y*(v-l)+l).toFixed(5)))}function Wn(t=.34944106645296036,e=.19228640875738723,n=.8784393832007205,r=.04850964319275053){return()=>{const o=((t|=0)+(e|=0)|0)+(r|=0)|0;return r=r+1|0,t=e^e>>>9,e=(n|=0)+(n<<3)|0,n=(n=n<<21|n>>>11)+o|0,(o>>>0)/4294967296}}function Ln(t){let e=0,n=0,r=0;e^=-1;for(let o=0,i=t.length;o<i;o++)r=255&(e^t.charCodeAt(o)),n=+("0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substring(9*r,9*r+8)),e=e>>>8^n;return(-1^e)>>>0}const je=new Map([["abs",function(e,n,r){return H(e,n,r,En)}],["acos",function(e,n,r){return H(e,n,r,gn)}],["asin",function(e,n,r){return H(e,n,r,hn)}],["atan",function(e,n,r){return H(e,n,r,Cn)}],["atan2",function(e,n,r){return Ie(e,n,r,yn)}],["calc",w],["clamp",function(e,n,r){const o=me([...e.value.filter((g=>!ee(g)))],n),i=[],a=[],u=[];{let g=i;for(let G=0;G<o.length;G++){const z=o[G];if(h(z)&&de(z.value)){if(g===u)return-1;if(g===a){g=u;continue}if(g===i){g=a;continue}return-1}g.push(z)}}const c=Ve(i),p=Ve(u);if(c&&p)return w(R(a),n,r);const l=N(w(R(a),n,r));if(l===-1)return-1;if(c){const g=N(w(R(u),n,r));return g===-1?-1:ct((v=l,y=g,new F([s.Function,"min(",-1,-1,{value:"min"}],[s.CloseParen,")",-1,-1,void 0],[v,new f([s.Comma,",",-1,-1,void 0]),y])),[l,g],r)}if(p){const g=N(w(R(i),n,r));return g===-1?-1:ut(jn(g,l),[g,l],r)}var v,y;const E=N(w(R(i),n,r));if(E===-1)return-1;const P=N(w(R(u),n,r));return P===-1?-1:Pn(e,E,l,P,r)}],["cos",function(e,n,r){return H(e,n,r,kn)}],["exp",function(e,n,r){return H(e,n,r,bn)}],["hypot",function(e,n,r){return xe(e,e.value,n,r,Sn)}],["log",function(e,n,r){return xe(e,e.value,n,r,Tn)}],["max",function(e,n,r){return xe(e,e.value,n,r,ut)}],["min",function(e,n,r){return xe(e,e.value,n,r,ct)}],["mod",function(e,n,r){return Ie(e,n,r,An)}],["pow",function(e,n,r){return Ie(e,n,r,Dn)}],["random",function(e,n,r){const o=Vn(e.value.filter((v=>!ee(v))),n,r);if(o===-1)return-1;const[i,a]=o,u=lt(a,n,r);if(u===-1)return-1;const[c,p,l]=u;return!c||!p?-1:Un(e,i,c,p,l,r)}],["rem",function(e,n,r){return Ie(e,n,r,Bn)}],["round",function(e,n,r){const o=me([...e.value.filter((v=>!ee(v)))],n);let i="",a=!1;const u=[],c=[];{let v=u;for(let y=0;y<o.length;y++){const E=o[y];if(!i&&u.length===0&&c.length===0&&h(E)&&ge(E.value)){const P=E.value[4].value.toLowerCase();if(zn.has(P)){i=P;continue}}if(h(E)&&de(E.value)){if(v===c)return-1;if(v===u&&i&&u.length===0)continue;if(v===u){a=!0,v=c;continue}return-1}v.push(E)}}const p=N(w(R(u),n,r));if(p===-1)return-1;a||c.length!==0||c.push(new f([s.Number,"1",-1,-1,{value:1,type:d.Integer}]));const l=N(w(R(c),n,r));return l===-1?-1:(i||(i="nearest"),Fn(e,i,p,l,r))}],["sign",function(e,n,r){return H(e,n,r,wn)}],["sin",function(e,n,r){return H(e,n,r,Nn)}],["sqrt",function(e,n,r){return H(e,n,r,In)}],["tan",function(e,n,r){return H(e,n,r,xn)}]]);function w(t,e,n){const r=me([...t.value.filter((i=>!ee(i)))],e);if(r.length===1&&h(r[0]))return{inputs:[r[0]],operation:we};let o=0;for(;o<r.length;){const i=r[o];if(Qt(i)&&et(i.startToken)){const a=w(i,e,n);if(a===-1)return-1;r.splice(o,1,a)}else if(ve(i)){const a=je.get(i.getName().toLowerCase());if(!a)return-1;const u=a(i,e,n);if(u===-1)return-1;r.splice(o,1,u)}else o++}if(o=0,r.length===1&&te(r[0]))return r[0];for(;o<r.length;){const i=r[o];if(!i||!h(i)&&!te(i)){o++;continue}const a=r[o+1];if(!a||!h(a)){o++;continue}const u=a.value;if(!_e(u)||u[4].value!=="*"&&u[4].value!=="/"){o++;continue}const c=r[o+2];if(!c||!h(c)&&!te(c))return-1;u[4].value!=="*"?u[4].value!=="/"?o++:r.splice(o,3,{inputs:[i,c],operation:fn}):r.splice(o,3,{inputs:[i,c],operation:vn})}if(o=0,r.length===1&&te(r[0]))return r[0];for(;o<r.length;){const i=r[o];if(!i||!h(i)&&!te(i)){o++;continue}const a=r[o+1];if(!a||!h(a)){o++;continue}const u=a.value;if(!_e(u)||u[4].value!=="+"&&u[4].value!=="-"){o++;continue}const c=r[o+2];if(!c||!h(c)&&!te(c))return-1;u[4].value!=="+"?u[4].value!=="-"?o++:r.splice(o,3,{inputs:[i,c],operation:On}):r.splice(o,3,{inputs:[i,c],operation:pn})}return r.length===1&&te(r[0])?r[0]:-1}function H(t,e,n,r){const o=$n(t.value,e,n);return o===-1?-1:r(t,o,n)}function $n(t,e,n){const r=N(w(R(me([...t.filter((o=>!ee(o)))],e)),e,n));return r===-1?-1:r}function Ie(t,e,n,r){const o=qn(t.value,e,n);if(o===-1)return-1;const[i,a]=o;return r(t,i,a,n)}function qn(t,e,n){const r=me([...t.filter((c=>!ee(c)))],e),o=[],i=[];{let c=o;for(let p=0;p<r.length;p++){const l=r[p];if(h(l)&&de(l.value)){if(c===i)return-1;if(c===o){c=i;continue}return-1}c.push(l)}}const a=N(w(R(o),e,n));if(a===-1)return-1;const u=N(w(R(i),e,n));return u===-1?-1:[a,u]}function xe(t,e,n,r,o){const i=lt(t.value,n,r);return i===-1?-1:o(t,i,r)}function lt(t,e,n){const r=me([...t.filter((i=>!ee(i)))],e),o=[];{const i=[];let a=[];for(let u=0;u<r.length;u++){const c=r[u];h(c)&&de(c.value)?(i.push(a),a=[]):a.push(c)}i.push(a);for(let u=0;u<i.length;u++){if(i[u].length===0)return-1;const c=N(w(R(i[u]),e,n));if(c===-1)return-1;o.push(c)}}return o}const zn=new Set(["nearest","up","down","to-zero"]);function Vn(t,e,n){const r={isAuto:!1,dashedIdent:"",fixed:-1,elementShared:!1},o=t[0];if(!h(o)||!ge(o.value))return[r,t];for(let i=0;i<t.length;i++){const a=t[i];if(!h(a))return-1;if(de(a.value))return[r,t.slice(i+1)];if(!ge(a.value))return-1;const u=a.value[4].value.toLowerCase();if(u!=="element-shared")if(u!=="fixed")if(u!=="auto"){if(u.startsWith("--")){if(r.fixed!==-1||r.isAuto)return-1;r.dashedIdent=u}}else{if(r.fixed!==-1||r.dashedIdent)return-1;r.isAuto=!0}else{if(r.elementShared||r.dashedIdent||r.isAuto)return-1;i++;const c=t[i];if(!c)return-1;const p=N(w(R([c]),e,n));if(p===-1||!m(p.value)||p.value[4].value<0||p.value[4].value>1)return-1;r.fixed=Math.max(0,Math.min(p.value[4].value,1-1e-9))}else{if(r.fixed!==-1)return-1;r.elementShared=!0}}return-1}function R(t){return new F([s.Function,"calc(",-1,-1,{value:"calc"}],[s.CloseParen,")",-1,-1,void 0],t)}function jn(t,e){return new F([s.Function,"max(",-1,-1,{value:"max"}],[s.CloseParen,")",-1,-1,void 0],[t,new f([s.Comma,",",-1,-1,void 0]),e])}function Hn(t){if(t===-1)return-1;if(ve(t))return t;const e=t.value;return A(e)&&Number.isNaN(e[4].value)?m(e)?new F([s.Function,"calc(",e[2],e[3],{value:"calc"}],[s.CloseParen,")",e[2],e[3],void 0],[new f([s.Ident,"NaN",e[2],e[3],{value:"NaN"}])]):k(e)?new F([s.Function,"calc(",e[2],e[3],{value:"calc"}],[s.CloseParen,")",e[2],e[3],void 0],[new f([s.Ident,"NaN",e[2],e[3],{value:"NaN"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Delim,"*",e[2],e[3],{value:"*"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Dimension,"1"+e[4].unit,e[2],e[3],{value:1,type:d.Integer,unit:e[4].unit}])]):b(e)?new F([s.Function,"calc(",e[2],e[3],{value:"calc"}],[s.CloseParen,")",e[2],e[3],void 0],[new f([s.Ident,"NaN",e[2],e[3],{value:"NaN"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Delim,"*",e[2],e[3],{value:"*"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Percentage,"1%",e[2],e[3],{value:1}])]):-1:t}function Gn(t){if(t===-1)return-1;if(ve(t))return t;const e=t.value;if(!A(e)||Number.isFinite(e[4].value)||Number.isNaN(e[4].value))return t;let n="";return Number.NEGATIVE_INFINITY===e[4].value&&(n="-"),m(e)?new F([s.Function,"calc(",e[2],e[3],{value:"calc"}],[s.CloseParen,")",e[2],e[3],void 0],[new f([s.Ident,n+"infinity",e[2],e[3],{value:n+"infinity"}])]):k(e)?new F([s.Function,"calc(",e[2],e[3],{value:"calc"}],[s.CloseParen,")",e[2],e[3],void 0],[new f([s.Ident,n+"infinity",e[2],e[3],{value:n+"infinity"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Delim,"*",e[2],e[3],{value:"*"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Dimension,"1"+e[4].unit,e[2],e[3],{value:1,type:d.Integer,unit:e[4].unit}])]):new F([s.Function,"calc(",e[2],e[3],{value:"calc"}],[s.CloseParen,")",e[2],e[3],void 0],[new f([s.Ident,n+"infinity",e[2],e[3],{value:n+"infinity"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Delim,"*",e[2],e[3],{value:"*"}]),new O([[s.Whitespace," ",e[2],e[3],void 0]]),new f([s.Percentage,"1%",e[2],e[3],{value:1}])])}function Jn(t){if(t===-1)return-1;if(ve(t))return t;const e=t.value;return A(e)&&Object.is(-0,e[4].value)&&(e[1]==="-0"||(b(e)?e[1]="-0%":k(e)?e[1]="-0"+e[4].unit:e[1]="-0")),t}function Yn(t,e=13){if(t===-1)return-1;if(e<=0||ve(t))return t;const n=t.value;if(!A(n)||Number.isInteger(n[4].value))return t;const r=Number(n[4].value.toFixed(e)).toString();return m(n)?n[1]=r:b(n)?n[1]=r+"%":k(n)&&(n[1]=r+n[4].unit),t}function Zn(t,e){let n=t;return n=Yn(n,e==null?void 0:e.precision),n=Jn(n),n=Hn(n),n=Gn(n),n}function Kn(t){return new Map}function Qn(t,e){return Xn(Jt(Ot({css:t}),{}),e).map((n=>n.map((r=>Y(...r.tokens()))).join(""))).join(",")}function Xn(t,e){const n=Kn();return Kt(t,(r=>{if(!ve(r))return;const o=je.get(r.getName().toLowerCase());if(!o)return;const i=Zn(N(o(r,n,{})),e);return i!==-1?i:void 0}))}new Set(je.keys());const q=t=>{const e=`${t}`,n=parseFloat(e);let r="unsupported";const o=e.match(/px|rem|em/);return o&&(r=o[0]),n===0&&r==="unsupported"&&(r="zero"),{number:n,unit:r}},dt=t=>{const e={};if(typeof t=="string")e.fontSize=q(t);else if(Array.isArray(t)){if(e.fontSize=q(t[0]),typeof t[1]=="string")e.lineHeight=q(t[1]);else if(typeof t[1]=="object"){if("lineHeight"in t[1]){let n=t[1].lineHeight;typeof n=="string"&&n.includes("calc")&&(n=Qn(n));const r=q(n);r.unit==="unsupported"?e.lineHeight={number:n*e.fontSize.number,unit:e.fontSize.unit}:e.lineHeight=r}"letterSpacing"in t[1]&&(e.letterSpacing=q(t[1].letterSpacing))}}return e},Ee=(t,e,n,r=null)=>t.number===e.number?(re.error(`Same value for start an end${r?` (${r})`:""}: "clamp-[${n}]".`),null):t.unit!==e.unit&&t.unit!=="zero"&&e.unit!=="zero"?(re.error(`Units need to match${r?` (${r})`:""}: "clamp-[${n}]" ${t.unit} !== ${e.unit}.`),null):t.unit==="unsupported"||e.unit==="unsupported"?(re.error(`Only px, rem and em units are supported${r?` (${r})`:""}: "clamp-[${n}]".`),null):!0,He=(t,e,n={number:23.4375,unit:"rem"},r={number:90,unit:"rem"},o=!1)=>{const i=t.unit==="zero"?e.unit:t.unit,a=i==="px";let u=t.number,c=e.number,p=!1,l=n.number,v=r.number;n.unit!=="px"&&a&&(l=n.number*16),n.unit==="px"&&!a&&(l=n.number/16),r.unit!=="px"&&a&&(v=r.number*16),r.unit==="px"&&!a&&(v=r.number/16),c<u&&u<0&&c<0?(u=Math.abs(u),c=Math.abs(c),p=!0):c<u&&u>0&&c>0?(u=u*-1,c=c*-1,p=!0):c<u&&(u=Math.abs(u)*-1,c=Math.abs(c),p=!0);const y=(c-u)/(v-l),E=`${(u-l*y).toFixed(6)}${i} + ${(100*y).toFixed(6)}${o?"cqw":"vw"}`,P=`clamp(${u}${i}, ${E}, ${c}${i})`;return p?`calc(${P} * -1)`:P},_n={minSize:"23.4375rem",maxSize:"90rem"};function Oe(t,e,n,r){if(!t)return{...q(e),isContainer:!1};const o=t.startsWith("@"),i=o?t.slice(1):t,a=o?r[i]||i:n[i]||i;return{...q(a),isContainer:o}}const er=t=>/^-?\d*\.?\d+(px|rem|em)$/.test(t.trim())||t.trim()==="0";return x.withOptions(function(t={}){const e={..._n,...t};return function({matchUtilities:n,addBase:r,theme:o,config:i}){const a=o("clamp")||{},u={},c={};for(const[p,l]of Object.entries(a)){if(typeof l!="string")continue;const v=l.split(",")[0];er(v)?c[p]=l:u[p]=l}if(Object.keys(c).length>0){const p=o("screens"),l=o("containers"),v={};for(const[y,E]of Object.entries(c)){const P=E.split(",").map(Te=>Te.trim());if(P.length<2){re.error(`Theme clamp variable "--clamp-${y}" requires at least 2 values (start, end).`);continue}const g=q(P[0]),G=q(P[1]),z=Oe(P[2],e.minSize,p,l),U=Oe(P[3],e.maxSize,p,l);if(!Ee(z,U,`--clamp-${y}`)||!Ee(g,G,`--clamp-${y}`))continue;const Ge=z.isContainer;v[`--clamp-${y}`]=He(g,G,z,U,Ge)}Object.keys(v).length>0&&r({":root":v})}n({clamp:p=>{var pt,ft;const l=p.split(",");if(l.length<3)return re.error(`The clamp utility requires at least 3 arguments: "clamp-[${p}]".`),{};const v=o("screens"),y=o("containers"),E=Oe(l[3],e.minSize,v,y),P=Oe(l[4],e.maxSize,v,y);if(!Ee(E,P,p))return{};const g=E.isContainer,z=l[0].startsWith("--")?{type:"regular",key:null,props:[l[0]]}:ne(l[0]);if(!z)return re.error(`Property "${l[0]}" is not supported: "clamp-[${p}]".`),{};const{key:U,props:Ge,type:Te}=z;if(Te==="fontSize"){const D=dt(i().theme[U][l[1]]||l[1]),V=dt(i().theme[U][l[2]]||l[2]),Pe={};return Object.keys(D).forEach(B=>{if(B in V){if((B==="letterSpacing"||B==="lineHeight")&&D[B].number===V[B].number&&D[B].unit===V[B].unit)Pe[B]=`${D[B].number}${D[B].unit}`;else if(Ee(D[B],V[B],p,B)){const nr=He(D[B],V[B],E,P,g);Pe[B]=nr}}}),Pe}let Je=q(U&&((pt=i().theme[U])==null?void 0:pt[l[1]])||l[1]),Ye=q(U&&((ft=i().theme[U])==null?void 0:ft[l[2]])||l[2]);if(Te==="spacing"){const D=q(typeof o("spacing")=="string"?o("spacing"):o("spacing.1")),V=/^-?\d*\.?\d+$/.test(l[1]),Pe=/^-?\d*\.?\d+$/.test(l[2]);V&&(Je={number:D.number*parseFloat(l[1]),unit:D.unit}),Pe&&(Ye={number:D.number*parseFloat(l[2]),unit:D.unit})}if(!Ee(Je,Ye,p))return{};const tr=He(Je,Ye,E,P,g);return Ge.reduce((D,V)=>(typeof V=="string"?D[V]=tr:D={...D,...V},D),{})}},{values:u},{supportsNegativeValues:!1,modifiers:{pattern:/[\w-]+(?:,[\w-]+){2}/}})}})}));
|
|
2
2
|
//# sourceMappingURL=index.umd.cjs.map
|