@fwkui/x-css 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -354,7 +354,7 @@ Lưu ý khi dùng cùng `prefix`:
354
354
  1. Engine kiểm tra `excludes`/`excludePrefixes` trước, sau đó mới kiểm tra `prefix`.
355
355
  2. Nếu token match exclude thì giữ nguyên class gốc và không parse tiếp.
356
356
  3. Nếu có `prefix: 'fk-'`, token không bắt đầu bằng `fk-` sẽ giữ nguyên class gốc.
357
- 4. `exclude` vẫn được hỗ trợ để tương thích ngược, nhưng key khuyến nghị là `excludes`.
357
+
358
358
 
359
359
  `dictionaryImport`:
360
360
  1. `true` (mặc định): tự động tải dictionary built-in từ module `dist/dictionary.*` (giúp file core nhẹ hơn).
@@ -373,8 +373,7 @@ Lưu ý:
373
373
 
374
374
  Khi `compression: true`:
375
375
  1. Ưu tiên `CompressionStream` (deflate-raw + base64) nếu runtime hỗ trợ.
376
- 2. Tự động fallback về LZW để tương thích ngược.
377
- 3. Đọc cache vẫn hỗ trợ key cũ `xcss_cache_v1` để migrate dần.
376
+ 2. Tự động fallback về LZW nếu runtime không hỗ trợ stream.
378
377
 
379
378
  Quy tắc cache key:
380
379
  `cacheKey = styleId + "_cache_" + version`
@@ -488,7 +487,7 @@ Thay 2 biến ngay đầu script nếu cần:
488
487
 
489
488
  ```html
490
489
  <script>
491
- (async()=>{const sid='fwkui',ver='v1',k=sid+'_cache_'+ver,l='xcss_cache_v1';const L=s=>{if(!s)return'';const d={};let z=256;for(let i=0;i<256;i++)d[i]=String.fromCharCode(i);const c=[...s].map(ch=>ch.charCodeAt(0));let p=c[0],ph=d[p]||'',r=ph;for(let i=1;i<c.length;i++){const x=c[i];let e=d[x];if(!e)e=x===z?ph+ph[0]:'';r+=e;d[z++]=ph+e[0];ph=e;}return r};const S=()=>typeof DecompressionStream!=='undefined'&&typeof Blob!=='undefined'&&typeof Response!=='undefined';const B=b=>{if(typeof atob==='function'){const s=atob(b),u=new Uint8Array(s.length);for(let i=0;i<s.length;i++)u[i]=s.charCodeAt(i);return u;}if(typeof Buffer!=='undefined')return new Uint8Array(Buffer.from(b,'base64'));throw new Error('base64');};const D=async p=>{if(!S())return null;try{return await new Response(new Blob([B(p)]).stream().pipeThrough(new DecompressionStream('deflate-raw'))).text();}catch{return null;}};const P=async raw=>{if(!raw)return null;try{let j=JSON.parse(raw);if(j&&j.__xcss_cache_v===3&&j.compressed===true&&j.algorithm==='deflate-raw'&&j.encoding==='base64'&&typeof j.payload==='string'){const ex=await D(j.payload);if(!ex)return null;j=JSON.parse(ex);}else if(j&&j.__xcss_cache_v===2&&j.compressed===true&&typeof j.payload==='string'){const ex=L(j.payload);if(!ex)return null;j=JSON.parse(ex);}return j&&j.cssText?j:null;}catch{return null;}};try{if(typeof window==='undefined'||!window.localStorage)return;let p=null;for(const kk of (k===l?[k]:[k,l])){p=await P(localStorage.getItem(kk));if(p)break;}if(!p)return;let st=document.getElementById(sid);if(!st){st=document.createElement('style');st.id=sid;document.head.appendChild(st);}let css=p.cssText.root?p.cssText.root+'\\n':'';for(const n in p.cssText)if(n!=='root')css+=(p.cssText[n]||'')+'\\n';st.textContent=css;}catch{}})();
490
+ (async()=>{const sid='fwkui',ver='v1',k=sid+'_cache_'+ver;const L=s=>{if(!s)return'';const d={};let z=256;for(let i=0;i<256;i++)d[i]=String.fromCharCode(i);const c=[...s].map(ch=>ch.charCodeAt(0));let p=c[0],ph=d[p]||'',r=ph;for(let i=1;i<c.length;i++){const x=c[i];let e=d[x];if(!e)e=x===z?ph+ph[0]:'';r+=e;d[z++]=ph+e[0];ph=e;}return r};const S=()=>typeof DecompressionStream!=='undefined'&&typeof Blob!=='undefined'&&typeof Response!=='undefined';const B=b=>{if(typeof atob==='function'){const s=atob(b),u=new Uint8Array(s.length);for(let i=0;i<s.length;i++)u[i]=s.charCodeAt(i);return u;}if(typeof Buffer!=='undefined')return new Uint8Array(Buffer.from(b,'base64'));throw new Error('base64');};const D=async p=>{if(!S())return null;try{return await new Response(new Blob([B(p)]).stream().pipeThrough(new DecompressionStream('deflate-raw'))).text();}catch{return null;}};const P=async raw=>{if(!raw)return null;try{let j=JSON.parse(raw);if(j&&j.__xcss_cache_v===3&&j.compressed===true&&j.algorithm==='deflate-raw'&&j.encoding==='base64'&&typeof j.payload==='string'){const ex=await D(j.payload);if(!ex)return null;j=JSON.parse(ex);}else if(j&&j.__xcss_cache_v===2&&j.compressed===true&&typeof j.payload==='string'){const ex=L(j.payload);if(!ex)return null;j=JSON.parse(ex);}return j&&j.cssText?j:null;}catch{return null;}};try{if(typeof window==='undefined'||!window.localStorage)return;let p=await P(localStorage.getItem(k));if(!p)return;let st=document.getElementById(sid);if(!st){st=document.createElement('style');st.id=sid;document.head.appendChild(st);}let css=p.cssText.root?p.cssText.root+'\\n':'';for(const n in p.cssText)if(n!=='root')css+=(p.cssText[n]||'')+'\\n';st.textContent=css;}catch{}})();
492
491
  </script>
493
492
  ```
494
493
 
@@ -515,10 +514,9 @@ const html = `
515
514
 
516
515
  Lưu ý:
517
516
  1. Đồng bộ `styleId` + `version` giữa bootloader và cấu hình `xcss.css(...)`.
518
- 2. Script tạo từ `getBootloaderScript` ưu tiên `DecompressionStream` (cache deflate-raw) và fallback LZW/legacy.
517
+ 2. Script tạo từ `getBootloaderScript` ưu tiên `DecompressionStream` (cache deflate-raw) và fallback LZW.
519
518
  3. Sau bootloader vẫn cần gọi `xcss.cssObserve(...)` như bình thường.
520
- 4. Tương thích ngược: tham số thứ 2 vẫn chấp nhận `cacheKey` nếu bạn đang dùng API trước đó.
521
- 5. Dùng `{ compact: true }` khi muốn script trả về ở dạng nén gọn để nhúng HTML.
519
+ 4. Dùng `{ compact: true }` khi muốn script trả về dạng nén gọn để nhúng HTML.
522
520
  6. Nếu dữ liệu cache dưới key hiện tại bị lỗi/không decode được, engine sẽ tự xóa key đó để lần chạy sau lưu lại dữ liệu mới.
523
521
 
524
522
  ### Khi nào nên dùng `getBootloaderScript`
@@ -614,4 +612,4 @@ Yêu cầu:
614
612
 
615
613
  Licensed under MIT. See [LICENSE](./LICENSE).
616
614
 
617
- Updated: 2026-03-02
615
+ Updated: 2026-03-18
@@ -1,14 +1,14 @@
1
- "use strict";var we=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var lt=(e,t)=>{for(var n in t)we(e,n,{get:t[n],enumerable:!0})},ct=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of it(t))!at.call(e,o)&&o!==n&&we(e,o,{get:()=>t[o],enumerable:!(s=ot(t,o))||s.enumerable});return e};var dt=e=>ct(we({},"__esModule",{value:!0}),e);var Kt={};lt(Kt,{clsx:()=>$t,createSharedClsx:()=>Pt,createSharedInstance:()=>Xt,default:()=>Ht,getBootloaderScript:()=>ze,getCss:()=>jt,observe:()=>Lt,ready:()=>Bt,setClsxRoot:()=>Mt});module.exports=dt(Kt);var Me=e=>(e=e||new Map,{all:e,on(t,n){let s=e.get(t);s?s.push(n):e.set(t,[n])},off(t,n){let s=e.get(t);s&&(n?s.splice(s.indexOf(n)>>>0,1):e.set(t,[]))},emit(t,n){let s=e.get(t);s&&s.slice().forEach(d=>{d(n)});let o=e.get("*");o&&o.slice().forEach(d=>{d(t,n)})}});function ft(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){s>0&&s--;continue}if(d===58&&s===0)return o}return-1}function ut(e,t,n){let s=0;for(let o=n-1;o>=t;o--){let d=e.charCodeAt(o);if(d===93){s++;continue}if(d===91){s>0&&s--;continue}if(d===64&&s===0)return o}return-1}function pt(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){if(s===0)return!1;s--}}return s===0}function yt(e){return e>=97&&e<=122}function ae(e){if(!e||e.length<2||!pt(e,0,e.length))return null;let t=0,n=e.length,s="",o=ut(e,t,n);o>t&&(s=e.substring(o+1,n),n=o);let d="",h="",u=ft(e,t,n);if(u>0&&u<n){let O=e.substring(t,u);t=u+1,d=O}let _=t;for(;_<n;){let O=e.charCodeAt(_);if(O>=48&&O<=57)_++;else break}if(_>t&&(h=e.substring(t,_),t=_),t>=n||e.charCodeAt(t)===38)return null;if(e.charCodeAt(t)===91){let O=e.indexOf("]",t);if(O>t)return{mq:d,layer:h,prop:e.substring(t,O+1),val:"",selector:s}}let R=t;for(;R<n;){let O=e.charCodeAt(R);if(O===45||O===46){if(R+1<n){let w=e.charCodeAt(R+1);if(O===45&&w===45&&R>t||w>=48&&w<=57)break}R++;continue}if(!yt(O))break;R++}if(R===t)return null;let U=e.substring(t,R),L=e.substring(R,n);return{mq:d,layer:h,prop:U,val:L,selector:s}}var He=e=>{let t=typeof e?.styleId=="string"&&e.styleId.trim()?e.styleId.trim():"fwkui",n=typeof e?.version=="string"&&e.version.trim()?e.version.trim():"v1",s=e?.compression??!0,o=typeof e?.debounceMs=="number"&&e.debounceMs>=0?e.debounceMs:1e3;return{styleId:t,version:n,compression:s,debounceMs:o}},St=e=>`${e.styleId}_cache_${e.version}`,Ke=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===2&&t.compressed===!0&&typeof t.payload=="string"},xe=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===3&&t.compressed===!0&&t.algorithm==="deflate-raw"&&t.encoding==="base64"&&typeof t.payload=="string"},We=()=>typeof CompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",Ue=()=>typeof DecompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",gt=e=>{if(typeof btoa=="function"){let n="";for(let o=0;o<e.length;o+=32768){let d=e.subarray(o,o+32768);for(let h=0;h<d.length;h++)n+=String.fromCharCode(d[h])}return btoa(n)}let t=globalThis.Buffer;if(typeof t<"u")return t.from(e).toString("base64");throw new Error("XCSS: base64 encoding is not supported in this runtime")},ht=e=>{if(typeof atob=="function"){let n=atob(e),s=new Uint8Array(n.length);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return s}let t=globalThis.Buffer;if(typeof t<"u")return new Uint8Array(t.from(e,"base64"));throw new Error("XCSS: base64 decoding is not supported in this runtime")},mt=async e=>{if(!We())throw new Error("XCSS: CompressionStream is not supported");let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate-raw")),n=await new Response(t).arrayBuffer();return gt(new Uint8Array(n))},Ct=async e=>{if(!Ue())throw new Error("XCSS: DecompressionStream is not supported");let t=ht(e),n=new Uint8Array(t.length);n.set(t);let s=new Blob([n.buffer]).stream().pipeThrough(new DecompressionStream("deflate-raw"));return await new Response(s).text()},bt=e=>{try{let t=JSON.parse(e);return xe(t)}catch{return!1}},wt=e=>{if(!e)return"";let t=new Map,n=[],s=256;for(let d=0;d<256;d++)t.set(String.fromCharCode(d),d);let o=e[0];for(let d=1;d<e.length;d++){let h=e[d],u=o+h;t.has(u)?o=u:(n.push(t.get(o)),t.set(u,s++),o=h)}return n.push(t.get(o)),n.map(d=>String.fromCharCode(d)).join("")},Ve=e=>{if(!e)return"";let t=new Map,n=256,s="";for(let u=0;u<256;u++)t.set(u,String.fromCharCode(u));let o=e.split("").map(u=>u.charCodeAt(0)),d=o[0],h=t.get(d)||"";s=h;for(let u=1;u<o.length;u++){let _=o[u],R=t.get(_);R||(R=_===n?h+h[0]:""),s+=R,t.set(n++,h+R[0]),h=R}return s},ve=e=>{if(!e||typeof e!="object")return null;let t=e,n=t.default&&typeof t.default=="object"?t.default:t,s=n.SHORT_PROPERTIES,o=n.COMMON_VALUES,d=n.SPECIFIC_VALUES;return!s||!o||!d||typeof s!="object"||typeof o!="object"||typeof d!="object"?null:{SHORT_PROPERTIES:s,COMMON_VALUES:o,SPECIFIC_VALUES:d}},xt=async e=>{let t=await import(e),n=ve(t);if(!n)throw new Error(Ne);return n},Ne="XCSS: dictionary module must export SHORT_PROPERTIES, COMMON_VALUES and SPECIFIC_VALUES",qe=()=>{let e=typeof require=="function"?require:null;if(!e)return null;for(let t of["./dictionary.js","./dictionary"])try{let n=e(t),s=ve(n);if(s)return s}catch{}return null},vt=async()=>{let e=qe();if(e)return e;let t=["./dictionary.mjs","./dictionary.js","./dictionary"],n=null;for(let s of t)try{let o=await import(s),d=ve(o);if(d)return d}catch(o){n=o}throw n||new Error(Ne)},Et=(e,t)=>{if(!e||typeof document>"u")return;t=t||"fwkui";let n=Array.from({length:24},(s,o)=>"l"+o);if(!e.querySelector('style[id="'+t+'"]')){let s=document.createElement("style");if(s.id=t,!(e instanceof ShadowRoot))document.head.append(s);else try{e.prepend(s)}catch{e.appendChild(s)}let o=`@layer ${n.join(", ")};`,d=setInterval(()=>{if(s.sheet){clearInterval(d);try{s.sheet.insertRule(o,s.sheet.cssRules.length)}catch{}}},10)}},Rt=e=>{let t=Array.isArray(e.excludes)?e.excludes:[],n=He(e.cache),s=JSON.stringify({base:e.base||"",aliases:e.aliases||{},breakpoints:e.breakpoints||[],theme:e.theme||{},prefix:e.prefix||"",excludes:t,excludePrefixes:e.excludePrefixes||[],dictionaryImport:e.dictionaryImport??!0,cache:n}),o=0;if(s.length===0)return o.toString();for(let d=0;d<s.length;d++){let h=s.charCodeAt(d);o=(o<<5)-o+h,o|=0}return o.toString()},je=e=>{if(!e)return null;try{let t=JSON.parse(e);if(Ke(t)){let n=Ve(t.payload);return n?JSON.parse(n):null}return xe(t)?null:t}catch{return null}},Tt=async e=>{if(!e)return null;try{let t=JSON.parse(e);if(Ke(t)){let n=Ve(t.payload);return n?JSON.parse(n):null}if(xe(t)){let n=await Ct(t.payload);return n?JSON.parse(n):null}return t}catch{return null}},Be=(e,t)=>{if(e==="root")return t;let n=/@media[^{]+\{\n?([\s\S]+)\n?\}/.exec(t);return n&&n[1]?n[1].trim():t},Ee=(e={base:"",aliases:{},excludes:[],excludePrefixes:[],breakpoints:[],theme:{},prefix:"",dictionaryImport:!0,cache:{styleId:"fwkui",version:"v1",compression:!0,debounceMs:1e3}})=>{let{base:t=null,breakpoints:n=[],aliases:s={},theme:o={},excludes:d=[],excludePrefixes:h=[],prefix:u="",dictionaryImport:_=!0,cache:R={}}=e||{};Array.isArray(n)||(n=[]),Array.isArray(d)||(d=[]),Array.isArray(h)||(h=[]),(!s||typeof s!="object")&&(s={}),(!o||typeof o!="object")&&(o={});let U=He(R),L=St(U),O=d,w=h.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0),X=r=>{let i=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&");return new RegExp("^"+i.replace(/\*/g,".*")+"$")},G=O.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0).map(r=>{if(r.includes("*")){let i=X(r);return c=>i.test(c)}return i=>i===r}),le=r=>w.some(i=>r.startsWith(i))?!0:G.some(i=>i(r)),ce=r=>!(le(r)||u&&!r.startsWith(u)),Fe=["default","xs","sm","md","lg","xl","2xl","sma","mda","lga","xla"],Ze=n.filter(r=>!!r&&typeof r=="object"&&!Array.isArray(r)).map(r=>Object.keys(r)[0]).filter(r=>typeof r=="string"&&r.length>0),Je=new Set([...Fe,...Ze]),de=r=>!r||Je.has(r),Ge=_!==!1,Ye=new Set(["mx","my","px","py","bdx","bdy"]),fe=new Set,ue=r=>r?!Ge||!V||Object.keys(V).length===0?!0:!!V[r]||Ye.has(r)||fe.has(r):!1,V={},te={},pe={},ye={},_e=()=>{ye={...pe,...o}},q=r=>{if(!r){V={},te={},pe={},fe=new Set,_e();return}V=r.SHORT_PROPERTIES,te=r.SPECIFIC_VALUES,pe=r.COMMON_VALUES,fe=new Set(Object.values(V)),_e()},z=!0,re=Promise.resolve();if(_===!1)q(null);else if(typeof _=="string")z=!1,q(null),re=xt(_).then(r=>{q(r)}).catch(r=>{console.warn("XCSS: Failed to import dictionary from URL",r)}).finally(()=>{z=!0});else{let r=qe();r?q(r):(z=!1,q(null),re=vt().then(i=>{q(i)}).catch(i=>{console.warn("XCSS: Failed to load built-in dictionary module",i)}).finally(()=>{z=!0}))}let Y=null,Qe=(r=typeof document<"u"?document:void 0)=>{let i=typeof window<"u"&&typeof document<"u",c=null,S=Array.isArray(t)?t.length>0:!!t;r&&(c="getRootNode"in r?r.getRootNode():r);let y=new Map,x=1e3;i&&c&&Et(c,U.styleId);let D=Me(),p=[{default:""},{xs:"screen and (max-width: 575px)"},{sm:"screen and (min-width: 576px)"},{md:"screen and (min-width: 768px)"},{lg:"screen and (min-width: 992px)"},{xl:"screen and (min-width: 1200px)"},{"2xl":"screen and (min-width: 1400px)"},{sma:"screen and (max-width: 768px)"},{mda:"screen and (max-width: 992px)"},{lga:"screen and (max-width: 1200px)"},{xla:"screen and (max-width: 1400px)"},...n],C=p.filter((a,l)=>p.findLastIndex(f=>Object.keys(f)[0]==Object.keys(a)[0])==l),g=C.map(a=>Object.keys(a)[0]),T={},b={},E={root:""},B={root:[]},ne={root:!1},F=Rt(e),I=null,H=0,M=!1,N=null,j=null,K=a=>{try{window.localStorage.setItem(L,a)}catch(l){console.warn("XCSS: Failed to save cache",l)}},se=a=>{!i||!window.localStorage||typeof a=="string"&&window.localStorage.getItem(L)!==a||window.localStorage.removeItem(L)},Z=a=>{if(!i||!window.localStorage)return;Y=a;let l=++H;try{let f=JSON.stringify(a),v=()=>{let m={__xcss_cache_v:2,compressed:!0,payload:wt(f)};K(JSON.stringify(m))};if(!U.compression){K(f);return}if(We()&&Ue()){mt(f).then(m=>{if(l!==H)return;K(JSON.stringify({__xcss_cache_v:3,compressed:!0,algorithm:"deflate-raw",encoding:"base64",payload:m}))}).catch(()=>{l===H&&v()});return}v()}catch(f){console.warn("XCSS: Failed to save cache",f)}},oe=()=>{i&&(I&&clearTimeout(I),I=setTimeout(()=>{let a={};for(let v in T)a[v]=Array.from(T[v]);let l={};Object.keys(E).forEach(v=>{if(v==="root")l[v]=E[v];else{let m=p.find($=>Object.keys($)[0]===v)?.[v];m&&E[v]?l[v]=`@media ${m} {
2
- ${E[v]}
3
- }`:l[v]=E[v]||""}});let f={configHash:F,cssText:l,rulesSet:a,keys:Array.from(y.entries()),sizeLast:x};Z(f)},U.debounceMs))};if(i&&window.localStorage)try{let a=window.localStorage.getItem(L);if(a){let l=je(a);if(!l)bt(a)?j={raw:a}:window.localStorage.removeItem(L);else if(l.configHash!==F)window.localStorage.removeItem(L);else{if(N=l,M=!0,l.keys&&l.keys.forEach(([f,v])=>y.set(f,v)),typeof l.sizeLast=="number"&&(x=l.sizeLast),l.cssText)for(let f in l.cssText)E[f]=Be(f,l.cssText[f]);Y=l}}}catch(a){console.error(a)}i&&(b.root=new CSSStyleSheet),g.forEach(a=>{if(T[a]=new Set,i){let l=C.find(f=>Object.keys(f)[0]==a)?.[a]||"";b[a]=new CSSStyleSheet({media:l})}M||(E[a]=""),B[a]=[],ne[a]=!1});let A=()=>{if(!c)return;let a=c.querySelector(`style[id="${U.styleId}"]`);a&&a.remove()},ie=a=>{if(a.keys&&a.keys.forEach(([l,f])=>y.set(l,f)),typeof a.sizeLast=="number"&&(x=a.sizeLast),a.cssText)for(let l in a.cssText){if(l==="root"&&S)continue;let f=Be(l,a.cssText[l]);E[l]=f,i&&b[l]&&b[l].replaceSync(f)}if(a.rulesSet)for(let l in a.rulesSet)T[l]||(T[l]=new Set),a.rulesSet[l].forEach(f=>T[l].add(f));Y=a,A()};M&&N&&ie(N),t&&Array.isArray(t)?(E.root=t.join(`
4
- `),i&&b.root&&b.root.replaceSync(E.root)):(E.root=t||"",i&&b.root&&b.root.replaceSync(E.root)),i&&c&&["root",...g].forEach(a=>{b[a]&&c?.adoptedStyleSheets&&(c.adoptedStyleSheets.includes(b[a])||(c.adoptedStyleSheets=[...c.adoptedStyleSheets,b[a]]))}),i&&window.localStorage&&j&&!M&&(async()=>{let a=await Tt(j.raw);if(!a){se(j.raw);return}if(a.configHash!==F){se(j.raw);return}M=!0,N=a,ie(a)})();let he=(a,l)=>{let{media:f,property:v,selector:m,layer:$,className:k}=l,P=E,W=B,Ce=ne;$=Number($)||0;let Pe=y.get(a),st=Pe?`.${Pe}${m}`:`.${k}${m}`;var be=`@layer l${$}{${st}{${v}}}`;T[f]||(T[f]=new Set);let $e=T[f];if(!$e.has(be))if($e.add(be),W[f]||(W[f]=[]),W[f].push(be),i)Ce[f]||(Ce[f]=!0,queueMicrotask(()=>{let ee=W[f],Le=b[f];ee.length>0&&(P[f]+=(P[f]?`
1
+ "use strict";var we=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var ct=(e,t)=>{for(var n in t)we(e,n,{get:t[n],enumerable:!0})},dt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of at(t))!lt.call(e,o)&&o!==n&&we(e,o,{get:()=>t[o],enumerable:!(s=it(t,o))||s.enumerable});return e};var ft=e=>dt(we({},"__esModule",{value:!0}),e);var Wt={};ct(Wt,{clsx:()=>$t,createSharedClsx:()=>Pt,createSharedInstance:()=>Lt,default:()=>Kt,getBootloaderScript:()=>Fe,getCss:()=>Bt,observe:()=>Mt,ready:()=>Ht,setClsxRoot:()=>jt});module.exports=ft(Wt);var Be=e=>(e=e||new Map,{all:e,on(t,n){let s=e.get(t);s?s.push(n):e.set(t,[n])},off(t,n){let s=e.get(t);s&&(n?s.splice(s.indexOf(n)>>>0,1):e.set(t,[]))},emit(t,n){let s=e.get(t);s&&s.slice().forEach(d=>{d(n)});let o=e.get("*");o&&o.slice().forEach(d=>{d(t,n)})}});function ut(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){s>0&&s--;continue}if(d===58&&s===0)return o}return-1}function pt(e,t,n){let s=0;for(let o=n-1;o>=t;o--){let d=e.charCodeAt(o);if(d===93){s++;continue}if(d===91){s>0&&s--;continue}if(d===64&&s===0)return o}return-1}function yt(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){if(s===0)return!1;s--}}return s===0}function St(e){return e>=97&&e<=122}function ie(e){if(!e||e.length<2||!yt(e,0,e.length))return null;let t=0,n=e.length,s="",o=pt(e,t,n);o>t&&(s=e.substring(o+1,n),n=o);let d="",m="",u=ut(e,t,n);if(u>0&&u<n){let O=e.substring(t,u);t=u+1,d=O}let k=t;for(;k<n;){let O=e.charCodeAt(k);if(O>=48&&O<=57)k++;else break}if(k>t&&(m=e.substring(t,k),t=k),t>=n||e.charCodeAt(t)===38)return null;if(e.charCodeAt(t)===91){let O=e.indexOf("]",t);if(O>t)return{mq:d,layer:m,prop:e.substring(t,O+1),val:"",selector:s}}let D=t;for(;D<n;){let O=e.charCodeAt(D);if(O===45||O===46){if(D+1<n){let b=e.charCodeAt(D+1);if(O===45&&b===45&&D>t||b>=48&&b<=57)break}D++;continue}if(!St(O))break;D++}if(D===t)return null;let K=e.substring(t,D),P=e.substring(D,n);return{mq:d,layer:m,prop:K,val:P,selector:s}}var Ke=e=>{let t=typeof e?.styleId=="string"&&e.styleId.trim()?e.styleId.trim():"fwkui",n=typeof e?.version=="string"&&e.version.trim()?e.version.trim():"v1",s=e?.compression??!0,o=typeof e?.debounceMs=="number"&&e.debounceMs>=0?e.debounceMs:1e3;return{styleId:t,version:n,compression:s,debounceMs:o}},gt=e=>`${e.styleId}_cache_${e.version}`,We=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===2&&t.compressed===!0&&typeof t.payload=="string"},ve=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===3&&t.compressed===!0&&t.algorithm==="deflate-raw"&&t.encoding==="base64"&&typeof t.payload=="string"},Ue=()=>typeof CompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",Ve=()=>typeof DecompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",ht=e=>{if(typeof btoa=="function"){let n="";for(let o=0;o<e.length;o+=32768){let d=e.subarray(o,o+32768);for(let m=0;m<d.length;m++)n+=String.fromCharCode(d[m])}return btoa(n)}let t=globalThis.Buffer;if(typeof t<"u")return t.from(e).toString("base64");throw new Error("XCSS: base64 encoding is not supported in this runtime")},mt=e=>{if(typeof atob=="function"){let n=atob(e),s=new Uint8Array(n.length);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return s}let t=globalThis.Buffer;if(typeof t<"u")return new Uint8Array(t.from(e,"base64"));throw new Error("XCSS: base64 decoding is not supported in this runtime")},Ct=async e=>{if(!Ue())throw new Error("XCSS: CompressionStream is not supported");let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate-raw")),n=await new Response(t).arrayBuffer();return ht(new Uint8Array(n))},bt=async e=>{if(!Ve())throw new Error("XCSS: DecompressionStream is not supported");let t=mt(e),n=new Uint8Array(t.length);n.set(t);let s=new Blob([n.buffer]).stream().pipeThrough(new DecompressionStream("deflate-raw"));return await new Response(s).text()},wt=e=>{try{let t=JSON.parse(e);return ve(t)}catch{return!1}},xt=e=>{if(!e)return"";let t=new Map,n=[],s=256;for(let d=0;d<256;d++)t.set(String.fromCharCode(d),d);let o=e[0];for(let d=1;d<e.length;d++){let m=e[d],u=o+m;t.has(u)?o=u:(n.push(t.get(o)),t.set(u,s++),o=m)}return n.push(t.get(o)),n.map(d=>String.fromCharCode(d)).join("")},Ne=e=>{if(!e)return"";let t=new Map,n=256,s="";for(let u=0;u<256;u++)t.set(u,String.fromCharCode(u));let o=e.split("").map(u=>u.charCodeAt(0)),d=o[0],m=t.get(d)||"";s=m;for(let u=1;u<o.length;u++){let k=o[u],D=t.get(k);D||(D=k===n?m+m[0]:""),s+=D,t.set(n++,m+D[0]),m=D}return s},Ee=e=>{if(!e||typeof e!="object")return null;let t=e,n=t.default&&typeof t.default=="object"?t.default:t,s=n.SHORT_PROPERTIES,o=n.COMMON_VALUES,d=n.SPECIFIC_VALUES;return!s||!o||!d||typeof s!="object"||typeof o!="object"||typeof d!="object"?null:{SHORT_PROPERTIES:s,COMMON_VALUES:o,SPECIFIC_VALUES:d}},vt=async e=>{let t=await import(e),n=Ee(t);if(!n)throw new Error(ze);return n},ze="XCSS: dictionary module must export SHORT_PROPERTIES, COMMON_VALUES and SPECIFIC_VALUES",qe=()=>{let e=typeof require=="function"?require:null;if(!e)return null;for(let t of["./dictionary.js","./dictionary"])try{let n=e(t),s=Ee(n);if(s)return s}catch{}return null},Et=async()=>{let e=qe();if(e)return e;let t=["./dictionary.mjs","./dictionary.js","./dictionary"],n=null;for(let s of t)try{let o=await import(s),d=Ee(o);if(d)return d}catch(o){n=o}throw n||new Error(ze)},Rt=(e,t)=>{if(!e||typeof document>"u")return;t=t||"fwkui";let n=Array.from({length:24},(s,o)=>"l"+o);if(!e.querySelector('style[id="'+t+'"]')){let s=document.createElement("style");if(s.id=t,!(e instanceof ShadowRoot))document.head.append(s);else try{e.prepend(s)}catch{e.appendChild(s)}let o=`@layer ${n.join(", ")};`,d=setInterval(()=>{if(s.sheet){clearInterval(d);try{s.sheet.insertRule(o,s.sheet.cssRules.length)}catch{}}},10)}},Tt=e=>{let t=Array.isArray(e.excludes)?e.excludes:[],n=Ke(e.cache),s=JSON.stringify({base:e.base||"",aliases:e.aliases||{},breakpoints:e.breakpoints||[],theme:e.theme||{},prefix:e.prefix||"",excludes:t,excludePrefixes:e.excludePrefixes||[],dictionaryImport:e.dictionaryImport??!0,cache:n}),o=0;if(s.length===0)return o.toString();for(let d=0;d<s.length;d++){let m=s.charCodeAt(d);o=(o<<5)-o+m,o|=0}return o.toString()},xe=e=>{if(!e)return null;try{let t=JSON.parse(e);if(We(t)){let n=Ne(t.payload);return n?JSON.parse(n):null}return ve(t)?null:t}catch{return null}},Dt=async e=>{if(!e)return null;try{let t=JSON.parse(e);if(We(t)){let n=Ne(t.payload);return n?JSON.parse(n):null}if(ve(t)){let n=await bt(t.payload);return n?JSON.parse(n):null}return t}catch{return null}},He=(e,t)=>{if(e==="root")return t;let n=/@media[^{]+\{\n?([\s\S]+)\n?\}/.exec(t);return n&&n[1]?n[1].trim():t},Re=(e={base:"",aliases:{},excludes:[],excludePrefixes:[],breakpoints:[],theme:{},prefix:"",dictionaryImport:!0,cache:{styleId:"fwkui",version:"v1",compression:!0,debounceMs:1e3}})=>{let{base:t=null,breakpoints:n=[],aliases:s={},theme:o={},excludes:d=[],excludePrefixes:m=[],prefix:u="",dictionaryImport:k=!0,cache:D={}}=e||{};Array.isArray(n)||(n=[]),Array.isArray(d)||(d=[]),Array.isArray(m)||(m=[]),(!s||typeof s!="object")&&(s={}),(!o||typeof o!="object")&&(o={});let K=Ke(D),P=gt(K),O=d,b=m.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0),X=r=>{let i=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&");return new RegExp("^"+i.replace(/\*/g,".*")+"$")},J=O.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0).map(r=>{if(r.includes("*")){let i=X(r);return c=>i.test(c)}return i=>i===r}),ae=r=>b.some(i=>r.startsWith(i))?!0:J.some(i=>i(r)),le=r=>!(ae(r)||u&&!r.startsWith(u)),Ze=["default","xs","sm","md","lg","xl","2xl","sma","mda","lga","xla"],Je=n.filter(r=>!!r&&typeof r=="object"&&!Array.isArray(r)).map(r=>Object.keys(r)[0]).filter(r=>typeof r=="string"&&r.length>0),Ge=new Set([...Ze,...Je]),ce=r=>!r||Ge.has(r),Ye=k!==!1,Qe=new Set(["mx","my","px","py","bdx","bdy"]),de=new Set,fe=r=>r?!Ye||!N||Object.keys(N).length===0?!0:!!N[r]||Qe.has(r)||de.has(r):!1,N={},te={},ue={},pe={},ke=()=>{pe={...ue,...o}},q=r=>{if(!r){N={},te={},ue={},de=new Set,ke();return}N=r.SHORT_PROPERTIES,te=r.SPECIFIC_VALUES,ue=r.COMMON_VALUES,de=new Set(Object.values(N)),ke()},F=!0,re=Promise.resolve();if(k===!1)q(null);else if(typeof k=="string")F=!1,q(null),re=vt(k).then(r=>{q(r)}).catch(r=>{console.warn("XCSS: Failed to import dictionary from URL",r)}).finally(()=>{F=!0});else{let r=qe();r?q(r):(F=!1,q(null),re=Et().then(i=>{q(i)}).catch(i=>{console.warn("XCSS: Failed to load built-in dictionary module",i)}).finally(()=>{F=!0}))}let G=null,et=(r=typeof document<"u"?document:void 0)=>{let i=typeof window<"u"&&typeof document<"u",c=null,S=Array.isArray(t)?t.length>0:!!t;r&&(c="getRootNode"in r?r.getRootNode():r);let p=new Map,v=new Set,T=1e3;i&&c&&Rt(c,K.styleId);let y=Be(),g=[{default:""},{xs:"screen and (max-width: 575px)"},{sm:"screen and (min-width: 576px)"},{md:"screen and (min-width: 768px)"},{lg:"screen and (min-width: 992px)"},{xl:"screen and (min-width: 1200px)"},{"2xl":"screen and (min-width: 1400px)"},{sma:"screen and (max-width: 768px)"},{mda:"screen and (max-width: 992px)"},{lga:"screen and (max-width: 1200px)"},{xla:"screen and (max-width: 1400px)"},...n],h=g.filter((a,l)=>g.findLastIndex(f=>Object.keys(f)[0]==Object.keys(a)[0])==l),$=h.map(a=>Object.keys(a)[0]),x={},E={},R={root:""},ne={root:[]},Y={root:!1},I=Tt(e),j=null,W=0,U=!1,B=null,M=null,Q=a=>{try{window.localStorage.setItem(P,a)}catch(l){console.warn("XCSS: Failed to save cache",l)}},z=a=>{!i||!window.localStorage||typeof a=="string"&&window.localStorage.getItem(P)!==a||window.localStorage.removeItem(P)},ge=a=>{if(!i||!window.localStorage)return;G=a;let l=++W;try{let f=JSON.stringify(a),w=()=>{let C={__xcss_cache_v:2,compressed:!0,payload:xt(f)};Q(JSON.stringify(C))};if(!K.compression){Q(f);return}if(Ue()&&Ve()){Ct(f).then(C=>{if(l!==W)return;Q(JSON.stringify({__xcss_cache_v:3,compressed:!0,algorithm:"deflate-raw",encoding:"base64",payload:C}))}).catch(()=>{l===W&&w()});return}w()}catch(f){console.warn("XCSS: Failed to save cache",f)}},A=()=>{i&&(j&&clearTimeout(j),j=setTimeout(()=>{let a={};for(let w in x)a[w]=Array.from(x[w]);let l={};Object.keys(R).forEach(w=>{if(w==="root")l[w]=R[w];else{let C=g.find(L=>Object.keys(L)[0]===w)?.[w];C&&R[w]?l[w]=`@media ${C} {
2
+ ${R[w]}
3
+ }`:l[w]=R[w]||""}});let f={configHash:I,cssText:l,rulesSet:a,keys:Array.from(p.entries()),sizeLast:T};ge(f)},K.debounceMs))};if(i&&window.localStorage)try{let a=window.localStorage.getItem(P);if(a){let l=xe(a);if(!l)wt(a)?M={raw:a}:window.localStorage.removeItem(P);else if(l.configHash!==I)window.localStorage.removeItem(P);else{if(B=l,U=!0,l.keys&&l.keys.forEach(([f,w])=>{p.set(f,w),v.add(w)}),typeof l.sizeLast=="number"&&(T=l.sizeLast),l.cssText)for(let f in l.cssText)R[f]=He(f,l.cssText[f]);G=l}}}catch(a){console.error(a)}i&&(E.root=new CSSStyleSheet),$.forEach(a=>{if(x[a]=new Set,i){let l=h.find(f=>Object.keys(f)[0]==a)?.[a]||"";E[a]=new CSSStyleSheet({media:l})}U||(R[a]=""),ne[a]=[],Y[a]=!1});let he=()=>{if(!c)return;let a=c.querySelector(`style[id="${K.styleId}"]`);a&&a.remove()},se=a=>{if(a.keys&&a.keys.forEach(([l,f])=>{p.set(l,f),v.add(f)}),typeof a.sizeLast=="number"&&(T=a.sizeLast),a.cssText)for(let l in a.cssText){if(l==="root"&&S)continue;let f=He(l,a.cssText[l]);R[l]=f,i&&E[l]&&E[l].replaceSync(f)}if(a.rulesSet)for(let l in a.rulesSet)x[l]||(x[l]=new Set),a.rulesSet[l].forEach(f=>x[l].add(f));G=a,he()};U&&B&&se(B),t&&Array.isArray(t)?(R.root=t.join(`
4
+ `),i&&E.root&&E.root.replaceSync(R.root)):(R.root=t||"",i&&E.root&&E.root.replaceSync(R.root)),i&&c&&["root",...$].forEach(a=>{E[a]&&c?.adoptedStyleSheets&&(c.adoptedStyleSheets.includes(E[a])||(c.adoptedStyleSheets=[...c.adoptedStyleSheets,E[a]]))}),i&&window.localStorage&&M&&!U&&(async()=>{let a=await Dt(M.raw);if(!a){z(M.raw);return}if(a.configHash!==I){z(M.raw);return}U=!0,B=a,se(a)})(),i&&window.addEventListener&&window.addEventListener("storage",a=>{if(a.key===P&&a.newValue)try{let l=xe(a.newValue);l&&l.configHash===I&&(typeof l.sizeLast=="number"&&l.sizeLast>T&&(T=l.sizeLast),l.keys&&l.keys.forEach(([f,w])=>{p.has(f)||(p.set(f,w),v.add(w))}))}catch{}});let me=(a,l)=>{let{media:f,property:w,selector:C,layer:L,className:_}=l,V=R,H=ne,Ce=Y;L=Number(L)||0;let $e=p.get(a),ot=$e?`.${$e}${C}`:`.${_}${C}`;var be=`@layer l${L}{${ot}{${w}}}`;x[f]||(x[f]=new Set);let Me=x[f];if(!Me.has(be))if(Me.add(be),H[f]||(H[f]=[]),H[f].push(be),i)Ce[f]||(Ce[f]=!0,queueMicrotask(()=>{let ee=H[f],je=E[f];ee.length>0&&(V[f]+=(V[f]?`
5
5
  `:"")+ee.join(`
6
- `),Le&&Le.replaceSync(P[f]),W[f]=[],oe()),Ce[f]=!1}));else{let ee=W[f];ee.length>0&&(P[f]+=(P[f]?`
6
+ `),je&&je.replaceSync(V[f]),H[f]=[],A()),Ce[f]=!1}));else{let ee=H[f];ee.length>0&&(V[f]+=(V[f]?`
7
7
  `:"")+ee.join(`
8
- `),W[f]=[])}},me=a=>{a.forEach(l=>{let f=Xe(l);f&&he(l,f)})},Q=a=>{if(a.length===0)return;let l=()=>me(a);z?l():re.then(l)};return D.on("observeDom",Q),{clsx:(...a)=>{let l=a.map(m=>Array.isArray(m)?m:[m]).flat(1/0).map(m=>typeof m=="string"?m.split(/(\s|\t)+/g):[]).flat(1/0);l=l.filter(m=>typeof m=="string"&&m.trim()),l=[...new Set(l)];let f=m=>{if(!ce(m))return!1;if(z)return!!Xe(m);let $=u?m.slice(u.length):m,k=ae($);if(!k||!de(k.mq))return!1;let P=(k.selector||"").replace(/(';|;)/g,W=>W=="';"?";":" ");return P&&!Se(P)?!1:k.prop.startsWith("[")?!!Oe(k.prop+k.val):ue(k.prop)?(k.prop==="&",k.val.length>0):!1},v=l.map(m=>{let $=m;if(y.has(m))$=y.get(m);else if(f(m)){let k=new Set(y.values()),P;do P="D"+(x++).toString(32).toUpperCase();while(k.has(P));y.set(m,P),$=P,oe()}return $});return i?queueMicrotask(()=>D.emit("observeDom",l)):D.emit("observeDom",l),v.join(" ")},observe:()=>{!i||!c||nt(c,a=>{Q(a)})},getCssString:()=>Object.entries(E).map(([a,l])=>{if(!l)return"";if(a==="root"||a==="default")return l;let f=p.find(v=>Object.keys(v)[0]===a)?.[a];return f?`@media ${f} {
8
+ `),H[f]=[])}},oe=a=>{a.forEach(l=>{let f=Le(l);f&&me(l,f)})},Pe=a=>{if(a.length===0)return;let l=()=>oe(a);F?l():re.then(l)};return y.on("observeDom",Pe),{clsx:(...a)=>{let l=a.map(C=>Array.isArray(C)?C:[C]).flat(1/0).map(C=>typeof C=="string"?C.split(/(\s|\t)+/g):[]).flat(1/0);l=l.filter(C=>typeof C=="string"&&C.trim()),l=[...new Set(l)];let f=C=>{if(!le(C))return!1;if(F)return!!Le(C);let L=u?C.slice(u.length):C,_=ie(L);if(!_||!ce(_.mq))return!1;let V=(_.selector||"").replace(/(';|;)/g,H=>H=="';"?";":" ");return V&&!ye(V)?!1:_.prop.startsWith("[")?!!Oe(_.prop+_.val):fe(_.prop)?(_.prop==="&",_.val.length>0):!1},w=l.map(C=>{let L=C;if(p.has(C))L=p.get(C);else if(f(C)){let _;do _="D"+(T++).toString(32).toUpperCase();while(v.has(_));p.set(C,_),v.add(_),L=_,A()}return L});return i?queueMicrotask(()=>y.emit("observeDom",l)):y.emit("observeDom",l),w.join(" ")},observe:()=>{!i||!c||st(c,a=>{Pe(a)})},getCssString:()=>Object.entries(R).map(([a,l])=>{if(!l)return"";if(a==="root"||a==="default")return l;let f=g.find(w=>Object.keys(w)[0]===a)?.[a];return f?`@media ${f} {
9
9
  ${l}
10
10
  }`:l}).join(`
11
- `)}};function Oe(r){let i=new RegExp("^(\\[(?<p>[a-zA-Z]+)\\])$"),{p:c=""}=i.exec(r)?.groups??{};if(c&&s[c]&&Array.isArray(s[c])){let S=s[c],y=[],x=!0,D=p=>{let C=p.trim();if(!C)return null;let g=C.endsWith(";")?C.slice(0,-1).trim():C,T=g.indexOf(":");if(T<=0||T>=g.length-1)return null;let b=g.slice(0,T).trim(),E=g.slice(T+1).trim();return!b||!E||!/^(?:--[a-zA-Z0-9-_]+|-?[a-zA-Z][a-zA-Z0-9-]*)$/.test(b)?null:`${b}:${E}`};for(let p of S){if(typeof p!="string"){x=!1;break}let C=D(p);if(C){if(typeof CSS<"u"&&!CSS.supports(C)){x=!1;break}y.push(C);continue}x=!1;break}if(y.length>0&&x)return y.join(";")}return null}function ke(r,i){let c=Oe(r+i);if(c)return c;if(!r||i===void 0)return null;let S=V[r],y=S||r,x=i[0],D=!1,p=i;if(x==="!"&&(D=!0,p=p.substring(1),x=p[0]),p.startsWith("--"))p="var("+p+")";else if(x==="["&&p.endsWith("]"))p=p.substring(1,p.length-1);else if(p.length>0){let b=p[0].toLowerCase()+p.substring(1),E=te[r]?.[b]||ye[b];if(!E){let B=p.toLowerCase();E=te[r]?.[B]||ye[B]}p=E||p}if(p=p.replace(/(';|;)/g,b=>b=="';"?";":" "),!p)return null;let C=p+(D?" !important":""),g=[y+":"+C];switch(y){case"mx":g=[`margin-left:${C}`,`margin-right:${C}`];break;case"my":g=[`margin-top:${C}`,`margin-bottom:${C}`];break;case"px":g=[`padding-left:${C}`,`padding-right:${C}`];break;case"py":g=[`padding-top:${C}`,`padding-bottom:${C}`];break;case"bdx":g=[`border-left:${C}`,`border-right:${C}`];break;case"bdy":g=[`border-top:${C}`,`border-bottom:${C}`];break}return!(typeof CSS<"u")||g.every(b=>CSS.supports(b))?g.join(";"):null}let et=r=>{let i=0;for(let c=r.length-1;c>=0;c--){let S=r[c];if(S==="]"){i++;continue}if(S==="["){i>0&&i--;continue}if(S==="@"&&i===0)return{body:r.slice(0,c),selector:r.slice(c+1)}}return{body:r,selector:""}},tt=r=>{let i=[],c=0,S=0;for(let y=0;y<r.length;y++){let x=r[y];if(x==="["){S++;continue}if(x==="]"){S>0&&S--;continue}x==="&"&&S===0&&(i.push(r.slice(c,y)),c=y+1)}return i.push(r.slice(c)),i},Se=r=>{if(!r)return!0;let i=r.trim();if(!i)return!0;if(/[{}]/.test(i)||i==="#"||i==="("||i===")"||i===","||i===">"||i==="+"||i==="~"||i.startsWith("(")||i.startsWith(")"))return!1;let c=0;for(let S=0;S<i.length;S++){let y=i[S];if(y==="("){c++;continue}if(y===")"){if(c===0)return!1;c--}}return c===0};function Xe(r){if(!ce(r))return null;let i=u?r.slice(u.length):r,c=typeof CSS<"u"?CSS.escape(r):rt(r);if(i.includes("&")&&!i.startsWith("&")){let{body:B,selector:ne}=et(i),F=tt(B).map(I=>I.trim()).filter(I=>I.length>0).map(I=>u&&I.startsWith(u)?I.slice(u.length):I);if(F.length>1){let I="",H="",M=ne,N=!1,j=[];for(let Z of F){let oe=M?`${Z}@${M}`:Z,A=ae(oe);if(!A||!de(A.mq)||!A.prop.startsWith("[")&&!ue(A.prop))return null;N?(!A.mq&&I&&(A.mq=I),!A.layer&&H&&(A.layer=H)):(I=A.mq||"",H=A.layer||"",N=!0);let ie=A.mq||"",he=A.layer||"",me=A.selector||"";if(ie!==I||he!==H||me!==M)return null;let Q=ke(A.prop,A.val);if(!Q)return null;j.push(Q)}if(j.length===0)return null;let K=M.replace(/(';|;)/g,Z=>Z=="';"?";":" "),se=`selector(${c}${K})`;if(K){if(typeof CSS<"u"){if(!CSS.supports(se))return null}else if(!Se(K))return null}return{media:I||"default",layer:H||"0",className:c,property:j.join(";"),selector:K,cssRules:`.${c}${K}{${j.join(";")}}`}}}let S=ae(i);if(!S||!de(S.mq)||!S.prop.startsWith("[")&&!ue(S.prop))return null;let{mq:y="default",layer:x="0",prop:D,val:p,selector:C=""}=S,g=[],T=ke(D,p);if(T&&g.push(T),g.length===0)return null;let b=C.replace(/(';|;)/g,B=>B=="';"?";":" "),E=`selector(${c}${b})`;if(b){if(typeof CSS<"u"){if(!CSS.supports(E))return null}else if(!Se(b))return null}return{media:y||"default",layer:x||"0",className:c,property:g.join(";"),selector:b,cssRules:`.${c}${b}{${g.join(";")}}`}}let rt=r=>r.replace(/([^\w-])/g,"\\$1"),ge=r=>{var i=[...r?.classList||[]].filter(c=>{if(c){let S=c.charCodeAt(0)==45?c.charCodeAt(1):c.charCodeAt(0);return S>=97&&S<=122||S>=48&&S<=57}return!1});return r?.children?.length>0&&Array.from(r?.children).forEach(c=>{i.push(...ge(c))}),i.flat(1/0)},nt=(r,i)=>{if(typeof i!="function")throw new Error("Callback is not a function");if(!r)return;let c;"documentElement"in r?c=r.documentElement:(r instanceof Element||"tagName"in r||"host"in r)&&(c=r),c&&(c instanceof Element&&i(ge(c)),typeof MutationObserver<"u"&&new MutationObserver(S=>{for(let y of S)if(y.type=="attributes"&&y.attributeName=="class"){if(y.target.nodeType==1){let x=String(y.target?.className??""),D=String(y?.oldValue??"");if(x||D){let p=x.split(" ").map(g=>g.trim()).filter(g=>g),C=D.split(" ").map(g=>g.trim()).filter(g=>g);p=p.filter(g=>!C.includes(g)),typeof i=="function"&&i([...new Set(p)])}}}else if(y.type=="childList"&&y.addedNodes.length>0){let x=[...y.addedNodes].filter(D=>D.nodeType==1).map(D=>ge(D)).flat(1/0);typeof i=="function"&&i([...new Set(x)])}}).observe(c,{attributes:!0,attributeOldValue:!0,attributeFilter:["class"],childList:!0,subtree:!0}))};return{buildCss:Qe,exportCache:()=>typeof window>"u"||!window.localStorage?Y:je(window.localStorage.getItem(L))||Y,ready:re}},Dt=(e,t)=>{Ee(t).buildCss(e).observe()},It=(e,t)=>Ee(t).buildCss(e).clsx,Re={css:Ee,cssObserve:Dt,clsx:It};var At=(e,t)=>(e=e||"fwkui",t=t||"v1",`${e}_cache_${t}`),ze=(e="fwkui",t="v1",n)=>{let s=String(e||"").trim()||"fwkui",o=At(s,t),d=JSON.stringify(s),h=JSON.stringify(o),u=`
11
+ `)}};function Oe(r){let i=new RegExp("^(\\[(?<p>[a-zA-Z]+)\\])$"),{p:c=""}=i.exec(r)?.groups??{};if(c&&s[c]&&Array.isArray(s[c])){let S=s[c],p=[],v=!0,T=y=>{let g=y.trim();if(!g)return null;let h=g.endsWith(";")?g.slice(0,-1).trim():g,$=h.indexOf(":");if($<=0||$>=h.length-1)return null;let x=h.slice(0,$).trim(),E=h.slice($+1).trim();return!x||!E||!/^(?:--[a-zA-Z0-9-_]+|-?[a-zA-Z][a-zA-Z0-9-]*)$/.test(x)?null:`${x}:${E}`};for(let y of S){if(typeof y!="string"){v=!1;break}let g=T(y);if(g){if(typeof CSS<"u"&&!CSS.supports(g)){v=!1;break}p.push(g);continue}v=!1;break}if(p.length>0&&v)return p.join(";")}return null}function Xe(r,i){let c=Oe(r+i);if(c)return c;if(!r||i===void 0)return null;let S=N[r],p=S||r,v=i[0],T=!1,y=i;if(v==="!"&&(T=!0,y=y.substring(1),v=y[0]),y.startsWith("--"))y="var("+y+")";else if(v==="["&&y.endsWith("]"))y=y.substring(1,y.length-1);else if(y.length>0){let x=y[0].toLowerCase()+y.substring(1),E=te[r]?.[x]||pe[x];if(!E){let R=y.toLowerCase();E=te[r]?.[R]||pe[R]}y=E||y}if(y=y.replace(/(';|;)/g,x=>x=="';"?";":" "),!y)return null;let g=y+(T?" !important":""),h=[p+":"+g];switch(p){case"mx":h=[`margin-left:${g}`,`margin-right:${g}`];break;case"my":h=[`margin-top:${g}`,`margin-bottom:${g}`];break;case"px":h=[`padding-left:${g}`,`padding-right:${g}`];break;case"py":h=[`padding-top:${g}`,`padding-bottom:${g}`];break;case"bdx":h=[`border-left:${g}`,`border-right:${g}`];break;case"bdy":h=[`border-top:${g}`,`border-bottom:${g}`];break}return!(typeof CSS<"u")||h.every(x=>CSS.supports(x))?h.join(";"):null}let tt=r=>{let i=0;for(let c=r.length-1;c>=0;c--){let S=r[c];if(S==="]"){i++;continue}if(S==="["){i>0&&i--;continue}if(S==="@"&&i===0)return{body:r.slice(0,c),selector:r.slice(c+1)}}return{body:r,selector:""}},rt=r=>{let i=[],c=0,S=0;for(let p=0;p<r.length;p++){let v=r[p];if(v==="["){S++;continue}if(v==="]"){S>0&&S--;continue}v==="&"&&S===0&&(i.push(r.slice(c,p)),c=p+1)}return i.push(r.slice(c)),i},ye=r=>{if(!r)return!0;let i=r.trim();if(!i)return!0;if(/[{}]/.test(i)||i==="#"||i==="("||i===")"||i===","||i===">"||i==="+"||i==="~"||i.startsWith("(")||i.startsWith(")"))return!1;let c=0;for(let S=0;S<i.length;S++){let p=i[S];if(p==="("){c++;continue}if(p===")"){if(c===0)return!1;c--}}return c===0};function Le(r){if(!le(r))return null;let i=u?r.slice(u.length):r,c=typeof CSS<"u"?CSS.escape(r):nt(r);if(i.includes("&")&&!i.startsWith("&")){let{body:R,selector:ne}=tt(i),Y=rt(R).map(I=>I.trim()).filter(I=>I.length>0).map(I=>u&&I.startsWith(u)?I.slice(u.length):I);if(Y.length>1){let I="",j="",W=ne,U=!1,B=[];for(let z of Y){let ge=W?`${z}@${W}`:z,A=ie(ge);if(!A||!ce(A.mq)||!A.prop.startsWith("[")&&!fe(A.prop))return null;U?(!A.mq&&I&&(A.mq=I),!A.layer&&j&&(A.layer=j)):(I=A.mq||"",j=A.layer||"",U=!0);let he=A.mq||"",se=A.layer||"",me=A.selector||"";if(he!==I||se!==j||me!==W)return null;let oe=Xe(A.prop,A.val);if(!oe)return null;B.push(oe)}if(B.length===0)return null;let M=W.replace(/(';|;)/g,z=>z=="';"?";":" "),Q=`selector(${c}${M})`;if(M){if(typeof CSS<"u"){if(!CSS.supports(Q))return null}else if(!ye(M))return null}return{media:I||"default",layer:j||"0",className:c,property:B.join(";"),selector:M,cssRules:`.${c}${M}{${B.join(";")}}`}}}let S=ie(i);if(!S||!ce(S.mq)||!S.prop.startsWith("[")&&!fe(S.prop))return null;let{mq:p="default",layer:v="0",prop:T,val:y,selector:g=""}=S,h=[],$=Xe(T,y);if($&&h.push($),h.length===0)return null;let x=g.replace(/(';|;)/g,R=>R=="';"?";":" "),E=`selector(${c}${x})`;if(x){if(typeof CSS<"u"){if(!CSS.supports(E))return null}else if(!ye(x))return null}return{media:p||"default",layer:v||"0",className:c,property:h.join(";"),selector:x,cssRules:`.${c}${x}{${h.join(";")}}`}}let nt=r=>r.replace(/([^\w-])/g,"\\$1"),Se=r=>{var i=[...r?.classList||[]].filter(c=>{if(c){let S=c.charCodeAt(0)==45?c.charCodeAt(1):c.charCodeAt(0);return S>=97&&S<=122||S>=48&&S<=57}return!1});return r?.children?.length>0&&Array.from(r?.children).forEach(c=>{i.push(...Se(c))}),i.flat(1/0)},st=(r,i)=>{if(typeof i!="function")throw new Error("Callback is not a function");if(!r)return;let c;"documentElement"in r?c=r.documentElement:(r instanceof Element||"tagName"in r||"host"in r)&&(c=r),c&&(c instanceof Element&&i(Se(c)),typeof MutationObserver<"u"&&new MutationObserver(S=>{for(let p of S)if(p.type=="attributes"&&p.attributeName=="class"){if(p.target.nodeType==1){let v=String(p.target?.className??""),T=String(p?.oldValue??"");if(v||T){let y=v.split(" ").map(h=>h.trim()).filter(h=>h),g=T.split(" ").map(h=>h.trim()).filter(h=>h);y=y.filter(h=>!g.includes(h)),typeof i=="function"&&i([...new Set(y)])}}}else if(p.type=="childList"&&p.addedNodes.length>0){let v=[...p.addedNodes].filter(T=>T.nodeType==1).map(T=>Se(T)).flat(1/0);typeof i=="function"&&i([...new Set(v)])}}).observe(c,{attributes:!0,attributeOldValue:!0,attributeFilter:["class"],childList:!0,subtree:!0}))};return{buildCss:et,exportCache:()=>typeof window>"u"||!window.localStorage?G:xe(window.localStorage.getItem(P))||G,ready:re}},It=(e,t)=>{Re(t).buildCss(e).observe()},At=(e,t)=>Re(t).buildCss(e).clsx,Te={css:Re,cssObserve:It,clsx:At};var _t=(e,t)=>(e=e||"fwkui",t=t||"v1",`${e}_cache_${t}`),Fe=(e="fwkui",t="v1",n)=>{let s=String(e||"").trim()||"fwkui",o=_t(s,t),d=JSON.stringify(s),m=JSON.stringify(o),u=`
12
12
  (async function () {
13
13
  function decompressLZW(compressed) {
14
14
  if (!compressed) return '';
@@ -94,7 +94,7 @@ ${l}
94
94
  if (typeof window === 'undefined' || !window.localStorage) return;
95
95
 
96
96
  var styleId = ${d};
97
- var key = ${h};
97
+ var key = ${m};
98
98
  var raw = localStorage.getItem(key);
99
99
  if (!raw) return;
100
100
  var payload=await parseCache(raw);
@@ -118,5 +118,5 @@ ${l}
118
118
  styleEl.textContent = css;
119
119
  } catch (_error) {}
120
120
  })();
121
- `.trim();return n?.compact?u.replace(/\s+/g," ").trim():u};var Te="__FWXCSS_SHARED__",_t={base:"html,body{font-size:16px;padding:0;margin:0;}"},Ot=e=>{if(!e)return!1;let t=typeof Document<"u",n=typeof ShadowRoot<"u",s=t&&e instanceof Document,o=n&&e instanceof ShadowRoot;return s||o},kt=e=>{let t=[],n=s=>{if(s){if(typeof s=="string"||typeof s=="number"){t.push(String(s));return}if(Array.isArray(s)){s.forEach(n);return}typeof s=="object"&&Object.keys(s).forEach(o=>{s[o]&&t.push(o)})}};return e.forEach(n),t},Ie=e=>{let t=new WeakMap,n=null,s=e??_t,o=typeof document<"u"?document:null,d=w=>{let X=Re.css(s);return{...X.buildCss(w??void 0),ready:X.ready}},h=()=>(n||(n=d(null)),n),u=w=>{if(!w)return h();let X=t.get(w);return X||(X=d(w),t.set(w,X)),X};return{clsx:(...w)=>{let X,G=w[w.length-1];Ot(G)&&(X=G,w=w.slice(0,-1));let le=kt(w);return u(X||o).clsx(le.join(" "))},observe:w=>{u(w||o).observe()},setClsxRoot:w=>{o=w||(typeof document<"u"?document:null)},getCss:w=>w?u(w).getCssString():o?u(o).getCssString():h().getCssString(),ready:w=>w?u(w).ready:o?u(o).ready:h().ready}},Xt=e=>Ie(e),Pt=e=>Ie(e),De=typeof globalThis<"u"?globalThis:typeof window<"u"?window:global,J=De[Te]||Ie();De[Te]||(De[Te]=J);var $t=J.clsx,Lt=J.observe,Mt=J.setClsxRoot,jt=J.getCss,Bt=J.ready;var Ae=Re;typeof document<"u"&&(Ae.cssObserve(document),console.log("\u{1F680} fwxcss Auto-Observer Activated"));var Ht=Ae;0&&(module.exports={clsx,createSharedClsx,createSharedInstance,getBootloaderScript,getCss,observe,ready,setClsxRoot});
121
+ `.trim();return n?.compact?u.replace(/\s+/g," ").trim():u};var De="__FWXCSS_SHARED__",kt={base:"html,body{font-size:16px;padding:0;margin:0;}"},Ot=e=>{if(!e)return!1;let t=typeof Document<"u",n=typeof ShadowRoot<"u",s=t&&e instanceof Document,o=n&&e instanceof ShadowRoot;return s||o},Xt=e=>{let t=[],n=s=>{if(s){if(typeof s=="string"||typeof s=="number"){t.push(String(s));return}if(Array.isArray(s)){s.forEach(n);return}typeof s=="object"&&Object.keys(s).forEach(o=>{s[o]&&t.push(o)})}};return e.forEach(n),t},Ae=e=>{let t=new WeakMap,n=null,s=e??kt,o=typeof document<"u"?document:null,d=b=>{let X=Te.css(s);return{...X.buildCss(b??void 0),ready:X.ready}},m=()=>(n||(n=d(null)),n),u=b=>{if(!b)return m();let X=t.get(b);return X||(X=d(b),t.set(b,X)),X};return{clsx:(...b)=>{let X,J=b[b.length-1];Ot(J)&&(X=J,b=b.slice(0,-1));let ae=Xt(b);return u(X||o).clsx(ae.join(" "))},observe:b=>{u(b||o).observe()},setClsxRoot:b=>{o=b||(typeof document<"u"?document:null)},getCss:b=>b?u(b).getCssString():o?u(o).getCssString():m().getCssString(),ready:b=>b?u(b).ready:o?u(o).ready:m().ready}},Lt=e=>Ae(e),Pt=e=>Ae(e),Ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:global,Z=Ie[De]||Ae();Ie[De]||(Ie[De]=Z);var $t=Z.clsx,Mt=Z.observe,jt=Z.setClsxRoot,Bt=Z.getCss,Ht=Z.ready;var _e=Te;typeof document<"u"&&(_e.cssObserve(document),console.log("\u{1F680} fwxcss Auto-Observer Activated"));var Kt=_e;0&&(module.exports={clsx,createSharedClsx,createSharedInstance,getBootloaderScript,getCss,observe,ready,setClsxRoot});
122
122
  //# sourceMappingURL=index-auto.js.map