@uicopilot/storybook-addon 0.5.16 → 0.5.17

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.
Files changed (2) hide show
  1. package/dist/manager.mjs +4 -4
  2. package/package.json +1 -1
package/dist/manager.mjs CHANGED
@@ -11,7 +11,7 @@ var HF=Object.create;var $a=Object.defineProperty;var WF=Object.getOwnPropertyDe
11
11
  `+t+`
12
12
  --`+new Array((n||t.length)+1).join("-")+"^"})}var $b=_(()=>{"use strict";al()});var KA,XA,QA,JA,ZA,Ub,kl,jb=_(()=>{"use strict";$b();KA=9,XA=10,QA=12,JA=13,ZA=32,Ub=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),kl=class{constructor(t){this.str=t,this.pos=0}charCodeAt(t){return t<this.str.length?this.str.charCodeAt(t):0}charCode(){return this.charCodeAt(this.pos)}isNameCharCode(t=this.charCode()){return t<128&&Ub[t]===1}nextCharCode(){return this.charCodeAt(this.pos+1)}nextNonWsCode(t){return this.charCodeAt(this.findWsEnd(t))}skipWs(){this.pos=this.findWsEnd(this.pos)}findWsEnd(t){for(;t<this.str.length;t++){let n=this.str.charCodeAt(t);if(n!==JA&&n!==XA&&n!==QA&&n!==ZA&&n!==KA)break}return t}substringToPos(t){return this.str.substring(this.pos,this.pos=t)}eat(t){this.charCode()!==t&&this.error("Expect `"+String.fromCharCode(t)+"`"),this.pos++}peek(){return this.pos<this.str.length?this.str.charAt(this.pos++):""}error(t){throw new _b(t,this.str,this.pos)}scanSpaces(){return this.substringToPos(this.findWsEnd(this.pos))}scanWord(){let t=this.pos;for(;t<this.str.length;t++){let n=this.str.charCodeAt(t);if(n>=128||Ub[n]===0)break}return this.pos===t&&this.error("Expect a keyword"),this.substringToPos(t)}scanNumber(){let t=this.pos;for(;t<this.str.length;t++){let n=this.str.charCodeAt(t);if(n<48||n>57)break}return this.pos===t&&this.error("Expect a number"),this.substringToPos(t)}scanString(){let t=this.str.indexOf("'",this.pos+1);return t===-1&&(this.pos=this.str.length,this.error("Expect an apostrophe")),this.substringToPos(t+1)}}});function Yb(e){let t=null,n=null;return e.eat(Il),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===lp?(e.pos++,e.skipWs(),e.charCode()!==ip&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat(ip),{min:Number(t),max:n?Number(n):0}}function sP(e){let t=null,n=!1;switch(e.charCode()){case Jb:e.pos++,t={min:0,max:0};break;case ap:e.pos++,t={min:1,max:0};break;case Tl:e.pos++,t={min:0,max:1};break;case sp:e.pos++,n=!0,e.charCode()===Il?t=Yb(e):e.charCode()===Tl?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case Il:t=Yb(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}function Zr(e,t){let n=sP(e);return n!==null?(n.term=t,e.charCode()===sp&&e.charCodeAt(e.pos-1)===ap||e.charCode()===Tl&&e.charCodeAt(e.pos-1)===ip?Zr(e,n):n):t}function rp(e){let t=e.peek();return t===""?null:Zr(e,{type:"Token",value:t})}function aP(e){let t;return e.eat(cp),e.eat(Cl),t=e.scanWord(),e.eat(Cl),e.eat(op),Zr(e,{type:"Property",name:t})}function lP(e){let t=null,n=null,r=1;return e.eat(Es),e.charCode()===Wb&&(e.peek(),r=-1),r==-1&&e.charCode()===Gb?e.peek():(t=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(lp),e.skipWs(),e.charCode()===Gb?e.peek():(r=1,e.charCode()===Wb&&(e.peek(),r=-1),n=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(Ii),{type:"Range",min:t,max:n}}function cP(e){let t,n=null;if(e.eat(cp),t=e.scanWord(),t==="boolean-expr"){e.eat(Es);let r=Fl(e,Ii);return e.eat(Ii),e.eat(op),Zr(e,{type:"Boolean",term:r.terms.length===1?r.terms[0]:r})}return e.charCode()===Xb&&e.nextCharCode()===Qb&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===Es&&(e.skipWs(),n=lP(e)),e.eat(op),Zr(e,{type:"Type",name:t,opts:n})}function uP(e){let t=e.scanWord();return e.charCode()===Xb?(e.pos++,{type:"Function",name:t}):Zr(e,{type:"Keyword",name:t})}function pP(e,t){function n(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let r;for(t=Object.keys(t).sort((o,i)=>qb[o]-qb[i]);t.length>0;){r=t.shift();let o=0,i=0;for(;o<e.length;o++){let s=e[o];s.type==="Combinator"&&(s.value===r?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,n(e.slice(i,o),r)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,n(e.slice(i,o),r))}return r}function Fl(e,t=-1){let n=Object.create(null),r=[],o=null,i=e.pos,s=!1;for(;e.charCode()!==t;){let a=s?Fl(e,Qb):gP(e);if(!a)break;if(a.type!=="Spaces"){if(s){if(a.terms.length===0){s=!1;continue}if(a.combinator===" "){for(;a.terms.length>1;)n[" "]=!0,r.push({type:"Combinator",value:" "},a.terms.shift());a=a.terms[0]}}a.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),n[a.value]=!0):o!==null&&o.type!=="Combinator"&&(n[" "]=!0,r.push({type:"Combinator",value:" "})),r.push(a),o=a,i=e.pos,s=a.type==="Function"}}return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:r,combinator:pP(r,n)||" ",disallowEmpty:!1,explicit:!1}}function dP(e){let t;return e.eat(Es),t=Fl(e,Ii),e.eat(Ii),t.explicit=!0,e.charCode()===Kb&&(e.pos++,t.disallowEmpty=!0),t}function gP(e){let t=e.charCode();switch(t){case Ii:break;case Es:return Zr(e,dP(e));case cp:return e.nextCharCode()===Cl?aP(e):cP(e);case Vb:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===Vb?2:1))};case Hb:return e.pos++,e.eat(Hb),{type:"Combinator",value:"&&"};case lp:return e.pos++,{type:"Comma"};case Cl:return Zr(e,{type:"String",value:e.scanString()});case oP:case eP:case tP:case rP:case nP:return{type:"Spaces",value:e.scanSpaces()};case iP:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):rp(e);case Jb:case ap:case Tl:case sp:case Kb:break;case Il:if(t=e.nextCharCode(),t<48||t>57)return rp(e);break;default:return e.isNameCharCode(t)?uP(e):rp(e)}}function As(e){let t=new kl(e),n=Fl(t);return t.pos!==e.length&&t.error("Unexpected input"),n.terms.length===1&&n.terms[0].type==="Group"?n.terms[0]:n}var eP,tP,nP,rP,oP,Kb,sp,Hb,Cl,Xb,Qb,Jb,ap,lp,Wb,cp,op,Tl,iP,Es,Ii,Il,Vb,ip,Gb,qb,up=_(()=>{"use strict";jb();eP=9,tP=10,nP=12,rP=13,oP=32,Kb=33,sp=35,Hb=38,Cl=39,Xb=40,Qb=41,Jb=42,ap=43,lp=44,Wb=45,cp=60,op=62,Tl=63,iP=64,Es=91,Ii=93,Il=123,Vb=124,ip=125,Gb=8734,qb={" ":1,"&&":2,"||":3,"|":4}});function Zb(e){return typeof e=="function"?e:Ps}function pp(e,t,n){function r(s){switch(o.call(n,s),s.type){case"Group":s.terms.forEach(r);break;case"Multiplier":case"Boolean":r(s.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+s.type)}i.call(n,s)}let o=Ps,i=Ps;if(typeof t=="function"?o=t:t&&(o=Zb(t.enter),i=Zb(t.leave)),o===Ps&&i===Ps)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var Ps,e0=_(()=>{"use strict";Ps=function(){}});var dp=_(()=>{"use strict";Hu();up();e0()});function hP(e){let t=[];return wo(e,(n,r,o)=>t.push({type:n,value:e.slice(r,o),node:null})),t}function t0(e,t){return typeof e=="string"?hP(e):t.generate(e,mP)}var mP,n0=_(()=>{"use strict";sr();mP={decorator(e){let t=[],n=null;return{...e,node(r){let o=n;n=r,e.node.call(this,r),n=o},emit(r,o,i){t.push({type:o,value:r,node:i?null:n})},result(){return t}}}}});function bn(e,t,n){return t===pt&&n===St||e===pt&&t===pt&&n===pt?e:(e.type==="If"&&e.else===St&&t===pt&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function o0(e){return e.length>2&&e.charCodeAt(e.length-2)===xP&&e.charCodeAt(e.length-1)===yP}function r0(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&o0(e.name)}function ko(e,t=" ",n=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function Ls(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case"If":e.match=Ls(e.match,t,n),e.then=Ls(e.then,t,n),e.else=Ls(e.else,t,n);break;case"Type":return t[e.name]||e}return e}function gp(e,t,n){switch(e){case" ":{let r=pt;for(let o=t.length-1;o>=0;o--){let i=t[o];r=bn(i,r,St)}return r}case"|":{let r=St,o=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(r0(s)&&(o===null&&i>0&&r0(t[i-1])&&(o=Object.create(null),r=bn({type:"Enum",map:o},pt,r)),o!==null)){let a=(o0(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(a in o)){o[a]=s;continue}}o=null,r=bn(s,pt,r)}return r}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let r=St;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=gp(e,t.filter(function(a){return a!==i}),!1):s=pt,r=bn(i,s,r)}return r}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let r=n?pt:St;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=gp(e,t.filter(function(a){return a!==i}),!0):s=pt,r=bn(i,s,r)}return r}}}function bP(e){let t=pt,n=Fi(e.term);if(e.max===0)n=bn(n,El,St),t=bn(n,null,St),t.then=bn(pt,pt,t),e.comma&&(t.then.else=bn({type:"Comma",syntax:e},t,St));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==pt&&(t=bn({type:"Comma",syntax:e},t,St)),t=bn(n,bn(pt,pt,t),St);if(e.min===0)t=bn(pt,pt,t);else for(let r=0;r<e.min-1;r++)e.comma&&t!==pt&&(t=bn({type:"Comma",syntax:e},t,St)),t=bn(n,t,St);return t}function Fi(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=gp(e.combinator,e.terms.map(Fi),!1);return e.disallowEmpty&&(t=bn(t,El,St)),t}case"Multiplier":return bP(e);case"Boolean":{let t=Fi(e.term),n=Fi(ko([ko([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),ko([{type:"Type",name:"!boolean-group"},ko([{type:"Multiplier",comma:!1,min:0,max:0,term:ko([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:ko([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),r=Fi(ko([{type:"Type",name:"!term"},ko([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return Ls(r,{"!term":t,"!self":n}),Ls(n,{"!boolean-group":r}),n}case"Type":case"Property":return{type:e.type,name:e.name,syntax:e};case"Keyword":return{type:e.type,name:e.name.toLowerCase(),syntax:e};case"AtKeyword":return{type:e.type,name:"@"+e.name.toLowerCase(),syntax:e};case"Function":return{type:e.type,name:e.name.toLowerCase()+"(",syntax:e};case"String":return e.value.length===3?{type:"Token",value:e.value.charAt(1),syntax:e}:{type:e.type,value:e.value.substr(1,e.value.length-2).replace(/\\'/g,"'"),syntax:e};case"Token":return{type:e.type,value:e.value,syntax:e};case"Comma":return{type:e.type,syntax:e};default:throw new Error("Unknown node type:",e.type)}}function Ms(e,t){return typeof e=="string"&&(e=As(e)),{type:"MatchGraph",match:Fi(e),syntax:t||null,source:e}}var pt,St,El,xP,yP,fp=_(()=>{"use strict";up();pt={type:"Match"},St={type:"Mismatch"},El={type:"DisallowEmpty"},xP=40,yP=41});function TP(e){let t=null,n=null,r=e;for(;r!==null;)n=r.prev,r.prev=t,t=r,r=n;return t}function mp(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=t.charCodeAt(n),o=e.charCodeAt(n);if(o>=65&&o<=90&&(o=o|32),o!==r)return!1}return!0}function IP(e){return e.type!==9?!1:e.value!=="?"}function l0(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||IP(e)}function c0(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function FP(e,t,n){function r(){do I++,E=I<e.length?e[I]:null;while(E!==null&&(E.type===13||E.type===25))}function o($){let P=I+$;return P<e.length?e[P]:null}function i($,P){return{nextState:$,matchStack:R,syntaxStack:d,thenStack:g,tokenIndex:I,prev:P}}function s($){g={nextState:$,matchStack:R,syntaxStack:d,prev:g}}function a($){p=i($,p)}function u(){R={type:wP,syntax:t.syntax,token:E,prev:R},r(),f=null,I>D&&(D=I)}function c(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},R={type:hp,syntax:t.syntax,token:R.token,prev:R}}function l(){R.type===hp?R=R.prev:R={type:u0,syntax:d.syntax,token:R.token,prev:R},d=d.prev}let d=null,g=null,p=null,f=null,k=0,T=null,E=null,I=-1,D=0,R={type:SP,syntax:null,token:null,prev:null};for(r();T===null&&++k<a0;)switch(t.type){case"Match":if(g===null){if(E!==null&&(I!==e.length-1||E.value!=="\\0"&&E.value!=="\\9")){t=St;break}T=s0;break}if(t=g.nextState,t===El)if(g.matchStack===R){t=St;break}else t=pt;for(;g.syntaxStack!==d;)l();g=g.prev;break;case"Mismatch":if(f!==null&&f!==!1)(p===null||I>p.tokenIndex)&&(p=f,f=!1);else if(p===null){T=vP;break}t=p.nextState,g=p.thenStack,d=p.syntaxStack,R=p.matchStack,I=p.tokenIndex,E=I<e.length?e[I]:null,p=p.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==St&&a(t.else),t.then!==pt&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let z=t.syntax.terms;if(t.index===z.length){if(t.mask===0||t.syntax.all){t=St;break}t=pt;break}if(t.mask===(1<<z.length)-1){t=pt;break}for(;t.index<z.length;t.index++){let x=1<<t.index;if((t.mask&x)===0){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|x}),t=z[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(E!==null){let z=E.value.toLowerCase();if(z.indexOf("\\")!==-1&&(z=z.replace(/\\[09].*$/,"")),i0.call(t.map,z)){t=t.map[z];break}}t=St;break;case"Generic":{let z=d!==null?d.opts:null,x=I+Math.floor(t.fn(E,o,z));if(!isNaN(x)&&x>I){for(;I<x;)u();t=pt}else t=St;break}case"Type":case"Property":{let z=t.type==="Type"?"types":"properties",x=i0.call(n,z)?n[z][t.name]:null;if(!x||!x.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(f!==!1&&E!==null&&t.type==="Type"&&(t.name==="custom-ident"&&E.type===1||t.name==="length"&&E.value==="0")){f===null&&(f=i(t,p)),t=St;break}c(),t=x.matchRef||x.match;break}case"Keyword":{let z=t.name;if(E!==null){let x=E.value;if(x.indexOf("\\")!==-1&&(x=x.replace(/\\[09].*$/,"")),mp(x,z)){u(),t=pt;break}}t=St;break}case"AtKeyword":case"Function":if(E!==null&&mp(E.value,t.name)){u(),t=pt;break}t=St;break;case"Token":if(E!==null&&E.value===t.value){u(),t=pt;break}t=St;break;case"Comma":E!==null&&E.type===18?l0(R.token)?t=St:(u(),t=c0(E)?St:pt):t=l0(R.token)||c0(E)?pt:St;break;case"String":let $="",P=I;for(;P<e.length&&$.length<t.value.length;P++)$+=e[P].value;if(mp($,t.value)){for(;I<P;)u();t=pt}else t=St;break;default:throw new Error("Unknown node type: "+t.type)}switch(CP+=k,T){case null:console.warn("[csstree-match] BREAK after "+a0+" iterations"),T=kP,R=null;break;case s0:for(;d!==null;)l();break;default:R=null}return{tokens:e,reason:T,iterations:k,match:R,longestMatch:D}}function xp(e,t,n){let r=FP(e,t,n||{});if(r.match===null)return r;let o=r.match,i=r.match={syntax:t.syntax||null,match:[]},s=[i];for(o=TP(o).prev;o!==null;){switch(o.type){case hp:i.match.push(i={syntax:o.syntax,match:[]}),s.push(i);break;case u0:s.pop(),i=s[s.length-1];break;default:i.match.push({syntax:o.syntax||null,token:o.token.value,node:o.token.node})}o=o.prev}return r}var i0,SP,wP,hp,u0,s0,vP,kP,a0,CP,p0=_(()=>{"use strict";fp();({hasOwnProperty:i0}=Object.prototype),SP=0,wP=1,hp=2,u0=3,s0="Match",vP="Mismatch",kP="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",a0=15e3,CP=0});var bp={};Se(bp,{getTrace:()=>d0,isKeyword:()=>PP,isProperty:()=>AP,isType:()=>EP});function d0(e){function t(o){return o===null?!1:o.type==="Type"||o.type==="Property"||o.type==="Keyword"}function n(o){if(Array.isArray(o.match)){for(let i=0;i<o.match.length;i++)if(n(o.match[i]))return t(o.syntax)&&r.unshift(o.syntax),!0}else if(o.node===e)return r=t(o.syntax)?[o.syntax]:[],!0;return!1}let r=null;return this.matched!==null&&n(this.matched),r}function EP(e,t){return yp(this,e,n=>n.type==="Type"&&n.name===t)}function AP(e,t){return yp(this,e,n=>n.type==="Property"&&n.name===t)}function PP(e){return yp(this,e,t=>t.type==="Keyword")}function yp(e,t,n){let r=d0.call(e,t);return r===null?!1:r.some(n)}var g0=_(()=>{"use strict"});function f0(e){return"node"in e?e.node:f0(e.match[0])}function m0(e){return"node"in e?e.node:m0(e.match[e.match.length-1])}function Sp(e,t,n,r,o){function i(a){if(a.syntax!==null&&a.syntax.type===r&&a.syntax.name===o){let u=f0(a),c=m0(a);e.syntax.walk(t,function(l,d,g){if(l===u){let p=new Xn;do{if(p.appendData(d.data),d.data===c)break;d=d.next}while(d!==null);s.push({parent:g,nodes:p})}})}Array.isArray(a.match)&&a.match.forEach(i)}let s=[];return n.matched!==null&&i(n.matched),s}var h0=_(()=>{"use strict";Ss()});function wp(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function x0(e){return!!e&&wp(e.offset)&&wp(e.line)&&wp(e.column)}function LP(e,t){return function(r,o){if(!r||r.constructor!==Object)return o(r,"Type of node should be an Object");for(let i in r){let s=!0;if(Bs.call(r,i)!==!1){if(i==="type")r.type!==e&&o(r,"Wrong node type `"+r.type+"`, expected `"+e+"`");else if(i==="loc"){if(r.loc===null)continue;if(r.loc&&r.loc.constructor===Object)if(typeof r.loc.source!="string")i+=".source";else if(!x0(r.loc.start))i+=".start";else if(!x0(r.loc.end))i+=".end";else continue;s=!1}else if(t.hasOwnProperty(i)){s=!1;for(let a=0;!s&&a<t[i].length;a++){let u=t[i][a];switch(u){case String:s=typeof r[i]=="string";break;case Boolean:s=typeof r[i]=="boolean";break;case null:s=r[i]===null;break;default:typeof u=="string"?s=r[i]&&r[i].type===u:Array.isArray(u)&&(s=r[i]instanceof Xn)}}}else o(r,"Unknown field `"+i+"` for "+e+" node type");s||o(r,"Bad value for `"+e+"."+i+"`")}}for(let i in t)Bs.call(t,i)&&Bs.call(r,i)===!1&&o(r,"Field `"+e+"."+i+"` is missed")}}function y0(e,t){let n=[];for(let r=0;r<e.length;r++){let o=e[r];if(o===String||o===Boolean)n.push(o.name.toLowerCase());else if(o===null)n.push("null");else if(typeof o=="string")n.push(o);else if(Array.isArray(o))n.push("List<"+(y0(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return n.join(" | ")}function MP(e,t){let n=t.structure,r={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in n){if(Bs.call(n,i)===!1)continue;let s=r[i]=Array.isArray(n[i])?n[i].slice():[n[i]];o[i]=y0(s,e+"."+i)}return{docs:o,check:LP(e,r)}}function b0(e){let t={};if(e.node){for(let n in e.node)if(Bs.call(e.node,n)){let r=e.node[n];if(r.structure)t[n]=MP(n,r);else throw new Error("Missed `structure` field in `"+n+"` node type definition")}}return t}var Bs,S0=_(()=>{"use strict";Ss();({hasOwnProperty:Bs}=Object.prototype)});function vp(e,t,n){let r={};for(let o in e)e[o].syntax&&(r[o]=n?e[o].syntax:wi(e[o].syntax,{compact:t}));return r}function BP(e,t,n){let r={};for(let[o,i]of Object.entries(e))r[o]={prelude:i.prelude&&(n?i.prelude.syntax:wi(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&vp(i.descriptors,t,n)};return r}function DP(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function RP(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function kr(e,t,n){return{matched:e,iterations:n,error:t,...bp}}function Ei(e,t,n,r){let o=t0(n,e.syntax),i;return DP(o)?kr(null,new Error("Matching for a tree with var() is not supported")):(r&&(i=xp(o,e.cssWideKeywordsSyntax,e)),(!r||!i.match)&&(i=xp(o,t.match,e),!i.match)?kr(null,new kb(i.reason,t.syntax,n,i),i.iterations):kr(i.match,null,i.iterations))}var Ds,w0=_(()=>{"use strict";Cb();yl();bl();Nb();Ob();dp();n0();fp();p0();g0();h0();S0();Ds=class{constructor(t,n,r){if(this.cssWideKeywords=Ci,this.syntax=n,this.generic=!1,this.units={...vl},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=r||b0(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(vl))Array.isArray(t.units[o])&&(this.units[o]=t.units[o]);if(t.types)for(let[o,i]of Object.entries(t.types))this.addType_(o,i);if(t.generic){this.generic=!0;for(let[o,i]of Object.entries(zb(this.units)))this.addType_(o,i)}if(t.atrules)for(let[o,i]of Object.entries(t.atrules))this.addAtrule_(o,i);if(t.properties)for(let[o,i]of Object.entries(t.properties))this.addProperty_(o,i)}this.cssWideKeywordsSyntax=Ms(this.cssWideKeywords.join(" | "))}checkStructure(t){function n(i,s){o.push({node:i,message:s})}let r=this.structure,o=[];return this.syntax.walk(t,function(i){r.hasOwnProperty(i.type)?r[i.type].check(i,n):n(i,"Unknown node type `"+i.type+"`")}),o.length?o:!1}createDescriptor(t,n,r,o=null){let i={type:n,name:r},s={type:n,name:r,parent:o,serializable:typeof t=="string"||t&&typeof t.type=="string",syntax:null,match:null,matchRef:null};return typeof t=="function"?s.match=Ms(t,i):(typeof t=="string"?Object.defineProperty(s,"syntax",{get(){return Object.defineProperty(s,"syntax",{value:As(t)}),s.syntax}}):s.syntax=t,Object.defineProperty(s,"match",{get(){return Object.defineProperty(s,"match",{value:Ms(s.syntax,i)}),s.match}}),n==="Property"&&Object.defineProperty(s,"matchRef",{get(){let a=s.syntax,u=RP(a)?Ms({...a,terms:[a.terms[0].term]},i):null;return Object.defineProperty(s,"matchRef",{value:u}),u}})),s}addAtrule_(t,n){n&&(this.atrules[t]={type:"Atrule",name:t,prelude:n.prelude?this.createDescriptor(n.prelude,"AtrulePrelude",t):null,descriptors:n.descriptors?Object.keys(n.descriptors).reduce((r,o)=>(r[o]=this.createDescriptor(n.descriptors[o],"AtruleDescriptor",o,t),r),Object.create(null)):null})}addProperty_(t,n){n&&(this.properties[t]=this.createDescriptor(n,"Property",t))}addType_(t,n){n&&(this.types[t]=this.createDescriptor(n,"Type",t))}checkAtruleName(t){if(!this.getAtrule(t))return new vi("Unknown at-rule","@"+t)}checkAtrulePrelude(t,n){let r=this.checkAtruleName(t);if(r)return r;let o=this.getAtrule(t);if(!o.prelude&&n)return new SyntaxError("At-rule `@"+t+"` should not contain a prelude");if(o.prelude&&!n&&!Ei(this,o.prelude,"",!1).matched)return new SyntaxError("At-rule `@"+t+"` should contain a prelude")}checkAtruleDescriptorName(t,n){let r=this.checkAtruleName(t);if(r)return r;let o=this.getAtrule(t),i=hl(n);if(!o.descriptors)return new SyntaxError("At-rule `@"+t+"` has no known descriptors");if(!o.descriptors[i.name]&&!o.descriptors[i.basename])return new vi("Unknown at-rule descriptor",n)}checkPropertyName(t){if(!this.getProperty(t))return new vi("Unknown property",t)}matchAtrulePrelude(t,n){let r=this.checkAtrulePrelude(t,n);if(r)return kr(null,r);let o=this.getAtrule(t);return o.prelude?Ei(this,o.prelude,n||"",!1):kr(null,null)}matchAtruleDescriptor(t,n,r){let o=this.checkAtruleDescriptorName(t,n);if(o)return kr(null,o);let i=this.getAtrule(t),s=hl(n);return Ei(this,i.descriptors[s.name]||i.descriptors[s.basename],r,!1)}matchDeclaration(t){return t.type!=="Declaration"?kr(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,n){if(Wu(t).custom)return kr(null,new Error("Lexer matching doesn't applicable for custom properties"));let r=this.checkPropertyName(t);return r?kr(null,r):Ei(this,this.getProperty(t),n,!0)}matchType(t,n){let r=this.getType(t);return r?Ei(this,r,n,!1):kr(null,new vi("Unknown type",t))}match(t,n){return typeof t!="string"&&(!t||!t.type)?kr(null,new vi("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),Ei(this,t,n,!1))}findValueFragments(t,n,r,o){return Sp(this,n,this.matchProperty(t,n),r,o)}findDeclarationValueFragments(t,n,r){return Sp(this,t.value,this.matchDeclaration(t),n,r)}findAllFragments(t,n,r){let o=[];return this.syntax.walk(t,{visit:"Declaration",enter:i=>{o.push.apply(o,this.findDeclarationValueFragments(i,n,r))}}),o}getAtrule(t,n=!0){let r=hl(t);return(r.vendor&&n?this.atrules[r.name]||this.atrules[r.basename]:this.atrules[r.name])||null}getAtrulePrelude(t,n=!0){let r=this.getAtrule(t,n);return r&&r.prelude||null}getAtruleDescriptor(t,n){return this.atrules.hasOwnProperty(t)&&this.atrules.declarators&&this.atrules[t].declarators[n]||null}getProperty(t,n=!0){let r=Wu(t);return(r.vendor&&n?this.properties[r.name]||this.properties[r.basename]:this.properties[r.name])||null}getType(t){return hasOwnProperty.call(this.types,t)?this.types[t]:null}validate(){function t(u,c){return c?`<${u}>`:`<'${u}'>`}function n(u,c,l,d){if(l.has(c))return l.get(c);l.set(c,!1),d.syntax!==null&&pp(d.syntax,function(g){if(g.type!=="Type"&&g.type!=="Property")return;let p=g.type==="Type"?u.types:u.properties,f=g.type==="Type"?o:i;hasOwnProperty.call(p,g.name)?n(u,g.name,f,p[g.name])&&(r.push(`${t(c,l===o)} used broken syntax definition ${t(g.name,g.type==="Type")}`),l.set(c,!0)):(r.push(`${t(c,l===o)} used missed syntax definition ${t(g.name,g.type==="Type")}`),l.set(c,!0))},this)}let r=[],o=new Map,i=new Map;for(let u in this.types)n(this,u,o,this.types[u]);for(let u in this.properties)n(this,u,i,this.properties[u]);let s=[...o.keys()].filter(u=>o.get(u)),a=[...i.keys()].filter(u=>i.get(u));return s.length||a.length?{errors:r,types:s,properties:a}:null}dump(t,n){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:vp(this.types,!n,t),properties:vp(this.properties,!n,t),atrules:BP(this.atrules,!n,t)}}toString(){return JSON.stringify(this.dump())}}});function kp(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function zP(e,t){let n=Object.create(null);for(let r of Object.keys(e))t.includes(r)&&(n[r]=e[r]);return n}function Cp(e,t,n){let r={...e};for(let[o,i]of Object.entries(t))r[o]={...r[o],...n?zP(i,n):i};return r}function Rs(e,t){let n={...e};for(let[r,o]of Object.entries(t))switch(r){case"generic":n[r]=!!o;break;case"cssWideKeywords":n[r]=e[r]?[...e[r],...o]:o||[];break;case"units":n[r]={...e[r]};for(let[i,s]of Object.entries(o))n[r][i]=Array.isArray(s)?s:[];break;case"atrules":n[r]={...e[r]};for(let[i,s]of Object.entries(o)){let a=n[r][i]||{},u=n[r][i]={prelude:a.prelude||null,descriptors:{...a.descriptors}};if(s){u.prelude=s.prelude?kp(u.prelude,s.prelude):u.prelude||null;for(let[c,l]of Object.entries(s.descriptors||{}))u.descriptors[c]=l?kp(u.descriptors[c],l):null;Object.keys(u.descriptors).length||(u.descriptors=null)}}break;case"types":case"properties":n[r]={...e[r]};for(let[i,s]of Object.entries(o))n[r][i]=kp(n[r][i],s);break;case"parseContext":n[r]={...e[r],...o};break;case"scope":case"features":n[r]=Cp(e[r],o);break;case"atrule":case"pseudo":n[r]=Cp(e[r],o,["parse"]);break;case"node":n[r]=Cp(e[r],o,["name","structure","parse","generate","walkContext"]);break}return n}var v0=_(()=>{"use strict"});function k0(e){let t=Oy(e),n=Sb(e),r=db(e),{fromPlainObject:o,toPlainObject:i}=fb(n),s={lexer:null,createLexer:a=>new Ds(a,s,s.lexer.structure),tokenize:wo,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:i,fork(a){let u=Rs({},e);return k0(typeof a=="function"?a(u):Rs(u,a))}};return s.lexer=new Ds({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var C0,T0=_(()=>{"use strict";sr();_y();gb();mb();wb();w0();v0();C0=e=>k0(Rs({},e))});var I0,F0=_(()=>{"use strict";I0={generic:!0,cssWideKeywords:["initial","inherit","unset","revert","revert-layer"],units:{angle:["deg","grad","rad","turn"],decibel:["db"],flex:["fr"],frequency:["hz","khz"],length:["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],resolution:["dpi","dpcm","dppx","x"],semitones:["st"],time:["s","ms"]},types:{"abs()":"abs( <calc-sum> )","absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large","acos()":"acos( <calc-sum> )","alpha-value":"<number>|<percentage>","an+b":"odd|even|<integer>|<n-dimension>|'+'? \u2020 n|-n|<ndashdigit-dimension>|'+'? \u2020 <ndashdigit-ident>|<dashndashdigit-ident>|<n-dimension> <signed-integer>|'+'? \u2020 n <signed-integer>|-n <signed-integer>|<ndash-dimension> <signless-integer>|'+'? \u2020 n- <signless-integer>|-n- <signless-integer>|<n-dimension> ['+'|'-'] <signless-integer>|'+'? \u2020 n ['+'|'-'] <signless-integer>|-n ['+'|'-'] <signless-integer>","anchor()":"anchor( <anchor-name>?&&<anchor-side> , <length-percentage>? )","anchor-name":"<dashed-ident>","anchor-side":"inside|outside|top|left|right|bottom|start|end|self-start|self-end|<percentage>|center","anchor-size":"width|height|block|inline|self-block|self-inline","anchor-size()":"anchor-size( [<anchor-name>||<anchor-size>]? , <length-percentage>? )","angle-percentage":"<angle>|<percentage>","angular-color-hint":"<angle-percentage>|<zero>","angular-color-stop":"<color> <color-stop-angle>?","angular-color-stop-list":"<angular-color-stop> , [<angular-color-hint>? , <angular-color-stop>]#?","animateable-feature":"scroll-position|contents|<custom-ident>","animation-action":"none|play|play-once|play-forwards|play-backwards|pause|reset|replay","asin()":"asin( <calc-sum> )","atan()":"atan( <calc-sum> )","atan2()":"atan2( <calc-sum> , <calc-sum> )",attachment:"scroll|fixed|local","attr()":"attr( <attr-name> <attr-type>? , <declaration-value>? )","attr-matcher":"['~'|'|'|'^'|'$'|'*']? '='","attr-modifier":"i|s","attr-type":"type( <syntax> )|raw-string|number|<attr-unit>","attribute-selector":"'[' <wq-name> ']'|'[' <wq-name> <attr-matcher> [<string-token>|<ident-token>] <attr-modifier>? ']'","auto-repeat":"repeat( [auto-fill|auto-fit] , [<line-names>? <fixed-size>]+ <line-names>? )","auto-track-list":"[<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>? <auto-repeat> [<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>?",axis:"block|inline|x|y","baseline-position":"[first|last]? baseline","basic-shape":"<inset()>|<xywh()>|<rect()>|<circle()>|<ellipse()>|<polygon()>|<path()>","basic-shape-rect":"<inset()>|<rect()>|<xywh()>","bg-clip":"<visual-box>|border-area|text","bg-image":"<image>|none","bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>","bg-position":"[[left|center|right|top|bottom|<length-percentage>]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]|[center|[left|right] <length-percentage>?]&&[center|[top|bottom] <length-percentage>?]]","bg-size":"[<length-percentage [0,\u221E]>|auto]{1,2}|cover|contain","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity","blur()":"blur( <length>? )","brightness()":"brightness( [<number>|<percentage>]? )","calc()":"calc( <calc-sum> )","calc-constant":"e|pi|infinity|-infinity|NaN","calc-product":"<calc-value> ['*' <calc-value>|'/' <number>]*","calc-size()":"calc-size( <calc-size-basis> , <calc-sum> )","calc-size-basis":"<intrinsic-size-keyword>|<calc-size()>|any|<calc-sum>","calc-sum":"<calc-product> [['+'|'-'] <calc-product>]*","calc-value":"<number>|<dimension>|<percentage>|<calc-constant>|( <calc-sum> )","cf-final-image":"<image>|<color>","cf-mixing-image":"<percentage>?&&<image>","circle()":"circle( <radial-size>? [at <position>]? )","clamp()":"clamp( <calc-sum>#{3} )","class-selector":"'.' <ident-token>","clip-source":"<url>",color:"<color-base>|currentColor|<system-color>|<device-cmyk()>|<light-dark()>|<-non-standard-color>","color()":"color( <colorspace-params> [/ [<alpha-value>|none]]? )","color-base":"<hex-color>|<color-function>|<named-color>|<color-mix()>|transparent","color-function":"<rgb()>|<rgba()>|<hsl()>|<hsla()>|<hwb()>|<lab()>|<lch()>|<oklab()>|<oklch()>|<color()>","color-interpolation-method":"in [<rectangular-color-space>|<polar-color-space> <hue-interpolation-method>?|<custom-color-space>]","color-mix()":"color-mix( <color-interpolation-method> , [<color>&&<percentage [0,100]>?]#{2} )","color-stop":"<color-stop-length>|<color-stop-angle>","color-stop-angle":"[<angle-percentage>|<zero>]{1,2}","color-stop-length":"<length-percentage>{1,2}","color-stop-list":"<linear-color-stop> , [<linear-color-hint>? , <linear-color-stop>]#?","colorspace-params":"[<predefined-rgb-params>|<xyz-params>]",combinator:"'>'|'+'|'~'|['|' '|']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat-auto":"searchfield|textarea|checkbox|radio|menulist|listbox|meter|progress-bar|button","compat-special":"textfield|menulist-button","complex-selector":"<complex-selector-unit> [<combinator>? <complex-selector-unit>]*","complex-selector-list":"<complex-selector>#","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[<type-selector>? <subclass-selector>*]!","compound-selector-list":"<compound-selector>#","conic-gradient()":"conic-gradient( [<conic-gradient-syntax>] )","conic-gradient-syntax":"[[[from [<angle>|<zero>]]? [at <position>]?]||<color-interpolation-method>]? , <angular-color-stop-list>","container-condition":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","container-name":"<custom-ident>","container-query":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[<string>|contents|<image>|<counter>|<quote>|<target>|<leader()>|<attr()>]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"<image>","contextual-alt-values":"[contextual|no-contextual]","contrast()":"contrast( [<number>|<percentage>]? )","coord-box":"content-box|padding-box|border-box|fill-box|stroke-box|view-box","corner-shape-value":"round|scoop|bevel|notch|square|squircle|<superellipse()>","cos()":"cos( <calc-sum> )",counter:"<counter()>|<counters()>","counter()":"counter( <counter-name> , <counter-style>? )","counter-name":"<custom-ident>","counter-style":"<counter-style-name>|symbols( )","counter-style-name":"<custom-ident>","counters()":"counters( <counter-name> , <string> , <counter-style>? )","cross-fade()":"cross-fade( <cf-mixing-image> , <cf-final-image>? )","cubic-bezier()":"cubic-bezier( [<number [0,1]> , <number>]#{2} )","cubic-bezier-easing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )","cursor-predefined":"auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing","custom-color-space":"<dashed-ident>","custom-params":"<dashed-ident> [<number>|<percentage>|none]+",dasharray:"[[<length-percentage>|<number>]+]#","dashndashdigit-ident":"<ident-token>","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonHighlight|ButtonShadow|CaptionText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"<display-outside>?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( [<color>?&&<length>{2,3}] )","dynamic-range-limit-mix()":"dynamic-range-limit-mix( [<'dynamic-range-limit'>&&<percentage [0,100]>]#{2,} )","easing-function":"<linear-easing-function>|<cubic-bezier-easing-function>|<step-easing-function>","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( <custom-ident> , [first|start|last|first-except]? )|element( <id-selector> )","ellipse()":"ellipse( <radial-size>? [at <position>]? )","env()":"env( <custom-ident> , <declaration-value>? )","exp()":"exp( <calc-sum> )","explicit-track-list":"[<line-names>? <track-size>]+ <line-names>?","family-name":"<string>|<custom-ident>+","feature-tag-value":"<string> [<integer>|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":"<feature-type> '{' <feature-value-declaration-list> '}'","feature-value-block-list":"<feature-value-block>+","feature-value-declaration":"<custom-ident> : <integer>+ ;","feature-value-declaration-list":"<feature-value-declaration>","feature-value-name":"<custom-ident>","filter-function":"<blur()>|<brightness()>|<contrast()>|<drop-shadow()>|<grayscale()>|<hue-rotate()>|<invert()>|<opacity()>|<saturate()>|<sepia()>","filter-value-list":"[<filter-function>|<url>]+","final-bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>||<'background-color'>","fit-content()":"fit-content( <length-percentage [0,\u221E]> )","fixed-breadth":"<length-percentage>","fixed-repeat":"repeat( [<integer [1,\u221E]>] , [<line-names>? <fixed-size>]+ <line-names>? )","fixed-size":"<fixed-breadth>|minmax( <fixed-breadth> , <track-breadth> )|minmax( <inflexible-breadth> , <fixed-breadth> )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|<percentage>","font-variant-css2":"normal|small-caps","font-weight-absolute":"normal|bold|<number [1,1000]>","font-width-css3":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","form-control-identifier":"select","frequency-percentage":"<frequency>|<percentage>","generic-complete":"serif|sans-serif|system-ui|cursive|fantasy|math|monospace","general-enclosed":"[<function-token> <any-value>? )]|[( <any-value>? )]","generic-family":"<generic-script-specific>|<generic-complete>|<generic-incomplete>|<-non-standard-generic-family>","generic-incomplete":"ui-serif|ui-sans-serif|ui-monospace|ui-rounded","geometry-box":"<shape-box>|fill-box|stroke-box|view-box",gradient:"<linear-gradient()>|<repeating-linear-gradient()>|<radial-gradient()>|<repeating-radial-gradient()>|<conic-gradient()>|<repeating-conic-gradient()>|<-legacy-gradient>","grayscale()":"grayscale( [<number>|<percentage>]? )","grid-line":"auto|<custom-ident>|[<integer>&&<custom-ident>?]|[span&&[<integer>||<custom-ident>]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsl( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hsla()":"hsla( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsla( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )",hue:"<number>|<angle>","hue-interpolation-method":"[shorter|longer|increasing|decreasing] hue","hue-rotate()":"hue-rotate( [<angle>|<zero>]? )","hwb()":"hwb( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hypot()":"hypot( <calc-sum># )",image:"<url>|<image()>|<image-set()>|<element()>|<paint()>|<cross-fade()>|<gradient>","image()":"image( <image-tags>? [<image-src>? , <color>?]! )","image-set()":"image-set( <image-set-option># )","image-set-option":"[<image>|<string>] [<resolution>||type( <string> )]","image-src":"<url>|<string>","image-tags":"ltr|rtl","inflexible-breadth":"<length-percentage>|min-content|max-content|auto","inset()":"inset( <length-percentage>{1,4} [round <'border-radius'>]? )","invert()":"invert( [<number>|<percentage>]? )","keyframe-block":"<keyframe-selector># { <declaration-list> }","keyframe-selector":"from|to|<percentage [0,100]>|<timeline-range-name> <percentage>","keyframes-name":"<custom-ident>|<string>","lab()":"lab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","layer()":"layer( <layer-name> )","layer-name":"<ident> ['.' <ident>]*","lch()":"lch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","leader()":"leader( <leader-type> )","leader-type":"dotted|solid|space|<string>","length-percentage":"<length>|<percentage>","light-dark()":"light-dark( <color> , <color> )","line-name-list":"[<line-names>|<name-repeat>]+","line-names":"'[' <custom-ident>* ']'","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"<length>|thin|medium|thick","linear()":"linear( [<number>&&<percentage>{0,2}]# )","linear-color-hint":"<length-percentage>","linear-color-stop":"<color> <color-stop-length>?","linear-easing-function":"linear|<linear()>","linear-gradient()":"linear-gradient( [<linear-gradient-syntax>] )","linear-gradient-syntax":"[[<angle>|<zero>|to <side-or-corner>]||<color-interpolation-method>]? , <color-stop-list>","log()":"log( <calc-sum> , <calc-sum>? )","mask-layer":"<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||<geometry-box>||[<geometry-box>|no-clip]||<compositing-operator>||<masking-mode>","mask-position":"[<length-percentage>|left|center|right] [<length-percentage>|top|center|bottom]?","mask-reference":"none|<image>|<mask-source>","mask-source":"<url>","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( <number>#{6} )","matrix3d()":"matrix3d( <number>#{16} )","max()":"max( <calc-sum># )","media-and":"<media-in-parens> [and <media-in-parens>]+","media-condition":"<media-not>|<media-and>|<media-or>|<media-in-parens>","media-condition-without-or":"<media-not>|<media-and>|<media-in-parens>","media-feature":"( [<mf-plain>|<mf-boolean>|<mf-range>] )","media-in-parens":"( <media-condition> )|<media-feature>|<general-enclosed>","media-not":"not <media-in-parens>","media-or":"<media-in-parens> [or <media-in-parens>]+","media-query":"<media-condition>|[not|only]? <media-type> [and <media-condition-without-or>]?","media-query-list":"<media-query>#","media-type":"<ident>","mf-boolean":"<mf-name>","mf-name":"<ident>","mf-plain":"<mf-name> : <mf-value>","mf-range":"<mf-name> ['<'|'>']? '='? <mf-value>|<mf-value> ['<'|'>']? '='? <mf-name>|<mf-value> '<' '='? <mf-name> '<' '='? <mf-value>|<mf-value> '>' '='? <mf-name> '>' '='? <mf-value>","mf-value":"<number>|<dimension>|<ident>|<ratio>","min()":"min( <calc-sum># )","minmax()":"minmax( [<length-percentage>|min-content|max-content|auto] , [<length-percentage>|<flex>|min-content|max-content|auto] )","mod()":"mod( <calc-sum> , <calc-sum> )","n-dimension":"<dimension-token>","name-repeat":"repeat( [<integer [1,\u221E]>|auto-fill] , <line-names>+ )","named-color":"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen","namespace-prefix":"<ident>","ndash-dimension":"<dimension-token>","ndashdigit-dimension":"<dimension-token>","ndashdigit-ident":"<ident-token>","ns-prefix":"[<ident-token>|'*']? '|'","number-percentage":"<number>|<percentage>","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]","offset-path":"<ray()>|<url>|<basic-shape>","oklab()":"oklab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","oklch()":"oklch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","opacity()":"opacity( [<number>|<percentage>]? )","opacity-value":"<number>|<percentage>","outline-line-style":"none|dotted|dashed|solid|double|groove|ridge|inset|outset","outline-radius":"<length>|<percentage>","overflow-position":"unsafe|safe","page-body":"<declaration>? [; <page-body>]?|<page-margin-box> <page-body>","page-margin-box":"<page-margin-box-type> '{' <declaration-list> '}'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector":"<pseudo-page>+|<ident> <pseudo-page>*","page-selector-list":"[<page-selector>#]?","page-size":"A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger",paint:"none|<color>|<url> [none|<color>]?|context-fill|context-stroke","paint()":"paint( <ident> , <declaration-value>? )","paint-box":"<visual-box>|fill-box|stroke-box","palette-identifier":"<dashed-ident>","palette-mix()":"palette-mix( <color-interpolation-method> , [[normal|light|dark|<palette-identifier>|<palette-mix()>]&&<percentage [0,100]>?]#{2} )","path()":"path( <'fill-rule'>? , <string> )","perspective()":"perspective( [<length [0,\u221E]>|none] )","polar-color-space":"hsl|hwb|lch|oklch","polygon()":"polygon( <'fill-rule'>? , [<length-percentage> <length-percentage>]# )",position:"[[left|center|right]||[top|center|bottom]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]?|[[left|right] <length-percentage>]&&[[top|bottom] <length-percentage>]]","position-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|center|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|center|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]","pow()":"pow( <calc-sum> , <calc-sum> )","predefined-rgb":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020","predefined-rgb-params":"<predefined-rgb> [<number>|<percentage>|none]{3}","pseudo-class-selector":"':' <ident-token>|':' <function-token> <any-value> ')'","pseudo-element-selector":"':' <pseudo-class-selector>|<legacy-pseudo-element-selector>","pseudo-page":": [left|right|first|blank]","query-in-parens":"( <container-condition> )|( <size-feature> )|style( <style-query> )|<general-enclosed>",quote:"open-quote|close-quote|no-open-quote|no-close-quote","radial-extent":"closest-corner|closest-side|farthest-corner|farthest-side","radial-gradient()":"radial-gradient( [<radial-gradient-syntax>] )","radial-gradient-syntax":"[[[<radial-shape>||<radial-size>]? [at <position>]?]||<color-interpolation-method>]? , <color-stop-list>","radial-shape":"circle|ellipse","radial-size":"<radial-extent>|<length [0,\u221E]>|<length-percentage [0,\u221E]>{2}",ratio:"<number [0,\u221E]> [/ <number [0,\u221E]>]?","ray()":"ray( <angle>&&<ray-size>?&&contain?&&[at <position>]? )","ray-size":"closest-side|closest-corner|farthest-side|farthest-corner|sides","rect()":"rect( [<length-percentage>|auto]{4} [round <'border-radius'>]? )","rectangular-color-space":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020|lab|oklab|xyz|xyz-d50|xyz-d65","relative-selector":"<combinator>? <complex-selector>","relative-selector-list":"<relative-selector>#","relative-size":"larger|smaller","rem()":"rem( <calc-sum> , <calc-sum> )","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-conic-gradient()":"repeating-conic-gradient( [<conic-gradient-syntax>] )","repeating-linear-gradient()":"repeating-linear-gradient( [<linear-gradient-syntax>] )","repeating-radial-gradient()":"repeating-radial-gradient( [<radial-gradient-syntax>] )","reversed-counter-name":"reversed( <counter-name> )","rgb()":"rgb( <percentage>#{3} , <alpha-value>? )|rgb( <number>#{3} , <alpha-value>? )|rgb( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rgba()":"rgba( <percentage>#{3} , <alpha-value>? )|rgba( <number>#{3} , <alpha-value>? )|rgba( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rotate()":"rotate( [<angle>|<zero>] )","rotate3d()":"rotate3d( <number> , <number> , <number> , [<angle>|<zero>] )","rotateX()":"rotateX( [<angle>|<zero>] )","rotateY()":"rotateY( [<angle>|<zero>] )","rotateZ()":"rotateZ( [<angle>|<zero>] )","round()":"round( <rounding-strategy>? , <calc-sum> , <calc-sum> )","rounding-strategy":"nearest|up|down|to-zero","saturate()":"saturate( [<number>|<percentage>]? )","scale()":"scale( [<number>|<percentage>]#{1,2} )","scale3d()":"scale3d( [<number>|<percentage>]#{3} )","scaleX()":"scaleX( [<number>|<percentage>] )","scaleY()":"scaleY( [<number>|<percentage>] )","scaleZ()":"scaleZ( [<number>|<percentage>] )","scope-end":"<forgiving-selector-list>","scope-start":"<forgiving-selector-list>","scroll()":"scroll( [<scroller>||<axis>]? )",scroller:"root|nearest|self","scroll-state-feature":"<media-query-list>","scroll-state-in-parens":"( <scroll-state-query> )|( <scroll-state-feature> )|<general-enclosed>","scroll-state-query":"not <scroll-state-in-parens>|<scroll-state-in-parens> [[and <scroll-state-in-parens>]*|[or <scroll-state-in-parens>]*]|<scroll-state-feature>","selector-list":"<complex-selector-list>","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","sepia()":"sepia( [<number>|<percentage>]? )",shadow:"inset?&&<length>{2,4}&&<color>?","shadow-t":"[<length>{2,3}&&<color>?]",shape:"rect( <top> , <right> , <bottom> , <left> )|rect( <top> <right> <bottom> <left> )","shape-box":"<visual-box>|margin-box","side-or-corner":"[left|right]||[top|bottom]","sign()":"sign( <calc-sum> )","signed-integer":"<number-token>","signless-integer":"<number-token>","sin()":"sin( <calc-sum> )","single-animation":"<'animation-duration'>||<easing-function>||<'animation-delay'>||<single-animation-iteration-count>||<single-animation-direction>||<single-animation-fill-mode>||<single-animation-play-state>||[none|<keyframes-name>]||<single-animation-timeline>","single-animation-composition":"replace|add|accumulate","single-animation-direction":"normal|reverse|alternate|alternate-reverse","single-animation-fill-mode":"none|forwards|backwards|both","single-animation-iteration-count":"infinite|<number>","single-animation-play-state":"running|paused","single-animation-timeline":"auto|none|<dashed-ident>|<scroll()>|<view()>","single-transition":"[none|<single-transition-property>]||<time>||<easing-function>||<time>||<transition-behavior-value>","single-transition-property":"all|<custom-ident>",size:"closest-side|farthest-side|closest-corner|farthest-corner|<length>|<length-percentage>{2}","size-feature":"<mf-plain>|<mf-boolean>|<mf-range>","skew()":"skew( [<angle>|<zero>] , [<angle>|<zero>]? )","skewX()":"skewX( [<angle>|<zero>] )","skewY()":"skewY( [<angle>|<zero>] )","sqrt()":"sqrt( <calc-sum> )","step-position":"jump-start|jump-end|jump-none|jump-both|start|end","step-easing-function":"step-start|step-end|<steps()>","steps()":"steps( <integer> , <step-position>? )","style-feature":"<declaration>","style-in-parens":"( <style-condition> )|( <style-feature> )|<general-enclosed>","style-query":"<style-condition>|<style-feature>","subclass-selector":"<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>","superellipse()":"superellipse( [<number>|infinity|-infinity] )","supports-condition":"not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*","supports-decl":"( <declaration> )","supports-feature":"<supports-decl>|<supports-selector-fn>","supports-in-parens":"( <supports-condition> )|<supports-feature>|<general-enclosed>","supports-selector-fn":"selector( <complex-selector> )",symbol:"<string>|<image>|<custom-ident>","symbols()":"symbols( <symbols-type>? [<string>|<image>]+ )","symbols-type":"cyclic|numeric|alphabetic|symbolic|fixed","system-color":"AccentColor|AccentColorText|ActiveText|ButtonBorder|ButtonFace|ButtonText|Canvas|CanvasText|Field|FieldText|GrayText|Highlight|HighlightText|LinkText|Mark|MarkText|SelectedItem|SelectedItemText|VisitedText","system-family-name":"caption|icon|menu|message-box|small-caption|status-bar","tan()":"tan( <calc-sum> )",target:"<target-counter()>|<target-counters()>|<target-text()>","target-counter()":"target-counter( [<string>|<url>] , <custom-ident> , <counter-style>? )","target-counters()":"target-counters( [<string>|<url>] , <custom-ident> , <string> , <counter-style>? )","target-text()":"target-text( [<string>|<url>] , [content|before|after|first-letter]? )","text-edge":"[text|cap|ex|ideographic|ideographic-ink] [text|alphabetic|ideographic|ideographic-ink]?","time-percentage":"<time>|<percentage>","timeline-range-name":"cover|contain|entry|exit|entry-crossing|exit-crossing","track-breadth":"<length-percentage>|<flex>|min-content|max-content|auto","track-list":"[<line-names>? [<track-size>|<track-repeat>]]+ <line-names>?","track-repeat":"repeat( [<integer [1,\u221E]>] , [<line-names>? <track-size>]+ <line-names>? )","track-size":"<track-breadth>|minmax( <inflexible-breadth> , <track-breadth> )|fit-content( <length-percentage> )","transform-function":"<matrix()>|<translate()>|<translateX()>|<translateY()>|<scale()>|<scaleX()>|<scaleY()>|<rotate()>|<skew()>|<skewX()>|<skewY()>|<matrix3d()>|<translate3d()>|<translateZ()>|<scale3d()>|<scaleZ()>|<rotate3d()>|<rotateX()>|<rotateY()>|<rotateZ()>|<perspective()>","transform-list":"<transform-function>+","transition-behavior-value":"normal|allow-discrete","translate()":"translate( <length-percentage> , <length-percentage>? )","translate3d()":"translate3d( <length-percentage> , <length-percentage> , <length> )","translateX()":"translateX( <length-percentage> )","translateY()":"translateY( <length-percentage> )","translateZ()":"translateZ( <length> )","try-size":"most-width|most-height|most-block-size|most-inline-size","try-tactic":"flip-block||flip-inline||flip-start","type-or-unit":"string|color|url|integer|number|length|angle|time|frequency|cap|ch|em|ex|ic|lh|rlh|rem|vb|vi|vw|vh|vmin|vmax|mm|Q|cm|in|pt|pc|px|deg|grad|rad|turn|ms|s|Hz|kHz|%","type-selector":"<wq-name>|<ns-prefix>? '*'","var()":"var( <custom-property-name> , <declaration-value>? )","view()":"view( [<axis>||<'view-timeline-inset'>]? )","viewport-length":"auto|<length-percentage>","visual-box":"content-box|padding-box|border-box","wq-name":"<ns-prefix>? <ident-token>","xywh()":"xywh( <length-percentage>{2} <length-percentage [0,\u221E]>{2} [round <'border-radius'>]? )",xyz:"xyz|xyz-d50|xyz-d65","xyz-params":"<xyz-space> [<number>|<percentage>|none]{3}","-legacy-gradient":"<-webkit-gradient()>|<-legacy-linear-gradient>|<-legacy-repeating-linear-gradient>|<-legacy-radial-gradient>|<-legacy-repeating-radial-gradient>","-legacy-linear-gradient":"-moz-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-repeating-linear-gradient":"-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-linear-gradient-arguments":"[<angle>|<side-or-corner>]? , <color-stop-list>","-legacy-radial-gradient":"-moz-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-repeating-radial-gradient":"-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-radial-gradient-arguments":"[<position> ,]? [[[<-legacy-radial-gradient-shape>||<-legacy-radial-gradient-size>]|[<length>|<percentage>]{2}] ,]? <color-stop-list>","-legacy-radial-gradient-size":"closest-side|closest-corner|farthest-side|farthest-corner|contain|cover","-legacy-radial-gradient-shape":"circle|ellipse","-non-standard-font":"-apple-system-body|-apple-system-headline|-apple-system-subheadline|-apple-system-caption1|-apple-system-caption2|-apple-system-footnote|-apple-system-short-body|-apple-system-short-headline|-apple-system-short-subheadline|-apple-system-short-caption1|-apple-system-short-footnote|-apple-system-tall-body","-non-standard-color":"-moz-ButtonDefault|-moz-ButtonHoverFace|-moz-ButtonHoverText|-moz-CellHighlight|-moz-CellHighlightText|-moz-Combobox|-moz-ComboboxText|-moz-Dialog|-moz-DialogText|-moz-dragtargetzone|-moz-EvenTreeRow|-moz-Field|-moz-FieldText|-moz-html-CellHighlight|-moz-html-CellHighlightText|-moz-mac-accentdarkestshadow|-moz-mac-accentdarkshadow|-moz-mac-accentface|-moz-mac-accentlightesthighlight|-moz-mac-accentlightshadow|-moz-mac-accentregularhighlight|-moz-mac-accentregularshadow|-moz-mac-chrome-active|-moz-mac-chrome-inactive|-moz-mac-focusring|-moz-mac-menuselect|-moz-mac-menushadow|-moz-mac-menutextselect|-moz-MenuHover|-moz-MenuHoverText|-moz-MenuBarText|-moz-MenuBarHoverText|-moz-nativehyperlinktext|-moz-OddTreeRow|-moz-win-communicationstext|-moz-win-mediatext|-moz-activehyperlinktext|-moz-default-background-color|-moz-default-color|-moz-hyperlinktext|-moz-visitedhyperlinktext|-webkit-activelink|-webkit-focus-ring-color|-webkit-link|-webkit-text","-non-standard-image-rendering":"optimize-contrast|-moz-crisp-edges|-o-crisp-edges|-webkit-optimize-contrast","-non-standard-overflow":"overlay|-moz-scrollbars-none|-moz-scrollbars-horizontal|-moz-scrollbars-vertical|-moz-hidden-unscrollable","-non-standard-size":"intrinsic|min-intrinsic|-webkit-fill-available|-webkit-fit-content|-webkit-min-content|-webkit-max-content|-moz-available|-moz-fit-content|-moz-min-content|-moz-max-content","-webkit-gradient()":"-webkit-gradient( <-webkit-gradient-type> , <-webkit-gradient-point> [, <-webkit-gradient-point>|, <-webkit-gradient-radius> , <-webkit-gradient-point>] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )","-webkit-gradient-color-stop":"from( <color> )|color-stop( [<number-zero-one>|<percentage>] , <color> )|to( <color> )","-webkit-gradient-point":"[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]","-webkit-gradient-radius":"<length>|<percentage>","-webkit-gradient-type":"linear|radial","-webkit-mask-box-repeat":"repeat|stretch|round","-ms-filter-function-list":"<-ms-filter-function>+","-ms-filter-function":"<-ms-filter-function-progid>|<-ms-filter-function-legacy>","-ms-filter-function-progid":"'progid:' [<ident-token> '.']* [<ident-token>|<function-token> <any-value>? )]","-ms-filter-function-legacy":"<ident-token>|<function-token> <any-value>? )",age:"child|young|old","attr-name":"<wq-name>","attr-fallback":"<any-value>",autospace:"no-autospace|[ideograph-alpha||ideograph-numeric||punctuation]||[insert|replace]",bottom:"<length>|auto","generic-voice":"[<age>? <gender> <integer>?]",gender:"male|female|neutral","generic-script-specific":"generic( kai )|generic( fangsong )|generic( nastaliq )","-non-standard-generic-family":"-apple-system|BlinkMacSystemFont","intrinsic-size-keyword":"min-content|max-content|fit-content",left:"<length>|auto","device-cmyk()":"<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>","legacy-device-cmyk-syntax":"device-cmyk( <number>#{4} )","modern-device-cmyk-syntax":"device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )","cmyk-component":"<number>|<percentage>|none","color-space":"<rectangular-color-space>|<polar-color-space>|<custom-color-space>",right:"<length>|auto","forgiving-selector-list":"<complex-real-selector-list>","forgiving-relative-selector-list":"<relative-real-selector-list>","complex-real-selector-list":"<complex-real-selector>#","simple-selector-list":"<simple-selector>#","relative-real-selector-list":"<relative-real-selector>#","complex-selector-unit":"[<compound-selector>? <pseudo-compound-selector>*]!","complex-real-selector":"<compound-selector> [<combinator>? <compound-selector>]*","relative-real-selector":"<combinator>? <complex-real-selector>","pseudo-compound-selector":"<pseudo-element-selector> <pseudo-class-selector>*","simple-selector":"<type-selector>|<subclass-selector>","legacy-pseudo-element-selector":"':' [before|after|first-line|first-letter]","svg-length":"<percentage>|<length>|<number>","svg-writing-mode":"lr-tb|rl-tb|tb-rl|lr|rl|tb",top:"<length>|auto",x:"<number>",y:"<number>",declaration:"<ident-token> : <declaration-value>? ['!' important]?","declaration-list":"[<declaration>? ';']* <declaration>?",url:"url( <string> <url-modifier>* )|<url-token>","url-modifier":"<ident>|<function-token> <any-value> )","number-zero-one":"<number [0,1]>","number-one-or-greater":"<number [1,\u221E]>","xyz-space":"xyz|xyz-d50|xyz-d65","style-condition":"not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]","-non-standard-display":"-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box","inset-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",syntax:"'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>","syntax-component":"<syntax-single-component> <syntax-multiplier>?|'<' transform-list '>'","syntax-single-component":"'<' <syntax-type-name> '>'|<ident>","syntax-type-name":"angle|color|custom-ident|image|integer|length|length-percentage|number|percentage|resolution|string|time|url|transform-function","syntax-combinator":"'|'","syntax-multiplier":"'#'|'+'","syntax-string":"<string>"},properties:{"--*":"<declaration-value>","-ms-accelerator":"false|true","-ms-block-progression":"tb|rl|bt|lr","-ms-content-zoom-chaining":"none|chained","-ms-content-zoom-limit":"<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>","-ms-content-zoom-limit-max":"<percentage>","-ms-content-zoom-limit-min":"<percentage>","-ms-content-zoom-snap":"<'-ms-content-zoom-snap-type'>||<'-ms-content-zoom-snap-points'>","-ms-content-zoom-snap-points":"snapInterval( <percentage> , <percentage> )|snapList( <percentage># )","-ms-content-zoom-snap-type":"none|proximity|mandatory","-ms-content-zooming":"none|zoom","-ms-filter":"<string>","-ms-flow-from":"[none|<custom-ident>]#","-ms-flow-into":"[none|<custom-ident>]#","-ms-grid-columns":"none|<track-list>|<auto-track-list>","-ms-grid-rows":"none|<track-list>|<auto-track-list>","-ms-high-contrast-adjust":"auto|none","-ms-hyphenate-limit-chars":"auto|<integer>{1,3}","-ms-hyphenate-limit-lines":"no-limit|<integer>","-ms-hyphenate-limit-zone":"<percentage>|<length>","-ms-ime-align":"auto|after","-ms-overflow-style":"auto|none|scrollbar|-ms-autohiding-scrollbar","-ms-scroll-chaining":"chained|none","-ms-scroll-limit":"<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>","-ms-scroll-limit-x-max":"auto|<length>","-ms-scroll-limit-x-min":"<length>","-ms-scroll-limit-y-max":"auto|<length>","-ms-scroll-limit-y-min":"<length>","-ms-scroll-rails":"none|railed","-ms-scroll-snap-points-x":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-points-y":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-type":"none|proximity|mandatory","-ms-scroll-snap-x":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>","-ms-scroll-snap-y":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>","-ms-scroll-translation":"none|vertical-to-horizontal","-ms-scrollbar-3dlight-color":"<color>","-ms-scrollbar-arrow-color":"<color>","-ms-scrollbar-base-color":"<color>","-ms-scrollbar-darkshadow-color":"<color>","-ms-scrollbar-face-color":"<color>","-ms-scrollbar-highlight-color":"<color>","-ms-scrollbar-shadow-color":"<color>","-ms-scrollbar-track-color":"<color>","-ms-text-autospace":"none|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space","-ms-touch-select":"grippers|none","-ms-user-select":"none|element|text","-ms-wrap-flow":"auto|both|start|end|maximum|clear","-ms-wrap-margin":"<length>","-ms-wrap-through":"wrap|none","-moz-appearance":"none|button|button-arrow-down|button-arrow-next|button-arrow-previous|button-arrow-up|button-bevel|button-focus|caret|checkbox|checkbox-container|checkbox-label|checkmenuitem|dualbutton|groupbox|listbox|listitem|menuarrow|menubar|menucheckbox|menuimage|menuitem|menuitemtext|menulist|menulist-button|menulist-text|menulist-textfield|menupopup|menuradio|menuseparator|meterbar|meterchunk|progressbar|progressbar-vertical|progresschunk|progresschunk-vertical|radio|radio-container|radio-label|radiomenuitem|range|range-thumb|resizer|resizerpanel|scale-horizontal|scalethumbend|scalethumb-horizontal|scalethumbstart|scalethumbtick|scalethumb-vertical|scale-vertical|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|separator|sheet|spinner|spinner-downbutton|spinner-textfield|spinner-upbutton|splitter|statusbar|statusbarpanel|tab|tabpanel|tabpanels|tab-scroll-arrow-back|tab-scroll-arrow-forward|textfield|textfield-multiline|toolbar|toolbarbutton|toolbarbutton-dropdown|toolbargripper|toolbox|tooltip|treeheader|treeheadercell|treeheadersortarrow|treeitem|treeline|treetwisty|treetwistyopen|treeview|-moz-mac-unified-toolbar|-moz-win-borderless-glass|-moz-win-browsertabbar-toolbox|-moz-win-communicationstext|-moz-win-communications-toolbox|-moz-win-exclude-glass|-moz-win-glass|-moz-win-mediatext|-moz-win-media-toolbox|-moz-window-button-box|-moz-window-button-box-maximized|-moz-window-button-close|-moz-window-button-maximize|-moz-window-button-minimize|-moz-window-button-restore|-moz-window-frame-bottom|-moz-window-frame-left|-moz-window-frame-right|-moz-window-titlebar|-moz-window-titlebar-maximized","-moz-binding":"<url>|none","-moz-border-bottom-colors":"<color>+|none","-moz-border-left-colors":"<color>+|none","-moz-border-right-colors":"<color>+|none","-moz-border-top-colors":"<color>+|none","-moz-context-properties":"none|[fill|fill-opacity|stroke|stroke-opacity]#","-moz-float-edge":"border-box|content-box|margin-box|padding-box","-moz-force-broken-image-icon":"0|1","-moz-orient":"inline|block|horizontal|vertical","-moz-outline-radius":"<outline-radius>{1,4} [/ <outline-radius>{1,4}]?","-moz-outline-radius-bottomleft":"<outline-radius>","-moz-outline-radius-bottomright":"<outline-radius>","-moz-outline-radius-topleft":"<outline-radius>","-moz-outline-radius-topright":"<outline-radius>","-moz-stack-sizing":"ignore|stretch-to-fit","-moz-text-blink":"none|blink","-moz-user-focus":"ignore|normal|select-after|select-before|select-menu|select-same|select-all|none","-moz-user-input":"auto|none|enabled|disabled","-moz-user-modify":"read-only|read-write|write-only","-moz-window-dragging":"drag|no-drag","-moz-window-shadow":"default|menu|tooltip|sheet|none","-webkit-appearance":"none|button|button-bevel|caps-lock-indicator|caret|checkbox|default-button|inner-spin-button|listbox|listitem|media-controls-background|media-controls-fullscreen-background|media-current-time-display|media-enter-fullscreen-button|media-exit-fullscreen-button|media-fullscreen-button|media-mute-button|media-overlay-play-button|media-play-button|media-seek-back-button|media-seek-forward-button|media-slider|media-sliderthumb|media-time-remaining-display|media-toggle-closed-captions-button|media-volume-slider|media-volume-slider-container|media-volume-sliderthumb|menulist|menulist-button|menulist-text|menulist-textfield|meter|progress-bar|progress-bar-value|push-button|radio|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbargripper-horizontal|scrollbargripper-vertical|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|searchfield-cancel-button|searchfield-decoration|searchfield-results-button|searchfield-results-decoration|slider-horizontal|slider-vertical|sliderthumb-horizontal|sliderthumb-vertical|square-button|textarea|textfield|-apple-pay-button","-webkit-border-before":"<'border-width'>||<'border-style'>||<color>","-webkit-border-before-color":"<color>","-webkit-border-before-style":"<'border-style'>","-webkit-border-before-width":"<'border-width'>","-webkit-box-reflect":"[above|below|right|left]? <length>? <image>?","-webkit-line-clamp":"none|<integer>","-webkit-mask":"[<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||[<visual-box>|border|padding|content|text]||[<visual-box>|border|padding|content]]#","-webkit-mask-attachment":"<attachment>#","-webkit-mask-clip":"[<coord-box>|no-clip|border|padding|content|text]#","-webkit-mask-composite":"<composite-style>#","-webkit-mask-image":"<mask-reference>#","-webkit-mask-origin":"[<coord-box>|border|padding|content]#","-webkit-mask-position":"<position>#","-webkit-mask-position-x":"[<length-percentage>|left|center|right]#","-webkit-mask-position-y":"[<length-percentage>|top|center|bottom]#","-webkit-mask-repeat":"<repeat-style>#","-webkit-mask-repeat-x":"repeat|no-repeat|space|round","-webkit-mask-repeat-y":"repeat|no-repeat|space|round","-webkit-mask-size":"<bg-size>#","-webkit-overflow-scrolling":"auto|touch","-webkit-tap-highlight-color":"<color>","-webkit-text-fill-color":"<color>","-webkit-text-stroke":"<length>||<color>","-webkit-text-stroke-color":"<color>","-webkit-text-stroke-width":"<length>","-webkit-touch-callout":"default|none","-webkit-user-modify":"read-only|read-write|read-write-plaintext-only","-webkit-user-select":"auto|none|text|all","accent-color":"auto|<color>","align-content":"normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>","align-items":"normal|stretch|<baseline-position>|[<overflow-position>? <self-position>]|anchor-center","align-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? <self-position>|anchor-center","align-tracks":"[normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>]#","alignment-baseline":"auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical",all:"initial|inherit|unset|revert|revert-layer","anchor-name":"none|<dashed-ident>#","anchor-scope":"none|all|<dashed-ident>#",animation:"<single-animation>#","animation-composition":"<single-animation-composition>#","animation-delay":"<time>#","animation-direction":"<single-animation-direction>#","animation-duration":"[auto|<time [0s,\u221E]>]#","animation-fill-mode":"<single-animation-fill-mode>#","animation-iteration-count":"<single-animation-iteration-count>#","animation-name":"[none|<keyframes-name>]#","animation-play-state":"<single-animation-play-state>#","animation-range":"[<'animation-range-start'> <'animation-range-end'>?]#","animation-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-timeline":"<single-animation-timeline>#","animation-timing-function":"<easing-function>#","animation-trigger":"[none|[<dashed-ident> <animation-action>+]+]#",appearance:"none|auto|<compat-auto>|<compat-special>","aspect-ratio":"auto||<ratio>","backdrop-filter":"none|<filter-value-list>","backface-visibility":"visible|hidden",background:"<bg-layer>#? , <final-bg-layer>","background-attachment":"<attachment>#","background-blend-mode":"<blend-mode>#","background-clip":"<bg-clip>#","background-color":"<color>","background-image":"<bg-image>#","background-origin":"<visual-box>#","background-position":"<bg-position>#","background-position-x":"[center|[[left|right|x-start|x-end]? <length-percentage>?]!]#","background-position-y":"[center|[[top|bottom|y-start|y-end]? <length-percentage>?]!]#","background-repeat":"<repeat-style>#","background-size":"<bg-size>#","baseline-shift":"baseline|sub|super|<svg-length>","baseline-source":"auto|first|last","block-size":"<'width'>",border:"<line-width>||<line-style>||<color>","border-block":"<'border-block-start'>","border-block-color":"<'border-top-color'>{1,2}","border-block-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-end-color":"<'border-top-color'>","border-block-end-style":"<'border-top-style'>","border-block-end-width":"<'border-top-width'>","border-block-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-start-color":"<'border-top-color'>","border-block-start-style":"<'border-top-style'>","border-block-start-width":"<'border-top-width'>","border-block-style":"<'border-top-style'>{1,2}","border-block-width":"<'border-top-width'>{1,2}","border-bottom":"<line-width>||<line-style>||<color>","border-bottom-color":"<'border-top-color'>","border-bottom-left-radius":"<length-percentage [0,\u221E]>{1,2}","border-bottom-right-radius":"<length-percentage [0,\u221E]>{1,2}","border-bottom-style":"<line-style>","border-bottom-width":"<line-width>","border-collapse":"separate|collapse","border-color":"<color>{1,4}","border-end-end-radius":"<'border-top-left-radius'>","border-end-start-radius":"<'border-top-left-radius'>","border-image":"<'border-image-source'>||<'border-image-slice'> [/ <'border-image-width'>|/ <'border-image-width'>? / <'border-image-outset'>]?||<'border-image-repeat'>","border-image-outset":"[<length [0,\u221E]>|<number [0,\u221E]>]{1,4}","border-image-repeat":"[stretch|repeat|round|space]{1,2}","border-image-slice":"[<number [0,\u221E]>|<percentage [0,\u221E]>]{1,4}&&fill?","border-image-source":"none|<image>","border-image-width":"[<length-percentage [0,\u221E]>|<number [0,\u221E]>|auto]{1,4}","border-inline":"<'border-block-start'>","border-inline-color":"<'border-top-color'>{1,2}","border-inline-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-end-color":"<'border-top-color'>","border-inline-end-style":"<'border-top-style'>","border-inline-end-width":"<'border-top-width'>","border-inline-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-start-color":"<'border-top-color'>","border-inline-start-style":"<'border-top-style'>","border-inline-start-width":"<'border-top-width'>","border-inline-style":"<'border-top-style'>{1,2}","border-inline-width":"<'border-top-width'>{1,2}","border-left":"<line-width>||<line-style>||<color>","border-left-color":"<color>","border-left-style":"<line-style>","border-left-width":"<line-width>","border-radius":"<length-percentage [0,\u221E]>{1,4} [/ <length-percentage [0,\u221E]>{1,4}]?","border-right":"<line-width>||<line-style>||<color>","border-right-color":"<color>","border-right-style":"<line-style>","border-right-width":"<line-width>","border-spacing":"<length>{1,2}","border-start-end-radius":"<'border-top-left-radius'>","border-start-start-radius":"<'border-top-left-radius'>","border-style":"<line-style>{1,4}","border-top":"<line-width>||<line-style>||<color>","border-top-color":"<color>","border-top-left-radius":"<length-percentage [0,\u221E]>{1,2}","border-top-right-radius":"<length-percentage [0,\u221E]>{1,2}","border-top-style":"<line-style>","border-top-width":"<line-width>","border-width":"<line-width>{1,4}",bottom:"auto|<length-percentage>|<anchor()>|<anchor-size()>","box-align":"start|center|end|baseline|stretch","box-decoration-break":"slice|clone","box-direction":"normal|reverse|inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single|multiple","box-ordinal-group":"<integer>","box-orient":"horizontal|vertical|inline-axis|block-axis|inherit","box-pack":"start|center|end|justify","box-shadow":"none|<shadow>#","box-sizing":"content-box|border-box","break-after":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-before":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-inside":"auto|avoid|avoid-page|avoid-column|avoid-region","caption-side":"top|bottom",caret:"<'caret-color'>||<'caret-animation'>||<'caret-shape'>","caret-animation":"auto|manual","caret-color":"auto|<color>","caret-shape":"auto|bar|block|underscore",clear:"none|left|right|both|inline-start|inline-end",clip:"<shape>|auto","clip-path":"<clip-source>|[<basic-shape>||<geometry-box>]|none","clip-rule":"nonzero|evenodd",color:"<color>","color-interpolation-filters":"auto|sRGB|linearRGB","color-scheme":"normal|[light|dark|<custom-ident>]+&&only?","column-count":"<integer>|auto","column-fill":"auto|balance","column-gap":"normal|<length-percentage>","column-height":"auto|<length [0,\u221E]>","column-rule":"<'column-rule-width'>||<'column-rule-style'>||<'column-rule-color'>","column-rule-color":"<color>","column-rule-style":"<'border-style'>","column-rule-width":"<'border-width'>","column-span":"none|all","column-width":"auto|<length [0,\u221E]>","column-wrap":"auto|nowrap|wrap",columns:"[<'column-width'>||<'column-count'>] [/ <'column-height'>]?",contain:"none|strict|content|[[size||inline-size]||layout||style||paint]","contain-intrinsic-block-size":"auto? [none|<length>]","contain-intrinsic-height":"auto? [none|<length>]","contain-intrinsic-inline-size":"auto? [none|<length>]","contain-intrinsic-size":"[auto? [none|<length>]]{1,2}","contain-intrinsic-width":"auto? [none|<length>]",container:"<'container-name'> [/ <'container-type'>]?","container-name":"none|<custom-ident>+","container-type":"normal||[size|inline-size]",content:"normal|none|[<content-replacement>|<content-list>] [/ [<string>|<counter>|<attr()>]+]?","content-visibility":"visible|auto|hidden","corner-block-end-shape":"<corner-shape-value>{1,2}","corner-block-start-shape":"<corner-shape-value>{1,2}","corner-bottom-shape":"<corner-shape-value>{1,2}","corner-bottom-left-shape":"<corner-shape-value>","corner-bottom-right-shape":"<corner-shape-value>","corner-end-end-shape":"<corner-shape-value>","corner-end-start-shape":"<corner-shape-value>","corner-inline-end-shape":"<corner-shape-value>{1,2}","corner-inline-start-shape":"<corner-shape-value>{1,2}","corner-left-shape":"<corner-shape-value>{1,2}","corner-right-shape":"<corner-shape-value>{1,2}","corner-shape":"<corner-shape-value>{1,4}","corner-start-start-shape":"<corner-shape-value>","corner-start-end-shape":"<corner-shape-value>","corner-top-shape":"<corner-shape-value>{1,2}","corner-top-left-shape":"<corner-shape-value>","corner-top-right-shape":"<corner-shape-value>","counter-increment":"[<counter-name> <integer>?]+|none","counter-reset":"[<counter-name> <integer>?|<reversed-counter-name> <integer>?]+|none","counter-set":"[<counter-name> <integer>?]+|none",cursor:"[[<url> [<x> <y>]? ,]* [auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing|hand|-webkit-grab|-webkit-grabbing|-webkit-zoom-in|-webkit-zoom-out|-moz-grab|-moz-grabbing|-moz-zoom-in|-moz-zoom-out]]",cx:"<length>|<percentage>",cy:"<length>|<percentage>",d:"none|path( <string> )",direction:"ltr|rtl",display:"[<display-outside>||<display-inside>]|<display-listitem>|<display-internal>|<display-box>|<display-legacy>|<-non-standard-display>","dominant-baseline":"auto|use-script|no-change|reset-size|ideographic|alphabetic|hanging|mathematical|central|middle|text-after-edge|text-before-edge","dynamic-range-limit":"standard|no-limit|constrained|<dynamic-range-limit-mix()>","empty-cells":"show|hide","field-sizing":"content|fixed",fill:"<paint>","fill-opacity":"<number-zero-one>|<percentage>","fill-rule":"nonzero|evenodd",filter:"none|<filter-value-list>|<-ms-filter-function-list>",flex:"none|[<'flex-grow'> <'flex-shrink'>?||<'flex-basis'>]","flex-basis":"content|<'width'>","flex-direction":"row|row-reverse|column|column-reverse","flex-flow":"<'flex-direction'>||<'flex-wrap'>","flex-grow":"<number>","flex-shrink":"<number>","flex-wrap":"nowrap|wrap|wrap-reverse",float:"left|right|none|inline-start|inline-end","flood-color":"<color>","flood-opacity":"<'opacity'>",font:"[[<'font-style'>||<font-variant-css2>||<'font-weight'>||<font-width-css3>]? <'font-size'> [/ <'line-height'>]? <'font-family'>#]|<system-family-name>|<-non-standard-font>","font-family":"[<family-name>|<generic-family>]#","font-feature-settings":"normal|<feature-tag-value>#","font-kerning":"auto|normal|none","font-language-override":"normal|<string>","font-optical-sizing":"auto|none","font-palette":"normal|light|dark|<palette-identifier>|<palette-mix()>","font-size":"<absolute-size>|<relative-size>|<length-percentage [0,\u221E]>|math","font-size-adjust":"none|[ex-height|cap-height|ch-width|ic-width|ic-height]? [from-font|<number>]","font-smooth":"auto|never|always|<absolute-size>|<length>","font-stretch":"<font-stretch-absolute>","font-style":"normal|italic|oblique <angle>?","font-synthesis":"none|[weight||style||small-caps||position]","font-synthesis-position":"auto|none","font-synthesis-small-caps":"auto|none","font-synthesis-style":"auto|none","font-synthesis-weight":"auto|none","font-variant":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>||stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )||[small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps]||<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero||<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-alternates":"normal|[stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )]","font-variant-caps":"normal|small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","font-variant-east-asian":"normal|[<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-emoji":"normal|text|emoji|unicode","font-variant-ligatures":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>]","font-variant-numeric":"normal|[<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero]","font-variant-position":"normal|sub|super","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>|bolder|lighter","font-width":"normal|<percentage [0,\u221E]>|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","forced-color-adjust":"auto|none|preserve-parent-color",gap:"<'row-gap'> <'column-gap'>?",grid:"<'grid-template'>|<'grid-template-rows'> / [auto-flow&&dense?] <'grid-auto-columns'>?|[auto-flow&&dense?] <'grid-auto-rows'>? / <'grid-template-columns'>","grid-area":"<grid-line> [/ <grid-line>]{0,3}","grid-auto-columns":"<track-size>+","grid-auto-flow":"[row|column]||dense","grid-auto-rows":"<track-size>+","grid-column":"<grid-line> [/ <grid-line>]?","grid-column-end":"<grid-line>","grid-column-gap":"<length-percentage>","grid-column-start":"<grid-line>","grid-gap":"<'grid-row-gap'> <'grid-column-gap'>?","grid-row":"<grid-line> [/ <grid-line>]?","grid-row-end":"<grid-line>","grid-row-gap":"<length-percentage>","grid-row-start":"<grid-line>","grid-template":"none|[<'grid-template-rows'> / <'grid-template-columns'>]|[<line-names>? <string> <track-size>? <line-names>?]+ [/ <explicit-track-list>]?","grid-template-areas":"none|<string>+","grid-template-columns":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","grid-template-rows":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","hanging-punctuation":"none|[first||[force-end|allow-end]||last]",height:"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","hyphenate-character":"auto|<string>","hyphenate-limit-chars":"[auto|<integer>]{1,3}",hyphens:"none|manual|auto","image-orientation":"from-image|<angle>|[<angle>? flip]","image-rendering":"auto|crisp-edges|pixelated|smooth|optimizeSpeed|optimizeQuality|<-non-standard-image-rendering>","image-resolution":"[from-image||<resolution>]&&snap?","ime-mode":"auto|normal|active|inactive|disabled","initial-letter":"normal|[<number> <integer>?]","initial-letter-align":"[auto|alphabetic|hanging|ideographic]","inline-size":"<'width'>",inset:"<'top'>{1,4}","inset-block":"<'top'>{1,2}","inset-block-end":"<'top'>","inset-block-start":"<'top'>","inset-inline":"<'top'>{1,2}","inset-inline-end":"<'top'>","inset-inline-start":"<'top'>","interpolate-size":"numeric-only|allow-keywords",isolation:"auto|isolate",interactivity:"auto|inert","interest-delay":"<'interest-delay-start'>{1,2}","interest-delay-end":"normal|<time>","interest-delay-start":"normal|<time>","justify-content":"normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]","justify-items":"normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|legacy|legacy&&[left|right|center]|anchor-center","justify-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|anchor-center","justify-tracks":"[normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]]#",left:"auto|<length-percentage>|<anchor()>|<anchor-size()>","letter-spacing":"normal|<length-percentage>","lighting-color":"<color>","line-break":"auto|loose|normal|strict|anywhere","line-clamp":"none|<integer>","line-height":"normal|<number>|<length>|<percentage>","line-height-step":"<length>","list-style":"<'list-style-type'>||<'list-style-position'>||<'list-style-image'>","list-style-image":"<image>|none","list-style-position":"inside|outside","list-style-type":"<counter-style>|<string>|none",margin:"<'margin-top'>{1,4}","margin-block":"<'margin-top'>{1,2}","margin-block-end":"<'margin-top'>","margin-block-start":"<'margin-top'>","margin-bottom":"<length-percentage>|auto|<anchor-size()>","margin-inline":"<'margin-top'>{1,2}","margin-inline-end":"<'margin-top'>","margin-inline-start":"<'margin-top'>","margin-left":"<length-percentage>|auto|<anchor-size()>","margin-right":"<length-percentage>|auto|<anchor-size()>","margin-top":"<length-percentage>|auto|<anchor-size()>","margin-trim":"none|in-flow|all",marker:"none|<url>","marker-end":"none|<url>","marker-mid":"none|<url>","marker-start":"none|<url>",mask:"<mask-layer>#","mask-border":"<'mask-border-source'>||<'mask-border-slice'> [/ <'mask-border-width'>? [/ <'mask-border-outset'>]?]?||<'mask-border-repeat'>||<'mask-border-mode'>","mask-border-mode":"luminance|alpha","mask-border-outset":"[<length>|<number>]{1,4}","mask-border-repeat":"[stretch|repeat|round|space]{1,2}","mask-border-slice":"<number-percentage>{1,4} fill?","mask-border-source":"none|<image>","mask-border-width":"[<length-percentage>|<number>|auto]{1,4}","mask-clip":"[<coord-box>|no-clip]#","mask-composite":"<compositing-operator>#","mask-image":"<mask-reference>#","mask-mode":"<masking-mode>#","mask-origin":"<coord-box>#","mask-position":"<position>#","mask-repeat":"<repeat-style>#","mask-size":"<bg-size>#","mask-type":"luminance|alpha","masonry-auto-flow":"[pack|next]||[definite-first|ordered]","math-depth":"auto-add|add( <integer> )|<integer>","math-shift":"normal|compact","math-style":"normal|compact","max-block-size":"<'max-width'>","max-height":"none|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","max-inline-size":"<'max-width'>","max-lines":"none|<integer>","max-width":"none|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-block-size":"<'min-width'>","min-height":"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-inline-size":"<'min-width'>","min-width":"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","mix-blend-mode":"<blend-mode>|plus-darker|plus-lighter","object-fit":"fill|contain|cover|none|scale-down","object-position":"<position>","object-view-box":"none|<basic-shape-rect>",offset:"[<'offset-position'>? [<'offset-path'> [<'offset-distance'>||<'offset-rotate'>]?]?]! [/ <'offset-anchor'>]?","offset-anchor":"auto|<position>","offset-distance":"<length-percentage>","offset-path":"none|<offset-path>||<coord-box>","offset-position":"normal|auto|<position>","offset-rotate":"[auto|reverse]||<angle>",opacity:"<opacity-value>",order:"<integer>",orphans:"<integer>",outline:"<'outline-width'>||<'outline-style'>||<'outline-color'>","outline-color":"auto|<color>","outline-offset":"<length>","outline-style":"auto|<outline-line-style>","outline-width":"<line-width>",overflow:"[visible|hidden|clip|scroll|auto]{1,2}|<-non-standard-overflow>","overflow-anchor":"auto|none","overflow-block":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-clip-box":"padding-box|content-box","overflow-clip-margin":"<visual-box>||<length [0,\u221E]>","overflow-inline":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-wrap":"normal|break-word|anywhere","overflow-x":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-y":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>",overlay:"none|auto","overscroll-behavior":"[contain|none|auto]{1,2}","overscroll-behavior-block":"contain|none|auto","overscroll-behavior-inline":"contain|none|auto","overscroll-behavior-x":"contain|none|auto","overscroll-behavior-y":"contain|none|auto",padding:"<'padding-top'>{1,4}","padding-block":"<'padding-top'>{1,2}","padding-block-end":"<'padding-top'>","padding-block-start":"<'padding-top'>","padding-bottom":"<length-percentage [0,\u221E]>","padding-inline":"<'padding-top'>{1,2}","padding-inline-end":"<'padding-top'>","padding-inline-start":"<'padding-top'>","padding-left":"<length-percentage [0,\u221E]>","padding-right":"<length-percentage [0,\u221E]>","padding-top":"<length-percentage [0,\u221E]>",page:"auto|<custom-ident>","page-break-after":"auto|always|avoid|left|right|recto|verso","page-break-before":"auto|always|avoid|left|right|recto|verso","page-break-inside":"auto|avoid","paint-order":"normal|[fill||stroke||markers]",perspective:"none|<length>","perspective-origin":"<position>","place-content":"<'align-content'> <'justify-content'>?","place-items":"<'align-items'> <'justify-items'>?","place-self":"<'align-self'> <'justify-self'>?","pointer-events":"auto|none|visiblePainted|visibleFill|visibleStroke|visible|painted|fill|stroke|all|inherit",position:"static|relative|absolute|sticky|fixed|-webkit-sticky","position-anchor":"auto|none|<anchor-name>","position-area":"none|<position-area>","position-try":"<'position-try-order'>? <'position-try-fallbacks'>","position-try-fallbacks":"none|[[<dashed-ident>||<try-tactic>]|<'position-area'>]#","position-try-order":"normal|<try-size>","position-visibility":"always|[anchors-valid||anchors-visible||no-overflow]","print-color-adjust":"economy|exact",quotes:"none|auto|[<string> <string>]+",r:"<length>|<percentage>","reading-flow":"normal|source-order|flex-visual|flex-flow|grid-rows|grid-columns|grid-order","reading-order":"<integer>",resize:"none|both|horizontal|vertical|block|inline",right:"auto|<length-percentage>|<anchor()>|<anchor-size()>",rotate:"none|<angle>|[x|y|z|<number>{3}]&&<angle>","row-gap":"normal|<length-percentage>","ruby-align":"start|center|space-between|space-around","ruby-merge":"separate|collapse|auto","ruby-overhang":"auto|none","ruby-position":"[alternate||[over|under]]|inter-character",rx:"<length>|<percentage>",ry:"<length>|<percentage>",scale:"none|[<number>|<percentage>]{1,3}","scroll-behavior":"auto|smooth","scroll-initial-target":"none|nearest","scroll-margin":"<length>{1,4}","scroll-margin-block":"<length>{1,2}","scroll-margin-block-end":"<length>","scroll-margin-block-start":"<length>","scroll-margin-bottom":"<length>","scroll-margin-inline":"<length>{1,2}","scroll-margin-inline-end":"<length>","scroll-margin-inline-start":"<length>","scroll-margin-left":"<length>","scroll-margin-right":"<length>","scroll-margin-top":"<length>","scroll-marker-group":"none|before|after","scroll-padding":"[auto|<length-percentage>]{1,4}","scroll-padding-block":"[auto|<length-percentage>]{1,2}","scroll-padding-block-end":"auto|<length-percentage>","scroll-padding-block-start":"auto|<length-percentage>","scroll-padding-bottom":"auto|<length-percentage>","scroll-padding-inline":"[auto|<length-percentage>]{1,2}","scroll-padding-inline-end":"auto|<length-percentage>","scroll-padding-inline-start":"auto|<length-percentage>","scroll-padding-left":"auto|<length-percentage>","scroll-padding-right":"auto|<length-percentage>","scroll-padding-top":"auto|<length-percentage>","scroll-snap-align":"[none|start|end|center]{1,2}","scroll-snap-coordinate":"none|<position>#","scroll-snap-destination":"<position>","scroll-snap-points-x":"none|repeat( <length-percentage> )","scroll-snap-points-y":"none|repeat( <length-percentage> )","scroll-snap-stop":"normal|always","scroll-snap-type":"none|[x|y|block|inline|both] [mandatory|proximity]?","scroll-snap-type-x":"none|mandatory|proximity","scroll-snap-type-y":"none|mandatory|proximity","scroll-target-group":"none|auto","scroll-timeline":"[<'scroll-timeline-name'> <'scroll-timeline-axis'>?]#","scroll-timeline-axis":"[block|inline|x|y]#","scroll-timeline-name":"[none|<dashed-ident>]#","scrollbar-color":"auto|<color>{2}","scrollbar-gutter":"auto|stable&&both-edges?","scrollbar-width":"auto|thin|none","shape-image-threshold":"<opacity-value>","shape-margin":"<length-percentage>","shape-outside":"none|[<shape-box>||<basic-shape>]|<image>","shape-rendering":"auto|optimizeSpeed|crispEdges|geometricPrecision","speak-as":"normal|spell-out||digits||[literal-punctuation|no-punctuation]","stop-color":"<'color'>","stop-opacity":"<'opacity'>",stroke:"<paint>","stroke-color":"<color>","stroke-dasharray":"none|[<svg-length>+]#","stroke-dashoffset":"<svg-length>","stroke-linecap":"butt|round|square","stroke-linejoin":"miter|round|bevel","stroke-miterlimit":"<number-one-or-greater>","stroke-opacity":"<'opacity'>","stroke-width":"<svg-length>","tab-size":"<integer>|<length>","table-layout":"auto|fixed","text-align":"start|end|left|right|center|justify|match-parent","text-align-last":"auto|start|end|left|right|center|justify","text-anchor":"start|middle|end","text-autospace":"normal|<autospace>|auto","text-box":"normal|<'text-box-trim'>||<'text-box-edge'>","text-box-edge":"auto|<text-edge>","text-box-trim":"none|trim-start|trim-end|trim-both","text-combine-upright":"none|all|[digits <integer>?]","text-decoration":"<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>","text-decoration-color":"<color>","text-decoration-inset":"<length>{1,2}|auto","text-decoration-line":"none|[underline||overline||line-through||blink]|spelling-error|grammar-error","text-decoration-skip":"none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]","text-decoration-skip-ink":"auto|all|none","text-decoration-style":"solid|double|dotted|dashed|wavy","text-decoration-thickness":"auto|from-font|<length>|<percentage>","text-emphasis":"<'text-emphasis-style'>||<'text-emphasis-color'>","text-emphasis-color":"<color>","text-emphasis-position":"auto|[over|under]&&[right|left]?","text-emphasis-style":"none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>","text-indent":"<length-percentage>&&hanging?&&each-line?","text-justify":"auto|inter-character|inter-word|none","text-orientation":"mixed|upright|sideways","text-overflow":"[clip|ellipsis|<string>]{1,2}","text-rendering":"auto|optimizeSpeed|optimizeLegibility|geometricPrecision","text-shadow":"none|<shadow-t>#","text-size-adjust":"none|auto|<percentage>","text-spacing-trim":"space-all|normal|space-first|trim-start","text-transform":"none|[capitalize|uppercase|lowercase]||full-width||full-size-kana|math-auto","text-underline-offset":"auto|<length>|<percentage>","text-underline-position":"auto|from-font|[under||[left|right]]","text-wrap":"<'text-wrap-mode'>||<'text-wrap-style'>","text-wrap-mode":"wrap|nowrap","text-wrap-style":"auto|balance|stable|pretty","timeline-scope":"none|<dashed-ident>#","timeline-trigger":"none|[<'timeline-trigger-name'> <'timeline-trigger-source'> <'timeline-trigger-range'> ['/' <'timeline-trigger-exit-range'>]?]#","timeline-trigger-name":"none|<dashed-ident>#","timeline-trigger-exit-range":"[<'timeline-trigger-exit-range-start'> <'timeline-trigger-exit-range-end'>?]#","timeline-trigger-exit-range-end":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-exit-range-start":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range":"[<'timeline-trigger-range-start'> <'timeline-trigger-range-end'>?]#","timeline-trigger-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-source":"<single-animation-timeline>#",top:"auto|<length-percentage>|<anchor()>|<anchor-size()>","touch-action":"auto|none|[[pan-x|pan-left|pan-right]||[pan-y|pan-up|pan-down]||pinch-zoom]|manipulation",transform:"none|<transform-list>","transform-box":"content-box|border-box|fill-box|stroke-box|view-box","transform-origin":"[<length-percentage>|left|center|right|top|bottom]|[[<length-percentage>|left|center|right]&&[<length-percentage>|top|center|bottom]] <length>?","transform-style":"flat|preserve-3d",transition:"<single-transition>#","transition-behavior":"<transition-behavior-value>#","transition-delay":"<time>#","transition-duration":"<time>#","transition-property":"none|<single-transition-property>#","transition-timing-function":"<easing-function>#",translate:"none|<length-percentage> [<length-percentage> <length>?]?","trigger-scope":"none|all|<dashed-ident>#","unicode-bidi":"normal|embed|isolate|bidi-override|isolate-override|plaintext|-moz-isolate|-moz-isolate-override|-moz-plaintext|-webkit-isolate|-webkit-isolate-override|-webkit-plaintext","user-select":"auto|text|none|all","vector-effect":"none|non-scaling-stroke|non-scaling-size|non-rotation|fixed-position","vertical-align":"baseline|sub|super|text-top|text-bottom|middle|top|bottom|<percentage>|<length>","view-timeline":"[<'view-timeline-name'> [<'view-timeline-axis'>||<'view-timeline-inset'>]?]#","view-timeline-axis":"[block|inline|x|y]#","view-timeline-inset":"[[auto|<length-percentage>]{1,2}]#","view-timeline-name":"[none|<dashed-ident>]#","view-transition-class":"none|<custom-ident>+","view-transition-name":"none|<custom-ident>|match-element",visibility:"visible|hidden|collapse","white-space":"normal|pre|pre-wrap|pre-line|<'white-space-collapse'>||<'text-wrap-mode'>","white-space-collapse":"collapse|preserve|preserve-breaks|preserve-spaces|break-spaces",widows:"<integer>",width:"auto|<length-percentage [0,\u221E]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,\u221E]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","will-change":"auto|<animateable-feature>#","word-break":"normal|break-all|keep-all|break-word|auto-phrase","word-spacing":"normal|<length>","word-wrap":"normal|break-word","writing-mode":"horizontal-tb|vertical-rl|vertical-lr|sideways-rl|sideways-lr|<svg-writing-mode>",x:"<length>|<percentage>",y:"<length>|<percentage>","z-index":"auto|<integer>",zoom:"normal|reset|<number [0,\u221E]>||<percentage [0,\u221E]>","-moz-background-clip":"padding|border","-moz-border-radius-bottomleft":"<'border-bottom-left-radius'>","-moz-border-radius-bottomright":"<'border-bottom-right-radius'>","-moz-border-radius-topleft":"<'border-top-left-radius'>","-moz-border-radius-topright":"<'border-bottom-right-radius'>","-moz-control-character-visibility":"visible|hidden","-moz-osx-font-smoothing":"auto|grayscale","-moz-user-select":"none|text|all|-moz-none","-ms-flex-align":"start|end|center|baseline|stretch","-ms-flex-item-align":"auto|start|end|center|baseline|stretch","-ms-flex-line-pack":"start|end|center|justify|distribute|stretch","-ms-flex-negative":"<'flex-shrink'>","-ms-flex-pack":"start|end|center|justify|distribute","-ms-flex-order":"<integer>","-ms-flex-positive":"<'flex-grow'>","-ms-flex-preferred-size":"<'flex-basis'>","-ms-interpolation-mode":"nearest-neighbor|bicubic","-ms-grid-column-align":"start|end|center|stretch","-ms-grid-row-align":"start|end|center|stretch","-ms-hyphenate-limit-last":"none|always|column|page|spread","-webkit-background-clip":"[<visual-box>|border|padding|content|text]#","-webkit-column-break-after":"always|auto|avoid","-webkit-column-break-before":"always|auto|avoid","-webkit-column-break-inside":"always|auto|avoid","-webkit-font-smoothing":"auto|none|antialiased|subpixel-antialiased","-webkit-mask-box-image":"[<url>|<gradient>|none] [<length-percentage>{4} <-webkit-mask-box-repeat>{2}]?","-webkit-print-color-adjust":"economy|exact","-webkit-text-security":"none|circle|disc|square","-webkit-user-drag":"none|element|auto",behavior:"<url>+",cue:"<'cue-before'> <'cue-after'>?","cue-after":"<url> <decibel>?|none","cue-before":"<url> <decibel>?|none","glyph-orientation-horizontal":"<angle>","glyph-orientation-vertical":"<angle>",kerning:"auto|<svg-length>",pause:"<'pause-before'> <'pause-after'>?","pause-after":"<time>|none|x-weak|weak|medium|strong|x-strong","pause-before":"<time>|none|x-weak|weak|medium|strong|x-strong","position-try-options":"<'position-try-fallbacks'>",rest:"<'rest-before'> <'rest-after'>?","rest-after":"<time>|none|x-weak|weak|medium|strong|x-strong","rest-before":"<time>|none|x-weak|weak|medium|strong|x-strong",speak:"auto|never|always","voice-balance":"<number>|left|center|right|leftwards|rightwards","voice-duration":"auto|<time>","voice-family":"[[<family-name>|<generic-voice>] ,]* [<family-name>|<generic-voice>]|preserve","voice-pitch":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-range":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-rate":"[normal|x-slow|slow|medium|fast|x-fast]||<percentage>","voice-stress":"normal|strong|moderate|none|reduced","voice-volume":"silent|[[x-soft|soft|medium|loud|x-loud]||<decibel>]","white-space-trim":"none|discard-before||discard-after||discard-inner"},atrules:{charset:{prelude:"<string>",descriptors:null},"counter-style":{prelude:"<counter-style-name>",descriptors:{"additive-symbols":"[<integer [0,\u221E]>&&<symbol>]#",fallback:"<counter-style-name>",negative:"<symbol> <symbol>?",pad:"<integer [0,\u221E]>&&<symbol>",prefix:"<symbol>",range:"[[<integer>|infinite]{2}]#|auto","speak-as":"auto|bullets|numbers|words|spell-out|<counter-style-name>",suffix:"<symbol>",symbols:"<symbol>+",system:"cyclic|numeric|alphabetic|symbolic|additive|[fixed <integer>?]|[extends <counter-style-name>]"}},container:{prelude:"[<container-name>]? <container-condition>",descriptors:null},document:{prelude:"[<url>|url-prefix( <string> )|domain( <string> )|media-document( <string> )|regexp( <string> )]#",descriptors:null},"font-face":{prelude:null,descriptors:{"ascent-override":"normal|<percentage>","descent-override":"normal|<percentage>","font-display":"auto|block|swap|fallback|optional","font-family":"<family-name>","font-feature-settings":"normal|<feature-tag-value>#","font-stretch":"<font-stretch-absolute>{1,2}","font-style":"normal|italic|oblique <angle>{0,2}","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>{1,2}","line-gap-override":"normal|<percentage>","size-adjust":"<percentage>",src:"[<url> [format( <string># )]?|local( <family-name> )]#","unicode-range":"<urange>#"}},"font-feature-values":{prelude:"<family-name>#",descriptors:null},"font-palette-values":{prelude:"<dashed-ident>",descriptors:{"base-palette":"light|dark|<integer [0,\u221E]>","font-family":"<family-name>#","override-colors":"[<integer [0,\u221E]> <color>]#"}},import:{prelude:"[<string>|<url>] [layer|layer( <layer-name> )]? [supports( [<supports-condition>|<declaration>] )]? <media-query-list>?",descriptors:null},keyframes:{prelude:"<keyframes-name>",descriptors:null},layer:{prelude:"[<layer-name>#|<layer-name>?]",descriptors:null},media:{prelude:"<media-query-list>",descriptors:null},namespace:{prelude:"<namespace-prefix>? [<string>|<url>]",descriptors:null},page:{prelude:"<page-selector-list>",descriptors:{bleed:"auto|<length>",marks:"none|[crop||cross]","page-orientation":"upright|rotate-left|rotate-right",size:"<length [0,\u221E]>{1,2}|auto|[<page-size>||[portrait|landscape]]"}},"position-try":{prelude:"<dashed-ident>",descriptors:{top:"<'top'>",left:"<'left'>",bottom:"<'bottom'>",right:"<'right'>","inset-block-start":"<'inset-block-start'>","inset-block-end":"<'inset-block-end'>","inset-inline-start":"<'inset-inline-start'>","inset-inline-end":"<'inset-inline-end'>","inset-block":"<'inset-block'>","inset-inline":"<'inset-inline'>",inset:"<'inset'>","margin-top":"<'margin-top'>","margin-left":"<'margin-left'>","margin-bottom":"<'margin-bottom'>","margin-right":"<'margin-right'>","margin-block-start":"<'margin-block-start'>","margin-block-end":"<'margin-block-end'>","margin-inline-start":"<'margin-inline-start'>","margin-inline-end":"<'margin-inline-end'>",margin:"<'margin'>","margin-block":"<'margin-block'>","margin-inline":"<'margin-inline'>",width:"<'width'>",height:"<'height'>","min-width":"<'min-width'>","min-height":"<'min-height'>","max-width":"<'max-width'>","max-height":"<'max-height'>","block-size":"<'block-size'>","inline-size":"<'inline-size'>","min-block-size":"<'min-block-size'>","min-inline-size":"<'min-inline-size'>","max-block-size":"<'max-block-size'>","max-inline-size":"<'max-inline-size'>","align-self":"<'align-self'>|anchor-center","justify-self":"<'justify-self'>|anchor-center"}},property:{prelude:"<custom-property-name>",descriptors:{inherits:"true|false","initial-value":"<declaration-value>?",syntax:"<string>"}},scope:{prelude:"[( <scope-start> )]? [to ( <scope-end> )]?",descriptors:null},"starting-style":{prelude:null,descriptors:null},supports:{prelude:"<supports-condition>",descriptors:null},"view-transition":{prelude:null,descriptors:{navigation:"auto|none",types:"none|<custom-ident>+"}},"font-features-values":{prelude:"[<string>|<custom-ident>]+",descriptors:{"font-display":"auto|block|swap|fallback|optional"}}}}});var Fp={};Se(Fp,{generate:()=>$P,name:()=>OP,parse:()=>Ip,structure:()=>_P});function Pl(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===Or||r===Qn)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)Ut(this.charCodeAt(n))||this.error("Integer is expected",n)}function Ai(e){return Pl.call(this,0,e)}function Co(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case Al:n="N is expected";break;case Qn:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function Tp(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10)if(this.isDelim(Or,e)||this.isDelim(Qn,e)){t=this.isDelim(Or,e)?Or:Qn;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),Ai.call(this,Xo))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==Or&&n!==Qn&&this.error("Number sign is expected")),Ai.call(this,t!==0),t===Qn?"-"+this.consume(10):this.consume(10)}function Ip(){let e=this.tokenStart,t=null,n=null;if(this.tokenType===10)Ai.call(this,NP),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Qn))switch(t="-1",Co.call(this,1,Al),this.tokenEnd-this.tokenStart){case 2:this.next(),n=Tp.call(this);break;case 3:Co.call(this,2,Qn),this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10);break;default:Co.call(this,2,Qn),Pl.call(this,3,Xo),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(Or)&&this.lookupType(1)===1){let r=0;switch(t="1",this.isDelim(Or)&&(r=1,this.next()),Co.call(this,0,Al),this.tokenEnd-this.tokenStart){case 1:this.next(),n=Tp.call(this);break;case 2:Co.call(this,1,Qn),this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10);break;default:Co.call(this,1,Qn),Pl.call(this,2,Xo),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){let r=this.charCodeAt(this.tokenStart),o=r===Or||r===Qn,i=this.tokenStart+o;for(;i<this.tokenEnd&&Ut(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),Co.call(this,i-this.tokenStart,Al),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),n=Tp.call(this)):(Co.call(this,i-this.tokenStart+1,Qn),i+2===this.tokenEnd?(this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10)):(Pl.call(this,i-this.tokenStart+2,Xo),this.next(),n=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===Or&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===Or&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function $P(e){if(e.a){let t=e.a==="+1"&&"n"||e.a==="1"&&"n"||e.a==="-1"&&"-n"||e.a+"n";if(e.b){let n=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}var Or,Qn,Al,Xo,NP,OP,_P,Ep=_(()=>{"use strict";sr();Or=43,Qn=45,Al=110,Xo=!0,NP=!1;OP="AnPlusB",_P={a:[String,null],b:[String,null]}});var Pp={};Se(Pp,{generate:()=>VP,name:()=>jP,parse:()=>Ap,structure:()=>WP,walkContext:()=>HP});function E0(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function UP(){for(let e=1,t;t=this.lookupType(e);e++){if(t===24)return!0;if(t===23||t===3)return!1}return!1}function Ap(e=!1){let t=this.tokenStart,n,r,o=null,i=null;switch(this.eat(3),n=this.substrToCursor(t+1),r=n.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(this.parseAtrulePrelude?o=this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),E0):o=E0.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:hasOwnProperty.call(this.atrule,r)&&typeof this.atrule[r].block=="function"?i=this.atrule[r].block.call(this,e):i=this.Block(UP.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:o,block:i}}function VP(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var jP,HP,WP,Lp=_(()=>{"use strict";jP="Atrule",HP="atrule",WP={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]}});var Bp={};Se(Bp,{generate:()=>KP,name:()=>GP,parse:()=>Mp,structure:()=>YP,walkContext:()=>qP});function Mp(e){let t=null;return e!==null&&(e=e.toLowerCase()),this.skipSC(),hasOwnProperty.call(this.atrule,e)&&typeof this.atrule[e].prelude=="function"?t=this.atrule[e].prelude.call(this):t=this.readSequence(this.scope.AtrulePrelude),this.skipSC(),this.eof!==!0&&this.tokenType!==23&&this.tokenType!==17&&this.error("Semicolon or block is expected"),{type:"AtrulePrelude",loc:this.getLocationFromList(t),children:t}}function KP(e){this.children(e)}var GP,qP,YP,Dp=_(()=>{"use strict";GP="AtrulePrelude",qP="atrulePrelude",YP={children:[[]]}});var Np={};Se(Np,{generate:()=>r2,name:()=>t2,parse:()=>zp,structure:()=>n2});function ZP(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(A0)?(t=!0,this.next()):this.isDelim(Rp)||this.eat(1),this.isDelim(Rp)?this.charCodeAt(this.tokenStart+1)!==Ll?(this.next(),this.eat(1)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function e2(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==Ll&&t!==JP&&t!==QP&&t!==XP&&t!==A0&&t!==Rp&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Ll&&(this.isDelim(Ll)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function zp(){let e=this.tokenStart,t,n=null,r=null,o=null;return this.eat(19),this.skipSC(),t=ZP.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=e2.call(this),this.skipSC(),r=this.tokenType===5?this.String():this.Identifier(),this.skipSC()),this.tokenType===1&&(o=this.consume(1),this.skipSC())),this.eat(20),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:n,value:r,flags:o}}function r2(e){this.token(9,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(1,e.flags),this.token(9,"]")}var XP,A0,Ll,QP,Rp,JP,t2,n2,Op=_(()=>{"use strict";XP=36,A0=42,Ll=61,QP=94,Rp=124,JP=126;t2="AttributeSelector",n2={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]}});var $p={};Se($p,{generate:()=>c2,name:()=>s2,parse:()=>_p,structure:()=>l2,walkContext:()=>a2});function M0(){return this.Raw(null,!0)}function P0(){return this.parseWithFallback(this.Rule,M0)}function L0(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function i2(){if(this.tokenType===17)return L0.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,L0);return this.tokenType===17&&this.next(),e}function _p(e){let t=e?i2:P0,n=this.tokenStart,r=this.createList();this.eat(23);e:for(;!this.eof;)switch(this.tokenType){case 24:break e;case 13:case 25:this.next();break;case 3:r.push(this.parseWithFallback(this.Atrule.bind(this,e),M0));break;default:e&&this.isDelim(o2)?r.push(P0.call(this)):r.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:r}}function c2(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var o2,s2,a2,l2,Up=_(()=>{"use strict";o2=38;s2="Block",a2="block",l2={children:[["Atrule","Rule","Declaration"]]}});var Hp={};Se(Hp,{generate:()=>d2,name:()=>u2,parse:()=>jp,structure:()=>p2});function jp(e,t){let n=this.tokenStart,r=null;return this.eat(19),r=e.call(this,t),this.eof||this.eat(20),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:r}}function d2(e){this.token(9,"["),this.children(e),this.token(9,"]")}var u2,p2,Wp=_(()=>{"use strict";u2="Brackets",p2={children:[[]]}});var Gp={};Se(Gp,{generate:()=>m2,name:()=>g2,parse:()=>Vp,structure:()=>f2});function Vp(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function m2(){this.token(15,"-->")}var g2,f2,qp=_(()=>{"use strict";g2="CDC",f2=[]});var Kp={};Se(Kp,{generate:()=>y2,name:()=>h2,parse:()=>Yp,structure:()=>x2});function Yp(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function y2(){this.token(14,"<!--")}var h2,x2,Xp=_(()=>{"use strict";h2="CDO",x2=[]});var Jp={};Se(Jp,{generate:()=>v2,name:()=>S2,parse:()=>Qp,structure:()=>w2});function Qp(){return this.eatDelim(b2),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function v2(e){this.token(9,"."),this.token(1,e.name)}var b2,S2,w2,Zp=_(()=>{"use strict";b2=46,S2="ClassSelector",w2={name:String}});var td={};Se(td,{generate:()=>E2,name:()=>I2,parse:()=>ed,structure:()=>F2});function ed(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case C2:case k2:case T2:this.next();break;case B0:this.next(),this.eatIdent("deep"),this.eatDelim(B0);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function E2(e){this.tokenize(e.name)}var k2,B0,C2,T2,I2,F2,nd=_(()=>{"use strict";k2=43,B0=47,C2=62,T2=126,I2="Combinator",F2={name:String}});var od={};Se(od,{generate:()=>B2,name:()=>L2,parse:()=>rd,structure:()=>M2});function rd(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===A2&&this.charCodeAt(t-1)===P2&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function B2(e){this.token(25,"/*"+e.value+"*/")}var A2,P2,L2,M2,id=_(()=>{"use strict";A2=42,P2=47,L2="Comment",M2={value:String}});var ad={};Se(ad,{generate:()=>O2,name:()=>R2,parse:()=>sd,structure:()=>z2});function D0(e){return this.lookupTypeNonSC(1)===1&&D2.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}function sd(e="media"){let t=this.createList();e:for(;!this.eof;)switch(this.tokenType){case 25:case 13:this.next();continue;case 1:t.push(this.Identifier());break;case 21:{let n=this.parseWithFallback(()=>N2[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(21);let r=this.Condition(e);return this.eat(22),r},()=>this.GeneralEnclosed(e))),t.push(n);break}case 2:{let n=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);n||(n=this.GeneralEnclosed(e)),t.push(n);break}default:break e}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function O2(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var D2,R2,z2,N2,ld=_(()=>{"use strict";D2=new Set([16,22,0]),R2="Condition",z2={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};N2={media:D0,container:D0,supports(){return this.SupportsDeclaration()}}});var ud={};Se(ud,{generate:()=>X2,name:()=>q2,parse:()=>cd,structure:()=>K2,walkContext:()=>Y2});function W2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function V2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function G2(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(z0)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}function cd(){let e=this.tokenStart,t=this.tokenIndex,n=Q2.call(this),r=xl(n),o=r?this.parseCustomProperty:this.parseValue,i=r?V2:W2,s=!1,a;this.skipSC(),this.eat(16);let u=this.tokenIndex;if(r||this.skipSC(),o?a=this.parseWithFallback(G2,i):a=i.call(this,this.tokenIndex),r&&a.type==="Value"&&a.children.isEmpty){for(let c=u-this.tokenIndex;c<=0;c++)if(this.lookupType(c)===13){a.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(z0)&&(s=J2.call(this),this.skipSC()),this.eof===!1&&this.tokenType!==17&&this.isBalanceEdge(t)===!1&&this.error(),{type:"Declaration",loc:this.getLocation(e,this.tokenStart),important:s,property:n,value:a}}function X2(e){this.token(1,e.property),this.token(16,":"),this.node(e.value),e.important&&(this.token(9,"!"),this.token(1,e.important===!0?"important":e.important))}function Q2(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case j2:case $2:case H2:case _2:case U2:this.next();break;case R0:this.next(),this.isDelim(R0)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function J2(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var z0,_2,$2,U2,j2,H2,R0,q2,Y2,K2,pd=_(()=>{"use strict";yl();z0=33,_2=35,$2=36,U2=38,j2=42,H2=43,R0=47;q2="Declaration",Y2="declaration",K2={important:[Boolean,String],property:String,value:["Value","Raw"]}});var fd={};Se(fd,{generate:()=>nL,name:()=>eL,parse:()=>gd,structure:()=>tL});function dd(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function gd(){let e=this.createList();for(;!this.eof;)switch(this.tokenType){case 13:case 25:case 17:this.next();break;case 3:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),dd));break;default:this.isDelim(Z2)?e.push(this.parseWithFallback(this.Rule,dd)):e.push(this.parseWithFallback(this.Declaration,dd))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function nL(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var Z2,eL,tL,md=_(()=>{"use strict";Z2=38;eL="DeclarationList",tL={children:[["Declaration","Atrule","Rule"]]}});var xd={};Se(xd,{generate:()=>iL,name:()=>rL,parse:()=>hd,structure:()=>oL});function hd(){let e=this.tokenStart,t=this.consumeNumber(12);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function iL(e){this.token(12,e.value+e.unit)}var rL,oL,yd=_(()=>{"use strict";rL="Dimension",oL={value:String,unit:String}});var Sd={};Se(Sd,{generate:()=>cL,name:()=>aL,parse:()=>bd,structure:()=>lL});function bd(e){let t=this.tokenStart,n,r=null;if(this.eat(21),this.skipSC(),n=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:this.lookupNonWSType(1)===9?r=this.Ratio():r=this.Number();break;case 12:r=this.Dimension();break;case 1:r=this.Identifier();break;case 2:r=this.parseWithFallback(()=>{let o=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(sL)&&this.error(),o},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(22),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:n,value:r}}function cL(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var sL,aL,lL,wd=_(()=>{"use strict";sL=47,aL="Feature",lL={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]}});var kd={};Se(kd,{generate:()=>gL,name:()=>uL,parse:()=>vd,structure:()=>pL});function dL(e,t){let r=(this.features[e]||{})[t];return typeof r!="function"&&this.error(`Unknown feature ${t}()`),r}function vd(e="unknown"){let t=this.tokenStart,n=this.consumeFunctionName(),r=dL.call(this,e,n.toLowerCase());this.skipSC();let o=this.parseWithFallback(()=>{let i=this.tokenIndex,s=r.call(this);return this.eof===!1&&this.isBalanceEdge(i)===!1&&this.error(),s},()=>this.Raw(null,!1));return this.eof||this.eat(22),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:o}}function gL(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var uL,pL,Cd=_(()=>{"use strict";uL="FeatureFunction",pL={kind:String,feature:String,value:["Declaration","Selector"]}});var Fd={};Se(Fd,{generate:()=>yL,name:()=>hL,parse:()=>Id,structure:()=>xL});function Td(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(N0,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case 12:return this.Dimension();case 1:return this.Identifier();case 2:return this.parseWithFallback(()=>{let e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(N0)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function _0(e){if(this.skipSC(),this.isDelim(fL)||this.isDelim(mL)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(O0)?(this.next(),t+"="):t}if(this.isDelim(O0))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function Id(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let n=Td.call(this),r=_0.call(this,n.type==="Identifier"),o=Td.call(this),i=null,s=null;return this.lookupNonWSType(0)!==22&&(i=_0.call(this),s=Td.call(this)),this.skipSC(),this.eat(22),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:r,middle:o,rightComparison:i,right:s}}function yL(e){this.token(21,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(22,")")}var N0,fL,O0,mL,hL,xL,Ed=_(()=>{"use strict";N0=47,fL=60,O0=61,mL=62,hL="FeatureRange",xL={kind:String,left:["Identifier","Number","Dimension","Ratio","Function"],leftComparison:String,middle:["Identifier","Number","Dimension","Ratio","Function"],rightComparison:[String,null],right:["Identifier","Number","Dimension","Ratio","Function",null]}});var Pd={};Se(Pd,{generate:()=>vL,name:()=>bL,parse:()=>Ad,structure:()=>wL,walkContext:()=>SL});function Ad(e,t){let n=this.tokenStart,r=this.consumeFunctionName(),o=r.toLowerCase(),i;return i=t.hasOwnProperty(o)?t[o].call(this,t):e.call(this,t),this.eof||this.eat(22),{type:"Function",loc:this.getLocation(n,this.tokenStart),name:r,children:i}}function vL(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var bL,SL,wL,Ld=_(()=>{"use strict";bL="Function",SL="function",wL={name:String,children:[[]]}});var Bd={};Se(Bd,{generate:()=>TL,name:()=>kL,parse:()=>Md,structure:()=>CL});function Md(e){let t=this.tokenStart,n=null;this.tokenType===2?n=this.consumeFunctionName():this.eat(21);let r=this.parseWithFallback(()=>{let o=this.tokenIndex,i=this.readSequence(this.scope.Value);return this.eof===!1&&this.isBalanceEdge(o)===!1&&this.error(),i},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(22),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:n,children:r}}function TL(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var kL,CL,Dd=_(()=>{"use strict";kL="GeneralEnclosed",CL={kind:String,function:[String,null],children:[[]]}});var zd={};Se(zd,{generate:()=>AL,name:()=>FL,parse:()=>Rd,structure:()=>EL,xxx:()=>IL});function Rd(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function AL(e){this.token(4,"#"+e.value)}var IL,FL,EL,Nd=_(()=>{"use strict";IL="XXX",FL="Hash",EL={value:String}});var _d={};Se(_d,{generate:()=>ML,name:()=>PL,parse:()=>Od,structure:()=>LL});function Od(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function ML(e){this.token(1,e.name)}var PL,LL,$d=_(()=>{"use strict";PL="Identifier",LL={name:String}});var jd={};Se(jd,{generate:()=>RL,name:()=>BL,parse:()=>Ud,structure:()=>DL});function Ud(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function RL(e){this.token(9,"#"+e.name)}var BL,DL,Hd=_(()=>{"use strict";BL="IdSelector",DL={name:String}});var Vd={};Se(Vd,{generate:()=>_L,name:()=>NL,parse:()=>Wd,structure:()=>OL});function Wd(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(zL);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function _L(e){this.tokenize(e.name)}var zL,NL,OL,Gd=_(()=>{"use strict";zL=46,NL="Layer",OL={name:String}});var Yd={};Se(Yd,{generate:()=>jL,name:()=>$L,parse:()=>qd,structure:()=>UL});function qd(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===18);)this.skipSC(),this.next(),this.skipSC();return{type:"LayerList",loc:this.getLocationFromList(e),children:e}}function jL(e){this.children(e,()=>this.token(18,","))}var $L,UL,Kd=_(()=>{"use strict";$L="LayerList",UL={children:[["Layer"]]}});var Qd={};Se(Qd,{generate:()=>VL,name:()=>HL,parse:()=>Xd,structure:()=>WL});function Xd(){let e=this.tokenStart,t=null,n=null,r=null;if(this.skipSC(),this.tokenType===1&&this.lookupTypeNonSC(1)!==21){let o=this.consume(1),i=o.toLowerCase();switch(i==="not"||i==="only"?(this.skipSC(),t=i,n=this.consume(1)):n=o,this.lookupTypeNonSC(0)){case 1:{this.skipSC(),this.eatIdent("and"),r=this.Condition("media");break}case 23:case 17:case 18:case 0:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case 1:case 21:case 2:{r=this.Condition("media");break}case 23:case 17:case 0:break;default:this.error("Identifier or parenthesis is expected")}return{type:"MediaQuery",loc:this.getLocation(e,this.tokenStart),modifier:t,mediaType:n,condition:r}}function VL(e){e.mediaType?(e.modifier&&this.token(1,e.modifier),this.token(1,e.mediaType),e.condition&&(this.token(1,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}var HL,WL,Jd=_(()=>{"use strict";HL="MediaQuery",WL={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]}});var eg={};Se(eg,{generate:()=>YL,name:()=>GL,parse:()=>Zd,structure:()=>qL});function Zd(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===18);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function YL(e){this.children(e,()=>this.token(18,","))}var GL,qL,tg=_(()=>{"use strict";GL="MediaQueryList",qL={children:[["MediaQuery"]]}});var rg={};Se(rg,{generate:()=>JL,name:()=>XL,parse:()=>ng,structure:()=>QL});function ng(){let e=this.tokenStart;return this.eatDelim(KL),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function JL(){this.token(9,"&")}var KL,XL,QL,og=_(()=>{"use strict";KL=38,XL="NestingSelector",QL={}});var sg={};Se(sg,{generate:()=>tM,name:()=>ZL,parse:()=>ig,structure:()=>eM});function ig(){this.skipSC();let e=this.tokenStart,t=e,n=null,r;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?r=this.Identifier():r=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),n=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:r,selector:n}}function tM(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var ZL,eM,ag=_(()=>{"use strict";ZL="Nth",eM={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]}});var cg={};Se(cg,{generate:()=>oM,name:()=>nM,parse:()=>lg,structure:()=>rM});function lg(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function oM(e){this.token(10,e.value)}var nM,rM,ug=_(()=>{"use strict";nM="Number",rM={value:String}});var dg={};Se(dg,{generate:()=>aM,name:()=>iM,parse:()=>pg,structure:()=>sM});function pg(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function aM(e){this.tokenize(e.value)}var iM,sM,gg=_(()=>{"use strict";iM="Operator",sM={value:String}});var mg={};Se(mg,{generate:()=>uM,name:()=>lM,parse:()=>fg,structure:()=>cM});function fg(e,t){let n=this.tokenStart,r=null;return this.eat(21),r=e.call(this,t),this.eof||this.eat(22),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:r}}function uM(e){this.token(21,"("),this.children(e),this.token(22,")")}var lM,cM,hg=_(()=>{"use strict";lM="Parentheses",cM={children:[[]]}});var yg={};Se(yg,{generate:()=>gM,name:()=>pM,parse:()=>xg,structure:()=>dM});function xg(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function gM(e){this.token(11,e.value+"%")}var pM,dM,bg=_(()=>{"use strict";pM="Percentage",dM={value:String}});var wg={};Se(wg,{generate:()=>xM,name:()=>fM,parse:()=>Sg,structure:()=>hM,walkContext:()=>mM});function Sg(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function xM(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var fM,mM,hM,vg=_(()=>{"use strict";fM="PseudoClassSelector",mM="function",hM={name:String,children:[["Raw"],null]}});var Cg={};Se(Cg,{generate:()=>wM,name:()=>yM,parse:()=>kg,structure:()=>SM,walkContext:()=>bM});function kg(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function wM(e){this.token(16,":"),this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var yM,bM,SM,Tg=_(()=>{"use strict";yM="PseudoElementSelector",bM="function",SM={name:String,children:[["Raw"],null]}});var Fg={};Se(Fg,{generate:()=>CM,name:()=>vM,parse:()=>Ig,structure:()=>kM});function U0(){switch(this.skipSC(),this.tokenType){case 10:return this.Number();case 2:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}function Ig(){let e=this.tokenStart,t=U0.call(this),n=null;return this.skipSC(),this.isDelim($0)&&(this.eatDelim($0),n=U0.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function CM(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var $0,vM,kM,Eg=_(()=>{"use strict";$0=47;vM="Ratio",kM={left:["Number","Function"],right:["Number","Function",null]}});var Pg={};Se(Pg,{generate:()=>EM,name:()=>IM,parse:()=>Ag,structure:()=>FM});function TM(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function Ag(e,t){let n=this.getTokenStart(this.tokenIndex),r;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?r=TM.call(this):r=this.tokenStart,{type:"Raw",loc:this.getLocation(n,r),value:this.substring(n,r)}}function EM(e){this.tokenize(e.value)}var IM,FM,Lg=_(()=>{"use strict";IM="Raw",FM={value:String}});var Bg={};Se(Bg,{generate:()=>BM,name:()=>PM,parse:()=>Mg,structure:()=>MM,walkContext:()=>LM});function j0(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function AM(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}function Mg(){let e=this.tokenIndex,t=this.tokenStart,n,r;return this.parseRulePrelude?n=this.parseWithFallback(AM,j0):n=j0.call(this,e),r=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function BM(e){this.node(e.prelude),this.node(e.block)}var PM,LM,MM,Dg=_(()=>{"use strict";PM="Rule",LM="rule",MM={prelude:["SelectorList","Raw"],block:["Block"]}});var zg={};Se(zg,{generate:()=>zM,name:()=>DM,parse:()=>Rg,structure:()=>RM});function Rg(){let e=null,t=null;this.skipSC();let n=this.tokenStart;return this.tokenType===21&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),this.lookupNonWSType(0)===1&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(21),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),{type:"Scope",loc:this.getLocation(n,this.tokenStart),root:e,limit:t}}function zM(e){e.root&&(this.token(21,"("),this.node(e.root),this.token(22,")")),e.limit&&(this.token(1,"to"),this.token(21,"("),this.node(e.limit),this.token(22,")"))}var DM,RM,Ng=_(()=>{"use strict";DM="Scope",RM={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]}});var _g={};Se(_g,{generate:()=>_M,name:()=>NM,parse:()=>Og,structure:()=>OM});function Og(){let e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function _M(e){this.children(e)}var NM,OM,$g=_(()=>{"use strict";NM="Selector",OM={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]}});var jg={};Se(jg,{generate:()=>HM,name:()=>$M,parse:()=>Ug,structure:()=>jM,walkContext:()=>UM});function Ug(){let e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===18){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function HM(e){this.children(e,()=>this.token(18,","))}var $M,UM,jM,Hg=_(()=>{"use strict";$M="SelectorList",UM="selector",jM={children:[["Selector","Raw"]]}});function Ml(e){let t=e.length,n=e.charCodeAt(0),r=n===H0||n===W0?1:0,o=r===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1,i="";for(let s=r;s<=o;s++){let a=e.charCodeAt(s);if(a===Wg){if(s===o){s!==t-1&&(i=e.substr(s+1));break}if(a=e.charCodeAt(++s),Pn(Wg,a)){let u=s-1,c=Yr(e,u);s=c-1,i+=tl(e.substring(u+1,c))}else a===13&&e.charCodeAt(s+1)===10&&s++}else i+=e[s]}return i}function V0(e,t){let n=t?"'":'"',r=t?W0:H0,o="",i=!1;for(let s=0;s<e.length;s++){let a=e.charCodeAt(s);if(a===0){o+="\uFFFD";continue}if(a<=31||a===127){o+="\\"+a.toString(16),i=!0;continue}a===r||a===Wg?(o+="\\"+e.charAt(s),i=!1):(i&&(Ln(a)||zr(a))&&(o+=" "),o+=e.charAt(s),i=!1)}return n+o+n}var Wg,H0,W0,Bl=_(()=>{"use strict";sr();Wg=92,H0=34,W0=39});var Gg={};Se(Gg,{generate:()=>GM,name:()=>WM,parse:()=>Vg,structure:()=>VM});function Vg(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:Ml(this.consume(5))}}function GM(e){this.token(5,V0(e.value))}var WM,VM,qg=_(()=>{"use strict";Bl();WM="String",VM={value:String}});var Kg={};Se(Kg,{generate:()=>QM,name:()=>YM,parse:()=>Yg,structure:()=>XM,walkContext:()=>KM});function q0(){return this.Raw(null,!1)}function Yg(){let e=this.tokenStart,t=this.createList(),n;for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==qM){this.next();continue}n=this.Comment();break;case 14:n=this.CDO();break;case 15:n=this.CDC();break;case 3:n=this.parseWithFallback(this.Atrule,q0);break;default:n=this.parseWithFallback(this.Rule,q0)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function QM(e){this.children(e)}var qM,YM,KM,XM,Xg=_(()=>{"use strict";qM=33;YM="StyleSheet",KM="stylesheet",XM={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]}});var Jg={};Se(Jg,{generate:()=>eB,name:()=>JM,parse:()=>Qg,structure:()=>ZM});function Qg(){let e=this.tokenStart;this.eat(21),this.skipSC();let t=this.Declaration();return this.eof||this.eat(22),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function eB(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var JM,ZM,Zg=_(()=>{"use strict";JM="SupportsDeclaration",ZM={declaration:"Declaration"}});var nf={};Se(nf,{generate:()=>oB,name:()=>nB,parse:()=>tf,structure:()=>rB});function ef(){this.tokenType!==1&&this.isDelim(tB)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function tf(){let e=this.tokenStart;return this.isDelim(Y0)?(this.next(),ef.call(this)):(ef.call(this),this.isDelim(Y0)&&(this.next(),ef.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function oB(e){this.tokenize(e.name)}var tB,Y0,nB,rB,rf=_(()=>{"use strict";tB=42,Y0=124;nB="TypeSelector",rB={name:String}});var af={};Se(af,{generate:()=>cB,name:()=>aB,parse:()=>sf,structure:()=>lB});function zs(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){let o=this.charCodeAt(r);if(o===X0&&t&&n!==0)return zs.call(this,e+n+1,!1),-1;Ln(o)||this.error(t&&n!==0?"Hyphen minus"+(n<6?" or hex digit":"")+" is expected":n<6?"Hex digit is expected":"Unexpected input",r),++n>6&&this.error("Too many hex digits",r)}return this.next(),n}function Dl(e){let t=0;for(;this.isDelim(of);)++t>e&&this.error("Too many question marks"),this.next()}function iB(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===K0?"Plus sign":"Hyphen minus")+" is expected")}function sB(){let e=0;switch(this.tokenType){case 10:if(e=zs.call(this,1,!0),this.isDelim(of)){Dl.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){iB.call(this,X0),zs.call(this,1,!1);break}break;case 12:e=zs.call(this,1,!0),e>0&&Dl.call(this,6-e);break;default:if(this.eatDelim(K0),this.tokenType===1){e=zs.call(this,0,!0),e>0&&Dl.call(this,6-e);break}if(this.isDelim(of)){this.next(),Dl.call(this,5);break}this.error("Hex digit or question mark is expected")}}function sf(){let e=this.tokenStart;return this.eatIdent("u"),sB.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function cB(e){this.tokenize(e.value)}var K0,X0,of,aB,lB,lf=_(()=>{"use strict";sr();K0=43,X0=45,of=63;aB="UnicodeRange",lB={value:String}});function J0(e){let t=e.length,n=4,r=e.charCodeAt(t-1)===Q0?t-2:t-1,o="";for(;n<r&&zr(e.charCodeAt(n));)n++;for(;n<r&&zr(e.charCodeAt(r));)r--;for(let i=n;i<=r;i++){let s=e.charCodeAt(i);if(s===cf){if(i===r){i!==t-1&&(o=e.substr(i+1));break}if(s=e.charCodeAt(++i),Pn(cf,s)){let a=i-1,u=Yr(e,a);i=u-1,o+=tl(e.substring(a+1,u))}else s===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function Z0(e){let t="",n=!1;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o===0){t+="\uFFFD";continue}if(o<=31||o===127){t+="\\"+o.toString(16),n=!0;continue}o===uB||o===cf||o===pB||o===dB||o===gB||o===Q0?(t+="\\"+e.charAt(r),n=!1):(n&&Ln(o)&&(t+=" "),t+=e.charAt(r),n=!1)}return"url("+t+")"}var uB,cf,pB,dB,gB,Q0,uf=_(()=>{"use strict";sr();uB=32,cf=92,pB=34,dB=39,gB=40,Q0=41});var df={};Se(df,{generate:()=>hB,name:()=>fB,parse:()=>pf,structure:()=>mB});function pf(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=J0(this.consume(7));break;case 2:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(2),this.skipSC(),t=Ml(this.consume(5)),this.skipSC(),this.eof||this.eat(22);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function hB(e){this.token(7,Z0(e.value))}var fB,mB,gf=_(()=>{"use strict";uf();Bl();fB="Url",mB={value:String}});var mf={};Se(mf,{generate:()=>bB,name:()=>xB,parse:()=>ff,structure:()=>yB});function ff(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function bB(e){this.children(e)}var xB,yB,hf=_(()=>{"use strict";xB="Value",yB={children:[[]]}});var yf={};Se(yf,{generate:()=>kB,name:()=>wB,parse:()=>xf,structure:()=>vB});function xf(){return this.eat(13),SB}function kB(e){this.token(13,e.value)}var SB,wB,vB,bf=_(()=>{"use strict";SB=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),wB="WhiteSpace",vB={value:String}});var Ns={};Se(Ns,{AnPlusB:()=>Fp,Atrule:()=>Pp,AtrulePrelude:()=>Bp,AttributeSelector:()=>Np,Block:()=>$p,Brackets:()=>Hp,CDC:()=>Gp,CDO:()=>Kp,ClassSelector:()=>Jp,Combinator:()=>td,Comment:()=>od,Condition:()=>ad,Declaration:()=>ud,DeclarationList:()=>fd,Dimension:()=>xd,Feature:()=>Sd,FeatureFunction:()=>kd,FeatureRange:()=>Fd,Function:()=>Pd,GeneralEnclosed:()=>Bd,Hash:()=>zd,IdSelector:()=>jd,Identifier:()=>_d,Layer:()=>Vd,LayerList:()=>Yd,MediaQuery:()=>Qd,MediaQueryList:()=>eg,NestingSelector:()=>rg,Nth:()=>sg,Number:()=>cg,Operator:()=>dg,Parentheses:()=>mg,Percentage:()=>yg,PseudoClassSelector:()=>wg,PseudoElementSelector:()=>Cg,Ratio:()=>Fg,Raw:()=>Pg,Rule:()=>Bg,Scope:()=>zg,Selector:()=>_g,SelectorList:()=>jg,String:()=>Gg,StyleSheet:()=>Kg,SupportsDeclaration:()=>Jg,TypeSelector:()=>nf,UnicodeRange:()=>af,Url:()=>df,Value:()=>mf,WhiteSpace:()=>yf});var Sf=_(()=>{"use strict";Ep();Lp();Dp();Op();Up();Wp();qp();Xp();Zp();nd();id();ld();pd();md();yd();wd();Cd();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tg();og();ag();ug();gg();hg();bg();vg();Tg();Eg();Lg();Dg();Ng();$g();Hg();qg();Xg();Zg();rf();lf();gf();hf();bf()});var tS,nS=_(()=>{"use strict";bl();F0();Sf();tS={generic:!0,cssWideKeywords:Ci,...I0,node:Ns}});function Os(e){switch(this.tokenType){case 4:return this.Hash();case 18:return this.Operator();case 21:return this.Parentheses(this.readSequence,e.recognizer);case 19:return this.Brackets(this.readSequence,e.recognizer);case 5:return this.String();case 12:return this.Dimension();case 11:return this.Percentage();case 10:return this.Number();case 2:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case 7:return this.Url();case 1:return this.cmpChar(this.tokenStart,EB)&&this.cmpChar(this.tokenStart+1,rS)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===FB||t===TB||t===rS||t===IB)return this.Operator();t===CB&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var CB,TB,rS,IB,FB,EB,wf=_(()=>{"use strict";CB=35,TB=42,rS=43,IB=45,FB=47,EB=117});var oS,iS=_(()=>{"use strict";wf();oS={getNode:Os}});function NB(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function OB(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return this.lookupType(1)===16?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:this.charCodeAt(this.tokenStart)===sS&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case MB:case DB:case zB:case BB:return this.Combinator();case sS:return this.ClassSelector();case LB:case RB:return this.TypeSelector();case AB:return this.IdSelector();case PB:return this.NestingSelector()}break}}}var AB,PB,LB,MB,BB,sS,DB,RB,zB,aS,lS=_(()=>{"use strict";AB=35,PB=38,LB=42,MB=43,BB=47,sS=46,DB=62,RB=124,zB=126;aS={onWhiteSpace:NB,getNode:OB}});function cS(){return this.createSingleNodeList(this.Raw(null,!1))}var uS=_(()=>{"use strict"});function pS(){let e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());let t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(n.type==="Value"&&n.children.isEmpty){for(let r=t-this.tokenIndex;r<=0;r++)if(this.lookupType(r)===13){n.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(n)}return e}var dS=_(()=>{"use strict"});function gS(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var fS,mS=_(()=>{"use strict";wf();uS();dS();fS={getNode:Os,onWhiteSpace(e,t){gS(e)&&(e.value=" "+e.value),gS(t.last)&&(t.last.value+=" ")},expression:cS,var:pS}});var vf={};Se(vf,{AtrulePrelude:()=>oS,Selector:()=>aS,Value:()=>fS});var hS=_(()=>{"use strict";iS();lS();mS()});var _B,xS,yS=_(()=>{"use strict";_B=new Set(["none","and","not","or"]),xS={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);_B.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}}});var bS,SS=_(()=>{"use strict";bS={parse:{prelude:null,block(){return this.Block(!0)}}}});function kf(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==22&&this.error()}},t||(()=>this.Raw(null,!0)))}var wS,vS,kS=_(()=>{"use strict";wS={layer(){this.skipSC();let e=this.createList(),t=kf.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=kf.call(this,this.Declaration,()=>kf.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},vS={parse:{prelude(){let e=this.createList();switch(this.tokenType){case 5:e.push(this.String());break;case 7:case 2:e.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===1&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?e.push(this.Identifier()):this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,wS)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,wS)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}}});var CS,TS=_(()=>{"use strict";CS={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}}});var IS,FS=_(()=>{"use strict";IS={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}}});var ES,AS=_(()=>{"use strict";ES={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var PS,LS=_(()=>{"use strict";PS={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var MS,BS=_(()=>{"use strict";MS={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}}});var DS,RS=_(()=>{"use strict";DS={parse:{prelude:null,block(e=!1){return this.Block(e)}}}});var zS,NS=_(()=>{"use strict";zS={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}});var OS,_S=_(()=>{"use strict";yS();SS();kS();TS();FS();AS();LS();BS();RS();NS();OS={container:xS,"font-face":bS,import:vS,layer:CS,media:IS,nest:ES,page:PS,scope:MS,"starting-style":DS,supports:zS}});function $S(){let e=this.createList();this.skipSC();e:for(;!this.eof;){switch(this.tokenType){case 1:e.push(this.Identifier());break;case 5:e.push(this.String());break;case 18:e.push(this.Operator());break;case 22:break e;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}var US=_(()=>{"use strict"});var Qo,Cf,$B,UB,Rl,jS,HS=_(()=>{"use strict";US();Qo={parse(){return this.createSingleNodeList(this.SelectorList())}},Cf={parse(){return this.createSingleNodeList(this.Selector())}},$B={parse(){return this.createSingleNodeList(this.Identifier())}},UB={parse:$S},Rl={parse(){return this.createSingleNodeList(this.Nth())}},jS={dir:$B,has:Qo,lang:UB,matches:Qo,is:Qo,"-moz-any":Qo,"-webkit-any":Qo,where:Qo,not:Qo,"nth-child":Rl,"nth-last-child":Rl,"nth-last-of-type":Rl,"nth-of-type":Rl,slotted:Cf,host:Cf,"host-context":Cf}});var Tf={};Se(Tf,{AnPlusB:()=>Ip,Atrule:()=>Ap,AtrulePrelude:()=>Mp,AttributeSelector:()=>zp,Block:()=>_p,Brackets:()=>jp,CDC:()=>Vp,CDO:()=>Yp,ClassSelector:()=>Qp,Combinator:()=>ed,Comment:()=>rd,Condition:()=>sd,Declaration:()=>cd,DeclarationList:()=>gd,Dimension:()=>hd,Feature:()=>bd,FeatureFunction:()=>vd,FeatureRange:()=>Id,Function:()=>Ad,GeneralEnclosed:()=>Md,Hash:()=>Rd,IdSelector:()=>Ud,Identifier:()=>Od,Layer:()=>Wd,LayerList:()=>qd,MediaQuery:()=>Xd,MediaQueryList:()=>Zd,NestingSelector:()=>ng,Nth:()=>ig,Number:()=>lg,Operator:()=>pg,Parentheses:()=>fg,Percentage:()=>xg,PseudoClassSelector:()=>Sg,PseudoElementSelector:()=>kg,Ratio:()=>Ig,Raw:()=>Ag,Rule:()=>Mg,Scope:()=>Rg,Selector:()=>Og,SelectorList:()=>Ug,String:()=>Vg,StyleSheet:()=>Yg,SupportsDeclaration:()=>Qg,TypeSelector:()=>tf,UnicodeRange:()=>sf,Url:()=>pf,Value:()=>ff,WhiteSpace:()=>xf});var WS=_(()=>{"use strict";Ep();Lp();Dp();Op();Up();Wp();qp();Xp();Zp();nd();id();ld();pd();md();yd();wd();Cd();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tg();og();ag();ug();gg();hg();bg();vg();Tg();Eg();Lg();Dg();Ng();$g();Hg();qg();Xg();Zg();rf();lf();gf();hf();bf()});var VS,GS=_(()=>{"use strict";hS();_S();HS();WS();VS={parseContext:{default:"StyleSheet",stylesheet:"StyleSheet",atrule:"Atrule",atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:"MediaQueryList",mediaQuery:"MediaQuery",condition(e){return this.Condition(e.kind)},rule:"Rule",selectorList:"SelectorList",selector:"Selector",block(){return this.Block(!0)},declarationList:"DeclarationList",declaration:"Declaration",value:"Value"},features:{supports:{selector(){return this.Selector()}},container:{style(){return this.Declaration()}}},scope:vf,atrule:OS,pseudo:jS,node:Tf}});var qS,YS=_(()=>{"use strict";Sf();qS={node:Ns}});var KS,XS=_(()=>{"use strict";T0();nS();GS();YS();KS=C0({...tS,...VS,...qS})});var QS=_(()=>{"use strict"});var JS=_(()=>{"use strict"});var Xq,ZS,Qq,Jq,Zq,ew,eY,tY,nY,rY,oY,iY,tw=_(()=>{"use strict";XS();QS();dp();yl();JS();Bl();uf();({tokenize:Xq,parse:ZS,generate:Qq,lexer:Jq,createLexer:Zq,walk:ew,find:eY,findLast:tY,findAll:nY,toPlainObject:rY,fromPlainObject:oY,fork:iY}=KS)});function VB(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function rw(e){try{let t=ZS(e.trim(),{context:"value"}),n=[];return ew(t,{enter(r){if(r.type==="Dimension"){let o=parseFloat(r.value);n.push(`${o}${r.unit}`)}else if(r.type==="Number"){let o=parseFloat(r.value);n.push(`${o}`)}else r.type==="Percentage"?n.push(`${parseFloat(r.value)}%`):r.type==="Identifier"?n.push(r.name.toLowerCase()):r.type==="Hash"?n.push(`#${r.value.toLowerCase()}`):r.type}}),n}catch{return[e.trim().toLowerCase()]}}function GB(e,t){let n=VB(e);if(!WB.has(n))return t;let r=rw(t);if(r.length<1||r.length>4)return t;let o=r.map(i=>i==="0"?"0px":i);return o.length===1?`${o[0]} ${o[0]} ${o[0]} ${o[0]}`:o.length===2?`${o[0]} ${o[1]} ${o[0]} ${o[1]}`:o.length===3?`${o[0]} ${o[1]} ${o[2]} ${o[1]}`:o.join(" ")}function nw(e,t){let n=t.trim();if(!n)return"";let r=GB(e,n);return rw(r).map(i=>i==="0"?"0px":i).join(" ")}function ow(e,t,n){let r=nw(e,t),o=nw(e,n);return r!==""&&o!==""&&r===o}var WB,iw=_(()=>{"use strict";tw();WB=new Set(["padding","margin","border-radius","borderradius","inset","border-width","borderwidth"])});function qB(e){let t=e.toLowerCase();return t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function YB(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/);if(!t)return null;let n=parseInt(t[1],10).toString(16).padStart(2,"0"),r=parseInt(t[2],10).toString(16).padStart(2,"0"),o=parseInt(t[3],10).toString(16).padStart(2,"0");return`#${n}${r}${o}`}function sw(e){let t=typeof e=="string"?e:String(e??"");if(!t||t==="[object Object]")return"";let n=t.match(/rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/);if(n){let i=YB(n[0]);if(i)return i}let r=t.match(/#([0-9a-fA-F]{3,8})/);if(r)return qB(r[0]);let o=t.match(/(-?\d+\.?\d*)(px|em|rem|%|pt|vw|vh)?/g);return o&&o.length>1?o.join(" ").toLowerCase():o&&o.length===1?o[0].toLowerCase():t.toLowerCase().trim().replace(/\s+/g," ")}function Jo(e,t,n){if(!e||!t)return!1;let r=String(e),o=String(t),i=r.toLowerCase(),s=o.toLowerCase(),a=i.includes("none"),u=s.includes("none");if(a!==u)return!1;let c=/\b(fill|stroke)\s*:/i,l=c.test(r),d=c.test(o);if(l!==d)return!1;let g=sw(r),p=sw(o);return!!(g===p||n&&ow(n,r,o))}var If=_(()=>{"use strict";iw()});function ZB(e){let t=String(e.property||"").toLowerCase(),n=String(e.description||"").toLowerCase(),r=String(e.expected||e.suggestedValue||"").toLowerCase(),o=String(e.actual||e.currentValue||"").toLowerCase();if(t.includes("color")||t.includes("fill")||t.includes("background")||n.includes("color")||n.includes("fill"))return!0;let i=s=>/^#[0-9a-f]{3,8}$/i.test(s)||s.includes("rgb")||["white","black","red","blue","green","orange","yellow","transparent"].includes(s);return!!(i(r)||i(o)||e.relatedProperties?.some(s=>{let a=s.property?.toLowerCase()||"";return a.includes("color")||a.includes("fill")||a.includes("background")}))}function aw(e){if(e.includes("\xD7")||/\d+px\s*x\s*\d+px/i.test(e))return!1;let t=e.match(/\d+px/g);return t?t.length>1:!1}function eD(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase(),r=String(e.property||"").toLowerCase(),o=String(e.description||"").toLowerCase(),i=n.includes("margin")||t.includes("margin")||r==="margin",s=t.includes("gap")||o.includes("gap");return i&&s}function tD(e,t,n){if(!e||!t)return!1;let r=typeof e=="string"?e:String(e??""),o=typeof t=="string"?t:String(t??"");if(!r||!o||r==="[object Object]"||o==="[object Object]"||n&&ZB(n)||aw(r)||aw(o)||n&&eD(n))return!1;let i=parseFloat(r),s=parseFloat(o);if(isNaN(i)||isNaN(s))return!1;let a=Math.abs(i-s);if(r.includes("px")||o.includes("px")){let u=n?.property?.toLowerCase()||"";return u==="width"||u==="height"||u.includes("width")||u.includes("height")?a<cw:a<lw}return r.includes("%")||o.includes("%")?a<1:!1}function nD(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(JB.some(s=>t.includes(s))||!XB.some(s=>t.includes(s)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!Jo(o,i,e.property))}function rD(e){let t=(e.expected!==void 0?"fill":"").toLowerCase(),n=e.actual!==void 0||e.currentValue!==void 0?"fill":"";if(!(t==="fill"||n==="fill"||e.description?.toLowerCase().includes("fill")||e.title?.toLowerCase().includes("fill")))return!1;let o=String(e.expected||e.suggestedValue||"").toLowerCase();if(!(o==="none"||o==="transparent"||o.includes("no fills")||o.includes("transparent")))return!1;let s=`${e.description||""} ${e.title||""}`.toLowerCase();return s.includes("container")||s.includes("svg ")||s.includes("<svg")||s.includes("wrapper")}function oD(e){let t=`${e.description||""} ${e.title||""}`.toLowerCase(),n=e.property?.toLowerCase()||"";if(!(t.includes("text ")||t.includes("text layer")||t.includes("text span")||t.includes("span ")||t.includes("label "))||!(n==="width"||n==="height"||n.includes("width")||n.includes("height")||t.includes("width")||t.includes("height")))return!1;let i=e.expected||e.suggestedValue||"",s=e.actual||e.currentValue||"",a=parseFloat(i),u=parseFloat(s);return isNaN(a)||isNaN(u)?!1:Math.abs(a-u)<uw}function iD(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase(),n=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase();if(!QB.some(d=>t.includes(d)||n.includes(d)))return!1;let i=`${t} ${n} ${r}`;if(i.includes("min-width")||i.includes("max-width")||i.includes("min-height")||i.includes("max-height")||i.includes("explicit")||i.includes("constraint")||i.includes("forced"))return!1;let a=n.includes("hug")||n.includes("auto"),u=/\d+\.?\d*px/.test(r);if(!a||!u)return!1;let c=n.match(/(\d+\.?\d*)px/),l=r.match(/(\d+\.?\d*)px/);return!(c&&l&&Math.abs(parseFloat(c[1])-parseFloat(l[1]))>KB)}function sD(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase();return(!n||!t||n.includes("see ")||t.includes("see ")||n.includes("image")||t.includes("image"))&&e.type==="visual"}function _s(e){if(e.programmaticallyVerified)return{dismissed:!1};let t=e.expected||e.suggestedValue,n=e.actual||e.currentValue;if(e.fixRequired===!1)return{dismissed:!0,dismissReason:"Auto-dismissed: FixRequired is false (no code change needed)",dismissedBy:"post-ai-validation"};if(Jo(t,n,e.property))return{dismissed:!0,dismissReason:"Auto-dismissed: expected equals actual (identical values)",dismissedBy:"post-ai-validation"};if(e.fixRequired===!0)return{dismissed:!1};if(oD(e))return{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${uw}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"};if(tD(t,n,e)){let r=e.property?.toLowerCase()||"";return{dismissed:!0,dismissReason:`Auto-dismissed: negligible difference (<${r==="width"||r==="height"||r.includes("width")||r.includes("height")?cw:lw}px)`,dismissedBy:"post-ai-validation"}}return sD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:nD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:iD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:rD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var lw,cw,uw,KB,XB,QB,JB,pw=_(()=>{"use strict";If();lw=.5,cw=2,uw=2,KB=5,XB=["values match","values already match","already correct","correctly implemented","implementation is correct","css matches","matches figma","identical","same value","no difference","none - ","no changes needed","no fix needed"],QB=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],JB=["duplicate","extra","missing","additional","removed","should not exist","does not exist","not in figma","not in storybook","renders 2","renders two","has 1","has one"]});function To(e,t,n){let r=100-n*1-t*3-e*10;return Math.max(0,Math.min(100,r))}var dw=_(()=>{"use strict"});var gw=_(()=>{"use strict"});var fw=_(()=>{"use strict"});var Ff=_(()=>{"use strict";If();pw();dw();gw();fw()});var mD,hD,vY,Ef=_(()=>{"use strict";mD=["flex","inline-flex"],hD=["grid","inline-grid"],vY=[...mD,...hD]});var hw=_(()=>{"use strict";Ff();Ef()});var xw=_(()=>{"use strict"});var Rn=_(()=>{"use strict";wu();wy();vy();Ff();Ef();hw();xw()});function yD(e){let{aiPrompt:t,aiResponse:n,...r}=e;return r}function Jn(e){try{let t=e.map(yD),n=JSON.stringify(t,bD);sessionStorage.setItem(Af,n)}catch(t){y.error("[SessionStorage] Failed to save review history:",t)}}function Pf(){try{let e=sessionStorage.getItem(Af);if(!e)return[];let t=JSON.parse(e,SD);return Array.isArray(t)?t:[]}catch(e){return y.error("[SessionStorage] Failed to load review history:",e),[]}}function yw(){try{let e=Pf();if(e.length===0)return;let t=!1,n=e.map(r=>{if(r.aiPrompt!==void 0||r.aiResponse!==void 0){t=!0;let{aiPrompt:o,aiResponse:i,...s}=r;return s}return r});t&&(Jn(n),y.debug("[SessionStorage] Stripped aiPrompt/aiResponse from existing review history"))}catch(e){y.error("[SessionStorage] Failed to strip sensitive fields:",e)}}function bw(){try{sessionStorage.removeItem(Af),y.debug("[SessionStorage] Review history cleared")}catch(e){y.error("[SessionStorage] Failed to clear review history:",e)}}function bD(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function SD(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var Af,Lf=_(()=>{"use strict";Oe();Af="uicopilot_review_history"});import wD,{createContext as vD,useContext as kD,useReducer as CD,useMemo as Sw,useRef as TD,useEffect as ID}from"react";function zl(e){let t=e.length>ww?e.slice(e.length-ww):e,n=Math.max(0,t.length-FD);return n===0?t:t.map((r,o)=>{if(o>=n)return r;let i=r.storybookImageData?.startsWith("data:"),s=r.figmaImageData?.startsWith("data:");return!i&&!s?r:{...r,storybookImageData:i?void 0:r.storybookImageData,figmaImageData:s?void 0:r.figmaImageData}})}function ED(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"ADD_STREAMING_MESSAGE":return{...e,streamingMessages:[...e.streamingMessages,t.payload]};case"UPDATE_STREAMING_MESSAGE":return{...e,streamingMessages:e.streamingMessages.map((n,r)=>r===t.payload.index?{...n,content:t.payload.content}:n)};case"CLEAR_STREAMING_MESSAGES":return{...e,streamingMessages:[]};case"TOGGLE_MODEL":{let n=e.selectedModels.includes(t.payload);return n&&e.selectedModels.length===1?e:{...e,selectedModels:n?e.selectedModels.filter(r=>r!==t.payload):[...e.selectedModels,t.payload]}}case"SET_REVIEW_RESULTS":{if(!t.payload)return{...e,reviewResults:null,currentReviewId:null};let n=e.userRole==="admin",r={id:t.payload.id,componentId:t.payload.componentId,storyId:t.payload.storyId,modelId:t.payload.modelId,complianceScore:t.payload.complianceScore,issuesCount:t.payload.issuesCount,issues:t.payload.issues,createdAt:t.payload.createdAt,visualSimilarity:t.payload.visualSimilarity,storybookImageData:e.storybookImageUrl||void 0,figmaImageData:e.figmaImageUrl||void 0,aiPrompt:n&&e.fullPrompt||void 0,aiResponse:n&&e.fullResponse||void 0,costUsd:t.payload.costUsd,inputTokens:t.payload.inputTokens,outputTokens:t.payload.outputTokens},o=e.reviewHistory.findIndex(s=>s.id===t.payload.id),i;return o>=0?i=e.reviewHistory.map((s,a)=>a===o?r:s):i=[...e.reviewHistory,r],i=zl(i),Jn(i),{...e,reviewResults:t.payload,reviewHistory:i,currentReviewId:t.payload.id}}case"UPDATE_MULTI_MODEL_STREAMING":return e.multiModelResults?{...e,multiModelResults:{...e.multiModelResults,byModel:{...e.multiModelResults.byModel,[t.payload.modelId]:{...e.multiModelResults.byModel[t.payload.modelId],streamingMessages:t.payload.messages}}}}:{...e,multiModelResults:{byModel:{[t.payload.modelId]:{streamingMessages:t.payload.messages}},activeModelId:t.payload.modelId}};case"SET_MODEL_COMPLETED":return e.multiModelResults?{...e,multiModelResults:{...e.multiModelResults,byModel:{...e.multiModelResults.byModel,[t.payload]:{...e.multiModelResults.byModel[t.payload],completed:!0}}}}:e;case"BULK_ADD_REVIEWS":{let n=new Set(e.reviewHistory.map(i=>i.id)),r=t.payload.filter(i=>!n.has(i.id));if(r.length===0)return e;let o=zl([...e.reviewHistory,...r]);return Jn(o),{...e,reviewHistory:o}}case"ADD_REVIEW":{let n=zl([...e.reviewHistory,t.payload]);return Jn(n),{...e,reviewHistory:n,currentReviewId:t.payload.id}}case"TOGGLE_ISSUE_SELECTION":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload?{...o,selectedForFix:!o.selectedForFix}:o)});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_ISSUE_STATUS":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload.issueId?{...o,status:t.payload.status,error:t.payload.error}:o)});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_ISSUE_GENERATED_FIX":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload.issueId?{...o,generatedFix:o.generatedFix?{...o.generatedFix,...t.payload.generatedFix}:t.payload.generatedFix,selectedForFix:t.payload.generatedFix?.status==="failed"?!1:o.selectedForFix}:o)});return Jn(n),{...e,reviewHistory:n}}case"BATCH_UPDATE_ISSUE_GENERATED_FIXES":{if(!e.currentReviewId)return e;let n=new Map(t.payload.map(o=>[o.issueId,o.generatedFix])),r=e.reviewHistory.map(o=>o.id!==e.currentReviewId?o:{...o,issues:o.issues.map(i=>{let s=n.get(i.id);return s?{...i,generatedFix:i.generatedFix?{...i.generatedFix,...s}:s,selectedForFix:s?.status==="failed"?!1:i.selectedForFix}:i})});return Jn(r),{...e,reviewHistory:r}}case"DISMISS_ISSUE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.map(c=>c.id===t.payload.issueId?{...c,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:c),i=o.filter(c=>!c.dismissed),s=i.filter(c=>c.severity==="critical").length,a=i.filter(c=>c.severity==="major").length,u=i.filter(c=>c.severity==="minor").length;return{...r,issues:o,complianceScore:To(s,a,u),issuesCount:i.length}});return Jn(n),{...e,reviewHistory:n}}case"UNDISMISS_ISSUE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.map(c=>c.id===t.payload?{...c,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:c),i=o.filter(c=>!c.dismissed),s=i.filter(c=>c.severity==="critical").length,a=i.filter(c=>c.severity==="major").length,u=i.filter(c=>c.severity==="minor").length;return{...r,issues:o,complianceScore:To(s,a,u),issuesCount:i.length}});return Jn(n),{...e,reviewHistory:n}}case"RECALCULATE_SCORE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.filter(c=>!c.dismissed),i=o.filter(c=>c.severity==="critical").length,s=o.filter(c=>c.severity==="major").length,a=o.filter(c=>c.severity==="minor").length,u=To(i,s,a);return y.debug(`[recalculateScore] Active: ${o.length}, score: ${u}`),{...r,complianceScore:u,issuesCount:o.length}});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_REVIEW_SCORE":{let n=e.reviewHistory.map(r=>r.id!==t.payload.reviewId?r:{...r,complianceScore:t.payload.newScore});return Jn(n),{...e,reviewHistory:n}}case"CLEAR_ALL_REVIEWS":return bw(),{...e,reviewHistory:[],currentReviewId:null};case"CLEAR_STALE_REVIEWS":return{...e,currentReviewId:null,reviewResults:null};case"RESET_REVIEW":{let n=e.isReviewing;return{...e,isReviewing:!1,reviewError:null,reviewResults:n?null:e.reviewResults,multiModelResults:null,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:n?"chat":e.reviewDetailTab,fullPrompt:"",fullResponse:"",figmaImageUrl:n?null:e.figmaImageUrl,storybookImageUrl:n?null:e.storybookImageUrl,currentReviewId:n?null:e.currentReviewId}}case"RESET_PROMPT":return{...e,isGenerating:!1,generatedPrompt:null,promptError:null};case"TRIGGER_SCREENSHOT_REFRESH":return{...e,screenshotRefreshKey:e.screenshotRefreshKey+1};default:return e}}function Bf({children:e}){let[t,n]=CD(ED,BD),r=TD(t);ID(()=>{r.current=t},[t]);let o=Sw(()=>({setIsReviewing:s=>n({type:"SET_STATE",payload:{isReviewing:s}}),setReviewError:s=>n({type:"SET_STATE",payload:{reviewError:s}}),bulkAddReviews:s=>n({type:"BULK_ADD_REVIEWS",payload:s}),setReviewResults:s=>n({type:"SET_REVIEW_RESULTS",payload:s}),setMultiModelResults:s=>n({type:"SET_STATE",payload:{multiModelResults:s}}),updateMultiModelStreamingMessages:(s,a)=>n({type:"UPDATE_MULTI_MODEL_STREAMING",payload:{modelId:s,messages:a}}),setModelCompleted:s=>n({type:"SET_MODEL_COMPLETED",payload:s}),setActiveModelId:s=>{let a=r.current;a.multiModelResults&&n({type:"SET_STATE",payload:{multiModelResults:{...a.multiModelResults,activeModelId:s}}})},setShowReviewMenu:s=>n({type:"SET_STATE",payload:{showReviewMenu:s}}),setSeverityFilter:s=>n({type:"SET_STATE",payload:{severityFilter:s}}),setShowStreamingPanel:s=>n({type:"SET_STATE",payload:{showStreamingPanel:s}}),setStreamingPanelCollapsed:s=>n({type:"SET_STATE",payload:{streamingPanelCollapsed:s}}),addStreamingMessage:s=>n({type:"ADD_STREAMING_MESSAGE",payload:s}),updateStreamingMessage:(s,a)=>n({type:"UPDATE_STREAMING_MESSAGE",payload:{index:s,content:a}}),clearStreamingMessages:()=>n({type:"CLEAR_STREAMING_MESSAGES"}),setStreamingProgress:s=>n({type:"SET_STATE",payload:{streamingProgress:s}}),setStreamingStatus:s=>n({type:"SET_STATE",payload:{streamingStatus:s}}),setReviewDetailTab:s=>n({type:"SET_STATE",payload:{reviewDetailTab:s}}),setFullPrompt:s=>n({type:"SET_STATE",payload:{fullPrompt:s}}),setFullResponse:s=>n({type:"SET_STATE",payload:{fullResponse:s}}),setFigmaImageUrl:s=>n({type:"SET_STATE",payload:{figmaImageUrl:s}}),setStorybookImageUrl:s=>n({type:"SET_STATE",payload:{storybookImageUrl:s}}),setFigmaDimensions:s=>n({type:"SET_STATE",payload:{figmaDimensions:s}}),setSelectedModels:s=>n({type:"SET_STATE",payload:{selectedModels:s}}),toggleModel:s=>n({type:"TOGGLE_MODEL",payload:s}),setModelComparisonView:s=>n({type:"SET_STATE",payload:{modelComparisonView:s}}),resetReview:()=>n({type:"RESET_REVIEW"}),addReview:s=>n({type:"ADD_REVIEW",payload:s}),getCurrentReview:()=>{let s=r.current;return s.currentReviewId&&s.reviewHistory.find(a=>a.id===s.currentReviewId)||null},getReviewById:s=>r.current.reviewHistory.find(a=>a.id===s)||null,getParentReview:()=>{let s=r.current,a=s.reviewHistory.find(u=>u.id===s.currentReviewId);return a?.parentReviewId&&s.reviewHistory.find(u=>u.id===a.parentReviewId)||null},hasAppliedFixes:()=>{let s=r.current,a=s.reviewHistory.find(u=>u.id===s.currentReviewId);return!a||!Array.isArray(a.issues)||a.issues.length===0?!1:a.issues.some(u=>u.status==="applied"||u.generatedFix?.status==="applied")},toggleIssueSelection:s=>n({type:"TOGGLE_ISSUE_SELECTION",payload:s}),updateIssueStatus:(s,a,u)=>n({type:"UPDATE_ISSUE_STATUS",payload:{issueId:s,status:a,error:u}}),updateIssueGeneratedFix:(s,a)=>n({type:"UPDATE_ISSUE_GENERATED_FIX",payload:{issueId:s,generatedFix:a}}),batchUpdateIssueGeneratedFixes:s=>n({type:"BATCH_UPDATE_ISSUE_GENERATED_FIXES",payload:s}),dismissIssue:(s,a,u)=>n({type:"DISMISS_ISSUE",payload:{issueId:s,reason:a,dismissedBy:u}}),undismissIssue:s=>n({type:"UNDISMISS_ISSUE",payload:s}),recalculateScore:()=>n({type:"RECALCULATE_SCORE"}),updateReviewScore:(s,a)=>n({type:"UPDATE_REVIEW_SCORE",payload:{reviewId:s,newScore:a}}),clearAllReviews:()=>n({type:"CLEAR_ALL_REVIEWS"}),clearStaleReviewsForStory:s=>n({type:"CLEAR_STALE_REVIEWS",payload:s}),setIsApplying:s=>n({type:"SET_STATE",payload:{isApplying:s}}),setApplyFixesResult:s=>n({type:"SET_STATE",payload:{applyFixesResult:s}}),setIncludeComponentIssues:s=>n({type:"SET_STATE",payload:{includeComponentIssues:s}}),setIncludeTextComparison:s=>n({type:"SET_STATE",payload:{includeTextComparison:s}}),setUsePromptCache:s=>n({type:"SET_STATE",payload:{usePromptCache:s}}),setIsValidating:s=>n({type:"SET_STATE",payload:{isValidating:s}}),setValidationUsage:s=>n({type:"SET_STATE",payload:{validationUsage:s}}),setWorkspacePath:s=>n({type:"SET_STATE",payload:{workspacePath:s}}),triggerScreenshotRefresh:()=>n({type:"TRIGGER_SCREENSHOT_REFRESH"}),setHoveredIssueId:s=>n({type:"SET_STATE",payload:{hoveredIssueId:s}}),setFeatureFlags:s=>n({type:"SET_STATE",payload:{featureFlags:s}}),setUserRole:s=>n({type:"SET_STATE",payload:{userRole:s}}),setRoleOverride:s=>{try{s?localStorage.setItem("uicopilot_role_override",s):localStorage.removeItem("uicopilot_role_override")}catch{}n({type:"SET_STATE",payload:{roleOverride:s}})},setReviewAllConcurrency:s=>{let a=Math.max(1,Math.min(5,s));try{localStorage.setItem("uicopilot_review_all_concurrency",String(a))}catch{}n({type:"SET_STATE",payload:{reviewAllConcurrency:a}})},setIsGenerating:s=>n({type:"SET_STATE",payload:{isGenerating:s}}),setGeneratedPrompt:s=>n({type:"SET_STATE",payload:{generatedPrompt:s}}),setPromptError:s=>n({type:"SET_STATE",payload:{promptError:s}}),resetPrompt:()=>n({type:"RESET_PROMPT"})}),[]),i=Sw(()=>({...t,...o}),[t,o]);return wD.createElement(vw.Provider,{value:i},e)}function ce(){let e=kD(vw);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var ww,FD,AD,PD,Mf,LD,MD,BD,vw,Df=_(()=>{"use strict";Rn();Lf();Oe();ww=20,FD=5;AD=()=>{if(typeof localStorage>"u")return 3;try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 3},PD=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},Mf={enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},LD=()=>{if(typeof localStorage>"u")return Mf;try{let e=localStorage.getItem("uicopilot_feature_flags");if(!e)return Mf;let t=JSON.parse(e);return{enableFixGeneration:!!t.enableFixGeneration,enableFixApply:!!t.enableFixApply,enableAutoMap:!!t.enableAutoMap,enableReviewBadges:!!t.enableReviewBadges,showCosts:!!t.showCosts,enableParallelReview:!!t.enableParallelReview,enableModelSelection:!!t.enableModelSelection}}catch{}return Mf},MD=()=>{if(typeof localStorage>"u")return"beta";try{let e=localStorage.getItem("uicopilot_user_role");if(e==="admin"||e==="beta")return e}catch{}return"beta"},BD={isReviewing:!1,reviewError:null,reviewResults:null,multiModelResults:null,showReviewMenu:!1,severityFilter:"all",showStreamingPanel:!1,streamingPanelCollapsed:!1,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:"chat",fullPrompt:"",fullResponse:"",figmaImageUrl:null,storybookImageUrl:null,figmaDimensions:null,selectedModels:["claude-sonnet-4-5-20250929"],modelComparisonView:"side-by-side",reviewHistory:zl(Pf()),currentReviewId:null,includeComponentIssues:!0,includeTextComparison:!1,usePromptCache:!1,isApplying:!1,applyFixesResult:null,screenshotRefreshKey:0,isValidating:!1,validationUsage:null,lastAiCallTimestamp:null,aiRateLimitSeconds:0,isGenerating:!1,generatedPrompt:null,promptError:null,workspacePath:null,userRole:MD(),roleOverride:PD(),featureFlags:LD(),reviewAllConcurrency:AD(),hoveredIssueId:null},vw=vD(null)});import $s,{useMemo as DD}from"react";function zf({children:e}){return $s.createElement(mu,null,$s.createElement(xu,null,$s.createElement(bu,null,$s.createElement(Bf,null,$s.createElement(RD,null),e))))}function kw(e){let t=we(),n=Je(),r=nt(),o=ce(),i=DD(()=>({...t,...n,...r,...o}),[t,n,r,o]);return e?e(i):i}function RD(){return Rf=kw(),null}var Rf,gt,Cw=_(()=>{"use strict";hu();yu();Su();Df();Rf=null,gt=Object.assign(kw,{getState:()=>{if(!Rf)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return Rf}})});var Ce=_(()=>{"use strict";Cw();hu();yu();Su();Df()});function V(){return(process.env.STORYBOOK_UICOPILOT_URL||zD).replace(/\/$/,"")}var zD,Tw,je=_(()=>{"use strict";zD="https://app.uiparity.com";Tw=3.6});async function ne(e,t,n=3e4){let r=new AbortController,o=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${n}ms: ${e}`):i}finally{clearTimeout(o)}}var ct=_(()=>{"use strict"});import{useEffect as Zo,useState as Ol,useRef as Uw,useCallback as $f}from"react";import{addons as Uf}from"storybook/manager-api";async function OR(e,t,n){let r=`${e}:${t}`,o=jf.get(r);if(o)return y.debug("[useReviewScreenshots] Reusing in-flight Figma image fetch for",r),o;let i=(async()=>{let s=await ne(`${Gw}/api/figma/image?projectId=${e}&nodeId=${t}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});return s.ok?s.json():{imageUrl:null}})().finally(()=>{jf.delete(r)});return jf.set(r,i),i}function _R(e,t,n){try{sessionStorage.setItem(`${_l}${e}`,JSON.stringify({figmaNodeId:t,imageUrl:n,timestamp:Date.now()}))}catch{}}function $R(e,t){try{let n=sessionStorage.getItem(`${_l}${e}`);if(!n)return null;let r=JSON.parse(n);if(r.figmaNodeId===t&&Date.now()-r.timestamp<1800*1e3)return r.imageUrl;sessionStorage.removeItem(`${_l}${e}`)}catch{}return null}function UR(e){try{let t=sessionStorage.getItem(`${_l}${e}`);if(!t)return null;let n=JSON.parse(t);if(n.imageUrl&&Date.now()-n.timestamp<300*1e3)return n.imageUrl}catch{}return null}var jw,Hw,Ww,Vw,Bi,Gw,zn,Hf,jf,_l,qw,Yw,ei,Di=_(()=>{"use strict";Ce();Wf();Oe();je();ct();jw="storyArgsUpdated",Hw="storyRendered",Ww="forceRemount",Vw=null,Bi=()=>Vw,Gw=V(),zn=new Map,Hf=null,jf=new Map;_l="uicopilot-figma-image-";qw=(e,t,n)=>{let r=zn.get(e);r?(r.storybookImageUrl=t,n&&(r.figmaImageUrl=n)):zn.set(e,{storybookImageUrl:t,figmaImageUrl:n??null}),y.debug("[useReviewScreenshots] Populated historical screenshots for story:",e)},Yw=(e,t,n)=>{Hf=t;let r=zn.get(e);r?r.figmaImageUrl=n:zn.set(e,{storybookImageUrl:null,figmaImageUrl:n}),y.debug("[useReviewScreenshots] Pre-set Figma image for mapping:",{storyId:e,figmaNodeId:t,imageUrl:n.substring(0,50)+"..."})},ei=()=>{let[e,t]=Ol(!1),[n,r]=Ol(!1),[o,i]=Ol(!1),[s,a]=Ol(null),u=Uw(null),{screenshotRefreshKey:c,triggerScreenshotRefresh:l}=ce(),d=$f(()=>{let P=gt.getState().currentStoryId;P&&(y.debug("[useReviewScreenshots] Refreshing screenshots for story:",P),zn.delete(P),u.current=null,i(!0),l())},[l]),g=$f(()=>{let P=gt.getState().currentStoryId;if(P){y.debug("[useReviewScreenshots] Refreshing Storybook screenshot only for story:",P);let z=zn.get(P);z&&(z.storybookImageUrl=null),u.current=null,i(!0),l()}},[l]),{sessionToken:p}=we(),{selectedProjectId:f}=Je(),{currentStoryId:k,currentMapping:T,loadingMapping:E}=nt(),{setStorybookImageUrl:I,setFigmaImageUrl:D}=ce(),R=Uw(null);Zo(()=>{k&&R.current&&R.current!==k&&(y.debug("[useReviewScreenshots] Story switched, clearing images"),I(""),D("")),R.current=k},[k,I,D]),Zo(()=>{!k||E||T||D("")},[k,T,E,D]),Zo(()=>{if(!k)return;let P=UR(k);P&&(y.debug("[useReviewScreenshots] Quick-restored Figma image for:",k),D(P))},[k,D]),Zo(()=>{let P=!1;return(async()=>{if(!p||!f||!k){y.debug("[useReviewScreenshots] Missing required context, skipping auto-load");return}u.current&&u.current!==k&&(y.debug("[useReviewScreenshots] Story changed, clearing stale screenshots"),I(""),D(""));let x=gt.getState();if(u.current===k&&x.storybookImageUrl&&x.figmaImageUrl){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping capture");return}let w=T?.figmaNodeId??null;if(w!==Hf){y.debug("[useReviewScreenshots] Figma mapping changed, invalidating Figma image only for story:",k);let L=zn.get(k);L&&(L.figmaImageUrl=null),Hf=w,u.current=null}let v=T?.figmaNodeId;if(v&&!zn.get(k)?.figmaImageUrl){let L=$R(k,v);if(L){y.debug("[useReviewScreenshots] Hydrated Figma image from sessionStorage for story:",k),D(L);let B=zn.get(k);B?B.figmaImageUrl=L:zn.set(k,{storybookImageUrl:null,figmaImageUrl:L})}}let C=zn.get(k),m=C&&C.storybookImageUrl&&C.figmaImageUrl,F=C&&C.storybookImageUrl&&!C.figmaImageUrl,S=C&&!C.storybookImageUrl&&C.figmaImageUrl;if(m){y.debug("[useReviewScreenshots] Using fully cached screenshots for story:",k),I(C.storybookImageUrl),D(C.figmaImageUrl),u.current=k;return}let b=F&&T?.figmaNodeId;b&&(y.debug("[useReviewScreenshots] Using cached Storybook, fetching new Figma for story:",k),I(C.storybookImageUrl));let A=S;if(A&&(y.debug("[useReviewScreenshots] Using cached Figma, recapturing Storybook for story:",k),D(C.figmaImageUrl)),u.current===k&&T?.figmaNodeId){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping");return}try{if(a(null),b?r(!0):(A||(t(!0),r(!0)),i(!0)),u.current=k,P)return;let L=A?C.figmaImageUrl:null,B;if(A)y.debug("[useReviewScreenshots] Figma cached (storybookOnlyRefresh), skipping fetch"),r(!1);else if(v){y.debug("[useReviewScreenshots] Found Figma node ID from mapping:",v);let h=null;try{y.debug("[useReviewScreenshots] Fetching Figma image (with caching)...");let j=await OR(f,v,p);h=j.imageUrl||null;let W=j.cached?"(cached)":"(fresh)";y.debug(`[useReviewScreenshots] Figma image fetched ${W}:`,h?"success":"not found")}catch(j){y.warn("[useReviewScreenshots] Failed to fetch Figma image:",j)}if(h)try{y.debug("[useReviewScreenshots] Fetching Figma image via proxy...");let j=`${Gw}/api/proxy/image?url=${encodeURIComponent(h)}`,W=await ne(j);if(W.ok){let M=await W.blob(),K=new FileReader,ee=await new Promise((xe,ae)=>{K.onloadend=()=>xe(K.result),K.onerror=ae,K.readAsDataURL(M)});L=ee,D(ee),y.debug("[useReviewScreenshots] Figma image loaded via proxy");let ge=new Image;await new Promise(xe=>{ge.onload=()=>{B={width:ge.naturalWidth,height:ge.naturalHeight},y.debug("[useReviewScreenshots] Figma dimensions:",B),xe()},ge.onerror=()=>xe(),ge.src=ee})}else L=h,D(h),y.warn("[useReviewScreenshots] Proxy failed, using direct URL as fallback")}catch(j){y.warn("[useReviewScreenshots] Proxy error, using direct URL as fallback:",j),L=h,D(h)}else y.warn("[useReviewScreenshots] No thumbnail found for node:",v),D(null);L&&v&&_R(k,v,L),r(!1)}else y.debug("[useReviewScreenshots] No Figma mapping exists for this component"),D(null),r(!1);let N=C?.storybookImageUrl||null;if(N)y.debug("[useReviewScreenshots] Using cached Storybook screenshot"),i(!1);else{y.debug("[useReviewScreenshots] Capturing Storybook screenshot for story:",k);let h=await $l({storyId:k,sessionToken:p||void 0,...B&&{figmaWidth:B.width,figmaHeight:B.height}});h&&!P?(N=h,I(h),y.debug("[useReviewScreenshots] Storybook screenshot captured at dimensions:",B||"natural")):y.warn("[useReviewScreenshots] Failed to capture Storybook screenshot"),i(!1)}zn.set(k,{storybookImageUrl:N,figmaImageUrl:L}),y.debug("[useReviewScreenshots] Screenshots cached for story:",k)}catch(L){y.error("[useReviewScreenshots] Error loading screenshots:",L),a(L instanceof Error?L.message:"Failed to load screenshots"),u.current=null,r(!1),i(!1)}finally{t(!1)}})(),()=>{P=!0}},[p,f,k,T?.figmaNodeId,c]),Zo(()=>{let P=Uf.getChannel(),z=null,x=w=>{Vw=w.args,y.debug("[useReviewScreenshots] Args updated for story:",w.storyId,"args:",w.args),z&&clearTimeout(z),z=setTimeout(()=>{y.debug("[useReviewScreenshots] Story args changed, refreshing screenshot"),d()},500)};return P.on(jw,x),()=>{P.off(jw,x),z&&clearTimeout(z)}},[d]),Zo(()=>{let P=Uf.getChannel(),z=!1,x=null,w=()=>{y.debug("[useReviewScreenshots] FORCE_REMOUNT detected, showing Storybook loader"),z=!0,i(!0)},v=()=>{z&&(y.debug("[useReviewScreenshots] STORY_RENDERED after remount, waiting for styles to settle..."),x&&clearTimeout(x),x=setTimeout(()=>{z=!1,y.debug("[useReviewScreenshots] Refreshing Storybook screenshot after HMR (preserving Figma)"),g()},500))};return P.on(Ww,w),P.on(Hw,v),()=>{P.off(Ww,w),P.off(Hw,v),x&&clearTimeout(x)}},[g]),Zo(()=>{let P=Uf.getChannel(),z=async x=>{if(!x?.snapshot?.html){y.debug("[useReviewScreenshots] DOM mutated but no snapshot available");return}y.debug("[useReviewScreenshots] DOM mutated, capturing snapshot screenshot"),i(!0);try{let w=gt.getState().currentStoryId,v=await fetch("/__uicopilot/screenshot-snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...x.snapshot,storyId:w})});if(v.ok){let C=await v.json();if(C.screenshot){I(C.screenshot);let m=gt.getState().currentStoryId;if(m){let F=zn.get(m);F?F.storybookImageUrl=C.screenshot:zn.set(m,{storybookImageUrl:C.screenshot,figmaImageUrl:null})}}}else y.error("[useReviewScreenshots] Snapshot screenshot failed:",await v.text())}catch(w){y.error("[useReviewScreenshots] Snapshot screenshot error:",w)}finally{i(!1)}};return P.on("UICOPILOT/STORY_DOM_MUTATED",z),()=>{P.off("UICOPILOT/STORY_DOM_MUTATED",z)}},[]);let $=$f((P,z,x)=>{y.debug("[useReviewScreenshots] setFigmaImageDirect called - bypassing load"),Yw(P,z,x),D(x),r(!1),u.current=P},[D]);return{isLoadingScreenshots:e,isLoadingFigma:n,isLoadingStorybook:o,screenshotError:s,refreshScreenshots:d,refreshStorybookOnly:g,setFigmaImageDirect:$}}});function HR(){return!V().startsWith("http://localhost")}function WR(e,t,n){let r=t.createElement("div");r.style.color=e,t.body.appendChild(r);let o=n.getComputedStyle(r).color;return r.remove(),o}function Kw(e,t,n){let r=new Map;return e.replace(/(?:color|oklch|oklab|lab|lch)\([^)]+\)/g,o=>{if(r.has(o))return r.get(o);let i=WR(o,t,n);return r.set(o,i),i})}async function VR(){let e=(await import("html2canvas")).default,t=document.getElementById("storybook-preview-iframe");if(!t?.contentDocument||!t.contentWindow)throw new Error("Storybook iframe not accessible");let n=t.contentDocument.querySelector("#storybook-root > *")||t.contentDocument.querySelector("#root > *");if(!n)throw new Error("Story element not found in iframe");let r=t.contentWindow,o=t.contentDocument;return(await e(n,{useCORS:!0,logging:!1,backgroundColor:null,onclone:s=>{s.querySelectorAll("style").forEach(u=>{let c=u.textContent||"";/(?:color|oklch|oklab|lab|lch)\(/.test(c)&&(u.textContent=Kw(c,o,r))});let a=Array.from(o.styleSheets);s.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let c=u.href,l=a.find(d=>d.href===c);if(l)try{let d="";for(let g of Array.from(l.cssRules))d+=g.cssText+`
13
13
  `;if(/(?:color|oklch|oklab|lab|lch)\(/.test(d)){let g=s.createElement("style");g.textContent=Kw(d,o,r),u.replaceWith(g)}}catch{}})}})).toDataURL("image/png")}function GR(e){let t=[];for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o;typeof r=="boolean"?o=`!${r}`:typeof r=="number"?o=String(r):typeof r=="string"?o=encodeURIComponent(r).replace(/%20/g,"+"):o=encodeURIComponent(JSON.stringify(r)),t.push(`${n}:${o}`)}return t.join(";")}async function qR(e,t){y.debug("[Screenshot] Using server-side Chrome capture for:",e);let n={"Content-Type":"application/json"};t?.sessionToken&&(n.Authorization=`Bearer ${t.sessionToken}`);let r=await ne(`${jR}/api/screenshot`,{method:"POST",headers:n,body:JSON.stringify({url:e,selector:t?.selector,width:t?.width,height:t?.height,scale:t?.scale||1,figmaWidth:t?.figmaWidth,figmaHeight:t?.figmaHeight})});if(!r.ok){let i=await r.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||`Screenshot failed: ${r.status}`)}return(await r.json()).screenshot}function YR(e){let t={};if(!e)return t;let n=e.split(";");for(let r of n){let o=r.indexOf(":");if(o===-1)continue;let i=r.slice(0,o),s=r.slice(o+1);typeof s=="string"&&(s==="!true"?s=!0:s==="!false"?s=!1:!isNaN(Number(s))&&s!==""?s=Number(s):s=decodeURIComponent(s.replace(/\+/g," "))),t[i]=s}return t}function KR(e){let t=new URLSearchParams(window.location.search),n=e;if(n||(n=(t.get("path")||"").replace("/story/","").replace("/docs/",""),y.debug("[Screenshot] Warning: Using story ID from URL (fallback):",n)),!n)throw new Error("Could not determine current story ID. Please select a story first.");let r=window.location.origin,o=Date.now(),i=`${r}/iframe.html?viewMode=story&id=${n}&globals=&_cb=${o}`,s=Bi();if(!s||Object.keys(s).length===0){let a=t.get("args");a&&(s=YR(a),y.debug("[Screenshot] Parsed args from URL:",s))}if(s&&Object.keys(s).length>0){let a=GR(s);i+=`&args=${a}`,y.debug("[Screenshot] Using URL with current args:",i)}else y.debug("[Screenshot] No current args, using default URL:",i);return i}async function XR(e){try{let t=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(t.status===501)return y.info("[Screenshot] Local Puppeteer not available, falling back"),null;if(!t.ok){let r=await t.json().catch(()=>({error:"Unknown"}));throw new Error(r.error||`Screenshot failed: ${t.status}`)}let n=await t.json();return y.info("[Screenshot] Captured via local Puppeteer (pixel-perfect)"),n.screenshot}catch(t){if(t instanceof TypeError&&t.message.includes("fetch"))return null;throw t}}async function $l(e){let t=e?.storyId||QR();if(t){let n=Vf.get(t);if(n)return y.debug("[Screenshot] Reusing in-flight capture for",t),n;let r=Xw(t,e).finally(()=>{Vf.delete(t)});return Vf.set(t,r),r}return Xw(void 0,e)}async function Xw(e,t){try{if(e){let n=await XR(e);if(n)return n}if(!HR()){let n=KR(t?.storyId);return await qR(n,{...t,selector:"#storybook-root > *"})}return y.info("[Screenshot] Using client-side capture (html2canvas fallback)"),await VR()}catch(n){throw y.error("Error capturing screenshot:",n),new Error(`Failed to capture screenshot: ${n instanceof Error?n.message:"Unknown error"}`)}}function QR(){return(new URLSearchParams(window.location.search).get("path")||"").replace("/story/","").replace("/docs/","")||void 0}var jR,Vf,Wf=_(()=>{"use strict";je();Di();Oe();ct();jR=V();Vf=new Map});function Tn(e){if(e==="transparent"||e==="rgba(0, 0, 0, 0)")return"transparent";let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t)return e;let[,n,r,o,i]=t,s=i?parseFloat(i):1;return s<1?`rgba(${n}, ${r}, ${o}, ${s})`:`#${[n,r,o].map(u=>parseInt(u).toString(16).padStart(2,"0")).join("")}`}function Nn(e,t){let r={backgroundColor:["transparent","rgba(0, 0, 0, 0)"],border:["none","0px none","0px none rgb(0, 0, 0)"],borderRadius:["0px"],boxShadow:["none"],opacity:["1"],gap:["normal","0px"],flexDirection:["row"],justifyContent:["normal","flex-start"],alignItems:["normal","stretch"],textAlign:["start","left"],letterSpacing:["normal","0px"],margin:["0px","0px 0px 0px 0px"],padding:["0px","0px 0px 0px 0px"]}[e];return r?r.includes(t):!1}function Vs(e){return e.split(",").map(n=>n.trim().replace(/['"]/g,""))[0]||e}function Qw(e){let t=e.ownerDocument,r=(t.defaultView||window).getComputedStyle(e);if("fonts"in t){let T=r.fontSize||"16px",E=r.fontWeight||"400";if(r.fontFamily.includes("Roboto")){let I=t.fonts.check(`${E} ${T} Roboto`);if(y.debug("[computedStyles] Roboto check:",{cssFamily:r.fontFamily,robotoLoaded:I,fontWeight:E,fontSize:T,isIframe:t!==document,fontStatus:Array.from(t.fonts).map(D=>({family:D.family,status:D.status}))}),I)return"Roboto"}}let o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",s=t.createElement("canvas").getContext("2d");if(!s)return"unknown";let a=r.fontSize,u=r.fontWeight,c=r.fontStyle,l=r.fontFamily.split(",").map(T=>T.trim().replace(/['"]/g,"")),d=["Arial","Helvetica","Helvetica Neue","Times New Roman","Georgia","Courier New","Verdana","Tahoma","Trebuchet MS","sans-serif","serif","monospace"],g=[...new Set([...l,...d])];s.font=`${c} ${u} ${a} monospace`;let p=s.measureText(o).width,f="unknown",k=new Map;for(let T of g){s.font=`${c} ${u} ${a} "${T}", monospace`;let E=s.measureText(o).width;if(k.set(T,E),E!==p){s.font=`${c} ${u} ${a} "${T}"`;let I=s.measureText(o).width;s.font=`${c} ${u} ${a} ${r.fontFamily}`;let D=s.measureText(o).width;if(Math.abs(I-D)<.1){f=T;break}}}return y.debug("[computedStyles] Font detection:",{declared:r.fontFamily,detected:f,declaredFonts:l,fontWidths:Array.from(k.entries()),isIframe:t!==document}),f}var Gs=_(()=>{"use strict";Oe()});function Ri(e,t){if(!t)return e;let n=t.split(" ").filter(i=>i.trim()),r=n.find(i=>!i.includes("--")),o=n.filter(i=>i.includes("--"));return r&&o.length>0?`${e}.${r}.${o[0]}`:r?`${e}.${r}`:n[0]?`${e}.${n[0]}`:e}function Gf(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e);return y.debug("[computedStyles] Extracting styles:",{fontFamily:n.fontFamily,fontWeight:n.fontWeight,borderRadius:n.borderRadius,backgroundColor:n.backgroundColor,padding:{top:n.paddingTop,right:n.paddingRight,bottom:n.paddingBottom,left:n.paddingLeft},isIframeContext:e.ownerDocument!==document}),{color:Tn(n.color),backgroundColor:Tn(n.backgroundColor),borderColor:Tn(n.borderColor),padding:{top:n.paddingTop,right:n.paddingRight,bottom:n.paddingBottom,left:n.paddingLeft},margin:{top:n.marginTop,right:n.marginRight,bottom:n.marginBottom,left:n.marginLeft},gap:n.gap,fontFamily:n.fontFamily,renderedFont:Qw(e),fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,textAlign:n.textAlign,textTransform:n.textTransform,width:n.width,height:n.height,minWidth:n.minWidth,minHeight:n.minHeight,maxWidth:n.maxWidth,maxHeight:n.maxHeight,borderWidth:n.borderWidth,borderStyle:n.borderStyle,borderRadius:n.borderRadius,boxShadow:n.boxShadow,textShadow:n.textShadow,display:n.display,flexDirection:n.display==="flex"?n.flexDirection:void 0,justifyContent:n.display==="flex"?n.justifyContent:void 0,alignItems:n.display==="flex"?n.alignItems:void 0,position:n.position,opacity:n.opacity,cursor:n.cursor}}function qf(e,t){let n={width:null,height:null,minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,display:null,flexGrow:null,flexShrink:null,flexBasis:null};try{let r=Array.from(t.styleSheets);for(let i of r)try{let s=i.cssRules||i.rules;if(!s)continue;for(let a of Array.from(s))if(a.type===1){let u=a;try{if(e.matches(u.selectorText)){let c=u.style;c.width&&(n.width=c.width),c.height&&(n.height=c.height),c.minWidth&&(n.minWidth=c.minWidth),c.minHeight&&(n.minHeight=c.minHeight),c.maxWidth&&(n.maxWidth=c.maxWidth),c.maxHeight&&(n.maxHeight=c.maxHeight),c.display&&(n.display=c.display),c.flexGrow&&(n.flexGrow=c.flexGrow),c.flexShrink&&(n.flexShrink=c.flexShrink),c.flexBasis&&(n.flexBasis=c.flexBasis)}}catch{continue}}}catch{continue}let o=e.style;o.width&&(n.width=o.width),o.height&&(n.height=o.height),o.minWidth&&(n.minWidth=o.minWidth),o.minHeight&&(n.minHeight=o.minHeight),o.maxWidth&&(n.maxWidth=o.maxWidth),o.maxHeight&&(n.maxHeight=o.maxHeight),o.display&&(n.display=o.display),o.flexGrow&&(n.flexGrow=o.flexGrow),o.flexShrink&&(n.flexShrink=o.flexShrink),o.flexBasis&&(n.flexBasis=o.flexBasis)}catch(r){y.error("Error extracting declared styles:",r)}return n}var Ul=_(()=>{"use strict";Oe();Gs()});function JR(e){let t=[],n=new Set,r=Jw.join(", "),o=e.querySelectorAll(r);for(let i of Array.from(o)){let s=`${i.tagName.toLowerCase()}.${i.className}`;n.has(s)||(n.add(s),t.push(i))}if(Jw.includes(e.tagName.toLowerCase())){let i=`${e.tagName.toLowerCase()}.${e.className}`;n.has(i)||t.unshift(e)}return t}function ZR(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"";return{selector:Ri(r,i),tagName:r,className:i,styles:{fontSize:n.fontSize,fontFamily:Vs(n.fontFamily),fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:Tn(n.color),textAlign:n.textAlign,textTransform:n.textTransform}}}function ez(e,t=2){let n=[e],r=new Set,o=s=>{let a=s.className;return typeof a=="string"?a:a?.baseVal||""};r.add(`${e.tagName}.${o(e)}`);function i(s,a){if(a>=t)return;let u=Array.from(s.children);for(let c of u){let l=c.tagName.toLowerCase();if(["script","style","link","meta","br","hr"].includes(l))continue;let d=`${c.tagName}.${o(c)}`;r.has(d)||(r.add(d),n.push(c),i(c,a+1))}}return i(e,0),n}function tz(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"",s=n.borderWidth!=="0px",a=n.backgroundColor!=="transparent"&&n.backgroundColor!=="rgba(0, 0, 0, 0)",u=n.borderRadius!=="0px",c=n.gap!=="normal"&&n.gap!=="0px";if(!s&&!a&&!u&&!c)return null;let l=n.borderWidth,d=n.borderStyle,g=Tn(n.borderColor),p=s?`${l} ${d} ${g}`:"none";return{selector:Ri(r,i),className:i,border:p,borderRadius:n.borderRadius,backgroundColor:Tn(n.backgroundColor),gap:n.gap}}function qs(){y.debug("[computedStyles] extractStoryStyles called - FULL CONTEXT VERSION");try{let e=document.getElementById("storybook-preview-iframe");if(!e||!e.contentDocument)throw new Error("Storybook preview iframe not found");let t=e.contentDocument,n=t.getElementById("storybook-root");if(!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(!r)throw new Error("Component element not found in story root");let o=ez(r,2),i=o.map(tz).filter(a=>a!==null);y.debug("[computedStyles] Extracted visual styles from nested elements:",{total:o.length,withVisuals:i.length,elements:i.map(a=>({selector:a.selector,border:a.border,background:a.backgroundColor,borderRadius:a.borderRadius}))});let s=[];try{let a=JR(r);s=a.map(ZR),y.debug("[computedStyles] Text elements found:",{count:a.length,elements:s.map(u=>({selector:u.selector,fontSize:u.styles.fontSize,fontWeight:u.styles.fontWeight}))})}catch(a){y.error("[computedStyles] Error extracting text elements:",a)}return{computed:Gf(r),declared:qf(r,t),markup:r.outerHTML,textElementStyles:s,nestedElementStyles:i}}catch(e){return y.error("Error extracting computed styles:",e),null}}var Jw,Zw=_(()=>{"use strict";Oe();Gs();Ul();Jw=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});function Yf(e,t,n,r){return e===t&&t===n&&n===r?e:e===n&&t===r?`${e} ${t}`:t===r?`${e} ${t} ${n}`:`${e} ${t} ${n} ${r}`}function rz(e,t,n){if(!(e==="0px"||t==="none"))return`${e} ${t} ${n}`}function oz(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r={},o=Tn(n.backgroundColor);Nn("backgroundColor",o)||(r.backgroundColor=o);let i=rz(n.borderWidth,n.borderStyle,Tn(n.borderColor));i&&(r.border=i),Nn("borderRadius",n.borderRadius)||(r.borderRadius=n.borderRadius),Nn("boxShadow",n.boxShadow)||(r.boxShadow=n.boxShadow),Nn("opacity",n.opacity)||(r.opacity=n.opacity);let s=e.tagName.toLowerCase(),a=["svg","circle","rect","ellipse","line","polyline","polygon","path","text","tspan","g","use","defs","clipPath","mask"];if(e instanceof SVGElement||a.includes(s)){for(let T=0;T<e.attributes.length;T++){let E=e.attributes[T];if(["class","style","id","xmlns","xmlns:xlink"].includes(E.name))continue;let I=E.name.replace(/-([a-z])/g,(R,$)=>$.toUpperCase()),D=E.value.startsWith("rgb")?Tn(E.value):E.value;I==="d"&&D.length>100?r[I]=D.substring(0,100)+"...":r[I]=D}let p=n.getPropertyValue("fill"),f=n.getPropertyValue("stroke");if(p&&p!=="none"&&(r.fill=p.startsWith("rgb")?Tn(p):p),f&&f!=="none"&&(r.stroke=f.startsWith("rgb")?Tn(f):f),["circle","ellipse","rect","path","line","polyline","polygon"].includes(s)){let T=e.getBoundingClientRect();T.width>0&&(r.width=`${Math.round(T.width*100)/100}px`),T.height>0&&(r.height=`${Math.round(T.height*100)/100}px`)}}let c=e.textContent&&e.textContent.trim().length>0,l=nz.includes(e.tagName.toLowerCase());(c||l)&&(r.fontSize=n.fontSize,r.fontFamily=Vs(n.fontFamily),r.fontWeight=n.fontWeight,r.lineHeight=n.lineHeight,r.color=Tn(n.color),Nn("letterSpacing",n.letterSpacing)||(r.letterSpacing=n.letterSpacing),Nn("textAlign",n.textAlign)||(r.textAlign=n.textAlign)),r.display=n.display;let d=Yf(n.paddingTop,n.paddingRight,n.paddingBottom,n.paddingLeft);Nn("padding",d)||(r.padding=d);let g=Yf(n.marginTop,n.marginRight,n.marginBottom,n.marginLeft);return Nn("margin",g)||(r.margin=g),Nn("gap",n.gap)||(r.gap=n.gap),(n.display==="flex"||n.display==="inline-flex")&&(Nn("flexDirection",n.flexDirection)||(r.flexDirection=n.flexDirection),Nn("justifyContent",n.justifyContent)||(r.justifyContent=n.justifyContent),Nn("alignItems",n.alignItems)||(r.alignItems=n.alignItems)),r.width||(r.width=n.width),r.height||(r.height=n.height),r}function ev(e){let t=1;for(let n of e.children)t+=ev(n);return t}function tv(e,t=4){function n(o,i){let s=o.tagName.toLowerCase(),a=o.className,u=typeof a=="string"?a:a?.baseVal||"",c=o.id||void 0,l=o.getAttribute("role")||void 0,d;for(let k of Array.from(o.childNodes))if(k.nodeType===Node.TEXT_NODE){let T=k.textContent?.trim();if(T){d=T.length>50?T.substring(0,50)+"...":T;break}}let g=s;c?g=`${s}#${c}`:u&&(g=Ri(s,u));let p=oz(o),f=[];if(i<t){let k=Array.from(o.children);for(let T of k){let E=T.tagName.toLowerCase();if(["script","style","link","meta","br","hr","noscript"].includes(E))continue;let D=(T.ownerDocument.defaultView||window).getComputedStyle(T);D.display==="none"||D.visibility==="hidden"||f.push(n(T,i+1))}}return{selector:g,tagName:s,className:u,id:c,role:l,textContent:d,styles:p,children:f}}y.debug("[computedStyles] Extracting DOM tree with maxDepth:",t);let r=n(e,0);return y.debug("[computedStyles] DOM tree extracted:",{rootSelector:r.selector,childrenCount:r.children.length,totalNodes:ev(r)}),r}function Kf(e=4){y.debug("[extractStoryDOMTree] Starting DOM tree extraction...");try{let t=document.getElementById("storybook-preview-iframe");if(y.debug("[extractStoryDOMTree] iframe found:",!!t),!t)throw new Error("Storybook preview iframe not found");if(y.debug("[extractStoryDOMTree] iframe.contentDocument:",!!t.contentDocument),!t.contentDocument)throw new Error("iframe.contentDocument is not accessible (possible cross-origin issue)");let n=t.contentDocument.getElementById("storybook-root");if(y.debug("[extractStoryDOMTree] storyRoot found:",!!n),!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(y.debug("[extractStoryDOMTree] componentElement found:",!!r,r?.tagName),!r)throw new Error("Component element not found in story root");let o=tv(r,e);return y.debug("[extractStoryDOMTree] DOM tree extracted successfully:",{selector:o.selector,childrenCount:o.children.length}),o}catch(t){return y.error("[extractStoryDOMTree] Error extracting DOM tree:",t),null}}var nz,nv=_(()=>{"use strict";Oe();Gs();Ul();nz=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});var Xf=_(()=>{"use strict";Gs();Ul();Zw();nv()});var Ev=rr((cQ,Fv)=>{"use strict";Fv.exports={compareTwoStrings:Iv,findBestMatch:Az};function Iv(e,t){if(e=e.replace(/\s+/g,""),t=t.replace(/\s+/g,""),e===t)return 1;if(e.length<2||t.length<2)return 0;let n=new Map;for(let o=0;o<e.length-1;o++){let i=e.substring(o,o+2),s=n.has(i)?n.get(i)+1:1;n.set(i,s)}let r=0;for(let o=0;o<t.length-1;o++){let i=t.substring(o,o+2),s=n.has(i)?n.get(i):0;s>0&&(n.set(i,s-1),r++)}return 2*r/(e.length+t.length-2)}function Az(e,t){if(!Pz(e,t))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");let n=[],r=0;for(let i=0;i<t.length;i++){let s=t[i],a=Iv(e,s);n.push({target:s,rating:a}),a>n[r].rating&&(r=i)}let o=n[r];return{ratings:n,bestMatch:o,bestMatchIndex:r}}function Pz(e,t){return!(typeof e!="string"||!Array.isArray(t)||!t.length||t.find(function(n){return typeof n!="string"}))}});var C1=rr((kse,k1)=>{"use strict";var b1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,E3=/\n/g,A3=/^\s*/,P3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,L3=/^:\s*/,M3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,B3=/^[;\s]*/,D3=/^\s+|\s+$/g,R3=`
14
- `,S1="/",w1="*",ai="",z3="comment",N3="declaration";function O3(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(f){var k=f.match(E3);k&&(n+=k.length);var T=f.lastIndexOf(R3);r=~T?f.length-T:r+f.length}function i(){var f={line:n,column:r};return function(k){return k.position=new s(f),c(),k}}function s(f){this.start=f,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(f){var k=new Error(t.source+":"+n+":"+r+": "+f);if(k.reason=f,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function u(f){var k=f.exec(e);if(k){var T=k[0];return o(T),e=e.slice(T.length),k}}function c(){u(A3)}function l(f){var k;for(f=f||[];k=d();)k!==!1&&f.push(k);return f}function d(){var f=i();if(!(S1!=e.charAt(0)||w1!=e.charAt(1))){for(var k=2;ai!=e.charAt(k)&&(w1!=e.charAt(k)||S1!=e.charAt(k+1));)++k;if(k+=2,ai===e.charAt(k-1))return a("End of comment missing");var T=e.slice(2,k-2);return r+=2,o(T),e=e.slice(k),r+=2,f({type:z3,comment:T})}}function g(){var f=i(),k=u(P3);if(k){if(d(),!u(L3))return a("property missing ':'");var T=u(M3),E=f({type:N3,property:v1(k[0].replace(b1,ai)),value:T?v1(T[0].replace(b1,ai)):ai});return u(B3),E}}function p(){var f=[];l(f);for(var k;k=g();)k!==!1&&(f.push(k),l(f));return f}return c(),p()}function v1(e){return e?e.replace(D3,ai):ai}k1.exports=O3});var T1=rr(ma=>{"use strict";var _3=ma&&ma.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ma,"__esModule",{value:!0});ma.default=U3;var $3=_3(C1());function U3(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,$3.default)(e),o=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;let{property:s,value:a}=i;o?t(s,a,i):a&&(n=n||{},n[s]=a)}),n}});var F1=rr(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.camelCase=void 0;var j3=/^--[a-zA-Z0-9_-]+$/,H3=/-([a-z])/g,W3=/^[^-]+$/,V3=/^-(webkit|moz|ms|o|khtml)-/,G3=/^-(ms)-/,q3=function(e){return!e||W3.test(e)||j3.test(e)},Y3=function(e,t){return t.toUpperCase()},I1=function(e,t){return"".concat(t,"-")},K3=function(e,t){return t===void 0&&(t={}),q3(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(G3,I1):e=e.replace(V3,I1),e.replace(H3,Y3))};kc.camelCase=K3});var A1=rr((Ph,E1)=>{"use strict";var X3=Ph&&Ph.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Q3=X3(T1()),J3=F1();function Ah(e,t){var n={};return!e||typeof e!="string"||(0,Q3.default)(e,function(r,o){r&&o&&(n[(0,J3.camelCase)(r,t)]=o)}),n}Ah.default=Ah;E1.exports=Ah});var nI=rr((Jpe,tI)=>{"use strict";var Gc=Object.prototype.hasOwnProperty,eI=Object.prototype.toString,YT=Object.defineProperty,KT=Object.getOwnPropertyDescriptor,XT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):eI.call(t)==="[object Array]"},QT=function(t){if(!t||eI.call(t)!=="[object Object]")return!1;var n=Gc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Gc.call(t,o)},JT=function(t,n){YT&&n.name==="__proto__"?YT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ZT=function(t,n){if(n==="__proto__")if(Gc.call(t,n)){if(KT)return KT(t,n).value}else return;return t[n]};tI.exports=function e(){var t,n,r,o,i,s,a=arguments[0],u=1,c=arguments.length,l=!1;for(typeof a=="boolean"&&(l=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=ZT(a,n),o=ZT(t,n),a!==o&&(l&&o&&(QT(o)||(i=XT(o)))?(i?(i=!1,s=r&&XT(r)?r:[]):s=r&&QT(r)?r:{},JT(a,{name:n,newValue:e(l,s,o)})):typeof o<"u"&&JT(a,{name:n,newValue:o}));return a}});import Oa from"react";import{addons as lu,types as ty,experimental_getStatusStore as ny}from"storybook/manager-api";import{AddonPanel as yV}from"storybook/internal/components";import Dt,{useState as NW,useEffect as OW}from"react";import{styled as xr}from"storybook/theming";import py from"react";import{styled as Mt}from"storybook/theming";var se="#ea580c",pu="#c2410c",ja="#ff6b35";var iy=Mt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),sy=Mt.div({flex:1,overflow:"auto",padding:"6px 20px 20px"}),ho=Mt.div({marginBottom:"20px"}),xo=Mt.label(({theme:e})=>({display:"block",marginBottom:`${e.layoutMargin*.6}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),ps=Mt.input(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.8}px ${e.layoutMargin}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:e.input.background,color:e.color.defaultText,"&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`}})),hn=Mt.select(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.8}px 32px ${e.layoutMargin*.8}px ${e.layoutMargin}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:e.input.background,color:e.color.defaultText,cursor:"pointer",appearance:"none",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center",backgroundSize:"12px",transition:"border-color 0.15s, box-shadow 0.15s","&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`},"&:hover":{borderColor:e.color.mediumdark},"&:disabled":{opacity:.6,cursor:"not-allowed"}})),ay=Mt(hn)(({theme:e})=>({width:"auto",padding:`${e.layoutMargin*.6}px 28px ${e.layoutMargin*.6}px ${e.layoutMargin}px`,fontSize:e.typography.size.s1})),Ha=e=>({padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,border:"none",borderRadius:e.appBorderRadius,cursor:"pointer",transition:"all 0.15s","&:disabled":{opacity:.5,cursor:"not-allowed"}}),kn=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Yt=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:se,color:e.color.inverseText,boxShadow:`0 2px 4px ${se}4d`,"&:hover:not(:disabled)":{backgroundColor:pu,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${se}66`}})),Rr=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),ly=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Cn=Mt.button(({theme:e})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:`${e.layoutMargin*.4}px`,fontSize:e.typography.size.s2,color:e.color.mediumdark,backgroundColor:"transparent",border:"none",borderRadius:e.appBorderRadius,cursor:"pointer",transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),du=Mt.button(({theme:e})=>({padding:0,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.base,color:e.color.secondary,backgroundColor:"transparent",border:"none",cursor:"pointer",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),yo=Mt.button(({theme:e,active:t})=>({padding:`${e.layoutMargin*.6}px ${e.layoutMargin*1.2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:t?e.typography.weight.bold:400,color:t?e.color.secondary:e.color.mediumdark,backgroundColor:"transparent",border:"none",borderBottom:t?`2px solid ${e.color.secondary}`:"2px solid transparent",cursor:"pointer",transition:"all 0.15s","&:hover":{color:t?e.color.secondary:e.color.defaultText}})),bo=Mt(ps)(({theme:e})=>({paddingLeft:`${e.layoutMargin*3}px`,backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:`${e.layoutMargin}px center`,backgroundSize:"14px"})),IV=Mt.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),cy=Mt.h2(({theme:e})=>({margin:`0 0 ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s3,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),FV=Mt.h3(({theme:e})=>({margin:`0 0 ${e.layoutMargin*1.2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),ds=Mt.p(({theme:e})=>({margin:`0 0 ${e.layoutMargin*.8}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,color:e.color.defaultText,lineHeight:1.5})),EV=Mt.div(({theme:e,width:t="100%",height:n="40px"})=>({width:t,height:n,backgroundColor:e.background.hoverable,borderRadius:e.appBorderRadius,position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"100%",background:`linear-gradient(90deg, transparent, ${e.color.mediumlight}33, transparent)`,animation:"shimmer 1.5s infinite"},"@keyframes shimmer":{"0%":{transform:"translateX(-100%)"},"100%":{transform:"translateX(100%)"}}})),uy=Mt.span(({theme:e,variant:t="default"})=>{let n={default:{bg:e.background.hoverable,color:e.color.defaultText},success:{bg:`${e.color.positive}40`,color:e.color.positive},warning:{bg:`${e.color.warning}40`,color:e.color.warning},error:{bg:`${e.color.negative}40`,color:e.color.negative}};return{display:"inline-block",padding:"2px 8px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,borderRadius:"3px",backgroundColor:n[t].bg,color:n[t].color}}),AV=Mt.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),PV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),LV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));var gu=({header:e,children:t,footer:n})=>py.createElement(iy,null,e,py.createElement(sy,null,t),n);import XF from"react";import{styled as QF}from"storybook/theming";var JF=QF.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"6px 12px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,zIndex:100,backgroundColor:e.background.content})),fu=({toolbar:e})=>XF.createElement(JF,null,e);import UV from"react";import{styled as Wa}from"storybook/theming";var WV=Wa.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,zIndex:100,backgroundColor:e.background.content})),VV=Wa.div({display:"flex",flex:1}),GV=Wa(yo)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),qV=Wa.div({display:"flex",gap:"8px",alignItems:"center"});import Zt,{useState as Of,useCallback as Nw,useEffect as Ow}from"react";import{styled as eo}from"storybook/theming";import ve,{useEffect as Iw}from"react";import{styled as lt}from"storybook/theming";Ce();je();Oe();ct();var Fw=lt.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),Ew=lt.div(({theme:e})=>({position:"absolute",top:"100%",right:0,marginTop:"8px",backgroundColor:e.background.content,borderRadius:"12px",width:"360px",maxWidth:"90vw",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",zIndex:10001})),ND=lt.div({display:"flex",alignItems:"center",gap:"12px",padding:"16px 16px 12px"}),OD=lt.div({width:"36px",height:"36px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",fontWeight:700,flexShrink:0}),_D=lt.div({display:"flex",flexDirection:"column",gap:"4px"}),$D=lt.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,lineHeight:1.2})),UD=lt.span({display:"inline-block",alignSelf:"flex-start",padding:"2px 10px",borderRadius:"6px",fontSize:"11px",fontWeight:600,color:"#7c3aed",backgroundColor:"rgba(124, 58, 237, 0.1)",letterSpacing:"0.3px"}),jD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px 8px",fontSize:"14px",color:e.color.defaultText})),HD=lt.span(({theme:e})=>({color:e.textMutedColor,fontSize:"13px"})),WD=lt.span(({theme:e})=>({color:e.color.defaultText,fontSize:"15px",fontWeight:600})),VD=lt.div(({theme:e})=>({height:"8px",borderRadius:"4px",backgroundColor:e.base==="dark"?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",margin:"0 16px 8px",overflow:"hidden"})),GD=lt.div(({percent:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,background:`linear-gradient(90deg, #f59e0b 0%, ${se} 100%)`,transition:"width 0.3s ease"})),qD=lt.div(({theme:e})=>({padding:"0 16px 14px",fontSize:"12px",color:e.textMutedColor})),YD=lt.div(({theme:e})=>({height:"1px",backgroundColor:e.appBorderColor})),KD=lt.button({width:"100%",padding:"14px 16px",background:"transparent",border:"none",color:se,fontSize:"14px",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.03)"}}),Aw=lt.button(({theme:e})=>({position:"absolute",top:"12px",right:"12px",width:"24px",height:"24px",borderRadius:"4px",border:"none",background:"transparent",color:e.textMutedColor,cursor:"pointer",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center","&:hover":{backgroundColor:e.background.hoverable}})),XD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),QD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),JD=lt.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),ZD=lt.div({display:"flex",gap:"8px"}),Pw=lt(Cn)({fontSize:"18px"}),eR=lt.div({padding:"20px 16px"}),tR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),nR=lt.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),rR=lt.div({fontSize:"28px",fontWeight:700}),oR=lt.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),iR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),sR=lt.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),aR=lt.div({display:"flex",alignItems:"center",gap:"8px"}),lR=lt.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),cR=lt.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:se,color:e.color.inverseText})),uR=lt.button(({theme:e})=>({background:"none",border:"none",color:se,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),pR=lt.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),dR=lt.button(({theme:e,variant:t="primary"})=>({width:"100%",padding:"12px",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",border:"none",marginBottom:"12px",backgroundColor:t==="primary"?se:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),gR=30*1e3,Lw=({onClose:e})=>{let{sessionToken:t,resetAuth:n,usageData:r,usageLastFetched:o,setUsageData:i}=we(),{featureFlags:s}=ce(),a=s.showCosts,u=r,c=!r&&t,l=async(f=!1)=>{if(!t)return;let k=o&&Date.now()-o<gR;if(!(!f&&k&&r))try{let T=V(),E=await ne(`${T}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(E.ok){let I=await E.json();i(I)}}catch(T){y.error("Failed to fetch usage:",T)}};Iw(()=>{l()},[t]),Iw(()=>{let f=()=>{document.visibilityState==="visible"&&(y.debug("[TokenUsageModal] Tab visible, refreshing balance..."),l(!0))};return document.addEventListener("visibilitychange",f),()=>document.removeEventListener("visibilitychange",f)},[t]);let d=()=>{if(t){let f=V();fetch(`${f}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}n(),e()},g=()=>{let f=V();window.open(`${f}/pricing`,"_blank")},p=()=>{let f=V();window.open(`${f}/pricing#add-credits`,"_blank")};if(t&&!a&&!c){let f=Math.floor(u?.creditBalance??0),T=Math.max(f,10),E=Math.max(0,T-f),I=T>0?f/T*100:0;return ve.createElement(ve.Fragment,null,ve.createElement(Fw,{onClick:e}),ve.createElement(Ew,{onClick:D=>D.stopPropagation(),style:{width:"320px"}},ve.createElement(ND,null,ve.createElement(OD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement(_D,null,ve.createElement($D,null,"UI Review"),ve.createElement(UD,null,(u?.plan||"BETA").toUpperCase())),ve.createElement("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"2px"}},ve.createElement(Aw,{onClick:d,title:"Sign out",style:{position:"static"}},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Aw,{onClick:e,title:"Close",style:{position:"static"}},"\xD7"))),ve.createElement(jD,null,ve.createElement(HD,null,"Credits"),ve.createElement(WD,null,f," left")),ve.createElement(VD,null,ve.createElement(GD,{percent:I})),ve.createElement(qD,null,E," used \xB7 ",f," remaining"),ve.createElement(YD,null),ve.createElement(KD,{onClick:()=>window.open("mailto:hello@uiparity.com?subject=Credits request","_blank")},"Contact us for credits \u2192")))}return ve.createElement(ve.Fragment,null,ve.createElement(Fw,{onClick:e}),ve.createElement(Ew,{onClick:f=>f.stopPropagation()},ve.createElement(XD,null,ve.createElement(QD,null,ve.createElement(JD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement("span",null,u?.email||"Loading...")),ve.createElement(ZD,null,ve.createElement(Pw,{onClick:d,title:"Sign out"},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Pw,{onClick:e,title:"Close"},"\xD7"))),ve.createElement(eR,null,c?ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?ve.createElement(ve.Fragment,null,ve.createElement(tR,null,ve.createElement(nR,null,"Credit Balance"),ve.createElement(rR,null,"$",(u?.creditBalance??0).toFixed(2)),ve.createElement(oR,null,(u?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),ve.createElement(iR,null,ve.createElement(sR,null,ve.createElement(aR,null,ve.createElement(lR,null,"Current Plan"),ve.createElement(cR,null,u?.plan||"Free")),ve.createElement(uR,{onClick:g},"View detail >")),ve.createElement(pR,null,"~$0.02-0.05 per review depending on complexity"),ve.createElement(dR,{onClick:p,style:{marginTop:"16px"}},"Add Credits"))):ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};Ce();import Pi from"react";import{styled as Mw}from"storybook/theming";je();Ce();ct();Oe();var fR=Mw.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),mR=Mw.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),hR={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}},Bw=()=>{let{userRole:e,roleOverride:t,setRoleOverride:n,setFeatureFlags:r}=ce(),{sessionToken:o}=we();return e!=="admin"?null:Pi.createElement(fR,null,Pi.createElement(mR,null,"View as:"),Pi.createElement(ay,{value:t??e,onChange:a=>{let u=a.target.value;if(u===e)n(null),o&&ne(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(c=>c.json()).then(c=>{let l={enableFixGeneration:!!c.enableFixGeneration,enableFixApply:!!c.enableFixApply,enableAutoMap:!!c.enableAutoMap,enableReviewBadges:!!c.enableReviewBadges,showCosts:!!c.showCosts,enableParallelReview:!!c.enableParallelReview,enableModelSelection:!!c.enableModelSelection};r(l);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(l))}catch{}}).catch(c=>y.warn("[RoleSwitcher] Failed to re-fetch flags:",c.message));else{n(u);let c=hR[u];r(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}},style:{width:"auto",minWidth:"100px"}},Pi.createElement("option",{value:"admin"},"Admin"),Pi.createElement("option",{value:"beta"},"Beta Tester")),t&&Pi.createElement(uy,{variant:"warning"},"Previewing as ",t))};je();Ce();ct();import ht,{useState as Us,useCallback as Nf}from"react";import{styled as Cr}from"storybook/theming";var xR="0.5.7",yR=[{value:"bug",label:"\u{1F41E} Bug \u2014 something broke"},{value:"ux",label:"\u{1F9ED} UX \u2014 confusing or slow"},{value:"feature",label:"\u2728 Feature \u2014 missing something"},{value:"praise",label:"\u{1F49A} Praise \u2014 works great"},{value:"other",label:"\u{1F4AC} Other"}],bR=Cr.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"}),SR=Cr.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"12px",width:"460px",maxWidth:"94%",maxHeight:"90vh",overflow:"auto",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.25)"})),wR=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",borderBottom:`1px solid ${e.appBorderColor}`})),vR=Cr.h3(({theme:e})=>({margin:0,fontSize:"15px",fontWeight:600,color:e.color.defaultText,display:"flex",alignItems:"center",gap:"8px"})),kR=Cr.button(({theme:e})=>({background:"transparent",border:"none",fontSize:"20px",color:e.color.mediumdark,cursor:"pointer",padding:"0 6px",lineHeight:1,"&:hover":{color:e.color.defaultText}})),CR=Cr.div({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"14px"}),TR=Cr.textarea(({theme:e})=>({width:"100%",minHeight:"110px",padding:"8px 10px",borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.defaultText,backgroundColor:e.background.app,resize:"vertical",boxSizing:"border-box","&:focus":{outline:"none",borderColor:se}})),Dw=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px 16px",borderTop:`1px solid ${e.appBorderColor}`,gap:"8px"})),Rw=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4})),IR=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.negative})),FR=Cr.div(({theme:e})=>({padding:"24px 20px",textAlign:"center",display:"flex",flexDirection:"column",gap:"10px","& h4":{margin:0,fontSize:"15px",fontWeight:600,color:e.color.positive},"& p":{margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark}}));function zw({isOpen:e,onClose:t}){let{sessionToken:n,isConnected:r}=we(),{selectedProjectId:o}=Je(),{currentStoryId:i}=nt(),[s,a]=Us("other"),[u,c]=Us(""),[l,d]=Us(!1),[g,p]=Us(!1),[f,k]=Us(null),T=Nf(()=>{c(""),a("other"),p(!1),k(null),d(!1)},[]),E=Nf(()=>{T(),t()},[T,t]),I=Nf(async D=>{if(D.preventDefault(),!u.trim()){k("Please write a message.");return}if(!r||!n){k("Sign in to send feedback.");return}d(!0),k(null);try{let R=await ne(`${V()}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({message:u.trim(),severity:s,projectId:o||void 0,storyId:i||void 0,addonVersion:xR})});if(!R.ok){let $=await R.json().catch(()=>({}));throw new Error($.error||`Request failed (${R.status})`)}p(!0)}catch(R){k(R instanceof Error?R.message:"Something went wrong")}finally{d(!1)}},[u,s,n,r,o,i]);return e?ht.createElement(bR,{onClick:E},ht.createElement(SR,{onClick:D=>D.stopPropagation()},ht.createElement(wR,null,ht.createElement(vR,null,ht.createElement("span",null,"\u{1F4AC}"),"Send feedback"),ht.createElement(kR,{onClick:E,"aria-label":"Close"},"\xD7")),g?ht.createElement(ht.Fragment,null,ht.createElement(FR,null,ht.createElement("h4",null,"Thanks \u2014 got it."),ht.createElement("p",null,"We read every message. If it's a bug, we'll likely follow up by email.")),ht.createElement(Dw,null,ht.createElement("span",null),ht.createElement(kn,{onClick:E},"Close"))):ht.createElement("form",{onSubmit:I},ht.createElement(CR,null,ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-severity"},"Type"),ht.createElement(hn,{id:"feedback-severity",value:s,onChange:D=>a(D.target.value),disabled:l},yR.map(D=>ht.createElement("option",{key:D.value,value:D.value},D.label)))),ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-message"},"What happened?"),ht.createElement(TR,{id:"feedback-message",value:u,onChange:D=>c(D.target.value),placeholder:"Tell us what you were doing, what you expected, and what happened.",disabled:l,autoFocus:!0,maxLength:5e3})),ht.createElement(Rw,null,"We auto-attach your current story and project so we can reproduce it. No screenshots sent."),f&&ht.createElement(IR,null,f)),ht.createElement(Dw,null,ht.createElement(Rw,null,i?`Context: ${i}`:"No story selected"),ht.createElement("div",{style:{display:"flex",gap:"8px"}},ht.createElement(kn,{type:"button",onClick:E,disabled:l},"Cancel"),ht.createElement(Yt,{type:"submit",disabled:l||!u.trim()},l?"Sending\u2026":"Send")))))):null}Ce();je();ct();var ER=eo.div({display:"flex",alignItems:"center"}),Li=eo.div(({theme:e})=>({display:"flex",alignItems:"center",paddingLeft:"8px",borderLeft:`1px solid ${e.appBorderColor}`,"&:first-of-type":{paddingLeft:0,borderLeft:"none"}})),AR=eo.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.secondary,fontWeight:e.typography.weight.bold,paddingRight:"8px",opacity:.8})),PR=eo.div({position:"relative"}),LR=eo.button(({theme:e})=>({width:"26px",height:"26px",padding:0,background:`linear-gradient(135deg, ${e.color.secondary} 0%, ${e.color.secondary}cc 100%)`,border:"none",borderRadius:"50%",color:e.color.inverseText,cursor:"pointer",fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s","&:hover":{transform:"scale(1.05)",boxShadow:`0 2px 8px ${e.color.secondary}66`}})),_w=eo.button(({isLow:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",background:e?"#FEF3C7":"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",border:"none",borderRadius:"12px",color:e?"#92400E":"#fff",cursor:"pointer",fontSize:"12px",fontWeight:600,transition:"all 0.2s",minWidth:"60px",justifyContent:"center","&:hover":{transform:"scale(1.02)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})),MR=eo.span({display:"inline-block",width:"12px",height:"12px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"credit-spin 0.8s linear infinite","@keyframes credit-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}}),BR=eo.button(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 10px",height:"28px",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.mediumdark,fontSize:"12px",fontWeight:500,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.mediumdark}})),DR=eo.button({position:"fixed",bottom:"20px",right:"20px",width:"48px",height:"48px",borderRadius:"50%",backgroundColor:se,color:"white",border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",cursor:"pointer",boxShadow:`0 4px 14px ${se}66, 0 2px 4px rgba(0,0,0,0.1)`,transition:"all 0.2s ease",zIndex:9999,"&:hover":{transform:"scale(1.08)",boxShadow:`0 6px 20px ${se}88, 0 3px 6px rgba(0,0,0,0.15)`},"&:active":{transform:"scale(0.96)"}}),RR=30*1e3,_f=({onOpenSettings:e})=>{let[t,n]=Of(!1),[r,o]=Of(!1),[i,s]=Of(!1),{usageData:a,usageLastFetched:u,setUsageData:c,sessionToken:l}=we(),{userRole:d,roleOverride:g,featureFlags:p}=ce(),f=g??d;Ow(()=>{(async()=>{if(!(!l||u&&Date.now()-u<RR&&a)){s(!0);try{let $=V(),P=await ne(`${$}/api/addon/account`,{headers:{Authorization:`Bearer ${l}`}});if(P.ok){let z=await P.json();c(z)}}catch($){console.error("Failed to fetch balance:",$)}finally{s(!1)}}})()},[l,u,a,c]),Ow(()=>{let D=()=>{document.visibilityState==="visible"&&t&&n(!1)},R=()=>{t&&n(!1)};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",R),()=>{document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",R)}},[t]);let k=Nw(()=>{n(!0)},[]),T=Nw(()=>{n(!1)},[]),E=a?.creditBalance??0,I=E<2&&!i;return Zt.createElement(ER,null,e&&Zt.createElement(Li,null,Zt.createElement(BR,{onClick:e,title:"Settings"},Zt.createElement("span",{style:{fontSize:"14px"}},"\u2699"),"Settings")),l&&d==="admin"&&f==="admin"&&Zt.createElement(Li,null,Zt.createElement(Bw,null)),Zt.createElement(Li,null,Zt.createElement(AR,null,"v","0.5.16")),l&&p.showCosts&&Zt.createElement(Li,null,Zt.createElement(_w,{onClick:k,isLow:I,title:i?"Loading...":a?I?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},i?Zt.createElement(MR,null):a?`$${E.toFixed(2)}`:"...")),l&&!p.showCosts&&a&&Zt.createElement(Li,null,Zt.createElement(_w,{onClick:k,isLow:Math.floor(E)<=3,title:`${Math.floor(E)} review credits \u2014 click for details`},"\u26A1 ",Math.floor(E))),Zt.createElement(Li,null,Zt.createElement(PR,null,Zt.createElement(LR,{title:"Account & Usage",onClick:k},a?.email?a.email[0].toUpperCase():"?"),t&&Zt.createElement(Lw,{onClose:T}))),l&&Zt.createElement(DR,{onClick:()=>o(!0),title:"Send feedback","aria-label":"Send feedback"},"\u{1F4AC}"),Zt.createElement(zw,{isOpen:r,onClose:()=>o(!1)}))};import Lt,{useEffect as w4,useRef as v4}from"react";import{styled as gr}from"storybook/theming";import rt from"react";Ce();Oe();je();ct();Rn();import{useState as zR,useCallback as Mi,useRef as $w,useEffect as NR}from"react";var to=V();y.debug("[useAuth] Module loaded, APP_URL:",to);var js=()=>{let e=$w(null),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setSessionToken:c,setApiKey:l,setAuthMethod:d,setDeviceCode:g,setUserCode:p,setVerificationUri:f,setPollingInterval:k,setAuthError:T,resetAuth:E}=we(),I=$w(null),[D,R]=zR(!1),$=Mi(async()=>{try{y.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let C;try{C=await ne(`${to}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(A){let B=A instanceof Error&&A.message.includes("timed out")?`Cannot reach ${Ft.NAME} server at ${to}. Is the dashboard running?`:`Connection failed: ${to} is not responding.`;T(B),y.error("[useAuth]",B);return}if(!C.ok){let A=`Cannot reach ${Ft.NAME} server. Is the dashboard running?`;T(A),y.error("[useAuth]",A);return}let{poll_code:m}=await C.json();y.debug("[useAuth] Got poll_code:",m.substring(0,15)+"...");let F=localStorage.getItem("uicopilot_force_sign_in")==="true";F&&localStorage.removeItem("uicopilot_force_sign_in");let S=`${to}/addon/auth?poll_code=${m}${F?"&force_sign_in=true":""}`;R(!0),window.open(S,"uiparity-auth","width=520,height=620,left=300,top=150"),y.debug("[useAuth] Starting OAuth poll for token..."),I.current&&clearInterval(I.current);let b=async()=>{try{let L=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:m})})).json();L.status==="authorized"&&L.session_token?(y.debug("[useAuth] \u2705 OAuth poll successful! Got token."),I.current&&(clearInterval(I.current),I.current=null),localStorage.setItem("uicopilot_session_token",L.session_token),c(L.session_token),R(!1)):L.status==="expired"&&(y.debug("[useAuth] OAuth poll_code expired"),I.current&&(clearInterval(I.current),I.current=null),R(!1))}catch(A){y.error("[useAuth] OAuth poll error:",A)}};I.current=setInterval(b,2e3),setTimeout(b,1e3)}catch(C){y.error("[useAuth] OAuth flow error:",C),T(`Connection failed. Is the dashboard running at ${to}?`),R(!1)}},[c,T]),P=Mi(async()=>{try{let C=await fetch(`${to}/api/addon/auth/device`,{method:"POST"});if(!C.ok)throw new Error("Failed to start device code flow");let m=await C.json();g(m.device_code),p(m.user_code),f(m.verification_uri),window.open(m.verification_uri,"_blank"),z(m.device_code,m.interval*1e3)}catch(C){throw y.error("[useAuth] Device code flow error:",C),C}},[g,p,f]),z=Mi((C,m)=>{y.debug("[useAuth] Starting polling. Device code:",C,"Interval:",m),e.current&&clearInterval(e.current);let F=async()=>{try{let b=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:C})})).json();b.status==="authorized"?(y.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null),localStorage.setItem("uicopilot_session_token",b.session_token),c(b.session_token),setOauthUrl(null)):(b.status==="expired"||b.status==="denied")&&(y.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null))}catch(S){y.error("[useAuth] Polling error:",S)}};e.current=setInterval(F,m),k(m)},[g,p,f,c,k]),x=Mi(()=>{e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null),k(null)},[g,p,f,k]),w=Mi(C=>{l(C),c(C),localStorage.setItem("uicopilot_api_key",C)},[l,c]),v=Mi(()=>{E(),setOauthUrl(null),e.current&&(clearInterval(e.current),e.current=null),I.current&&(clearInterval(I.current),I.current=null)},[E]);return NR(()=>()=>{e.current&&clearInterval(e.current),I.current&&clearInterval(I.current)},[]),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,oauthPending:D,setAuthMethod:d,startOAuth:$,startDeviceCode:P,cancelDeviceCode:x,saveApiKey:w,logout:v}};Ce();Oe();je();ct();import{useCallback as Nl}from"react";var Hs=V(),no=()=>{let{projects:e,selectedProjectId:t,loadingProjects:n,setProjects:r,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:s}=Je(),{sessionToken:a}=we(),u=Nl(async()=>{if(!a){y.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),y.debug("[useProjects] Fetching from:",`${Hs}/api/projects`);let g=await ne(`${Hs}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}});if(g.ok){let p=await g.json();y.debug("[useProjects] Projects:",p.projects),r(p.projects||[])}else y.error("[useProjects] Failed to fetch projects:",g.status,g.statusText)}catch(g){y.error("[useProjects] Error fetching projects:",g)}finally{i(!1)}},[a,r,i]),c=Nl(async g=>{if(!a)throw new Error("Not authenticated");let p=await ne(`${Hs}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(g)});if(!p.ok)throw new Error("Failed to create project");let f=await p.json();return await u(),f.project},[a,u]),l=Nl(async(g,p)=>{if(!a)throw new Error("Not authenticated");let f={};if(p.name!==void 0&&(f.name=p.name),p.description!==void 0&&(f.description=p.description),p.figmaFileUrl!==void 0&&(f.figmaFileId=p.figmaFileUrl||void 0),!(await ne(`${Hs}/api/projects/${g}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(f)})).ok)throw new Error("Failed to update project");await u()},[a,u]),d=Nl(async g=>{if(!a)throw new Error("Not authenticated");if(!(await ne(`${Hs}/api/projects/${g}`,{method:"DELETE",headers:{Authorization:`Bearer ${a}`}})).ok)throw new Error("Failed to delete project");await u(),t===g&&o(null)},[a,t,u,o]);return{projects:e,selectedProjectId:t,selectedProject:s(),loadingProjects:n,setSelectedProjectId:o,fetchProjects:u,createProject:c,updateProject:l,deleteProject:d}};Ce();var Ws=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d}=nt();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d,openComponentBrowser:()=>s(!0),closeComponentBrowser:()=>s(!1)}};Ce();Wf();Xf();import{useCallback as Js,useRef as Yl}from"react";Oe();function jl(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){y.warn("[iframeReload] No preview iframe found"),e();return}let n=t.contentWindow.location.href,r=new URL(n);r.searchParams.set("_cb",Date.now().toString());let o=r.toString();y.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{y.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",s),e()},5e3),s=()=>{clearTimeout(i),t.removeEventListener("load",s),y.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{y.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",s),t.contentWindow.location.href=o})}var Hl=BigInt(4294967295),rv=BigInt(32);function iz(e,t=!1){return t?{h:Number(e&Hl),l:Number(e>>rv&Hl)}:{h:Number(e>>rv&Hl)|0,l:Number(e&Hl)|0}}function ov(e,t=!1){let n=e.length,r=new Uint32Array(n),o=new Uint32Array(n);for(let i=0;i<n;i++){let{h:s,l:a}=iz(e[i],t);[r[i],o[i]]=[s,a]}return[r,o]}var iv=(e,t,n)=>e<<n|t>>>32-n,sv=(e,t,n)=>t<<n|e>>>32-n,av=(e,t,n)=>t<<n-32|e>>>64-n,lv=(e,t,n)=>e<<n-32|t>>>64-n;function sz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Qf(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Wl(e,t,n=""){let r=sz(e),o=e?.length,i=t!==void 0;if(!r||i&&o!==t){let s=n&&`"${n}" `,a=i?` of length ${t}`:"",u=r?`length=${o}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function Jf(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function cv(e,t){Wl(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function uv(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Zf(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var az=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function lz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function cz(e){for(let t=0;t<e.length;t++)e[t]=lz(e[t]);return e}var em=az?e=>e:cz;function pv(e,t={}){let n=(o,i)=>e(i).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}var dv=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var uz=BigInt(0),Ys=BigInt(1),pz=BigInt(2),dz=BigInt(7),gz=BigInt(256),fz=BigInt(113),mv=[],hv=[],xv=[];for(let e=0,t=Ys,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],mv.push(2*(5*r+n)),hv.push((e+1)*(e+2)/2%64);let o=uz;for(let i=0;i<7;i++)t=(t<<Ys^(t>>dz)*fz)%gz,t&pz&&(o^=Ys<<(Ys<<BigInt(i))-Ys);xv.push(o)}var yv=ov(xv,!0),mz=yv[0],hz=yv[1],gv=(e,t,n)=>n>32?av(e,t,n):iv(e,t,n),fv=(e,t,n)=>n>32?lv(e,t,n):sv(e,t,n);function xz(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,c=n[u],l=n[u+1],d=gv(c,l,1)^n[a],g=fv(c,l,1)^n[a+1];for(let p=0;p<50;p+=10)e[s+p]^=d,e[s+p+1]^=g}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=hv[s],u=gv(o,i,a),c=fv(o,i,a),l=mv[s];o=e[l],i=e[l+1],e[l]=u,e[l+1]=c}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=mz[r],e[1]^=hz[r]}Zf(n)}var tm=class e{constructor(t,n,r,o=!1,i=24){or(this,"state");or(this,"pos",0);or(this,"posOut",0);or(this,"finished",!1);or(this,"state32");or(this,"destroyed",!1);or(this,"blockLen");or(this,"suffix");or(this,"outputLen");or(this,"enableXOF",!1);or(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,Qf(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=uv(this.state)}clone(){return this._cloneInto()}keccak(){em(this.state32),xz(this.state32,this.rounds),em(this.state32),this.posOut=0,this.pos=0}update(t){Jf(this),Wl(t);let{blockLen:n,state:r}=this,o=t.length;for(let i=0;i<o;){let s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Jf(this,!1),Wl(t),this.finish();let n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qf(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(cv(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Zf(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},yz=(e,t,n,r={})=>pv(()=>new tm(t,e,n),r);var bv=yz(6,72,64,dv(10));var bz=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,nm=Math.ceil,ur=Math.floor,On="[BigNumber Error] ",Sv=On+"Number primitive has more than 15 significant digits: ",Tr=1e14,Ve=14,rm=9007199254740991,om=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Io=1e7,an=1e9;function wv(e){var t,n,r,o=I.prototype={constructor:I,toString:null,valueOf:null},i=new I(1),s=20,a=4,u=-7,c=21,l=-1e7,d=1e7,g=!1,p=1,f=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function I(x,w){var v,C,m,F,S,b,A,L,B=this;if(!(B instanceof I))return new I(x,w);if(w==null){if(x&&x._isBigNumber===!0){B.s=x.s,!x.c||x.e>d?B.c=B.e=null:x.e<l?B.c=[B.e=0]:(B.e=x.e,B.c=x.c.slice());return}if((b=typeof x=="number")&&x*0==0){if(B.s=1/x<0?(x=-x,-1):1,x===~~x){for(F=0,S=x;S>=10;S/=10,F++);F>d?B.c=B.e=null:(B.e=F,B.c=[x]);return}L=String(x)}else{if(!bz.test(L=String(x)))return r(B,L,b);B.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(F=L.indexOf("."))>-1&&(L=L.replace(".","")),(S=L.search(/e/i))>0?(F<0&&(F=S),F+=+L.slice(S+1),L=L.substring(0,S)):F<0&&(F=L.length)}else{if(zt(w,2,T.length,"Base"),w==10&&E)return B=new I(x),P(B,s+B.e+1,a);if(L=String(x),b=typeof x=="number"){if(x*0!=0)return r(B,L,b,w);if(B.s=1/x<0?(L=L.slice(1),-1):1,I.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(Sv+x)}else B.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(v=T.slice(0,w),F=S=0,A=L.length;S<A;S++)if(v.indexOf(C=L.charAt(S))<0){if(C=="."){if(S>F){F=A;continue}}else if(!m&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){m=!0,S=-1,F=0;continue}return r(B,String(x),b,w)}b=!1,L=n(L,w,10,B.s),(F=L.indexOf("."))>-1?L=L.replace(".",""):F=L.length}for(S=0;L.charCodeAt(S)===48;S++);for(A=L.length;L.charCodeAt(--A)===48;);if(L=L.slice(S,++A)){if(A-=S,b&&I.DEBUG&&A>15&&(x>rm||x!==ur(x)))throw Error(Sv+B.s*x);if((F=F-S-1)>d)B.c=B.e=null;else if(F<l)B.c=[B.e=0];else{if(B.e=F,B.c=[],S=(F+1)%Ve,F<0&&(S+=Ve),S<A){for(S&&B.c.push(+L.slice(0,S)),A-=Ve;S<A;)B.c.push(+L.slice(S,S+=Ve));S=Ve-(L=L.slice(S)).length}else S-=A;for(;S--;L+="0");B.c.push(+L)}}else B.c=[B.e=0]}I.clone=wv,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(x){var w,v;if(x!=null)if(typeof x=="object"){if(x.hasOwnProperty(w="DECIMAL_PLACES")&&(v=x[w],zt(v,0,an,w),s=v),x.hasOwnProperty(w="ROUNDING_MODE")&&(v=x[w],zt(v,0,8,w),a=v),x.hasOwnProperty(w="EXPONENTIAL_AT")&&(v=x[w],v&&v.pop?(zt(v[0],-an,0,w),zt(v[1],0,an,w),u=v[0],c=v[1]):(zt(v,-an,an,w),u=-(c=v<0?-v:v))),x.hasOwnProperty(w="RANGE"))if(v=x[w],v&&v.pop)zt(v[0],-an,-1,w),zt(v[1],1,an,w),l=v[0],d=v[1];else if(zt(v,-an,an,w),v)l=-(d=v<0?-v:v);else throw Error(On+w+" cannot be zero: "+v);if(x.hasOwnProperty(w="CRYPTO"))if(v=x[w],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))g=v;else throw g=!v,Error(On+"crypto unavailable");else g=v;else throw Error(On+w+" not true or false: "+v);if(x.hasOwnProperty(w="MODULO_MODE")&&(v=x[w],zt(v,0,9,w),p=v),x.hasOwnProperty(w="POW_PRECISION")&&(v=x[w],zt(v,0,an,w),f=v),x.hasOwnProperty(w="FORMAT"))if(v=x[w],typeof v=="object")k=v;else throw Error(On+w+" not an object: "+v);if(x.hasOwnProperty(w="ALPHABET"))if(v=x[w],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))E=v.slice(0,10)=="0123456789",T=v;else throw Error(On+w+" invalid: "+v)}else throw Error(On+"Object expected: "+x);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,c],RANGE:[l,d],CRYPTO:g,MODULO_MODE:p,POW_PRECISION:f,FORMAT:k,ALPHABET:T}},I.isBigNumber=function(x){if(!x||x._isBigNumber!==!0)return!1;if(!I.DEBUG)return!0;var w,v,C=x.c,m=x.e,F=x.s;e:if({}.toString.call(C)=="[object Array]"){if((F===1||F===-1)&&m>=-an&&m<=an&&m===ur(m)){if(C[0]===0){if(m===0&&C.length===1)return!0;break e}if(w=(m+1)%Ve,w<1&&(w+=Ve),String(C[0]).length==w){for(w=0;w<C.length;w++)if(v=C[w],v<0||v>=Tr||v!==ur(v))break e;if(v!==0)return!0}}}else if(C===null&&m===null&&(F===null||F===1||F===-1))return!0;throw Error(On+"Invalid BigNumber: "+x)},I.maximum=I.max=function(){return R(arguments,-1)},I.minimum=I.min=function(){return R(arguments,1)},I.random=(function(){var x=9007199254740992,w=Math.random()*x&2097151?function(){return ur(Math.random()*x)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,m,F,S,b,A=0,L=[],B=new I(i);if(v==null?v=s:zt(v,0,an),S=nm(v/Ve),g)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(S*=2));A<S;)b=C[A]*131072+(C[A+1]>>>11),b>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),C[A]=m[0],C[A+1]=m[1]):(L.push(b%1e14),A+=2);A=S/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(S*=7);A<S;)b=(C[A]&31)*281474976710656+C[A+1]*1099511627776+C[A+2]*4294967296+C[A+3]*16777216+(C[A+4]<<16)+(C[A+5]<<8)+C[A+6],b>=9e15?crypto.randomBytes(7).copy(C,A):(L.push(b%1e14),A+=7);A=S/7}else throw g=!1,Error(On+"crypto unavailable");if(!g)for(;A<S;)b=w(),b<9e15&&(L[A++]=b%1e14);for(S=L[--A],v%=Ve,S&&v&&(b=om[Ve-v],L[A]=ur(S/b)*b);L[A]===0;L.pop(),A--);if(A<0)L=[F=0];else{for(F=-1;L[0]===0;L.splice(0,1),F-=Ve);for(A=1,b=L[0];b>=10;b/=10,A++);A<Ve&&(F-=Ve-A)}return B.e=F,B.c=L,B}})(),I.sum=function(){for(var x=1,w=arguments,v=new I(w[0]);x<w.length;)v=v.plus(w[x++]);return v},n=(function(){var x="0123456789";function w(v,C,m,F){for(var S,b=[0],A,L=0,B=v.length;L<B;){for(A=b.length;A--;b[A]*=C);for(b[0]+=F.indexOf(v.charAt(L++)),S=0;S<b.length;S++)b[S]>m-1&&(b[S+1]==null&&(b[S+1]=0),b[S+1]+=b[S]/m|0,b[S]%=m)}return b.reverse()}return function(v,C,m,F,S){var b,A,L,B,N,h,j,W,M=v.indexOf("."),K=s,ee=a;for(M>=0&&(B=f,f=0,v=v.replace(".",""),W=new I(C),h=W.pow(v.length-M),f=B,W.c=w(ro(cr(h.c),h.e,"0"),10,m,x),W.e=W.c.length),j=w(v,C,m,S?(b=T,x):(b=x,T)),L=B=j.length;j[--B]==0;j.pop());if(!j[0])return b.charAt(0);if(M<0?--L:(h.c=j,h.e=L,h.s=F,h=t(h,W,K,ee,m),j=h.c,N=h.r,L=h.e),A=L+K+1,M=j[A],B=m/2,N=N||A<0||j[A+1]!=null,N=ee<4?(M!=null||N)&&(ee==0||ee==(h.s<0?3:2)):M>B||M==B&&(ee==4||N||ee==6&&j[A-1]&1||ee==(h.s<0?8:7)),A<1||!j[0])v=N?ro(b.charAt(1),-K,b.charAt(0)):b.charAt(0);else{if(j.length=A,N)for(--m;++j[--A]>m;)j[A]=0,A||(++L,j=[1].concat(j));for(B=j.length;!j[--B];);for(M=0,v="";M<=B;v+=b.charAt(j[M++]));v=ro(v,L,b.charAt(0))}return v}})(),t=(function(){function x(C,m,F){var S,b,A,L,B=0,N=C.length,h=m%Io,j=m/Io|0;for(C=C.slice();N--;)A=C[N]%Io,L=C[N]/Io|0,S=j*A+L*h,b=h*A+S%Io*Io+B,B=(b/F|0)+(S/Io|0)+j*L,C[N]=b%F;return B&&(C=[B].concat(C)),C}function w(C,m,F,S){var b,A;if(F!=S)A=F>S?1:-1;else for(b=A=0;b<F;b++)if(C[b]!=m[b]){A=C[b]>m[b]?1:-1;break}return A}function v(C,m,F,S){for(var b=0;F--;)C[F]-=b,b=C[F]<m[F]?1:0,C[F]=b*S+C[F]-m[F];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,m,F,S,b){var A,L,B,N,h,j,W,M,K,ee,ge,xe,ae,Ke,be,Te,te,Me=C.s==m.s?1:-1,Ae=C.c,pe=m.c;if(!Ae||!Ae[0]||!pe||!pe[0])return new I(!C.s||!m.s||(Ae?pe&&Ae[0]==pe[0]:!pe)?NaN:Ae&&Ae[0]==0||!pe?Me*0:Me/0);for(M=new I(Me),K=M.c=[],L=C.e-m.e,Me=F+L+1,b||(b=Tr,L=pr(C.e/Ve)-pr(m.e/Ve),Me=Me/Ve|0),B=0;pe[B]==(Ae[B]||0);B++);if(pe[B]>(Ae[B]||0)&&L--,Me<0)K.push(1),N=!0;else{for(Ke=Ae.length,Te=pe.length,B=0,Me+=2,h=ur(b/(pe[0]+1)),h>1&&(pe=x(pe,h,b),Ae=x(Ae,h,b),Te=pe.length,Ke=Ae.length),ae=Te,ee=Ae.slice(0,Te),ge=ee.length;ge<Te;ee[ge++]=0);te=pe.slice(),te=[0].concat(te),be=pe[0],pe[1]>=b/2&&be++;do{if(h=0,A=w(pe,ee,Te,ge),A<0){if(xe=ee[0],Te!=ge&&(xe=xe*b+(ee[1]||0)),h=ur(xe/be),h>1)for(h>=b&&(h=b-1),j=x(pe,h,b),W=j.length,ge=ee.length;w(j,ee,W,ge)==1;)h--,v(j,Te<W?te:pe,W,b),W=j.length,A=1;else h==0&&(A=h=1),j=pe.slice(),W=j.length;if(W<ge&&(j=[0].concat(j)),v(ee,j,ge,b),ge=ee.length,A==-1)for(;w(pe,ee,Te,ge)<1;)h++,v(ee,Te<ge?te:pe,ge,b),ge=ee.length}else A===0&&(h++,ee=[0]);K[B++]=h,ee[0]?ee[ge++]=Ae[ae]||0:(ee=[Ae[ae]],ge=1)}while((ae++<Ke||ee[0]!=null)&&Me--);N=ee[0]!=null,K[0]||K.splice(0,1)}if(b==Tr){for(B=1,Me=K[0];Me>=10;Me/=10,B++);P(M,F+(M.e=B+L*Ve-1)+1,S,N)}else M.e=L,M.r=+N;return M}})();function D(x,w,v,C){var m,F,S,b,A;if(v==null?v=a:zt(v,0,8),!x.c)return x.toString();if(m=x.c[0],S=x.e,w==null)A=cr(x.c),A=C==1||C==2&&(S<=u||S>=c)?Gl(A,S):ro(A,S,"0");else if(x=P(new I(x),w,v),F=x.e,A=cr(x.c),b=A.length,C==1||C==2&&(w<=F||F<=u)){for(;b<w;A+="0",b++);A=Gl(A,F)}else if(w-=S+(C===2&&F>S),A=ro(A,F,"0"),F+1>b){if(--w>0)for(A+=".";w--;A+="0");}else if(w+=F-b,w>0)for(F+1==b&&(A+=".");w--;A+="0");return x.s<0&&m?"-"+A:A}function R(x,w){for(var v,C,m=1,F=new I(x[0]);m<x.length;m++)C=new I(x[m]),(!C.s||(v=ti(F,C))===w||v===0&&F.s===w)&&(F=C);return F}function $(x,w,v){for(var C=1,m=w.length;!w[--m];w.pop());for(m=w[0];m>=10;m/=10,C++);return(v=C+v*Ve-1)>d?x.c=x.e=null:v<l?x.c=[x.e=0]:(x.e=v,x.c=w),x}r=(function(){var x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,S,b,A){var L,B=b?S:S.replace(m,"");if(C.test(B))F.s=isNaN(B)?null:B<0?-1:1;else{if(!b&&(B=B.replace(x,function(N,h,j){return L=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!A||A==L?h:N}),A&&(L=A,B=B.replace(w,"$1").replace(v,"0.$1")),S!=B))return new I(B,L);if(I.DEBUG)throw Error(On+"Not a"+(A?" base "+A:"")+" number: "+S);F.s=null}F.c=F.e=null}})();function P(x,w,v,C){var m,F,S,b,A,L,B,N=x.c,h=om;if(N){e:{for(m=1,b=N[0];b>=10;b/=10,m++);if(F=w-m,F<0)F+=Ve,S=w,A=N[L=0],B=ur(A/h[m-S-1]%10);else if(L=nm((F+1)/Ve),L>=N.length)if(C){for(;N.length<=L;N.push(0));A=B=0,m=1,F%=Ve,S=F-Ve+1}else break e;else{for(A=b=N[L],m=1;b>=10;b/=10,m++);F%=Ve,S=F-Ve+m,B=S<0?0:ur(A/h[m-S-1]%10)}if(C=C||w<0||N[L+1]!=null||(S<0?A:A%h[m-S-1]),C=v<4?(B||C)&&(v==0||v==(x.s<0?3:2)):B>5||B==5&&(v==4||C||v==6&&(F>0?S>0?A/h[m-S]:0:N[L-1])%10&1||v==(x.s<0?8:7)),w<1||!N[0])return N.length=0,C?(w-=x.e+1,N[0]=h[(Ve-w%Ve)%Ve],x.e=-w||0):N[0]=x.e=0,x;if(F==0?(N.length=L,b=1,L--):(N.length=L+1,b=h[Ve-F],N[L]=S>0?ur(A/h[m-S]%h[S])*b:0),C)for(;;)if(L==0){for(F=1,S=N[0];S>=10;S/=10,F++);for(S=N[0]+=b,b=1;S>=10;S/=10,b++);F!=b&&(x.e++,N[0]==Tr&&(N[0]=1));break}else{if(N[L]+=b,N[L]!=Tr)break;N[L--]=0,b=1}for(F=N.length;N[--F]===0;N.pop());}x.e>d?x.c=x.e=null:x.e<l&&(x.c=[x.e=0])}return x}function z(x){var w,v=x.e;return v===null?x.toString():(w=cr(x.c),w=v<=u||v>=c?Gl(w,v):ro(w,v,"0"),x.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var x=new I(this);return x.s<0&&(x.s=1),x},o.comparedTo=function(x,w){return ti(this,new I(x,w))},o.decimalPlaces=o.dp=function(x,w){var v,C,m,F=this;if(x!=null)return zt(x,0,an),w==null?w=a:zt(w,0,8),P(new I(F),x+F.e+1,w);if(!(v=F.c))return null;if(C=((m=v.length-1)-pr(this.e/Ve))*Ve,m=v[m])for(;m%10==0;m/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(x,w){return t(this,new I(x,w),s,a)},o.dividedToIntegerBy=o.idiv=function(x,w){return t(this,new I(x,w),0,1)},o.exponentiatedBy=o.pow=function(x,w){var v,C,m,F,S,b,A,L,B,N=this;if(x=new I(x),x.c&&!x.isInteger())throw Error(On+"Exponent not an integer: "+z(x));if(w!=null&&(w=new I(w)),b=x.e>14,!N.c||!N.c[0]||N.c[0]==1&&!N.e&&N.c.length==1||!x.c||!x.c[0])return B=new I(Math.pow(+z(N),b?x.s*(2-Vl(x)):+z(x))),w?B.mod(w):B;if(A=x.s<0,w){if(w.c?!w.c[0]:!w.s)return new I(NaN);C=!A&&N.isInteger()&&w.isInteger(),C&&(N=N.mod(w))}else{if(x.e>9&&(N.e>0||N.e<-1||(N.e==0?N.c[0]>1||b&&N.c[1]>=24e7:N.c[0]<8e13||b&&N.c[0]<=9999975e7)))return F=N.s<0&&Vl(x)?-0:0,N.e>-1&&(F=1/F),new I(A?1/F:F);f&&(F=nm(f/Ve+2))}for(b?(v=new I(.5),A&&(x.s=1),L=Vl(x)):(m=Math.abs(+z(x)),L=m%2),B=new I(i);;){if(L){if(B=B.times(N),!B.c)break;F?B.c.length>F&&(B.c.length=F):C&&(B=B.mod(w))}if(m){if(m=ur(m/2),m===0)break;L=m%2}else if(x=x.times(v),P(x,x.e+1,1),x.e>14)L=Vl(x);else{if(m=+z(x),m===0)break;L=m%2}N=N.times(N),F?N.c&&N.c.length>F&&(N.c.length=F):C&&(N=N.mod(w))}return C?B:(A&&(B=i.div(B)),w?B.mod(w):F?P(B,f,a,S):B)},o.integerValue=function(x){var w=new I(this);return x==null?x=a:zt(x,0,8),P(w,w.e+1,x)},o.isEqualTo=o.eq=function(x,w){return ti(this,new I(x,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(x,w){return ti(this,new I(x,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(x,w){return(w=ti(this,new I(x,w)))===1||w===0},o.isInteger=function(){return!!this.c&&pr(this.e/Ve)>this.c.length-2},o.isLessThan=o.lt=function(x,w){return ti(this,new I(x,w))<0},o.isLessThanOrEqualTo=o.lte=function(x,w){return(w=ti(this,new I(x,w)))===-1||w===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(x,w){var v,C,m,F,S=this,b=S.s;if(x=new I(x,w),w=x.s,!b||!w)return new I(NaN);if(b!=w)return x.s=-w,S.plus(x);var A=S.e/Ve,L=x.e/Ve,B=S.c,N=x.c;if(!A||!L){if(!B||!N)return B?(x.s=-w,x):new I(N?S:NaN);if(!B[0]||!N[0])return N[0]?(x.s=-w,x):new I(B[0]?S:a==3?-0:0)}if(A=pr(A),L=pr(L),B=B.slice(),b=A-L){for((F=b<0)?(b=-b,m=B):(L=A,m=N),m.reverse(),w=b;w--;m.push(0));m.reverse()}else for(C=(F=(b=B.length)<(w=N.length))?b:w,b=w=0;w<C;w++)if(B[w]!=N[w]){F=B[w]<N[w];break}if(F&&(m=B,B=N,N=m,x.s=-x.s),w=(C=N.length)-(v=B.length),w>0)for(;w--;B[v++]=0);for(w=Tr-1;C>b;){if(B[--C]<N[C]){for(v=C;v&&!B[--v];B[v]=w);--B[v],B[C]+=Tr}B[C]-=N[C]}for(;B[0]==0;B.splice(0,1),--L);return B[0]?$(x,B,L):(x.s=a==3?-1:1,x.c=[x.e=0],x)},o.modulo=o.mod=function(x,w){var v,C,m=this;return x=new I(x,w),!m.c||!x.s||x.c&&!x.c[0]?new I(NaN):!x.c||m.c&&!m.c[0]?new I(m):(p==9?(C=x.s,x.s=1,v=t(m,x,0,3),x.s=C,v.s*=C):v=t(m,x,0,p),x=m.minus(v.times(x)),!x.c[0]&&p==1&&(x.s=m.s),x)},o.multipliedBy=o.times=function(x,w){var v,C,m,F,S,b,A,L,B,N,h,j,W,M,K,ee=this,ge=ee.c,xe=(x=new I(x,w)).c;if(!ge||!xe||!ge[0]||!xe[0])return!ee.s||!x.s||ge&&!ge[0]&&!xe||xe&&!xe[0]&&!ge?x.c=x.e=x.s=null:(x.s*=ee.s,!ge||!xe?x.c=x.e=null:(x.c=[0],x.e=0)),x;for(C=pr(ee.e/Ve)+pr(x.e/Ve),x.s*=ee.s,A=ge.length,N=xe.length,A<N&&(W=ge,ge=xe,xe=W,m=A,A=N,N=m),m=A+N,W=[];m--;W.push(0));for(M=Tr,K=Io,m=N;--m>=0;){for(v=0,h=xe[m]%K,j=xe[m]/K|0,S=A,F=m+S;F>m;)L=ge[--S]%K,B=ge[S]/K|0,b=j*L+B*h,L=h*L+b%K*K+W[F]+v,v=(L/M|0)+(b/K|0)+j*B,W[F--]=L%M;W[F]=v}return v?++C:W.splice(0,1),$(x,W,C)},o.negated=function(){var x=new I(this);return x.s=-x.s||null,x},o.plus=function(x,w){var v,C=this,m=C.s;if(x=new I(x,w),w=x.s,!m||!w)return new I(NaN);if(m!=w)return x.s=-w,C.minus(x);var F=C.e/Ve,S=x.e/Ve,b=C.c,A=x.c;if(!F||!S){if(!b||!A)return new I(m/0);if(!b[0]||!A[0])return A[0]?x:new I(b[0]?C:m*0)}if(F=pr(F),S=pr(S),b=b.slice(),m=F-S){for(m>0?(S=F,v=A):(m=-m,v=b),v.reverse();m--;v.push(0));v.reverse()}for(m=b.length,w=A.length,m-w<0&&(v=A,A=b,b=v,w=m),m=0;w;)m=(b[--w]=b[w]+A[w]+m)/Tr|0,b[w]=Tr===b[w]?0:b[w]%Tr;return m&&(b=[m].concat(b),++S),$(x,b,S)},o.precision=o.sd=function(x,w){var v,C,m,F=this;if(x!=null&&x!==!!x)return zt(x,1,an),w==null?w=a:zt(w,0,8),P(new I(F),x,w);if(!(v=F.c))return null;if(m=v.length-1,C=m*Ve+1,m=v[m]){for(;m%10==0;m/=10,C--);for(m=v[0];m>=10;m/=10,C++);}return x&&F.e+1>C&&(C=F.e+1),C},o.shiftedBy=function(x){return zt(x,-rm,rm),this.times("1e"+x)},o.squareRoot=o.sqrt=function(){var x,w,v,C,m,F=this,S=F.c,b=F.s,A=F.e,L=s+4,B=new I("0.5");if(b!==1||!S||!S[0])return new I(!b||b<0&&(!S||S[0])?NaN:S?F:1/0);if(b=Math.sqrt(+z(F)),b==0||b==1/0?(w=cr(S),(w.length+A)%2==0&&(w+="0"),b=Math.sqrt(+w),A=pr((A+1)/2)-(A<0||A%2),b==1/0?w="5e"+A:(w=b.toExponential(),w=w.slice(0,w.indexOf("e")+1)+A),v=new I(w)):v=new I(b+""),v.c[0]){for(A=v.e,b=A+L,b<3&&(b=0);;)if(m=v,v=B.times(m.plus(t(F,m,L,1))),cr(m.c).slice(0,b)===(w=cr(v.c)).slice(0,b))if(v.e<A&&--b,w=w.slice(b-3,b+1),w=="9999"||!C&&w=="4999"){if(!C&&(P(m,m.e+s+2,0),m.times(m).eq(F))){v=m;break}L+=4,b+=4,C=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(P(v,v.e+s+2,1),x=!v.times(v).eq(F));break}}return P(v,v.e+s+1,a,x)},o.toExponential=function(x,w){return x!=null&&(zt(x,0,an),x++),D(this,x,w,1)},o.toFixed=function(x,w){return x!=null&&(zt(x,0,an),x=x+this.e+1),D(this,x,w)},o.toFormat=function(x,w,v){var C,m=this;if(v==null)x!=null&&w&&typeof w=="object"?(v=w,w=null):x&&typeof x=="object"?(v=x,x=w=null):v=k;else if(typeof v!="object")throw Error(On+"Argument not an object: "+v);if(C=m.toFixed(x,w),m.c){var F,S=C.split("."),b=+v.groupSize,A=+v.secondaryGroupSize,L=v.groupSeparator||"",B=S[0],N=S[1],h=m.s<0,j=h?B.slice(1):B,W=j.length;if(A&&(F=b,b=A,A=F,W-=F),b>0&&W>0){for(F=W%b||b,B=j.substr(0,F);F<W;F+=b)B+=L+j.substr(F,b);A>0&&(B+=L+j.slice(F)),h&&(B="-"+B)}C=N?B+(v.decimalSeparator||"")+((A=+v.fractionGroupSize)?N.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):N):B}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(x){var w,v,C,m,F,S,b,A,L,B,N,h,j=this,W=j.c;if(x!=null&&(b=new I(x),!b.isInteger()&&(b.c||b.s!==1)||b.lt(i)))throw Error(On+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+z(b));if(!W)return new I(j);for(w=new I(i),L=v=new I(i),C=A=new I(i),h=cr(W),F=w.e=h.length-j.e-1,w.c[0]=om[(S=F%Ve)<0?Ve+S:S],x=!x||b.comparedTo(w)>0?F>0?w:L:b,S=d,d=1/0,b=new I(h),A.c[0]=0;B=t(b,w,0,1),m=v.plus(B.times(C)),m.comparedTo(x)!=1;)v=C,C=m,L=A.plus(B.times(m=L)),A=m,w=b.minus(B.times(m=w)),b=m;return m=t(x.minus(v),C,0,1),A=A.plus(m.times(L)),v=v.plus(m.times(C)),A.s=L.s=j.s,F=F*2,N=t(L,C,F,a).minus(j).abs().comparedTo(t(A,v,F,a).minus(j).abs())<1?[L,C]:[A,v],d=S,N},o.toNumber=function(){return+z(this)},o.toPrecision=function(x,w){return x!=null&&zt(x,1,an),D(this,x,w,2)},o.toString=function(x){var w,v=this,C=v.s,m=v.e;return m===null?C?(w="Infinity",C<0&&(w="-"+w)):w="NaN":(x==null?w=m<=u||m>=c?Gl(cr(v.c),m):ro(cr(v.c),m,"0"):x===10&&E?(v=P(new I(v),s+m+1,a),w=ro(cr(v.c),v.e,"0")):(zt(x,2,T.length,"Base"),w=n(ro(cr(v.c),m,"0"),10,x,C,!0)),C<0&&v.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return z(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&I.set(e),I}function pr(e){var t=e|0;return e>0||e===t?t:t-1}function cr(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Ve-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function ti(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=u==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return u>c^n?1:-1;for(a=(u=o.length)<(c=i.length)?u:c,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function zt(e,t,n,r){if(e<t||e>n||e!==ur(e))throw Error(On+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Vl(e){var t=e.c.length-1;return pr(e.e/Ve)==t&&e.c[t]%2!=0}function Gl(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ro(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Sz=wv(),vv=Sz;var wz=24,Ks=32,vz=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"?()=>{let e=new Uint32Array(1);return globalThis.crypto.getRandomValues(e),e[0]/4294967296}:Math.random,sm=vz(),im=(e=4,t=sm)=>{let n="";for(;n.length<e;)n=n+Math.floor(t()*36).toString(36);return n};function kz(e){let t=new vv(0);for(let n of e.values())t=t.multipliedBy(256).plus(n);return t}var Cv=(e="")=>{let t=new TextEncoder;return kz(bv(t.encode(e))).toString(36).slice(1)},kv=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),Cz=e=>kv[Math.floor(e()*kv.length)],Tz=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=sm}={})=>{let n=Object.keys(e).toString(),r=n.length?n+im(Ks,t):im(Ks,t);return Cv(r).substring(0,Ks)},Iz=e=>()=>e++,Fz=476782367,Tv=({random:e=sm,counter:t=Iz(Math.floor(e()*Fz)),length:n=wz,fingerprint:r=Tz({random:e})}={})=>{if(n>Ks)throw new Error(`Length must be between 2 and ${Ks}. Received: ${n}`);return function(){let i=Cz(e),s=Date.now().toString(36),a=t().toString(36),u=im(n,e),c=`${s+u+a+r}`;return`${i+Cv(c).substring(1,n)}`}},Fo=Ez(Tv);function Ez(e){let t;return()=>(t||(t=e()),t())}var Lz=Ua(Ev());Rn();Oe();var ql=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function Mz(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function am(e,t){let n=[],r=e.split(`
14
+ `,S1="/",w1="*",ai="",z3="comment",N3="declaration";function O3(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(f){var k=f.match(E3);k&&(n+=k.length);var T=f.lastIndexOf(R3);r=~T?f.length-T:r+f.length}function i(){var f={line:n,column:r};return function(k){return k.position=new s(f),c(),k}}function s(f){this.start=f,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(f){var k=new Error(t.source+":"+n+":"+r+": "+f);if(k.reason=f,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function u(f){var k=f.exec(e);if(k){var T=k[0];return o(T),e=e.slice(T.length),k}}function c(){u(A3)}function l(f){var k;for(f=f||[];k=d();)k!==!1&&f.push(k);return f}function d(){var f=i();if(!(S1!=e.charAt(0)||w1!=e.charAt(1))){for(var k=2;ai!=e.charAt(k)&&(w1!=e.charAt(k)||S1!=e.charAt(k+1));)++k;if(k+=2,ai===e.charAt(k-1))return a("End of comment missing");var T=e.slice(2,k-2);return r+=2,o(T),e=e.slice(k),r+=2,f({type:z3,comment:T})}}function g(){var f=i(),k=u(P3);if(k){if(d(),!u(L3))return a("property missing ':'");var T=u(M3),E=f({type:N3,property:v1(k[0].replace(b1,ai)),value:T?v1(T[0].replace(b1,ai)):ai});return u(B3),E}}function p(){var f=[];l(f);for(var k;k=g();)k!==!1&&(f.push(k),l(f));return f}return c(),p()}function v1(e){return e?e.replace(D3,ai):ai}k1.exports=O3});var T1=rr(ma=>{"use strict";var _3=ma&&ma.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ma,"__esModule",{value:!0});ma.default=U3;var $3=_3(C1());function U3(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,$3.default)(e),o=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;let{property:s,value:a}=i;o?t(s,a,i):a&&(n=n||{},n[s]=a)}),n}});var F1=rr(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.camelCase=void 0;var j3=/^--[a-zA-Z0-9_-]+$/,H3=/-([a-z])/g,W3=/^[^-]+$/,V3=/^-(webkit|moz|ms|o|khtml)-/,G3=/^-(ms)-/,q3=function(e){return!e||W3.test(e)||j3.test(e)},Y3=function(e,t){return t.toUpperCase()},I1=function(e,t){return"".concat(t,"-")},K3=function(e,t){return t===void 0&&(t={}),q3(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(G3,I1):e=e.replace(V3,I1),e.replace(H3,Y3))};kc.camelCase=K3});var A1=rr((Ph,E1)=>{"use strict";var X3=Ph&&Ph.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Q3=X3(T1()),J3=F1();function Ah(e,t){var n={};return!e||typeof e!="string"||(0,Q3.default)(e,function(r,o){r&&o&&(n[(0,J3.camelCase)(r,t)]=o)}),n}Ah.default=Ah;E1.exports=Ah});var nI=rr((Jpe,tI)=>{"use strict";var Gc=Object.prototype.hasOwnProperty,eI=Object.prototype.toString,YT=Object.defineProperty,KT=Object.getOwnPropertyDescriptor,XT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):eI.call(t)==="[object Array]"},QT=function(t){if(!t||eI.call(t)!=="[object Object]")return!1;var n=Gc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Gc.call(t,o)},JT=function(t,n){YT&&n.name==="__proto__"?YT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ZT=function(t,n){if(n==="__proto__")if(Gc.call(t,n)){if(KT)return KT(t,n).value}else return;return t[n]};tI.exports=function e(){var t,n,r,o,i,s,a=arguments[0],u=1,c=arguments.length,l=!1;for(typeof a=="boolean"&&(l=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=ZT(a,n),o=ZT(t,n),a!==o&&(l&&o&&(QT(o)||(i=XT(o)))?(i?(i=!1,s=r&&XT(r)?r:[]):s=r&&QT(r)?r:{},JT(a,{name:n,newValue:e(l,s,o)})):typeof o<"u"&&JT(a,{name:n,newValue:o}));return a}});import Oa from"react";import{addons as lu,types as ty,experimental_getStatusStore as ny}from"storybook/manager-api";import{AddonPanel as yV}from"storybook/internal/components";import Dt,{useState as NW,useEffect as OW}from"react";import{styled as xr}from"storybook/theming";import py from"react";import{styled as Mt}from"storybook/theming";var se="#ea580c",pu="#c2410c",ja="#ff6b35";var iy=Mt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),sy=Mt.div({flex:1,overflow:"auto",padding:"6px 20px 20px"}),ho=Mt.div({marginBottom:"20px"}),xo=Mt.label(({theme:e})=>({display:"block",marginBottom:`${e.layoutMargin*.6}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),ps=Mt.input(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.8}px ${e.layoutMargin}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:e.input.background,color:e.color.defaultText,"&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`}})),hn=Mt.select(({theme:e})=>({width:"100%",padding:`${e.layoutMargin*.8}px 32px ${e.layoutMargin*.8}px ${e.layoutMargin}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:e.input.background,color:e.color.defaultText,cursor:"pointer",appearance:"none",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center",backgroundSize:"12px",transition:"border-color 0.15s, box-shadow 0.15s","&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`},"&:hover":{borderColor:e.color.mediumdark},"&:disabled":{opacity:.6,cursor:"not-allowed"}})),ay=Mt(hn)(({theme:e})=>({width:"auto",padding:`${e.layoutMargin*.6}px 28px ${e.layoutMargin*.6}px ${e.layoutMargin}px`,fontSize:e.typography.size.s1})),Ha=e=>({padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,border:"none",borderRadius:e.appBorderRadius,cursor:"pointer",transition:"all 0.15s","&:disabled":{opacity:.5,cursor:"not-allowed"}}),kn=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Yt=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:se,color:e.color.inverseText,boxShadow:`0 2px 4px ${se}4d`,"&:hover:not(:disabled)":{backgroundColor:pu,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${se}66`}})),Rr=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),ly=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Cn=Mt.button(({theme:e})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:`${e.layoutMargin*.4}px`,fontSize:e.typography.size.s2,color:e.color.mediumdark,backgroundColor:"transparent",border:"none",borderRadius:e.appBorderRadius,cursor:"pointer",transition:"all 0.15s","&:hover":{color:e.color.defaultText,backgroundColor:e.background.hoverable},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),du=Mt.button(({theme:e})=>({padding:0,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.base,color:e.color.secondary,backgroundColor:"transparent",border:"none",cursor:"pointer",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),yo=Mt.button(({theme:e,active:t})=>({padding:`${e.layoutMargin*.6}px ${e.layoutMargin*1.2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:t?e.typography.weight.bold:400,color:t?e.color.secondary:e.color.mediumdark,backgroundColor:"transparent",border:"none",borderBottom:t?`2px solid ${e.color.secondary}`:"2px solid transparent",cursor:"pointer",transition:"all 0.15s","&:hover":{color:t?e.color.secondary:e.color.defaultText}})),bo=Mt(ps)(({theme:e})=>({paddingLeft:`${e.layoutMargin*3}px`,backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:`${e.layoutMargin}px center`,backgroundSize:"14px"})),IV=Mt.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),cy=Mt.h2(({theme:e})=>({margin:`0 0 ${e.layoutMargin*1.6}px`,fontSize:e.typography.size.s3,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),FV=Mt.h3(({theme:e})=>({margin:`0 0 ${e.layoutMargin*1.2}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),ds=Mt.p(({theme:e})=>({margin:`0 0 ${e.layoutMargin*.8}px`,fontSize:e.typography.size.s2,fontFamily:e.typography.fonts.base,color:e.color.defaultText,lineHeight:1.5})),EV=Mt.div(({theme:e,width:t="100%",height:n="40px"})=>({width:t,height:n,backgroundColor:e.background.hoverable,borderRadius:e.appBorderRadius,position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"100%",background:`linear-gradient(90deg, transparent, ${e.color.mediumlight}33, transparent)`,animation:"shimmer 1.5s infinite"},"@keyframes shimmer":{"0%":{transform:"translateX(-100%)"},"100%":{transform:"translateX(100%)"}}})),uy=Mt.span(({theme:e,variant:t="default"})=>{let n={default:{bg:e.background.hoverable,color:e.color.defaultText},success:{bg:`${e.color.positive}40`,color:e.color.positive},warning:{bg:`${e.color.warning}40`,color:e.color.warning},error:{bg:`${e.color.negative}40`,color:e.color.negative}};return{display:"inline-block",padding:"2px 8px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,borderRadius:"3px",backgroundColor:n[t].bg,color:n[t].color}}),AV=Mt.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),PV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),LV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));var gu=({header:e,children:t,footer:n})=>py.createElement(iy,null,e,py.createElement(sy,null,t),n);import XF from"react";import{styled as QF}from"storybook/theming";var JF=QF.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"6px 12px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,zIndex:100,backgroundColor:e.background.content})),fu=({toolbar:e})=>XF.createElement(JF,null,e);import UV from"react";import{styled as Wa}from"storybook/theming";var WV=Wa.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,zIndex:100,backgroundColor:e.background.content})),VV=Wa.div({display:"flex",flex:1}),GV=Wa(yo)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),qV=Wa.div({display:"flex",gap:"8px",alignItems:"center"});import Zt,{useState as Of,useCallback as Nw,useEffect as Ow}from"react";import{styled as eo}from"storybook/theming";import ve,{useEffect as Iw}from"react";import{styled as lt}from"storybook/theming";Ce();je();Oe();ct();var Fw=lt.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),Ew=lt.div(({theme:e})=>({position:"absolute",top:"100%",right:0,marginTop:"8px",backgroundColor:e.background.content,borderRadius:"12px",width:"360px",maxWidth:"90vw",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",zIndex:10001})),ND=lt.div({display:"flex",alignItems:"center",gap:"12px",padding:"16px 16px 12px"}),OD=lt.div({width:"36px",height:"36px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",fontWeight:700,flexShrink:0}),_D=lt.div({display:"flex",flexDirection:"column",gap:"4px"}),$D=lt.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,lineHeight:1.2})),UD=lt.span({display:"inline-block",alignSelf:"flex-start",padding:"2px 10px",borderRadius:"6px",fontSize:"11px",fontWeight:600,color:"#7c3aed",backgroundColor:"rgba(124, 58, 237, 0.1)",letterSpacing:"0.3px"}),jD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px 8px",fontSize:"14px",color:e.color.defaultText})),HD=lt.span(({theme:e})=>({color:e.textMutedColor,fontSize:"13px"})),WD=lt.span(({theme:e})=>({color:e.color.defaultText,fontSize:"15px",fontWeight:600})),VD=lt.div(({theme:e})=>({height:"8px",borderRadius:"4px",backgroundColor:e.base==="dark"?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.08)",margin:"0 16px 8px",overflow:"hidden"})),GD=lt.div(({percent:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,background:`linear-gradient(90deg, #f59e0b 0%, ${se} 100%)`,transition:"width 0.3s ease"})),qD=lt.div(({theme:e})=>({padding:"0 16px 14px",fontSize:"12px",color:e.textMutedColor})),YD=lt.div(({theme:e})=>({height:"1px",backgroundColor:e.appBorderColor})),KD=lt.button({width:"100%",padding:"14px 16px",background:"transparent",border:"none",color:se,fontSize:"14px",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.03)"}}),Aw=lt.button(({theme:e})=>({position:"absolute",top:"12px",right:"12px",width:"24px",height:"24px",borderRadius:"4px",border:"none",background:"transparent",color:e.textMutedColor,cursor:"pointer",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center","&:hover":{backgroundColor:e.background.hoverable}})),XD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),QD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),JD=lt.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),ZD=lt.div({display:"flex",gap:"8px"}),Pw=lt(Cn)({fontSize:"18px"}),eR=lt.div({padding:"20px 16px"}),tR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),nR=lt.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),rR=lt.div({fontSize:"28px",fontWeight:700}),oR=lt.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),iR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),sR=lt.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),aR=lt.div({display:"flex",alignItems:"center",gap:"8px"}),lR=lt.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),cR=lt.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:se,color:e.color.inverseText})),uR=lt.button(({theme:e})=>({background:"none",border:"none",color:se,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),pR=lt.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),dR=lt.button(({theme:e,variant:t="primary"})=>({width:"100%",padding:"12px",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",border:"none",marginBottom:"12px",backgroundColor:t==="primary"?se:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),gR=30*1e3,Lw=({onClose:e})=>{let{sessionToken:t,resetAuth:n,usageData:r,usageLastFetched:o,setUsageData:i}=we(),{featureFlags:s}=ce(),a=s.showCosts,u=r,c=!r&&t,l=async(f=!1)=>{if(!t)return;let k=o&&Date.now()-o<gR;if(!(!f&&k&&r))try{let T=V(),E=await ne(`${T}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(E.ok){let I=await E.json();i(I)}}catch(T){y.error("Failed to fetch usage:",T)}};Iw(()=>{l()},[t]),Iw(()=>{let f=()=>{document.visibilityState==="visible"&&(y.debug("[TokenUsageModal] Tab visible, refreshing balance..."),l(!0))};return document.addEventListener("visibilitychange",f),()=>document.removeEventListener("visibilitychange",f)},[t]);let d=()=>{if(t){let f=V();fetch(`${f}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}n(),e()},g=()=>{let f=V();window.open(`${f}/pricing`,"_blank")},p=()=>{let f=V();window.open(`${f}/pricing#add-credits`,"_blank")};if(t&&!a&&!c){let f=Math.floor(u?.creditBalance??0),T=Math.max(f,10),E=Math.max(0,T-f),I=T>0?f/T*100:0;return ve.createElement(ve.Fragment,null,ve.createElement(Fw,{onClick:e}),ve.createElement(Ew,{onClick:D=>D.stopPropagation(),style:{width:"320px"}},ve.createElement(ND,null,ve.createElement(OD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement(_D,null,ve.createElement($D,null,"UI Review"),ve.createElement(UD,null,(u?.plan||"BETA").toUpperCase())),ve.createElement("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"2px"}},ve.createElement(Aw,{onClick:d,title:"Sign out",style:{position:"static"}},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Aw,{onClick:e,title:"Close",style:{position:"static"}},"\xD7"))),ve.createElement(jD,null,ve.createElement(HD,null,"Credits"),ve.createElement(WD,null,f," left")),ve.createElement(VD,null,ve.createElement(GD,{percent:I})),ve.createElement(qD,null,E," used \xB7 ",f," remaining"),ve.createElement(YD,null),ve.createElement(KD,{onClick:()=>window.open("mailto:hello@uiparity.com?subject=Credits request","_blank")},"Contact us for credits \u2192")))}return ve.createElement(ve.Fragment,null,ve.createElement(Fw,{onClick:e}),ve.createElement(Ew,{onClick:f=>f.stopPropagation()},ve.createElement(XD,null,ve.createElement(QD,null,ve.createElement(JD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement("span",null,u?.email||"Loading...")),ve.createElement(ZD,null,ve.createElement(Pw,{onClick:d,title:"Sign out"},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Pw,{onClick:e,title:"Close"},"\xD7"))),ve.createElement(eR,null,c?ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?ve.createElement(ve.Fragment,null,ve.createElement(tR,null,ve.createElement(nR,null,"Credit Balance"),ve.createElement(rR,null,"$",(u?.creditBalance??0).toFixed(2)),ve.createElement(oR,null,(u?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),ve.createElement(iR,null,ve.createElement(sR,null,ve.createElement(aR,null,ve.createElement(lR,null,"Current Plan"),ve.createElement(cR,null,u?.plan||"Free")),ve.createElement(uR,{onClick:g},"View detail >")),ve.createElement(pR,null,"~$0.02-0.05 per review depending on complexity"),ve.createElement(dR,{onClick:p,style:{marginTop:"16px"}},"Add Credits"))):ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};Ce();import Pi from"react";import{styled as Mw}from"storybook/theming";je();Ce();ct();Oe();var fR=Mw.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),mR=Mw.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),hR={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}},Bw=()=>{let{userRole:e,roleOverride:t,setRoleOverride:n,setFeatureFlags:r}=ce(),{sessionToken:o}=we();return e!=="admin"?null:Pi.createElement(fR,null,Pi.createElement(mR,null,"View as:"),Pi.createElement(ay,{value:t??e,onChange:a=>{let u=a.target.value;if(u===e)n(null),o&&ne(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(c=>c.json()).then(c=>{let l={enableFixGeneration:!!c.enableFixGeneration,enableFixApply:!!c.enableFixApply,enableAutoMap:!!c.enableAutoMap,enableReviewBadges:!!c.enableReviewBadges,showCosts:!!c.showCosts,enableParallelReview:!!c.enableParallelReview,enableModelSelection:!!c.enableModelSelection};r(l);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(l))}catch{}}).catch(c=>y.warn("[RoleSwitcher] Failed to re-fetch flags:",c.message));else{n(u);let c=hR[u];r(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}},style:{width:"auto",minWidth:"100px"}},Pi.createElement("option",{value:"admin"},"Admin"),Pi.createElement("option",{value:"beta"},"Beta Tester")),t&&Pi.createElement(uy,{variant:"warning"},"Previewing as ",t))};je();Ce();ct();import ht,{useState as Us,useCallback as Nf}from"react";import{styled as Cr}from"storybook/theming";var xR="0.5.7",yR=[{value:"bug",label:"\u{1F41E} Bug \u2014 something broke"},{value:"ux",label:"\u{1F9ED} UX \u2014 confusing or slow"},{value:"feature",label:"\u2728 Feature \u2014 missing something"},{value:"praise",label:"\u{1F49A} Praise \u2014 works great"},{value:"other",label:"\u{1F4AC} Other"}],bR=Cr.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"}),SR=Cr.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"12px",width:"460px",maxWidth:"94%",maxHeight:"90vh",overflow:"auto",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.25)"})),wR=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",borderBottom:`1px solid ${e.appBorderColor}`})),vR=Cr.h3(({theme:e})=>({margin:0,fontSize:"15px",fontWeight:600,color:e.color.defaultText,display:"flex",alignItems:"center",gap:"8px"})),kR=Cr.button(({theme:e})=>({background:"transparent",border:"none",fontSize:"20px",color:e.color.mediumdark,cursor:"pointer",padding:"0 6px",lineHeight:1,"&:hover":{color:e.color.defaultText}})),CR=Cr.div({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"14px"}),TR=Cr.textarea(({theme:e})=>({width:"100%",minHeight:"110px",padding:"8px 10px",borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.defaultText,backgroundColor:e.background.app,resize:"vertical",boxSizing:"border-box","&:focus":{outline:"none",borderColor:se}})),Dw=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px 16px",borderTop:`1px solid ${e.appBorderColor}`,gap:"8px"})),Rw=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4})),IR=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.negative})),FR=Cr.div(({theme:e})=>({padding:"24px 20px",textAlign:"center",display:"flex",flexDirection:"column",gap:"10px","& h4":{margin:0,fontSize:"15px",fontWeight:600,color:e.color.positive},"& p":{margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark}}));function zw({isOpen:e,onClose:t}){let{sessionToken:n,isConnected:r}=we(),{selectedProjectId:o}=Je(),{currentStoryId:i}=nt(),[s,a]=Us("other"),[u,c]=Us(""),[l,d]=Us(!1),[g,p]=Us(!1),[f,k]=Us(null),T=Nf(()=>{c(""),a("other"),p(!1),k(null),d(!1)},[]),E=Nf(()=>{T(),t()},[T,t]),I=Nf(async D=>{if(D.preventDefault(),!u.trim()){k("Please write a message.");return}if(!r||!n){k("Sign in to send feedback.");return}d(!0),k(null);try{let R=await ne(`${V()}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({message:u.trim(),severity:s,projectId:o||void 0,storyId:i||void 0,addonVersion:xR})});if(!R.ok){let $=await R.json().catch(()=>({}));throw new Error($.error||`Request failed (${R.status})`)}p(!0)}catch(R){k(R instanceof Error?R.message:"Something went wrong")}finally{d(!1)}},[u,s,n,r,o,i]);return e?ht.createElement(bR,{onClick:E},ht.createElement(SR,{onClick:D=>D.stopPropagation()},ht.createElement(wR,null,ht.createElement(vR,null,ht.createElement("span",null,"\u{1F4AC}"),"Send feedback"),ht.createElement(kR,{onClick:E,"aria-label":"Close"},"\xD7")),g?ht.createElement(ht.Fragment,null,ht.createElement(FR,null,ht.createElement("h4",null,"Thanks \u2014 got it."),ht.createElement("p",null,"We read every message. If it's a bug, we'll likely follow up by email.")),ht.createElement(Dw,null,ht.createElement("span",null),ht.createElement(kn,{onClick:E},"Close"))):ht.createElement("form",{onSubmit:I},ht.createElement(CR,null,ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-severity"},"Type"),ht.createElement(hn,{id:"feedback-severity",value:s,onChange:D=>a(D.target.value),disabled:l},yR.map(D=>ht.createElement("option",{key:D.value,value:D.value},D.label)))),ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-message"},"What happened?"),ht.createElement(TR,{id:"feedback-message",value:u,onChange:D=>c(D.target.value),placeholder:"Tell us what you were doing, what you expected, and what happened.",disabled:l,autoFocus:!0,maxLength:5e3})),ht.createElement(Rw,null,"We auto-attach your current story and project so we can reproduce it. No screenshots sent."),f&&ht.createElement(IR,null,f)),ht.createElement(Dw,null,ht.createElement(Rw,null,i?`Context: ${i}`:"No story selected"),ht.createElement("div",{style:{display:"flex",gap:"8px"}},ht.createElement(kn,{type:"button",onClick:E,disabled:l},"Cancel"),ht.createElement(Yt,{type:"submit",disabled:l||!u.trim()},l?"Sending\u2026":"Send")))))):null}Ce();je();ct();var ER=eo.div({display:"flex",alignItems:"center"}),Li=eo.div(({theme:e})=>({display:"flex",alignItems:"center",paddingLeft:"8px",borderLeft:`1px solid ${e.appBorderColor}`,"&:first-of-type":{paddingLeft:0,borderLeft:"none"}})),AR=eo.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.secondary,fontWeight:e.typography.weight.bold,paddingRight:"8px",opacity:.8})),PR=eo.div({position:"relative"}),LR=eo.button(({theme:e})=>({width:"26px",height:"26px",padding:0,background:`linear-gradient(135deg, ${e.color.secondary} 0%, ${e.color.secondary}cc 100%)`,border:"none",borderRadius:"50%",color:e.color.inverseText,cursor:"pointer",fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s","&:hover":{transform:"scale(1.05)",boxShadow:`0 2px 8px ${e.color.secondary}66`}})),_w=eo.button(({isLow:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",background:e?"#FEF3C7":"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",border:"none",borderRadius:"12px",color:e?"#92400E":"#fff",cursor:"pointer",fontSize:"12px",fontWeight:600,transition:"all 0.2s",minWidth:"60px",justifyContent:"center","&:hover":{transform:"scale(1.02)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})),MR=eo.span({display:"inline-block",width:"12px",height:"12px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"credit-spin 0.8s linear infinite","@keyframes credit-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}}),BR=eo.button(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 10px",height:"28px",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.mediumdark,fontSize:"12px",fontWeight:500,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.mediumdark}})),DR=eo.button({position:"fixed",bottom:"20px",right:"20px",width:"48px",height:"48px",borderRadius:"50%",backgroundColor:se,color:"white",border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",cursor:"pointer",boxShadow:`0 4px 14px ${se}66, 0 2px 4px rgba(0,0,0,0.1)`,transition:"all 0.2s ease",zIndex:9999,"&:hover":{transform:"scale(1.08)",boxShadow:`0 6px 20px ${se}88, 0 3px 6px rgba(0,0,0,0.15)`},"&:active":{transform:"scale(0.96)"}}),RR=30*1e3,_f=({onOpenSettings:e})=>{let[t,n]=Of(!1),[r,o]=Of(!1),[i,s]=Of(!1),{usageData:a,usageLastFetched:u,setUsageData:c,sessionToken:l}=we(),{userRole:d,roleOverride:g,featureFlags:p}=ce(),f=g??d;Ow(()=>{(async()=>{if(!(!l||u&&Date.now()-u<RR&&a)){s(!0);try{let $=V(),P=await ne(`${$}/api/addon/account`,{headers:{Authorization:`Bearer ${l}`}});if(P.ok){let z=await P.json();c(z)}}catch($){console.error("Failed to fetch balance:",$)}finally{s(!1)}}})()},[l,u,a,c]),Ow(()=>{let D=()=>{document.visibilityState==="visible"&&t&&n(!1)},R=()=>{t&&n(!1)};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",R),()=>{document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",R)}},[t]);let k=Nw(()=>{n(!0)},[]),T=Nw(()=>{n(!1)},[]),E=a?.creditBalance??0,I=E<2&&!i;return Zt.createElement(ER,null,e&&Zt.createElement(Li,null,Zt.createElement(BR,{onClick:e,title:"Settings"},Zt.createElement("span",{style:{fontSize:"14px"}},"\u2699"),"Settings")),l&&d==="admin"&&f==="admin"&&Zt.createElement(Li,null,Zt.createElement(Bw,null)),Zt.createElement(Li,null,Zt.createElement(AR,null,"v","0.5.17")),l&&p.showCosts&&Zt.createElement(Li,null,Zt.createElement(_w,{onClick:k,isLow:I,title:i?"Loading...":a?I?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},i?Zt.createElement(MR,null):a?`$${E.toFixed(2)}`:"...")),l&&!p.showCosts&&a&&Zt.createElement(Li,null,Zt.createElement(_w,{onClick:k,isLow:Math.floor(E)<=3,title:`${Math.floor(E)} review credits \u2014 click for details`},"\u26A1 ",Math.floor(E))),Zt.createElement(Li,null,Zt.createElement(PR,null,Zt.createElement(LR,{title:"Account & Usage",onClick:k},a?.email?a.email[0].toUpperCase():"?"),t&&Zt.createElement(Lw,{onClose:T}))),l&&Zt.createElement(DR,{onClick:()=>o(!0),title:"Send feedback","aria-label":"Send feedback"},"\u{1F4AC}"),Zt.createElement(zw,{isOpen:r,onClose:()=>o(!1)}))};import Lt,{useEffect as w4,useRef as v4}from"react";import{styled as gr}from"storybook/theming";import rt from"react";Ce();Oe();je();ct();Rn();import{useState as zR,useCallback as Mi,useRef as $w,useEffect as NR}from"react";var to=V();y.debug("[useAuth] Module loaded, APP_URL:",to);var js=()=>{let e=$w(null),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setSessionToken:c,setApiKey:l,setAuthMethod:d,setDeviceCode:g,setUserCode:p,setVerificationUri:f,setPollingInterval:k,setAuthError:T,resetAuth:E}=we(),I=$w(null),[D,R]=zR(!1),$=Mi(async()=>{try{y.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let C;try{C=await ne(`${to}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(A){let B=A instanceof Error&&A.message.includes("timed out")?`Cannot reach ${Ft.NAME} server at ${to}. Is the dashboard running?`:`Connection failed: ${to} is not responding.`;T(B),y.error("[useAuth]",B);return}if(!C.ok){let A=`Cannot reach ${Ft.NAME} server. Is the dashboard running?`;T(A),y.error("[useAuth]",A);return}let{poll_code:m}=await C.json();y.debug("[useAuth] Got poll_code:",m.substring(0,15)+"...");let F=localStorage.getItem("uicopilot_force_sign_in")==="true";F&&localStorage.removeItem("uicopilot_force_sign_in");let S=`${to}/addon/auth?poll_code=${m}${F?"&force_sign_in=true":""}`;R(!0),window.open(S,"uiparity-auth","width=520,height=620,left=300,top=150"),y.debug("[useAuth] Starting OAuth poll for token..."),I.current&&clearInterval(I.current);let b=async()=>{try{let L=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:m})})).json();L.status==="authorized"&&L.session_token?(y.debug("[useAuth] \u2705 OAuth poll successful! Got token."),I.current&&(clearInterval(I.current),I.current=null),localStorage.setItem("uicopilot_session_token",L.session_token),c(L.session_token),R(!1)):L.status==="expired"&&(y.debug("[useAuth] OAuth poll_code expired"),I.current&&(clearInterval(I.current),I.current=null),R(!1))}catch(A){y.error("[useAuth] OAuth poll error:",A)}};I.current=setInterval(b,2e3),setTimeout(b,1e3)}catch(C){y.error("[useAuth] OAuth flow error:",C),T(`Connection failed. Is the dashboard running at ${to}?`),R(!1)}},[c,T]),P=Mi(async()=>{try{let C=await fetch(`${to}/api/addon/auth/device`,{method:"POST"});if(!C.ok)throw new Error("Failed to start device code flow");let m=await C.json();g(m.device_code),p(m.user_code),f(m.verification_uri),window.open(m.verification_uri,"_blank"),z(m.device_code,m.interval*1e3)}catch(C){throw y.error("[useAuth] Device code flow error:",C),C}},[g,p,f]),z=Mi((C,m)=>{y.debug("[useAuth] Starting polling. Device code:",C,"Interval:",m),e.current&&clearInterval(e.current);let F=async()=>{try{let b=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:C})})).json();b.status==="authorized"?(y.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null),localStorage.setItem("uicopilot_session_token",b.session_token),c(b.session_token),setOauthUrl(null)):(b.status==="expired"||b.status==="denied")&&(y.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null))}catch(S){y.error("[useAuth] Polling error:",S)}};e.current=setInterval(F,m),k(m)},[g,p,f,c,k]),x=Mi(()=>{e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null),k(null)},[g,p,f,k]),w=Mi(C=>{l(C),c(C),localStorage.setItem("uicopilot_api_key",C)},[l,c]),v=Mi(()=>{E(),setOauthUrl(null),e.current&&(clearInterval(e.current),e.current=null),I.current&&(clearInterval(I.current),I.current=null)},[E]);return NR(()=>()=>{e.current&&clearInterval(e.current),I.current&&clearInterval(I.current)},[]),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,oauthPending:D,setAuthMethod:d,startOAuth:$,startDeviceCode:P,cancelDeviceCode:x,saveApiKey:w,logout:v}};Ce();Oe();je();ct();import{useCallback as Nl}from"react";var Hs=V(),no=()=>{let{projects:e,selectedProjectId:t,loadingProjects:n,setProjects:r,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:s}=Je(),{sessionToken:a}=we(),u=Nl(async()=>{if(!a){y.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),y.debug("[useProjects] Fetching from:",`${Hs}/api/projects`);let g=await ne(`${Hs}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}});if(g.ok){let p=await g.json();y.debug("[useProjects] Projects:",p.projects),r(p.projects||[])}else y.error("[useProjects] Failed to fetch projects:",g.status,g.statusText)}catch(g){y.error("[useProjects] Error fetching projects:",g)}finally{i(!1)}},[a,r,i]),c=Nl(async g=>{if(!a)throw new Error("Not authenticated");let p=await ne(`${Hs}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(g)});if(!p.ok)throw new Error("Failed to create project");let f=await p.json();return await u(),f.project},[a,u]),l=Nl(async(g,p)=>{if(!a)throw new Error("Not authenticated");let f={};if(p.name!==void 0&&(f.name=p.name),p.description!==void 0&&(f.description=p.description),p.figmaFileUrl!==void 0&&(f.figmaFileId=p.figmaFileUrl||void 0),!(await ne(`${Hs}/api/projects/${g}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(f)})).ok)throw new Error("Failed to update project");await u()},[a,u]),d=Nl(async g=>{if(!a)throw new Error("Not authenticated");if(!(await ne(`${Hs}/api/projects/${g}`,{method:"DELETE",headers:{Authorization:`Bearer ${a}`}})).ok)throw new Error("Failed to delete project");await u(),t===g&&o(null)},[a,t,u,o]);return{projects:e,selectedProjectId:t,selectedProject:s(),loadingProjects:n,setSelectedProjectId:o,fetchProjects:u,createProject:c,updateProject:l,deleteProject:d}};Ce();var Ws=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d}=nt();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d,openComponentBrowser:()=>s(!0),closeComponentBrowser:()=>s(!1)}};Ce();Wf();Xf();import{useCallback as Js,useRef as Yl}from"react";Oe();function jl(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){y.warn("[iframeReload] No preview iframe found"),e();return}let n=t.contentWindow.location.href,r=new URL(n);r.searchParams.set("_cb",Date.now().toString());let o=r.toString();y.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{y.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",s),e()},5e3),s=()=>{clearTimeout(i),t.removeEventListener("load",s),y.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{y.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",s),t.contentWindow.location.href=o})}var Hl=BigInt(4294967295),rv=BigInt(32);function iz(e,t=!1){return t?{h:Number(e&Hl),l:Number(e>>rv&Hl)}:{h:Number(e>>rv&Hl)|0,l:Number(e&Hl)|0}}function ov(e,t=!1){let n=e.length,r=new Uint32Array(n),o=new Uint32Array(n);for(let i=0;i<n;i++){let{h:s,l:a}=iz(e[i],t);[r[i],o[i]]=[s,a]}return[r,o]}var iv=(e,t,n)=>e<<n|t>>>32-n,sv=(e,t,n)=>t<<n|e>>>32-n,av=(e,t,n)=>t<<n-32|e>>>64-n,lv=(e,t,n)=>e<<n-32|t>>>64-n;function sz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Qf(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Wl(e,t,n=""){let r=sz(e),o=e?.length,i=t!==void 0;if(!r||i&&o!==t){let s=n&&`"${n}" `,a=i?` of length ${t}`:"",u=r?`length=${o}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function Jf(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function cv(e,t){Wl(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function uv(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Zf(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var az=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function lz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function cz(e){for(let t=0;t<e.length;t++)e[t]=lz(e[t]);return e}var em=az?e=>e:cz;function pv(e,t={}){let n=(o,i)=>e(i).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}var dv=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var uz=BigInt(0),Ys=BigInt(1),pz=BigInt(2),dz=BigInt(7),gz=BigInt(256),fz=BigInt(113),mv=[],hv=[],xv=[];for(let e=0,t=Ys,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],mv.push(2*(5*r+n)),hv.push((e+1)*(e+2)/2%64);let o=uz;for(let i=0;i<7;i++)t=(t<<Ys^(t>>dz)*fz)%gz,t&pz&&(o^=Ys<<(Ys<<BigInt(i))-Ys);xv.push(o)}var yv=ov(xv,!0),mz=yv[0],hz=yv[1],gv=(e,t,n)=>n>32?av(e,t,n):iv(e,t,n),fv=(e,t,n)=>n>32?lv(e,t,n):sv(e,t,n);function xz(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,c=n[u],l=n[u+1],d=gv(c,l,1)^n[a],g=fv(c,l,1)^n[a+1];for(let p=0;p<50;p+=10)e[s+p]^=d,e[s+p+1]^=g}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=hv[s],u=gv(o,i,a),c=fv(o,i,a),l=mv[s];o=e[l],i=e[l+1],e[l]=u,e[l+1]=c}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=mz[r],e[1]^=hz[r]}Zf(n)}var tm=class e{constructor(t,n,r,o=!1,i=24){or(this,"state");or(this,"pos",0);or(this,"posOut",0);or(this,"finished",!1);or(this,"state32");or(this,"destroyed",!1);or(this,"blockLen");or(this,"suffix");or(this,"outputLen");or(this,"enableXOF",!1);or(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,Qf(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=uv(this.state)}clone(){return this._cloneInto()}keccak(){em(this.state32),xz(this.state32,this.rounds),em(this.state32),this.posOut=0,this.pos=0}update(t){Jf(this),Wl(t);let{blockLen:n,state:r}=this,o=t.length;for(let i=0;i<o;){let s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Jf(this,!1),Wl(t),this.finish();let n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qf(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(cv(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Zf(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},yz=(e,t,n,r={})=>pv(()=>new tm(t,e,n),r);var bv=yz(6,72,64,dv(10));var bz=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,nm=Math.ceil,ur=Math.floor,On="[BigNumber Error] ",Sv=On+"Number primitive has more than 15 significant digits: ",Tr=1e14,Ve=14,rm=9007199254740991,om=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Io=1e7,an=1e9;function wv(e){var t,n,r,o=I.prototype={constructor:I,toString:null,valueOf:null},i=new I(1),s=20,a=4,u=-7,c=21,l=-1e7,d=1e7,g=!1,p=1,f=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function I(x,w){var v,C,m,F,S,b,A,L,B=this;if(!(B instanceof I))return new I(x,w);if(w==null){if(x&&x._isBigNumber===!0){B.s=x.s,!x.c||x.e>d?B.c=B.e=null:x.e<l?B.c=[B.e=0]:(B.e=x.e,B.c=x.c.slice());return}if((b=typeof x=="number")&&x*0==0){if(B.s=1/x<0?(x=-x,-1):1,x===~~x){for(F=0,S=x;S>=10;S/=10,F++);F>d?B.c=B.e=null:(B.e=F,B.c=[x]);return}L=String(x)}else{if(!bz.test(L=String(x)))return r(B,L,b);B.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(F=L.indexOf("."))>-1&&(L=L.replace(".","")),(S=L.search(/e/i))>0?(F<0&&(F=S),F+=+L.slice(S+1),L=L.substring(0,S)):F<0&&(F=L.length)}else{if(zt(w,2,T.length,"Base"),w==10&&E)return B=new I(x),P(B,s+B.e+1,a);if(L=String(x),b=typeof x=="number"){if(x*0!=0)return r(B,L,b,w);if(B.s=1/x<0?(L=L.slice(1),-1):1,I.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(Sv+x)}else B.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(v=T.slice(0,w),F=S=0,A=L.length;S<A;S++)if(v.indexOf(C=L.charAt(S))<0){if(C=="."){if(S>F){F=A;continue}}else if(!m&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){m=!0,S=-1,F=0;continue}return r(B,String(x),b,w)}b=!1,L=n(L,w,10,B.s),(F=L.indexOf("."))>-1?L=L.replace(".",""):F=L.length}for(S=0;L.charCodeAt(S)===48;S++);for(A=L.length;L.charCodeAt(--A)===48;);if(L=L.slice(S,++A)){if(A-=S,b&&I.DEBUG&&A>15&&(x>rm||x!==ur(x)))throw Error(Sv+B.s*x);if((F=F-S-1)>d)B.c=B.e=null;else if(F<l)B.c=[B.e=0];else{if(B.e=F,B.c=[],S=(F+1)%Ve,F<0&&(S+=Ve),S<A){for(S&&B.c.push(+L.slice(0,S)),A-=Ve;S<A;)B.c.push(+L.slice(S,S+=Ve));S=Ve-(L=L.slice(S)).length}else S-=A;for(;S--;L+="0");B.c.push(+L)}}else B.c=[B.e=0]}I.clone=wv,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(x){var w,v;if(x!=null)if(typeof x=="object"){if(x.hasOwnProperty(w="DECIMAL_PLACES")&&(v=x[w],zt(v,0,an,w),s=v),x.hasOwnProperty(w="ROUNDING_MODE")&&(v=x[w],zt(v,0,8,w),a=v),x.hasOwnProperty(w="EXPONENTIAL_AT")&&(v=x[w],v&&v.pop?(zt(v[0],-an,0,w),zt(v[1],0,an,w),u=v[0],c=v[1]):(zt(v,-an,an,w),u=-(c=v<0?-v:v))),x.hasOwnProperty(w="RANGE"))if(v=x[w],v&&v.pop)zt(v[0],-an,-1,w),zt(v[1],1,an,w),l=v[0],d=v[1];else if(zt(v,-an,an,w),v)l=-(d=v<0?-v:v);else throw Error(On+w+" cannot be zero: "+v);if(x.hasOwnProperty(w="CRYPTO"))if(v=x[w],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))g=v;else throw g=!v,Error(On+"crypto unavailable");else g=v;else throw Error(On+w+" not true or false: "+v);if(x.hasOwnProperty(w="MODULO_MODE")&&(v=x[w],zt(v,0,9,w),p=v),x.hasOwnProperty(w="POW_PRECISION")&&(v=x[w],zt(v,0,an,w),f=v),x.hasOwnProperty(w="FORMAT"))if(v=x[w],typeof v=="object")k=v;else throw Error(On+w+" not an object: "+v);if(x.hasOwnProperty(w="ALPHABET"))if(v=x[w],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))E=v.slice(0,10)=="0123456789",T=v;else throw Error(On+w+" invalid: "+v)}else throw Error(On+"Object expected: "+x);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,c],RANGE:[l,d],CRYPTO:g,MODULO_MODE:p,POW_PRECISION:f,FORMAT:k,ALPHABET:T}},I.isBigNumber=function(x){if(!x||x._isBigNumber!==!0)return!1;if(!I.DEBUG)return!0;var w,v,C=x.c,m=x.e,F=x.s;e:if({}.toString.call(C)=="[object Array]"){if((F===1||F===-1)&&m>=-an&&m<=an&&m===ur(m)){if(C[0]===0){if(m===0&&C.length===1)return!0;break e}if(w=(m+1)%Ve,w<1&&(w+=Ve),String(C[0]).length==w){for(w=0;w<C.length;w++)if(v=C[w],v<0||v>=Tr||v!==ur(v))break e;if(v!==0)return!0}}}else if(C===null&&m===null&&(F===null||F===1||F===-1))return!0;throw Error(On+"Invalid BigNumber: "+x)},I.maximum=I.max=function(){return R(arguments,-1)},I.minimum=I.min=function(){return R(arguments,1)},I.random=(function(){var x=9007199254740992,w=Math.random()*x&2097151?function(){return ur(Math.random()*x)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,m,F,S,b,A=0,L=[],B=new I(i);if(v==null?v=s:zt(v,0,an),S=nm(v/Ve),g)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(S*=2));A<S;)b=C[A]*131072+(C[A+1]>>>11),b>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),C[A]=m[0],C[A+1]=m[1]):(L.push(b%1e14),A+=2);A=S/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(S*=7);A<S;)b=(C[A]&31)*281474976710656+C[A+1]*1099511627776+C[A+2]*4294967296+C[A+3]*16777216+(C[A+4]<<16)+(C[A+5]<<8)+C[A+6],b>=9e15?crypto.randomBytes(7).copy(C,A):(L.push(b%1e14),A+=7);A=S/7}else throw g=!1,Error(On+"crypto unavailable");if(!g)for(;A<S;)b=w(),b<9e15&&(L[A++]=b%1e14);for(S=L[--A],v%=Ve,S&&v&&(b=om[Ve-v],L[A]=ur(S/b)*b);L[A]===0;L.pop(),A--);if(A<0)L=[F=0];else{for(F=-1;L[0]===0;L.splice(0,1),F-=Ve);for(A=1,b=L[0];b>=10;b/=10,A++);A<Ve&&(F-=Ve-A)}return B.e=F,B.c=L,B}})(),I.sum=function(){for(var x=1,w=arguments,v=new I(w[0]);x<w.length;)v=v.plus(w[x++]);return v},n=(function(){var x="0123456789";function w(v,C,m,F){for(var S,b=[0],A,L=0,B=v.length;L<B;){for(A=b.length;A--;b[A]*=C);for(b[0]+=F.indexOf(v.charAt(L++)),S=0;S<b.length;S++)b[S]>m-1&&(b[S+1]==null&&(b[S+1]=0),b[S+1]+=b[S]/m|0,b[S]%=m)}return b.reverse()}return function(v,C,m,F,S){var b,A,L,B,N,h,j,W,M=v.indexOf("."),K=s,ee=a;for(M>=0&&(B=f,f=0,v=v.replace(".",""),W=new I(C),h=W.pow(v.length-M),f=B,W.c=w(ro(cr(h.c),h.e,"0"),10,m,x),W.e=W.c.length),j=w(v,C,m,S?(b=T,x):(b=x,T)),L=B=j.length;j[--B]==0;j.pop());if(!j[0])return b.charAt(0);if(M<0?--L:(h.c=j,h.e=L,h.s=F,h=t(h,W,K,ee,m),j=h.c,N=h.r,L=h.e),A=L+K+1,M=j[A],B=m/2,N=N||A<0||j[A+1]!=null,N=ee<4?(M!=null||N)&&(ee==0||ee==(h.s<0?3:2)):M>B||M==B&&(ee==4||N||ee==6&&j[A-1]&1||ee==(h.s<0?8:7)),A<1||!j[0])v=N?ro(b.charAt(1),-K,b.charAt(0)):b.charAt(0);else{if(j.length=A,N)for(--m;++j[--A]>m;)j[A]=0,A||(++L,j=[1].concat(j));for(B=j.length;!j[--B];);for(M=0,v="";M<=B;v+=b.charAt(j[M++]));v=ro(v,L,b.charAt(0))}return v}})(),t=(function(){function x(C,m,F){var S,b,A,L,B=0,N=C.length,h=m%Io,j=m/Io|0;for(C=C.slice();N--;)A=C[N]%Io,L=C[N]/Io|0,S=j*A+L*h,b=h*A+S%Io*Io+B,B=(b/F|0)+(S/Io|0)+j*L,C[N]=b%F;return B&&(C=[B].concat(C)),C}function w(C,m,F,S){var b,A;if(F!=S)A=F>S?1:-1;else for(b=A=0;b<F;b++)if(C[b]!=m[b]){A=C[b]>m[b]?1:-1;break}return A}function v(C,m,F,S){for(var b=0;F--;)C[F]-=b,b=C[F]<m[F]?1:0,C[F]=b*S+C[F]-m[F];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,m,F,S,b){var A,L,B,N,h,j,W,M,K,ee,ge,xe,ae,Ke,be,Te,te,Me=C.s==m.s?1:-1,Ae=C.c,pe=m.c;if(!Ae||!Ae[0]||!pe||!pe[0])return new I(!C.s||!m.s||(Ae?pe&&Ae[0]==pe[0]:!pe)?NaN:Ae&&Ae[0]==0||!pe?Me*0:Me/0);for(M=new I(Me),K=M.c=[],L=C.e-m.e,Me=F+L+1,b||(b=Tr,L=pr(C.e/Ve)-pr(m.e/Ve),Me=Me/Ve|0),B=0;pe[B]==(Ae[B]||0);B++);if(pe[B]>(Ae[B]||0)&&L--,Me<0)K.push(1),N=!0;else{for(Ke=Ae.length,Te=pe.length,B=0,Me+=2,h=ur(b/(pe[0]+1)),h>1&&(pe=x(pe,h,b),Ae=x(Ae,h,b),Te=pe.length,Ke=Ae.length),ae=Te,ee=Ae.slice(0,Te),ge=ee.length;ge<Te;ee[ge++]=0);te=pe.slice(),te=[0].concat(te),be=pe[0],pe[1]>=b/2&&be++;do{if(h=0,A=w(pe,ee,Te,ge),A<0){if(xe=ee[0],Te!=ge&&(xe=xe*b+(ee[1]||0)),h=ur(xe/be),h>1)for(h>=b&&(h=b-1),j=x(pe,h,b),W=j.length,ge=ee.length;w(j,ee,W,ge)==1;)h--,v(j,Te<W?te:pe,W,b),W=j.length,A=1;else h==0&&(A=h=1),j=pe.slice(),W=j.length;if(W<ge&&(j=[0].concat(j)),v(ee,j,ge,b),ge=ee.length,A==-1)for(;w(pe,ee,Te,ge)<1;)h++,v(ee,Te<ge?te:pe,ge,b),ge=ee.length}else A===0&&(h++,ee=[0]);K[B++]=h,ee[0]?ee[ge++]=Ae[ae]||0:(ee=[Ae[ae]],ge=1)}while((ae++<Ke||ee[0]!=null)&&Me--);N=ee[0]!=null,K[0]||K.splice(0,1)}if(b==Tr){for(B=1,Me=K[0];Me>=10;Me/=10,B++);P(M,F+(M.e=B+L*Ve-1)+1,S,N)}else M.e=L,M.r=+N;return M}})();function D(x,w,v,C){var m,F,S,b,A;if(v==null?v=a:zt(v,0,8),!x.c)return x.toString();if(m=x.c[0],S=x.e,w==null)A=cr(x.c),A=C==1||C==2&&(S<=u||S>=c)?Gl(A,S):ro(A,S,"0");else if(x=P(new I(x),w,v),F=x.e,A=cr(x.c),b=A.length,C==1||C==2&&(w<=F||F<=u)){for(;b<w;A+="0",b++);A=Gl(A,F)}else if(w-=S+(C===2&&F>S),A=ro(A,F,"0"),F+1>b){if(--w>0)for(A+=".";w--;A+="0");}else if(w+=F-b,w>0)for(F+1==b&&(A+=".");w--;A+="0");return x.s<0&&m?"-"+A:A}function R(x,w){for(var v,C,m=1,F=new I(x[0]);m<x.length;m++)C=new I(x[m]),(!C.s||(v=ti(F,C))===w||v===0&&F.s===w)&&(F=C);return F}function $(x,w,v){for(var C=1,m=w.length;!w[--m];w.pop());for(m=w[0];m>=10;m/=10,C++);return(v=C+v*Ve-1)>d?x.c=x.e=null:v<l?x.c=[x.e=0]:(x.e=v,x.c=w),x}r=(function(){var x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,S,b,A){var L,B=b?S:S.replace(m,"");if(C.test(B))F.s=isNaN(B)?null:B<0?-1:1;else{if(!b&&(B=B.replace(x,function(N,h,j){return L=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!A||A==L?h:N}),A&&(L=A,B=B.replace(w,"$1").replace(v,"0.$1")),S!=B))return new I(B,L);if(I.DEBUG)throw Error(On+"Not a"+(A?" base "+A:"")+" number: "+S);F.s=null}F.c=F.e=null}})();function P(x,w,v,C){var m,F,S,b,A,L,B,N=x.c,h=om;if(N){e:{for(m=1,b=N[0];b>=10;b/=10,m++);if(F=w-m,F<0)F+=Ve,S=w,A=N[L=0],B=ur(A/h[m-S-1]%10);else if(L=nm((F+1)/Ve),L>=N.length)if(C){for(;N.length<=L;N.push(0));A=B=0,m=1,F%=Ve,S=F-Ve+1}else break e;else{for(A=b=N[L],m=1;b>=10;b/=10,m++);F%=Ve,S=F-Ve+m,B=S<0?0:ur(A/h[m-S-1]%10)}if(C=C||w<0||N[L+1]!=null||(S<0?A:A%h[m-S-1]),C=v<4?(B||C)&&(v==0||v==(x.s<0?3:2)):B>5||B==5&&(v==4||C||v==6&&(F>0?S>0?A/h[m-S]:0:N[L-1])%10&1||v==(x.s<0?8:7)),w<1||!N[0])return N.length=0,C?(w-=x.e+1,N[0]=h[(Ve-w%Ve)%Ve],x.e=-w||0):N[0]=x.e=0,x;if(F==0?(N.length=L,b=1,L--):(N.length=L+1,b=h[Ve-F],N[L]=S>0?ur(A/h[m-S]%h[S])*b:0),C)for(;;)if(L==0){for(F=1,S=N[0];S>=10;S/=10,F++);for(S=N[0]+=b,b=1;S>=10;S/=10,b++);F!=b&&(x.e++,N[0]==Tr&&(N[0]=1));break}else{if(N[L]+=b,N[L]!=Tr)break;N[L--]=0,b=1}for(F=N.length;N[--F]===0;N.pop());}x.e>d?x.c=x.e=null:x.e<l&&(x.c=[x.e=0])}return x}function z(x){var w,v=x.e;return v===null?x.toString():(w=cr(x.c),w=v<=u||v>=c?Gl(w,v):ro(w,v,"0"),x.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var x=new I(this);return x.s<0&&(x.s=1),x},o.comparedTo=function(x,w){return ti(this,new I(x,w))},o.decimalPlaces=o.dp=function(x,w){var v,C,m,F=this;if(x!=null)return zt(x,0,an),w==null?w=a:zt(w,0,8),P(new I(F),x+F.e+1,w);if(!(v=F.c))return null;if(C=((m=v.length-1)-pr(this.e/Ve))*Ve,m=v[m])for(;m%10==0;m/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(x,w){return t(this,new I(x,w),s,a)},o.dividedToIntegerBy=o.idiv=function(x,w){return t(this,new I(x,w),0,1)},o.exponentiatedBy=o.pow=function(x,w){var v,C,m,F,S,b,A,L,B,N=this;if(x=new I(x),x.c&&!x.isInteger())throw Error(On+"Exponent not an integer: "+z(x));if(w!=null&&(w=new I(w)),b=x.e>14,!N.c||!N.c[0]||N.c[0]==1&&!N.e&&N.c.length==1||!x.c||!x.c[0])return B=new I(Math.pow(+z(N),b?x.s*(2-Vl(x)):+z(x))),w?B.mod(w):B;if(A=x.s<0,w){if(w.c?!w.c[0]:!w.s)return new I(NaN);C=!A&&N.isInteger()&&w.isInteger(),C&&(N=N.mod(w))}else{if(x.e>9&&(N.e>0||N.e<-1||(N.e==0?N.c[0]>1||b&&N.c[1]>=24e7:N.c[0]<8e13||b&&N.c[0]<=9999975e7)))return F=N.s<0&&Vl(x)?-0:0,N.e>-1&&(F=1/F),new I(A?1/F:F);f&&(F=nm(f/Ve+2))}for(b?(v=new I(.5),A&&(x.s=1),L=Vl(x)):(m=Math.abs(+z(x)),L=m%2),B=new I(i);;){if(L){if(B=B.times(N),!B.c)break;F?B.c.length>F&&(B.c.length=F):C&&(B=B.mod(w))}if(m){if(m=ur(m/2),m===0)break;L=m%2}else if(x=x.times(v),P(x,x.e+1,1),x.e>14)L=Vl(x);else{if(m=+z(x),m===0)break;L=m%2}N=N.times(N),F?N.c&&N.c.length>F&&(N.c.length=F):C&&(N=N.mod(w))}return C?B:(A&&(B=i.div(B)),w?B.mod(w):F?P(B,f,a,S):B)},o.integerValue=function(x){var w=new I(this);return x==null?x=a:zt(x,0,8),P(w,w.e+1,x)},o.isEqualTo=o.eq=function(x,w){return ti(this,new I(x,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(x,w){return ti(this,new I(x,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(x,w){return(w=ti(this,new I(x,w)))===1||w===0},o.isInteger=function(){return!!this.c&&pr(this.e/Ve)>this.c.length-2},o.isLessThan=o.lt=function(x,w){return ti(this,new I(x,w))<0},o.isLessThanOrEqualTo=o.lte=function(x,w){return(w=ti(this,new I(x,w)))===-1||w===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(x,w){var v,C,m,F,S=this,b=S.s;if(x=new I(x,w),w=x.s,!b||!w)return new I(NaN);if(b!=w)return x.s=-w,S.plus(x);var A=S.e/Ve,L=x.e/Ve,B=S.c,N=x.c;if(!A||!L){if(!B||!N)return B?(x.s=-w,x):new I(N?S:NaN);if(!B[0]||!N[0])return N[0]?(x.s=-w,x):new I(B[0]?S:a==3?-0:0)}if(A=pr(A),L=pr(L),B=B.slice(),b=A-L){for((F=b<0)?(b=-b,m=B):(L=A,m=N),m.reverse(),w=b;w--;m.push(0));m.reverse()}else for(C=(F=(b=B.length)<(w=N.length))?b:w,b=w=0;w<C;w++)if(B[w]!=N[w]){F=B[w]<N[w];break}if(F&&(m=B,B=N,N=m,x.s=-x.s),w=(C=N.length)-(v=B.length),w>0)for(;w--;B[v++]=0);for(w=Tr-1;C>b;){if(B[--C]<N[C]){for(v=C;v&&!B[--v];B[v]=w);--B[v],B[C]+=Tr}B[C]-=N[C]}for(;B[0]==0;B.splice(0,1),--L);return B[0]?$(x,B,L):(x.s=a==3?-1:1,x.c=[x.e=0],x)},o.modulo=o.mod=function(x,w){var v,C,m=this;return x=new I(x,w),!m.c||!x.s||x.c&&!x.c[0]?new I(NaN):!x.c||m.c&&!m.c[0]?new I(m):(p==9?(C=x.s,x.s=1,v=t(m,x,0,3),x.s=C,v.s*=C):v=t(m,x,0,p),x=m.minus(v.times(x)),!x.c[0]&&p==1&&(x.s=m.s),x)},o.multipliedBy=o.times=function(x,w){var v,C,m,F,S,b,A,L,B,N,h,j,W,M,K,ee=this,ge=ee.c,xe=(x=new I(x,w)).c;if(!ge||!xe||!ge[0]||!xe[0])return!ee.s||!x.s||ge&&!ge[0]&&!xe||xe&&!xe[0]&&!ge?x.c=x.e=x.s=null:(x.s*=ee.s,!ge||!xe?x.c=x.e=null:(x.c=[0],x.e=0)),x;for(C=pr(ee.e/Ve)+pr(x.e/Ve),x.s*=ee.s,A=ge.length,N=xe.length,A<N&&(W=ge,ge=xe,xe=W,m=A,A=N,N=m),m=A+N,W=[];m--;W.push(0));for(M=Tr,K=Io,m=N;--m>=0;){for(v=0,h=xe[m]%K,j=xe[m]/K|0,S=A,F=m+S;F>m;)L=ge[--S]%K,B=ge[S]/K|0,b=j*L+B*h,L=h*L+b%K*K+W[F]+v,v=(L/M|0)+(b/K|0)+j*B,W[F--]=L%M;W[F]=v}return v?++C:W.splice(0,1),$(x,W,C)},o.negated=function(){var x=new I(this);return x.s=-x.s||null,x},o.plus=function(x,w){var v,C=this,m=C.s;if(x=new I(x,w),w=x.s,!m||!w)return new I(NaN);if(m!=w)return x.s=-w,C.minus(x);var F=C.e/Ve,S=x.e/Ve,b=C.c,A=x.c;if(!F||!S){if(!b||!A)return new I(m/0);if(!b[0]||!A[0])return A[0]?x:new I(b[0]?C:m*0)}if(F=pr(F),S=pr(S),b=b.slice(),m=F-S){for(m>0?(S=F,v=A):(m=-m,v=b),v.reverse();m--;v.push(0));v.reverse()}for(m=b.length,w=A.length,m-w<0&&(v=A,A=b,b=v,w=m),m=0;w;)m=(b[--w]=b[w]+A[w]+m)/Tr|0,b[w]=Tr===b[w]?0:b[w]%Tr;return m&&(b=[m].concat(b),++S),$(x,b,S)},o.precision=o.sd=function(x,w){var v,C,m,F=this;if(x!=null&&x!==!!x)return zt(x,1,an),w==null?w=a:zt(w,0,8),P(new I(F),x,w);if(!(v=F.c))return null;if(m=v.length-1,C=m*Ve+1,m=v[m]){for(;m%10==0;m/=10,C--);for(m=v[0];m>=10;m/=10,C++);}return x&&F.e+1>C&&(C=F.e+1),C},o.shiftedBy=function(x){return zt(x,-rm,rm),this.times("1e"+x)},o.squareRoot=o.sqrt=function(){var x,w,v,C,m,F=this,S=F.c,b=F.s,A=F.e,L=s+4,B=new I("0.5");if(b!==1||!S||!S[0])return new I(!b||b<0&&(!S||S[0])?NaN:S?F:1/0);if(b=Math.sqrt(+z(F)),b==0||b==1/0?(w=cr(S),(w.length+A)%2==0&&(w+="0"),b=Math.sqrt(+w),A=pr((A+1)/2)-(A<0||A%2),b==1/0?w="5e"+A:(w=b.toExponential(),w=w.slice(0,w.indexOf("e")+1)+A),v=new I(w)):v=new I(b+""),v.c[0]){for(A=v.e,b=A+L,b<3&&(b=0);;)if(m=v,v=B.times(m.plus(t(F,m,L,1))),cr(m.c).slice(0,b)===(w=cr(v.c)).slice(0,b))if(v.e<A&&--b,w=w.slice(b-3,b+1),w=="9999"||!C&&w=="4999"){if(!C&&(P(m,m.e+s+2,0),m.times(m).eq(F))){v=m;break}L+=4,b+=4,C=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(P(v,v.e+s+2,1),x=!v.times(v).eq(F));break}}return P(v,v.e+s+1,a,x)},o.toExponential=function(x,w){return x!=null&&(zt(x,0,an),x++),D(this,x,w,1)},o.toFixed=function(x,w){return x!=null&&(zt(x,0,an),x=x+this.e+1),D(this,x,w)},o.toFormat=function(x,w,v){var C,m=this;if(v==null)x!=null&&w&&typeof w=="object"?(v=w,w=null):x&&typeof x=="object"?(v=x,x=w=null):v=k;else if(typeof v!="object")throw Error(On+"Argument not an object: "+v);if(C=m.toFixed(x,w),m.c){var F,S=C.split("."),b=+v.groupSize,A=+v.secondaryGroupSize,L=v.groupSeparator||"",B=S[0],N=S[1],h=m.s<0,j=h?B.slice(1):B,W=j.length;if(A&&(F=b,b=A,A=F,W-=F),b>0&&W>0){for(F=W%b||b,B=j.substr(0,F);F<W;F+=b)B+=L+j.substr(F,b);A>0&&(B+=L+j.slice(F)),h&&(B="-"+B)}C=N?B+(v.decimalSeparator||"")+((A=+v.fractionGroupSize)?N.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):N):B}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(x){var w,v,C,m,F,S,b,A,L,B,N,h,j=this,W=j.c;if(x!=null&&(b=new I(x),!b.isInteger()&&(b.c||b.s!==1)||b.lt(i)))throw Error(On+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+z(b));if(!W)return new I(j);for(w=new I(i),L=v=new I(i),C=A=new I(i),h=cr(W),F=w.e=h.length-j.e-1,w.c[0]=om[(S=F%Ve)<0?Ve+S:S],x=!x||b.comparedTo(w)>0?F>0?w:L:b,S=d,d=1/0,b=new I(h),A.c[0]=0;B=t(b,w,0,1),m=v.plus(B.times(C)),m.comparedTo(x)!=1;)v=C,C=m,L=A.plus(B.times(m=L)),A=m,w=b.minus(B.times(m=w)),b=m;return m=t(x.minus(v),C,0,1),A=A.plus(m.times(L)),v=v.plus(m.times(C)),A.s=L.s=j.s,F=F*2,N=t(L,C,F,a).minus(j).abs().comparedTo(t(A,v,F,a).minus(j).abs())<1?[L,C]:[A,v],d=S,N},o.toNumber=function(){return+z(this)},o.toPrecision=function(x,w){return x!=null&&zt(x,1,an),D(this,x,w,2)},o.toString=function(x){var w,v=this,C=v.s,m=v.e;return m===null?C?(w="Infinity",C<0&&(w="-"+w)):w="NaN":(x==null?w=m<=u||m>=c?Gl(cr(v.c),m):ro(cr(v.c),m,"0"):x===10&&E?(v=P(new I(v),s+m+1,a),w=ro(cr(v.c),v.e,"0")):(zt(x,2,T.length,"Base"),w=n(ro(cr(v.c),m,"0"),10,x,C,!0)),C<0&&v.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return z(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&I.set(e),I}function pr(e){var t=e|0;return e>0||e===t?t:t-1}function cr(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Ve-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function ti(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=u==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return u>c^n?1:-1;for(a=(u=o.length)<(c=i.length)?u:c,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function zt(e,t,n,r){if(e<t||e>n||e!==ur(e))throw Error(On+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Vl(e){var t=e.c.length-1;return pr(e.e/Ve)==t&&e.c[t]%2!=0}function Gl(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ro(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Sz=wv(),vv=Sz;var wz=24,Ks=32,vz=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"?()=>{let e=new Uint32Array(1);return globalThis.crypto.getRandomValues(e),e[0]/4294967296}:Math.random,sm=vz(),im=(e=4,t=sm)=>{let n="";for(;n.length<e;)n=n+Math.floor(t()*36).toString(36);return n};function kz(e){let t=new vv(0);for(let n of e.values())t=t.multipliedBy(256).plus(n);return t}var Cv=(e="")=>{let t=new TextEncoder;return kz(bv(t.encode(e))).toString(36).slice(1)},kv=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),Cz=e=>kv[Math.floor(e()*kv.length)],Tz=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=sm}={})=>{let n=Object.keys(e).toString(),r=n.length?n+im(Ks,t):im(Ks,t);return Cv(r).substring(0,Ks)},Iz=e=>()=>e++,Fz=476782367,Tv=({random:e=sm,counter:t=Iz(Math.floor(e()*Fz)),length:n=wz,fingerprint:r=Tz({random:e})}={})=>{if(n>Ks)throw new Error(`Length must be between 2 and ${Ks}. Received: ${n}`);return function(){let i=Cz(e),s=Date.now().toString(36),a=t().toString(36),u=im(n,e),c=`${s+u+a+r}`;return`${i+Cv(c).substring(1,n)}`}},Fo=Ez(Tv);function Ez(e){let t;return()=>(t||(t=e()),t())}var Lz=Ua(Ev());Rn();Oe();var ql=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function Mz(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function am(e,t){let n=[],r=e.split(`
15
15
  `);for(let s=0;s<r.length;s++){let a=Mz(r[s]),u=ql.exec(a);if(u){let[,c,l,,d]=u,g=Bz(l),p=Dz(r,s+1),f={id:Fo(),reviewId:t,type:c.trim(),severity:g,title:d.trim(),description:p.description,file:p.file,lineNumber:p.lineNumber,property:p.property,currentValue:p.currentValue,suggestedValue:p.suggestedValue,suggestedCode:p.suggestedCode,suggestedFix:p.suggestedFix,fixTarget:p.fixTarget,fixRequired:p.fixRequired,status:"pending",selectedForFix:!1,createdAt:new Date};n.push(f)}ql.lastIndex=0}return n.map(s=>{let a=_s(s);return a.dismissed?(y.debug(`[parseIssues] Auto-dismissed: ${s.title} - ${a.dismissReason}`),{...s,dismissed:!0,dismissReason:a.dismissReason,dismissedBy:a.dismissedBy,dismissedAt:new Date}):s})}function Bz(e){let t=e.toLowerCase().trim();return t.includes("critical")||t.includes("high")?"critical":t.includes("major")||t.includes("medium")?"major":"minor"}function Dz(e,t){let n={description:"",file:void 0,lineNumber:void 0,property:void 0,currentValue:void 0,suggestedValue:void 0,suggestedCode:void 0,suggestedFix:void 0,fixTarget:void 0,fixRequired:void 0},r=[];for(let o=t;o<e.length;o++){let i=e[o].trim();if(!i||ql.test(i)){ql.lastIndex=0;break}if(i.startsWith("Expected:"))n.suggestedValue=i.replace("Expected:","").trim();else if(i.startsWith("Actual:")||i.startsWith("Current:"))n.currentValue=i.replace(/^(Actual|Current):/,"").trim();else if(i.startsWith("File:")){let s=i.replace("File:","").trim(),a=s.match(/^(.+?):(\d+)$/);a?(n.file=a[1],n.lineNumber=parseInt(a[2],10)):n.file=s}else if(i.startsWith("Property:"))n.property=i.replace("Property:","").trim();else if(i.startsWith("FixTarget:")){let s=i.replace("FixTarget:","").trim().toLowerCase();(s==="css"||s==="component")&&(n.fixTarget=s)}else if(i.startsWith("FixRequired:")){let s=i.replace("FixRequired:","").trim().toLowerCase();n.fixRequired=s==="true"}else if(i.startsWith("Fix:"))n.suggestedFix=i.replace("Fix:","").trim();else if(i.startsWith("```")){let s=[];for(o++;o<e.length&&!e[o].trim().startsWith("```");)s.push(e[o]),o++;n.suggestedCode=s.join(`
16
16
  `)}else r.push(i)}return n.description=r.join(" ").trim(),n}Oe();var Xs=null,Av=0,Rz=3e4;async function zz(){let e=Date.now();if(Xs&&e-Av<Rz)return Xs;try{let t=await fetch("/index.json");if(!t.ok)throw new Error(`Failed to fetch index.json: ${t.status}`);let n=await t.json();return Xs=n.entries||n.stories||{},Av=e,y.debug("[storyFilePaths] Fetched index.json, entries:",Object.keys(Xs).length),Xs}catch(t){throw y.error("[storyFilePaths] Error fetching index.json:",t),t}}async function Qs(e){try{let n=(await zz())[e];if(!n?.importPath)return y.warn("[storyFilePaths] No importPath found for story:",e),null;let r=n.importPath;y.debug("[storyFilePaths] Found importPath:",r);let o=r.replace(/^\.\//,""),i;n.componentPath?(i=n.componentPath.replace(/^\.\//,""),y.debug("[storyFilePaths] Using Storybook componentPath:",i)):(i=`${o.replace(/\.stories\.tsx$/,"").replace(/\.stories\.ts$/,"").replace(/\.stories\.jsx$/,"").replace(/\.stories\.js$/,"")}.tsx`,y.debug("[storyFilePaths] Derived componentFile:",i));let s=i.replace(/\.tsx$/,".css").replace(/\.ts$/,".css").replace(/\.jsx$/,".css").replace(/\.js$/,".css"),a=i.substring(0,i.lastIndexOf("/")),u={storyFile:o,componentFile:i,cssFile:s,baseDir:a};return y.debug("[storyFilePaths] Final paths:",u),u}catch(t){return y.error("[storyFilePaths] Error getting file paths:",t),null}}function lm(e,t){if(e==="css")return t.cssFile;if(e==="component")return t.componentFile;if(e==="story")return t.storyFile}function Nz(e,t){let n=e.toLowerCase().trim();return["color","spacing","typography","dimension","border","shadow","layout","background","font","size","margin","padding"].some(i=>n.includes(i))?t.cssFile:t.componentFile}function cm(e,t){let n=e.property?.toLowerCase()||"",r=e.domElement?.toLowerCase()||"",o=r.startsWith("svg"),i=r.startsWith("img"),s=n==="width"||n==="height",a=/\[(?:width|height)=/.test(r);return(o||i)&&s||a?(y.debug(`[storyFilePaths] \u{1F50D} INLINE ATTRIBUTE: domElement="${e.domElement}", property="${e.property}" \u2192 component file`),t.componentFile):Nz(e.type,t)}Oe();function Oz(e){let t=(e.description||"").toLowerCase(),n=(e.title||"").toLowerCase(),r=`${t} ${n}`;return r.includes("inner icon")||r.includes("inner vector")?"inner-icon":r.includes("second icon")?"icon-2":r.includes("first icon")?"icon-1":r.includes("icon")||r.includes("vector")||r.includes("svg")?"icon":r.includes("button")?"button":r.includes("text")||r.includes("label")?"text":r.includes("container")||r.includes("wrapper")?"container":"other"}function _z(e){let t=(e.property||"").toLowerCase(),n=(e.description||"").toLowerCase();return t.includes("width")||t.includes("height")||t.includes("size")||t.includes("dimensions")?"dimensions":t.includes("padding")||t.includes("margin")||t.includes("gap")?"spacing":t.includes("color")||t.includes("background")||t.includes("fill")?"colors":t.includes("font")||t.includes("text")||t.includes("line-height")?"typography":t.includes("border")||t.includes("radius")?"border":n.includes("overall")||n.includes("visual fidelity")||n.includes("pixel similarity")||t.includes("overall")?"summary":"other"}function $z(e){let t=(e.property||"").toLowerCase(),n=(e.description||"").toLowerCase();return t.includes("overall")||t.includes("visual fidelity")||n.includes("pixel similarity score")||n.includes("primarily explained by")||n.includes("visual discrepancy")}function Uz(e,t,n){let r={critical:3,major:2,minor:1},i=[...e].sort((c,l)=>(r[l.severity]||0)-(r[c.severity]||0))[0],s=e.length,a,u;if(t.includes("icon")&&n==="dimensions"){let c=e.map(d=>d.currentValue).filter(Boolean),l=e.map(d=>d.suggestedValue).filter(Boolean);a=`Icon sizing is incorrect (${s} related issues)`,u=`Icons are rendered at wrong dimensions. Current: ${c[0]||"10px"}, Expected: ${l[0]||"20px"}. This single CSS fix will resolve all ${s} icon dimension issues.`}else a=`${t} ${n} issues (${s} related)`,u=`${s} related ${n} issues for ${t}. ${i.description}`;return{...i,id:`merged-${t}-${n}-${i.id}`,title:a,description:u,currentValue:i.currentValue,suggestedValue:i.suggestedValue,mergedCount:s,mergedIssueIds:e.map(c=>c.id)}}function um(e){if(!e||e.length===0)return[];let t=e.filter(i=>!$z(i)),n=[],r=[];for(let i of t){let s=Oz(i),a=_z(i);s.includes("icon")&&a==="dimensions"?n.push(i):r.push(i)}let o=[];return n.length>0&&(n.length===1?o.push(n[0]):o.push(Uz(n,"icon","dimensions"))),o.push(...r),y.debug("[deduplicateIssues] Input:",e.length,"issues, Output:",o.length,"issues"),y.debug("[deduplicateIssues] Removed",e.length-t.length,"summary issues"),y.debug("[deduplicateIssues] Merged",n.length,"icon issues into",n.length>0?1:0),o}Oe();Rn();var jz=[/Failed to fetch/i,/NetworkError/i,/network request failed/i,/load failed/i,/ERR_(NETWORK|INTERNET|CONNECTION|NAME_NOT_RESOLVED)/i,/timed out/i,/aborted/i],Hz=[/credits?/i,/Rate limit/i,/Figma connection expired/i,/Map.*to Figma|Figma mapping required/i,/No project selected/i,/Not authenticated/i,/No story/i,/Monthly review limit/i,/Upgrade your plan/i];function Pv(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"Review failed";return Hz.some(n=>n.test(t))?t:jz.some(n=>n.test(t))?`Can't reach ${Ft.NAME}. Check your internet connection and try again. If the dashboard URL is wrong, fix it in Settings.`:/Unauthorized|401/i.test(t)?"Your session expired. Sign out and back in from Settings to continue.":/Internal Server Error|5\d\d|server error/i.test(t)?`${Ft.NAME}'s servers had a hiccup. Try the review again in a moment. If it keeps failing, send feedback.`:/parsing|SSE|stream|structured result|failed to receive/i.test(t)?"Review completed but the result was malformed. Try again, or send feedback if it keeps happening.":`Review failed: ${t}. Try again, or send feedback if this keeps happening.`}je();import{addons as Oi}from"storybook/manager-api";var pm="uireview/badge",zi={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error"};function Wz(e){return e.criticalCount>0||e.score<70?"status-value:error":e.majorCount>0||e.score<90?"status-value:warning":"status-value:success"}function Vz(e){let t=[`Score: ${e.score}`];return e.criticalCount>0&&t.push(`${e.criticalCount} critical`),e.majorCount>0&&t.push(`${e.majorCount} major`),e.minorCount>0&&t.push(`${e.minorCount} minor`),t.join(" \xB7 ")}function Gz(e){return e.score>=90?`\u2713 Score ${e.score}`:e.score>=70?`\u26A0 Score ${e.score}`:`\u2717 Score ${e.score}`}function Ni(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function Bv(e){if(Ni())try{Oi.getChannel().emit(zi.REVIEW_START,{storyId:e})}catch{}}function Eo(e,t){if(Ni())try{Oi.getChannel().emit(zi.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function Dv(e){if(Ni())try{Oi.getChannel().emit(zi.REVIEW_ERROR,{storyId:e})}catch{}}function Lv(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}}var Mv=null;function Rv(e){if(Mv!==null)return;let t=Oi.getChannel(),n=o=>i=>{Ni()&&o(i)};t.on(zi.REVIEW_START,n(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:pm,storyId:o,title:"Reviewing...",description:"AI review in progress"}])})),t.on(zi.REVIEW_COMPLETE,n(({storyId:o,summary:i})=>{e.set([{value:Wz(i),typeId:pm,storyId:o,title:Gz(i),description:Vz(i)}])})),t.on(zi.REVIEW_ERROR,n(({storyId:o})=>{e.set([{value:"status-value:error",typeId:pm,storyId:o,title:"Review Failed",description:"An error occurred during review"}])}));let r=Ni();r||Lv(e),Mv=setInterval(()=>{let o=Ni();o!==r&&(r=o,o||Lv(e))},1500)}var qz="uireview/mapped",zv="uireview/mappings-updated";function Nv(e){try{Oi.getChannel().emit(zv,{storyIds:e})}catch{}}function Ov(e){Oi.getChannel().on(zv,({storyIds:n})=>{n.length&&e.set(n.map(r=>({value:"status-value:success",typeId:qz,storyId:r,title:"\u2713 Linked to Figma",description:"Story has a Figma mapping"})))})}var dm=V(),gm=180;function Ao(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e;if("value"in t&&typeof t.value=="string")return t.value;if("top"in t||"left"in t){let n=[t.top,t.right,t.bottom,t.left].filter(Boolean);if(n.length>0)return n.join(" ")}return JSON.stringify(e)}return String(e)}var fm=()=>{let{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,selectedModels:l,setIsReviewing:d,setReviewError:g,setReviewResults:p,setShowReviewMenu:f,setSeverityFilter:k,setShowStreamingPanel:T,setStreamingPanelCollapsed:E,addStreamingMessage:I,updateStreamingMessage:D,clearStreamingMessages:R,setStreamingProgress:$,setStreamingStatus:P,setFullPrompt:z,setFullResponse:x,setFigmaImageUrl:w,storybookImageUrl:v,setStorybookImageUrl:C,setFigmaDimensions:m,setMultiModelResults:F,updateMultiModelStreamingMessages:S,setModelCompleted:b,setActiveModelId:A,resetReview:L,addReview:B,setReviewDetailTab:N,includeTextComparison:h,usePromptCache:j,setApplyFixesResult:W,featureFlags:M}=ce(),{sessionToken:K,usageData:ee,setUsageData:ge}=we(),{selectedProjectId:xe}=Je(),{currentStoryId:ae,currentStoryName:Ke}=nt(),be=Yl(ee);be.current=ee;let Te=Yl(null),te=Yl(null),Me=Yl({}),Ae=Js((fe,tt)=>{I({role:fe,content:tt})},[I]),pe=Js((fe,tt)=>{$(fe),P(tt)},[$,P]),Pt=Js(async fe=>{let{isIteration:tt=!1,parentReviewId:he=null}=fe||{};if(!K)throw new Error("Not authenticated");if(!xe)throw new Error("No project selected");if(!ae||!Ke)throw new Error("No story is currently selected in Storybook");if(e){y.debug("[useAIReview] Review already in progress, ignoring duplicate request");return}let oe=Date.now();try{d(!0),g(null),p(null),N("issues"),W(null),ae&&M.enableReviewBadges&&Bv(ae),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{y.debug(`[useAIReview] Auto-stopping review after ${gm}s timeout`),Te.current&&Te.current.abort(),I({role:"system",content:`Review auto-stopped after ${gm} seconds timeout.`})},gm*1e3),z(""),x(""),T(!0),E(!1),R(),pe(0,"Starting review..."),pe(5,"Refreshing component preview..."),y.debug("[Review] Forcing iframe reload for fresh styles..."),await jl(),y.debug("[Review] Iframe reloaded, styles should be fresh"),pe(20,"Capturing screenshot & extracting styles..."),y.debug("[Review] Starting parallel data collection...");let[Y,me,ie]=await Promise.all([$l({sessionToken:K||void 0}),Promise.resolve(qs()),Promise.resolve(Kf())]);if(Y&&Y!==v&&(C(Y),y.debug("[Review] Storybook screenshot captured and set")),!me)throw new Error("Failed to extract styles from component");let{computed:O,declared:U,markup:H,textElementStyles:Be,nestedElementStyles:_e}=me;ie?y.debug("[Review] DOM tree extracted:",{selector:ie.selector,childrenCount:ie.children.length}):(y.error("[Review] DOM tree extraction FAILED - domTree is null"),y.error("[Review] This will cause AI to use comparison table instead of tree comparison")),pe(50,"Preparing metadata..."),y.debug("[Review] Current story:",{id:ae,name:Ke});let bt=gt.getState().currentMapping?.figmaNodeId??null,Gn=gt.getState().figmaImageUrl;if(bt&&(y.debug("[Review] Using Figma node ID from store:",bt),Gn&&(pe(65,"Using existing Figma design..."),y.debug("[Review] Reusing already-loaded Figma image"))),!bt)try{let Qe=await fetch(`${dm}/api/mappings?projectId=${xe}&storyId=${ae}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Qe.ok){let Rt=await Qe.json();Rt.mapping?.figmaNodeId?(bt=Rt.mapping.figmaNodeId,y.debug("[Review] Found Figma node ID from API:",bt)):y.debug("[Review] No mapping found for story:",ae)}else y.debug("[Review] Failed to fetch mapping:",Qe.status)}catch(Qe){y.error("[Review] Error fetching mapping:",Qe)}if(bt&&!Gn){pe(65,"Fetching Figma design...");try{let Qe=await fetch(`${dm}/api/figma/frames?projectId=${xe}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Qe.ok){let $t=(await Qe.json()).thumbnails?.[bt];$t?(w($t),y.debug("[Review] Figma thumbnail fetched and displayed:",$t)):y.warn("[Review] No thumbnail found for node:",bt)}else y.warn("[Review] Failed to fetch Figma frames:",Qe.status)}catch(Qe){y.error("[Review] Error fetching Figma frames:",Qe)}}if(!bt)throw new Error('Figma mapping required. Please link this story to a Figma frame using the "Map to Figma" button before reviewing.');pe(80,"AI is analyzing your component..."),y.debug("[Review] Sending to streaming API...");let nr={projectId:xe,storyId:ae,storyName:Ke,storybookScreenshot:Y,computedStyles:O,declaredStyles:U,textElementStyles:Be,nestedElementStyles:_e,componentMarkup:H,domTree:ie,figmaNodeId:bt,figmaImageUrl:Gn||void 0,aiModels:l,includeTextComparison:h,usePromptCache:j,parentReviewId:tt?he:void 0,isIteration:tt};y.debug("[Review] Request payload:",{...nr,storybookScreenshot:Y?`${Y.substring(0,50)}...`:null,domTree:ie?{selector:ie.selector,childrenCount:ie.children.length}:null}),Te.current=new AbortController;let En=await fetch(`${dm}/api/review/stream`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`},body:JSON.stringify(nr),signal:Te.current.signal});if(y.debug("[Review] Response status:",En.status,En.statusText),!En.ok){let Qe=await En.json();if(y.error("[Review] API error response:",Qe),En.status===429){let Rt=Qe.retryAfter||60;throw new Error(`Rate limit exceeded. Please wait ${Rt} seconds before trying again.`)}if(En.status===402){if(Qe.code==="INSUFFICIENT_CREDITS"){let Rt=Qe.details?.required??1,$t=Qe.details?.balance??0;throw new Error(`Not enough credits. This review requires ${Rt} credit(s) but you have ${$t}. Visit Settings to add more.`)}throw Qe.code==="SUBSCRIPTION_LIMIT_EXCEEDED"?new Error(Qe.message||"Monthly review limit reached. Upgrade your plan to continue."):new Error(Qe.message||"Payment required")}throw En.status===401&&Qe.code==="FIGMA_AUTH_EXPIRED"?new Error("Figma connection expired. Open Settings \u2192 Disconnect \u2192 Reconnect Figma to continue."):new Error(Qe.error||Qe.message||"Review request failed")}let mo=En.body?.getReader(),wn=new TextDecoder,Br="",rn="",$e=null,uu=null,ry=l.length>1,Vo={},cs={},wV={};if(!mo)throw new Error("Response body is not readable");let oy=gt.getState().streamingMessages.length;for(Ae("assistant","");;){let{done:Qe,value:Rt}=await mo.read();if(Qe)break;Br+=wn.decode(Rt,{stream:!0});let $t=Br.split(`
17
17
  `);Br=$t.pop()||"";for(let qn of $t)if(qn.startsWith("data: ")){let pn=qn.slice(6);if(pn==="[DONE]")continue;try{let re=JSON.parse(pn);if(re.type!=="text"&&re.type!=="content"&&y.debug("[Review] SSE Event received:",re.type),re.type==="prompt")re.prompt&&(z(re.prompt),y.debug("[Review] Prompt received early"));else if(re.type==="model_started")y.debug("[Review] Model started:",re.modelId),Vo[re.modelId]||(Vo[re.modelId]="",cs[re.modelId]=[{role:"assistant",content:""}]);else if(re.type==="text"||re.type==="content")if(ry&&re.modelId){Vo[re.modelId]||(Vo[re.modelId]="",cs[re.modelId]=[{role:"assistant",content:""}]),Vo[re.modelId]+=re.content,cs[re.modelId][0].content=Vo[re.modelId],S(re.modelId,cs[re.modelId]);let qt=Object.entries(Vo).map(([dn,at])=>`[${dn}]
@@ -147,7 +147,7 @@ ${_e.diffPreview}`),_e.error&&Be.push(`Error: ${_e.error}`)}return Be.push(""),B
147
147
 
148
148
  `),Y=te.filter(H=>H.generatedFix?.status==="applied").length,me=te.filter(H=>H.generatedFix?.status==="ready").length,ie=Y>0||me>0?` | Fixes: ${Y} applied, ${me} ready`:"",O=r!==void 0?` | Similarity: ${r}%`:"",U=`Score: ${n}/100${O} | ${te.length} issues${ie}
149
149
 
150
- `;try{await navigator.clipboard.writeText(U+oe),W(!0),setTimeout(()=>W(!1),2e3)}catch(H){console.error("Failed to copy:",H)}};q.useEffect(()=>{z&&ae.current&&ae.current.scrollIntoView({behavior:"smooth",block:"start"})},[z]);let te=d8(()=>e.filter(oe=>{let Y=L==="all"||oe.severity===L,me=N==="all"||oe.status===N,ie=ee||!D8(oe);return Y&&me&&ie}),[e,L,N,ee]),Me=()=>{te.forEach(oe=>{oe.selectedForFix||l(oe.id)})},Ae=()=>{te.forEach(oe=>{oe.selectedForFix&&l(oe.id)})},pe=()=>{te.forEach(oe=>{oe.generatedFix&&oe.generatedFix.status==="ready"&&!oe.selectedForFix&&l(oe.id)})},Pt=te.filter(oe=>oe.selectedForFix).length,nn=te.filter(oe=>oe.severity==="critical").length,Mr=te.filter(oe=>oe.severity==="major").length,fe=te.filter(oe=>oe.severity==="minor").length,tt=te.filter(oe=>oe.generatedFix&&oe.generatedFix.status==="ready").length,he=te.filter(oe=>oe.selectedForFix&&oe.generatedFix&&oe.generatedFix.status==="ready").length;return e.length===0?S?q.createElement(Xc,{label:"Loading review..."}):b?q.createElement(JI,null):q.createElement(eF,null,q.createElement(tF,null,F?"\u2728":"\u{1F441}\uFE0F"),q.createElement(nF,null,F?"No issues found":"No review yet"),q.createElement(rF,null,F?"This review didn't detect any issues. Great work!":'Click the "Review" button to analyze your component.')):q.createElement(h8,{"data-testid":"issues-panel"},q.createElement(x8,null,q.createElement(ZI,{value:L,onChange:oe=>B(oe.target.value)},q.createElement("option",{value:"all"},"All Severities"),q.createElement("option",{value:"critical"},"Critical Only"),q.createElement("option",{value:"major"},"Major Only"),q.createElement("option",{value:"minor"},"Minor Only")),q.createElement(ZI,{value:N,onChange:oe=>h(oe.target.value)},q.createElement("option",{value:"all"},"All Statuses"),q.createElement("option",{value:"pending"},"Pending"),q.createElement("option",{value:"applied"},"Applied"),q.createElement("option",{value:"verified"},"Verified"),q.createElement("option",{value:"failed"},"Failed"))),q.createElement("div",null,q.createElement(y8,{isOpen:M,onClick:()=>K(!M)},q.createElement(b8,null,q.createElement(S8,{isOpen:M},q.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("polyline",{points:"6 9 12 15 18 9"}))),q.createElement(k8,null,te.length," issues"),(()=>{if(te.length===0)return null;let oe=te.map(ie=>ie.generatedFix?.filePath||ie.file).filter(Boolean);if(oe.length===0)return null;let Y=oe[0];return oe.every(ie=>ie===Y)?q.createElement(T8,null,"in ",Y):null})(),q.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},nn>0&&q.createElement(Mx,{variant:"critical"},nn," critical"),Mr>0&&q.createElement(Mx,{variant:"major"},Mr," major"),fe>0&&q.createElement(Mx,{variant:"minor"},fe," minor"))),q.createElement(v8,{onClick:oe=>oe.stopPropagation()},q.createElement(Qc,{onClick:Me},"All"),q.createElement(Qc,{onClick:Ae},"None"),q.createElement(Qc,{onClick:Te},j?"\u2713":"\u2398"," Copy"),tt>0&&q.createElement(Qc,{onClick:pe},"Fixes (",tt,")"))),z&&q.createElement(F8,{ref:ae,variant:z.error||z.failed>0?"warning":"success"},z.error?q.createElement(q.Fragment,null,z.error):z.failed>0?q.createElement(q.Fragment,null,"Applied ",z.succeeded,"/",z.total," ","fixes. ",z.failed," failed. Run a new review to verify."):q.createElement(q.Fragment,null,"Applied ",z.total," fix",z.total!==1?"es":"","! Run a new review to verify changes."),x&&q.createElement(E8,{onClick:x},"\u2715")),Pt>0&&q.createElement(oF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(aF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&f&&q.createElement(iF,{disabled:R||$||he===0,onClick:f},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(sF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")),A&&!R&&q.createElement(A8,{confidence:A.overallConfidence},q.createElement(P8,null,q.createElement(M8,null,"AI Self-Review"),q.createElement(L8,{confidence:A.overallConfidence},A.wouldReachPerfect?"\u2713":"\u25B3"," ",A.overallConfidence,"% confidence")),q.createElement(B8,null,A.variantSafety&&q.createElement(Jc,null,q.createElement(Zc,null,"Variant safety:"," "),A.variantSafety),A.gaps.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Gaps: "),q.createElement("ul",null,A.gaps.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),!A.wouldReachPerfect&&A.reasonsNotPerfect.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Why not 100%:"," "),q.createElement("ul",null,A.reasonsNotPerfect.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),A.suggestions&&A.suggestions.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Suggestions: "),q.createElement("ul",null,A.suggestions.map((oe,Y)=>q.createElement("li",{key:Y},oe)))))),M&&q.createElement(w8,null,te.length===0?q.createElement(eF,null,q.createElement(tF,null,"\u{1F50D}"),q.createElement(nF,null,"No issues match current filters"),q.createElement(rF,null,"Try adjusting your severity or status filters")):q.createElement(C8,null,(()=>{let oe={};te.forEach(U=>{let H=U.detectedBy;H&&(oe[H]=(oe[H]||0)+1)});let Y=Object.entries(oe).sort((U,H)=>H[1]-U[1])[0],me=Y&&Y[1]>te.length/2?Y[0]:void 0,ie=te.map(U=>U.generatedFix?.filePath||U.file).filter(Boolean),O=ie.length>0&&ie.every(U=>U===ie[0]);return te.map(U=>q.createElement(qI,{key:U.id,issue:U,modelId:t,dominantDetector:me,showFilePath:!O,onToggleSelection:l,onDismiss:I,onUndismiss:D,onApplyFix:k}))})()))),Pt>0&&q.createElement(oF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(aF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&f&&q.createElement(iF,{disabled:R||$||he===0,onClick:f},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(sF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")))};Oe();var R8=Ct.div({display:"flex",flexDirection:"column"}),z8=Ct.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.positive,borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"})),N8=Ct.span(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive})),Bx=Ct.span(({theme:e,variant:t})=>{let n={resolved:{bg:e.background.positive,text:e.color.positive},remaining:{bg:e.background.warning,text:e.color.warning},new:{bg:e.color.tertiary,text:se}};return{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:n[t].bg,color:n[t].text}}),O8=Ct.span(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginLeft:"auto"})),Dfe=Ct.div(({theme:e})=>({textAlign:"center",padding:"60px 20px",color:e.textMutedColor})),Rfe=Ct.div({fontSize:"48px",marginBottom:"16px"}),zfe=Ct.div(({theme:e})=>({fontSize:"16px",fontWeight:600,marginBottom:"8px",color:e.color.defaultText})),Nfe=Ct.div({fontSize:"14px",opacity:.8}),_8=Ct.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),$8=Ct.div(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",backgroundColor:e.background.app,fontSize:"12px",color:e.textMutedColor})),U8=Ct(Cn)({display:"flex",gap:"8px",padding:"0",fontSize:"12px"}),j8=Ct(Rr)(({theme:e})=>({marginLeft:"auto",padding:"4px 10px",fontSize:"11px",color:e.color.secondary})),H8=Ct.span(({theme:e})=>({backgroundColor:e.color.medium,color:e.textMutedColor,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600})),W8=Ct.div(({theme:e})=>({padding:"8px 16px",backgroundColor:e.background.app})),V8=Ct.div(({theme:e})=>({padding:"12px 14px",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"6px",border:`1px solid ${e.appBorderColor}`})),G8=Ct.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}),q8=Ct.button(({theme:e})=>({background:"none",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"2px 8px",fontSize:"11px",color:e.color.mediumdark,cursor:"pointer","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.secondary}})),Y8=Ct.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,lineHeight:"1.4"})),K8=Ct.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"8px",paddingTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,lineHeight:"1.4"})),X8=Ct.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",padding:"12px 0 8px 0",marginTop:"8px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"8px","&:first-of-type":{marginTop:0}})),Q8=Ct.span(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"8px"})),J8=e=>{if(!e)return"Other";let t=e.toLowerCase();return t.includes("hug")||t.includes("fill")||t.includes("content-driven")?"HUG/FILL Sizing":t.includes("sub-pixel")||t.includes("negligible")?"Sub-pixel Differences":t.includes("values match")||t.includes("values already match")||t.includes("identical")?"Values Match":t.includes("no fix needed")||t.includes("no changes needed")?"No Fix Needed":"Other"},cF=e=>{if(!e)return"";let t=e.replace(/^Auto-dismissed:\s*/i,"").replace(/^Programmatic:\s*/i,"").replace(/^Two-Pass:\s*/i,"");return t=t.replace(/Sub-pixel difference \([\d.]+px\) - within [\d.]+px tolerance/i,"Sub-pixel difference").replace(/Dimension issue with HUG\/FILL sizing - width is content-driven, not fixed/i,"Width is content-driven").replace(/Height issue with HUG sizing - dimension is content-driven, not actionable/i,"Height is content-driven").replace(/Width issue with HUG sizing - dimension is content-driven, not actionable/i,"Width is content-driven").replace(/no-changes-needed - values already match/i,"Values already match").replace(/Values are the same - no difference/i,"Values match"),t},Z8=Ct.span(({theme:e,phase:t})=>{let n={"post-ai-validation":{bg:"#4b5563",text:"#ffffff"},"ai-validation":{bg:"#7c3aed",text:"#ffffff"},user:{bg:"#7c3aed",text:"#ffffff"}},{bg:r,text:o}=n[t]||n.user;return{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",fontWeight:600,color:o,backgroundColor:r,padding:"3px 10px",borderRadius:"10px",marginBottom:"8px"}}),eW=Ct.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"8px",marginLeft:"8px",fontSize:"11px",color:e.textMutedColor,"& > span":{display:"inline-flex",alignItems:"center",gap:"3px"}})),Rx=e=>{if(!e)return;let t=e.toLowerCase();if(t.includes("no-changes-needed")||t.includes("values already match")||t.includes("sub-pixel")||t.includes("negligible")||t.includes("hug")||t.includes("fill")||t.includes("content-driven")||t.includes("equivalent")||t.includes("layout mechanism"))return"post-ai-validation"},tW=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"\u2699\uFE0F";case"ai-validation":return"\u2726";case"user":return"\u{1F464}";default:return"\u2699\uFE0F"}},uF=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"Pre-filter";case"ai-validation":return"Haiku";case"user":return"Manual";default:return"Auto"}},nW=Ct.div(({theme:e})=>({padding:"20px",margin:"20px",backgroundColor:e.background.negative,borderRadius:"8px",borderLeft:`4px solid ${e.color.negative}`})),rW=Ct.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.negative,marginTop:0,marginBottom:"8px"})),oW=Ct.pre(({theme:e})=>({fontSize:"12px",color:e.color.negative,backgroundColor:e.background.app,padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"200px",fontFamily:"monospace",lineHeight:"1.5"})),iW=Ct(ly)({marginTop:"12px"}),Dx=class extends We.Component{constructor(n){super(n);this.handleReset=()=>{this.setState({hasError:!1,error:null})};this.state={hasError:!1,error:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){y.error("[IssuesPanel ErrorBoundary] Caught error:",n,r)}render(){return this.state.hasError?We.createElement(nW,null,We.createElement(rW,null,"\u26A0\uFE0F Issues Panel Error"),We.createElement("p",null,"Something went wrong displaying the issues. This might happen if a fix failed or there's invalid data."),We.createElement(oW,null,this.state.error?.message||"Unknown error",`
150
+ `;try{await navigator.clipboard.writeText(U+oe),W(!0),setTimeout(()=>W(!1),2e3)}catch(H){console.error("Failed to copy:",H)}};q.useEffect(()=>{z&&ae.current&&ae.current.scrollIntoView({behavior:"smooth",block:"start"})},[z]);let te=d8(()=>e.filter(oe=>{let Y=L==="all"||oe.severity===L,me=N==="all"||oe.status===N,ie=ee||!D8(oe);return Y&&me&&ie}),[e,L,N,ee]),Me=()=>{te.forEach(oe=>{oe.selectedForFix||l(oe.id)})},Ae=()=>{te.forEach(oe=>{oe.selectedForFix&&l(oe.id)})},pe=()=>{te.forEach(oe=>{oe.generatedFix&&oe.generatedFix.status==="ready"&&!oe.selectedForFix&&l(oe.id)})},Pt=te.filter(oe=>oe.selectedForFix).length,nn=te.filter(oe=>oe.severity==="critical").length,Mr=te.filter(oe=>oe.severity==="major").length,fe=te.filter(oe=>oe.severity==="minor").length,tt=te.filter(oe=>oe.generatedFix&&oe.generatedFix.status==="ready").length,he=te.filter(oe=>oe.selectedForFix&&oe.generatedFix&&oe.generatedFix.status==="ready").length;return e.length===0?S?q.createElement(Xc,{label:"Loading review..."}):b?q.createElement(JI,null):q.createElement(eF,null,q.createElement(tF,null,F?"\u2728":"\u{1F441}\uFE0F"),q.createElement(nF,null,F?"No issues found":"No review yet"),q.createElement(rF,null,F?"This review didn't detect any issues. Great work!":'Click the "Review" button to analyze your component.')):q.createElement(h8,{"data-testid":"issues-panel"},q.createElement(x8,null,q.createElement(ZI,{value:L,onChange:oe=>B(oe.target.value)},q.createElement("option",{value:"all"},"All Severities"),q.createElement("option",{value:"critical"},"Critical Only"),q.createElement("option",{value:"major"},"Major Only"),q.createElement("option",{value:"minor"},"Minor Only")),q.createElement(ZI,{value:N,onChange:oe=>h(oe.target.value)},q.createElement("option",{value:"all"},"All Statuses"),q.createElement("option",{value:"pending"},"Pending"),q.createElement("option",{value:"applied"},"Applied"),q.createElement("option",{value:"verified"},"Verified"),q.createElement("option",{value:"failed"},"Failed"))),q.createElement("div",null,q.createElement(y8,{isOpen:M,onClick:()=>K(!M)},q.createElement(b8,null,q.createElement(S8,{isOpen:M},q.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("polyline",{points:"6 9 12 15 18 9"}))),q.createElement(k8,null,te.length," issues"),(()=>{if(te.length===0)return null;let oe=te.map(ie=>ie.generatedFix?.filePath||ie.file).filter(Boolean);if(oe.length===0)return null;let Y=oe[0];return oe.every(ie=>ie===Y)?q.createElement(T8,null,"in ",Y):null})(),q.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},nn>0&&q.createElement(Mx,{variant:"critical"},nn," critical"),Mr>0&&q.createElement(Mx,{variant:"major"},Mr," major"),fe>0&&q.createElement(Mx,{variant:"minor"},fe," minor"))),q.createElement(v8,{onClick:oe=>oe.stopPropagation()},q.createElement(Qc,{onClick:Me},"All"),q.createElement(Qc,{onClick:Ae},"None"),q.createElement(Qc,{onClick:Te},j?"\u2713":"\u2398"," Copy"),tt>0&&q.createElement(Qc,{onClick:pe},"Fixes (",tt,")"))),z&&q.createElement(F8,{ref:ae,variant:z.error||z.failed>0?"warning":"success"},z.error?q.createElement(q.Fragment,null,z.error):z.failed>0?q.createElement(q.Fragment,null,"Applied ",z.succeeded,"/",z.total," ","fixes. ",z.failed," failed. Run a new review to verify."):q.createElement(q.Fragment,null,"Applied ",z.total," fix",z.total!==1?"es":"","! Run a new review to verify changes."),x&&q.createElement(E8,{onClick:x},"\u2715")),Pt>0&&q.createElement(oF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(aF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&f&&q.createElement(iF,{disabled:R||$||he===0,onClick:f},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(sF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")),A&&!R&&q.createElement(A8,{confidence:A.overallConfidence},q.createElement(P8,null,q.createElement(M8,null,"AI Self-Review"),q.createElement(L8,{confidence:A.overallConfidence},A.wouldReachPerfect?"\u2713":"\u25B3"," ",A.overallConfidence,"% confidence")),q.createElement(B8,null,A.variantSafety&&q.createElement(Jc,null,q.createElement(Zc,null,"Variant safety:"," "),A.variantSafety),A.gaps.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Gaps: "),q.createElement("ul",null,A.gaps.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),!A.wouldReachPerfect&&A.reasonsNotPerfect.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Why not 100%:"," "),q.createElement("ul",null,A.reasonsNotPerfect.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),A.suggestions&&A.suggestions.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Suggestions: "),q.createElement("ul",null,A.suggestions.map((oe,Y)=>q.createElement("li",{key:Y},oe)))))),M&&q.createElement(w8,null,te.length===0?q.createElement(eF,null,q.createElement(tF,null,"\u{1F50D}"),q.createElement(nF,null,"No issues match current filters"),q.createElement(rF,null,"Try adjusting your severity or status filters")):q.createElement(C8,null,(()=>{let oe={};te.forEach(U=>{let H=U.detectedBy;H&&(oe[H]=(oe[H]||0)+1)});let Y=Object.entries(oe).sort((U,H)=>H[1]-U[1])[0],me=Y&&Y[1]>te.length/2?Y[0]:void 0,ie=te.map(U=>U.generatedFix?.filePath||U.file).filter(Boolean),O=ie.length>0&&ie.every(U=>U===ie[0]);return te.map(U=>q.createElement(qI,{key:U.id,issue:U,modelId:t,dominantDetector:me,showFilePath:!O,onToggleSelection:l,onDismiss:I,onUndismiss:D,onApplyFix:k}))})()))),Pt>0&&q.createElement(oF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(aF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&f&&q.createElement(iF,{disabled:R||$||he===0,onClick:f},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(sF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")))};Oe();var R8=Ct.div({display:"flex",flexDirection:"column"}),z8=Ct.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.positive,borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"})),N8=Ct.span(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive})),Bx=Ct.span(({theme:e,variant:t})=>{let n={resolved:{bg:e.background.positive,text:e.color.positive},remaining:{bg:e.background.warning,text:e.color.warning},new:{bg:e.color.tertiary,text:se}};return{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:n[t].bg,color:n[t].text}}),O8=Ct.span(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginLeft:"auto"})),Dfe=Ct.div(({theme:e})=>({textAlign:"center",padding:"60px 20px",color:e.textMutedColor})),Rfe=Ct.div({fontSize:"48px",marginBottom:"16px"}),zfe=Ct.div(({theme:e})=>({fontSize:"16px",fontWeight:600,marginBottom:"8px",color:e.color.defaultText})),Nfe=Ct.div({fontSize:"14px",opacity:.8}),_8=Ct.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),$8=Ct.div(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",backgroundColor:e.background.app,fontSize:"12px",color:e.textMutedColor})),U8=Ct(Cn)({display:"flex",gap:"8px",padding:"0",fontSize:"12px"}),j8=Ct(Rr)(({theme:e})=>({marginLeft:"auto",padding:"4px 10px",fontSize:"11px",color:e.color.secondary})),H8=Ct.span(({theme:e})=>({backgroundColor:e.color.medium,color:e.textMutedColor,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600})),W8=Ct.div(({theme:e})=>({padding:"8px 16px",backgroundColor:e.background.app})),V8=Ct.div(({theme:e})=>({padding:"12px 14px",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"6px",border:`1px solid ${e.appBorderColor}`})),G8=Ct.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}),q8=Ct.button(({theme:e})=>({background:"none",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"2px 8px",fontSize:"11px",color:e.color.mediumdark,cursor:"pointer","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.secondary}})),Y8=Ct.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,lineHeight:"1.4"})),K8=Ct.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"8px",paddingTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,lineHeight:"1.4"})),X8=Ct.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",padding:"12px 0 8px 0",marginTop:"8px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"8px","&:first-of-type":{marginTop:0}})),Q8=Ct.span(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"8px"})),J8=e=>{if(!e)return"Other";let t=e.toLowerCase();return t.includes("hug")||t.includes("fill")||t.includes("content-driven")?"HUG/FILL Sizing":t.includes("sub-pixel")||t.includes("negligible")?"Sub-pixel Differences":t.includes("values match")||t.includes("values already match")||t.includes("identical")?"Values Match":t.includes("no fix needed")||t.includes("no changes needed")?"No Fix Needed":"Other"},cF=e=>{if(!e)return"";let t=e.replace(/^Auto-dismissed:\s*/i,"").replace(/^Programmatic:\s*/i,"").replace(/^Two-Pass:\s*/i,"");return t=t.replace(/Sub-pixel difference \([\d.]+px\) - within [\d.]+px tolerance/i,"Sub-pixel difference").replace(/Dimension issue with HUG\/FILL sizing - width is content-driven, not fixed/i,"Width is content-driven").replace(/Height issue with HUG sizing - dimension is content-driven, not actionable/i,"Height is content-driven").replace(/Width issue with HUG sizing - dimension is content-driven, not actionable/i,"Width is content-driven").replace(/no-changes-needed - values already match/i,"Values already match").replace(/Values are the same - no difference/i,"Values match"),t},Z8=Ct.span(({theme:e,phase:t})=>{let n={"post-ai-validation":{bg:"#4b5563",text:"#ffffff"},"ai-validation":{bg:"#0369a1",text:"#ffffff"},user:{bg:"#7c3aed",text:"#ffffff"}},{bg:r,text:o}=n[t]||n["post-ai-validation"];return{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",fontWeight:600,color:o,backgroundColor:r,padding:"3px 10px",borderRadius:"10px",marginBottom:"8px"}}),eW=Ct.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"8px",marginLeft:"8px",fontSize:"11px",color:e.textMutedColor,"& > span":{display:"inline-flex",alignItems:"center",gap:"3px"}})),Rx=e=>{if(!e)return;let t=e.toLowerCase();if(t.includes("no-changes-needed")||t.includes("values already match")||t.includes("sub-pixel")||t.includes("negligible")||t.includes("hug")||t.includes("fill")||t.includes("content-driven")||t.includes("equivalent")||t.includes("layout mechanism"))return"post-ai-validation"},tW=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"\u2699\uFE0F";case"ai-validation":return"\u2726";case"user":return"\u{1F464}";default:return"\u2699\uFE0F"}},uF=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"Pre-filter";case"ai-validation":return"Auto";case"user":return"Manual";default:return"Auto"}},nW=Ct.div(({theme:e})=>({padding:"20px",margin:"20px",backgroundColor:e.background.negative,borderRadius:"8px",borderLeft:`4px solid ${e.color.negative}`})),rW=Ct.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.negative,marginTop:0,marginBottom:"8px"})),oW=Ct.pre(({theme:e})=>({fontSize:"12px",color:e.color.negative,backgroundColor:e.background.app,padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"200px",fontFamily:"monospace",lineHeight:"1.5"})),iW=Ct(ly)({marginTop:"12px"}),Dx=class extends We.Component{constructor(n){super(n);this.handleReset=()=>{this.setState({hasError:!1,error:null})};this.state={hasError:!1,error:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){y.error("[IssuesPanel ErrorBoundary] Caught error:",n,r)}render(){return this.state.hasError?We.createElement(nW,null,We.createElement(rW,null,"\u26A0\uFE0F Issues Panel Error"),We.createElement("p",null,"Something went wrong displaying the issues. This might happen if a fix failed or there's invalid data."),We.createElement(oW,null,this.state.error?.message||"Unknown error",`
151
151
 
152
152
  `,this.state.error?.stack),We.createElement(iW,{onClick:this.handleReset},"Try Again")):this.props.children}},pF=()=>{let{currentStoryId:e}=nt(),{currentReviewId:t,isReviewing:n,reviewHistory:r,toggleIssueSelection:o,applyFixesResult:i,setApplyFixesResult:s}=ce(),{dismissAndSync:a,undismissAndSync:u}=bI(),{loadingMapping:c}=nt(),l=!!e&&!t&&!n&&c,[d,g]=We.useState(!1),[p,f]=We.useState(!1),[k,T]=We.useState(!1),{isSupported:E,isDetecting:I}=vm(),{refreshStorybookOnly:D}=ei(),{generateBatchFixes:R,isGenerating:$,error:P,timing:z,progress:x,usage:w,selfReview:v,lastStorybookRoot:C}=ym(),{applyFixes:m,isApplying:F}=xm({onComplete:D,storybookRoot:C}),S=r.find(Y=>Y.id===t),b=S?.issues||[],A=We.useMemo(()=>b.filter(Y=>!Y.dismissed),[b]),L=We.useMemo(()=>b.filter(Y=>Y.dismissed),[b]),B=We.useMemo(()=>{let Y={postAiValidation:0,aiValidation:0,user:0};for(let me of L)switch(me.dismissedBy){case"post-ai-validation":Y.postAiValidation++;break;case"ai-validation":Y.aiValidation++;break;default:Y.user++;break}return Y},[L]),N=A,h=S?.modelId||"unknown",j=A.filter(Y=>Y.severity==="critical").length,W=A.filter(Y=>Y.severity==="major").length,M=A.filter(Y=>Y.severity==="minor").length,K=S?To(j,W,M):void 0,ee=S?.visualSimilarity,ge=S?.costUsd,xe=S?.reviewDurationMs,ae=S?.inputTokens,Ke=S?.outputTokens,be=S?.cacheCreationTokens,Te=S?.cacheReadTokens,te=S?.parentReviewId?r.find(Y=>Y.id===S.parentReviewId):null,Me=We.useMemo(()=>{if(!te||!S)return null;let Y=new Set(te.issues.map(H=>`${H.type}:${H.property||""}:${H.description}`)),me=new Set(N.map(H=>`${H.type}:${H.property||""}:${H.description}`)),ie=te.issues.filter(H=>!me.has(`${H.type}:${H.property||""}:${H.description}`)).length,O=N.filter(H=>Y.has(`${H.type}:${H.property||""}:${H.description}`)).length,U=N.filter(H=>!Y.has(`${H.type}:${H.property||""}:${H.description}`)).length;return{resolved:ie,remaining:O,newIssues:U}},[te,S,N]),Ae=()=>{N.forEach(Y=>{Y.selectedForFix||o(Y.id)})},pe=()=>{N.forEach(Y=>{Y.selectedForFix&&o(Y.id)})},Pt=()=>{N.forEach(Y=>{Y.generatedFix&&Y.generatedFix.status==="ready"&&!Y.selectedForFix&&o(Y.id)})},{featureFlags:nn}=ce(),Mr=()=>{if(!nn.enableFixGeneration){y.warn("[IssuesPanel] Fix generation is disabled by feature flag");return}let Y=N.filter(me=>me.selectedForFix);if(Y.length===0){y.warn("[IssuesPanel] No issues selected for fix generation");return}y.debug(`[IssuesPanel] Generating fixes for ${Y.length} issue(s)`,Y),R(Y)},fe=()=>{if(!nn.enableFixApply){y.warn("[IssuesPanel] Fix apply is disabled by feature flag");return}let Y=N.filter(ie=>ie.selectedForFix&&ie.generatedFix&&ie.generatedFix.status==="ready"&&ie.generatedFix.code&&ie.generatedFix.filePath);if(Y.length===0){y.warn("[IssuesPanel] No issues with ready AI-generated fixes selected");return}let me=Y.map(ie=>({id:ie.id,reviewId:ie.reviewId,type:ie.type,severity:ie.severity,title:ie.title,description:ie.description,generatedFix:ie.generatedFix,storyId:S?.storyId||""}));y.debug(`[IssuesPanel] Applying AI-generated fixes for ${me.length} issue(s)`,me),m(me)},tt=Y=>{let me=N.find(O=>O.id===Y);if(!me){y.warn("[IssuesPanel] Issue not found:",Y);return}if(!me.generatedFix||me.generatedFix.status!=="ready"||!me.generatedFix.code||!me.generatedFix.filePath){y.warn("[IssuesPanel] Issue does not have a ready AI-generated fix:",Y);return}let ie={id:me.id,reviewId:me.reviewId,type:me.type,severity:me.severity,title:me.title,description:me.description,generatedFix:me.generatedFix,storyId:S?.storyId||""};y.debug("[IssuesPanel] Applying single AI-generated fix for issue:",ie),m([ie])},he=async()=>{let Y=N.filter(ie=>ie.selectedForFix&&ie.generatedFix&&ie.generatedFix.status==="ready"&&ie.generatedFix.code&&ie.generatedFix.filePath);if(Y.length===0){y.warn("[IssuesPanel] No issues with ready AI-generated fixes selected");return}let me=Y.map(ie=>{let O=ie.generatedFix,U=[];return U.push(`// File: ${O.filePath}`),U.push(`// Issue: ${ie.title||ie.description}`),ie.currentValue&&U.push(`// Actual: ${ie.currentValue}`),ie.suggestedValue&&U.push(`// Expected (Figma): ${ie.suggestedValue}`),O.diffPreview&&(U.push("//"),U.push("// Diff:"),O.diffPreview.split(`
153
153
  `).forEach(H=>{U.push(`// ${H}`)})),U.push("//"),U.push("// Full Fixed Code:"),U.push(O.code),U.join(`
@@ -163,7 +163,7 @@ ${_e.diffPreview}`),_e.error&&Be.push(`Error: ${_e.error}`)}return Be.push(""),B
163
163
  `),ie=`Filtered Issues (${L.length})
164
164
  ${"=".repeat(40)}
165
165
 
166
- `;try{await navigator.clipboard.writeText(ie+me),T(!0),setTimeout(()=>T(!1),2e3)}catch(O){y.error("Failed to copy dismissed issues:",O)}};return We.createElement(R8,null,Me&&We.createElement(z8,null,We.createElement(N8,null,"\u{1F4CA} Progress:"),We.createElement(Bx,{variant:"resolved"},"\u2705 ",Me.resolved," resolved"),We.createElement(Bx,{variant:"remaining"},"\u23F3 ",Me.remaining," remaining"),Me.newIssues>0&&We.createElement(Bx,{variant:"new"},"\u{1F195} ",Me.newIssues," new"),We.createElement(O8,null,"Iteration ",S?.iterationNumber||1)),We.createElement(Dx,null,We.createElement(lF,{issues:N,modelId:h,complianceScore:K,visualSimilarity:ee,costUsd:ge,reviewDurationMs:xe,inputTokens:ae,outputTokens:Ke,cacheCreationTokens:be,cacheReadTokens:Te,onToggleSelection:o,onSelectAll:Ae,onSelectNone:pe,onSelectAllFixes:Pt,onGenerateFixes:Mr,onApplyFixes:fe,onApplyFix:tt,onCopyAllFixes:he,onDismiss:a,onUndismiss:u,isGenerating:$,isApplying:F,isCopying:p,applyFixesResult:i,onDismissResult:()=>s(null),generationTiming:z,generationUsage:w,hasReviewBeenRun:!!S,isLoadingReview:l,isReviewing:n,generationProgress:x,autoApplySupported:E,selfReview:v})),L.length>0&&We.createElement(_8,null,We.createElement($8,null,We.createElement(U8,{onClick:()=>g(!d)},We.createElement("span",null,d?"\u25BC":"\u25B6"),We.createElement("span",null,"Filtered out"),We.createElement(H8,null,L.length),We.createElement(eW,null,B.postAiValidation>0&&We.createElement("span",null,"\u2699\uFE0F ",B.postAiValidation),B.aiValidation>0&&We.createElement("span",null,"\u2726 ",B.aiValidation),B.user>0&&We.createElement("span",null,"\u{1F464} ",B.user))),We.createElement(j8,{onClick:oe},k?"\u2713 Copied!":"Copy")),d&&We.createElement(W8,null,(()=>{let Y=L.reduce((O,U)=>{let H=J8(U.dismissReason);return O[H]||(O[H]=[]),O[H].push(U),O},{}),me=["HUG/FILL Sizing","Sub-pixel Differences","Values Match","No Fix Needed","Other"];return Object.keys(Y).sort((O,U)=>me.indexOf(O)-me.indexOf(U)).map(O=>We.createElement(We.Fragment,{key:O},We.createElement(X8,null,O,We.createElement(Q8,null,Y[O].length)),Y[O].map(U=>We.createElement(V8,{key:U.id},We.createElement(G8,null,We.createElement(Z8,{phase:U.dismissedBy||Rx(U.dismissReason)||"post-ai-validation"},tW(U.dismissedBy,U.dismissReason)," ",uF(U.dismissedBy,U.dismissReason)),We.createElement(q8,{onClick:()=>u(U.id),title:"Restore to active issues"},"\u21A9 Restore")),We.createElement(Y8,null,"[",U.severity.toUpperCase(),"] ",U.title||U.description),U.dismissReason&&We.createElement(K8,null,cF(U.dismissReason))))))})())))};var aW=Aa.div({marginTop:"20px"}),lW=Aa.div(({theme:e})=>({display:"flex",alignItems:"center",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),cW=Aa.div({display:"flex",alignItems:"center"}),zx=Aa(yo)({padding:"10px 16px"}),uW=Aa.div({minHeight:"200px"}),Nx=()=>{let{reviewDetailTab:e,setReviewDetailTab:t,multiModelResults:n,selectedModels:r,userRole:o,roleOverride:i}=ce(),a=(i??o)==="admin",u=r.length>1||n&&Object.keys(n.byModel).length>1;return sW(()=>{!a&&(e==="chat"||e==="prompt")&&t("issues")},[a,e,t]),Lr.createElement(aW,null,Lr.createElement(lW,null,Lr.createElement(cW,null,a&&Lr.createElement(zx,{active:e==="prompt",onClick:()=>t("prompt")},"Prompt"),a&&Lr.createElement(zx,{active:e==="chat",onClick:()=>t("chat")},u?"Models":"Chat"),Lr.createElement(zx,{active:e==="issues",onClick:()=>t("issues")},"Issues"))),Lr.createElement(uW,null,a&&e==="chat"&&(u?Lr.createElement(yI,null):Lr.createElement(wx,null)),e==="issues"&&Lr.createElement(pF,null),a&&e==="prompt"&&Lr.createElement(Sx,null)))};Ce();import G,{useState as go,useRef as jx,useEffect as fW,useMemo as mW}from"react";import{styled as vt,useTheme as hW}from"storybook/theming";je();Oe();var eu={enableIssueTracking:!1,enableAutoFix:!1,enableFileModification:!1,enableMultiModelComparison:!0,enableBulkFixApplication:!1,enableFixUndo:!1,enableHoverHighlight:!0,enableEvaluationFixtures:!1,enableDebugMode:!1},Pa="uicopilot_feature_flags";function Ox(){try{let e=localStorage.getItem(Pa);if(e){let t=JSON.parse(e);return{...eu,...t}}}catch(e){y.warn("[FeatureFlags] Failed to load from localStorage:",e)}return eu}function pW(e,t){try{let r={...Ox(),[e]:t},o={};for(let i in r){let s=i;r[s]!==eu[s]&&(o[s]=r[s])}Object.keys(o).length>0?localStorage.setItem(Pa,JSON.stringify(o)):localStorage.removeItem(Pa),y.debug(`[FeatureFlags] Set ${e} = ${t}`)}catch(n){y.error("[FeatureFlags] Failed to set flag:",n)}}function dW(){try{localStorage.removeItem(Pa),y.debug("[FeatureFlags] Reset to defaults")}catch(e){y.error("[FeatureFlags] Failed to reset:",e)}}function _x(e){return Ox()[e]}function gW(){let e=Object.keys(eu).reduce((t,n)=>({...t,[n]:!0}),{});try{localStorage.setItem(Pa,JSON.stringify(e)),y.debug("[FeatureFlags] All features enabled! Reload to apply.")}catch(t){y.error("[FeatureFlags] Failed to enable all features:",t)}}typeof window<"u"&&(window.uicopilot={...window.uicopilot,featureFlags:{get:Ox,set:pW,reset:dW,enableAll:gW,isEnabled:_x}});Oe();ct();import At from"react";var dF=()=>At.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},At.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),At.createElement("circle",{cx:"12",cy:"12",r:"3"}));var La={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},tu=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),gF=()=>At.createElement("svg",{...La},At.createElement("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.71 1.71"}),At.createElement("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),At.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),At.createElement("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),At.createElement("line",{x1:"16",y1:"22",x2:"16",y2:"19"}),At.createElement("line",{x1:"22",y1:"16",x2:"19",y2:"16"})),fF=()=>At.createElement("svg",{...La},At.createElement("polyline",{points:"23 4 23 10 17 10"}),At.createElement("polyline",{points:"1 20 1 14 7 14"}),At.createElement("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})),$x=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"})),Ux=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"}));var Ma=vt.div({marginTop:"20px"}),Hx=vt.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",flexWrap:"wrap",gap:"8px"}),Wx=vt.div({display:"flex",alignItems:"center",gap:"12px"}),Ba=vt.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),lme=vt.div({display:"flex",gap:"8px"}),cme=vt.button(({active:e,theme:t})=>({padding:"4px 12px",backgroundColor:e?t.color.secondary:"transparent",color:e?"#fff":t.color.mediumdark,border:`1px solid ${e?t.color.secondary:t.appBorderColor}`,borderRadius:"4px",fontSize:"11px",fontWeight:500,cursor:"pointer",transition:"all 0.2s","&:hover":{opacity:.9}})),mF=vt.div(({theme:e,layout:t})=>({display:t==="side-by-side"?"grid":"flex",gridTemplateColumns:t==="side-by-side"?"minmax(0, 1fr) minmax(0, 1fr)":void 0,gap:t==="side-by-side"?`${e.layoutMargin}px`:0,position:"relative",width:"100%",justifyContent:t==="overlay"?"center":void 0})),nu=vt.div(({theme:e,zoomed:t})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,overflow:"hidden",backgroundColor:e.background.app,minHeight:"60px",maxHeight:t?"400px":"150px",display:"flex",alignItems:"center",justifyContent:"center",transition:"max-height 0.2s ease, box-shadow 0.2s ease",boxShadow:t?"0 8px 30px rgba(0, 0, 0, 0.15)":"none","& img":t?{maxWidth:"100%",maxHeight:"400px"}:void 0})),ru=vt.div(({theme:e})=>({position:"absolute",top:"6px",left:"6px",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.92)":"rgba(0, 0, 0, 0.7)",color:e.base==="dark"?"#0a0a0f":e.color.inverseText,padding:"3px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,zIndex:10})),ou=vt.div({position:"absolute",top:"6px",right:"6px",display:"flex",gap:"4px",zIndex:10}),gi=vt.button(({theme:e,accent:t})=>({width:"24px",height:"24px",padding:"0",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.12)":"rgba(255, 255, 255, 0.92)",border:`1px solid ${t}55`,borderRadius:e.appBorderRadius,color:t,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",backdropFilter:"blur(4px)","&:hover:not(:disabled)":{backgroundColor:t,color:"#ffffff",borderColor:t},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),xW=vt.img(({opacity:e=1})=>({maxWidth:"150px",maxHeight:"150px",height:"auto",display:"block",objectFit:"contain",opacity:e})),yW=vt.img({display:"block",objectFit:"contain",maxHeight:"150px",maxWidth:"150px"}),bW=vt.div({position:"relative",display:"inline-block",maxHeight:"150px",overflow:"hidden"}),ume=vt.svg(({isVisible:e})=>({position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",opacity:e?1:0,transition:"opacity 150ms ease-in",...!e&&{transition:"opacity 100ms ease-out"}})),SW=vt.div({position:"relative",display:"inline-block"}),pme=vt.div(({width:e,height:t,theme:n})=>({position:"relative",width:e?`${e}px`:"auto",height:t?`${t}px`:"auto",border:`1px solid ${n.appBorderColor}`,borderRadius:"4px",overflow:"hidden",backgroundColor:n.background.app})),wW=vt.img({display:"block",maxWidth:"100%",height:"auto",objectFit:"contain"}),vW=vt.img({position:"absolute",top:"0",left:"0",pointerEvents:"none"}),kW=vt.div({marginTop:"12px",display:"flex",alignItems:"center",gap:"12px"}),CW=vt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,minWidth:"80px"})),TW=vt.input({flex:1}),Vx=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"4px"})),dme=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),hF=vt.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"}),rs=vt.div(({theme:e})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content,minHeight:"80px",maxHeight:"120px",display:"flex",alignItems:"center",justifyContent:"center","&::before":{content:'""',position:"absolute",top:0,left:"-100%",width:"100%",height:"100%",background:e.base==="dark"?"linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent)":"linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent)",animation:"shimmer 1.5s ease-in-out infinite",pointerEvents:"none"},"@keyframes shimmer":{"0%":{left:"-100%"},"100%":{left:"100%"}}})),os=vt.div({textAlign:"center",zIndex:1}),is=vt.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTop:`3px solid ${e.color.secondary}`,borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"12px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),ss=vt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontWeight:500})),Gx=({isLoading:e=!1,isLoadingFigma:t=!1,isLoadingStorybook:n=!1})=>{let r=hW(),{currentMapping:o,loadingMapping:i}=nt(),{figmaImageUrl:s,storybookImageUrl:a,figmaDimensions:u,setFigmaImageUrl:c,hoveredIssueId:l,reviewHistory:d,currentReviewId:g}=ce(),{selectedProjectId:p}=Je(),{sessionToken:f}=we(),{openComponentBrowser:k}=Ws(),{hasMapping:T,deleteMapping:E,setCurrentMapping:I}=ni(),D=_x("enableHoverHighlight"),[R,$]=go("side-by-side"),[P,z]=go(.5),[x,w]=go(!1),[v,C]=go(!1),[m,F]=go(!1),[S,b]=go(!1),[A,L]=go(!1),B=async()=>{F(!1);try{let be=o?.id;be&&await E(be),I(null)}catch(be){y.error("[ScreenshotComparison] Failed to unlink:",be)}};fW(()=>{C(!1)},[s]);let[N,h]=go(null),[j,W]=go(null),M=jx(null),K=jx(null),ee=jx(null),ge=mW(()=>{if(!D||!l||!g)return null;let be=d.find(Te=>Te.id===g);return be?.issues&&be.issues.find(Te=>Te.id===l)||null},[l,g,d]),xe=be=>{let Te=be.currentTarget;C(!0),!gt.getState().figmaDimensions&&Te.naturalWidth&&Te.naturalHeight&&gt.getState().setFigmaDimensions({width:Te.naturalWidth,height:Te.naturalHeight}),requestAnimationFrame(()=>{if(K.current){let{clientWidth:Me,clientHeight:Ae}=K.current;Me&&Ae&&W({width:Me,height:Ae})}})},ae=()=>{requestAnimationFrame(()=>{if(M.current){let{clientWidth:be,clientHeight:Te}=M.current;be&&Te&&h({width:be,height:Te})}})},Ke=async()=>{if(!(!p||!f)){w(!0);try{let be=V();await ne(`${be}/api/figma/frames/invalidate?projectId=${p}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},credentials:"include"}),c(null),y.debug("Figma cache cleared, image will reload on next review")}catch(be){y.error("Failed to refresh Figma:",be)}finally{w(!1)}}};return e?G.createElement(Ma,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),G.createElement(hF,null,G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Figma..."))),G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Storybook..."))))):!s&&!a&&!o?i?G.createElement(Ma,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),G.createElement(hF,null,G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading..."))))):G.createElement(Ma,null,G.createElement(Ba,null,"Screenshot Comparison"),G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"20px 16px",lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u2728 This story isn't linked to a Figma frame yet"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the \u{1F50D} above to browse your Figma file and pick a matching frame. Once linked, run a Review to compare your code with the design.")))):!s&&!a?G.createElement(Ma,null,G.createElement(Ba,null,"Screenshot Comparison"),G.createElement(Vx,{style:{lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u{1F440} Ready to compare"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the ",G.createElement("strong",null,"Review")," button above to capture both the Figma frame and your Storybook component, then check for differences."))):G.createElement(Ma,{ref:ee},G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),R==="side-by-side"?G.createElement(mF,{layout:"side-by-side"},o&&s&&!t?G.createElement(nu,{zoomed:S},G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:()=>b(be=>!be),title:S?"Shrink preview":"Enlarge preview","aria-label":S?"Shrink preview":"Enlarge preview"},S?G.createElement(Ux,null):G.createElement($x,null)),T&&G.createElement(gi,{accent:r.color.secondary,onClick:k,title:"Browse Figma \u2014 change mapping","aria-label":"Browse Figma"},G.createElement(tu,null)),G.createElement(gi,{accent:r.color.positive,onClick:Ke,disabled:x,title:"Refresh Figma cache and reload image","aria-label":"Refresh Figma cache"},G.createElement(fF,null)),T&&G.createElement(gi,{accent:r.color.negative,onClick:()=>F(!0),title:"Unlink Figma mapping","aria-label":"Unlink Figma mapping"},G.createElement(gF,null))),G.createElement(bW,null,G.createElement(yW,{ref:K,src:s,alt:"Figma design",onLoad:xe,style:{opacity:v?1:0,transition:"opacity 150ms ease-in"}}))):!o&&!i?G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"16px"}},"No Figma mapping.")):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,t?"Refreshing Figma...":"Loading Figma..."))),a&&!n?G.createElement(nu,{zoomed:A},G.createElement(ru,null,"Storybook Component"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:()=>L(be=>!be),title:A?"Shrink preview":"Enlarge preview","aria-label":A?"Shrink preview":"Enlarge preview"},A?G.createElement(Ux,null):G.createElement($x,null))),G.createElement(xW,{ref:M,src:a,alt:"Storybook component",onLoad:ae})):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,n?"Refreshing Storybook...":"Loading Storybook...")))):G.createElement(G.Fragment,null,G.createElement(mF,{layout:"overlay"},G.createElement(SW,null,s&&a?G.createElement(G.Fragment,null,G.createElement("div",{style:{position:"relative",display:"inline-block",border:"1px solid #ccc",borderRadius:"4px",overflow:"hidden"}},G.createElement(wW,{ref:M,src:a,alt:"Storybook component",onLoad:ae,style:{maxHeight:"150px"}}),N&&G.createElement(vW,{src:s,alt:"Figma design overlay",style:{opacity:P,width:N.width,height:N.height,objectFit:"fill"}})),G.createElement("div",{style:{fontSize:"10px",color:r.color.mediumdark,marginTop:"8px",textAlign:"center"}},G.createElement("span",{style:{color:"#1ea7fd"}},"Storybook (base)")," + ",G.createElement("span",{style:{color:"#667eea"}},"Figma (overlay)"),N&&` \u2022 ${N.width}\xD7${N.height}px`)):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Images..."))))),a&&s&&G.createElement(kW,null,G.createElement(CW,null,"Figma Opacity:"),G.createElement(TW,{type:"range",min:"0",max:"1",step:"0.01",value:P,onChange:be=>z(parseFloat(be.target.value))}),G.createElement("span",null,Math.round(P*100),"%"))),G.createElement(_r,{isOpen:m,title:"Unlink Figma Mapping",message:"Unlink this story from its Figma mapping?",confirmLabel:"Unlink",variant:"danger",onConfirm:B,onCancel:()=>F(!1)}))};Ce();ct();var IW=as.div({height:"100%"}),qx=as.div({marginBottom:"20px"}),xF=as.div(({theme:e})=>({padding:"12px",backgroundColor:e.background.negative||"#fee2e2",border:`1px solid ${e.color.negative||"#fca5a5"}`,borderRadius:"6px",color:e.color.negative||"#991b1b",fontSize:"13px",marginBottom:"16px",display:"flex",alignItems:"flex-start",gap:"8px"})),yF=as.span({fontSize:"16px",flexShrink:0}),FW=as.div(({theme:e})=>({padding:"10px 12px",backgroundColor:`${e.color.warning}1a`,border:`1px solid ${e.color.warning}`,borderRadius:"6px",color:e.color.warning,fontSize:e.typography.size.s2,marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px",lineHeight:1.4})),bF=as.div({flex:1}),Yx=()=>{let{reviewError:e,getCurrentReview:t}=ce(),n=t(),{showComponentBrowser:r,closeComponentBrowser:o,figmaFileUrl:i}=Ws(),{selectedProjectId:s}=no(),{setCurrentMapping:a}=ni(),{currentStoryId:u,currentStoryName:c}=nt(),{isLoadingScreenshots:l,isLoadingFigma:d,isLoadingStorybook:g,screenshotError:p,setFigmaImageDirect:f}=ei(),k=async T=>{y.debug("[ReviewPanel] handleSelectFrame CALLED with frame:",T),y.debug("[ReviewPanel] frame.id:",T?.id);let E=gt.getState(),I=E.selectedProjectId,D=E.currentStoryId,R=E.currentStoryName,$=E.figmaFileUrl;y.debug("[ReviewPanel] selectedProjectId (from store):",I),y.debug("[ReviewPanel] currentStoryId (from store):",D),y.debug("[ReviewPanel] currentStoryName (from store):",R),T.thumbnail&&D&&(y.debug("[ReviewPanel] Setting Figma image directly BEFORE mapping save (instant display)"),f(D,T.id,T.thumbnail));try{let P=V(),z=localStorage.getItem("uicopilot_session_token");if(y.debug("[ReviewPanel] sessionToken exists:",!!z),y.debug("[ReviewPanel] dashboardUrl:",P),!z||!I||!D){y.error("[ReviewPanel] Missing required data for saving mapping:",{hasSessionToken:!!z,selectedProjectId:I,currentStoryId:D});return}let x=$?.match(/\/file\/([^\/]+)/)?.[1]||void 0;y.debug("[ReviewPanel] Making POST to /api/mappings with:",{projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x});let w=await ne(`${P}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x})});if(w.ok){let v=await w.json();v.mapping&&(a(v.mapping),T.thumbnail||(y.debug("[ReviewPanel] No thumbnail available, triggering fetch"),gt.getState().triggerScreenshotRefresh()),y.debug("[ReviewPanel] Mapping saved successfully:",v.mapping))}else{let v=await w.text();y.error("[ReviewPanel] Failed to save mapping:",v)}}catch(P){y.error("[ReviewPanel] Error saving mapping:",P)}};return Qt.createElement(IW,null,Qt.createElement(qx,null,Qt.createElement(yh,null)),e&&Qt.createElement(xF,null,Qt.createElement(yF,null,"\u26A0\uFE0F"),Qt.createElement(bF,null,e)),p&&Qt.createElement(xF,null,Qt.createElement(yF,null,"\u26A0\uFE0F"),Qt.createElement(bF,null,"Screenshot loading error: ",p)),n?.variantMismatch&&Qt.createElement(FW,null,Qt.createElement("span",{style:{fontSize:16,flexShrink:0}},"\u26A0"),Qt.createElement("span",null,Qt.createElement("strong",null,"Variant mismatch:")," Storybook is showing ",Qt.createElement("strong",null,n.storybookVariant)," but Figma frame is ",Qt.createElement("strong",null,n.figmaVariant),". Some differences may be expected.")),Qt.createElement(qx,null,Qt.createElement(Gx,{isLoading:l,isLoadingFigma:d,isLoadingStorybook:g})),Qt.createElement(qx,null,Qt.createElement(Nx,null)),Qt.createElement(Hi,{isOpen:r,onClose:o,onSelect:k,figmaFileUrl:i||"",projectId:s||void 0}))};Ce();Oe();je();ct();import{useEffect as SF,useState as EW,useRef as Kx,useCallback as AW}from"react";var PW=V(),LW=2e3;function wF(){let{sessionToken:e,usageData:t,setUsageData:n}=we(),[r,o]=EW(null),i=Kx(null),s=Kx(!1),a=Kx(0);SF(()=>{t?.creditBalance!==void 0&&i.current===null&&(i.current=t.creditBalance)},[t?.creditBalance]);let u=AW(()=>{o(null)},[]);return SF(()=>{if(!e)return;let c=async()=>{let d=Date.now();if(s.current||d-a.current<LW){y.debug("[useBalanceRefresh] Skipping refresh (debounced or in progress)");return}s.current=!0,a.current=d;try{y.debug("[useBalanceRefresh] Refreshing balance...");let g=await ne(`${PW}/api/addon/account`,{headers:{Authorization:`Bearer ${e}`}});if(g.ok){let p=await g.json(),f=p.creditBalance,k=i.current;if(k!==null&&f>k){let T=f-k;o({message:`Credits added! +${Math.floor(T)} credit(s)`,previousBalance:k,newBalance:f}),y.debug("[useBalanceRefresh] Credits added:",T)}i.current=f,n(p),y.debug("[useBalanceRefresh] Balance updated:",f)}}catch(g){y.error("[useBalanceRefresh] Failed to refresh:",g)}finally{s.current=!1}},l=()=>{document.visibilityState==="visible"&&c()};return document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l)}},[e,n]),{notification:r,dismissNotification:u}}Ce();Ce();je();Oe();ct();Lf();import{useEffect as MW,useRef as BW}from"react";var DW=300*1e3,vF="uicopilot_feature_flags_fetched_at";function RW(){if(typeof localStorage>"u")return!1;try{let e=localStorage.getItem(vF);if(!e)return!1;let t=parseInt(e,10);return Number.isNaN(t)?!1:Date.now()-t<DW}catch{return!1}}var Xx=null,zW={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}};function kF(){let{setFeatureFlags:e,setUserRole:t,roleOverride:n}=ce(),{sessionToken:r,resetAuth:o}=we(),i=BW(null);MW(()=>{if(!r||r===i.current)return;if(i.current=r,RW()){y.debug("[useFeatureFlags] Cache fresh, skipping fetch");return}if(Xx){y.debug("[useFeatureFlags] Reusing in-flight fetch");return}let s=`${V()}/api/addon/flags`;Xx=ne(s,{headers:{Authorization:`Bearer ${r}`}}).then(a=>{if(a.status===401||a.status===403)throw y.debug("[useFeatureFlags] Token rejected, resetting auth"),o(),new Error("session token invalid");if(!a.ok)throw new Error(`flags endpoint returned ${a.status}`);return a.json()}).then(a=>{y.debug("[useFeatureFlags] Received flags:",a);let u={enableFixGeneration:!!a.enableFixGeneration,enableFixApply:!!a.enableFixApply,enableAutoMap:!!a.enableAutoMap,enableReviewBadges:!!a.enableReviewBadges,showCosts:!!a.showCosts,enableParallelReview:!!a.enableParallelReview,enableModelSelection:!!a.enableModelSelection};a.role&&(t(a.role),a.role==="beta"&&yw());let c=a.role==="admin"&&n?zW[n]:u;e(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c)),a.role&&localStorage.setItem("uicopilot_user_role",a.role),localStorage.setItem(vF,Date.now().toString())}catch{}}).catch(a=>{y.warn("[useFeatureFlags] Failed to fetch flags, using defaults:",a.message)}).finally(()=>{Xx=null})},[r,e,t])}Ce();je();Rn();var _W={success:"linear-gradient(135deg, #10b981 0%, #059669 100%)",warning:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",error:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)"},$W=xr.div`
166
+ `;try{await navigator.clipboard.writeText(ie+me),T(!0),setTimeout(()=>T(!1),2e3)}catch(O){y.error("Failed to copy dismissed issues:",O)}};return We.createElement(R8,null,Me&&We.createElement(z8,null,We.createElement(N8,null,"\u{1F4CA} Progress:"),We.createElement(Bx,{variant:"resolved"},"\u2705 ",Me.resolved," resolved"),We.createElement(Bx,{variant:"remaining"},"\u23F3 ",Me.remaining," remaining"),Me.newIssues>0&&We.createElement(Bx,{variant:"new"},"\u{1F195} ",Me.newIssues," new"),We.createElement(O8,null,"Iteration ",S?.iterationNumber||1)),We.createElement(Dx,null,We.createElement(lF,{issues:N,modelId:h,complianceScore:K,visualSimilarity:ee,costUsd:ge,reviewDurationMs:xe,inputTokens:ae,outputTokens:Ke,cacheCreationTokens:be,cacheReadTokens:Te,onToggleSelection:o,onSelectAll:Ae,onSelectNone:pe,onSelectAllFixes:Pt,onGenerateFixes:Mr,onApplyFixes:fe,onApplyFix:tt,onCopyAllFixes:he,onDismiss:a,onUndismiss:u,isGenerating:$,isApplying:F,isCopying:p,applyFixesResult:i,onDismissResult:()=>s(null),generationTiming:z,generationUsage:w,hasReviewBeenRun:!!S,isLoadingReview:l,isReviewing:n,generationProgress:x,autoApplySupported:E,selfReview:v})),L.length>0&&We.createElement(_8,null,We.createElement($8,null,We.createElement(U8,{onClick:()=>g(!d)},We.createElement("span",null,d?"\u25BC":"\u25B6"),We.createElement("span",null,"Filtered out"),We.createElement(H8,null,L.length),We.createElement(eW,null,B.postAiValidation>0&&We.createElement("span",null,"\u2699\uFE0F ",B.postAiValidation),B.aiValidation>0&&We.createElement("span",null,"\u2726 ",B.aiValidation),B.user>0&&We.createElement("span",null,"\u{1F464} ",B.user))),We.createElement(j8,{onClick:oe},k?"\u2713 Copied!":"Copy")),d&&We.createElement(W8,null,(()=>{let Y=L.reduce((O,U)=>{let H=J8(U.dismissReason);return O[H]||(O[H]=[]),O[H].push(U),O},{}),me=["HUG/FILL Sizing","Sub-pixel Differences","Values Match","No Fix Needed","Other"];return Object.keys(Y).sort((O,U)=>me.indexOf(O)-me.indexOf(U)).map(O=>We.createElement(We.Fragment,{key:O},We.createElement(X8,null,O,We.createElement(Q8,null,Y[O].length)),Y[O].map(U=>We.createElement(V8,{key:U.id},We.createElement(G8,null,We.createElement(Z8,{phase:U.dismissedBy||Rx(U.dismissReason)||"post-ai-validation"},tW(U.dismissedBy,U.dismissReason)," ",uF(U.dismissedBy,U.dismissReason)),We.createElement(q8,{onClick:()=>u(U.id),title:"Restore to active issues"},"\u21A9 Restore")),We.createElement(Y8,null,"[",U.severity.toUpperCase(),"]"," ",U.title||U.description),U.dismissReason&&We.createElement(K8,null,cF(U.dismissReason))))))})())))};var aW=Aa.div({marginTop:"20px"}),lW=Aa.div(({theme:e})=>({display:"flex",alignItems:"center",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),cW=Aa.div({display:"flex",alignItems:"center"}),zx=Aa(yo)({padding:"10px 16px"}),uW=Aa.div({minHeight:"200px"}),Nx=()=>{let{reviewDetailTab:e,setReviewDetailTab:t,multiModelResults:n,selectedModels:r,userRole:o,roleOverride:i}=ce(),a=(i??o)==="admin",u=r.length>1||n&&Object.keys(n.byModel).length>1;return sW(()=>{!a&&(e==="chat"||e==="prompt")&&t("issues")},[a,e,t]),Lr.createElement(aW,null,Lr.createElement(lW,null,Lr.createElement(cW,null,a&&Lr.createElement(zx,{active:e==="prompt",onClick:()=>t("prompt")},"Prompt"),a&&Lr.createElement(zx,{active:e==="chat",onClick:()=>t("chat")},u?"Models":"Chat"),Lr.createElement(zx,{active:e==="issues",onClick:()=>t("issues")},"Issues"))),Lr.createElement(uW,null,a&&e==="chat"&&(u?Lr.createElement(yI,null):Lr.createElement(wx,null)),e==="issues"&&Lr.createElement(pF,null),a&&e==="prompt"&&Lr.createElement(Sx,null)))};Ce();import G,{useState as go,useRef as jx,useEffect as fW,useMemo as mW}from"react";import{styled as vt,useTheme as hW}from"storybook/theming";je();Oe();var eu={enableIssueTracking:!1,enableAutoFix:!1,enableFileModification:!1,enableMultiModelComparison:!0,enableBulkFixApplication:!1,enableFixUndo:!1,enableHoverHighlight:!0,enableEvaluationFixtures:!1,enableDebugMode:!1},Pa="uicopilot_feature_flags";function Ox(){try{let e=localStorage.getItem(Pa);if(e){let t=JSON.parse(e);return{...eu,...t}}}catch(e){y.warn("[FeatureFlags] Failed to load from localStorage:",e)}return eu}function pW(e,t){try{let r={...Ox(),[e]:t},o={};for(let i in r){let s=i;r[s]!==eu[s]&&(o[s]=r[s])}Object.keys(o).length>0?localStorage.setItem(Pa,JSON.stringify(o)):localStorage.removeItem(Pa),y.debug(`[FeatureFlags] Set ${e} = ${t}`)}catch(n){y.error("[FeatureFlags] Failed to set flag:",n)}}function dW(){try{localStorage.removeItem(Pa),y.debug("[FeatureFlags] Reset to defaults")}catch(e){y.error("[FeatureFlags] Failed to reset:",e)}}function _x(e){return Ox()[e]}function gW(){let e=Object.keys(eu).reduce((t,n)=>({...t,[n]:!0}),{});try{localStorage.setItem(Pa,JSON.stringify(e)),y.debug("[FeatureFlags] All features enabled! Reload to apply.")}catch(t){y.error("[FeatureFlags] Failed to enable all features:",t)}}typeof window<"u"&&(window.uicopilot={...window.uicopilot,featureFlags:{get:Ox,set:pW,reset:dW,enableAll:gW,isEnabled:_x}});Oe();ct();import At from"react";var dF=()=>At.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},At.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),At.createElement("circle",{cx:"12",cy:"12",r:"3"}));var La={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},tu=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),gF=()=>At.createElement("svg",{...La},At.createElement("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.71 1.71"}),At.createElement("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),At.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),At.createElement("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),At.createElement("line",{x1:"16",y1:"22",x2:"16",y2:"19"}),At.createElement("line",{x1:"22",y1:"16",x2:"19",y2:"16"})),fF=()=>At.createElement("svg",{...La},At.createElement("polyline",{points:"23 4 23 10 17 10"}),At.createElement("polyline",{points:"1 20 1 14 7 14"}),At.createElement("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})),$x=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"})),Ux=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"}));var Ma=vt.div({marginTop:"20px"}),Hx=vt.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",flexWrap:"wrap",gap:"8px"}),Wx=vt.div({display:"flex",alignItems:"center",gap:"12px"}),Ba=vt.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),lme=vt.div({display:"flex",gap:"8px"}),cme=vt.button(({active:e,theme:t})=>({padding:"4px 12px",backgroundColor:e?t.color.secondary:"transparent",color:e?"#fff":t.color.mediumdark,border:`1px solid ${e?t.color.secondary:t.appBorderColor}`,borderRadius:"4px",fontSize:"11px",fontWeight:500,cursor:"pointer",transition:"all 0.2s","&:hover":{opacity:.9}})),mF=vt.div(({theme:e,layout:t})=>({display:t==="side-by-side"?"grid":"flex",gridTemplateColumns:t==="side-by-side"?"minmax(0, 1fr) minmax(0, 1fr)":void 0,gap:t==="side-by-side"?`${e.layoutMargin}px`:0,position:"relative",width:"100%",justifyContent:t==="overlay"?"center":void 0})),nu=vt.div(({theme:e,zoomed:t})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,overflow:"hidden",backgroundColor:e.background.app,minHeight:"60px",maxHeight:t?"400px":"150px",display:"flex",alignItems:"center",justifyContent:"center",transition:"max-height 0.2s ease, box-shadow 0.2s ease",boxShadow:t?"0 8px 30px rgba(0, 0, 0, 0.15)":"none","& img":t?{maxWidth:"100%",maxHeight:"400px"}:void 0})),ru=vt.div(({theme:e})=>({position:"absolute",top:"6px",left:"6px",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.92)":"rgba(0, 0, 0, 0.7)",color:e.base==="dark"?"#0a0a0f":e.color.inverseText,padding:"3px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,zIndex:10})),ou=vt.div({position:"absolute",top:"6px",right:"6px",display:"flex",gap:"4px",zIndex:10}),gi=vt.button(({theme:e,accent:t})=>({width:"24px",height:"24px",padding:"0",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.12)":"rgba(255, 255, 255, 0.92)",border:`1px solid ${t}55`,borderRadius:e.appBorderRadius,color:t,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",backdropFilter:"blur(4px)","&:hover:not(:disabled)":{backgroundColor:t,color:"#ffffff",borderColor:t},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),xW=vt.img(({opacity:e=1})=>({maxWidth:"150px",maxHeight:"150px",height:"auto",display:"block",objectFit:"contain",opacity:e})),yW=vt.img({display:"block",objectFit:"contain",maxHeight:"150px",maxWidth:"150px"}),bW=vt.div({position:"relative",display:"inline-block",maxHeight:"150px",overflow:"hidden"}),ume=vt.svg(({isVisible:e})=>({position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",opacity:e?1:0,transition:"opacity 150ms ease-in",...!e&&{transition:"opacity 100ms ease-out"}})),SW=vt.div({position:"relative",display:"inline-block"}),pme=vt.div(({width:e,height:t,theme:n})=>({position:"relative",width:e?`${e}px`:"auto",height:t?`${t}px`:"auto",border:`1px solid ${n.appBorderColor}`,borderRadius:"4px",overflow:"hidden",backgroundColor:n.background.app})),wW=vt.img({display:"block",maxWidth:"100%",height:"auto",objectFit:"contain"}),vW=vt.img({position:"absolute",top:"0",left:"0",pointerEvents:"none"}),kW=vt.div({marginTop:"12px",display:"flex",alignItems:"center",gap:"12px"}),CW=vt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,minWidth:"80px"})),TW=vt.input({flex:1}),Vx=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"4px"})),dme=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),hF=vt.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"}),rs=vt.div(({theme:e})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content,minHeight:"80px",maxHeight:"120px",display:"flex",alignItems:"center",justifyContent:"center","&::before":{content:'""',position:"absolute",top:0,left:"-100%",width:"100%",height:"100%",background:e.base==="dark"?"linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent)":"linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent)",animation:"shimmer 1.5s ease-in-out infinite",pointerEvents:"none"},"@keyframes shimmer":{"0%":{left:"-100%"},"100%":{left:"100%"}}})),os=vt.div({textAlign:"center",zIndex:1}),is=vt.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTop:`3px solid ${e.color.secondary}`,borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"12px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),ss=vt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontWeight:500})),Gx=({isLoading:e=!1,isLoadingFigma:t=!1,isLoadingStorybook:n=!1})=>{let r=hW(),{currentMapping:o,loadingMapping:i}=nt(),{figmaImageUrl:s,storybookImageUrl:a,figmaDimensions:u,setFigmaImageUrl:c,hoveredIssueId:l,reviewHistory:d,currentReviewId:g}=ce(),{selectedProjectId:p}=Je(),{sessionToken:f}=we(),{openComponentBrowser:k}=Ws(),{hasMapping:T,deleteMapping:E,setCurrentMapping:I}=ni(),D=_x("enableHoverHighlight"),[R,$]=go("side-by-side"),[P,z]=go(.5),[x,w]=go(!1),[v,C]=go(!1),[m,F]=go(!1),[S,b]=go(!1),[A,L]=go(!1),B=async()=>{F(!1);try{let be=o?.id;be&&await E(be),I(null)}catch(be){y.error("[ScreenshotComparison] Failed to unlink:",be)}};fW(()=>{C(!1)},[s]);let[N,h]=go(null),[j,W]=go(null),M=jx(null),K=jx(null),ee=jx(null),ge=mW(()=>{if(!D||!l||!g)return null;let be=d.find(Te=>Te.id===g);return be?.issues&&be.issues.find(Te=>Te.id===l)||null},[l,g,d]),xe=be=>{let Te=be.currentTarget;C(!0),!gt.getState().figmaDimensions&&Te.naturalWidth&&Te.naturalHeight&&gt.getState().setFigmaDimensions({width:Te.naturalWidth,height:Te.naturalHeight}),requestAnimationFrame(()=>{if(K.current){let{clientWidth:Me,clientHeight:Ae}=K.current;Me&&Ae&&W({width:Me,height:Ae})}})},ae=()=>{requestAnimationFrame(()=>{if(M.current){let{clientWidth:be,clientHeight:Te}=M.current;be&&Te&&h({width:be,height:Te})}})},Ke=async()=>{if(!(!p||!f)){w(!0);try{let be=V();await ne(`${be}/api/figma/frames/invalidate?projectId=${p}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},credentials:"include"}),c(null),y.debug("Figma cache cleared, image will reload on next review")}catch(be){y.error("Failed to refresh Figma:",be)}finally{w(!1)}}};return e?G.createElement(Ma,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),G.createElement(hF,null,G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Figma..."))),G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Storybook..."))))):!s&&!a&&!o?i?G.createElement(Ma,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),G.createElement(hF,null,G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading..."))))):G.createElement(Ma,null,G.createElement(Ba,null,"Screenshot Comparison"),G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"20px 16px",lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u2728 This story isn't linked to a Figma frame yet"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the \u{1F50D} above to browse your Figma file and pick a matching frame. Once linked, run a Review to compare your code with the design.")))):!s&&!a?G.createElement(Ma,null,G.createElement(Ba,null,"Screenshot Comparison"),G.createElement(Vx,{style:{lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u{1F440} Ready to compare"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the ",G.createElement("strong",null,"Review")," button above to capture both the Figma frame and your Storybook component, then check for differences."))):G.createElement(Ma,{ref:ee},G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),R==="side-by-side"?G.createElement(mF,{layout:"side-by-side"},o&&s&&!t?G.createElement(nu,{zoomed:S},G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:()=>b(be=>!be),title:S?"Shrink preview":"Enlarge preview","aria-label":S?"Shrink preview":"Enlarge preview"},S?G.createElement(Ux,null):G.createElement($x,null)),T&&G.createElement(gi,{accent:r.color.secondary,onClick:k,title:"Browse Figma \u2014 change mapping","aria-label":"Browse Figma"},G.createElement(tu,null)),G.createElement(gi,{accent:r.color.positive,onClick:Ke,disabled:x,title:"Refresh Figma cache and reload image","aria-label":"Refresh Figma cache"},G.createElement(fF,null)),T&&G.createElement(gi,{accent:r.color.negative,onClick:()=>F(!0),title:"Unlink Figma mapping","aria-label":"Unlink Figma mapping"},G.createElement(gF,null))),G.createElement(bW,null,G.createElement(yW,{ref:K,src:s,alt:"Figma design",onLoad:xe,style:{opacity:v?1:0,transition:"opacity 150ms ease-in"}}))):!o&&!i?G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"16px"}},"No Figma mapping.")):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,t?"Refreshing Figma...":"Loading Figma..."))),a&&!n?G.createElement(nu,{zoomed:A},G.createElement(ru,null,"Storybook Component"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:()=>L(be=>!be),title:A?"Shrink preview":"Enlarge preview","aria-label":A?"Shrink preview":"Enlarge preview"},A?G.createElement(Ux,null):G.createElement($x,null))),G.createElement(xW,{ref:M,src:a,alt:"Storybook component",onLoad:ae})):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,n?"Refreshing Storybook...":"Loading Storybook...")))):G.createElement(G.Fragment,null,G.createElement(mF,{layout:"overlay"},G.createElement(SW,null,s&&a?G.createElement(G.Fragment,null,G.createElement("div",{style:{position:"relative",display:"inline-block",border:"1px solid #ccc",borderRadius:"4px",overflow:"hidden"}},G.createElement(wW,{ref:M,src:a,alt:"Storybook component",onLoad:ae,style:{maxHeight:"150px"}}),N&&G.createElement(vW,{src:s,alt:"Figma design overlay",style:{opacity:P,width:N.width,height:N.height,objectFit:"fill"}})),G.createElement("div",{style:{fontSize:"10px",color:r.color.mediumdark,marginTop:"8px",textAlign:"center"}},G.createElement("span",{style:{color:"#1ea7fd"}},"Storybook (base)")," + ",G.createElement("span",{style:{color:"#667eea"}},"Figma (overlay)"),N&&` \u2022 ${N.width}\xD7${N.height}px`)):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Images..."))))),a&&s&&G.createElement(kW,null,G.createElement(CW,null,"Figma Opacity:"),G.createElement(TW,{type:"range",min:"0",max:"1",step:"0.01",value:P,onChange:be=>z(parseFloat(be.target.value))}),G.createElement("span",null,Math.round(P*100),"%"))),G.createElement(_r,{isOpen:m,title:"Unlink Figma Mapping",message:"Unlink this story from its Figma mapping?",confirmLabel:"Unlink",variant:"danger",onConfirm:B,onCancel:()=>F(!1)}))};Ce();ct();var IW=as.div({height:"100%"}),qx=as.div({marginBottom:"20px"}),xF=as.div(({theme:e})=>({padding:"12px",backgroundColor:e.background.negative||"#fee2e2",border:`1px solid ${e.color.negative||"#fca5a5"}`,borderRadius:"6px",color:e.color.negative||"#991b1b",fontSize:"13px",marginBottom:"16px",display:"flex",alignItems:"flex-start",gap:"8px"})),yF=as.span({fontSize:"16px",flexShrink:0}),FW=as.div(({theme:e})=>({padding:"10px 12px",backgroundColor:`${e.color.warning}1a`,border:`1px solid ${e.color.warning}`,borderRadius:"6px",color:e.color.warning,fontSize:e.typography.size.s2,marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px",lineHeight:1.4})),bF=as.div({flex:1}),Yx=()=>{let{reviewError:e,getCurrentReview:t}=ce(),n=t(),{showComponentBrowser:r,closeComponentBrowser:o,figmaFileUrl:i}=Ws(),{selectedProjectId:s}=no(),{setCurrentMapping:a}=ni(),{currentStoryId:u,currentStoryName:c}=nt(),{isLoadingScreenshots:l,isLoadingFigma:d,isLoadingStorybook:g,screenshotError:p,setFigmaImageDirect:f}=ei(),k=async T=>{y.debug("[ReviewPanel] handleSelectFrame CALLED with frame:",T),y.debug("[ReviewPanel] frame.id:",T?.id);let E=gt.getState(),I=E.selectedProjectId,D=E.currentStoryId,R=E.currentStoryName,$=E.figmaFileUrl;y.debug("[ReviewPanel] selectedProjectId (from store):",I),y.debug("[ReviewPanel] currentStoryId (from store):",D),y.debug("[ReviewPanel] currentStoryName (from store):",R),T.thumbnail&&D&&(y.debug("[ReviewPanel] Setting Figma image directly BEFORE mapping save (instant display)"),f(D,T.id,T.thumbnail));try{let P=V(),z=localStorage.getItem("uicopilot_session_token");if(y.debug("[ReviewPanel] sessionToken exists:",!!z),y.debug("[ReviewPanel] dashboardUrl:",P),!z||!I||!D){y.error("[ReviewPanel] Missing required data for saving mapping:",{hasSessionToken:!!z,selectedProjectId:I,currentStoryId:D});return}let x=$?.match(/\/file\/([^\/]+)/)?.[1]||void 0;y.debug("[ReviewPanel] Making POST to /api/mappings with:",{projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x});let w=await ne(`${P}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x})});if(w.ok){let v=await w.json();v.mapping&&(a(v.mapping),T.thumbnail||(y.debug("[ReviewPanel] No thumbnail available, triggering fetch"),gt.getState().triggerScreenshotRefresh()),y.debug("[ReviewPanel] Mapping saved successfully:",v.mapping))}else{let v=await w.text();y.error("[ReviewPanel] Failed to save mapping:",v)}}catch(P){y.error("[ReviewPanel] Error saving mapping:",P)}};return Qt.createElement(IW,null,Qt.createElement(qx,null,Qt.createElement(yh,null)),e&&Qt.createElement(xF,null,Qt.createElement(yF,null,"\u26A0\uFE0F"),Qt.createElement(bF,null,e)),p&&Qt.createElement(xF,null,Qt.createElement(yF,null,"\u26A0\uFE0F"),Qt.createElement(bF,null,"Screenshot loading error: ",p)),n?.variantMismatch&&Qt.createElement(FW,null,Qt.createElement("span",{style:{fontSize:16,flexShrink:0}},"\u26A0"),Qt.createElement("span",null,Qt.createElement("strong",null,"Variant mismatch:")," Storybook is showing ",Qt.createElement("strong",null,n.storybookVariant)," but Figma frame is ",Qt.createElement("strong",null,n.figmaVariant),". Some differences may be expected.")),Qt.createElement(qx,null,Qt.createElement(Gx,{isLoading:l,isLoadingFigma:d,isLoadingStorybook:g})),Qt.createElement(qx,null,Qt.createElement(Nx,null)),Qt.createElement(Hi,{isOpen:r,onClose:o,onSelect:k,figmaFileUrl:i||"",projectId:s||void 0}))};Ce();Oe();je();ct();import{useEffect as SF,useState as EW,useRef as Kx,useCallback as AW}from"react";var PW=V(),LW=2e3;function wF(){let{sessionToken:e,usageData:t,setUsageData:n}=we(),[r,o]=EW(null),i=Kx(null),s=Kx(!1),a=Kx(0);SF(()=>{t?.creditBalance!==void 0&&i.current===null&&(i.current=t.creditBalance)},[t?.creditBalance]);let u=AW(()=>{o(null)},[]);return SF(()=>{if(!e)return;let c=async()=>{let d=Date.now();if(s.current||d-a.current<LW){y.debug("[useBalanceRefresh] Skipping refresh (debounced or in progress)");return}s.current=!0,a.current=d;try{y.debug("[useBalanceRefresh] Refreshing balance...");let g=await ne(`${PW}/api/addon/account`,{headers:{Authorization:`Bearer ${e}`}});if(g.ok){let p=await g.json(),f=p.creditBalance,k=i.current;if(k!==null&&f>k){let T=f-k;o({message:`Credits added! +${Math.floor(T)} credit(s)`,previousBalance:k,newBalance:f}),y.debug("[useBalanceRefresh] Credits added:",T)}i.current=f,n(p),y.debug("[useBalanceRefresh] Balance updated:",f)}}catch(g){y.error("[useBalanceRefresh] Failed to refresh:",g)}finally{s.current=!1}},l=()=>{document.visibilityState==="visible"&&c()};return document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l)}},[e,n]),{notification:r,dismissNotification:u}}Ce();Ce();je();Oe();ct();Lf();import{useEffect as MW,useRef as BW}from"react";var DW=300*1e3,vF="uicopilot_feature_flags_fetched_at";function RW(){if(typeof localStorage>"u")return!1;try{let e=localStorage.getItem(vF);if(!e)return!1;let t=parseInt(e,10);return Number.isNaN(t)?!1:Date.now()-t<DW}catch{return!1}}var Xx=null,zW={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}};function kF(){let{setFeatureFlags:e,setUserRole:t,roleOverride:n}=ce(),{sessionToken:r,resetAuth:o}=we(),i=BW(null);MW(()=>{if(!r||r===i.current)return;if(i.current=r,RW()){y.debug("[useFeatureFlags] Cache fresh, skipping fetch");return}if(Xx){y.debug("[useFeatureFlags] Reusing in-flight fetch");return}let s=`${V()}/api/addon/flags`;Xx=ne(s,{headers:{Authorization:`Bearer ${r}`}}).then(a=>{if(a.status===401||a.status===403)throw y.debug("[useFeatureFlags] Token rejected, resetting auth"),o(),new Error("session token invalid");if(!a.ok)throw new Error(`flags endpoint returned ${a.status}`);return a.json()}).then(a=>{y.debug("[useFeatureFlags] Received flags:",a);let u={enableFixGeneration:!!a.enableFixGeneration,enableFixApply:!!a.enableFixApply,enableAutoMap:!!a.enableAutoMap,enableReviewBadges:!!a.enableReviewBadges,showCosts:!!a.showCosts,enableParallelReview:!!a.enableParallelReview,enableModelSelection:!!a.enableModelSelection};a.role&&(t(a.role),a.role==="beta"&&yw());let c=a.role==="admin"&&n?zW[n]:u;e(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c)),a.role&&localStorage.setItem("uicopilot_user_role",a.role),localStorage.setItem(vF,Date.now().toString())}catch{}}).catch(a=>{y.warn("[useFeatureFlags] Failed to fetch flags, using defaults:",a.message)}).finally(()=>{Xx=null})},[r,e,t])}Ce();je();Rn();var _W={success:"linear-gradient(135deg, #10b981 0%, #059669 100%)",warning:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",error:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)"},$W=xr.div`
167
167
  position: fixed;
168
168
  top: 16px;
169
169
  right: 16px;
@@ -215,7 +215,7 @@ ${"=".repeat(40)}
215
215
  color: ${({theme:e})=>e.color.mediumdark};
216
216
  text-align: center;
217
217
  opacity: 0.7;
218
- `,VW=xr.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center",gap:"16px"})),GW=xr.div({fontSize:"32px"}),qW=xr.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),YW=xr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark,maxWidth:"320px",lineHeight:1.5})),CF=xr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",margin:"8px 12px",backgroundColor:`${e.color.warning}15`,border:`1px solid ${e.color.warning}50`,borderRadius:e.appBorderRadius,fontSize:e.typography.size.s2,color:e.color.defaultText})),TF=xr.span({flex:1}),IF=xr.button(({theme:e})=>({padding:"4px 12px",fontSize:11,fontWeight:600,border:`1px solid ${e.color.warning}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.warning,cursor:"pointer",whiteSpace:"nowrap","&:hover":{backgroundColor:`${e.color.warning}15`}})),FF=()=>{let{selectedProjectId:e,projects:t,loadingProjects:n}=Je(),{isConnected:r,sessionToken:o,authError:i}=we(),{currentStoryId:s}=nt(),{currentReviewId:a,userRole:u,roleOverride:c,setRoleOverride:l,setFeatureFlags:d}=ce(),[g,p]=NW(!1),f=()=>{l(null),o&&fetch(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(P=>P.json()).then(P=>{d({enableFixGeneration:!!P.enableFixGeneration,enableFixApply:!!P.enableFixApply,enableAutoMap:!!P.enableAutoMap,enableReviewBadges:!!P.enableReviewBadges,showCosts:!!P.showCosts,enableParallelReview:!!P.enableParallelReview,enableModelSelection:!!P.enableModelSelection})}).catch(()=>{})};mm(),Mm(),kF(),Cm(),wm();let{notification:k,dismissNotification:T}=wF();OW(()=>{if(k){let P=setTimeout(T,5e3);return()=>clearTimeout(P)}},[k,T]);let E=t.find(P=>P.id===e),I=r&&!!e&&!!E,D=!!o&&!!e&&(n||t.length===0),{loadingMapping:R}=nt(),$=I&&!!s&&!a&&R;return Dt.createElement(gu,{header:Dt.createElement(fu,{toolbar:Dt.createElement(_f,{onOpenSettings:()=>p(!0)})}),footer:Dt.createElement(WW,null,Ft.NAME," v","0.5.16")},k&&Dt.createElement($W,{variant:k.variant||"success"},Dt.createElement(UW,null,k.variant==="error"?"!":k.variant==="warning"?"\u26A0":"+"),Dt.createElement(jW,null,k.message),Dt.createElement(HW,{onClick:T},"x")),i&&Dt.createElement(CF,null,Dt.createElement("span",null,"\u26A0"),Dt.createElement(TF,null,i),Dt.createElement(IF,{onClick:()=>p(!0)},"Reconnect")),u==="admin"&&c&&Dt.createElement(CF,null,Dt.createElement("span",null,"\u{1F441}"),Dt.createElement(TF,null,"Previewing as ",c),Dt.createElement(IF,{onClick:f},"Exit preview")),D||$?Dt.createElement(Xc,{label:D?"Loading...":"Loading review..."}):I?Dt.createElement(Yx,null):Dt.createElement(VW,null,Dt.createElement(GW,null,"\u2699"),Dt.createElement(qW,null,i?"Connection issue":`Set up ${Ft.NAME}`),Dt.createElement(YW,null,i?"Session expired or dashboard unreachable. Please reconnect.":"Connect your account and select a project to start reviewing your components against Figma designs."),Dt.createElement(Yt,{onClick:()=>p(!0)},i?"Reconnect":"Open Settings")),g&&Dt.createElement(JC,{onClose:()=>p(!1)}))};import EF,{useCallback as KW}from"react";import{useStorybookApi as XW}from"storybook/manager-api";import{IconButton as QW}from"storybook/internal/components";var JW="uireview",ZW=`${JW}/panel`,AF=()=>{let e=XW(),t=KW(()=>{e.togglePanel(!0),e.setSelectedPanel(ZW)},[e]);return EF.createElement(QW,{key:"uireview-tool",title:"UI Review - Compare with Figma",onClick:t},EF.createElement(dF,null))};Ce();import Gt,{useState as Na,useCallback as BF,useEffect as ey}from"react";import{styled as fo,useTheme as uV}from"storybook/theming";import{addons as au}from"storybook/manager-api";je();Oe();import{addons as iV,experimental_getStatusStore as su}from"storybook/manager-api";async function PF(e,t,n,r){let o=new Array(e.length),i=0;async function s(){for(;i<e.length&&!r();){let a=i++;try{let u=await e[a]();o[a]=u,r()||n(a,u)}catch(u){o[a]=u,r()||n(a,u)}}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>s())),o}je();Oe();var eV=V(),tV="uireview/badge";async function nV(e,t,n=3){for(let r=0;r<=n;r++){let o=await fetch(e,t);if(o.status!==429||r===n)return o;let i=Math.pow(2,r)*1e3;y.warn(`[reviewAll] Rate limited, retrying in ${i}ms`),await new Promise(s=>setTimeout(s,i))}throw new Error("Max retries exceeded")}async function rV(e,t){let n=new TextDecoder,r="",o=null,i=0,s=0,a=0,u=0,c=0,l=0;for(;;){let{done:d,value:g}=await e.read();if(d)break;if(t()){e.cancel();break}r+=n.decode(g,{stream:!0});let p=r.split(`
218
+ `,VW=xr.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center",gap:"16px"})),GW=xr.div({fontSize:"32px"}),qW=xr.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),YW=xr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark,maxWidth:"320px",lineHeight:1.5})),CF=xr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",margin:"8px 12px",backgroundColor:`${e.color.warning}15`,border:`1px solid ${e.color.warning}50`,borderRadius:e.appBorderRadius,fontSize:e.typography.size.s2,color:e.color.defaultText})),TF=xr.span({flex:1}),IF=xr.button(({theme:e})=>({padding:"4px 12px",fontSize:11,fontWeight:600,border:`1px solid ${e.color.warning}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.warning,cursor:"pointer",whiteSpace:"nowrap","&:hover":{backgroundColor:`${e.color.warning}15`}})),FF=()=>{let{selectedProjectId:e,projects:t,loadingProjects:n}=Je(),{isConnected:r,sessionToken:o,authError:i}=we(),{currentStoryId:s}=nt(),{currentReviewId:a,userRole:u,roleOverride:c,setRoleOverride:l,setFeatureFlags:d}=ce(),[g,p]=NW(!1),f=()=>{l(null),o&&fetch(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(P=>P.json()).then(P=>{d({enableFixGeneration:!!P.enableFixGeneration,enableFixApply:!!P.enableFixApply,enableAutoMap:!!P.enableAutoMap,enableReviewBadges:!!P.enableReviewBadges,showCosts:!!P.showCosts,enableParallelReview:!!P.enableParallelReview,enableModelSelection:!!P.enableModelSelection})}).catch(()=>{})};mm(),Mm(),kF(),Cm(),wm();let{notification:k,dismissNotification:T}=wF();OW(()=>{if(k){let P=setTimeout(T,5e3);return()=>clearTimeout(P)}},[k,T]);let E=t.find(P=>P.id===e),I=r&&!!e&&!!E,D=!!o&&!!e&&(n||t.length===0),{loadingMapping:R}=nt(),$=I&&!!s&&!a&&R;return Dt.createElement(gu,{header:Dt.createElement(fu,{toolbar:Dt.createElement(_f,{onOpenSettings:()=>p(!0)})}),footer:Dt.createElement(WW,null,Ft.NAME," v","0.5.17")},k&&Dt.createElement($W,{variant:k.variant||"success"},Dt.createElement(UW,null,k.variant==="error"?"!":k.variant==="warning"?"\u26A0":"+"),Dt.createElement(jW,null,k.message),Dt.createElement(HW,{onClick:T},"x")),i&&Dt.createElement(CF,null,Dt.createElement("span",null,"\u26A0"),Dt.createElement(TF,null,i),Dt.createElement(IF,{onClick:()=>p(!0)},"Reconnect")),u==="admin"&&c&&Dt.createElement(CF,null,Dt.createElement("span",null,"\u{1F441}"),Dt.createElement(TF,null,"Previewing as ",c),Dt.createElement(IF,{onClick:f},"Exit preview")),D||$?Dt.createElement(Xc,{label:D?"Loading...":"Loading review..."}):I?Dt.createElement(Yx,null):Dt.createElement(VW,null,Dt.createElement(GW,null,"\u2699"),Dt.createElement(qW,null,i?"Connection issue":`Set up ${Ft.NAME}`),Dt.createElement(YW,null,i?"Session expired or dashboard unreachable. Please reconnect.":"Connect your account and select a project to start reviewing your components against Figma designs."),Dt.createElement(Yt,{onClick:()=>p(!0)},i?"Reconnect":"Open Settings")),g&&Dt.createElement(JC,{onClose:()=>p(!1)}))};import EF,{useCallback as KW}from"react";import{useStorybookApi as XW}from"storybook/manager-api";import{IconButton as QW}from"storybook/internal/components";var JW="uireview",ZW=`${JW}/panel`,AF=()=>{let e=XW(),t=KW(()=>{e.togglePanel(!0),e.setSelectedPanel(ZW)},[e]);return EF.createElement(QW,{key:"uireview-tool",title:"UI Review - Compare with Figma",onClick:t},EF.createElement(dF,null))};Ce();import Gt,{useState as Na,useCallback as BF,useEffect as ey}from"react";import{styled as fo,useTheme as uV}from"storybook/theming";import{addons as au}from"storybook/manager-api";je();Oe();import{addons as iV,experimental_getStatusStore as su}from"storybook/manager-api";async function PF(e,t,n,r){let o=new Array(e.length),i=0;async function s(){for(;i<e.length&&!r();){let a=i++;try{let u=await e[a]();o[a]=u,r()||n(a,u)}catch(u){o[a]=u,r()||n(a,u)}}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>s())),o}je();Oe();var eV=V(),tV="uireview/badge";async function nV(e,t,n=3){for(let r=0;r<=n;r++){let o=await fetch(e,t);if(o.status!==429||r===n)return o;let i=Math.pow(2,r)*1e3;y.warn(`[reviewAll] Rate limited, retrying in ${i}ms`),await new Promise(s=>setTimeout(s,i))}throw new Error("Max retries exceeded")}async function rV(e,t){let n=new TextDecoder,r="",o=null,i=0,s=0,a=0,u=0,c=0,l=0;for(;;){let{done:d,value:g}=await e.read();if(d)break;if(t()){e.cancel();break}r+=n.decode(g,{stream:!0});let p=r.split(`
219
219
  `);r=p.pop()||"";for(let f of p)if(f.startsWith("data: "))try{let k=JSON.parse(f.slice(6));if(k.type==="complete"){o=k.complianceScore??k.validation?.complianceScore??null;let E=(k.issues||[]).filter(I=>!I.dismissed);i=E.filter(I=>I.severity==="critical").length,s=E.filter(I=>I.severity==="major").length,a=E.filter(I=>I.severity==="minor").length,u=k.costUsd||0,c=k.inputTokens||0,l=k.outputTokens||0}}catch{}}return{score:o,criticalCount:i,majorCount:s,minorCount:a,costUsd:u,inputTokens:c,outputTokens:l}}function iu(e,t,n,r,o){e&&e.set([{value:n,typeId:tV,storyId:t,title:r,description:o}])}async function oV(e){let t=window.location.origin;try{let n=await fetch(`${t}/__uicopilot/capture?storyId=${encodeURIComponent(e)}`);if(n.ok){let r=await n.json();return{screenshot:r.screenshot||void 0,computedStyles:r.computedStyles||void 0,domTree:r.domTree||void 0}}}catch{}try{let n=await fetch(`${t}/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(n.ok)return{screenshot:(await n.json()).screenshot||void 0}}catch{}return{}}async function LF(e,t,n,r,o,i){iu(o,e.storyId,"status-value:pending","Reviewing...",e.storyName);try{console.warn(`[reviewAll] Capturing for: ${e.storyName} (${e.storyId})`);let s=await oV(e.storyId);console.warn(`[reviewAll] Captured: screenshot=${!!s.screenshot} domTree=${!!s.domTree} styles=${!!s.computedStyles} for: ${e.storyName}`);let a=await nV(`${eV}/api/review/stream`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:n,storyId:e.storyId,storyName:e.storyName,storybookScreenshot:s.screenshot,computedStyles:s.computedStyles,domTree:s.domTree,aiModels:[r]})});if(console.warn(`[reviewAll] API response for ${e.storyName}: HTTP ${a.status}`),!a.ok)throw new Error(`HTTP ${a.status}`);let u=a.body?.getReader();if(!u)throw new Error("No response body");let c=await rV(u,i),{score:l,criticalCount:d,majorCount:g,minorCount:p,costUsd:f,inputTokens:k,outputTokens:T}=c;if(l!==null){let E=d>0||l<70?"status-value:error":g>0||l<90?"status-value:warning":"status-value:success",I=[`Score: ${l}`];d>0&&I.push(`${d} critical`),g>0&&I.push(`${g} major`),p>0&&I.push(`${p} minor`);let D=l>=90?`\u2713 Score ${l}`:l>=70?`\u26A0 Score ${l}`:`\u2717 Score ${l}`;return iu(o,e.storyId,E,D,I.join(" \xB7 ")),{passed:l>=70,score:l,costUsd:f,inputTokens:k,outputTokens:T}}return iu(o,e.storyId,"status-value:error","Review Failed","No score received"),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}catch(s){y.error(`[reviewAll] Failed to review ${e.storyName}:`,s);let a=s instanceof Error?s.message:"Unknown error";return iu(o,e.storyId,"status-value:error","Review Failed",a),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}}var sV=V(),Da="uireview/badge";function MF(){let e=!1,t=!1;try{let n=iV.getChannel();n.on(Jx,async()=>{if(!t){t=!0,e=!1;try{await cV(n,()=>e)}finally{t=!1}}}),n.on(Zx,()=>{e=!0})}catch{}}async function Qx(){try{let e=localStorage.getItem("uicopilot_session_token"),t=localStorage.getItem("uicopilot_selected_project_id");if(!e||!t)return[];let n=await fetch(`${sV}/api/mappings?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)return[];let i=((await n.json()).mappings||[]).filter(s=>s.figmaNodeId).map(s=>{let a=s;return{storyId:a.storyId,storyName:a.name||a.storyId,figmaNodeId:a.figmaNodeId}});return aV(i),i}catch(e){return y.error("[useReviewAll] Failed to load mapped stories:",e),[]}}function aV(e){try{if(typeof su!="function")return;let t=su(Da);if(!t)return;let n=t.getAll?.()||{},r=new Set(e.map(s=>s.storyId)),o=Object.keys(n).filter(s=>n[s]?.[Da]&&!r.has(s));o.length>0&&t.unset(o);let i=e.filter(s=>{let a=n[s.storyId]?.[Da];return!(a?.value==="status-value:success"||a?.value==="status-value:warning"||a?.value==="status-value:error")}).map(s=>({value:"status-value:pending",typeId:Da,storyId:s.storyId,title:"Mapped to Figma",description:"Ready for UI review \u2014 click Run to start"}));i.length>0&&t.set(i)}catch{}}function lV(){try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 3}async function cV(e,t){let n=await Qx();if(n.length===0){e.emit(za,{total:0,passed:0,failed:0});return}let r=localStorage.getItem("uicopilot_session_token"),o=localStorage.getItem("uicopilot_selected_project_id");if(!r||!o)return;let i="claude-sonnet-4-6";try{let k=localStorage.getItem("uicopilot_selected_models");if(k){let T=JSON.parse(k);Array.isArray(T)&&T.length>0&&(i=T[0])}}catch{}let s=null;try{typeof su=="function"&&(s=su(Da))}catch{}let a=lV(),u=0,c=0,l=0,d=0,g=0,p=0;e.emit(Ra,{total:n.length,completed:0,currentStoryName:n[0]?.storyName||""});let f=n.map(k=>()=>LF(k,r,o,i,s,t));await PF(f,a,(k,T)=>{if(T&&typeof T=="object"&&"score"in T){let E=T;E.score!==null&&E.score>=90?u++:E.score!==null&&E.score>=70?c++:l++,d+=E.costUsd||0,g+=E.inputTokens||0,p+=E.outputTokens||0}else l++;console.warn(`[reviewAll] Story ${k+1}/${n.length} done:`,n[k].storyName,T),e.emit(Ra,{total:n.length,completed:u+c+l,currentStoryName:n[k].storyName})},t),e.emit(za,{total:n.length,passed:u,failed:l,warnCount:c,costUsd:d,inputTokens:g,outputTokens:p})}var pV=fo.div({padding:"8px 12px",display:"flex",flexDirection:"column",gap:"6px"}),dV=fo.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),gV=fo.span(({theme:e})=>({fontSize:"12px",fontWeight:500,color:e.color.defaultText})),DF=fo.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),RF=fo.button(({theme:e,running:t})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",background:t?e.color.warning:e.color.secondary,border:"none",borderRadius:"6px",color:e.color.inverseText,cursor:"pointer",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,transition:"all 0.2s","&:disabled":{opacity:.4,cursor:"not-allowed"},"&:hover:not(:disabled)":{opacity:.9}})),fV=fo.div(({theme:e})=>({width:"100%",height:"3px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),mV=fo.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"2px",transition:"width 0.3s ease"})),zF=fo.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.8}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),ls=fo.span(e=>({display:"flex",alignItems:"center",gap:"3px","&::before":{content:'""',display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",backgroundColor:e.dotColor}})),Jx="uireview/review-all-start",Zx="uireview/review-all-cancel",Ra="uireview/review-all-progress",za="uireview/review-all-complete";function NF(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableParallelReview:!1}catch{return!1}}var OF=()=>{let[e,t]=Na(!1),[n,r]=Na(null),[o,i]=Na(null),[s,a]=Na(null),[u,c]=Na(NF);ey(()=>{let f=()=>c(NF()),k=setInterval(f,2e3);return window.addEventListener("storage",f),()=>{clearInterval(k),window.removeEventListener("storage",f)}},[]),ey(()=>{let f=()=>{Qx().then(I=>{a(I.length)}).catch(()=>{})},k=setTimeout(f,3e3),T=null;try{T=au.getChannel(),T.on("storyChanged",f),T.on("uireview/mappings-changed",f)}catch{}let E=setInterval(f,6e4);return()=>{clearTimeout(k),clearInterval(E),T&&(T.off("storyChanged",f),T.off("uireview/mappings-changed",f))}},[]),ey(()=>{let f;try{f=au.getChannel()}catch{return}let k=E=>{r(E),t(!0)},T=E=>{t(!1),r(null),i({total:E.total,passed:E.passed,failed:E.failed,warned:E.warnCount||0,costUsd:E.costUsd||0})};return f.on(Ra,k),f.on(za,T),()=>{f.off(Ra,k),f.off(za,T)}},[]);let l=BF(()=>{try{au.getChannel().emit(Jx),t(!0),i(null)}catch{}},[]),d=BF(()=>{try{au.getChannel().emit(Zx)}catch{}t(!1),r(null)},[]),g=n?Math.round(n.completed/n.total*100):0,p=uV();return u?Gt.createElement(pV,null,Gt.createElement(dV,null,Gt.createElement(gV,null,"UI Review"),e?Gt.createElement(RF,{running:!0,onClick:d},"Cancel"):Gt.createElement(RF,{onClick:l,disabled:!s||s===0},"Run",s?` (${s})`:"")),!e&&o?Gt.createElement(Gt.Fragment,null,Gt.createElement(zF,null,Gt.createElement(ls,{dotColor:p.color.positive},"Pass (",o.passed,")"),Gt.createElement(ls,{dotColor:p.color.warning},"Warn (",o.warned,")"),Gt.createElement(ls,{dotColor:p.color.negative},"Fail (",o.failed,")")),o.costUsd>0&&Gt.createElement(DF,null,"$",o.costUsd.toFixed(3)," \xB7 \u20AA",(o.costUsd*3.6).toFixed(3))):e?null:Gt.createElement(zF,null,Gt.createElement(ls,{dotColor:p.color.positive},"Pass"),Gt.createElement(ls,{dotColor:p.color.warning},"Warn"),Gt.createElement(ls,{dotColor:p.color.negative},"Fail")),e&&n&&Gt.createElement(Gt.Fragment,null,Gt.createElement(fV,null,Gt.createElement(mV,{percent:g})),Gt.createElement(DF,null,"Reviewing ",Math.min(n.completed+1,n.total),"/",n.total," \u2014 ",n.currentStoryName))):null};import*as $F from"@sentry/react";var hV="https://015e961f5f626bad5315430e02940616@o138219.ingest.us.sentry.io/4511134750539776",_F=!1;function xV(){if(typeof window>"u")return"production";let e=window.location.hostname;return/^(localhost|127\.0\.0\.1|0\.0\.0\.0)$/i.test(e)?"localhost":"production"}function UF(){if(!_F){_F=!0;try{$F.init({dsn:hV,environment:xV(),release:`uicopilot-addon@${process.env.npm_package_version||"unknown"}`,tracesSampleRate:0,enabled:!0,beforeSend(e){return e.tags={...e.tags,component:"storybook-addon"},e}})}catch{}}}UF();var cu="uireview",bV=`${cu}/panel`,SV=`${cu}/tool`,jF=`${cu}/test-provider`;lu.register(cu,()=>{if(console.log("[UI Review] Registering addon, checking for StatusStore API..."),typeof ny=="function"){console.log("[UI Review] StatusStore API available, initializing badges");let t=ny("uireview/badge");Rv(t);let n=ny("uireview/mapped");Ov(n),console.log("[UI Review] Badge listener initialized")}else console.warn("[UI Review] experimental_getStatusStore not available \u2014 badges disabled");lu.add(SV,{type:ty.TOOL,title:"UI Review",match:({viewMode:t})=>t==="story",render:()=>Oa.createElement(AF,null)}),MF(),(()=>{try{let t=localStorage.getItem("uicopilot_feature_flags");return t?!!JSON.parse(t).enableParallelReview:!1}catch{return!1}})()&&lu.add(jF,{type:ty.experimental_TEST_PROVIDER,id:jF,render:()=>Oa.createElement(OF,null)}),lu.add(bV,{type:ty.PANEL,title:"UI Review",match:({viewMode:t})=>t==="story",render:({active:t})=>Oa.createElement(yV,{active:t||!1},Oa.createElement(zf,null,Oa.createElement(FF,null)))})});
220
220
  /*! Bundled license information:
221
221