vendor: 8,402 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/prism-bundle-dpy2kVV0.js","assets/rolldown-runtime-aKtaBQYM.js","assets/code-import-BZtLbbsz.js","assets/format-lazy-CtLJTtqw.js"])))=>i.map(i=>d[i]); 2import{t as e}from"./rolldown-runtime-aKtaBQYM.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function te(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var D=/\/+/g;function O(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function re(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ie(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ie(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+O(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(D,`$&/`)+`/`),ie(o,r,i,``,function(e){return e})):o!=null&&(te(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(D,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+O(a,u),c+=ie(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+O(a,u++),c+=ie(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ie(re(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ae(e,t,n){if(e==null)return e;var r=[],i=0;return ie(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function oe(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var k=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},A={map:ae,forEach:function(e,t,n){ae(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ae(e,function(){t++}),t},toArray:function(e){return ae(e,function(e){return e})||[]},only:function(e){if(!te(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=A,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=te,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:oe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,k)}catch(e){k(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()}
vendor: 11,797 bytes, lines 2-4
2,e.version=`19.2.7`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&O(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&O(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=ee,te=function(){D.postMessage(null)}}else te=function(){_(ee,0)};function O(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,O(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var ie=Symbol.for(`react.client.reference`);function ae(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ne:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?ae(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var oe=Array.isArray,k=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},j=[],ce=-1;function M(e){return{current:e}}function N(e){0>ce||(e.current=j[ce],j[ce]=null,ce--)}function P(e,t){ce++,j[ce]=e.current,e.current=t}var le=M(null),ue=M(null),de=M(null),fe=M(null);function pe(e,t){switch(P(de,t),P(ue,e),P(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}N(le),P(le,e)}function me(){N(le),N(ue),N(de)}function he(e){e.memoizedState!==null&&P(fe,e);var t=le.current,n=Wd(t,e.type);t!==n&&(P(ue,e),P(le,n))}function ge(e){ue.current===e&&(N(le),N(ue)),fe.current===e&&(N(fe),$f._currentValue=se)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(` 3 at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return` 4`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}
vendor: 6,581 bytes, lines 4-9
4else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(` 5`),l=s.split(` 6`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=` 7`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return` 8Error generating stack: `+e.message+` 9`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,De=t.unstable_shouldYield,Oe=t.unstable_requestPaint,ke=t.unstable_now,Ae=t.unstable_getCurrentPriorityLevel,je=t.unstable_ImmediatePriority,Me=t.unstable_UserBlockingPriority,Ne=t.unstable_NormalPriority,Pe=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,Ie=t.log,Le=t.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function Je(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ye(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Je(n))):i=Je(o):i=Je(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Je(n))):i=Je(o)):i=Je(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ze(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qe(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ve(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&nt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function nt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ve(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ve(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function it(e,t){var n=t&-t;return n=n&42?1:at(n),(n&(e.suspendedLanes|t))===0?n:0}function at(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ot(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function st(){var e=A.p;return e===0?(e=window.event,e===void 0?32:hp(e.type)):e}function ct(e,t){var n=A.p;try{return A.p=e,t()}finally{A.p=n}}var lt=Math.random().toString(36).slice(2),ut=`__reactFiber$`+lt,dt=`__reactProps$`+lt,ft=`__reactContainer$`+lt,pt=`__reactEvents$`+lt,mt=`__reactListeners$`+lt,ht=`__reactHandles$`+lt,gt=`__reactResources$`+lt,_t=`__reactMarker$`+lt;function vt(e){delete e[ut],delete e[dt],delete e[pt],delete e[mt],delete e[ht]}function F(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ft]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pf(e);e!==null;){if(n=e[ut])return n;e=pf(e)}return t}e=n,n=e.parentNode}return null}function yt(e){if(e=e[ut]||e[ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function bt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function xt(e){var t=e[gt];return t||=e[gt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function St(e){e[_t]=!0}var Ct=new Set,wt={};function Tt(e,t){Et(e,t),Et(e+`Capture`,t)}function Et(e,t){for(wt[e]=t,e=0;e<t.length;e++)Ct.add(t[e])}var Dt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
9037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Ot={},kt={};function I(e){return we.call(kt,e)?!0:we.call(Ot,e)?!1:Dt.test(e)?kt[e]=!0:(Ot[e]=!0,!1)}function At(e,t,n){if(I(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function jt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Mt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Nt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Pt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ft(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function It(e){if(!e._valueTracker){var t=Pt(e)?`checked`:`value`;e._valueTracker=Ft(e,t,``+e[t])}}function Lt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Pt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Rt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var zt=/[\n"\\]/g;function Bt(e){return e.replace(zt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Vt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Nt(t)):e.value!==``+Nt(t)&&(e.value=``+Nt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ht(e,o,Nt(n)):Ht(e,o,Nt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Nt(s):e.removeAttribute(`name`)}function L(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){It(e);return}n=n==null?``:``+Nt(n),t=t==null?n:``+Nt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),It(e)}function Ht(e,t,n){t===`number`&&Rt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ut(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Nt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Wt(e,t,n){if(t!=null&&(t=``+Nt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Nt(n)}function Gt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(oe(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}
vendor: 87,367 bytes, line 9
9n=Nt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),It(e)}function Kt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Jt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||qt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Yt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Jt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Jt(e,a,t[a])}function Xt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Zt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function $t(e){return Qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function en(){}var tn=null;function nn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rn=null,an=null;function on(e){var t=yt(e);if(t&&(e=t.stateNode)){var n=e[dt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Vt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Bt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[dt]||null;if(!i)throw Error(s(90));Vt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Lt(r)}break a;case`textarea`:Wt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ut(e,!!n.multiple,t,!1)}}}var sn=!1;function cn(e,t,n){if(sn)return e(t,n);sn=!0;try{return e(t)}finally{if(sn=!1,(rn!==null||an!==null)&&(Cu(),rn&&(t=rn,e=an,an=rn=null,on(t),e)))for(t=0;t<e.length;t++)on(e[t])}}function ln(e,t){var n=e.stateNode;if(n===null)return null;var r=n[dt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var un=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),dn=!1;if(un)try{var fn={};Object.defineProperty(fn,"passive",{get:function(){dn=!0}}),window.addEventListener(`test`,fn,fn),window.removeEventListener(`test`,fn,fn)}catch{dn=!1}var pn=null,mn=null,hn=null;function gn(){if(hn)return hn;var e,t=mn,n=t.length,r,i=`value`in pn?pn.value:pn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return hn=i.slice(e,1<r?1-r:void 0)}function _n(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function vn(){return!0}function yn(){return!1}function bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?vn:yn,this.isPropagationStopped=yn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=vn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=vn)},persist:function(){},isPersistent:vn}),t}var xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sn=bn(xn),Cn=h({},xn,{view:0,detail:0}),wn=bn(Cn),Tn,En,Dn,On=h({},Cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Dn&&(Dn&&e.type===`mousemove`?(Tn=e.screenX-Dn.screenX,En=e.screenY-Dn.screenY):En=Tn=0,Dn=e),Tn)},movementY:function(e){return`movementY`in e?e.movementY:En}}),kn=bn(On),An=bn(h({},On,{dataTransfer:0})),jn=bn(h({},Cn,{relatedTarget:0})),Mn=bn(h({},xn,{animationName:0,elapsedTime:0,pseudoElement:0})),Nn=bn(h({},xn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Pn=bn(h({},xn,{data:0})),Fn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},In={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Ln={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Rn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ln[e])?!!t[e]:!1}function zn(){return Rn}var Bn=bn(h({},Cn,{key:function(e){if(e.key){var t=Fn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=_n(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?In[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zn,charCode:function(e){return e.type===`keypress`?_n(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?_n(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Vn=bn(h({},On,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Hn=bn(h({},Cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zn})),Un=bn(h({},xn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Wn=bn(h({},On,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Gn=bn(h({},xn,{newState:0,oldState:0})),Kn=[9,13,27,32],qn=un&&`CompositionEvent`in window,Jn=null;un&&`documentMode`in document&&(Jn=document.documentMode);var Yn=un&&`TextEvent`in window&&!Jn,Xn=un&&(!qn||Jn&&8<Jn&&11>=Jn),Zn=` `,Qn=!1;function $n(e,t){switch(e){case`keyup`:return Kn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function er(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var tr=!1;function nr(e,t){switch(e){case`compositionend`:return er(t);case`keypress`:return t.which===32?(Qn=!0,Zn):null;case`textInput`:return e=t.data,e===Zn&&Qn?null:e;default:return null}}function rr(e,t){if(tr)return e===`compositionend`||!qn&&$n(e,t)?(e=gn(),hn=mn=pn=null,tr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Xn&&t.locale!==`ko`?null:t.data;default:return null}}var ir={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ir[e.type]:t===`textarea`}function or(e,t,n,r){rn?an?an.push(r):an=[r]:rn=r,t=Dd(t,`onChange`),0<t.length&&(n=new Sn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var sr=null,cr=null;function lr(e){xd(e,0)}function ur(e){if(Lt(bt(e)))return e}function dr(e,t){if(e===`change`)return t}var fr=!1;if(un){var pr;if(un){var mr=`oninput`in document;if(!mr){var hr=document.createElement(`div`);hr.setAttribute(`oninput`,`return;`),mr=typeof hr.oninput==`function`}pr=mr}else pr=!1;fr=pr&&(!document.documentMode||9<document.documentMode)}function gr(){sr&&(sr.detachEvent(`onpropertychange`,_r),cr=sr=null)}function _r(e){if(e.propertyName===`value`&&ur(cr)){var t=[];or(t,cr,e,nn(e)),cn(lr,t)}}function vr(e,t,n){e===`focusin`?(gr(),sr=t,cr=n,sr.attachEvent(`onpropertychange`,_r)):e===`focusout`&&gr()}function yr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ur(cr)}function br(e,t){if(e===`click`)return ur(t)}function xr(e,t){if(e===`input`||e===`change`)return ur(t)}function Sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Cr=typeof Object.is==`function`?Object.is:Sr;function wr(e,t){if(Cr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!we.call(t,i)||!Cr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rt(e.document)}return t}function kr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Ar=un&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==Rt(r)||(r=jr,`selectionStart`in r&&kr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Nr&&wr(Nr,r)||(Nr=r,r=Dd(Mr,`onSelect`),0<r.length&&(t=new Sn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Lr={animationend:Ir(`Animation`,`AnimationEnd`),animationiteration:Ir(`Animation`,`AnimationIteration`),animationstart:Ir(`Animation`,`AnimationStart`),transitionrun:Ir(`Transition`,`TransitionRun`),transitionstart:Ir(`Transition`,`TransitionStart`),transitioncancel:Ir(`Transition`,`TransitionCancel`),transitionend:Ir(`Transition`,`TransitionEnd`)},Rr={},zr={};un&&(zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),`TransitionEvent`in window||delete Lr.transitionend.transition);function Br(e){if(Rr[e])return Rr[e];if(!Lr[e])return e;var t=Lr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zr)return Rr[e]=t[n];return e}var Vr=Br(`animationend`),Hr=Br(`animationiteration`),Ur=Br(`animationstart`),Wr=Br(`transitionrun`),Gr=Br(`transitionstart`),Kr=Br(`transitioncancel`),qr=Br(`transitionend`),Jr=new Map,Yr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Yr.push(`scrollEnd`);function Xr(e,t){Jr.set(e,t),Tt(t,[e])}var Zr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Qr=[],$r=0,ei=0;function ti(){for(var e=$r,t=ei=$r=0;t<e;){var n=Qr[t];Qr[t++]=null;var r=Qr[t];Qr[t++]=null;var i=Qr[t];Qr[t++]=null;var a=Qr[t];if(Qr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ai(n,i,a)}}function ni(e,t,n,r){Qr[$r++]=e,Qr[$r++]=t,Qr[$r++]=n,Qr[$r++]=r,ei|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ri(e,t,n,r){return ni(e,t,n,r),oi(e)}function ii(e,t){return ni(e,null,null,t),oi(e)}function ai(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ve(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function oi(e){if(50<mu)throw mu=0,hu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var si={};function ci(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function li(e,t,n,r){return new ci(e,t,n,r)}function ui(e){return e=e.prototype,!(!e||!e.isReactComponent)}function di(e,t){var n=e.alternate;return n===null?(n=li(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function fi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pi(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ui(e)&&(o=1);else if(typeof e==`string`)o=Wf(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ne:return e=li(31,n,t,i),e.elementType=ne,e.lanes=a,e;case y:return mi(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=li(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=li(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=li(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:o=10;break a;case S:o=9;break a;case w:o=11;break a;case ee:o=14;break a;case te:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=li(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function mi(e,t,n,r){return e=li(7,e,r,t),e.lanes=n,e}function hi(e,t,n){return e=li(6,e,null,t),e.lanes=n,e}function gi(e){var t=li(18,null,null,0);return t.stateNode=e,t}function _i(e,t,n){return t=li(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var vi=new WeakMap;function yi(e,t){if(typeof e==`object`&&e){var n=vi.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},vi.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var bi=[],xi=0,Si=null,Ci=0,wi=[],Ti=0,Ei=null,Di=1,Oi=``;function ki(e,t){bi[xi++]=Ci,bi[xi++]=Si,Si=e,Ci=t}function Ai(e,t,n){wi[Ti++]=Di,wi[Ti++]=Oi,wi[Ti++]=Ei,Ei=e;var r=Di;e=Oi;var i=32-Ve(r)-1;r&=~(1<<i),n+=1;var a=32-Ve(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Di=1<<32-Ve(t)+i|n<<i|r,Oi=a+e}else Di=1<<a|n<<i|r,Oi=e}function ji(e){e.return!==null&&(ki(e,1),Ai(e,1,0))}function Mi(e){for(;e===Si;)Si=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null;for(;e===Ei;)Ei=wi[--Ti],wi[Ti]=null,Oi=wi[--Ti],wi[Ti]=null,Di=wi[--Ti],wi[Ti]=null}function Ni(e,t){wi[Ti++]=Di,wi[Ti++]=Oi,wi[Ti++]=Ei,Di=t.id,Oi=t.overflow,Ei=e}var Pi=null,Fi=null,R=!1,Ii=null,Li=!1,Ri=Error(s(519));function zi(e){throw Gi(yi(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ri}function Bi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ut]=e,t[dt]=r,n){case`dialog`:X(`cancel`,t),X(`close`,t);break;case`iframe`:case`object`:case`embed`:X(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)X(yd[n],t);break;case`source`:X(`error`,t);break;case`img`:case`image`:case`link`:X(`error`,t),X(`load`,t);break;case`details`:X(`toggle`,t);break;case`input`:X(`invalid`,t),L(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:X(`invalid`,t);break;case`textarea`:X(`invalid`,t),Gt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Nd(t.textContent,n)?(r.popover!=null&&(X(`beforetoggle`,t),X(`toggle`,t)),r.onScroll!=null&&X(`scroll`,t),r.onScrollEnd!=null&&X(`scrollend`,t),r.onClick!=null&&(t.onclick=en),t=!0):t=!1,t||zi(e,!0)}function Vi(e){for(Pi=e.return;Pi;)switch(Pi.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Pi=Pi.return}}function Hi(e){if(e!==Pi)return!1;if(!R)return Vi(e),R=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Gd(e.type,e.memoizedProps)),n=!n),n&&Fi&&zi(e),Vi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Fi=ff(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Fi=ff(e)}else t===27?(t=Fi,$d(e.type)?(e=df,df=null,Fi=e):Fi=t):Fi=Pi?uf(e.stateNode.nextSibling):null;return!0}function Ui(){Fi=Pi=null,R=!1}function Wi(){var e=Ii;return e!==null&&(eu===null?eu=e:eu.push.apply(eu,e),Ii=null),e}function Gi(e){Ii===null?Ii=[e]:Ii.push(e)}var Ki=M(null),qi=null,Ji=null;function Yi(e,t,n){P(Ki,t._currentValue),t._currentValue=n}function Xi(e){e._currentValue=Ki.current,N(Ki)}function Zi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Qi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Zi(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Zi(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function $i(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;Cr(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===fe.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[$f]:e.push($f))}i=i.return}e!==null&&Qi(t,e,n,r),t.flags|=262144}function ea(e){for(e=e.firstContext;e!==null;){if(!Cr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ta(e){qi=e,Ji=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function na(e){return ia(qi,e)}function ra(e,t){return qi===null&&ta(e),ia(e,t)}function ia(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ji===null){if(e===null)throw Error(s(308));Ji=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ji=Ji.next=t;return n}var aa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oa=t.unstable_scheduleCallback,sa=t.unstable_NormalPriority,ca={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function la(){return{controller:new aa,data:new Map,refCount:0}}function ua(e){e.refCount--,e.refCount===0&&oa(sa,function(){e.controller.abort()})}var da=null,fa=0,pa=0,ma=null;function ha(e,t){if(da===null){var n=da=[];fa=0,pa=pd(),ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return fa++,t.then(ga,ga),t}function ga(){if(--fa===0&&da!==null){ma!==null&&(ma.status=`fulfilled`);var e=da;da=null,pa=0,ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _a(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var va=k.S;k.S=function(e,t){ru=ke(),typeof t==`object`&&t&&typeof t.then==`function`&&ha(e,t),va!==null&&va(e,t)};var ya=M(null);function ba(){var e=ya.current;return e===null?G.pooledCache:e}function xa(e,t){t===null?P(ya,ya.current):P(ya,t.pool)}function Sa(){var e=ba();return e===null?null:{parent:ca._currentValue,pool:e}}var Ca=Error(s(460)),wa=Error(s(474)),Ta=Error(s(542)),Ea={then:function(){}};function Da(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Oa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(en,en),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ma(e),e;default:if(typeof t.status==`string`)t.then(en,en);else{if(e=G,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ma(e),e}throw Aa=t,Ca}}function ka(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Aa=e,Ca):e}}var Aa=null;function ja(){if(Aa===null)throw Error(s(459));var e=Aa;return Aa=null,e}function Ma(e){if(e===Ca||e===Ta)throw Error(s(483))}var Na=null,Pa=0;function Fa(e){var t=Pa;return Pa+=1,Na===null&&(Na=[]),Oa(Na,e,t)}function Ia(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function La(e,t){throw t.$$typeof===g?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ra(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=di(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=hi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===te&&ka(a)===t.type)?(t=i(t,n.props),Ia(t,n),t.return=e,t):(t=pi(n.type,n.key,n.props,null,e.mode,r),Ia(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=_i(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=mi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=hi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=pi(t.type,t.key,t.props,null,e.mode,n),Ia(n,t),n.return=e,n;case v:return t=_i(t,e.mode,n),t.return=e,t;case te:return t=ka(t),f(e,t,n)}if(oe(t)||re(t))return t=mi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Fa(t),n);if(t.$$typeof===C)return f(e,ra(e,t),n);La(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case te:return n=ka(n),p(e,t,n,r)}if(oe(n)||re(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Fa(n),r);if(n.$$typeof===C)return p(e,t,ra(e,n),r);La(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case te:return r=ka(r),m(e,t,n,r,i)}if(oe(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Fa(r),i);if(r.$$typeof===C)return m(e,t,n,ra(t,r),i);La(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),R&&ki(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return R&&ki(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),R&&ki(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),R&&ki(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return R&&ki(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),R&&ki(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===te&&ka(l)===r.type){n(e,r.sibling),c=i(r,a.props),Ia(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===y?(c=mi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=pi(a.type,a.key,a.props,null,e.mode,c),Ia(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=_i(a,e.mode,c),c.return=e,e=c}return o(e);case te:return a=ka(a),b(e,r,a,c)}if(oe(a))return h(e,r,a,c);if(re(a)){if(l=re(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Fa(a),c);if(a.$$typeof===C)return b(e,r,ra(e,a),c);La(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=hi(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Pa=0;var i=b(e,t,n,r);return Na=null,i}catch(t){if(t===Ca||t===Ta)throw t;var a=li(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var za=Ra(!0),Ba=Ra(!1),Va=!1;function Ha(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ua(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ga(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=oi(e),ai(e,null,n),t}return ni(e,r,t,n),oi(e)}function Ka(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ja=!1;function Ya(){if(Ja){var e=ma;if(e!==null)throw e}}function Xa(e,t,n,r){Ja=!1;var i=e.updateQueue;Va=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===pa&&(Ja=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Va=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Jl|=o,e.lanes=o,e.memoizedState=d}}function Za(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Za(n[e],t)}var $a=M(null),eo=M(0);function to(e,t){e=Kl,P(eo,e),P($a,t),Kl=e|t.baseLanes}function no(){P(eo,Kl),P($a,$a.current)}function ro(){Kl=eo.current,N($a),N(eo)}var io=M(null),ao=null;function oo(e){var t=e.alternate;P(fo,fo.current&1),P(io,e),ao===null&&(t===null||$a.current!==null||t.memoizedState!==null)&&(ao=e)}function so(e){P(fo,fo.current),P(io,e),ao===null&&(ao=e)}function co(e){e.tag===22?(P(fo,fo.current),P(io,e),ao===null&&(ao=e)):lo(e)}function lo(){P(fo,fo.current),P(io,io.current)}function uo(e){N(io),ao===e&&(ao=null),N(fo)}var fo=M(0);function po(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||sf(n)||cf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var mo=0,z=null,ho=null,go=null,_o=!1,vo=!1,yo=!1,bo=0,xo=0,So=null,Co=0;function wo(){throw Error(s(321))}function To(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Cr(e[n],t[n]))return!1;return!0}function Eo(e,t,n,r,i,a){return mo=a,z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Vs:Hs,yo=!1,a=n(r,i),yo=!1,vo&&(a=Oo(t,n,r,i)),Do(e),a}function Do(e){k.H=Bs;var t=ho!==null&&ho.next!==null;if(mo=0,go=ho=z=null,_o=!1,xo=0,So=null,t)throw Error(s(300));e===null||ac||(e=e.dependencies,e!==null&&ea(e)&&(ac=!0))}function Oo(e,t,n,r){z=e;var i=0;do{if(vo&&(So=null),xo=0,vo=!1,25<=i)throw Error(s(301));if(i+=1,go=ho=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}k.H=Us,a=t(n,r)}while(vo);return a}function ko(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?Io(t):t,e=e.useState()[0],(ho===null?null:ho.memoizedState)!==e&&(z.flags|=1024),t}function Ao(){var e=bo!==0;return bo=0,e}function jo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Mo(e){if(_o){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_o=!1}mo=0,go=ho=z=null,vo=!1,xo=bo=0,So=null}function No(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return go===null?z.memoizedState=go=e:go=go.next=e,go}function Po(){if(ho===null){var e=z.alternate;e=e===null?null:e.memoizedState}else e=ho.next;var t=go===null?z.memoizedState:go.next;if(t!==null)go=t,ho=e;else{if(e===null)throw z.alternate===null?Error(s(467)):Error(s(310));ho=e,e={memoizedState:ho.memoizedState,baseState:ho.baseState,baseQueue:ho.baseQueue,queue:ho.queue,next:null},go===null?z.memoizedState=go=e:go=go.next=e}return go}function Fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Io(e){var t=xo;return xo+=1,So===null&&(So=[]),e=Oa(So,e,t),t=z,(go===null?t.memoizedState:go.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Vs:Hs),e}function Lo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Io(e);if(e.$$typeof===C)return na(e)}throw Error(s(438,String(e)))}function Ro(e){var t=null,n=z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=z.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Fo(),z.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=D;return t.index++,n}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){return Vo(Po(),ho,e)}function Vo(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(mo&f)===f:(q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===pa&&(d=!0);else if((mo&p)===p){u=u.next,p===pa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,z.lanes|=p,Jl|=p;f=u.action,yo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,z.lanes|=f,Jl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!Cr(a,e.memoizedState)&&(ac=!0,d&&(n=ma,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ho(e){var t=Po(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);Cr(a,t.memoizedState)||(ac=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Uo(e,t,n){var r=z,i=Po(),a=R;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!Cr((ho||i).memoizedState,n);if(o&&(i.memoizedState=n,ac=!0),i=i.queue,ps(Go.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||go!==null&&go.memoizedState.tag&1){if(r.flags|=2048,cs(9,{destroy:void 0},B.bind(null,r,i,n,t),null),G===null)throw Error(s(349));a||mo&127||Wo(r,t,n)}return n}function Wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=z.updateQueue,t===null?(t=Fo(),z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function B(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cr(e,n)}catch{return!0}}function qo(e){var t=ii(e,2);t!==null&&vu(t,e,2)}function Jo(e){var t=No();if(typeof e==`function`){var n=e;if(e=n(),yo){Be(!0);try{n()}finally{Be(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t}function Yo(e,t,n,r){return e.baseState=n,Vo(e,ho,typeof r==`function`?r:zo)}function Xo(e,t,n,r,i){if(Ls(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};k.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Zo(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Qo(e,t,s)}catch(n){es(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Qo(e,t,a)}catch(n){es(e,t,n)}}function Qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){$o(e,t,n)},function(n){return es(e,t,n)}):$o(e,t,n)}function $o(e,t,n){t.status=`fulfilled`,t.value=n,ts(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zo(e,n)))}function es(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ts(t),t=t.next;while(t!==r)}e.action=null}function ts(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ns(e,t){return t}function rs(e,t){if(R){var n=G.formState;if(n!==null){a:{var r=z;if(R){if(Fi){b:{for(var i=Fi,a=Li;i.nodeType!==8;){if(!a){i=null;break b}if(i=uf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Fi=uf(i.nextSibling),r=i.data===`F!`;break a}}zi(r)}r=!1}r&&(t=n[0])}}return n=No(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:t},n.queue=r,n=Ps.bind(null,z,r),r.dispatch=n,r=Jo(!1),a=Is.bind(null,z,!1,r.queue),r=No(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Xo.bind(null,z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function is(e){return as(Po(),ho,e)}function as(e,t,n){if(t=Vo(e,t,ns)[0],e=Bo(zo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Io(t)}catch(e){throw e===Ca?Ta:e}else r=t;t=Po();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(z.flags|=2048,cs(9,{destroy:void 0},os.bind(null,i,n),null)),[r,a,e]}function os(e,t){e.action=t}function ss(e){var t=Po(),n=ho;if(n!==null)return as(t,n,e);Po(),t=t.memoizedState,n=Po();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=z.updateQueue,t===null&&(t=Fo(),z.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ls(){return Po().memoizedState}function us(e,t,n,r){var i=No();z.flags|=e,i.memoizedState=cs(1|t,{destroy:void 0},n,r===void 0?null:r)}function ds(e,t,n,r){var i=Po();r=r===void 0?null:r;var a=i.memoizedState.inst;ho!==null&&r!==null&&To(r,ho.memoizedState.deps)?i.memoizedState=cs(t,a,n,r):(z.flags|=e,i.memoizedState=cs(1|t,a,n,r))}function fs(e,t){us(8390656,8,e,t)}function ps(e,t){ds(2048,8,e,t)}function ms(e){z.flags|=4;var t=z.updateQueue;if(t===null)t=Fo(),z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function hs(e){var t=Po().memoizedState;return ms({ref:t,nextImpl:e}),function(){if(W&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function gs(e,t){return ds(4,2,e,t)}function _s(e,t){return ds(4,4,e,t)}function vs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ys(e,t,n){n=n==null?null:n.concat([e]),ds(4,4,vs.bind(null,t,e),n)}function bs(){}function xs(e,t){var n=Po();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&To(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ss(e,t){var n=Po();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&To(t,r[1]))return r[0];if(r=e(),yo){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r}function Cs(e,t,n){return n===void 0||mo&1073741824&&!(q&261930)?e.memoizedState=t:(e.memoizedState=n,e=_u(),z.lanes|=e,Jl|=e,n)}function ws(e,t,n,r){return Cr(n,t)?n:$a.current===null?!(mo&42)||mo&1073741824&&!(q&261930)?(ac=!0,e.memoizedState=n):(e=_u(),z.lanes|=e,Jl|=e,t):(e=Cs(e,n,r),Cr(e,t)||(ac=!0),e)}function V(e,t,n,r,i){var a=A.p;A.p=a!==0&&8>a?a:8;var o=k.T,s={};k.T=s,Is(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,_a(c,r),gu(e)):Fs(e,t,r,gu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},gu())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ds(e).queue;V(e,i,t,se,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},gu())}function ks(){return na($f)}function As(){return Po().memoizedState}function js(){return Po().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gu();e=Wa(n);var r=Ga(t,e,n);r!==null&&(vu(r,t,n),Ka(r,t,n)),t={cache:la()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=gu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=ri(e,t,n,r),n!==null&&(vu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,gu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Cr(s,o))return ni(e,t,i,0),G===null&&ti(),!1}catch{}if(n=ri(e,t,i,r),n!==null)return vu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(s(479))}else t=ri(e,n,r,2),t!==null&&vu(t,e,2)}function Ls(e){var t=e.alternate;return e===z||t!==null&&t===z}function Rs(e,t){vo=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}var Bs={readContext:na,use:Lo,useCallback:wo,useContext:wo,useEffect:wo,useImperativeHandle:wo,useLayoutEffect:wo,useInsertionEffect:wo,useMemo:wo,useReducer:wo,useRef:wo,useState:wo,useDebugValue:wo,useDeferredValue:wo,useTransition:wo,useSyncExternalStore:wo,useId:wo,useHostTransitionStatus:wo,useFormState:wo,useActionState:wo,useOptimistic:wo,useMemoCache:wo,useCacheRefresh:wo};Bs.useEffectEvent=wo;var Vs={readContext:na,use:Lo,useCallback:function(e,t){return No().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:fs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),us(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=No();t=t===void 0?null:t;var r=e();if(yo){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=No();if(n!==void 0){var i=n(t);if(yo){Be(!0);try{n(t)}finally{Be(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ns.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=No();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=Ps.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bs,useDeferredValue:function(e,t){return Cs(No(),e,t)},useTransition:function(){var e=Jo(!1);return e=V.bind(null,z,e.queue,!0,!1),No().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,i=No();if(R){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),G===null)throw Error(s(349));q&127||Wo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,fs(Go.bind(null,r,a,e),[e]),r.flags|=2048,cs(9,{destroy:void 0},B.bind(null,r,a,n,t),null),n},useId:function(){var e=No(),t=G.identifierPrefix;if(R){var n=Oi,r=Di;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=bo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Co++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ks,useFormState:rs,useActionState:rs,useOptimistic:function(e){var t=No();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Is.bind(null,z,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ro,useCacheRefresh:function(){return No().memoizedState=Ms.bind(null,z)},useEffectEvent:function(e){var t=No(),n={impl:e};return t.memoizedState=n,function(){if(W&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Hs={readContext:na,use:Lo,useCallback:xs,useContext:na,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:Bo,useRef:ls,useState:function(){return Bo(zo)},useDebugValue:bs,useDeferredValue:function(e,t){return ws(Po(),ho.memoizedState,e,t)},useTransition:function(){var e=Bo(zo)[0],t=Po().memoizedState;return[typeof e==`boolean`?e:Io(e),t]},useSyncExternalStore:Uo,useId:As,useHostTransitionStatus:ks,useFormState:is,useActionState:is,useOptimistic:function(e,t){return Yo(Po(),ho,e,t)},useMemoCache:Ro,useCacheRefresh:js};Hs.useEffectEvent=hs;var Us={readContext:na,use:Lo,useCallback:xs,useContext:na,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:Ho,useRef:ls,useState:function(){return Ho(zo)},useDebugValue:bs,useDeferredValue:function(e,t){var n=Po();return ho===null?Cs(n,e,t):ws(n,ho.memoizedState,e,t)},useTransition:function(){var e=Ho(zo)[0],t=Po().memoizedState;return[typeof e==`boolean`?e:Io(e),t]},useSyncExternalStore:Uo,useId:As,useHostTransitionStatus:ks,useFormState:ss,useActionState:ss,useOptimistic:function(e,t){var n=Po();return ho===null?(n.baseState=e,[e,n.queue.dispatch]):Yo(n,ho,e,t)},useMemoCache:Ro,useCacheRefresh:js};Us.useEffectEvent=hs;function Ws(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Gs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Wa(r);i.payload=t,n!=null&&(i.callback=n),t=Ga(e,i,r),t!==null&&(vu(t,e,r),Ka(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Wa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ga(e,i,r),t!==null&&(vu(t,e,r),Ka(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gu(),r=Wa(n);r.tag=2,t!=null&&(r.callback=t),t=Ga(e,r,n),t!==null&&(vu(t,e,n),Ka(t,e,n))}};function Ks(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!wr(n,r)||!wr(i,a):!0}function qs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Gs.enqueueReplaceState(t,t.state,null)}function Js(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ys(e){Zr(e)}function Xs(e){console.error(e)}function Zs(e){Zr(e)}function Qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function ec(e,t,n){return n=Wa(n),n.tag=3,n.payload={element:null},n.callback=function(){Qs(e,t)},n}function tc(e){return e=Wa(e),e.tag=3,e}function nc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){$s(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){$s(t,n,r),typeof i!=`function`&&(ou===null?ou=new Set([this]):ou.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function rc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&$i(t,n,i,!0),n=io.current,n!==null){switch(n.tag){case 31:case 13:return ao===null?ku():n.alternate===null&&ql===0&&(ql=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,i)),!1;case 22:return n.flags|=65536,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,i)),!1}throw Error(s(435,n.tag))}return qu(e,r,i),ku(),!1}if(R)return t=io.current,t===null?(r!==Ri&&(t=Error(s(423),{cause:r}),Gi(yi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=yi(r,n),i=ec(e.stateNode,r,i),qa(e,i),ql!==4&&(ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ri&&(e=Error(s(422),{cause:r}),Gi(yi(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=yi(a,n),$l===null?$l=[a]:$l.push(a),ql!==4&&(ql=2),t===null)return!0;r=yi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=ec(n.stateNode,r,e),qa(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(ou===null||!ou.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=tc(i),nc(i,e,n,r),qa(n,i),!1}n=n.return}while(n!==null);return!1}var ic=Error(s(461)),ac=!1;function oc(e,t,n,r){t.child=e===null?Ba(t,null,n,r):za(t,e.child,n,r)}function sc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ta(t),r=Eo(e,t,n,o,a,i),s=Ao(),e!==null&&!ac?(jo(e,t,i),jc(e,t,i)):(R&&s&&ji(t),t.flags|=1,oc(e,t,r,i),t.child)}function cc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ui(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,lc(e,t,a,r,i)):(e=pi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Mc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?wr:n,n(o,r)&&e.ref===t.ref)return jc(e,t,i)}return t.flags|=1,e=di(a,r),e.ref=t.ref,e.return=t,t.child=e}function lc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(wr(a,r)&&e.ref===t.ref)if(ac=!1,t.pendingProps=r=a,Mc(e,i))e.flags&131072&&(ac=!0);else return t.lanes=e.lanes,jc(e,t,i)}return _c(e,t,n,r,i)}function uc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xa(t,a===null?null:a.cachePool),a===null?no():to(t,a),co(t);else return r=t.lanes=536870912,fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&xa(t,null),no(),lo(t)):(xa(t,a.cachePool),to(t,a),lo(t),t.memoizedState=null);return oc(e,t,i,n),t.child}function dc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fc(e,t,n,r,i){var a=ba();return a=a===null?null:{parent:ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&xa(t,null),no(),co(t),e!==null&&$i(e,t,r,!0),t.childLanes=i,null}function pc(e,t){return t=Ec({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mc(e,t,n){return za(t,e.child,null,n),e=pc(t,t.pendingProps),e.flags|=2,uo(t),t.memoizedState=null,e}function hc(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(R){if(r.mode===`hidden`)return e=pc(t,r),t.lanes=536870912,dc(null,e);if(so(t),(e=Fi)?(e=of(e,Li),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ei===null?null:{id:Di,overflow:Oi},retryLane:536870912,hydrationErrors:null},n=gi(e),n.return=t,t.child=n,Pi=t,Fi=null)):e=null,e===null)throw zi(t);return t.lanes=536870912,null}return pc(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(so(t),i)if(t.flags&256)t.flags&=-257,t=mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(ac||$i(e,t,n,!1),i=(n&e.childLanes)!==0,ac||i){if(r=G,r!==null&&(o=it(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,ii(e,o),vu(r,e,o),ic;ku(),t=mc(e,t,n)}else e=a.treeContext,Fi=uf(o.nextSibling),Pi=t,R=!0,Ii=null,Li=!1,e!==null&&Ni(t,e),t=pc(t,r),t.flags|=4096;return t}return e=di(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,r,i){return ta(t),n=Eo(e,t,n,r,void 0,i),r=Ao(),e!==null&&!ac?(jo(e,t,i),jc(e,t,i)):(R&&r&&ji(t),t.flags|=1,oc(e,t,n,i),t.child)}function vc(e,t,n,r,i,a){return ta(t),t.updateQueue=null,n=Oo(t,r,n,i),Do(e),r=Ao(),e!==null&&!ac?(jo(e,t,a),jc(e,t,a)):(R&&r&&ji(t),t.flags|=1,oc(e,t,n,a),t.child)}function yc(e,t,n,r,i){if(ta(t),t.stateNode===null){var a=si,o=n.contextType;typeof o==`object`&&o&&(a=na(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Gs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ha(t),o=n.contextType,a.context=typeof o==`object`&&o?na(o):si,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ws(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Gs.enqueueReplaceState(a,a.state,null),Xa(t,r,a,i),Ya(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Js(n,s);a.props=c;var l=a.context,u=n.contextType;o=si,typeof u==`object`&&u&&(o=na(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&qs(t,a,r,o),Va=!1;var f=t.memoizedState;a.state=f,Xa(t,r,a,i),Ya(),l=t.memoizedState,s||f!==l||Va?(typeof d==`function`&&(Ws(t,n,d,r),l=t.memoizedState),(c=Va||Ks(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ua(e,t),o=t.memoizedProps,u=Js(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=si,typeof l==`object`&&l&&(c=na(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&qs(t,a,r,c),Va=!1,f=t.memoizedState,a.state=f,Xa(t,r,a,i),Ya();var p=t.memoizedState;o!==d||f!==p||Va||e!==null&&e.dependencies!==null&&ea(e.dependencies)?(typeof s==`function`&&(Ws(t,n,s,r),p=t.memoizedState),(u=Va||Ks(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ea(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,gc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=za(t,e.child,null,i),t.child=za(t,null,n,i)):oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=jc(e,t,i),e}function bc(e,t,n,r){return Ui(),t.flags|=256,oc(e,t,n,r),t.child}var xc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sc(e){return{baseLanes:e,cachePool:Sa()}}function Cc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Zl),e}function wc(e,t,n){var r=t.pendingProps,i=!1,a=(t.flags&128)!=0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(fo.current&2)!=0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!=0,t.flags&=-33,e===null){if(R){if(i?oo(t):lo(t),(e=Fi)?(e=of(e,Li),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ei===null?null:{id:Di,overflow:Oi},retryLane:536870912,hydrationErrors:null},n=gi(e),n.return=t,t.child=n,Pi=t,Fi=null)):e=null,e===null)throw zi(t);return cf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(lo(t),i=t.mode,c=Ec({mode:`hidden`,children:c},i),r=mi(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,o,n),t.memoizedState=xc,dc(null,r)):(oo(t),Tc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(oo(t),t.flags&=-257,t=Dc(e,t,n)):t.memoizedState===null?(lo(t),c=r.fallback,i=t.mode,r=Ec({mode:`visible`,children:r.children},i),c=mi(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,za(t,e.child,null,n),r=t.child,r.memoizedState=Sc(n),r.childLanes=Cc(e,o,n),t.memoizedState=xc,t=dc(null,r)):(lo(t),t.child=e.child,t.flags|=128,t=null);else if(oo(t),cf(c)){if(o=c.nextSibling&&c.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(s(419)),r.stack=``,r.digest=o,Gi({value:r,source:null,stack:null}),t=Dc(e,t,n)}else if(ac||$i(e,t,n,!1),o=(n&e.childLanes)!==0,ac||o){if(o=G,o!==null&&(r=it(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ii(e,r),vu(o,e,r),ic;sf(c)||ku(),t=Dc(e,t,n)}else sf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Fi=uf(c.nextSibling),Pi=t,R=!0,Ii=null,Li=!1,e!==null&&Ni(t,e),t=Tc(t,r.children),t.flags|=4096);return t}return i?(lo(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=di(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=mi(c,i,n,null),c.flags|=2):c=di(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,dc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Sc(n):(i=c.cachePool,i===null?i=Sa():(l=ca._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=Cc(e,o,n),t.memoizedState=xc,dc(e.child,r)):(oo(t),n=e.child,e=n.sibling,n=di(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Tc(e,t){return t=Ec({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Ec(e,t){return e=li(22,e,null,t),e.lanes=0,e}function Dc(e,t,n){return za(t,e.child,null,n),e=Tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zi(e.return,t,n)}function kc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Ac(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=fo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,P(fo,o),oc(e,t,r,n),r=R?Ci:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Oc(e,n,t);else if(e.tag===19)Oc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&po(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),kc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&po(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}kc(t,!0,n,null,a,r);break;case`together`:kc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function jc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if($i(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=di(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=di(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Mc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&ea(e))):!0}function Nc(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),Yi(t,ca,e.memoizedState.cache),Ui();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:Yi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,so(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(oo(t),e=jc(e,t,n),e===null?null:e.sibling):wc(e,t,n):(oo(t),t.flags|=128,null);oo(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=($i(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ac(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(fo,fo.current),r)break;return null;case 22:return t.lanes=0,uc(e,t,n,t.pendingProps);case 24:Yi(t,ca,e.memoizedState.cache)}return jc(e,t,n)}function Pc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ac=!0;else{if(!Mc(e,n)&&!(t.flags&128))return ac=!1,Nc(e,t,n);ac=!!(e.flags&131072)}else ac=!1,R&&t.flags&1048576&&Ai(t,Ci,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ka(t.elementType),t.type=e,typeof e==`function`)ui(e)?(r=Js(e,r),t.tag=1,t=yc(null,t,e,r,n)):(t.tag=0,t=_c(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=sc(null,t,e,r,n);break a}else if(i===ee){t.tag=14,t=cc(null,t,e,r,n);break a}}throw t=ae(e)||e,Error(s(306,t,``))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Js(r,t.pendingProps),yc(e,t,r,i,n);case 3:a:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Ua(e,t),Xa(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Yi(t,ca,r),r!==a.cache&&Qi(t,[ca],n,!0),Ya(),r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=bc(e,t,r,n);break a}else if(r!==i){i=yi(Error(s(424)),t),Gi(i),t=bc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Fi=uf(e.firstChild),Pi=t,R=!0,Ii=null,Li=!0,n=Ba(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),r===i){t=jc(e,t,n);break a}oc(e,t,r,n)}t=t.child}return t;case 26:return gc(e,t),e===null?(n=Af(t.type,null,t.pendingProps,null))?t.memoizedState=n:R||(n=t.type,e=t.pendingProps,r=Hd(de.current).createElement(n),r[ut]=t,r[dt]=e,Id(r,n,e),St(r),t.stateNode=r):t.memoizedState=Af(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&R&&(r=t.stateNode=mf(t.type,t.pendingProps,de.current),Pi=t,Li=!0,i=Fi,$d(t.type)?(df=i,Fi=uf(r.firstChild)):Fi=i),oc(e,t,t.pendingProps.children,n),gc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&R&&((i=r=Fi)&&(r=rf(r,t.type,t.pendingProps,Li),r===null?i=!1:(t.stateNode=r,Pi=t,Fi=uf(r.firstChild),Li=!1,i=!0)),i||zi(t)),he(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,Gd(i,a)?r=null:o!==null&&Gd(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=Eo(e,t,ko,null,null,n),$f._currentValue=i),gc(e,t),oc(e,t,r,n),t.child;case 6:return e===null&&R&&((e=n=Fi)&&(n=af(n,t.pendingProps,Li),n===null?e=!1:(t.stateNode=n,Pi=t,Fi=null,e=!0)),e||zi(t)),null;case 13:return wc(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=za(t,null,r,n):oc(e,t,r,n),t.child;case 11:return sc(e,t,t.type,t.pendingProps,n);case 7:return oc(e,t,t.pendingProps,n),t.child;case 8:return oc(e,t,t.pendingProps.children,n),t.child;case 12:return oc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Yi(t,t.type,r.value),oc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ta(t),i=na(i),r=r(i),t.flags|=1,oc(e,t,r,n),t.child;case 14:return cc(e,t,t.type,t.pendingProps,n);case 15:return lc(e,t,t.type,t.pendingProps,n);case 19:return Ac(e,t,n);case 31:return hc(e,t,n);case 22:return uc(e,t,n,t.pendingProps);case 24:return ta(t),r=na(ca),e===null?(i=ba(),i===null&&(i=G,a=la(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Ha(t),Yi(t,ca,i)):((e.lanes&n)!==0&&(Ua(e,t),Xa(t,null,null,n),Ya()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Yi(t,ca,r),r!==i.cache&&Qi(t,[ca],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Yi(t,ca,r))),oc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Fc(e){e.flags|=4}function Ic(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Eu())e.flags|=8192;else throw Aa=Ea,wa}else e.flags&=-16777217}function Lc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Gf(t))if(Eu())e.flags|=8192;else throw Aa=Ea,wa}function Rc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Qe(),e.lanes|=t,Ql|=t)}function zc(e,t){if(!R)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Bc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Vc(e,t,n){var r=t.pendingProps;switch(Mi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bc(t),null;case 1:return Bc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Xi(ca),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Hi(t)?Fc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wi())),Bc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Fc(t),a===null?(Bc(t),Ic(t,i,null,r,n)):(Bc(t),Lc(t,a))):a?a===e.memoizedState?(Bc(t),t.flags&=-16777217):(Fc(t),Bc(t),Lc(t,a)):(e=e.memoizedProps,e!==r&&Fc(t),Bc(t),Ic(t,i,e,r,n)),null;case 27:if(ge(t),n=de.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Bc(t),null}e=le.current,Hi(t)?Bi(t,e):(e=mf(i,r,n),t.stateNode=e,Fc(t))}return Bc(t),null;case 5:if(ge(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Bc(t),null}if(a=le.current,Hi(t))Bi(t,a);else{var o=Hd(de.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[ut]=t,a[dt]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Id(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Fc(t)}}return Bc(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=de.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Pi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Nd(e.nodeValue,n)),e||zi(t,!0)}else e=Hd(e).createTextNode(r),e[ut]=t,t.stateNode=e}return Bc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[ut]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(uo(t),t):(uo(t),null);if(t.flags&128)throw Error(s(558))}return Bc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Hi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[ut]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bc(t),i=!1}else i=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(uo(t),t):(uo(t),null)}return uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Rc(t,t.updateQueue),Bc(t),null);case 4:return me(),e===null&&Cd(t.stateNode.containerInfo),Bc(t),null;case 10:return Xi(t.type),Bc(t),null;case 19:if(N(fo),r=t.memoizedState,r===null)return Bc(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)zc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=po(e),a!==null){for(t.flags|=128,zc(r,!1),e=a.updateQueue,t.updateQueue=e,Rc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fi(n,e),n=n.sibling;return P(fo,fo.current&1|2),R&&ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>iu&&(t.flags|=128,i=!0,zc(r,!1),t.lanes=4194304)}else{if(!i)if(e=po(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Rc(t,e),zc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!R)return Bc(t),null}else 2*ke()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,i=!0,zc(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Bc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=fo.current,P(fo,i?n&1|2:n&1),R&&ki(t,r.treeForkCount),e);case 22:case 23:return uo(t),ro(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Bc(t),t.subtreeFlags&6&&(t.flags|=8192)):Bc(t),n=t.updateQueue,n!==null&&Rc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&N(ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(ca),Bc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Hc(e,t){switch(Mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(ca),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(uo(t),t.alternate===null)throw Error(s(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(fo),null;case 4:return me(),null;case 10:return Xi(t.type),null;case 22:case 23:return uo(t),ro(),e!==null&&N(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(ca),null;case 25:return null;default:return null}}function Uc(e,t){switch(Mi(t),t.tag){case 3:Xi(ca),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&uo(t);break;case 13:uo(t);break;case 19:N(fo);break;case 10:Xi(t.type);break;case 22:case 23:uo(t),ro(),e!==null&&N(ya);break;case 24:Xi(ca)}}function Wc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Y(t,t.return,e)}}function Gc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Y(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Y(t,t.return,e)}}function Kc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Qa(t,n)}catch(t){Y(e,e.return,t)}}}function qc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Y(e,t,n)}}function H(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Y(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Y(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Y(e,t,n)}else n.current=null}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Y(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Ld(r,e.type,n,t),r[dt]=t}catch(t){Y(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$d(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&$d(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=en));else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Id(t,r,n),t[ut]=e,t[dt]=n}catch(t){Y(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,Bd=cp,e=Or(e),kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},cp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Js(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Y(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)nf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:nf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,ol=e;break}ol=t.return}}function cl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Cl(e,n),r&4&&Wc(5,n);break;case 1:if(Cl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Y(n,n.return,e)}else{var i=Js(n.type,t.memoizedProps);t=t.memoizedState;
vendor: 5,404 bytes, line 9
9try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Y(n,n.return,e)}}r&64&&Kc(n),r&512&&H(n,n.return);break;case 3:if(Cl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Qa(e,t)}catch(e){Y(n,n.return,e)}}break;case 27:t===null&&r&4&&tl(n);case 26:case 5:Cl(e,n),t===null&&r&4&&Yc(n),r&512&&H(n,n.return);break;case 12:Cl(e,n);break;case 31:Cl(e,n),r&4&&ml(e,n);break;case 13:Cl(e,n),r&4&&hl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),lf(e,n))));break;case 22:if(r=n.memoizedState!==null||nl,!r){t=t!==null&&t.memoizedState!==null||rl,i=nl;var a=rl;nl=r,(rl=t)&&!a?Tl(e,n,(n.subtreeFlags&8772)!=0):Cl(e,n),nl=i,rl=a}break;case 30:break;default:Cl(e,n)}}function ll(e){var t=e.alternate;t!==null&&(e.alternate=null,ll(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ul=null,dl=!1;function fl(e,t,n){for(n=n.child;n!==null;)pl(e,t,n),n=n.sibling}function pl(e,t,n){if(ze&&typeof ze.onCommitFiberUnmount==`function`)try{ze.onCommitFiberUnmount(Re,n)}catch{}switch(n.tag){case 26:rl||Jc(n,t),fl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rl||Jc(n,t);var r=ul,i=dl;$d(n.type)&&(ul=n.stateNode,dl=!1),fl(e,t,n),hf(n.stateNode),ul=r,dl=i;break;case 5:rl||Jc(n,t);case 6:if(r=ul,i=dl,ul=null,fl(e,t,n),ul=r,dl=i,ul!==null)if(dl)try{(ul.nodeType===9?ul.body:ul.nodeName===`HTML`?ul.ownerDocument.body:ul).removeChild(n.stateNode)}catch(e){Y(n,t,e)}else try{ul.removeChild(n.stateNode)}catch(e){Y(n,t,e)}break;case 18:ul!==null&&(dl?(e=ul,ef(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):ef(ul,n.stateNode));break;case 4:r=ul,i=dl,ul=n.stateNode.containerInfo,dl=!0,fl(e,t,n),ul=r,dl=i;break;case 0:case 11:case 14:case 15:Gc(2,n,t),rl||Gc(4,n,t),fl(e,t,n);break;case 1:rl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&qc(n,t,r)),fl(e,t,n);break;case 21:fl(e,t,n);break;case 22:rl=(r=rl)||n.memoizedState!==null,fl(e,t,n),rl=r;break;default:fl(e,t,n)}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Y(t,t.return,e)}}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Y(t,t.return,e)}}function gl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new al),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new al),t;default:throw Error(s(435,e.tag))}}function _l(e,t){var n=gl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function vl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,o=t,c=o;a:for(;c!==null;){switch(c.tag){case 27:if($d(c.type)){ul=c.stateNode,dl=!1;break a}break;case 5:ul=c.stateNode,dl=!1;break a;case 3:case 4:ul=c.stateNode.containerInfo,dl=!0;break a}c=c.return}if(ul===null)throw Error(s(160));pl(a,o,i),ul=null,dl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bl(t,e),t=t.sibling}var yl=null;function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vl(t,e),xl(e),r&4&&(Gc(3,e,e.return),Wc(3,e),Gc(5,e,e.return));break;case 1:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&64&&nl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=yl;if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[_t]||a[ut]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Id(a,r,n),a[ut]=e,St(a),r=a;break a;case`link`:var o=Hf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(c,1);break b}}a=i.createElement(r),Id(a,r,n),i.head.appendChild(a);break;case`meta`:if(o=Hf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(c,1);break b}}a=i.createElement(r),Id(a,r,n),i.head.appendChild(a);break;default:throw Error(s(468,r))}a[ut]=e,St(a),r=a}e.stateNode=r}else Uf(i,e.type,e.stateNode);else e.stateNode=Lf(i,r,e.memoizedProps);
vendor: 40,512 bytes, lines 9-10
9else a===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Uf(i,e.type,e.stateNode):Lf(i,r,e.memoizedProps))}break;case 27:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),e.flags&32){i=e.stateNode;try{Kt(i,``)}catch(t){Y(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Xc(e,i,n===null?i:n.memoizedProps)),r&1024&&(il=!0);break;case 6:if(vl(t,e),xl(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Y(e,e.return,t)}}break;case 3:if(Vf=null,i=yl,yl=vf(t.containerInfo),vl(t,e),yl=i,xl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Y(e,e.return,t)}il&&(il=!1,Sl(e));break;case 4:r=yl,yl=vf(e.stateNode.containerInfo),vl(t,e),xl(e),yl=r;break;case 12:vl(t,e),xl(e);break;case 31:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 13:vl(t,e),xl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nu=ke()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=nl,d=rl;if(nl=u||i,rl=d||l,vl(t,e),rl=d,nl=u,xl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||nl||rl||wl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Y(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Y(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?tf(m,!0):tf(l.stateNode,!1)}catch(e){Y(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,_l(e,n))));break;case 19:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 30:break;case 21:break;default:vl(t,e),xl(e)}}function xl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;el(e,Qc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Kt(a,``),n.flags&=-33),el(e,Qc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;$c(e,Qc(e),o);break;default:throw Error(s(161))}}catch(t){Y(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Cl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cl(e,t.alternate,t),t=t.sibling}function wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gc(4,t,t.return),wl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&qc(t,t.return,n),wl(t);break;case 27:hf(t.stateNode);case 26:case 5:Jc(t,t.return),wl(t);break;case 22:t.memoizedState===null&&wl(t);break;case 30:wl(t);break;default:wl(t)}e=e.sibling}}function Tl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Tl(i,a,n),Wc(4,a);break;case 1:if(Tl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Y(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Za(c[i],s)}catch(e){Y(r,r.return,e)}}n&&o&64&&Kc(a),H(a,a.return);break;case 27:tl(a);case 26:case 5:Tl(i,a,n),n&&r===null&&o&4&&Yc(a),H(a,a.return);break;case 12:Tl(i,a,n);break;case 31:Tl(i,a,n),n&&o&4&&ml(i,a);break;case 13:Tl(i,a,n),n&&o&4&&hl(i,a);break;case 22:a.memoizedState===null&&Tl(i,a,n),H(a,a.return);break;case 30:break;default:Tl(i,a,n)}t=t.sibling}}function El(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ua(n))}function U(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e))}function Dl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ol(e,t,n,r),t=t.sibling}function Ol(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Dl(e,t,n,r),i&2048&&Wc(9,t);break;case 1:Dl(e,t,n,r);break;case 3:Dl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e)));break;case 12:if(i&2048){Dl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Y(t,t.return,e)}}else Dl(e,t,n,r);break;case 31:Dl(e,t,n,r);break;case 13:Dl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Dl(e,t,n,r):(a._visibility|=2,kl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Dl(e,t,n,r):Al(e,t),i&2048&&El(o,t);break;case 24:Dl(e,t,n,r),i&2048&&U(t.alternate,t);break;default:Dl(e,t,n,r)}}function kl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:kl(a,o,s,c,i),Wc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,kl(a,o,s,c,i)):u._visibility&2?kl(a,o,s,c,i):Al(a,o),i&&l&2048&&El(o.alternate,o);break;case 24:kl(a,o,s,c,i),i&&l&2048&&U(o.alternate,o);break;default:kl(a,o,s,c,i)}t=t.sibling}}function Al(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Al(n,r),i&2048&&El(r.alternate,r);break;case 24:Al(n,r),i&2048&&U(r.alternate,r);break;default:Al(n,r)}t=t.sibling}}var jl=8192;function Ml(e,t,n){if(e.subtreeFlags&jl)for(e=e.child;e!==null;)Nl(e,t,n),e=e.sibling}function Nl(e,t,n){switch(e.tag){case 26:Ml(e,t,n),e.flags&jl&&e.memoizedState!==null&&Kf(n,yl,e.memoizedState,e.memoizedProps);break;case 5:Ml(e,t,n);break;case 3:case 4:var r=yl;yl=vf(e.stateNode.containerInfo),Ml(e,t,n),yl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=jl,jl=16777216,Ml(e,t,n),jl=r):Ml(e,t,n));break;default:Ml(e,t,n)}}function Pl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,Rl(r,e)}Pl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Il(e),e=e.sibling}function Il(e){switch(e.tag){case 0:case 11:case 15:Fl(e),e.flags&2048&&Gc(9,e,e.return);break;case 3:Fl(e);break;case 12:Fl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):Fl(e);break;default:Fl(e)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,Rl(r,e)}Pl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gc(8,t,t.return),Ll(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Rl(e,t){for(;ol!==null;){var n=ol;switch(n.tag){case 0:case 11:case 15:Gc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ua(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ol=r;else a:for(n=e;ol!==null;){r=ol;var i=r.sibling,a=r.return;if(ll(r),r===n){ol=null;break a}if(i!==null){i.return=a,ol=i;break a}ol=a}}}var zl={getCacheForType:function(e){var t=na(ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return na(ca).controller.signal}},Bl=typeof WeakMap==`function`?WeakMap:Map,W=0,G=null,K=null,q=0,Vl=0,Hl=null,Ul=!1,Wl=!1,Gl=!1,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=null,eu=null,tu=!1,nu=0,ru=0,iu=1/0,au=null,ou=null,su=0,cu=null,lu=null,uu=0,du=0,fu=null,pu=null,mu=0,hu=null;function gu(){return W&2&&q!==0?q&-q:k.T===null?st():pd()}function _u(){if(Zl===0)if(!(q&536870912)||R){var e=Ke;Ke<<=1,!(Ke&3932160)&&(Ke=262144),Zl=e}else Zl=536870912;return e=io.current,e!==null&&(e.flags|=32),Zl}function vu(e,t,n){(e===G&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)&&(wu(e,0),Su(e,q,Zl,!1)),et(e,n),(!(W&2)||e!==G)&&(e===G&&(!(W&2)&&(Yl|=n),ql===4&&Su(e,q,Zl,!1)),ad(e))}function yu(e,t,n){if(W&6)throw Error(s(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Xe(e,t),i=r?Mu(e,t):Au(e,t,!0),a=r;do{if(i===0){Wl&&!r&&Su(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!xu(n)){i=Au(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=$l;var l=c.current.memoizedState.isDehydrated;if(l&&(wu(c,o).flags|=256),o=Au(c,o,!1),o!==2){if(Gl&&!l){c.errorRecoveryDisabledLanes|=a,Yl|=a,i=4;break a}a=eu,eu=i,a!==null&&(eu===null?eu=a:eu.push.apply(eu,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){wu(e,0),Su(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:Su(r,t,Zl,!Ul);break a;case 2:eu=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=nu+300-ke(),10<i)){if(Su(r,t,Zl,!Ul),Ye(r,0,!0)!==0)break a;uu=t,r.timeoutHandle=Jd(bu.bind(null,r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,a,`Throttled`,-0,0),i);break a}bu(r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,a,null,-0,0)}}break}while(1);ad(e)}function bu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:en},Nl(t,a,d);var m=(a&62914560)===a?nu-ke():(a&4194048)===a?ru-ke():0;if(m=Jf(d,m),m!==null){uu=a,e.cancelPendingCommit=m(zu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Su(e,a,o,!l);return}}zu(e,t,a,n,r,i,o,s,c)}function xu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Cr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Su(e,t,n,r){t&=~Xl,t&=~Yl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ve(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&nt(e,n,t)}function Cu(){return W&6?!0:(od(0,!1),!1)}function J(){if(K!==null){if(Vl===0)var e=K.return;else e=K,Ji=qi=null,Mo(e),Na=null,Pa=0,e=K;for(;e!==null;)Uc(e.alternate,e),e=e.return;K=null}}function wu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Yd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),uu=0,J(),G=e,K=n=di(e.current,null),q=t,Vl=0,Hl=null,Ul=!1,Wl=Xe(e,t),Gl=!1,Ql=Zl=Xl=Yl=Jl=ql=0,eu=$l=null,tu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ve(r),a=1<<i;t|=e[i],r&=~a}return Kl=t,ti(),n}function Tu(e,t){z=null,k.H=Bs,t===Ca||t===Ta?(t=ja(),Vl=3):t===wa?(t=ja(),Vl=4):Vl=t===ic?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Hl=t,K===null&&(ql=1,Qs(e,yi(t,e.current)))}function Eu(){var e=io.current;return e===null?!0:(q&4194048)===q?ao===null:(q&62914560)===q||q&536870912?e===ao:!1}function Du(){var e=k.H;return k.H=Bs,e===null?Bs:e}function Ou(){var e=k.A;return k.A=zl,e}function ku(){ql=4,Ul||(q&4194048)!==q&&io.current!==null||(Wl=!0),!(Jl&134217727)&&!(Yl&134217727)||G===null||Su(G,q,Zl,!1)}function Au(e,t,n){var r=W;W|=2;var i=Du(),a=Ou();(G!==e||q!==t)&&(au=null,wu(e,t)),t=!1;var o=ql;a:do try{if(Vl!==0&&K!==null){var s=K,c=Hl;switch(Vl){case 8:J(),o=6;break a;case 3:case 2:case 9:case 6:io.current===null&&(t=!0);var l=Vl;if(Vl=0,Hl=null,Iu(e,s,c,l),n&&Wl){o=0;break a}break;default:l=Vl,Vl=0,Hl=null,Iu(e,s,c,l)}}ju(),o=ql;break}catch(t){Tu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ji=qi=null,W=r,k.H=i,k.A=a,K===null&&(G=null,q=0,ti()),o}function ju(){for(;K!==null;)Pu(K)}function Mu(e,t){var n=W;W|=2;var r=Du(),i=Ou();G!==e||q!==t?(au=null,iu=ke()+500,wu(e,t)):Wl=Xe(e,t);a:do try{if(Vl!==0&&K!==null){t=K;var a=Hl;b:switch(Vl){case 1:Vl=0,Hl=null,Iu(e,t,a,1);break;case 2:case 9:if(Da(a)){Vl=0,Hl=null,Fu(t);break}t=function(){Vl!==2&&Vl!==9||G!==e||(Vl=7),ad(e)},a.then(t,t);break a;case 3:Vl=7;break a;case 4:Vl=5;break a;case 7:Da(a)?(Vl=0,Hl=null,Fu(t)):(Vl=0,Hl=null,Iu(e,t,a,7));break;case 5:var o=null;switch(K.tag){case 26:o=K.memoizedState;case 5:case 27:var c=K;if(o?Gf(o):c.stateNode.complete){Vl=0,Hl=null;var l=c.sibling;if(l!==null)K=l;else{var u=c.return;u===null?K=null:(K=u,Lu(u))}break b}}Vl=0,Hl=null,Iu(e,t,a,5);break;case 6:Vl=0,Hl=null,Iu(e,t,a,6);break;case 8:J(),ql=6;break a;default:throw Error(s(462))}}Nu();break}catch(t){Tu(e,t)}while(1);return Ji=qi=null,k.H=r,k.A=i,W=n,K===null?(G=null,q=0,ti(),ql):0}function Nu(){for(;K!==null&&!De();)Pu(K)}function Pu(e){var t=Pc(e.alternate,e,Kl);e.memoizedProps=e.pendingProps,t===null?Lu(e):K=t}function Fu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=vc(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=vc(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:Mo(t);default:Uc(n,t),t=K=fi(t,Kl),t=Pc(n,t,Kl)}e.memoizedProps=e.pendingProps,t===null?Lu(e):K=t}function Iu(e,t,n,r){Ji=qi=null,Mo(t),Na=null,Pa=0;var i=t.return;try{if(rc(e,i,t,n,q)){ql=1,Qs(e,yi(n,e.current)),K=null;return}}catch(t){if(i!==null)throw K=i,t;ql=1,Qs(e,yi(n,e.current)),K=null;return}t.flags&32768?(R||r===1?e=!0:Wl||q&536870912?e=!1:(Ul=e=!0,(r===2||r===9||r===3||r===6)&&(r=io.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ru(t,e)):Lu(t)}function Lu(e){var t=e;do{if(t.flags&32768){Ru(t,Ul);return}e=t.return;var n=Vc(t.alternate,t,Kl);if(n!==null){K=n;return}if(t=t.sibling,t!==null){K=t;return}K=t=e}while(t!==null);ql===0&&(ql=5)}function Ru(e,t){do{var n=Hc(e.alternate,e);if(n!==null){n.flags&=32767,K=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){K=e;return}K=e=n}while(e!==null);ql=6,K=null}function zu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Wu();while(su!==0);if(W&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=ei,tt(e,n,a,o,c,l),e===G&&(K=G=null,q=0),lu=t,cu=e,uu=n,du=a,fu=i,pu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(Ne,function(){return Gu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=k.T,k.T=null,i=A.p,A.p=2,o=W,W|=4;try{sl(e,t,n)}finally{W=o,A.p=i,k.T=r}}su=1,Bu(),Vu(),Hu()}}function Bu(){if(su===1){su=0;var e=cu,t=lu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=W;W|=4;try{bl(t,e);var a=Vd,o=Or(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Dr(s.ownerDocument.documentElement,s)){if(c!==null&&kr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Er(s,h),v=Er(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}cp=!!Bd,Vd=Bd=null}finally{W=i,A.p=r,k.T=n}}e.current=t,su=2}}function Vu(){if(su===2){su=0;var e=cu,t=lu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=W;W|=4;try{cl(e,t.alternate,t)}finally{W=i,A.p=r,k.T=n}}su=3}}function Hu(){if(su===4||su===3){su=0,Oe();var e=cu,t=lu,n=uu,r=pu;t.subtreeFlags&10256||t.flags&10256?su=5:(su=0,lu=cu=null,Uu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ou=null),ot(n),t=t.stateNode,ze&&typeof ze.onCommitFiberRoot==`function`)try{ze.onCommitFiberRoot(Re,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=k.T,i=A.p,A.p=2,k.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{k.T=t,A.p=i}}uu&3&&Wu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===hu?mu++:(mu=0,hu=e):mu=0,od(0,!1)}}function Uu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ua(t)))}function Wu(){return Bu(),Vu(),Hu(),Gu()}function Gu(){if(su!==5)return!1;var e=cu,t=du;du=0;var n=ot(uu),r=k.T,i=A.p;try{A.p=32>n?32:n,k.T=null,n=fu,fu=null;var a=cu,o=uu;if(su=0,lu=cu=null,uu=0,W&6)throw Error(s(331));var c=W;if(W|=4,Il(a.current),Ol(a,a.current,o,n),W=c,od(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,a)}catch{}return!0}finally{A.p=i,k.T=r,Uu(e,t)}}function Ku(e,t,n){t=yi(n,t),t=ec(e.stateNode,t,2),e=Ga(e,t,2),e!==null&&(et(e,2),ad(e))}function Y(e,t,n){if(e.tag===3)Ku(e,e,n);else for(;t!==null;){if(t.tag===3){Ku(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=yi(n,e),n=tc(2),r=Ga(t,n,2),r!==null&&(nc(n,r,t,e),et(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Gl=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(ql===4||ql===3&&(q&62914560)===q&&300>ke()-nu?!(W&2)&&wu(e,0):Xl|=n,Ql===q&&(Ql=0)),ad(e)}function Yu(e,t){t===0&&(t=Qe()),e=ii(e,t),e!==null&&(et(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return Te(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=q,a=Ye(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Xe(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&qd()&&(e=id);for(var t=ke(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}su!==0&&su!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ve(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ze(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=G,n=q,n=Ye(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Xe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),ot(n)){case 2:case 8:n=Me;break;case 32:n=Ne;break;case 268435456:n=Fe;break;default:n=Ne}return r=ud.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ee(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(su!==0&&su!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wu()&&e.callbackNode!==n)return null;var r=q;return r=Ye(e,e===G?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(yu(e,r,t),ld(e,ke()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Wu())return null;yu(e,t,!0)}function fd(){Zd(function(){W&6?Te(je,sd):cd()})}function pd(){if(id===0){var e=pa;e===0&&(e=Ge,Ge<<=1,!(Ge&261888)&&(Ge=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:$t(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[dt]||null).action),o=r.submitter;o&&(t=(t=o[dt]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Sn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);Es(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),Es(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Yr.length;_d++){var vd=Yr[_d];Xr(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Xr(Vr,`onAnimationEnd`),Xr(Hr,`onAnimationIteration`),Xr(Ur,`onAnimationStart`),Xr(`dblclick`,`onDoubleClick`),Xr(`focusin`,`onFocus`),Xr(`focusout`,`onBlur`),Xr(Wr,`onTransitionRun`),Xr(Gr,`onTransitionStart`),Xr(Kr,`onTransitionCancel`),Xr(qr,`onTransitionEnd`),Et(`onMouseEnter`,[`mouseout`,`mouseover`]),Et(`onMouseLeave`,[`mouseout`,`mouseover`]),Et(`onPointerEnter`,[`pointerout`,`pointerover`]),Et(`onPointerLeave`,[`pointerout`,`pointerover`]),Tt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Tt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Tt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Tt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Zr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Zr(e)}i.currentTarget=null,a=c}}}}function X(e,t){var n=t[pt];n===void 0&&(n=t[pt]=new Set);var r=e+`__bubble`;n.has(r)||(wd(t,e,2,!1),n.add(r))}function Z(e,t,n){var r=0;t&&(r|=4),wd(n,e,r,t)}var Sd=`_reactListening`+Math.random().toString(36).slice(2);function Cd(e){if(!e[Sd]){e[Sd]=!0,Ct.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Z(t,!1,e),Z(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Sd]||(t[Sd]=!0,Z(`selectionchange`,!1,t))}}function wd(e,t,n,r){switch(hp(t)){case 2:var i=lp;break;case 8:i=up;break;default:i=dp}n=i.bind(null,t,n,e),i=void 0,!dn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Td(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=F(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}cn(function(){var r=a,i=nn(n),o=[];a:{var s=Jr.get(e);if(s!==void 0){var c=Sn,u=e;switch(e){case`keypress`:if(_n(n)===0)break a;case`keydown`:case`keyup`:c=Bn;break;case`focusin`:u=`focus`,c=jn;break;case`focusout`:u=`blur`,c=jn;break;case`beforeblur`:case`afterblur`:c=jn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=An;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Hn;break;case Vr:case Hr:case Ur:c=Mn;break;case qr:c=Un;break;case`scroll`:case`scrollend`:c=wn;break;case`wheel`:c=Wn;break;case`copy`:case`cut`:case`paste`:c=Nn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Vn;break;case`toggle`:case`beforetoggle`:c=Gn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=ln(m,p),g!=null&&d.push(Ed(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==tn&&(u=n.relatedTarget||n.fromElement)&&(F(u)||u[ft]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?F(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=kn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Vn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:bt(c),h=u==null?s:bt(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,F(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Od,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&kd(o,s,c,d,!1),u!==null&&f!==null&&kd(o,f,u,d,!0)}}a:{if(s=r?bt(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=dr;else if(ar(s))if(fr)v=xr;else{v=yr;var y=vr}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Xt(r.elementType)&&(v=dr):v=br;if(v&&=v(e,r)){or(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Ht(s,`number`,s.value)}switch(y=r?bt(r):window,e){case`focusin`:(ar(y)||y.contentEditable===`true`)&&(jr=y,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,Fr(o,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Fr(o,n,i)}var b;if(qn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else tr?$n(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Xn&&n.locale!==`ko`&&(tr||x!==`onCompositionStart`?x===`onCompositionEnd`&&tr&&(b=gn()):(pn=i,mn=`value`in pn?pn.value:pn.textContent,tr=!0)),y=Dd(r,x),0<y.length&&(x=new Pn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=er(n),b!==null&&(x.data=b)))),(b=Yn?nr(e,n):rr(e,n))&&(x=Dd(r,`onBeforeInput`),0<x.length&&(y=new Pn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),gd(o,e,r,n,i)}xd(o,t)})}function Ed(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Dd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=ln(e,n),i!=null&&r.unshift(Ed(e,i,a)),i=ln(e,t),i!=null&&r.push(Ed(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Od(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=ln(n,a),l!=null&&o.unshift(Ed(n,l,c))):i||(l=ln(n,a),l!=null&&o.push(Ed(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ad=/\r\n?/g,jd=/\u0000|\uFFFD/g;function Md(e){return(typeof e==`string`?e:``+e).replace(Ad,` 10`).replace(jd,``)}function Nd(e,t){return t=Md(t),Md(e)===t}function Pd(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Kt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Kt(e,``+r);break;case`className`:jt(e,`class`,r);break;case`tabIndex`:jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:jt(e,n,r);break;case`style`:Yt(e,r,a);break;case`data`:if(t!==`object`){jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof a==`function`&&(n===`formAction`?(t!==`input`&&Pd(e,t,`name`,i.name,i,null),Pd(e,t,`formEncType`,i.formEncType,i,null),Pd(e,t,`formMethod`,i.formMethod,i,null),Pd(e,t,`formTarget`,i.formTarget,i,null)):(Pd(e,t,`encType`,i.encType,i,null),Pd(e,t,`method`,i.method,i,null),Pd(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=en);break;case`onScroll`:r!=null&&X(`scroll`,e);break;case`onScrollEnd`:r!=null&&X(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=$t(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:X(`beforetoggle`,e),X(`toggle`,e),At(e,`popover`,r);break;case`xlinkActuate`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:At(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Zt.get(n)||n,At(e,n,r))}}function Fd(e,t,n,r,i,a){switch(n){case`style`:Yt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Kt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Kt(e,``+r);break;case`onScroll`:r!=null&&X(`scroll`,e);break;case`onScrollEnd`:r!=null&&X(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=en);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[dt]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):At(e,n,r)}}}function Id(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:X(`error`,e),X(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Pd(e,t,a,o,n,null)}}i&&Pd(e,t,`srcSet`,n.srcSet,n,null),r&&Pd(e,t,`src`,n.src,n,null);return;case`input`:X(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:Pd(e,t,r,d,n,null)}}L(e,a,c,l,u,o,i,!1);return;case`select`:for(i in X(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:Pd(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&Ut(e,!!r,n,!0):Ut(e,!!r,t,!1);return;case`textarea`:for(o in X(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:Pd(e,t,o,c,n,null)}Gt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Pd(e,t,l,r,n,null)}return;case`dialog`:X(`beforetoggle`,e),X(`toggle`,e),X(`cancel`,e),X(`close`,e);break;case`iframe`:case`object`:X(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)X(yd[r],e);break;case`image`:X(`error`,e),X(`load`,e);break;case`details`:X(`toggle`,e);break;case`embed`:case`source`:case`link`:X(`error`,e),X(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Pd(e,t,u,r,n,null)}return;default:if(Xt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Fd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Pd(e,t,c,r,n,null))}function Ld(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Pd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:o=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&Pd(e,t,p,m,r,f)}}Vt(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Pd(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:o=a;default:a!==l&&Pd(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?Ut(e,!!n,n?[]:``,!1):Ut(e,!!n,t,!0)):Ut(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Pd(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&Pd(e,t,o,i,r,a)}Wt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Pd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Pd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Pd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:Pd(e,t,u,p,r,m)}return;default:if(Xt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Fd(e,t,_,void 0,r,p);
vendor: 4,463 bytes, line 10
10for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Fd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Pd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Pd(e,t,f,p,r,m)}function Rd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function zd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Rd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Rd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Bd=null,Vd=null;function Hd(e){return e.nodeType===9?e:e.ownerDocument}function Ud(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Wd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Gd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Kd=null;function qd(){var e=window.event;return e&&e.type===`popstate`?e===Kd?!1:(Kd=e,!0):(Kd=null,!1)}var Jd=typeof setTimeout==`function`?setTimeout:void 0,Yd=typeof clearTimeout==`function`?clearTimeout:void 0,Xd=typeof Promise==`function`?Promise:void 0,Zd=typeof queueMicrotask==`function`?queueMicrotask:Xd===void 0?Jd:function(e){return Xd.resolve(null).then(e).catch(Qd)};function Qd(e){setTimeout(function(){throw e})}function $d(e){return e===`head`}function ef(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)hf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,hf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[_t]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&hf(e.ownerDocument.body);n=i}while(n);Np(t)}function tf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function nf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nf(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[_t])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=uf(e.nextSibling),e===null)break}return null}function af(e,t,n){if(t===``)return null;for(;
vendor: 20,897 bytes, line 10
10e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=uf(e.nextSibling),e===null))return null;return e}function of(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=uf(e.nextSibling),e===null))return null;return e}function sf(e){return e.data===`$?`||e.data===`$~`}function cf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function uf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var df=null;function ff(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return uf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function mf(e,t,n){switch(t=Hd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function hf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var gf=new Map,_f=new Set;function vf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var yf=A.d;A.d={f:bf,r:xf,D:wf,C:Tf,L:Ef,m:Df,X:Q,S:Of,M:kf};function bf(){var e=yf.f(),t=Cu();return e||t}function xf(e){var t=yt(e);t!==null&&t.tag===5&&t.type===`form`?Os(t):yf.r(e)}var Sf=typeof document>`u`?null:document;function Cf(e,t,n){var r=Sf;if(r&&typeof t==`string`&&t){var i=Bt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),_f.has(i)||(_f.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Id(t,`link`,e),St(t),r.head.appendChild(t)))}}function wf(e){yf.D(e),Cf(`dns-prefetch`,e,null)}function Tf(e,t){yf.C(e,t),Cf(`preconnect`,e,t)}function Ef(e,t,n){yf.L(e,t,n);var r=Sf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Bt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Bt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Bt(n.imageSizes)+`"]`)):i+=`[href="`+Bt(e)+`"]`;var a=i;switch(t){case`style`:a=jf(e);break;case`script`:a=Ff(e)}gf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),gf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Mf(a))||t===`script`&&r.querySelector(If(a))||(t=r.createElement(`link`),Id(t,`link`,e),St(t),r.head.appendChild(t)))}}function Df(e,t){yf.m(e,t);var n=Sf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Bt(r)+`"][href="`+Bt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ff(e)}if(!gf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),gf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(If(a)))return}r=n.createElement(`link`),Id(r,`link`,e),St(r),n.head.appendChild(r)}}}function Of(e,t,n){yf.S(e,t,n);var r=Sf;if(r&&e){var i=xt(r).hoistableStyles,a=jf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Mf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=gf.get(a))&&zf(e,n);var c=o=r.createElement(`link`);St(c),Id(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Rf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Q(e,t){yf.X(e,t);var n=Sf;if(n&&e){var r=xt(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=h({src:e,async:!0},t),(t=gf.get(i))&&Bf(e,t),a=n.createElement(`script`),St(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t){yf.M(e,t);var n=Sf;if(n&&e){var r=xt(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=gf.get(i))&&Bf(e,t),a=n.createElement(`script`),St(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t,n,r){var i=(i=de.current)?vf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=jf(n.href),n=xt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=jf(n.href);var a=xt(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(Mf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),gf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},gf.set(e,n),a||Pf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Ff(n),n=xt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function jf(e){return`href="`+Bt(e)+`"`}function Mf(e){return`link[rel="stylesheet"][`+e+`]`}function Nf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Pf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Id(t,`link`,n),St(t),e.head.appendChild(t))}function Ff(e){return`[src="`+Bt(e)+`"]`}function If(e){return`script[async]`+e}function Lf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Bt(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Id(r,`style`,i),Rf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=jf(n.href);var a=e.querySelector(Mf(i));if(a)return t.state.loading|=4,t.instance=a,St(a),a;r=Nf(n),(i=gf.get(i))&&zf(r,i),a=(e.ownerDocument||e).createElement(`link`),St(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Id(a,`link`,r),t.state.loading|=4,Rf(a,n.precedence,e),t.instance=a;case`script`:return a=Ff(n.src),(i=e.querySelector(If(a)))?(t.instance=i,St(i),i):(r=n,(i=gf.get(a))&&(r=h({},n),Bf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),St(i),Id(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Rf(r,n.precedence,e));return t.instance}function Rf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Vf=null;function Hf(e,t,n){if(Vf===null){var r=new Map,i=Vf=new Map;i.set(n,r)}else i=Vf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[_t]||a[ut]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Uf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Wf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Gf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Kf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=jf(r.href),a=t.querySelector(Mf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Yf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Nf(r),(i=gf.get(i))&&zf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Id(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Yf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var qf=0;function Jf(e,t){return e.stylesheets&&e.count===0&&Zf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&qf===0&&(qf=62500*zd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Yf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xf=null;function Zf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xf=new Map,t.forEach(Qf,e),Xf=null,Yf.call(e))}function Qf(e,t){if(!(t.state.loading&4)){var n=Xf.get(e);if(n)var r=n.get(null);else{n=new Map,Xf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Yf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var $f={$$typeof:C,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function ep(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function tp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ep(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=li(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ha(a),e}function np(e){return e?(e=si,e):si}function rp(e,t,n,r,i,a){i=np(i),r.context===null?r.context=i:r.pendingContext=i,r=Wa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ga(e,r,t),n!==null&&(vu(n,e,t),Ka(n,e,t))}function ip(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ap(e,t){ip(e,t),(e=e.alternate)&&ip(e,t)}function op(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&vu(t,e,67108864),ap(e,67108864)}}function sp(e){if(e.tag===13||e.tag===31){var t=gu();t=at(t);var n=ii(e,t);n!==null&&vu(n,e,t),ap(e,t)}}var cp=!0;function lp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,dp(e,t,n,r)}finally{A.p=a,k.T=i}}function up(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,dp(e,t,n,r)}finally{A.p=a,k.T=i}}function dp(e,t,n,r){if(cp){var i=fp(r);if(i===null)Td(e,t,r,pp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=yt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Je(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ve(o);s.entanglements[1]|=c,o&=~c}ad(a),!(W&6)&&(iu=ke()+500,od(0,!1))}}break;case 31:case 13:s=ii(a,2),s!==null&&vu(s,a,2),Cu(),ap(a,2)}if(a=fp(r),a===null&&Td(e,t,r,pp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Td(e,t,r,null,n)}}function fp(e){return e=nn(e),mp(e)}var pp=null;function mp(e){if(pp=null,e=F(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return pp=e,null}function hp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ae()){case je:return 2;case Me:return 8;case Ne:case Pe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var $=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=yt(t),t!==null&&op(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=F(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,ct(e.priority,function(){sp(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,ct(e.priority,function(){sp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tn=r,n.target.dispatchEvent(r),tn=null}else return t=yt(n),t!==null&&op(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){$=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,$||($=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(mp(r||n)===null)continue;break}var a=yt(n);a!==null&&(e.splice(t,3),t-=3,Es(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[dt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[dt]||null)s=o.formAction;else if(mp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;rp(n,gu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rp(e.current,2,null,e,null,null),Cu(),t[ft]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=st();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=r.version;if(Lp!==`19.2.7`)throw Error(s(527,Lp,`19.2.7`));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.2.7`};
10if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Re=zp.inject(Rp),ze=zp}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Ys,a=Xs,o=Zs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=tp(e,1,!1,null,null,n,r,null,i,a,o,Pp),e[ft]=t.current,Cd(e),new Fp(t)}})),c=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),f=e(((e,t)=>{t.exports=d()}))(),p=(0,l.createContext)(null),m=()=>window.location.pathname+window.location.search;function h({children:e}){let[t,n]=(0,l.useState)(m);(0,l.useEffect)(()=>{let e=()=>n(m());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let r=(0,l.useCallback)(e=>{window.history.pushState(null,``,e),n(m()),window.scrollTo(0,0)},[]);return(0,f.jsx)(p.Provider,{value:{url:t,navigate:r},children:e})}function g(){let e=(0,l.useContext)(p);if(!e)throw Error(`useRoute outside RouterProvider`);let t=new URL(e.url,window.location.origin);return{pathname:t.pathname,params:t.searchParams,navigate:e.navigate}}function _({to:e,children:t,...n}){let r=(0,l.useContext)(p);if(!r)throw Error(`Link outside RouterProvider`);return(0,f.jsx)(`a`,{href:e,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),r.navigate(e))},...n,children:t})}var v=(0,l.createContext)({theme:`light`,toggle:()=>{},set:()=>{}}),y=()=>{let e=window.localStorage.getItem(`playground-theme`);return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`};function b({children:e}){let[t,n]=(0,l.useState)(y);return(0,l.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,t),window.localStorage.setItem(`playground-theme`,t)},[t]),(0,f.jsx)(v.Provider,{value:{theme:t,toggle:()=>n(e=>e===`light`?`dark`:`light`),set:n},children:e})}var x=()=>(0,l.useContext)(v),S=!1,C=new Set,w=e=>(C.add(e),()=>C.delete(e));function T(){S||(S=!0,C.forEach(e=>e()))}function E(e){let t=e instanceof Error?e.message:String(e);return/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Failed to load module script|ChunkLoadError|Unable to preload CSS/i.test(t)}function ee(e){return E(e)?(T(),!0):!1}function te(){return(0,l.useSyncExternalStore)(w,()=>S)}typeof window<`u`&&window.addEventListener(`vite:preloadError`,e=>{e.preventDefault(),T()});function ne({open:e,onClose:t}){let n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!e)return;n.current?.focus();let r=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[e,t]),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`drawer__scrim`,onClick:t,"aria-hidden":!0}),(0,f.jsxs)(`aside`,{className:`drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":`How to use the playground`,children:[(0,f.jsxs)(`div`,{className:`drawer__head`,children:[(0,f.jsx)(`span`,{className:`pane__title`,children:`How do I use this?`}),(0,f.jsx)(`button`,{type:`button`,ref:n,className:`btn--small drawer__close`,onClick:t,children:`Close`})]}),(0,f.jsxs)(`div`,{className:`drawer__body`,children:[(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`What this is`}),(0,f.jsxs)(`p`,{children:[`A `,(0,f.jsx)(`b`,{children:`contract`}),` is one JSON file per component: its props and their legal values, the parts itâs made of, which design token paints each part, and its states. A React component and a Figma component set are both`,` `,(0,f.jsx)(`i`,{children:`generated`}),` from that file â neither is hand-maintained, and a differ proves they still match.`]}),(0,f.jsx)(`p`,{children:`This page runs the real engine in your browser so you can see that happen. Load a contract, change it, watch every output move together â and watch the engine refuse, by name, when you ask for something it cannot honestly do.`}),(0,f.jsxs)(`p`,{className:`drawer__subnote`,children:[(0,f.jsx)(`b`,{children:`What it is not:`}),` this is not how you build your library into Figma. That is the `,(0,f.jsx)(`code`,{children:`ds-contracts`}),` CLI plus the Sync Runner plugin â the CLI packages your contracts and tokens into one bundle, the plugin builds it onto the canvas.`,` `,(0,f.jsx)(`a`,{href:`https://ds-contracts-spec.pages.dev/get-started/`,target:`_blank`,rel:`noreferrer`,children:`The three get-started paths`}),` `,`walk that end to end.`]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`If you only do one thing`}),(0,f.jsxs)(`p`,{children:[`Open `,(0,f.jsx)(`b`,{children:`Examples`}),`, load the Badge, then break its contract on purpose â point a token binding at a name that doesnât exist, or delete a required field. The named refusal that appears is the entire product. Everything else here is plumbing around that behaviour.`]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Coming from design`}),(0,f.jsxs)(`p`,{children:[`Open the `,(0,f.jsx)(`b`,{children:`Figma`}),` tab and paste a figma.com component URL + personal access token. That is the route that works today; the live relay from the plugin is switched off (its `,(0,f.jsx)(`b`,{children:`Send to Playground`}),` tab was removed when the pluginâs tabs were re-housed into Build / Changes / Send), and the button says so rather than failing when you press it. The token stays in your browser, sent only to api.figma.com â session-only by default; the âRemember on this deviceâ checkbox (and the matching one on the Describe tabâs Anthropic key) opts a secret into this browserâs localStorage ONLY, until you clear it from the same field.`]}),(0,f.jsxs)(`p`,{children:[`When the plan withholds variable names, resolved values are minted as provisional`,` `,(0,f.jsx)(`code`,{children:`imported.*`}),` tokens â the preview stays styled, the receipts list every mint, and âSuggest semantic names (AI)â proposes renames you apply one by one, refereed. No token? Demo import runs the identical path over a committed fixture.`]}),(0,f.jsxs)(`p`,{children:[`To close the loop, copy the `,(0,f.jsx)(`b`,{children:`Figma script`}),` output and run it in the source file through the Sync Runner pluginâs `,(0,f.jsx)(`b`,{children:`Advanced â Paste a script`}),` `,`drawer (a developer surface â it runs raw scripts with full plugin permissions): it builds the contractâs version beside your original for A/B â provisional variables included. The pluginâs everyday door is `,(0,f.jsx)(`b`,{children:`Build`}),`, which takes a contracts file rather than a script.`]}),(0,f.jsxs)(`p`,{className:`drawer__subnote`,children:[(0,f.jsx)(`b`,{children:`Working locally?`}),` Two more rungs, by variable-name fidelity: paste a plugin dump (`,(0,f.jsx)(`code`,{children:`extract/figma/dump.plugin.js`}),` output) in the `,(0,f.jsx)(`b`,{children:`JSON`}),` tab â native variable names, zero ambiguity; or run`,` `,(0,f.jsx)(`code`,{children:`npm run extract:figma:mcp`}),` in the repo against the desktop app â full names on any plan, CLI-only (the desktop MCP server allows no browser origins). Same dump, same proposer, same refusals as the URL import; only how much of the variable names survives differs.`]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Coming from code`}),(0,f.jsxs)(`p`,{children:[`Open the `,(0,f.jsx)(`b`,{children:`Code`}),` tab. Paste TSX + CSS, or a public GitHub file or directory URL â the tracer follows the entryâs relative imports (every fetch receipted), and anything it cannot close is a named gap with an AI fetch-plan as the next rung.`]}),(0,f.jsx)(`p`,{children:`Every raw value is reported with nearest-token candidates, nothing invented. Check the Figma script tab for its design side.`})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Using the examples`}),(0,f.jsxs)(`p`,{children:[`Pick a contract from the `,(0,f.jsx)(`b`,{children:`Examples`}),` gallery. Edit it in the center pane â the schema and generator referee every keystroke, refusals by name, offending lines highlighted. The output tabs regenerate live.`]}),(0,f.jsxs)(`p`,{children:[`When the generator refuses a schema-valid contract, `,(0,f.jsx)(`b`,{children:`Fix with AI`}),` in the refusal banner sends the named refusals to the shared assist Worker â the corrected contract loads as an ai-proposed round (2 max, Undo included) and is re-refereed; nothing applies silently.`]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Starting from nothing`}),(0,f.jsxs)(`p`,{children:[`Open the `,(0,f.jsx)(`b`,{children:`Describe`}),` tab. One sentence plus your Anthropic key generates a contract â never freeform code â refereed by the same editor. No key? Demo generate replays a recorded response through the same path.`]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Tokens`}),(0,f.jsxs)(`p`,{children:[`Bring your own: paste DTCG token JSON in the `,(0,f.jsx)(`b`,{children:`Tokens`}),` tab and every consumer â validation, preview, suggestions, emitters â rebinds to your tree.`]}
10)]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Share`}),(0,f.jsxs)(`p`,{children:[(0,f.jsx)(`b`,{children:`Share`}),` copies a URL carrying the contract, output tab, and theme â never your tokens or keys.`]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`drawer__section-title`,children:`Glossary`}),(0,f.jsxs)(`dl`,{className:`drawer__glossary`,children:[(0,f.jsx)(`dt`,{children:`Contract`}),(0,f.jsx)(`dd`,{children:`The one JSON document that describes a component â its props, structure, and token references â from which every output is generated.`}),(0,f.jsx)(`dt`,{children:`Anatomy`}),(0,f.jsx)(`dd`,{children:`The contractâs named tree of parts (root, label, iconâ¦) that both the CSS and the Figma layers are built from.`}),(0,f.jsx)(`dt`,{children:`Token binding`}),(0,f.jsxs)(`dd`,{children:[`A style tied to a design-token name, like`,` `,(0,f.jsx)(`code`,{children:`{color.action.primary.background}`}),`, instead of a hard-coded value.`]}),(0,f.jsx)(`dt`,{children:`Emitter`}),(0,f.jsx)(`dd`,{children:`A function that turns a contract into one kind of output â React code, plain HTML, or a script that builds the Figma component.`}),(0,f.jsx)(`dt`,{children:`Refusal`}),(0,f.jsx)(`dd`,{children:`The engine declining to generate because something in the contract is wrong, with the exact reason named â never a silent guess or fix.`}),(0,f.jsx)(`dt`,{children:`Degradation`}),(0,f.jsx)(`dd`,{children:`When an import canât get full information (say, no variable names), the result steps down a tier and reports what was missing instead of inventing it.`}),(0,f.jsx)(`dt`,{children:`Promotion`}),(0,f.jsx)(`dd`,{children:`A change made on one surface (design or code) becoming a reviewed update to the contract, which then regenerates the other surface to match.`})]})]})]})]})]}):null}var D={$schema:`./contract.schema.json`,id:`ds.accordion-item`,name:`AccordionItem`,version:`1.1.0`,status:`draft`,description:`A collapsible content row: trigger with a state chevron, content revealed when open. API mirrors industry convention (Astryx Collapsible) with the open state flattened to a closed/open enum so both surfaces render both states; the toggle itself is contract-declared (onToggle + aria-expanded, generated); richer behavior stays a declared boundary.`,semantics:{element:`div`},props:[{name:`state`,description:`Closed shows only the trigger; open reveals the content and rotates the chevron.`,type:{enum:[`closed`,`open`]},default:`closed`,bindings:{figma:{kind:`VARIANT`,property:`State`,values:{closed:`Closed`,open:`Open`}},code:{prop:`state`}}},{name:`title`,description:`The always-visible trigger text.`,type:`text`,default:`Section title`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Title`},code:{prop:`title`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.card}`,"background-color":`{color.surface.raised}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{trigger:{layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`},parts:{chevron:{description:`Direction follows the state: right when closed, down when open.`,icon:{asset:`{state}`,size:14},tokens:{color:`{color.text.secondary}`}},titleText:{element:`span`,content:{prop:`title`},layout:{grow:!0},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`}}},element:`button`},contentArea:{description:`Revealed content â open state only.`,slot:{name:`children`,acceptsMode:`open`},visibleWhen:{prop:`state`,equals:`open`},layout:{direction:`column`,align:`stretch`},tokens:{"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`ba5ec62aa3c19bf86b7bcff8eb61ef1e86daad35`,nodeId:`11:1171`}
10,code:{importPath:`src/components/AccordionItem`,export:`AccordionItem`}},events:[{name:`toggle`,description:`Fires when the trigger is activated; uncontrolled instances flip state closed/open themselves.`,bindings:{code:{prop:`onToggle`}},trigger:`trigger`,toggles:{prop:`state`,between:[`closed`,`open`],aria:`expanded`}}]},O={$schema:`./contract.schema.json`,id:`ds.avatar-group`,name:`AvatarGroup`,version:`1.0.0`,status:`draft`,description:`Stacked avatars with an overflow count. API mirrors industry convention (Astryx AvatarGroup): overlapping layout â expressed as a negative-margin child rule in CSS and negative item spacing on the canvas.`,semantics:{element:`div`},props:[{name:`overflowLabel`,description:`The +N overflow indicator text.`,type:`text`,default:`+3`,bindings:{figma:{kind:`TEXT`,property:`Overflow`},code:{prop:`overflowLabel`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`},parts:{stack:{layout:{direction:`row`,align:`center`,overlap:!0},tokens:{gap:`{space.avatarGroup.overlap}`},slot:{name:`children`,accepts:[`ds.avatar`],acceptsMode:`prefer`,defaultContent:[{id:`ds.avatar`,props:{size:`md`},text:`AB`},{id:`ds.avatar`,props:{size:`md`},text:`CD`},{id:`ds.avatar`,props:{size:`md`},text:`EF`}]}},overflowText:{element:`span`,content:{prop:`overflowLabel`},tokens:{width:`{size.avatar.md}`,height:`{size.avatar.md}`,"background-color":`{color.action.secondary.background}`,color:`{color.text.secondary}`,"border-radius":`{radius.pill}`,"font-family":`{font.control.family}`,"font-size":`{font.avatar.size.md}`,"font-weight":`{font.control.weight}`},layout:{display:`inline-flex`,direction:`row`,align:`center`,justify:`center`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`41e084d38457f2aebd4611e3ebd922a56c2c392d`,nodeId:`11:1172`},code:{importPath:`src/components/AvatarGroup`,export:`AvatarGroup`}}},re={$schema:`./contract.schema.json`,id:`ds.avatar`,name:`Avatar`,version:`1.0.0`,status:`draft`,description:`Represents a person or entity with initials. Non-interactive.`,semantics:{element:`span`,role:`img`},props:[{name:`size`,description:`Avatar diameter.`,type:{enum:[`sm`,`md`]},default:`sm`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`}},code:{prop:`size`}}},{name:`children`,description:`Initials (1â2 characters).`,type:`text`,default:`AB`,bindings:{figma:{kind:`TEXT`,property:`Initials`},code:{prop:`children`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`,justify:`center`},tokens:{width:`{size.avatar.{size}}`,height:`{size.avatar.{size}}`,"border-radius":`{radius.avatar}`,"background-color":`{color.identity.background}`,color:`{color.identity.foreground}`,"font-family":`{font.control.family}`,"font-weight":`{font.control.weight}`,"font-size":`{font.avatar.size.{size}}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`b39059e770141b713f28ae1816be3ed756cd79da`,nodeId:`2:20`},code:{importPath:`src/components/Avatar`,export:`Avatar`}}},ie={$schema:`./contract.schema.json`,id:`ds.badge`,name:`Badge`,version:`1.1.0`,status:`draft`,description:`Communicates status or categorization at a glance. Non-interactive.`,semantics:{element:`span`,role:`status`},props:[{name:`variant`,description:`The feedback tone being communicated.`,type:{enum:[`info`,`success`,`warning`,`danger`,`error`]},default:`info`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{info:`Info`,success:`Success`,warning:`Warning`,danger:`Danger`,error:`Error`}},code:{prop:`variant`}}},{name:`children`,description:`Badge label.`,type:`text`,default:`Badge`,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`children`}}}],states:[],anatomy:{root:{tokens:{"background-color":`{color.feedback.{variant}.background}`,color:`{color.feedback.{variant}.foreground}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.sm}`,"border-radius":`{radius.badge}`,"font-family":`{font.control.family}`,"font-weight":`{font.control.weight}`,"font-size":`{font.badge.size}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`89f1fb2d4580116cea4be5d4ca340de216a27819`,nodeId:`6:10`},code:{importPath:`src/components/Badge`,export:`Badge`}}},ae={$schema:`./contract.schema.json`,id:`ds.banner`,name:`Banner`,version:`1.0.1`,status:`draft`,description:`Persistent inline notification for page- or section-level feedback. API mirrors industry convention (Astryx Banner): status drives color, icon, and ARIA role; dismissable banners expose a close affordance; endContent carries actions.`,semantics:{element:`div`,roleByProp:{prop:`status`,map:{info:`status`,success:`status`,warning:`alert`,error:`alert`}}},props:[{name:`status`,description:`Feedback tone â drives the color scheme, the leading icon, and the ARIA role (error/warning announce as alerts).`,type:{enum:[`info`,`success`,`warning`,`error`]},default:`info`,bindings:{figma:{kind:`VARIANT`,property:`Status`,values:{info:`Info`,success:`Success`,warning:`Warning`,error:`Error`}},code:{prop:`status`}}},{name:`container`,description:`card = standalone with radius; section = full-bleed, square.`,type:{enum:[`card`,`section`]},default:`card`,bindings:{figma:{kind:`VARIANT`,property:`Container`,values:{card:`Card`,section:`Section`}},code:{prop:`container`}}},{name:`isDismissable`,description:`Shows the close affordance. Keep error banners until resolved.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Dismissable`},code:{prop:`isDismissable`}}},{name:`title`,description:`Prominent header text.`,type:`text`,default:`Banner title`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Title`},code:{prop:`title`}}},{name:`description`,description:`Secondary text below the title.`,type:`text`,default:`Supporting detail that explains what happened and what to do next.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`start`},tokens:{"max-width":`{size.banner.width}`,"background-color":`{color.feedback.{status}.background}`,color:`{color.feedback.{status}.foreground}`,"border-radius":`{radius.banner.{container}}
10`,gap:`{space.gap.control}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.lg}`},parts:{statusIcon:{description:`Leading icon, selected by status. Decorative â hidden from assistive tech.`,icon:{asset:`{status}`}},body:{layout:{direction:`column`,grow:!0},tokens:{gap:`{space.inset-y.sm}`},parts:{title:{element:`div`,content:{prop:`title`},tokens:{"font-family":`{font.control.family}`,"font-size":`{font.control.size.md}`,"font-weight":`{font.title.weight}`}},descriptionText:{element:`div`,content:{prop:`description`},tokens:{"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.weight.regular}`}}}},endArea:{layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`},parts:{endContent:{description:`End-aligned action slot â typically a secondary Button.`,slot:{name:`endContent`,accepts:[`ds.button`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}},close:{description:`Close affordance â rendered only when isDismissable.`,element:`button`,visibleWhen:{prop:`isDismissable`},icon:{asset:`close`},attrs:{"aria-label":`Dismiss`,type:`button`,"data-action":`dismiss`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`6acb10544bd5dce1800d610744c0e346fc12bfb9`,nodeId:`11:184`},code:{importPath:`src/components/Banner`,export:`Banner`}}},oe={$schema:`./contract.schema.json`,id:`ds.bento-grid`,name:`BentoGrid`,version:`1.0.0`,status:`draft`,description:`The span matrix (G2) addressed through named areas (G4): a 3x4 bento whose five regions span rows and columns and whose area names ARE the slot anchors. Mixed px/fr tracks on both axes and independent row/column gaps.`,semantics:{element:`div`},props:[],states:[],anatomy:{root:{layout:{display:`grid`,rows:[{px:80},{fr:1},{fr:2}],columns:[{px:160},{fr:1},{fr:1},{px:120}],gap:{row:`{space.gap.sm}`,column:`{space.gap.md}`},areas:{header:{row:0,column:0,columnSpan:4},sidebar:{row:1,column:0,rowSpan:2},main:{row:1,column:1,columnSpan:2},rail:{row:1,column:3,rowSpan:2},footer:{row:2,column:1,columnSpan:2}}},literals:{width:`640px`,height:`480px`},parts:{header:{description:`Full-bleed banner region â one row, all four columns.`,element:`header`,slot:{name:`header`,figmaProperty:`Header`}},sidebar:{description:`Stationary 160px rail on the left, spanning both content rows.`,element:`aside`,slot:{name:`sidebar`,figmaProperty:`Sidebar`}},main:{description:`Primary region â the 1fr row across the two fr columns.`,element:`main`,slot:{name:`main`,figmaProperty:`Main`}},rail:{description:`Stationary 120px rail on the right, spanning both content rows.`,slot:{name:`rail`,figmaProperty:`Rail`}},footer:{description:`Deep region on the 2fr row, under main.`,element:`footer`,slot:{name:`footer`,figmaProperty:`Footer`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:null,componentSetKey:null},code:{importPath:`src/components/BentoGrid`,export:`BentoGrid`}}},k={$schema:`./contract.schema.json`,id:`ds.blockquote`,name:`Blockquote`,version:`1.0.0`,status:`draft`,description:`Styled quotation block with an accent left border for quotes, testimonials, and excerpts. API mirrors industry convention (Astryx Blockquote): content plus an optional cite slot rendered in semantic footer/cite markup.`,semantics:{element:`blockquote`},props:[],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`},tokens:{"border-left-width":`{border.width.divider.strong}`,"border-left-color":`{color.divider.strong}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.md}`,gap:`{space.gap.sm}`,color:`{color.text.secondary}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.md}`},parts:{quote:{description:`The quoted content.`,slot:{name:`children`,acceptsMode:`open`},layout:{direction:`column`}},citation:{description:`Attribution, rendered in a semantic footer.`,element:`footer`,slot:{name:`cite`,acceptsMode:`open`},optional:!0,tokens:{"font-size":`{font.control.size.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`b6dd9d18639b0b053e55d307b2a8dbf1d4af3cef`,nodeId:`11:270`},code:{importPath:`src/components/Blockquote`,export:`Blockquote`}}},A={$schema:`./contract.schema.json`,id:`ds.breadcrumb-item`,name:`BreadcrumbItem`,version:`1.0.0`,status:`draft`,description:`One link in a breadcrumb trail with its leading separator. API mirrors industry convention (Astryx BreadcrumbItem); the first item is authored with hasSeparator off (positional part logic is a documented gap), and aria-current needs conditional attributes â also documented.`,semantics:{element:`span`},props:[{name:`hasSeparator`,description:`Leading separator â off for the first item in a trail.`,type:`boolean`,default:!0,bindings:{figma:{kind:`BOOLEAN`,property:`Separator`},code:{prop:`hasSeparator`}}}
10,{name:`label`,description:`The crumb text.`,type:`text`,default:`Page`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`href`,description:`Navigation target. Current-page items conventionally point at themselves.`,type:`text`,default:`#`,bindings:{figma:{kind:`TEXT`,property:`Href`},code:{prop:`href`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`},parts:{separatorIcon:{icon:{asset:`chevron-right`,size:12},visibleWhen:{prop:`hasSeparator`},tokens:{color:`{color.text.secondary}`}},link:{element:`a`,content:{prop:`label`},attrs:{href:`{href}`},tokens:{color:`{color.text.secondary}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`7b9283aad1ddc94a1a597804a79a330316b3aaa1`,nodeId:`11:1182`},code:{importPath:`src/components/BreadcrumbItem`,export:`BreadcrumbItem`}}},se={$schema:`./contract.schema.json`,id:`ds.breadcrumbs`,name:`Breadcrumbs`,version:`1.0.0`,status:`draft`,description:`Navigation trail from root to the current page. API mirrors industry convention (Astryx Breadcrumbs): a nav landmark holding BreadcrumbItems; keep trails to five levels or fewer.`,semantics:{element:`nav`},props:[{name:`label`,description:`Accessible label for the navigation landmark.`,type:`text`,default:`Breadcrumb`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},attrs:{"aria-label":`{label}`},tokens:{gap:`{space.inset-y.sm}`},parts:{trail:{slot:{name:`children`,accepts:[`ds.breadcrumb-item`],acceptsMode:`prefer`,defaultContent:[{id:`ds.breadcrumb-item`,props:{label:`Home`,hasSeparator:!1}},{id:`ds.breadcrumb-item`,props:{label:`Components`}},{id:`ds.breadcrumb-item`,props:{label:`ProgressBar`}}]},layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`853821e9b58b03010cfeda157fd8ffcf2338bb15`,nodeId:`11:1186`},code:{importPath:`src/components/Breadcrumbs`,export:`Breadcrumbs`}}},j={$schema:`./contract.schema.json`,id:`ds.button`,name:`Button`,version:`1.5.0`,status:`draft`,description:`Triggers an action or event. Use one primary button per context.`,semantics:{element:`button`,role:`button`},props:[{name:`variant`,description:`Visual prominence of the action.`,type:{enum:[`primary`,`secondary`,`danger`,`ghost`]},default:`primary`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{primary:`Primary`,secondary:`Secondary`,danger:`Danger`,ghost:`Ghost`}}
10,code:{prop:`variant`}}},{name:`size`,description:`Control density.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`disabled`,description:`Prevents interaction and communicates unavailability.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Disabled`},code:{prop:`disabled`}}},{name:`loading`,description:`Shows a spinning busy indicator beside the label while an async action resolves.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Loading`},code:{prop:`loading`}}},{name:`children`,description:`Button label.`,type:`text`,default:`Button`,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`children`}}}],states:[`hover`,`focus-visible`,`disabled`],figmaStatePreviews:!0,anatomy:{root:{tokens:{"background-color":`{color.action.{variant}.background}`,color:`{color.action.{variant}.foreground}`,"padding-inline":`{space.inset-x.{size}}`,"padding-block":`{space.inset-y.{size}}`,"border-radius":`{radius.control}`,gap:`{space.gap.control}`,"font-family":`{font.control.family}`,"font-weight":`{font.control.weight}`,"font-size":`{font.control.size.{size}}`},states:{hover:{"background-color":`{color.action.{variant}.background-hover}`},"focus-visible":{"outline-color":`{color.border.focus}`,"outline-width":`{border.width.focus}`},disabled:{opacity:`{opacity.disabled}`}},layout:{display:`inline-flex`,direction:`row`,align:`center`,justify:`center`},parts:{loadingSpinner:{description:`Busy indicator, shown while loading.`,icon:{asset:`spinner`,size:14},animation:`spin`,visibleWhen:{prop:`loading`}},label:{element:`span`,content:{prop:`children`}}}}},a11y:{focusVisible:!0,minHitArea:44,contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`1b5d2a573f3f39404af396bdbe944a30ca0eaec3`,nodeId:`5:21`},code:{importPath:`src/components/Button`,export:`Button`}}},ce={$schema:`./contract.schema.json`,id:`ds.card`,name:`Card`,version:`1.1.0`,status:`draft`,description:`Groups related content behind one subject. Composes an Avatar, a bound title, a default body slot, and a constrained actions slot.`,semantics:{element:`article`},props:[{name:`title`,description:`Card heading, bound to the header title part on both surfaces.`,type:`text`,default:`Card title`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Title`},code:{prop:`title`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"background-color":`{color.surface.raised}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.card}`,"max-width":`{size.card.width}`},parts:{header:{element:`header`,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.control}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.md}`},parts:{avatar:{description:`Fixed identity anchor â an instance of ds.avatar.`,component:{id:`ds.avatar`,props:{size:`sm`}}},title:{element:`span`,content:{prop:`title`},tokens:{color:`{color.surface.foreground}`,"font-family":`{font.control.family}`,"font-size":`{font.title.size}`,"font-weight":`{font.title.weight}`}}}},body:{description:`Default slot â the card's main content.`,layout:{direction:`column`,align:`stretch`},tokens:{gap:`{space.gap.control}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.md}`,color:`{color.surface.foreground}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`},slot:{name:`children`,figmaProperty:`Body`,required:!0}},footer:{element:`footer`,description:`Constrained actions slot â only actions-grade components.`,optional:!0,layout:{direction:`row`,align:`center`,justify:`end`},tokens:{gap:`{space.gap.control}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.md}`},slot:{name:`actions`,accepts:[`ds.button`,`ds.badge`]}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`7cd7011e4f2374161cd212f02992c7fd0f899430`,nodeId:`2:21`},code:{importPath:`src/components/Card`,export:`Card`}}},M={$schema:`./contract.schema.json`,id:`ds.chat-message-metadata`,name:`ChatMessageMetadata`,version:`1.0.0`,status:`draft`,description:`Metadata row for a chat message: delivery status, timestamp, and footer content. API mirrors industry convention (Astryx ChatMessageMetadata): status drives the icon.`,semantics:{element:`div`},props:[{name:`status`,description:`Delivery status â drives the leading icon.`,type:{enum:[`sending`,`sent`,`delivered`,`read`,`error`]},default:`sent`,bindings:{figma:{kind:`VARIANT`,property:`Status`,values:{sending:`Sending`,sent:`Sent`,delivered:`Delivered`,read:`Read`,error:`Error`}},code:{prop:`status`}}},{name:`timestamp`,description:`Display timestamp text.`,type:`text`,default:`2:14 PM`,bindings:{figma:{kind:`TEXT`,property:`Timestamp`},code:{prop:`timestamp`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`,"font-family":`{font.control.family}`,"font-size":`{font.badge.size}`,color:`{color.text.secondary}`},parts:{statusIcon:{description:`Delivery status glyph, selected by status. Decorative.`,icon:{asset:`{status}`,size:12}},timestampText:{element:`span`,content:{prop:`timestamp`}},footer:{description:`Footer content â model info, reactions, a copy affordance.`,slot:{name:`footer`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`25f176c40364af596d09a7d897e371208934ff43`,nodeId:`11:789`},code:{importPath:`src/components/ChatMessageMetadata`,export:`ChatMessageMetadata`}}},N={$schema:`./contract.schema.json`,id:`ds.chat-message`,name:`ChatMessage`,version:`1.1.0`,status:`draft`,description:`Sender-context wrapper for a chat message: avatar, name, bubble content, and metadata. API mirrors industry convention (Astryx ChatMessage); the bubble color follows sender, and sender-based alignment flips via layoutByProp â user messages render right-aligned (row-reverse root, end-aligned body) on both surfaces.`,semantics:{element:`div`},props:[{name:`sender`,description:`Who sent it â drives the bubble color scheme.`,type:{enum:[`user`,`assistant`,`system`]},default:`assistant`,bindings:{figma:{kind:`VARIANT`,property:`Sender`,values:{user:`User`,assistant:`Assistant`,system:`System`}},code:{prop:`sender`}}},{name:`name`,description:`Sender name shown above the message body.`,type:`text`,default:`Assistant`,bindings:{figma:{kind:`TEXT`,property:`Name`},code:{prop:`name`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`start`},layoutByProp:{prop:`sender`,map:{user:{direction:`row-reverse`}}},tokens:{"max-width":`{size.banner.width}`,gap:`{space.gap.sm}`,"font-family":`{font.control.family}`},parts:{avatarSlot:{description:`Avatar beside the message.`,slot:{name:`avatar`,accepts:[`ds.avatar`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`start`}},body:{layout:{direction:`column`,grow:!0,align:`stretch`},layoutByProp:{prop:`sender`,map:{user:{align:`end`}}},tokens:{gap:`{space.inset-y.sm}`},parts:{nameText:{element:`span`,content:{prop:`name`},tokens:{"font-size":`{font.badge.size}`,"font-weight":`{font.title.weight}`,color:`{color.text.secondary}`}},bubble:{description:`The message bubble â free-form content.`,slot:{name:`children`,acceptsMode:`open`},layout:{direction:`column`,align:`stretch`},tokens:{"background-color":`{color.chat.{sender}.background}`,color:`{color.chat.{sender}.foreground}`,"border-radius":`{radius.card}`,gap:`{space.inset-y.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"font-size":`{font.control.size.sm}`}},metadataSlot:{description:`Timestamp and delivery status below the bubble.`,slot:{name:`metadata`,accepts:[`ds.chat-message-metadata`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`4af367f1f1c5044640cd31d2cbdd3e575b1bbb54`,
10nodeId:`11:826`},code:{importPath:`src/components/ChatMessage`,export:`ChatMessage`}}},P={$schema:`./contract.schema.json`,id:`ds.chat-system-message`,name:`ChatSystemMessage`,version:`1.0.0`,status:`draft`,description:`Centered system message for non-sender chat content â date separators, membership changes, status notices. API mirrors industry convention (Astryx ChatSystemMessage): the divider variant adds a line on each side.`,semantics:{element:`div`},props:[{name:`variant`,description:`Plain centered text, or text between divider lines.`,type:{enum:[`default`,`divider`]},default:`default`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{default:`Default`,divider:`Divider`}},code:{prop:`variant`}}},{name:`message`,description:`Short factual string â a date, a join notice, a status change.`,type:`text`,default:`Today`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Message`},code:{prop:`message`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`,justify:`center`},tokens:{"max-width":`{size.card.width}`,gap:`{space.gap.sm}`,"font-family":`{font.control.family}`,"font-size":`{font.badge.size}`,color:`{color.text.secondary}`},parts:{lineStart:{description:`Left divider line â divider variant only.`,layout:{grow:!0},visibleWhen:{prop:`variant`,equals:`divider`},tokens:{height:`{border.width.divider.subtle}`,"background-color":`{color.divider.subtle}`}},iconSlot:{slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},messageText:{element:`span`,content:{prop:`message`}},lineEnd:{description:`Right divider line â divider variant only.`,layout:{grow:!0},visibleWhen:{prop:`variant`,equals:`divider`},tokens:{height:`{border.width.divider.subtle}`,"background-color":`{color.divider.subtle}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`2c5056fcf5f0b075ec7be6019f20eb8cdc9d5efb`,nodeId:`11:839`},code:{importPath:`src/components/ChatSystemMessage`,export:`ChatSystemMessage`}}},le={$schema:`./contract.schema.json`,id:`ds.checkbox`,name:`Checkbox`,version:`2.0.1`,status:`draft`,description:`Toggles a single on/off value â settings, terms acceptance, opt-ins. API mirrors industry convention (Astryx CheckboxInput): checked, unchecked, and indeterminate are prop-driven appearance states. v2.0.0 (breaking, DOM shape): the control is a NATIVE input[type=checkbox] inside the wrapping label â checked/indeterminate are DOM state, not ARIA on a button; the box and glyphs are presentational.`,semantics:{element:`label`},props:[{name:`value`,description:`Checked, unchecked, or indeterminate (partial selection in a group).`,type:{enum:[`unchecked`,`checked`,`indeterminate`]},default:`unchecked`,bindings:{figma:{kind:`VARIANT`,property:`Value`,values:{unchecked:`Unchecked`,checked:`Checked`,indeterminate:`Indeterminate`}},code:{prop:`value`}}},{name:`size`,description:`Control size.`,type:{enum:[`sm`,`md`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`}},code:{prop:`size`}}},{name:`label`,description:`Always rendered â users must know what they are toggling.`,type:`text`,default:`Checkbox label`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`description`,description:`Secondary text below the label.`,type:`text`,default:`Supporting detail for this option.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`start`},tokens:{gap:`{space.gap.sm}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{box:{description:`The visual checkbox â presentational. Fill and glyph follow the value prop; the real input sits inside, visually managed.`,element:`span`,layout:{direction:`row`,align:`center`,justify:`center`},tokens:{width:`{size.checkbox.{size}}`,height:`{size.checkbox.{size}}`,"background-color":`{color.checkbox.{value}.background}`,"border-color":`{color.checkbox.{value}.border}`,"border-width":`{border-width.100}`,"border-radius":`{radius.100}`,color:`{color.checkbox.icon}`},parts:{input:{description:`The real checkable control â a native input. Checked and indeterminate are DOM state (checked + el.indeterminate), never ARIA attributes; the wrapping label gives implicit association. Canvas: not drawn (semantics don't draw).`,element:`input`,attrs:{type:`checkbox`}},checkGlyph:{icon:{asset:`check`,size:12},visibleWhen:{prop:`value`,equals:`checked`}},dashGlyph:{icon:{asset:`dash`,size:12}
10,visibleWhen:{prop:`value`,equals:`indeterminate`}}}},textCol:{layout:{direction:`column`,grow:!0},tokens:{gap:`{space.inset-y.xs}`},parts:{labelText:{element:`span`,content:{prop:`label`},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`,"font-weight":`{font.weight.regular}`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`9bc54e5a3f7c074b9ed016dfac8edff95ec45e23`,nodeId:`11:315`},code:{importPath:`src/components/Checkbox`,export:`Checkbox`}},events:[{name:`toggle`,description:`Fires when the input is toggled; uncontrolled instances flip unchecked/checked (indeterminate resolves to checked).`,bindings:{code:{prop:`onToggle`}},trigger:`input`,toggles:{prop:`value`,between:[`unchecked`,`checked`],aria:`checked`}}]},ue={$schema:`./contract.schema.json`,id:`ds.citation`,name:`Citation`,version:`1.0.0`,status:`draft`,description:`Inline reference to an external source â attribution in AI-generated responses, articles, anywhere provenance matters. API mirrors industry convention (Astryx Citation): label chips or compact numbered badges.`,semantics:{element:`a`},props:[{name:`variant`,description:`Label chip with the source title, or a compact numbered badge. Don't mix both in one paragraph.`,type:{enum:[`label`,`number`]},default:`label`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{label:`Label`,number:`Number`}},code:{prop:`variant`}}},{name:`sourceTitle`,description:`The source's display title (label variant).`,type:`text`,default:`example.com`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Source`},code:{prop:`sourceTitle`}}},{name:`number`,description:`Display index (number variant).`,type:`text`,default:`1`,bindings:{figma:{kind:`TEXT`,property:`Number`},code:{prop:`number`}}},{name:`href`,description:`Source URL.`,type:`text`,default:`https://example.com`,bindings:{figma:{kind:`TEXT`,property:`Href`},code:{prop:`href`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},attrs:{href:`{href}`,target:`_blank`,rel:`noopener noreferrer`},tokens:{"background-color":`{color.surface.sunken}`,color:`{color.text.secondary}`,"border-radius":`{radius.100}`,"padding-inline":`{space.inset-x.xs}`,"padding-block":`{space.inset-y.xs}`,"font-family":`{font.control.family}`,"font-size":`{font.badge.size}`,"font-weight":`{font.control.weight}`},parts:{labelText:{element:`span`,content:{prop:`sourceTitle`},visibleWhen:{prop:`variant`,equals:`label`}},numberText:{element:`span`,content:{prop:`number`},visibleWhen:{prop:`variant`,equals:`number`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`84b0a3c9abb3122d60820f8047a8b6d200956067`,nodeId:`11:844`},code:{importPath:`src/components/Citation`,export:`Citation`}}},de={$schema:`./contract.schema.json`,id:`ds.code`,name:`Code`,version:`1.0.0`,status:`draft`,description:`Inline code element with monospace font and muted background. API mirrors industry convention (Astryx Code); block code is a separate component family.`,semantics:{element:`code`},props:[{name:`children`,description:`The code content.`,type:`text`,default:`npm run build`,bindings:{figma:{kind:`TEXT`,property:`Content`},code:{prop:`children`}}}],states:[],anatomy:{root:{tokens:{"background-color":`{color.surface.sunken}`,color:`{color.surface.foreground}`,"border-radius":`{radius.100}`,"padding-inline":`{space.inset-x.xs}`,"padding-block":`{space.inset-y.xs}`,"font-family":`{font.code.family}`,"font-size":`{font.control.size.sm}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`d64c49cb8606d9f9275de6ab5c635708276cd047`,nodeId:`11:316`},code:{importPath:`src/components/Code`,export:`Code`}}},fe={$schema:`./contract.schema.json`,id:`ds.divider`,name:`Divider`,version:`1.0.0`,status:`draft`,description:`Visual separator dividing content into distinct sections. API mirrors industry convention (Astryx Divider) at the variant level; orientation requires per-enum-value property overrides â a documented schema gap.`,semantics:{element:`hr`,role:`separator`},props:[{name:`variant`,description:`Visual weight of the line.`,type:{enum:[`subtle`,`strong`]},default:`subtle`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{subtle:`Subtle`,strong:`Strong`}}
10,code:{prop:`variant`}}}],states:[],anatomy:{root:{tokens:{"background-color":`{color.divider.{variant}}`,height:`{border.width.divider.{variant}}`,"max-width":`{size.divider.length}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`1bd0e157dee768b650c50a752a164562fc606822`,nodeId:`11:320`},code:{importPath:`src/components/Divider`,export:`Divider`}}},pe={$schema:`./contract.schema.json`,id:`ds.empty-state`,name:`EmptyState`,version:`1.0.0`,status:`draft`,description:`Placeholder for a content area with no data â empty lists, zero results, first-time setup. API mirrors industry convention (Astryx EmptyState): always a title and a next step; the icon is decorative.`,semantics:{element:`div`},props:[{name:`title`,description:`Primary message.`,type:`text`,default:`Nothing here yet`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Title`},code:{prop:`title`}}},{name:`description`,description:`Secondary text explaining what will appear here and how.`,type:`text`,default:`When items are added they will show up in this list.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`center`},tokens:{"max-width":`{size.card.width}`,gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.lg}`,"padding-block":`{space.inset-x.lg}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{iconArea:{description:`Decorative icon or illustration above the title.`,slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`,justify:`center`},attrs:{"aria-hidden":`true`}},title:{element:`span`,content:{prop:`title`},tokens:{"font-size":`{font.control.size.md}`,"font-weight":`{font.title.weight}`}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`}},actions:{description:`Action buttons below the description.`,slot:{name:`actions`,accepts:[`ds.button`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`,"padding-block":`{space.inset-y.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`b0dd99f2822be1712c8984d1b59bd31bd8ab866d`,nodeId:`11:321`},code:{importPath:`src/components/EmptyState`,export:`EmptyState`}}},me={$schema:`./contract.schema.json`,id:`ds.field`,name:`Field`,version:`1.0.0`,status:`draft`,description:`Form field wrapper providing a label, description, and required indicator around any control. API mirrors industry convention (Astryx Field): the label targets the control via inputID; validation status needs structured-object props â a documented gap.`,semantics:{element:`div`},props:[{name:`isRequired`,description:`Shows the required indicator beside the label.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Required`},code:{prop:`isRequired`}}},{name:`label`,description:`Always rendered â even custom controls need names.`,type:`text`,default:`Field label`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`inputID`,description:`The wrapped control's id, used for the label's htmlFor association.`,type:`text`,default:`field-control`,required:!0,bindings:{figma:{kind:`TEXT`,property:`InputID`},code:{prop:`inputID`}}},{name:`description`,description:`Helper text between the label and the control.`,type:`text`,default:`Helper text for the wrapped control.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,gap:`{space.inset-y.sm}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{labelRow:{element:`label`,layout:{direction:`row`,align:`center`},attrs:{htmlFor:`{inputID}`},tokens:{gap:`{space.inset-y.sm}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`},parts:{labelText:{element:`span`,content:{prop:`label`}},requiredMark:{icon:{asset:`asterisk`,size:10},visibleWhen:{prop:`isRequired`},tokens:{color:`{color.action.danger.background}`}}}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`}},control:{description:`The wrapped form control.`,slot:{name:`children`,acceptsMode:`open`},layout:{direction:`column`,align:`stretch`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`e690d926c7f929fb354ba4aa0d3b355db929c444`,nodeId:`11:845`},code:{importPath:`src/components/Field`,export:`Field`}}},he={$schema:`./contract.schema.json`,id:`ds.grid-gallery`,name:`GridGallery`,version:`1.0.0`,status:`draft`,description:`Three equal fr columns filled by row auto-flow (G5) â the placement fact is CHILD ORDER, not an anchor. Six repeated slots flow into two derived rows.`,semantics:{element:`div`},props:[],states:[],anatomy:{root:{layout:{display:`grid`,columns:[{fr:1},{fr:1},{fr:1}],rows:[{fit:!0},{fit:!0}],flow:`row`,gap:{row:`{space.gap.md}`,column:`{space.gap.md}`}},literals:{width:`640px`,height:`fit-content`},parts:{item1:{description:`Gallery cell 1 â placed by order, not by anchor.`,slot:{name:`item1`,figmaProperty:`Item 1`}},item2:{description:`Gallery cell 2 â placed by order, not by anchor.`,slot:{name:`item2`,figmaProperty:`Item 2`}},item3:{description:`Gallery cell 3 â placed by order, not by anchor.`,slot:{name:`item3`,figmaProperty:`Item 3`}},item4:{description:`Gallery cell 4 â wraps to the second derived row.`,slot:{name:`item4`,figmaProperty:`Item 4`}},item5:{description:`Gallery cell 5 â wraps to the second derived row.`,slot:{name:`item5`,figmaProperty:`Item 5`}},item6:{description:`Gallery cell 6 â wraps to the second derived row.`,slot:{name:`item6`,figmaProperty:`Item 6`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:null,componentSetKey:null},code:{importPath:`src/components/GridGallery`,export:`GridGallery`}}},ge={$schema:`./contract.schema.json`,id:`ds.heading`,name:`Heading`,version:`1.0.0`,status:`draft`,description:`Sectioning heading whose rendered HTML element follows the level prop (h1âh6) via semantics.elementByProp, with a visual size ramp on the existing control type scale â document outline and visual weight are deliberately independent axes. Text nodes carry no element semantics, so only code renders the element itself.`,semantics:{element:`p`,elementByProp:{prop:`level`,map:{1:`h1`,2:`h2`,3:`h3`,4:`h4`,5:`h5`,6:`h6`}}}
10,props:[{name:`level`,description:`Document outline level â drives the rendered element (h1âh6) and the size ramp.`,type:{enum:[`1`,`2`,`3`,`4`,`5`,`6`]},default:`2`,bindings:{figma:{kind:`VARIANT`,property:`Level`,values:{1:`H1`,2:`H2`,3:`H3`,4:`H4`,5:`H5`,6:`H6`}},code:{prop:`level`}}},{name:`size`,description:`Visual size on the control type scale â independent of the document outline level.`,type:{enum:[`sm`,`md`,`lg`]},default:`lg`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`children`,description:`Heading text.`,type:`text`,default:`Heading`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Text`},code:{prop:`children`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{"font-family":`{font.control.family}`,"font-size":`{font.control.size.{size}}`,"font-weight":`{font.title.weight}`,color:`{color.surface.foreground}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`72c05e001310fd06ca059cede948454f54edc4f8`,nodeId:`32:1862`},code:{importPath:`src/components/Heading`,export:`Heading`}}},_e={$schema:`./contract.schema.json`,id:`ds.icon-button`,name:`IconButton`,version:`1.0.0`,status:`draft`,description:`A button showing only an icon, for toolbars, table rows, and compact UI. API mirrors industry convention (Astryx IconButton): the required label is the accessible name and is never rendered visibly.`,semantics:{element:`button`},props:[{name:`variant`,description:`Visual style. Ghost sits on the surface wash (transparent tokens are a documented gap).`,type:{enum:[`primary`,`secondary`,`ghost`,`destructive`]},default:`secondary`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{primary:`Primary`,secondary:`Secondary`,ghost:`Ghost`,destructive:`Destructive`}},code:{prop:`variant`}}},{name:`size`,description:`Square control size.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`isDisabled`,description:`Disables the button.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Disabled`},code:{prop:`isDisabled`}}},{name:`label`,description:`Accessible name (aria-label). Be specific: "Delete conversation", not "Delete".`,type:`text`,default:`Action`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[`hover`,`focus-visible`],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`,justify:`center`},attrs:{"aria-label":`{label}`,type:`button`},tokens:{width:`{size.icon-button.{size}}`,height:`{size.icon-button.{size}}`,"background-color":`{color.action.{variant}.background}`,color:`{color.action.{variant}.foreground}`,"border-radius":`{radius.control}`},parts:{iconSlot:{description:`The icon. Pass an Icon-sized element; it inherits the variant's foreground color.`,slot:{name:`icon`,acceptsMode:`open`},layout:{direction:`row`,align:`center`,justify:`center`}}},states:{hover:{"background-color":`{color.action.{variant}.background-hover}`},"focus-visible":{"outline-color":`{color.border.focus}`,"outline-width":`{border.width.focus}`}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`ba2cfd0b9f6f47a728081edaf340c37cdeb53123`,nodeId:`11:378`},code:{importPath:`src/components/IconButton`,export:`IconButton`}}},ve={$schema:`./contract.schema.json`,id:`ds.inline`,name:`Inline`,version:`1.0.0`,status:`draft`,description:`Horizontal layout primitive â lays children out in a row with a token-governed gap, vertically centered.`,semantics:{element:`div`},props:[{name:`gap`,description:`Space between children.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Gap`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`gap`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{gap:`{space.gap.{gap}}`}}},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:null,nodeId:null},code:{importPath:`src/components/Inline`,export:`Inline`}},figmaRepresentation:`native`},ye={$schema:`./contract.schema.json`,id:`ds.kbd`,name:`Kbd`,version:`1.0.0`,status:`draft`,description:`Renders a keyboard shortcut as a styled key badge for tooltips, menus, and help text. API mirrors industry convention (Astryx Kbd); multi-key parsing ("mod+K" into separate badges) is display logic â a documented gap, one badge per component for now.`,semantics:{element:`kbd`},props:[{name:`keys`,description:`The shortcut text, e.g. "âK".`,type:`text`,default:`âK`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Keys`},code:{prop:`keys`}}}],states:[],anatomy:{root:{tokens:{"background-color":`{color.surface.sunken}`,color:`{color.surface.foreground}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.100}`,"padding-inline":`{space.inset-x.xs}`,"padding-block":`{space.inset-y.xs}`,"font-family":`{font.code.family}`,"font-size":`{font.badge.size}`},layout:{display:`inline-flex`,direction:`row`,align:`center`,justify:`center`},parts:{keysText:{element:`span`,content:{prop:`keys`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`798616e092adf3047e8e3586844c2bcb0530fe0a`,nodeId:`11:856`},code:{importPath:`src/components/Kbd`,export:`Kbd`}}},be={$schema:`./contract.schema.json`,id:`ds.list-item`,name:`ListItem`,version:`1.0.0`,status:`draft`,description:`A single row in a List: label with optional description, leading and trailing content. API mirrors industry convention (Astryx ListItem); click/link behavior is a declared boundary.`,semantics:{element:`li`}
10,props:[{name:`label`,description:`Primary text.`,type:`text`,default:`List item`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`description`,description:`Secondary content below the label.`,type:`text`,default:`Supporting detail for this item.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{startContent:{description:`Leading content â icon or avatar.`,slot:{name:`startContent`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},textCol:{layout:{direction:`column`,grow:!0},tokens:{gap:`{space.inset-y.xs}`},parts:{labelText:{element:`span`,content:{prop:`label`},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`}}}},endContent:{description:`Trailing content â badge, count, chevron.`,slot:{name:`endContent`,accepts:[`ds.badge`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`470b0337773739a1521b294855bed053c8e7eb33`,nodeId:`11:857`},code:{importPath:`src/components/ListItem`,export:`ListItem`}}},xe={$schema:`./contract.schema.json`,id:`ds.list`,name:`List`,version:`1.0.0`,status:`draft`,description:`Vertical collection of items with consistent density. API mirrors industry convention (Astryx List); dividers need sibling-selector styling and marker styles need list-style tokens â documented gaps.`,semantics:{element:`ul`},props:[{name:`density`,description:`Item spacing density.`,type:{enum:[`compact`,`balanced`,`spacious`]},default:`balanced`,bindings:{figma:{kind:`VARIANT`,property:`Density`,values:{compact:`Compact`,balanced:`Balanced`,spacious:`Spacious`}},code:{prop:`density`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,"background-color":`{color.surface.raised}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.card}`,gap:`{space.list.{density}}`,"padding-inline":`{space.inset-y.sm}`,"padding-block":`{space.inset-y.sm}`},parts:{items:{description:`The list rows.`,slot:{name:`children`,accepts:[`ds.list-item`],acceptsMode:`prefer`,defaultContent:[{id:`ds.list-item`,props:{label:`Design tokens`,description:`210 governed values`}},{id:`ds.list-item`,props:{label:`Contracts`,description:`One JSON file per component`}},{id:`ds.list-item`,props:{label:`Parity checks`,description:`Three surfaces, one differ`}}]},layout:{direction:`column`,align:`stretch`},tokens:{gap:`{space.list.{density}}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`e506f83390b9f1495394675f91c6aa03a9317162`,nodeId:`11:963`},code:{importPath:`src/components/List`,export:`List`}}},Se={$schema:`./contract.schema.json`,id:`ds.metadata-list-item`,name:`MetadataListItem`,version:`1.0.0`,status:`draft`,description:`One keyâvalue pair in a MetadataList: a label and a value area. API mirrors industry convention (Astryx MetadataListItem).`,semantics:{element:`div`},props:[{name:`label`,description:`The key text.`,type:`text`,default:`Label`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`value`,description:`The value text. Use the children slot instead for rich values.`,type:`text`,default:`Value`,bindings:{figma:{kind:`TEXT`,property:`Value`},code:{prop:`value`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`start`},tokens:{gap:`{space.gap.md}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`},parts:{iconSlot:{description:`Icon before the label.`,slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},labelText:{element:`span`,content:{prop:`label`},tokens:{color:`{color.text.secondary}`,"min-width":`{container.xs}`}},valueText:{element:`span`,content:{prop:`value`},layout:{grow:!0},tokens:{color:`{color.surface.foreground}`,"font-weight":`{font.control.weight}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`84ae8763e0d2378b67b49878f355b264327d6c8a`,nodeId:`11:964`},code:{importPath:`src/components/MetadataListItem`,export:`MetadataListItem`}}},Ce={$schema:`./contract.schema.json`,id:`ds.metadata-list`,name:`MetadataList`,version:`1.0.0`,status:`draft`,description:`Keyâvalue pairs for object attributes â detail panels, settings summaries, record
10information. API mirrors industry convention (Astryx MetadataList); multi-column layout and collapse behavior are documented boundaries.`,semantics:{element:`div`},props:[{name:`title`,description:`Heading above the list.`,type:`text`,default:`Details`,bindings:{figma:{kind:`TEXT`,property:`Title`},code:{prop:`title`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,gap:`{space.gap.sm}`,"font-family":`{font.control.family}`},parts:{titleText:{element:`span`,content:{prop:`title`},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.title.weight}`,color:`{color.surface.foreground}`}},items:{slot:{name:`children`,accepts:[`ds.metadata-list-item`],acceptsMode:`prefer`,defaultContent:[{id:`ds.metadata-list-item`,props:{label:`Owner`,value:`Design Infrastructure`}},{id:`ds.metadata-list-item`,props:{label:`Status`,value:`Active`}},{id:`ds.metadata-list-item`,props:{label:`Updated`,value:`2 hours ago`}}]},layout:{direction:`column`,align:`stretch`},tokens:{gap:`{space.gap.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`f4c106dcd1de208ef1018b6d8ee4e30cdc030f0d`,nodeId:`11:970`},code:{importPath:`src/components/MetadataList`,export:`MetadataList`}}},we={$schema:`./contract.schema.json`,id:`ds.page-shell`,name:`PageShell`,version:`1.0.0`,status:`draft`,description:`Composition of compositions: header/aside/main/footer named areas (G4) whose slots accept the other layout contracts. The main slot's accepts list is the nested-composition constraint.`,semantics:{element:`div`},props:[],states:[],anatomy:{root:{layout:{display:`grid`,rows:[{px:64},{fr:1},{px:56}],columns:[{px:240},{fr:1}],gap:{row:`{space.gap.sm}`,column:`{space.gap.md}`},areas:{header:{row:0,column:0,columnSpan:2},aside:{row:1,column:0},main:{row:1,column:1},footer:{row:2,column:0,columnSpan:2}}},literals:{width:`640px`,height:`480px`},parts:{header:{description:`Masthead band spanning both columns.`,element:`header`,slot:{name:`header`,figmaProperty:`Header`}},aside:{description:`Stationary 240px navigation column.`,element:`aside`,slot:{name:`aside`,figmaProperty:`Aside`,accepts:[`ds.sidebar-layout`],acceptsMode:`prefer`}},main:{description:`Primary region â accepts the other layout contracts, so a composition nests inside a composition.`,element:`main`,slot:{name:`main`,figmaProperty:`Main`,accepts:[`ds.two-column`,`ds.sidebar-layout`,`ds.grid-gallery`,`ds.bento-grid`],acceptsMode:`prefer`}},footer:{description:`Footer band spanning both columns.`,element:`footer`,slot:{name:`footer`,figmaProperty:`Footer`,accepts:[`ds.two-column`],acceptsMode:`prefer`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:null,componentSetKey:null},code:{importPath:`src/components/PageShell`,export:`PageShell`}}},Te={$schema:`./contract.schema.json`,id:`ds.pagination`,name:`Pagination`,version:`1.0.0`,status:`draft`,description:`Steps through pages of content, below a table or list. API mirrors industry convention (Astryx Pagination) with three display variants; page math and click behavior are declared boundaries â the pages variant shows a representative trail.`,semantics:{element:`nav`},props:[{name:`variant`,description:`Numbered trail, compact page label, or dot indicators.`,type:{enum:[`pages`,`compact`,`dots`]},default:`pages`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{pages:`Pages`,compact:`Compact`,dots:`Dots`}},code:{prop:`variant`}}},{name:`pageLabel`,description:`The compact variant's label text.`,type:`text`,default:`Page 2 of 10`,bindings:{figma:{kind:`TEXT`,property:`PageLabel`},code:{prop:`pageLabel`}}},{name:`label`,description:`Accessible label for the navigation landmark.`,type:`text`,default:`Pagination`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},attrs:{"aria-label":`{label}`},tokens:{gap:`{space.gap.sm}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,color:`{color.surface.foreground}`},parts:{prevButton:{element:`button`,icon:{asset:`chevron-left`,size:14},attrs:{"aria-label":`Previous page`,type:`button`},tokens:{color:`{color.text.secondary}`}},pagesGroup:{visibleWhen:{prop:`variant`,equals:`pages`},layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.xs}`},parts:{pageOne:{element:`button`,text:`1`,attrs:{type:`button`},tokens:{"padding-inline":`{space.inset-y.md}`,"padding-block":`{space.inset-y.sm}`,"border-radius":`{radius.100}`,color:`{color.text.secondary}`}},pageCurrent:{element:`button`,text:`2`,attrs:{type:`button`,"aria-current":`page`},tokens:{"padding-inline":`{space.inset-y.md}`,"padding-block":`{space.inset-y.sm}`,"border-radius":`{radius.100}`,"background-color":`{color.nav.selected.background}`,color:`{color.nav.selected.foreground}`,"font-weight":`{font.title.weight}`}},pageThree:{element:`button`,text:`3`,attrs:{type:`button`},tokens:{"padding-inline":`{space.inset-y.md}`,"padding-block":`{space.inset-y.sm}`,"border-radius":`{radius.100}`,color:`{color.text.secondary}`}},ellipsis:{element:`span`,text:`â¦`,tokens:{color:`{color.text.secondary}`}},pageLast:{element:`button`,text:`10`,attrs:{type:`button`},tokens:{"padding-inline":`{space.inset-y.md}`,"padding-block":`{space.inset-y.sm}`,"border-radius":`{radius.100}`,color:`{color.text.secondary}`}}}},compactText:{element:`span`,content:{prop:`pageLabel`},visibleWhen:{prop:`variant`,equals:`compact`},tokens:{color:`{color.text.secondary}`}},dotsGroup:{visibleWhen:{prop:`variant`,equals:`dots`},layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`},parts:{dotActive:{element:`span`,text:``,tokens:{width:`{size.dot}`,height:`{size.dot}`,"border-radius":`{radius.pill}`,"background-color":`{color.status.accent}`}},dotTwo:{element:`span`,text:``,tokens:{width:`{size.dot}`,height:`{size.dot}`,"border-radius":`{radius.pill}`,"background-color":`{color.status.neutral}`}},dotThree:{element:`span`,text:``,tokens:{width:`{size.dot}`,height:`{size.dot}`,"border-radius":`{radius.pill}`,"background-color":`{color.status.neutral}`}}}},nextButton:{element:`button`,icon:{asset:`chevron-right`,size:14},attrs:{"aria-label":`Next page`,type:`button`},tokens:{color:`{color.text.secondary}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`51d18c28f5ef424142d682db4ec7fd35b9091257`,nodeId:`11:1233`},code:{importPath:`src/components/Pagination`,export:`Pagination`}}},Ee={$schema:`./contract.schema.json`,id:`ds.progress-bar`,name:`ProgressBar`,version:`1.0.1`,status:`draft`,description:`Horizontal bar showing completion progress. API mirrors industry convention (Astryx ProgressBar): number-valued value/max drive the fill; the canvas renders the defaults' fraction as its honest static state. Indeterminate mode needs animation on the canvas â a documented boundary.`,semantics:{element:`div`,roleException:`Native <progress> cannot host the contract's styled track/fill anatomy (its rendering is only reach
10able through vendor pseudo-elements, outside the token vocabulary), so the progressbar role rides a div per WAI-APG.`},props:[{name:`variant`,description:`Semantic color of the fill.`,type:{enum:[`accent`,`success`,`warning`,`error`,`neutral`]},default:`accent`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{accent:`Accent`,success:`Success`,warning:`Warning`,error:`Error`,neutral:`Neutral`}},code:{prop:`variant`}}},{name:`value`,description:`Current progress value.`,type:`number`,default:60,bindings:{figma:{kind:`TEXT`,property:`Value`},code:{prop:`value`}}},{name:`max`,description:`Maximum value.`,type:`number`,default:100,bindings:{figma:{kind:`TEXT`,property:`Max`},code:{prop:`max`}}},{name:`label`,description:`Accessible name â screen readers must know what is progressing.`,type:`text`,default:`Progress`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`},attrs:{role:`progressbar`,"aria-label":`{label}`},tokens:{"max-width":`{size.progress.width}`},parts:{track:{layout:{direction:`row`,align:`center`},tokens:{width:`{size.progress.width}`,height:`{size.progress.height}`,"background-color":`{color.progress.track}`,"border-radius":`{radius.100}`},parts:{fill:{meter:{valueProp:`value`,maxProp:`max`},tokens:{height:`{size.progress.height}`,"background-color":`{color.progress.{variant}}`,"border-radius":`{radius.100}`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`GnQnjSNBXtgtd2Ht0Hs1C8`,componentSetKey:`b18870547d3ca85fb933e46457fde0d02d782fb3`,nodeId:`11:1249`},code:{importPath:`src/components/ProgressBar`,export:`ProgressBar`}}},De={$schema:`./contract.schema.json`,id:`ds.section`,name:`Section`,version:`1.0.0`,status:`draft`,description:`The standard way to create page regions and group related content â settings groups, form sections, sidebar areas. API mirrors industry convention (Astryx Section) at the variant level; the transparent variant needs transparent color tokens â a documented gap.`,semantics:{element:`section`},props:[{name:`variant`,description:`Background treatment. Muted only to call attention.`,type:{enum:[`section`,`muted`]},default:`section`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{section:`Section`,muted:`Muted`}},code:{prop:`variant`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,"background-color":`{color.section.{variant}}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.card}`,gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-x.md}`},parts:{content:{slot:{name:`children`,acceptsMode:`open`},layout:{direction:`column`,align:`stretch`},tokens:{gap:`{space.gap.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`f47b739d72cc4bfc159e1b656f78e5dbceaf0200`,nodeId:`11:999`},code:{importPath:`src/components/Section`,export:`Section`}}},Oe={$schema:`./contract.schema.json`,id:`ds.side-nav-item`,name:`SideNavItem`,version:`1.0.0`,status:`draft`,description:`A sidebar navigation row: icon, label, and trailing content, with a selected state. API mirrors industry convention (Astryx SideNavItem); nesting and collapse are behavior-layer boundaries.`,semantics:{element:`a`},props:[{name:`state`,description:`Whether this item is the current page.`,type:{enum:[`default`,`selected`]},default:`default`,bindings:{figma:{kind:`VARIANT`,property:`State`,values:{default:`Default`,selected:`Selected`}},code:{prop:`state`}}},{name:`label`,description:`Item text.`,type:`text`,default:`Navigation item`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`href`,description:`Navigation target URL.`,type:`text`,default:`#`,bindings:{figma:{kind:`TEXT`,property:`Href`},code:{prop:`href`}}}],states:[`hover`],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},attrs:{href:`{href}`},tokens:{"max-width":`{size.card.width}`,"background-color":`{color.nav.{state}.background}`,color:`{color.nav.{state}.foreground}`,"border-radius":`{radius.control}`,gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`},states:{hover:{"background-color":`{color.surface.sunken}`}},parts:{iconSlot:{slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},labelText:{element:`span`,content:{prop:`label`},layout:{grow:!0}},endContent:{description:`Trailing badge or count.`,slot:{name:`endContent`,accepts:[`ds.badge`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`155b665997cadb6f418aa74bdd0ad9b00e348e97`,nodeId:`11:1016`},code:{importPath:`src/components/SideNavItem`,export:`SideNavItem`}}},ke={$schema:`./contract.schema.json`,id:`ds.sidebar-layout`,name:`SidebarLayout`,ver
10sion:`1.0.0`,status:`draft`,description:`A stationary px sidebar column beside an fr main column â mixed track kinds in one declared list (G1). The sidebar never reflows; main absorbs the remainder.`,semantics:{element:`div`},props:[],states:[],anatomy:{root:{layout:{display:`grid`,rows:[{fit:!0}],columns:[{px:240},{fr:1}],gap:{row:`{space.gap.md}`,column:`{space.gap.lg}`}},literals:{width:`640px`,height:`fit-content`},parts:{sidebar:{description:`Stationary 240px column â a FIXED track, never redistributed.`,element:`aside`,placement:{row:0,column:0},slot:{name:`sidebar`,figmaProperty:`Sidebar`}},main:{description:`Fluid main column â the single fr track absorbs all remaining width.`,element:`main`,placement:{row:0,column:1},slot:{name:`main`,figmaProperty:`Main`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:null,componentSetKey:null},code:{importPath:`src/components/SidebarLayout`,export:`SidebarLayout`}}},Ae={$schema:`./contract.schema.json`,id:`ds.skeleton`,name:`Skeleton`,version:`1.0.0`,status:`draft`,description:`Pulsing placeholder previewing the shape of loading content. API mirrors industry convention (Astryx Skeleton) with the free-form width/height flattened to a shape variant; the pulse is CSS-only â the canvas shows the static shape.`,semantics:{element:`span`},props:[{name:`variant`,description:`The shape being previewed.`,type:{enum:[`text`,`rect`,`circle`]},default:`text`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{text:`Text`,rect:`Rect`,circle:`Circle`}},code:{prop:`variant`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`},attrs:{"aria-hidden":`true`},parts:{block:{element:`span`,text:``,animation:`pulse`,tokens:{width:`{size.skeleton.{variant}.width}`,height:`{size.skeleton.{variant}.height}`,"background-color":`{color.skeleton}`,"border-radius":`{radius.skeleton.{variant}}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`2da0d4e2438f9b37a9ce159eafb4477f622b10bb`,nodeId:`11:1259`},code:{importPath:`src/components/Skeleton`,export:`Skeleton`}}},je={$schema:`./contract.schema.json`,id:`ds.slider`,name:`Slider`,version:`1.0.0`,status:`draft`,description:`Numeric selection within bounds â the static surface of a slider: label, filled track to the current value, and thumb. API mirrors industry convention (Astryx Slider); drag behavior and range mode are declared boundaries.`,semantics:{element:`div`},props:[{name:`value`,description:`Current value â positions the thumb.`,type:`number`,default:40,bindings:{figma:{kind:`TEXT`,property:`Value`},code:{prop:`value`}}},{name:`max`,description:`Maximum value.`,type:`number`,default:100,bindings:{figma:{kind:`TEXT`,property:`Max`},code:{prop:`max`}}},{name:`label`,description:`Always rendered.`,type:`text`,default:`Volume`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`},tokens:{"max-width":`{size.slider.width}`,gap:`{space.inset-y.sm}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{labelText:{element:`span`,content:{prop:`label`},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`}},trackRow:{layout:{direction:`row`,align:`center`},tokens:{width:`{size.slider.width}`},parts:{filled:{meter:{valueProp:`value`,maxProp:`max`},tokens:{height:`{size.slider.track}`,"background-color":`{color.progress.accent}`,"border-radius":`{radius.100}`}},thumb:{element:`span`,text:``,tokens:{width:`{size.slider.thumb}`,height:`{size.slider.thumb}`,"background-color":`{color.switch.thumb}`,"border-color":`{color.progress.accent}`,"border-width":`{border-width.200}`,"border-radius":`{radius.pill}`}},remainder:{layout:{grow:!0},tokens:{height:`{size.slider.track}`,"background-color":`{color.progress.track}`,"border-radius":`{radius.100}`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`GnQnjSNBXtgtd2Ht0Hs1C8`,componentSetKey:`8aac8c4b2be87b47b944650ec1a4c07bdfeb12f7`,nodeId:`11:1260`},code:{importPath:`src/components/Slider`,export:`Slider`}}},Me={$schema:`./contract.schema.json`,id:`ds.spinner`,name:`Spinner`,version:`1.0.0`,status:`draft`,description:`Animated loading indicator for processes of unknown duration. API mirrors industry convention (Astryx Spinner); the size scale needs per-variant icon sizing and the rotation itself is CSS-only â the canvas shows the static arc.`,semantics:{element:`span`,role:`status`}
10,props:[{name:`label`,description:`What is loading â announced to screen readers.`,type:`text`,default:`Loading`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},attrs:{"aria-label":`{label}`},tokens:{color:`{color.action.primary.background}`},parts:{arc:{icon:{asset:`spinner`},animation:`spin`}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`GnQnjSNBXtgtd2Ht0Hs1C8`,componentSetKey:`3cb0569208b199ceccb18b4c4439add4f5fea661`,nodeId:`11:1267`},code:{importPath:`src/components/Spinner`,export:`Spinner`}}},Ne={$schema:`./contract.schema.json`,id:`ds.stack`,name:`Stack`,version:`1.0.0`,status:`draft`,description:`Vertical layout primitive â stacks children with a token-governed gap. Screens compose from Stack/Inline instead of raw styled divs.`,semantics:{element:`div`},props:[{name:`gap`,description:`Space between children.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Gap`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`gap`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{gap:`{space.gap.{gap}}`}}},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:null,nodeId:null},code:{importPath:`src/components/Stack`,export:`Stack`}},figmaRepresentation:`native`},Pe={$schema:`./contract.schema.json`,id:`ds.status-dot`,name:`StatusDot`,version:`1.0.0`,status:`draft`,description:`Small colored dot communicating status â presence, severity, activity. API mirrors industry convention (Astryx StatusDot): five semantic variants with a required accessible label.`,semantics:{element:`span`,role:`img`},props:[{name:`variant`,description:`Semantic color variant.`,type:{enum:[`success`,`warning`,`error`,`accent`,`neutral`]},default:`neutral`,bindings:{figma:{kind:`VARIANT`,property:`Variant`,values:{success:`Success`,warning:`Warning`,error:`Error`,accent:`Accent`,neutral:`Neutral`}},code:{prop:`variant`}}},{name:`label`,description:`Accessible label announced by screen readers â status must never be conveyed by color alone.`,type:`text`,default:`Status`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{attrs:{"aria-label":`{label}`},tokens:{"background-color":`{color.status.{variant}}`,width:`{size.dot}`,height:`{size.dot}`,"border-radius":`{radius.pill}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`f66c5a1c366d1d37292459b9b9a56d80bf2a5034`,nodeId:`11:384`},code:{importPath:`src/components/StatusDot`,export:`StatusDot`}}},Fe={$schema:`./contract.schema.json`,id:`ds.switch`,name:`Switch`,version:`2.0.1`,status:`draft`,description:`Toggle for on/off settings that take effect immediately. API mirrors industry convention (Astryx Switch) with the boolean value flattened to an off/on enum so both surfaces render both states truthfully; toggle behavior is a declared boundary. v2.0.0 (breaking, DOM shape): the control is a NATIVE input[type=checkbox] with role=switch (the modern switch pattern) inside the wrapping label â checked is DOM state, not ARIA on a button; track and thumb are presentational.`,semantics:{element:`label`},props:[{name:`value`,description:`On or off â drives the track color and thumb position.`,type:{enum:[`off`,`on`]},default:`off`,bindings:{figma:{kind:`VARIANT`,property:`Value`,values:{off:`Off`,on:`On`}},code:{prop:`value`}}},{name:`label`,description:`Always rendered â users must know what they are toggling.`,type:`text`,default:`Enable notifications`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`description`,description:`Secondary text below the label.`,type:`text`,default:`Takes effect immediately.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`start`},tokens:{gap:`{space.gap.sm}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{track:{description:`The switch track â presentational. Thumb position is expressed structurally: a growing spacer sits on the off side; the real input sits inside, visually managed.`,element:`span`,layout:{direction:`row`,align:`center`},tokens:{width:`{size.switch.width}`,height:`{size.switch.height}`,"background-color":`{color.switch.{value}.track}`,"border-radius":`{radius.pill}`,"padding-inline":`{space.inset-y.xs}`,"padding-block":`{space.inset-y.xs}`},parts:{input:{description:`The real checkable control â a native input[type=checkbox] carrying role=switch (the modern switch pattern). Checked is DOM state, never aria-checked on a button; the wrapping label gives implicit association. Canvas: not drawn (semantics don't draw).`,element:`input`,attrs:{type:`checkbox`,role:`switch`}},spacerStart:{layout:{grow:!0},visibleWhen:{prop:`value`,equals:`on`}},thumb:{element:`span`,text:``,tokens:{width:`{size.switch.thumb}`,height:`{size.switch.thumb}`,"background-color":`{color.switch.thumb}`,"border-radius":`{radius.pill}`}},spacerEnd:{layout:{grow:!0},visibleWhen:{prop:`value`,equals:`off`}}}},textCol:{layout:{direction:`column`,grow:!0},tokens:{gap:`{space.inset-y.xs}`},parts:{labelText:{element:`span`,content:{prop:`label`},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`,"font-weight":`{font.weight.regular}`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`1a1
1074ed109a4f98a2bdd48f6509cf18f06a6d75b`,nodeId:`4:618`},code:{importPath:`src/components/Switch`,export:`Switch`}},events:[{name:`toggle`,description:`Fires when the input is toggled; uncontrolled instances flip value off/on themselves.`,bindings:{code:{prop:`onToggle`}},trigger:`input`,toggles:{prop:`value`,between:[`off`,`on`],aria:`checked`}}]},Ie={$schema:`./contract.schema.json`,id:`ds.tab-list`,name:`TabList`,version:`1.0.0`,status:`draft`,description:`Tab-style navigation container holding Tab items. API mirrors industry convention (Astryx TabList); roving-tabindex keyboard behavior and controlled selection are declared boundaries.`,semantics:{element:`div`,role:`tablist`},props:[],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"padding-block":`{space.inset-y.xs}`},parts:{tabs:{slot:{name:`children`,accepts:[`ds.tab`],acceptsMode:`prefer`,defaultContent:[{id:`ds.tab`,props:{label:`Overview`,state:`selected`}},{id:`ds.tab`,props:{label:`Components`}},{id:`ds.tab`,props:{label:`Tokens`}}]},layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`21786b6e7ff33e3d9ede5edb8ca07a56f3dbb8af`,nodeId:`11:1034`},code:{importPath:`src/components/TabList`,export:`TabList`}}},Le={$schema:`./contract.schema.json`,id:`ds.tab`,name:`Tab`,version:`1.0.0`,status:`draft`,description:`A single tab in a TabList. API mirrors industry convention (Astryx Tab) with selection flattened to a state enum so both surfaces render it truthfully; selection behavior itself is a declared boundary.`,semantics:{element:`button`,role:`tab`},props:[{name:`state`,description:`Selection state â selected tabs render semibold in the accent color.`,type:{enum:[`default`,`selected`]},default:`default`,bindings:{figma:{kind:`VARIANT`,property:`State`,values:{default:`Default`,selected:`Selected`}},code:{prop:`state`}}},{name:`label`,description:`Visible tab text.`,type:`text`,default:`Tab`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[`hover`],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},attrs:{type:`button`},tokens:{"background-color":`{color.surface.background}`,color:`{color.tab.{state}.foreground}`,"font-weight":`{font.tab.{state}.weight}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,gap:`{space.inset-y.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"border-radius":`{radius.100}`},states:{hover:{"background-color":`{color.surface.sunken}`}},parts:{iconSlot:{slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},labelText:{element:`span`,content:{prop:`label`}},endContent:{description:`Badge count or status dot after the label.`,slot:{name:`endContent`,accepts:[`ds.badge`,`ds.status-dot`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`5f7bce1453ff86d3147e96d9249f9313497f3d68`,nodeId:`11:1033`},code:{importPath:`src/components/Tab`,export:`Tab`}}},Re={$schema:`./contract.schema.json`,id:`ds.table-cell`,name:`TableCell`,version:`1.1.0`,status:`draft`,description:`A single data cell in a table row.`,semantics:{element:`div`,role:`cell`},props:[{name:`density`,description:`Vertical rhythm, normally driven by the owning Table.`,type:{enum:[`comfortable`,`compact`]},default:`comfortable`,bindings:{figma:{kind:`VARIANT`,property:`Density`,values:{comfortable:`Comfortable`,compact:`Compact`}},code:{prop:`density`}}},{name:`children`,description:`Cell content.`,type:`text`,default:`Cell`,bindings:{figma:{kind:`TEXT`,property:`Content`},code:{prop:`children`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.table.cell-y.{density}}`,color:`{color.surface.foreground}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,"min-width":`{size.table.cell-width}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`b440cb0ab4bd83de2491b2302ab1ccb9c3e0f2d1`,nodeId:`2:48`},code:{importPath:`src/components/TableCell`,export:`TableCell`}}},ze={$schema:`./contract.schema.json`,id:`ds.table-header-cell`,name:`TableHeaderCell`,version:`1.1.0`,status:`draft`,description:`A column header cell.`,semantics:{element:`div`,role:`columnheader`},props:[{name:`density`,description:`Vertical rhythm, normally driven by the owning Table.`,type:{enum:[`comfortable`,`compact`]},default:`comfortable`,bindings:{figma:{kind:`VARIANT`,property:`Density`,values:{comfortable:`Comfortable`,compact:`Compact`}},code:{prop:`density`}}},{name:`children`,description:`Column label.`,type:`text`,default:`Header`,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`children`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.table.cell-y.{density}}`,color:`{color.surface.foreground}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.title.weight}`,"min-width":`{size.table.cell-width}`}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`91bf99af47cb2e09190eed770012e9c99661294f`,nodeId:`2:53`},code:{importPath:`src/components/TableHeaderCell`,export:`TableHeaderCell`}}}
10,Be={$schema:`./contract.schema.json`,id:`ds.table-row`,name:`TableRow`,version:`1.1.0`,status:`draft`,description:`A selectable row of table cells.`,semantics:{element:`div`,role:`row`},props:[{name:`state`,description:`Data state of the row.`,type:{enum:[`default`,`selected`]},default:`default`,bindings:{figma:{kind:`VARIANT`,property:`State`,values:{default:`Default`,selected:`Selected`}},code:{prop:`state`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{"background-color":`{color.table.row.{state}}`},parts:{cells:{description:`The row's cells. Multi-child slot: renders its default content directly in Figma (INSTANCE_SWAP cannot hold multiple children â see docs/08).`,layout:{direction:`row`,align:`center`},slot:{name:`children`,figmaProperty:`Cells`,required:!0,accepts:[`ds.table-cell`,`ds.table-header-cell`],defaultContent:[{id:`ds.table-cell`,text:`Ada Lovelace`},{id:`ds.table-cell`,text:`Engineering`},{id:`ds.table-cell`,text:`Active`}]}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`2630a1f30455c0b4d906930e9b3815cc0437fe1f`,nodeId:`2:70`},code:{importPath:`src/components/TableRow`,export:`TableRow`}}},Ve={$schema:`./contract.schema.json`,id:`ds.table`,name:`Table`,version:`1.1.0`,status:`draft`,description:`Structured data in rows and columns. Composes header cells (with the Table's density mapped into them), and a body slot of rows.`,semantics:{element:`div`,role:`table`},props:[{name:`density`,description:`Vertical rhythm of the whole table; mapped into the fixed header cells.`,type:{enum:[`comfortable`,`compact`]},default:`comfortable`,bindings:{figma:{kind:`VARIANT`,property:`Density`,values:{comfortable:`Comfortable`,compact:`Compact`}},code:{prop:`density`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"background-color":`{color.surface.raised}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.card}`,"max-width":`{size.table.width}`},parts:{header:{description:`Fixed 3-column sample header; density flows down via parent-prop mapping.`,layout:{direction:`row`,align:`center`},tokens:{"background-color":`{color.surface.sunken}`},parts:{nameHeader:{component:{id:`ds.table-header-cell`,props:{density:`{density}`},text:`Name`}},roleHeader:{component:{id:`ds.table-header-cell`,props:{density:`{density}`},text:`Role`}},statusHeader:{component:{id:`ds.table-header-cell`,props:{density:`{density}`},text:`Status`}}}},body:{description:`Rows. Multi-child slot: renders its default content directly in Figma (see docs/08).`,layout:{direction:`column`,align:`stretch`},slot:{name:`children`,figmaProperty:`Rows`,required:!0,accepts:[`ds.table-row`],defaultContent:[{id:`ds.table-row`},{id:`ds.table-row`,props:{state:`selected`}},{id:`ds.table-row`}]}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`d3e8c9c378ea2fd072c2eb08545a30565fa77614`,nodeId:`2:154`},code:{importPath:`src/components/Table`,export:`Table`}}},He={$schema:`./contract.schema.json`,id:`ds.text-area`,name:`TextArea`,version:`1.0.0`,status:`draft`,description:`Multi-line text input for longer-form content â comments, descriptions, messages. API mirrors industry convention (Astryx TextArea); wrapping-label anatomy gives implicit association.`,semantics:{element:`label`},props:[{name:`size`,description:`Control size scale (affects padding and text size).`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`isRequired`,description:`Marks the field required.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Required`},code:{prop:`isRequired`}}},{name:`label`,description:`Field label â always rendered.`,type:`text`,default:`Label`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`description`,description:`Helper text between the label and the textarea.`,type:`text`,default:`Helper text that explains the expected content.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}},{name:`placeholder`,description:`Hint shown when empty.`,type:`text`,default:`Write somethingâ¦`,bindings:{figma:{kind:`TEXT`,property:`Placeholder`},code:{prop:`placeholder`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,gap:`{space.inset-y.sm}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},parts:{labelRow:{layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`},parts:{labelText:{element:`span`,content:{prop:`label`}},requiredMark:{icon:{asset:`asterisk`,size:10},visibleWhen:{prop:`isRequired`},tokens:{color:`{color.action.danger.background}`}}}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`}}
10,input:{element:`textarea`,attrs:{rows:`3`,placeholder:`{placeholder}`},tokens:{"background-color":`{color.input.background}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.control}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.{size}}`,"font-size":`{font.control.size.{size}}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`2cb4581bfc1e7d9b0b5e32260d783accaea973ef`,nodeId:`11:415`},code:{importPath:`src/components/TextArea`,export:`TextArea`}}},Ue={$schema:`./contract.schema.json`,id:`ds.text-field`,name:`TextField`,version:`1.1.1`,status:`draft`,description:`Single-line text input for short-form values â names, emails, search queries. API mirrors industry convention (Astryx TextInput): required label, description, size scale. The wrapping-label anatomy gives implicit label association. Disabled fields dim and drop pointer interaction via stylesWhen (code-side conditional styling; a declared canvas fidelity limit).`,semantics:{element:`label`},props:[{name:`size`,description:`Control size scale.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`isRequired`,description:`Marks the field required â shows the indicator beside the label.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Required`},code:{prop:`isRequired`}}},{name:`isDisabled`,description:`Disabled state.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Disabled`},code:{prop:`isDisabled`}}},{name:`label`,description:`Field label â always rendered; placeholders are not labels.`,type:`text`,default:`Label`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`description`,description:`Helper text between the label and the input.`,type:`text`,default:`Helper text that explains the expected value.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}},{name:`placeholder`,description:`Hint shown when the field is empty. Never a substitute for the label.`,type:`text`,default:`Enter a valueâ¦`,bindings:{figma:{kind:`TEXT`,property:`Placeholder`},code:{prop:`placeholder`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`column`,align:`stretch`},tokens:{"max-width":`{size.card.width}`,gap:`{space.inset-y.sm}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},stylesWhen:[{prop:`isDisabled`,styles:{opacity:`0.55`,"pointer-events":`none`,cursor:`not-allowed`}}],parts:{labelRow:{layout:{direction:`row`,align:`center`},tokens:{gap:`{space.inset-y.sm}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`},parts:{labelText:{element:`span`,content:{prop:`label`}},requiredMark:{description:`Required indicator â shown only when isRequired.`,icon:{asset:`asterisk`,size:10},visibleWhen:{prop:`isRequired`},tokens:{color:`{color.action.danger.background}`}}}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`,"font-weight":`{font.weight.regular}`}},input:{description:`The real input control. Code renders a native input; the canvas shows the placeholder bound to the same property.`,element:`input`,attrs:{type:`text`,placeholder:`{placeholder}`},tokens:{"background-color":`{color.input.background}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.control}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.{size}}`,"font-size":`{font.control.size.{size}}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`83b5ead2b038477a13c0647de71ee55bf458e0b3`,nodeId:`11:446`},code:{importPath:`src/components/TextField`,export:`TextField`}}},We={$schema:`./contract.schema.json`,id:`ds.toast`,name:`Toast`,version:`1.0.0`,status:`draft`,description:`Brief non-blocking notification confirming an action. API mirrors industry convention (Astryx Toast): the visual element â positioning, stacking, and auto-dismiss belong to the behavior layer and are a declared boundary.`,semantics:{element:`div`,roleByProp:{prop:`type`,map:{info:`status`,error:`alert`}}},props:[{name:`type`,description:`Info confirms; error persists until dismissed (behavior layer).`,type:{enum:[`info`,`error`]},default:`info`,bindings:{figma:{kind:`VARIANT`,property:`Type`,values:{info:`Info`,error:`Error`}},code:{prop:`type`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{"max-width":`{size.card.width}`,"background-color":`{color.toast.{type}.background}`,color:`{color.toast.{type}.foreground}`,"border-radius":`{radius.control}`,gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.md}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`},parts:{body:{description:`Primary message content.`,slot:{name:`children`,acceptsMode:`open`},layout:{direction:`row`,align:`center`,grow:!0}},endContent:{description:`Trailing content â an Undo button, a link.`,slot:{name:`endContent`,accepts:[`ds.button`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`0abc553b16f20807f50d984a4
101dc6cb936958a93`,nodeId:`11:461`},code:{importPath:`src/components/Toast`,export:`Toast`}}},Ge={$schema:`./contract.schema.json`,id:`ds.token`,name:`Token`,version:`1.1.0`,status:`draft`,description:`Small inline element for discrete associated data â tags, categories, active filters. API mirrors industry convention (Astryx Token): 11-color vocabulary with size scale; removal and click behavior are a declared boundary. v1.1.0: the size scale is LIVE via tokensByProp (it was declared but bound to fixed tokens â a dead prop): md keeps the original rendering; sm tightens padding-inline to {space.inset-y.sm} (4px â cross-axis reuse, the Switch/List precedent; no smaller inset-x token exists, and no font token below 12px exists so sm keeps the base font); lg steps font to {font.control.size.sm} and padding to {space.inset-x.sm}/{space.inset-y.sm}. Existing repo tokens only â nothing minted.`,semantics:{element:`span`},props:[{name:`color`,description:`Color variant.`,type:{enum:[`default`,`red`,`orange`,`yellow`,`green`,`teal`,`cyan`,`blue`,`purple`,`pink`,`gray`]},default:`default`,bindings:{figma:{kind:`VARIANT`,property:`Color`,values:{default:`Default`,red:`Red`,orange:`Orange`,yellow:`Yellow`,green:`Green`,teal:`Teal`,cyan:`Cyan`,blue:`Blue`,purple:`Purple`,pink:`Pink`,gray:`Gray`}},code:{prop:`color`}}},{name:`size`,description:`Token size.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`isDisabled`,description:`Reduces opacity and blocks interactions.`,type:`boolean`,default:!1,bindings:{figma:{kind:`BOOLEAN`,property:`Disabled`},code:{prop:`isDisabled`}}},{name:`label`,description:`Text label inside the token.`,type:`text`,default:`Token`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},tokens:{"background-color":`{color.token.{color}.background}`,color:`{color.token.{color}.foreground}`,"border-radius":`{radius.100}`,gap:`{space.inset-y.sm}`,"padding-inline":`{space.inset-x.xs}`,"padding-block":`{space.inset-y.xs}`,"font-family":`{font.control.family}`,"font-size":`{font.badge.size}`,"font-weight":`{font.control.weight}`},tokensByProp:{prop:`size`,map:{sm:{"padding-inline":`{space.inset-y.sm}`},lg:{"font-size":`{font.control.size.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.sm}`}}},parts:{iconSlot:{description:`Icon before the label.`,slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},labelText:{element:`span`,content:{prop:`label`}},endContent:{description:`Content after the label â a count Badge, a chevron.`,slot:{name:`endContent`,accepts:[`ds.badge`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`BMjUA2ue5CaZXU4kufxL0z`,componentSetKey:`25fa6e1c9a512109e7bbc4b341bbbde5ede1f7ec`,nodeId:`11:726`},code:{importPath:`src/components/Token`,export:`Token`}}},Ke={$schema:`./contract.schema.json`,id:`ds.toolbar`,name:`Toolbar`,version:`1.0.0`,status:`draft`,description:`General-purpose toolbar container with start, center, and end content areas for contextual actions. API mirrors industry convention (Astryx Toolbar); roving-tabindex keyboard behavior is a declared boundary.`,semantics:{element:`div`,role:`toolbar`},props:[{name:`size`,description:`Minimum toolbar height; children keep their own sizes.`,type:{enum:[`sm`,`md`,`lg`]},default:`md`,bindings:{figma:{kind:`VARIANT`,property:`Size`,values:{sm:`Small`,md:`Medium`,lg:`Large`}},code:{prop:`size`}}},{name:`label`,description:`Accessible label for the toolbar.`,type:`text`,default:`Toolbar`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`,justify:`space-between`},attrs:{"aria-label":`{label}`},tokens:{"max-width":`{size.banner.width}`,"min-height":`{size.toolbar.{size}}`,"background-color":`{color.surface.raised}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,"border-radius":`{radius.control}`,gap:`{space.gap.md}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.sm}`},parts:{startContent:{description:`Start-aligned actions â buttons, segmented controls, selectors.`,slot:{name:`startContent`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`}},centerContent:{description:`Centered content.`,slot:{name:`centerContent`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`}},endContent:{description:`End-aligned primary actions, selectors, badges.`,slot:{name:`endContent`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`e56c9f77a873e973aa6f567d0c275710cb039795`,nodeId:`11:1097`},code:{importPath:`src/components/Toolbar`,export:`Toolbar`}}},qe={$schema:`./contract.schema.json`,id:`ds.top-nav-item`,name:`TopNavItem`,version:`1.0.0`,status:`draft`,description:`A navigation item in a TopNav or SideNav context. API mirrors industry convention (Astryx TopNavItem) with selection flattened to a state enum; the selected state applies aria-current.`,semantics:{element:`a`}
10,props:[{name:`state`,description:`Whether this item is the current page.`,type:{enum:[`default`,`selected`]},default:`default`,bindings:{figma:{kind:`VARIANT`,property:`State`,values:{default:`Default`,selected:`Selected`}},code:{prop:`state`}}},{name:`label`,description:`Visible item text.`,type:`text`,default:`Nav item`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`href`,description:`Navigation target URL.`,type:`text`,default:`#`,bindings:{figma:{kind:`TEXT`,property:`Href`},code:{prop:`href`}}}],states:[`hover`],anatomy:{root:{layout:{display:`inline-flex`,direction:`row`,align:`center`},attrs:{href:`{href}`},tokens:{"background-color":`{color.nav.{state}.background}`,color:`{color.nav.{state}.foreground}`,"border-radius":`{radius.control}`,gap:`{space.inset-y.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"font-family":`{font.control.family}`,"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`},states:{hover:{"background-color":`{color.surface.sunken}`}},parts:{iconSlot:{slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},labelText:{element:`span`,content:{prop:`label`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`a4db1fe283d2bfb60891ec71398cf8472b2292dc`,nodeId:`11:1108`},code:{importPath:`src/components/TopNavItem`,export:`TopNavItem`}}},Je={$schema:`./contract.schema.json`,id:`ds.top-nav`,name:`TopNav`,version:`1.0.0`,status:`draft`,description:`Horizontal main navigation bar with heading, start, center, and end areas. API mirrors industry convention (Astryx TopNav); hover menus and mega-menus are behavior-layer boundaries.`,semantics:{element:`nav`},props:[{name:`label`,description:`Accessible label for the navigation landmark.`,type:`text`,default:`Main`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}}],states:[],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`,justify:`space-between`},attrs:{"aria-label":`{label}`},tokens:{"max-width":`{size.banner.width}`,"background-color":`{color.surface.raised}`,"border-color":`{color.border.subtle}`,"border-width":`{border-width.100}`,gap:`{space.gap.md}`,"padding-inline":`{space.inset-x.md}`,"padding-block":`{space.inset-y.md}`},parts:{heading:{description:`Logo or brand at the start edge.`,slot:{name:`heading`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`}},startContent:{description:`Primary navigation items after the heading.`,slot:{name:`startContent`,accepts:[`ds.top-nav-item`],acceptsMode:`prefer`},optional:!0,layout:{direction:`row`,align:`center`,grow:!0},tokens:{gap:`{space.inset-y.sm}`}},endContent:{description:`Search, icons, user profile at the end edge.`,slot:{name:`endContent`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`},tokens:{gap:`{space.gap.sm}`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`c82dd683a88f085e804e8d315c8f75dc6f261807`,nodeId:`11:1109`},code:{importPath:`src/components/TopNav`,export:`TopNav`}}},Ye={$schema:`./contract.schema.json`,id:`ds.two-column`,name:`TwoColumn`,version:`1.0.0`,status:`draft`,description:`Two equal fr columns, each a slot. The simplest declared-track grid: G1 tracks, G2 explicit placement, one row that hugs its content.`,semantics:{element:`div`},props:[],states:[],anatomy:{root:{layout:{display:`grid`,rows:[{fit:!0}],columns:[{fr:1},{fr:1}],gap:{row:`{space.gap.md}`,column:`{space.gap.md}`}},literals:{width:`640px`,height:`fit-content`},parts:{start:{description:`Leading column slot.`,placement:{row:0,column:0},slot:{name:`start`,figmaProperty:`Start`}},end:{description:`Trailing column slot.`,placement:{row:0,column:1},slot:{name:`end`,figmaProperty:`End`}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:null,componentSetKey:null},code:{importPath:`src/components/TwoColumn`,export:`TwoColumn`}}},Xe={$schema:`./contract.schema.json`,id:`ds.typeahead-item`,name:`TypeaheadItem`,version:`1.0.0`,status:`draft`,description:`Default dropdown item for search results: label with optional icon and description. API mirrors industry convention (Astryx TypeaheadItem)
10with the item object flattened to explicit props.`,semantics:{element:`div`,role:`option`},props:[{name:`label`,description:`Primary result text.`,type:`text`,default:`Search result`,required:!0,bindings:{figma:{kind:`TEXT`,property:`Label`},code:{prop:`label`}}},{name:`description`,description:`Secondary text below the label.`,type:`text`,default:`Supporting detail about this result.`,bindings:{figma:{kind:`TEXT`,property:`Description`},code:{prop:`description`}}}],states:[`hover`],anatomy:{root:{layout:{display:`flex`,direction:`row`,align:`center`},tokens:{"max-width":`{size.card.width}`,"background-color":`{color.surface.raised}`,"border-radius":`{radius.100}`,gap:`{space.gap.sm}`,"padding-inline":`{space.inset-x.sm}`,"padding-block":`{space.inset-y.md}`,"font-family":`{font.control.family}`,color:`{color.surface.foreground}`},states:{hover:{"background-color":`{color.surface.sunken}`}},parts:{iconSlot:{description:`Icon or avatar before the label.`,slot:{name:`icon`,acceptsMode:`open`},optional:!0,layout:{direction:`row`,align:`center`}},textCol:{layout:{direction:`column`,grow:!0},tokens:{gap:`{space.inset-y.xs}`},parts:{labelText:{element:`span`,content:{prop:`label`},tokens:{"font-size":`{font.control.size.sm}`,"font-weight":`{font.control.weight}`}},descriptionText:{element:`span`,content:{prop:`description`},tokens:{"font-size":`{font.control.size.sm}`,color:`{color.text.secondary}`}}}}}}},a11y:{contrast:`AA`},anchors:{figma:{fileKey:`8nim1d0IPnehMxA7B7SYxC`,componentSetKey:`e71ef70ee99e707af6c5eaa57b6336ae906b5690`,nodeId:`11:1119`},code:{importPath:`src/components/TypeaheadItem`,export:`TypeaheadItem`}}},Ze=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><line x1="10" y1="4.5" x2="10" y2="15.5" stroke-linecap="round"/><line x1="5.2" y1="7.2" x2="14.8" y2="12.8" stroke-linecap="round"/><line x1="14.8" y1="7.2" x2="5.2" y2="12.8" stroke-linecap="round"/></svg> 11`,Qe=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="2.6,10.6 5.8,13.8 12,6.6" stroke-linecap="round" stroke-linejoin="round"/><polyline points="9.4,12.6 10.6,13.8 17.4,6.6" stroke-linecap="round" stroke-linejoin="round"/></svg> 12`,$e=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4.6,10.4 8.2,14 15.4,6.4" stroke-linecap="round" stroke-linejoin="round"/></svg> 13`,et=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="5.5,7.8 10,12.3 14.5,7.8" stroke-linecap="round" stroke-linejoin="round"/></svg> 14`,tt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="12.3,5.5 7.8,10 12.3,14.5" stroke-linecap="round" stroke-linejoin="round"/></svg> 15`,nt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="7.8,5.5 12.3,10 7.8,14.5" stroke-linecap="round" stroke-linejoin="round"/></svg> 16`,rt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="7.5"/><polyline points="10,5.8 10,10 13,12" stroke-linecap="round" stroke-linejoin="round"/></svg> 17`,it=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><line x1="5" y1="5" x2="15" y2="15" stroke-linecap="round"/><line x1="15" y1="5" x2="5" y2="15" stroke-linecap="round"/></svg> 18`,at=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="7.8,5.5 12.3,10 7.8,14.5" stroke-linecap="round" stroke-linejoin="round"/></svg> 19`,ot=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><line x1="5.5" y1="10" x2="14.5" y2="10" stroke-linecap="round"/></svg> 20`,st=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="2.6,10.6 5.8,13.8 12,6.6" stroke-linecap="round" stroke-linejoin="round"/>
20<polyline points="9.4,12.6 10.6,13.8 17.4,6.6" stroke-linecap="round" stroke-linejoin="round"/></svg> 21`,ct=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="7.5"/><line x1="7.2" y1="7.2" x2="12.8" y2="12.8" stroke-linecap="round"/><line x1="12.8" y1="7.2" x2="7.2" y2="12.8" stroke-linecap="round"/></svg> 22`,lt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="7.5"/><line x1="10" y1="9" x2="10" y2="13.5" stroke-linecap="round"/><circle cx="10" cy="6.4" r="0.9" fill="currentColor" stroke="none"/></svg> 23`,ut=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="5.5,7.8 10,12.3 14.5,7.8" stroke-linecap="round" stroke-linejoin="round"/></svg> 24`,dt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="2.6,10.6 5.8,13.8 12,6.6" stroke-linecap="round" stroke-linejoin="round"/><polyline points="9.4,12.6 10.6,13.8 17.4,6.6" stroke-linecap="round" stroke-linejoin="round"/></svg> 25`,ft=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="9" cy="9" r="5.5"/><line x1="13.2" y1="13.2" x2="16.5" y2="16.5" stroke-linecap="round"/></svg> 26`,pt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="7.5"/><polyline points="10,5.8 10,10 13,12" stroke-linecap="round" stroke-linejoin="round"/></svg> 27`,mt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4.6,10.4 8.2,14 15.4,6.4" stroke-linecap="round" stroke-linejoin="round"/></svg> 28`,ht=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><path d="M 10 2.5 A 7.5 7.5 0 0 1 17.5 10" stroke-linecap="round"/></svg> 29`,gt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="10" cy="10" r="7.5"/><polyline points="6.6,10.2 9,12.6 13.4,7.8" stroke-linecap="round" stroke-linejoin="round"/></svg> 30`,_t=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 3.2 17.4 16H2.6Z" stroke-linejoin="round"/><line x1="10" y1="8.2" x2="10" y2="11.8" stroke-linecap="round"/><circle cx="10" cy="13.9" r="0.9" fill="currentColor" stroke="none"/></svg> 31`,vt;function F(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var yt=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},bt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(vt=globalThis).__zod_globalConfig??(vt.__zod_globalConfig={});var xt=globalThis.__zod_globalConfig;function St(e){return e&&Object.assign(xt,e),xt}function Ct(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}
vendor: 27,900 bytes, lines 31-76
31function wt(e,t){return typeof t==`bigint`?t.toString():t}function Tt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Et(e){return e==null}function Dt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ot(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var kt=Symbol(`evaluating`);function I(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==kt)return r===void 0&&(r=kt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function At(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function jt(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Mt(e){return JSON.stringify(e)}function Nt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Pt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var It=Tt(()=>{if(xt.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Lt(e){if(Ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ft(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Rt(e){return Lt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zt=new Set([`string`,`number`,`symbol`]);function Bt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Vt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ht(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ut={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Wt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Vt(e,jt(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return At(this,`shape`,e),e},checks:[]}))}function Gt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Vt(e,jt(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return At(this,`shape`,r),r},checks:[]}))}function Kt(e,t){if(!Lt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Vt(e,jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return At(this,`shape`,n),n}}))}function qt(e,t){if(!Lt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Vt(e,jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return At(this,`shape`,n),n}}))}function Jt(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Vt(e,jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return At(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Yt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Vt(t,jt(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return At(this,`shape`,i),i},checks:[]}))}function Xt(e,t,n){return Vt(t,jt(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return At(this,`shape`,i),i}}))}function Zt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function $t(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function en(e){return typeof e==`string`?e:e?.message}function tn(e,t,n){let r=e.message?e.message:en(e.inst?._zod.def?.error?.(e))??en(t?.error?.(e))??en(n.customError?.(e))??en(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function nn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function rn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var an=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,wt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},on=F(`$ZodError`,an),sn=F(`$ZodError`,an,{Parent:Error});function cn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ln(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var un=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new yt;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>tn(e,a,St())));throw Pt(t,i?.callee),t}return o.value},dn=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>tn(e,a,St())));throw Pt(t,i?.callee),t}return o.value},fn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new yt;return a.issues.length?{success:!1,error:new(e??on)(a.issues.map(e=>tn(e,i,St())))}:{success:!0,data:a.value}},pn=fn(sn),mn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>tn(e,i,St())))}:{success:!0,data:a.value}},hn=mn(sn),gn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return un(e)(t,n,i)},_n=e=>(t,n,r)=>un(e)(t,n,r),vn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dn(e)(t,n,i)},yn=e=>async(t,n,r)=>dn(e)(t,n,r),bn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return fn(e)(t,n,i)},xn=e=>(t,n,r)=>fn(e)(t,n,r),Sn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mn(e)(t,n,i)},Cn=e=>async(t,n,r)=>mn(e)(t,n,r),wn=/^[cC][0-9a-z]{6,}$/,Tn=/^[0-9a-z]+$/,En=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Dn=/^[0-9a-vA-V]{20}$/,On=/^[A-Za-z0-9]{27}$/,kn=/^[a-zA-Z0-9_-]{21}$/,An=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Mn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Nn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pn=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Fn(){return new RegExp(Pn,`u`)}var In=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vn=/^[A-Za-z0-9_-]*$/,Hn=/^https?$/,Un=/^\+[1-9]\d{6,14}$/,Wn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Gn=RegExp(`^${Wn}$`);function Kn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function qn(e){return RegExp(`^${Kn(e)}$`)}function Jn(e){let t=Kn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Wn}T(?:${r})$`)}var Yn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Xn=/^-?\d+$/,Zn=/^-?\d+(?:\.\d+)?$/,Qn=/^(?:true|false)$/i,$n=/^[^A-Z]*$/,er=/^[^a-z]*$/,tr=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),nr={number:`number`,bigint:`bigint`,object:`date`},rr=F(`$ZodCheckLessThan`,(e,t)=>{tr.init(e,t);let n=nr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=F(`$ZodCheckGreaterThan`,(e,t)=>{tr.init(e,t);let n=nr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ar=F(`$ZodCheckMultipleOf`,(e,t)=>{tr.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ot(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),or=F(`$ZodCheckNumberFormat`,(e,t)=>{tr.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ut[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Xn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),sr=F(`$ZodCheckMaxLength`,(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Et(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=nn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cr=F(`$ZodCheckMinLength`,(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Et(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=nn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lr=F(`$ZodCheckLengthEquals`,(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Et(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=nn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ur=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;tr.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),dr=F(`$ZodCheckRegex`,(e,t)=>{ur.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fr=F(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$n,ur.init(e,t)}),pr=F(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=er,ur.init(e,t)}),mr=F(`$ZodCheckIncludes`,(e,t)=>{tr.init(e,t);let n=Bt(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),hr=F(`$ZodCheckStartsWith`,(e,t)=>{tr.init(e,t);let n=RegExp(`^${Bt(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gr=F(`$ZodCheckEndsWith`,(e,t)=>{tr.init(e,t);let n=RegExp(`.*${Bt(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),_r=F(`$ZodCheckOverwrite`,(e,t)=>{tr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),vr=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` 32`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` 33`))}},yr={major:4,minor:4,patch:3},br=F(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Zt(e),i;for(let a of t){if(a._zod.def.when){if(Qt(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new yt;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Zt(e,t))});else{if(e.issues.length===t)continue;r||=Zt(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Zt(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new yt;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new yt;return o.then(e=>t(e,r,a))}return t(o,r,a)}}I(e,`~standard`,()=>({validate:t=>{try{let n=pn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return hn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),xr=F(`$ZodString`,(e,t)=>{br.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Yn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Sr=F(`$ZodStringFormat`,(e,t)=>{ur.init(e,t),xr.init(e,t)}),Cr=F(`$ZodGUID`,(e,t)=>{t.pattern??=jn,Sr.init(e,t)}),wr=F(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Mn(e)}else t.pattern??=Mn();Sr.init(e,t)}),Tr=F(`$ZodEmail`,(e,t)=>{t.pattern??=Nn,Sr.init(e,t)}),Er=F(`$ZodURL`,(e,t)=>{Sr.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Hn.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Dr=F(`$ZodEmoji`,(e,t)=>{t.pattern??=Fn(),Sr.init(e,t)}),Or=F(`$ZodNanoID`,(e,t)=>{t.pattern??=kn,Sr.init(e,t)}),kr=F(`$ZodCUID`,(e,t)=>{t.pattern??=wn,Sr.init(e,t)}),Ar=F(`$ZodCUID2`,(e,t)=>{t.pattern??=Tn,Sr.init(e,t)}),jr=F(`$ZodULID`,(e,t)=>{t.pattern??=En,Sr.init(e,t)}),Mr=F(`$ZodXID`,(e,t)=>{t.pattern??=Dn,Sr.init(e,t)}),Nr=F(`$ZodKSUID`,(e,t)=>{t.pattern??=On,Sr.init(e,t)}),Pr=F(`$ZodISODateTime`,(e,t)=>{t.pattern??=Jn(t),Sr.init(e,t)}),Fr=F(`$ZodISODate`,(e,t)=>{t.pattern??=Gn,Sr.init(e,t)}),Ir=F(`$ZodISOTime`,(e,t)=>{t.pattern??=qn(t),Sr.init(e,t)}),Lr=F(`$ZodISODuration`,(e,t)=>{t.pattern??=An,Sr.init(e,t)}),Rr=F(`$ZodIPv4`,(e,t)=>{t.pattern??=In,Sr.init(e,t),e._zod.bag.format=`ipv4`}),zr=F(`$ZodIPv6`,(e,t)=>{t.pattern??=Ln,Sr.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Br=F(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rn,Sr.init(e,t)}),Vr=F(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zn,Sr.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Hr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ur=F(`$ZodBase64`,(e,t)=>{t.pattern??=Bn,Sr.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Hr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Wr(e){if(!Vn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Hr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Gr=F(`$ZodBase64URL`,(e,t)=>{t.pattern??=Vn,Sr.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Wr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Kr=F(`$ZodE164`,(e,t)=>{t.pattern??=Un,Sr.init(e,t)});function qr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Jr=F(`$ZodJWT`,(e,t)=>{Sr.init(e,t),e._zod.check=n=>{qr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Yr=F(`$ZodNumber`,(e,t)=>{br.init(e,t),e._zod.pattern=e._zod.bag.pattern??Zn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Xr=F(`$ZodNumberFormat`,(e,t)=>{or.init(e,t),Yr.init(e,t)}),Zr=F(`$ZodBoolean`,(e,t)=>{br.init(e,t),e._zod.pattern=Qn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Qr=F(`$ZodUnknown`,(e,t)=>{br.init(e,t),e._zod.parse=e=>e}),$r=F(`$ZodNever`,(e,t)=>{br.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ei(e,t,n){e.issues.length&&t.issues.push(...$t(n,e.issues)),t.value[n]=e.value}var ti=F(`$ZodArray`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>ei(t,n,e))):ei(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ni(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...$t(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function ri(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ht(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ii(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ni(e,n,i,t,u,d))):ni(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var ai=F(`$ZodObject`,(e,t)=>{if(br.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Tt(()=>ri(t));I(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Ft,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>ni(n,t,e,s,r,i))):ni(a,t,e,s,r,i)}return i?ii(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),oi=F(`$ZodObjectJIT`,(e,t)=>{ai.init(e,t);let n=e._zod.parse,r=Tt(()=>ri(t)),i=e=>{let t=new vr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Mt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Mt(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(` 34 if (${n}.issues.length) { 35 if (${o} in input) { 36 payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ 37 ...iss, 38 path: iss.path ? [${o}, ...iss.path] : [${o}] 39 }))); 40 } 41 } 42 43 if (${n}.value === undefined) { 44 if (${o} in input) { 45 newResult[${o}] = undefined; 46 } 47 } else { 48 newResult[${o}] = ${n}.value; 49 } 50 51 `):c?t.write(` 52 if (${n}.issues.length) { 53 payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ 54 ...iss, 55 path: iss.path ? [${o}, ...iss.path] : [${o}] 56 }))); 57 } 58 59 if (${n}.value === undefined) { 60 if (${o} in input) { 61 newResult[${o}] = undefined; 62 } 63 } else { 64 newResult[${o}] = ${n}.value; 65 } 66 67 `):t.write(` 68 const ${n}_present = ${o} in input; 69 if (${n}.issues.length) { 70 payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ 71 ...iss, 72 path: iss.path ? [${o}, ...iss.path] : [${o}] 73 }))); 74 } 75 if (!${n}_present && !${n}.issues.length) { 76 payload.issues.push({
77 code: "invalid_type", 78 expected: "nonoptional", 79 input: undefined, 80 path: [${o}] 81 }); 82 } 83 84 if (${n}_present) { 85 if (${n}.value === undefined) { 86 newResult[${o}] = undefined; 87 } else { 88 newResult[${o}] = ${n}.value; 89 } 90 } 91 92 `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ft,s=!xt.jitless,c=s&&It.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ii([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function si(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Zt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>tn(e,r,St())))}),t)}var ci=F(`$ZodUnion`,(e,t)=>{br.init(e,t),I(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),I(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),I(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),I(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Dt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>si(t,r,e,i)):si(o,r,e,i)}}),li=F(`$ZodIntersection`,(e,t)=>{br.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>di(e,t,n)):di(e,i,a)}});function ui(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Lt(e)&&Lt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=ui(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ui(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function di(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Zt(e))return e;let o=ui(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var fi=F(`$ZodTuple`,(e,t)=>{br.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=pi(n,`optin`),c=pi(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>mi(t,r,e))):mi(a,r,e)}}return o.length?Promise.all(o).then(()=>hi(l,r,n,a,c)):hi(l,r,n,a,c)}});function pi(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}
vendor: 10,223 bytes, line 92
92function mi(e,t,n){e.issues.length&&t.issues.push(...$t(n,e.issues)),t.value[n]=e.value}function hi(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...$t(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var gi=F(`$ZodRecord`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Lt(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>tn(e,r,St())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...$t(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...$t(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Zn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>tn(e,r,St())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...$t(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...$t(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),_i=F(`$ZodEnum`,(e,t)=>{br.init(e,t);let n=Ct(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>zt.has(typeof e)).map(e=>typeof e==`string`?Bt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),vi=F(`$ZodLiteral`,(e,t)=>{if(br.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Bt(e):e?Bt(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),yi=F(`$ZodTransform`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new yt;return n.value=i,n.fallback=!0,n}});function bi(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var xi=F(`$ZodOptional`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),I(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Dt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>bi(e,r)):bi(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Si=F(`$ZodExactOptional`,(e,t)=>{xi.init(e,t),I(e._zod,`values`,()=>t.innerType._zod.values),I(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ci=F(`$ZodNullable`,(e,t)=>{br.init(e,t),I(e._zod,`optin`,()=>t.innerType._zod.optin),I(e._zod,`optout`,()=>t.innerType._zod.optout),I(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Dt(e.source)}|null)$`):void 0}),I(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),wi=F(`$ZodDefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ti(e,t)):Ti(r,t)}});function Ti(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ei=F(`$ZodPrefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Di=F(`$ZodNonOptional`,(e,t)=>{br.init(e,t),I(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Oi(t,e)):Oi(i,e)}});function Oi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var ki=F(`$ZodCatch`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,I(e._zod,`optout`,()=>t.innerType._zod.optout),I(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>tn(e,n,St()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>tn(e,n,St()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Ai=F(`$ZodPipe`,(e,t)=>{br.init(e,t),I(e._zod,`values`,()=>t.in._zod.values),I(e._zod,`optin`,()=>t.in._zod.optin),I(e._zod,`optout`,()=>t.out._zod.optout),I(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ji(e,t.in,n)):ji(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ji(e,t.out,n)):ji(r,t.out,n)}});function ji(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Mi=F(`$ZodReadonly`,(e,t)=>{br.init(e,t),I(e._zod,`propValues`,()=>t.innerType._zod.propValues),I(e._zod,`values`,()=>t.innerType._zod.values),I(e._zod,`optin`,()=>t.innerType?._zod?.optin),I(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ni):Ni(r)}});function Ni(e){return e.value=Object.freeze(e.value),e}var Pi=F(`$ZodLazy`,(e,t)=>{br.init(e,t),I(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),I(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),I(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),I(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),I(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Fi=F(`$ZodCustom`,(e,t)=>{tr.init(e,t),br.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>R(t,n,r,e));R(i,n,r,e)}});function R(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(rn(e))}}var Ii,Li=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ri(){return new Li}(Ii=globalThis).__zod_globalRegistry??(Ii.__zod_globalRegistry=Ri());var zi=globalThis.__zod_globalRegistry;function Bi(e,t){return new e({type:`string`,...L(t)})}function Vi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function Hi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function Wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function qi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function Ji(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function Yi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function Xi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function Zi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function Qi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function $i(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}
vendor: 22,169 bytes, lines 92-94
92function ea(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function ta(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function na(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function ra(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function ia(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function aa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function oa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function sa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function ca(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function la(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function ua(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function da(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function fa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function pa(e,t){return new e({type:`number`,checks:[],...L(t)})}function ma(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function ha(e,t){return new e({type:`boolean`,...L(t)})}function ga(e){return new e({type:`unknown`})}function _a(e,t){return new e({type:`never`,...L(t)})}function va(e,t){return new rr({check:`less_than`,...L(t),value:e,inclusive:!1})}function ya(e,t){return new rr({check:`less_than`,...L(t),value:e,inclusive:!0})}function ba(e,t){return new ir({check:`greater_than`,...L(t),value:e,inclusive:!1})}function xa(e,t){return new ir({check:`greater_than`,...L(t),value:e,inclusive:!0})}function Sa(e,t){return new ar({check:`multiple_of`,...L(t),value:e})}function Ca(e,t){return new sr({check:`max_length`,...L(t),maximum:e})}function wa(e,t){return new cr({check:`min_length`,...L(t),minimum:e})}function Ta(e,t){return new lr({check:`length_equals`,...L(t),length:e})}function Ea(e,t){return new dr({check:`string_format`,format:`regex`,...L(t),pattern:e})}function Da(e){return new fr({check:`string_format`,format:`lowercase`,...L(e)})}function Oa(e){return new pr({check:`string_format`,format:`uppercase`,...L(e)})}function ka(e,t){return new mr({check:`string_format`,format:`includes`,...L(t),includes:e})}function Aa(e,t){return new hr({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function ja(e,t){return new gr({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function Ma(e){return new _r({check:`overwrite`,tx:e})}function Na(e){return Ma(t=>t.normalize(e))}function Pa(){return Ma(e=>e.trim())}function Fa(){return Ma(e=>e.toLowerCase())}function Ia(){return Ma(e=>e.toUpperCase())}function La(){return Ma(e=>Nt(e))}function Ra(e,t,n){return new e({type:`array`,element:t,...L(n)})}function za(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function Ba(e,t){let n=Va(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(rn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(rn(r))}},e(t.value,t)),t);return n}function Va(e,t){let n=new tr({check:`custom`,...L(t)});return n._zod.check=e,n}function Ha(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??zi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ua(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ua(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Ka(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Wa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root> 93 94Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ga(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ja(t,`input`,e.processors),output:Ja(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ka(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ka(r.element,n);if(r.type===`set`)return Ka(r.valueType,n);if(r.type===`lazy`)return Ka(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Ka(r.innerType,n);if(r.type===`intersection`)return Ka(r.left,n)||Ka(r.right,n);if(r.type===`record`||r.type===`map`)return Ka(r.keyType,n)||Ka(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ka(r.in,n)||Ka(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ka(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ka(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ka(e,n))return!0;return!!(r.rest&&Ka(r.rest,n))}return!1}var qa=(e,t={})=>n=>{let r=Ha({...n,processors:t});return Ua(e,r),Wa(r,e),Ga(r,e)},Ja=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ha({...i??{},target:a,io:t,processors:n});return Ua(e,o),Wa(o,e),Ga(o,e)},Ya={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Xa=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ya[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Za=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Qa=(e,t,n,r)=>{n.type=`boolean`},$a=(e,t,n,r)=>{n.not={}},eo=(e,t,n,r)=>{let i=e._zod.def,a=Ct(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},to=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},no=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ua(a.element,t,{...r,path:[...r.path,`items`]})},ao=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ua(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ua(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},oo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ua(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},so=(e,t,n,r)=>{let i=e._zod.def,a=Ua(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ua(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},co=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ua(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ua(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ua(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ua(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ua(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},uo=(e,t,n,r)=>{let i=e._zod.def,a=Ua(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},fo=(e,t,n,r)=>{let i=e._zod.def;Ua(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},po=(e,t,n,r)=>{let i=e._zod.def;Ua(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},mo=(e,t,n,r)=>{let i=e._zod.def;Ua(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},z=(e,t,n,r)=>{let i=e._zod.def;Ua(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ho=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ua(o,t,r);let s=t.seen.get(e);s.ref=o},go=(e,t,n,r)=>{let i=e._zod.def;Ua(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},_o=(e,t,n,r)=>{let i=e._zod.def;Ua(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},vo=(e,t,n,r)=>{let i=e._zod.innerType;Ua(i,t,r);let a=t.seen.get(e);a.ref=i},yo=F(`ZodISODateTime`,(e,t)=>{Pr.init(e,t),Go.init(e,t)});function bo(e){return la(yo,e)}var xo=F(`ZodISODate`,(e,t)=>{Fr.init(e,t),Go.init(e,t)});function So(e){return ua(xo,e)}var Co=F(`ZodISOTime`,(e,t)=>{Ir.init(e,t),Go.init(e,t)});function wo(e){return da(Co,e)}var To=F(`ZodISODuration`,(e,t)=>{Lr.init(e,t),Go.init(e,t)});function Eo(e){return fa(To,e)}var Do=F(`ZodError`,(e,t)=>{on.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ln(e,t)},flatten:{value:t=>cn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,wt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,wt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Oo=un(Do),ko=dn(Do),Ao=fn(Do),jo=mn(Do),Mo=gn(Do),No=_n(Do),Po=vn(Do),Fo=yn(Do),Io=bn(Do),Lo=xn(Do),Ro=Sn(Do),zo=Cn(Do),Bo=new WeakMap;function Vo(e,t,n){let r=Object.getPrototypeOf(e),i=Bo.get(r);if(i||(i=new Set,Bo.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ho=F(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ja(e,`input`),output:Ja(e,`output`)}}),e.toJSONSchema=qa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Oo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ao(e,t,n),e.parseAsync=async(t,n)=>ko(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>jo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Mo(e,t,n),e.decode=(t,n)=>No(e,t,n),e.encodeAsync=async(t,n)=>Po(e,t,n),e.decodeAsync=async(t,n)=>Fo(e,t,n),e.safeEncode=(t,n)=>Io(e,t,n),e.safeDecode=(t,n)=>Lo(e,t,n),e.safeEncodeAsync=async(t,n)=>Ro(e,t,n),e.safeDecodeAsync=async(t,n)=>zo(e,t,n),Vo(e,`ZodType`,{check(...e){let t=this.def;return this.clone(jt(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Vt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(oc(e,t))},superRefine(e,t){return this.check(sc(e,t))},overwrite(e){return this.check(Ma(e))},optional(){return Bs(this)},exactOptional(){return Hs(this)},nullable(){return Ws(this)},nullish(){return Bs(Ws(this))},nonoptional(e){return Xs(this,e)},array(){return Ss(this)},or(e){return Es([this,e])},and(e){return Os(this,e)},transform(e){return ec(this,Rs(e))},default(e){return Ks(this,e)},prefault(e){return Js(this,e)},catch(e){return Qs(this,e)},pipe(e){return ec(this,e)},readonly(){return nc(this)},describe(e){let t=this.clone();return zi.add(t,{description:e}),t},meta(...e){if(e.length===0)return zi.get(this);let t=this.clone();return zi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return zi.get(e)?.description},configurable:!0}),e)),Uo=F(`_ZodString`,(e,t)=>{xr.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Vo(e,`_ZodString`,{regex(...e){return this.check(Ea(...e))},includes(...e){return this.check(ka(...e))},startsWith(...e){return this.check(Aa(...e))},endsWith(...e){return this.check(ja(...e))},min(...e){return this.check(wa(...e))},max(...e){return this.check(Ca(...e))},length(...e){return this.check(Ta(...e))},nonempty(...e){return this.check(wa(1,...e))},lowercase(e){return this.check(Da(e))},uppercase(e){return this.check(Oa(e))},trim(){return this.check(Pa())},normalize(...e){return this.check(Na(...e))},toLowerCase(){return this.check(Fa())},toUpperCase(){return this.check(Ia())},slugify(){return this.check(La())}})}),Wo=F(`ZodString`,(e,t)=>{xr.init(e,t),Uo.init(e,t),e.email=t=>e.check(Vi(Ko,t)),e.url=t=>e.check(qi(Yo,t)),e.jwt=t=>e.check(ca(us,t)),e.emoji=t=>e.check(Ji(Xo,t)),e.guid=t=>e.check(Hi(qo,t)),e.uuid=t=>e.check(Ui(Jo,t)),e.uuidv4=t=>e.check(Wi(Jo,t)),e.uuidv6=t=>e.check(Gi(Jo,t)),e.uuidv7=t=>e.check(Ki(Jo,t)),e.nanoid=t=>e.check(Yi(Zo,t)),e.guid=t=>e.check(Hi(qo,t)),e.cuid=t=>e.check(Xi(Qo,t)),e.cuid2=t=>e.check(Zi($o,t)),e.ulid=t=>e.check(Qi(es,t)),e.base64=t=>e.check(aa(ss,t)),e.base64url=t=>e.check(oa(cs,t)),e.xid=t=>e.check($i(ts,t)),e.ksuid=t=>e.check(ea(ns,t)),e.ipv4=t=>e.check(ta(rs,t)),e.ipv6=t=>e.check(na(is,t)),e.cidrv4=t=>e.check(ra(as,t)),e.cidrv6=t=>e.check(ia(os,t)),e.e164=t=>e.check(sa(ls,t)),e.datetime=t=>e.check(bo(t)),e.date=t=>e.check(So(t)),e.time=t=>e.check(wo(t)),e.duration=t=>e.check(Eo(t))});function B(e){return Bi(Wo,e)}var Go=F(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),Uo.init(e,t)}),Ko=F(`ZodEmail`,(e,t)=>{Tr.init(e,t),Go.init(e,t)}),qo=F(`ZodGUID`,(e,t)=>{Cr.init(e,t),Go.init(e,t)}),Jo=F(`ZodUUID`,(e,t)=>{wr.init(e,t),Go.init(e,t)}),Yo=F(`ZodURL`,(e,t)=>{Er.init(e,t),Go.init(e,t)}),Xo=F(`ZodEmoji`,(e,t)=>{Dr.init(e,t),Go.init(e,t)}),Zo=F(`ZodNanoID`,(e,t)=>{Or.init(e,t),Go.init(e,t)}),Qo=F(`ZodCUID`,(e,t)=>{kr.init(e,t),Go.init(e,t)}),$o=F(`ZodCUID2`,(e,t)=>{Ar.init(e,t),Go.init(e,t)}),es=F(`ZodULID`,(e,t)=>{jr.init(e,t),Go.init(e,t)}),ts=F(`ZodXID`,(e,t)=>{Mr.init(e,t),Go.init(e,t)}),ns=F(`ZodKSUID`,(e,t)=>{Nr.init(e,t),Go.init(e,t)}),rs=F(`ZodIPv4`,(e,t)=>{Rr.init(e,t),Go.init(e,t)}),is=F(`ZodIPv6`,(e,t)=>{zr.init(e,t),Go.init(e,t)}),as=F(`ZodCIDRv4`,(e,t)=>{Br.init(e,t),Go.init(e,t)}),os=F(`ZodCIDRv6`,(e,t)=>{Vr.init(e,t),Go.init(e,t)}),ss=F(`ZodBase64`,(e,t)=>{Ur.init(e,t),Go.init(e,t)}),cs=F(`ZodBase64URL`,(e,t)=>{Gr.init(e,t),Go.init(e,t)}),ls=F(`ZodE164`,(e,t)=>{Kr.init(e,t),Go.init(e,t)}),us=F(`ZodJWT`,(e,t)=>{Jr.init(e,t),Go.init(e,t)}),ds=F(`ZodNumber`,(e,t)=>{Yr.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),Vo(e,`ZodNumber`,{gt(e,t){return this.check(ba(e,t))},gte(e,t){return this.check(xa(e,t))},min(e,t){return this.check(xa(e,t))},lt(e,t){return this.check(va(e,t))},lte(e,t){return this.check(ya(e,t))},max(e,t){return this.check(ya(e,t))},int(e){return this.check(ms(e))},safe(e){return this.check(ms(e))},positive(e){return this.check(ba(0,e))},nonnegative(e){return this.check(xa(0,e))},negative(e){return this.check(va(0,e))},nonpositive(e){return this.check(ya(0,e))},multipleOf(e,t){return this.check(Sa(e,t))},step(e,t){return this.check(Sa(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function fs(e){return pa(ds,e)}var ps=F(`ZodNumberFormat`,(e,t)=>{Xr.init(e,t),ds.init(e,t)});function ms(e){return ma(ps,e)}
vendor: 3,371 bytes, line 94
94var hs=F(`ZodBoolean`,(e,t)=>{Zr.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r)});function gs(e){return ha(hs,e)}var _s=F(`ZodUnknown`,(e,t)=>{Qr.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function vs(){return ga(_s)}var ys=F(`ZodNever`,(e,t)=>{$r.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r)});function bs(e){return _a(ys,e)}var xs=F(`ZodArray`,(e,t)=>{ti.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.element=t.element,Vo(e,`ZodArray`,{min(e,t){return this.check(wa(e,t))},nonempty(e){return this.check(wa(1,e))},max(e,t){return this.check(Ca(e,t))},length(e,t){return this.check(Ta(e,t))},unwrap(){return this.element}})});function Ss(e,t){return Ra(xs,e,t)}var Cs=F(`ZodObject`,(e,t)=>{oi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),I(e,`shape`,()=>t.shape),Vo(e,`ZodObject`,{keyof(){return Ps(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:vs()})},loose(){return this.clone({...this._zod.def,catchall:vs()})},strict(){return this.clone({...this._zod.def,catchall:bs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Kt(this,e)},safeExtend(e){return qt(this,e)},merge(e){return Jt(this,e)},pick(e){return Wt(this,e)},omit(e){return Gt(this,e)},partial(...e){return Yt(zs,this,e[0])},required(...e){return Xt(Ys,this,e[0])}})});function ws(e,t){return new Cs({type:`object`,shape:e??{},...L(t)})}function V(e,t){return new Cs({type:`object`,shape:e,catchall:bs(),...L(t)})}var Ts=F(`ZodUnion`,(e,t)=>{ci.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.options=t.options});function Es(e,t){return new Ts({type:`union`,options:e,...L(t)})}var Ds=F(`ZodIntersection`,(e,t)=>{li.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Os(e,t){return new Ds({type:`intersection`,left:e,right:t})}var ks=F(`ZodTuple`,(e,t)=>{fi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function As(e,t,n){let r=t instanceof br;return new ks({type:`tuple`,items:e,rest:r?t:null,...L(r?n:t)})}var js=F(`ZodRecord`,(e,t)=>{gi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ms(e,t,n){return!t||!t._zod?new js({type:`record`,keyType:B(),valueType:e,...L(t)}):new js({type:`record`,keyType:e,valueType:t,...L(n)})}var Ns=F(`ZodEnum`,(e,t)=>{_i.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ns({...t,checks:[],...L(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ns({...t,checks:[],...L(r),entries:i})}});function Ps(e,t){return new Ns({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var Fs=F(`ZodLiteral`,(e,t)=>{vi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if
94(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Is(e,t){return new Fs({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var Ls=F(`ZodTransform`,(e,t)=>{yi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(rn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(rn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Rs(e){return new Ls({type:`transform`,transform:e})}var zs=F(`ZodOptional`,(e,t)=>{xi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bs(e){return new zs({type:`optional`,innerType:e})}var Vs=F(`ZodExactOptional`,(e,t)=>{Si.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hs(e){return new Vs({type:`optional`,innerType:e})}var Us=F(`ZodNullable`,(e,t)=>{Ci.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ws(e){return new Us({type:`nullable`,innerType:e})}var Gs=F(`ZodDefault`,(e,t)=>{wi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ks(e,t){return new Gs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rt(t)}})}var qs=F(`ZodPrefault`,(e,t)=>{Ei.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Js(e,t){return new qs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rt(t)}})}var Ys=F(`ZodNonOptional`,(e,t)=>{Di.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xs(e,t){return new Ys({type:`nonoptional`,innerType:e,...L(t)})}var Zs=F(`ZodCatch`,(e,t)=>{ki.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Qs(e,t){return new Zs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var $s=F(`ZodPipe`,(e,t)=>{Ai.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.in=t.in,e.out=t.out});function ec(e,t){return new $s({type:`pipe`,in:e,out:t})}var tc=F(`ZodReadonly`,(e,t)=>{Mi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nc(e){return new tc({type:`readonly`,innerType:e})}var rc=F(`ZodLazy`,(e,t)=>{Pi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function ic(e){return new rc({type:`lazy`,getter:e})}var ac=F(`ZodCustom`,(e,t)=>{Fi.init(e,t),Ho.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function oc(e,t={}){return za(ac,e,t)}function sc(e,t){return Ba(e,t)}var cc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},lc;lc||={};var uc=[`hover`,`active`,`focus-visible`,`disabled`],dc=B().regex(/^\{[a-z0-9.{}-]+\}$/i,`Token reference must be brace-wrapped, e.g. "{color.action.primary.background}"`).refine(e=>!e.includes(`_`),{message:`token refs may not contain underscores (path grammar: letters, digits, ".", "-"); if this is the "__unset" defaultless-axis sentinel, the axis needs a reviewed default in the capture config â set enumeration.unsetLabel to a token-ref-legal label (e.g. "unset") and pin the axis in baseCombo`}),fc=V({enum:Ss(B()).min(1)}),pc=V({arrayOf:Ms(B(),Ps([`text`,`number`,`boolean`]))}),mc=V({name:B(),description:B().optional(),type:Es([Is(`boolean`),Is(`text`),Is(`number`),fc,pc]),default:Es([B(),gs(),fs()]).optional(),required:gs().optional(),bindings:V({figma:V({kind:Ps([`VARIANT`,`BOOLEAN`,`TEXT`,`INSTANCE_SWAP`,`NONE`]),property:B().optional(),values:Ms(B(),B()).optional()}),code:V({prop:B()})})}).refine(e=>e.bindings.figma.kind===`NONE`||typeof e.bindings.figma.property==`string`,{message:`bindings.figma.property is required unless kind is "NONE"`,path:[`bindings`,`figma`,`property`]}).refine(e=>e.bindings.figma.kind!==`NONE`||e.bindings.figma.property===void 0,{message:`kind "NONE" declares no canvas property â omit bindings.figma.property`,path:[`bindings`,`figma`,`property`]}),hc={"grid-track-zero":`grid-track-zero: 0px/0fr tracks are refused â the Plugin API SILENTLY REWRITES them (P2b: {FIXED,0} reads back snapped to the rendered px, {FLEX,0} clamps to 1fr); the schema refuses so the emitter can never trigger the rewrite`,"grid-track-percent":`grid-track-percent: percent tracks are refused â the track-type enum is FLEX | FIXED | HUG (P2b exact error: "Invalid enum value. Expected 'FLEX' | 'FIXED' | 'HUG', received 'PERCENT'")`,"grid-track-minmax":`grid-track-minmax: minmax() tracks are refused â no canvas spelling exists (P6 exact error: "Unrecognized key(s) in object: 'min', 'max'" on gridColumnSizes)`,"grid-auto-fit-minmax":`grid-auto-fit-minmax: repeat(auto-fit/auto-fill, â¦) is refused â the canvas track count is a fixed number with no repeat-to-fit concept (P1 reflection); a viewport-responsive track COUNT is a reflow family one frame cannot carry`,"grid-subgrid":`grid-subgrid: subgrid is refused â no track-inheritance property exists anywhere in the reflected Plugin API inventory (P1); a nested grid with copied literal tracks is a DIFFERENT fact and must not be passed off as subgrid`,"grid-flow-column":`grid-flow-column: grid-auto-flow: column is refused â gridItemsPositioning is exactly 'MANUAL' | 'ROW_AUTO_FLOW' (P5: COLUMN_AUTO_FLOW rejected); refusing beats a silent transpose`,"grid-flow-dense":`grid-flow-dense: grid-auto-flow: dense is refused â dense packing is SOLVER OUTPUT, not a declared fact, and the enum rejects it anyway (P5: DENSE rejected)`,"grid-implicit-tracks":`grid-implicit-tracks: placement beyond the declared track list is refused â the canvas absorbs overflow by REWRITING the declaration (P9: MANUAL append grew grid
94RowCount 2â3) or under-reports it (P9: ROW_AUTO_FLOW anchors exceeded gridRowCount); the contract never relies on implicit tracks`,"grid-align-stretch-keyword":`grid-align-stretch-keyword: an explicit stretch ALIGN fact is refused â the canvas align enum rejects STRETCH (P3); stretch is spelled as the ABSENCE of alignment plus fill sizing (G3), a named LOWERED disposition, never a silent normalization`,"grid-baseline-align":`grid-baseline-align: baseline alignment in a grid cell is refused â the canvas align enum rejects BASELINE (P3)`,"grid-negative-line":`grid-negative-line: negative line indexes are refused â the anchor API has no negative-index concept (gridRow/ColumnAnchorIndex are 0-based cells, P3); proposers lower RESOLVABLE negatives to absolute indexes (LOWERED) and refuse unresolvable ones`,"grid-child-grow":`grid-child-grow: layout.grow on a child of a grid parent is refused â the Plugin API silently ACCEPTS layoutGrow on grid children with no layout effect (P4); the schema refuses what the platform would silently swallow`,"grid-hug-flex-axis":`grid-hug-flex-axis: an intrinsically-sized axis (literals width/height "fit-content") is refused on an axis whose declared track list contains an {fr} track â NO write order satisfies both (GP1/GP5/GP12: hugging AFTER the tracks normalizes every FLEX track on that axis to HUG and the ratio is silently gone; GP8/GP1b: hugging BEFORE the tracks preserves the ratio but the hug is INERT â the node reports layoutSizing HUG and stays its FIXED size, a readback that lies to the differ). CSS agrees: 1fr resolves against a definite size, so this fact exists on neither surface`,"grid-axis-indefinite":`grid-axis-indefinite: a grid part must make each axis DEFINITE â a px/token size, "fit-content" (G8), or layout.grow (width, flex parent). Absence is refused because it resolves DIFFERENTLY per surface: primary/counterAxisSizingMode are INERT on a GRID frame (GP1b/GP8), so the canvas keeps createFrame's FIXED 100 while CSS takes content height â the FC-GRID-ROOT-VSIZE defect the composition corpus measured on three of five stems`,"grid-overlay-edge-inversion":"grid-overlay-edge-inversion: inverting a captured absolute child (dump `abs`: x/y inside a cell) into Part.overlay is refused PERMANENTLY â not a Plugin API dead end but a VOCABULARY one: OverlaySchema is four edge values with NO offset channel, while the canvas fact is a point in R² plus a 3Ã3 constraints lattice, so every total map either drops the offsets (a silent geometry rewrite) or invents a channel the schema does not have (G9.1). The child is carried out-of-flow through the existing abs door (position:absolute + minted insets) and the GRID is carried whole","slot-accepts-cycle":`slot-accepts-cycle: a cycle in the slot.accepts dependency graph is refused â accepts is a HARD emission-order dependency (a slot naming an absent component throws at compile), so the emitted set is ordered topologically (G10); a cycle cannot be satisfied in one pass and dropping an edge to break it would make the constraint depend on iteration order`},gc=e=>{if(typeof e==`string`){let t=e.trim();if(/^repeat\(\s*auto-(fit|fill)/.test(t))return hc[`grid-auto-fit-minmax`];if(t.includes(`minmax(`))return hc[`grid-track-minmax`];if(t===`subgrid`)return hc[`grid-subgrid`];if(t.includes(`%`)&&!t.startsWith(`fit-content`))return hc[`grid-track-percent`]}if(typeof e==`object`&&e){let t=e;if(`min`in t||`max`in t)return hc[`grid-track-minmax`];if(`percent`in t||t.type===`PERCENT`)return hc[`grid-track-percent`];if(t.px===0||t.fr===0)return hc[`grid-track-zero`];if(typeof t.px==`number`&&t.px<0)return hc[`grid-negative-line`]}return`grid track must be exactly one of {"px": number>0}, {"fr": number>0}, {"fit": true} â the three spellings the Plugin API round-trips (P2/P2b: FIXED | FLEX | HUG)`},_c=fs().positive({error:e=>e.input===0?hc[`grid-track-zero`]:`grid track px/fr values must be > 0 (fractional ok â P2b: 33.5px / 2.5fr carried exactly)`}),vc=Es([V({px:_c}),V({fr:_c}),V({fit:Is(!0)})],{error:e=>gc(e.input)}),yc=Es([fs().min(0),dc]),bc=V({row:yc,column:yc}),xc=Is(`row`,{error:e=>{let t=e.input;return t===`column`||t===`column dense`?hc[`grid-flow-column`]:t===`dense`||t===`row dense`?hc[`grid-flow-dense`]:`flow must be "row" â the one bounded auto-flow the canvas has (P5: gridItemsPositioning is 'MANUAL' | 'ROW_AUTO_FLOW')`}}),Sc=Ps([`auto`,`start`,`center`,`end`],{error:e=>{let t=e.input;
94return t===`stretch`?hc[`grid-align-stretch-keyword`]:t===`baseline`?hc[`grid-baseline-align`]:`grid alignment vocabulary is auto | start | center | end (P3/P4: AUTO | MIN | CENTER | MAX â exactly those four)`}}),Cc=fs().int().nonnegative({error:()=>hc[`grid-negative-line`]}),wc=fs().int().min(1),Tc=V({row:Cc,column:Cc,rowSpan:wc.optional(),columnSpan:wc.optional(),alignX:Sc.optional(),alignY:Sc.optional()}),Ec=V({row:Cc,column:Cc,rowSpan:wc.optional(),columnSpan:wc.optional()}),Dc=V({display:Ps([`flex`,`inline-flex`,`grid`]).optional(),direction:Ps([`row`,`column`]).optional(),align:Ps([`start`,`center`,`end`,`stretch`,`baseline`]).optional(),justify:Ps([`start`,`center`,`end`,`space-between`]).optional(),grow:gs().optional(),overlap:gs().optional(),wrap:gs().optional(),rows:Ss(vc).min(1).optional(),columns:Ss(vc).min(1).optional(),gap:bc.optional(),areas:Ms(B(),Ec).optional(),flow:xc.optional()}).superRefine((e,t)=>{if(e.display===`grid`){for(let n of[`direction`,`justify`,`align`,`wrap`,`overlap`])e[n]!==void 0&&t.addIssue({code:`custom`,path:[n],message:`"${n}" is a flex-only fact and is schema-invalid together with display: "grid" (G1)`});e.columns||t.addIssue({code:`custom`,path:[`columns`],message:`display: "grid" requires a declared "columns" track list â the declared tracks ARE the contract fact (G1)`}),e.flow===`row`?e.areas&&t.addIssue({code:`custom`,path:[`areas`],message:`named areas are explicit placements; under flow: "row" placement is CHILD ORDER (P5: position setters are refused under auto-flow) â a grid declares areas or flow, never both`}):e.rows||t.addIssue({code:`custom`,path:[`rows`],message:`display: "grid" requires a declared "rows" track list, or flow: "row" with derivable rows (G1/G5)`})}else for(let n of[`rows`,`columns`,`gap`,`areas`,`flow`])e[n]!==void 0&&t.addIssue({code:`custom`,path:[n],message:`"${n}" is a grid-only fact â it requires display: "grid" (G1)`})}),Oc=V({display:Ps([`flex`,`inline-flex`]).optional(),direction:Ps([`row`,`column`,`row-reverse`,`column-reverse`]).optional(),align:Ps([`start`,`center`,`end`,`stretch`,`baseline`]).optional(),justify:Ps([`start`,`center`,`end`,`space-between`]).optional()}),kc=V({prop:B(),map:Ms(B(),Oc)}),Ac=V({prop:B(),map:Ms(B(),Ms(B(),dc))}),jc=Es([Ac,Ss(Ac).min(1)]),Mc=V({prop:B(),state:B(),map:Ms(B(),Ms(B(),dc))}),Nc=`(?:-?\\d+(?:\\.\\d+)?(?:px|rem|em)|inset|#[0-9a-fA-F]{3,8}|rgba?\\([\\d ,./%]+\\))`,Pc=RegExp(`^(?:none|${Nc}(?:[ ,]+${Nc})*)$`),Fc=new Set([`box-shadow`]),Ic=/^(-?\d+(\.\d+)?(px|rem|em|%)?|transparent|inherit|currentColor|fit-content|#[0-9a-fA-F]{3,8}|rgba?\([\d ,./%]+\))$/,Lc=e=>{let t=[],n=0,r=``;for(let i of e)i===`(`&&n++,i===`)`&&n--,i===`,`&&n===0?(t.push(r.trim()),r=``):r+=i;return r.trim()&&t.push(r.trim()),t},Rc=/^-?\d+(?:\.\d+)?(?:px|rem|em)$/,zc=/^(?:#[0-9a-fA-F]{3,8}|rgba?\([\d ,./%]+\))$/,Bc=e=>{let t=[],n=0,r=``;for(let i of e)i===`(`&&n++,i===`)`&&n--,/\s/.test(i)&&n===0?(r&&t.push(r),r=``):r+=i;if(r&&t.push(r),t.length===0)return!1;let i=0,a=0;for(let e of t)if(e!==`inset`){if(Rc.test(e)){i++;continue}if(zc.test(e)){a++;continue}return!1}return i>=2&&i<=4&&a<=1},Vc=(e,t)=>{if(!Fc.has(e))return Ic.test(t);let n=t.trim();if(n===`none`)return!0;if(!Pc.test(n))return!1;let r=Lc(n);return r.length>0&&r.every(Bc)};B().regex(Ic,`Literal value must be a px/rem/em/%/number, hex or rgb()/rgba() color, fit-content, or transparent/inherit/currentColor`);var Hc=new Set(`background.background-color.color.height.width.min-width.min-height.padding-block.padding-inline.gap.border-radius.border-width.font-size.line-height.letter-spacing.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.border-top-width.border-right-width.border-bottom-width.border-left-width.padding-left.padding-right.padding-top.padding-bottom.top.right.bottom.left.border-color.border-top-color.border-right-color.border-bottom-color.border-left-color.box-shadow`.split(`.`)),Uc=Ms(B(),B()).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))Vc(n,r)||t.addIssue({code:cc.custom,path:[n],message:Fc.has(n)?"box-shadow literal must be `none` or a CSS shadow stack (lengths in px/rem/em, hex or rgb()/rgba() colors, optional `inset`)":`Literal value must be a px/rem/em/%/number, hex or rgb()/rgba() color, fit-content, or transparent/inherit/currentColor`})}),Wc=V({prop:B(),map:Ms(B(),Uc)}),Gc=(e,t)=>{let n=qc[e];return!n||n.canvas!==`draw`?!1:!(n.drawExcept?.test(t)??!1)},Kc=(...e)=>RegExp(`^(${e.join(`|`)})$`),qc={transform:{value:/^(?:matrix\(1, 0, 0, 1, -?[\d.]+, -?[\d.]+\)$|rotate\(-?[\d.]+deg\))$/,canvas:`draw`,note:`Identity-translate (absolute offset fold) or rotate(<n>deg) for icon/shape orientation (FC-SVG-ROTATION).`},translate:{value:/^(none|-?[\d.]+(px|%)( -?[\d.]+(px|%))?)$/,canvas:`draw`,note:`Independent translate longhand on an absolute part â folded into the canvas absolute offsets (tx/ty).`},"box-sizing":{value:Kc(`border-box`,`content-box`),canvas:`draw`,note:`Box-sizing changes what captured width/height mean â content-box geometry gets padding added when lowered to canvas frame sizes.`},cursor:{value:/^[a-z-]+$/,canvas:`annotate`,note:`Cursor changes (pointer on hover) exist only in the coded component.`},"user-select":{value:Kc(`none`,`auto`,`text`,`all`,`contain`),canvas:`annotate`,note:`Text-selection behavior (user-select) exists only in the coded component.`},"pointer-events":{value:Kc(`none`,`auto`),canvas:`annotate`,note:`Pointer-event gating exists only in the coded component.`},"touch-action":{value:/^(auto|none|manipulation|(pan-(x|y|left|right|up|down)|pinch-zoom)( (pan-(x|y|left|right|up|down)|pinch-zoom))*)$/,canvas:`annotate`,note:`Touch gesture handling (touch-action) exists only in the coded component.`},appearance:{value:Kc(`none`,`auto`),canvas:`annotate`,note:`Native form-control appearance is reset only in the coded component.`},"text-rendering":{value:Kc(`auto`,`optimizespeed`,`optimizelegibility`,`geometricprecision`),canvas:`annotate`,note:`Text rasterization hints (text-rendering) apply only in code.`},"font-feature-settings":{value:/^(normal|"[a-z0-9]{4}"( (on|off|\d+))?(, "[a-z0-9]{4}"( (on|off|\d+))?)*)$/i,canvas:`annotate`,note:`Tabular figures / ligature settings apply only in code â Figma's plugin API cannot set OpenType features.`},transition:{value:/^[a-z0-9 .,()%-]+$/i,canvas:`annotate`,note:`Motion (spin, pulse, easing) runs only in the coded component; the canvas shows one still frame.`},"transition-property":{value:/^(none|all|[a-z-]+(, [a-z-]+)*)$/,canvas:`annotate`,note:`Motion (spin, pulse, easing) runs only in the coded component; the canvas shows one still frame.`},"transition-duration":{value:/^-?[\d.]+m?s(, -?[\d.]+m?s)*$/,canvas:`annotate`,note:`Motion (spin, pulse, easing) runs only in the coded component; the canvas shows one still frame.`},"transition-timing-function":{value:/^[a-z0-9 .,()-]+$/i,canvas:`annotate`,note:`Motion (spin, pulse, easing) runs only in the coded component; the canvas shows one still frame.`},"transition-delay":{value:/^-?[\d.]+m?s(, -?[\d.]+m?s)*$/,canvas:`annotate`,note:`Motion (spin, pulse, easing) runs only in the coded component; the canvas shows one still frame.`},position:{value:Kc(`relative`,`static`,`absolute`),canvas:`annotate`,note:`Positioning context (relative) or an inset overlay (absolute, lowered to absolute positioning on canvas); fixed/sticky have no carried spelling.`},"aspect-ratio":{value:/^\d+(\.\d+)?( \/ \d+(\.\d+)?)?$/,canvas:`draw`,note:`The intrinsic aspect ratio renders natively (height follows the bound width).`},"max-width":{value:/^(none|-?\d+(\.\d+)?(px|rem|em|%)|fit-content|max-content|min-content)$/,canvas:`annotate`,note:`Fluid max-width constraints live in code; the canvas draws the component at its real size (standing choice).`},"max-height":{value:/^(none|-?\d+(\.\d+)?(px|rem|em|%)|fit-content|max-content|min-content)$/,canvas:`annotate`,note:`Fluid max-height constraints live in code; the canvas draws the component at its real size (standing choice).`},display:{value:Kc(`inline`,`inline-block`,`block`,`flow-root`,`list-item`,`contents`,`none`),canvas:`annotate`,note:`CSS display modes outside auto-layout flex (inline, block, list-item) have no direct Figma equivalent; the canvas approximates with frame nesting (a block-level box lowers to a vertical stack).`},"text-wrap-mode":{value:Kc(`wrap`,`nowrap`),canvas:`annotate`,note:`Line-breaking rules differ: Figma wraps by box width only.`},"white-space":{value:Kc(`normal`,`nowrap`,`pre`,`pre-wrap`,`pre-line`,`break-spaces`),canvas:`annotate`,note:`Line-breaking rules differ: Figma wraps by box width only.`},"overflow-x":{value:Kc(`visible`,`hidden`,`clip`,`auto`,`scroll`),canvas:`draw`,drawExcept:Kc(`auto`,`scroll`,`visible`),note:`hidden/clip clip natively (clipsContent). auto/scroll are scrolling, which exists only in code.`},"overflow-y":{value:Kc(`visible`,`hidden`,`clip`,`auto`,`scroll`),canvas:`draw`,drawExcept:Kc(`auto`,`scroll`,`visible`),note:`hidden/clip clip natively (clipsContent). auto/scroll are scrolling, which exists only in code.`},"text-overflow":{value:Kc(`clip`,`ellipsis`),canvas:`draw`,note:`Text truncation renders natively on the canvas (textTruncation).`},"text-transform":{value:Kc(`none`,`uppercase`,`lowercase`,`capitalize`),canvas:`draw`,note:`Text case renders natively on the canvas (textCase).`},"text-decoration-line":{value:Kc(`none`,`underline`,`line-through`,`overline`),canvas:`draw`,drawExcept:Kc(`overline`),note:`Underline/strikethrough render natively (textDecoration); overline exists only in code.`},"text-decoration-style":{value:Kc(`solid`,`dashed`,`dotted`,`wavy`,`double`),canvas:`annotate`,note:`This decoration style variant exists only in code (canvas draws a
94solid decoration).`},"text-decoration-thickness":{value:/^(auto|from-font|-?\d+(\.\d+)?(px|rem|em|%))$/,canvas:`annotate`,note:`Decoration thickness exists only in code (canvas draws the default thickness).`},"text-align":{value:Kc(`left`,`right`,`center`,`justify`,`start`,`end`),canvas:`draw`,note:`Text alignment renders natively on the canvas (textAlignHorizontal).`},"font-family":{value:/^[^;{}]+$/,canvas:`draw`,note:`The first font-family stack entry renders on the canvas; fallback chains exist only in code.`},"font-style":{value:Kc(`normal`,`italic`,`oblique`),canvas:`draw`,note:`The slant renders natively on the canvas by selecting the italic face (fontName.style); a family with no italic face falls back to upright and says so (FC-FONT-STYLE-UNRESOLVED).`},"border-style":{value:Kc(`none`,`solid`,`dashed`,`dotted`),canvas:`annotate`,note:`Non-solid border styles exist only in code; the canvas shows a solid stroke of the same width.`},"border-top-style":{value:Kc(`none`,`solid`,`dashed`,`dotted`),canvas:`annotate`,note:`This part's borders use different styles per side in code; Figma strokes share one style.`},"border-right-style":{value:Kc(`none`,`solid`,`dashed`,`dotted`),canvas:`annotate`,note:`This part's borders use different styles per side in code; Figma strokes share one style.`},"border-bottom-style":{value:Kc(`none`,`solid`,`dashed`,`dotted`),canvas:`annotate`,note:`This part's borders use different styles per side in code; Figma strokes share one style.`},"border-left-style":{value:Kc(`none`,`solid`,`dashed`,`dotted`),canvas:`annotate`,note:`This part's borders use different styles per side in code; Figma strokes share one style.`},"background-attachment":{value:/^(scroll|fixed|local)(, (scroll|fixed|local))*$/,canvas:`annotate`,note:`Background attachment exists only in code.`},"background-blend-mode":{value:/^[a-z-]+(, [a-z-]+)*$/,canvas:`annotate`,note:`Background blend modes exist only in code (per-paint blendMode upgrade deferred by name).`},"background-clip":{value:/^(border-box|padding-box|content-box|text)(, (border-box|padding-box|content-box|text))*$/,canvas:`annotate`,note:`Background clipping exists only in code.`},"background-origin":{value:/^(border-box|padding-box|content-box)(, (border-box|padding-box|content-box))*$/,canvas:`annotate`,note:`Background origin exists only in code.`},"background-position":{value:/^[a-z0-9.% -]+(, [a-z0-9.% -]+)*$/,canvas:`annotate`,note:`Background positioning exists only in code.`},"background-repeat":{value:/^[a-z-]+( [a-z-]+)?(, [a-z-]+( [a-z-]+)?)*$/,canvas:`annotate`,note:`Background repetition exists only in code (uniform TILE approximation deferred by name).`},"background-size":{value:/^[a-z0-9.% -]+(, [a-z0-9.% -]+)*$/,canvas:`annotate`,note:`Background sizing exists only in code.`},isolation:{value:Kc(`auto`,`isolate`),canvas:`annotate`,note:`Stacking-context isolation exists only in code.`},"outline-style":{value:Kc(`none`,`solid`,`dashed`,`dotted`,`auto`),canvas:`annotate`,note:`Focus outlines render as a bound stroke approximation on canvas state previews (standing C5 approximation).`}},H=e=>({canvas:`draw`,css:`verbatim`,note:e}),Jc=e=>({canvas:`annotate`,css:`verbatim`,note:e}),Yc={background:H(`fills[0] (the CSS shorthand colour layer).`),"background-color":H(`fills[0].`),"background-image":H(`a parsed linear gradient appends as a GRADIENT_LINEAR paint; radial/conic/unparseable values fall to gradientMiss.`),"box-shadow":H(`DROP_SHADOW effect / effect stack; values outside the stack grammar fall to shadowMiss.`),color:H(`the text node fill.`),fill:H(`baked into the promoted glyph markup (iconSvg), like currentColor bakes the text colour.`),stroke:H("the glyph's stroke paint â baked into the promoted glyph markup (iconSvg) via the currentColor pass; the stroke-drawn (lucide-class) counterpart of `fill`."),"stroke-width":H(`the glyph's stroke weight â carried verbatim in the promoted glyph markup (stroke-width attribute); CSS surfaces render the computed value.`),opacity:H(`the node opacity (literal â Figma opacity is percent-scaled, so the 0-1 token is not bound).`),"border-color":H(`the strokes paint.`),"border-top-color":H(`one strokes paint serves all four sides â lowered only when every carried side agrees.`),"border-right-color":H(`one strokes paint serves all four sides â lowered only when every carried side agrees.`),"border-bottom-color":H(`one strokes paint serves all four sides â lowered only when every carried side agrees.`),"border-left-color":H(`one strokes paint serves all four sides â lowered only when every carried side agrees.`),"border-width":H(`strokeWeight.`),"border-top-width":H(`strokeTopWeight.`),"border-right-width":H(`strokeRightWeight.`),"border-bottom-width":H(`strokeBottomWeight.`),"border-left-width":H(`strokeLeftWeight.`),"border-radius":H(`all four corner radius fields.`),"border-top-left-radius":H(`topLeftRadius.`),"border-top-right-radius":H(`topRightRadius.`),"border-bottom-left-radius":H(`bottomLeftRadius.`),"border-bottom-right-radius":H(`bottomRightRadius.`),width:H(`a fixed width.`),height:H(`a fixed height.`),"min-width":H(`minWidth.`),"min-height":H(`minHeight (suppressed when the same part carries height â a fixed height is the drawn design truth).`),"max-width":H(`a root/text part bakes it as a fixed width;
94 any other part binds the real maxWidth ceiling and hugs beneath it.`),"padding-inline":H(`paddingLeft + paddingRight.`),"padding-block":H(`paddingTop + paddingBottom.`),"padding-left":H(`paddingLeft.`),"padding-right":H(`paddingRight.`),"padding-top":H(`paddingTop.`),"padding-bottom":H(`paddingBottom.`),gap:H(`itemSpacing.`),"column-gap":H(`itemSpacing on a HORIZONTAL stack; on a VERTICAL stack it is the CROSS axis and only matters under wrap â CSS-side there.`),"row-gap":H(`itemSpacing on a VERTICAL stack; on a HORIZONTAL stack it is the CROSS axis â CSS-side there.`),"margin-top":H(`the margin-box wrapper / sibling-gap itemSpacing lowering.`),"margin-right":H(`the margin-box wrapper / sibling-gap itemSpacing lowering.`),"margin-bottom":H(`the margin-box wrapper / sibling-gap itemSpacing lowering.`),"margin-left":H(`the margin-box wrapper / sibling-gap itemSpacing lowering.`),top:H(`absolutePartPlacement / insetOverlayOffsets / boundFullBleedScrimRoot â absolute offsets, not a switch case.`),right:H(`absolutePartPlacement / insetOverlayOffsets / boundFullBleedScrimRoot.`),bottom:H(`absolutePartPlacement / insetOverlayOffsets / boundFullBleedScrimRoot.`),left:H(`absolutePartPlacement / insetOverlayOffsets / boundFullBleedScrimRoot.`),"translate-x":{canvas:`draw`,css:`canvas-only`,note:`SYNTHETIC (decomposeTranslate) â folded into absolute x placement on canvas; CSS has no translate-x longhand.`},"translate-y":{canvas:`draw`,css:`canvas-only`,note:`SYNTHETIC (decomposeTranslate) â folded into absolute y placement on canvas; CSS has no translate-y longhand.`},"font-family":H(`the text node family (falls back to Inter when unavailable â named limit).`),"font-size":H(`fontSize.`),"font-weight":H(`the font STYLE name (Regular/Medium/Semi Bold/Bold).`),"line-height":H(`pixel lineHeight on text nodes.`),"letter-spacing":H(`pixel letterSpacing on text nodes.`),"outline-color":{canvas:`draw`,css:`verbatim`,note:`the strokes paint of an OUTSIDE-aligned stroke â drawn only when outline-width is carried too (a resting outline with no width paints nothing in CSS, and the toned base cells must not gain a ring).`},"outline-width":{canvas:`draw`,css:`verbatim`,note:`strokeWeight of an OUTSIDE-aligned stroke â drawn only when outline-color is carried too. emit-react supplies the outline-style:solid the pair needs; without a width no outline-style is written at all.`},"outline-offset":Jc(`Figma strokes have no offset field â an outside-aligned stroke sits flush against the box.`),"flex-basis":Jc(`Figma auto-layout has no flex-basis; sizing is hug/fill/fixed.`),"flex-grow":Jc(`the canvas approximates growth with layoutGrow/FILL, which is a boolean, not a ratio.`),"flex-shrink":Jc(`Figma auto-layout children do not shrink below their content â there is no shrink factor.`),"grid-template-columns":Jc(`Figma has no grid track sizing; the canvas lowers grids to nested auto-layout stacks.`),"grid-template-rows":Jc(`Figma has no grid track sizing.`),"grid-column-start":Jc(`Figma has no grid placement.`),"grid-row-start":Jc(`Figma has no grid placement.`),"grid-row-end":Jc(`Figma has no grid placement.`),"max-height":Jc(`Figma has no maxHeight field (maxWidth exists; its height twin does not).`),"text-indent":Jc(`Figma text nodes have no first-line indent.`),"vertical-align":Jc(`Figma has no inline baseline alignment; auto-layout counterAxisAlignItems is the nearest, coarser, fact.`),"z-index":Jc(`paint order on canvas is CHILD ORDER â a z-index a part carries independently of its DOM order has no field.`),scale:Jc(`Figma has no scale transform â a node's size IS its box, so a scale factor cannot be lowered without silently rewriting the box; the third independent-transform longhand alongside translate (folded to absolute placement) and rotate (carried by the transform grammar).`),"row-rule-color":Jc(`a Chromium GAP-DECORATION longhand (CSS gap decorations) that the computed sweep enumerates for every element â nobody authored it, and neither surface paints it. Registered so it is CARRIED and NAMED rather than silently believed.`),"column-rule-color":Jc(`a column-rule longhand the computed sweep enumerates; the canvas has no column rules.`),"caret-color":Jc(`the text caret is runtime UI, not canvas ink.`),"text-decoration-color":Jc(`Figma textDecoration is an enum with no independent colour.`),"text-emphasis-color":Jc(`Figma has no text-emphasis marks.`)},Xc={"background-image":{css:[`background-image`],note:`per-instance IMAGE fill identity (a Figma instance carries its own imageHash â dump v1.9 imageFill observed on the instance node).`},size:{css:[`width`,`height`],note:`per-instance box (a Figma instance is freely resizable â observed bbox, SQUARE boxes only: one custom property drives width and height, and any nested part binding the same refs, e.g. a stub glyph).`},"background-color":{css:[`background-color`],note:`per-instance solid paint (dump v1.7 instancePrimaryFill, fill-shaped) â stub roots declare it (their paint IS the observed instance paint); a real child owns its own paint.`},color:{css:[`color`],note:"per-instance GLYPH INK (gap-closing round 8; dump v1.7 instancePrimaryFill, stroke- or fill-shaped, observed on the nested instance node). The twin of background-color for a vector child: an exported glyph whose whole drawing is ONE ink draws `currentColor`, its own contract binds that ink as `color`, and a host that draws the same glyph in its own ink sets this channel. A glyph with two or more distinct inks is refused by the single-ink test (examples/untitled-ui/glyph-ink.mts) and never reaches this channel â one custom property cannot honestly serve two paints."}},Zc=(e,t)=>`--${e.replace(/[^a-zA-Z0-9]+/g,`-`)}-${t}`,Qc=B().regex(/^[^;{}!]+$/,`Declared value must be a plain CSS value (no token refs, no "!important", no rule injection)`),$c=new Set([`position`,`top`,`right`,`bottom`,`left`,`z-index`,`overflow`,`text-overflow`,`white-space`,`display`,`opacity`,`pointer-events`,`transform`,`transition`,`flex-direction`,`justify-content`,`align-items`,`cursor`,`text-decoration`,`mask`]),el=V({prop:B(),equals:B().optional(),styles:Ms(B(),B())}),tl=V({placement:Ps([`top`,`bottom`,`start`,`end`])}
94),nl=V({kind:Ps([`polygon`,`ellipse`,`rect`]),sides:fs().int().min(3).optional(),width:fs().positive(),height:fs().positive(),rotation:fs().optional(),arc:V({start:fs(),end:fs(),innerRadius:fs().min(0).max(1)}).optional()});function rl(e){let t=[],n=e=>`${Math.round(e*1e4)/1e4}%`;for(let r=0;r<e;r++){let i=(-90+r*360/e)*Math.PI/180;t.push(`${n(50+50*Math.cos(i))} ${n(50+50*Math.sin(i))}`)}return`polygon(${t.join(`, `)})`}function il(e,t){let n=e=>e*180/Math.PI,r=e=>Math.round(e*100)/100,i=r(n(t-e));return i<=0||i>=360?null:`conic-gradient(from ${r(((n(e)+90)%360+360)%360)}deg, #000 0deg ${i}deg, transparent ${i}deg 360deg)`}function al(e,t,n){if(!e)return[];if(`border-width`in e)return[`border-style: solid`];if(t!==`literals`)return[];let r=[];for(let t of[`top`,`right`,`bottom`,`left`]){let i=e[`border-${t}-width`];if(i===void 0)continue;let a=Number.parseFloat(i);!Number.isFinite(a)||a===0||n&&(`border-${t}-style`in n||`border-style`in n)||r.push(`border-${t}-style: solid`)}return r}function ol(e){let t=[`width: ${e.width}px`,`height: ${e.height}px`,`flex-shrink: 0`];if(e.kind===`polygon`&&t.push(`clip-path: ${rl(e.sides??3)}`),e.kind===`ellipse`&&t.push(`border-radius: 50%`),e.kind===`ellipse`&&e.arc){let n=il(e.arc.start,e.arc.end);n&&t.push(`mask: ${n}`)}return e.rotation!==void 0&&e.rotation!==0&&t.push(`transform: rotate(${e.rotation}deg)`),t}var sl=V({itemsProp:B(),sample:Ss(Ms(B(),Es([B(),gs(),fs()]))).min(1)}),cl=V({prop:B(),equals:Es([B(),Ss(B()).min(1)]).optional()}),ll=V({id:B(),props:Ms(B(),Es([B(),gs()])).optional(),text:B().optional()}),ul=V({name:B(),accepts:Ss(B()).optional(),acceptsMode:Ps([`prefer`,`restrict`,`open`]).optional(),min:fs().int().min(0).optional(),max:fs().int().min(1).optional(),required:gs().optional(),figmaProperty:B().optional(),defaultContent:Ss(ll).optional()}),dl=V({prop:B(),map:Ms(B(),B())}),fl=V({id:B(),props:Ms(B(),Es([B(),gs(),dl])).optional(),text:B().optional(),overrides:Ms(B(),dc).optional()});function pl(e){return e.overlay?!0:e.declared?.position===`absolute`||e.literals?.position===`absolute`}function ml(e,t){let n=[...e.literalsByProp??[],...e.tokensByProp===void 0?[]:Array.isArray(e.tokensByProp)?e.tokensByProp:[e.tokensByProp]],r=[e.literals?.[t],e.tokens?.[t],...n.flatMap(e=>Object.values(e.map??{}).map(e=>e[t]))],i=!1;for(let e of r)if(e!==void 0){if(e===`fit-content`)return`hug`;i=!0}if(i||t===`width`&&e.layout?.grow)return`definite`}function hl(e,t,n){let r=e.layout;if(r?.display!==`grid`)return;let i=e=>(e??[]).some(e=>`fr`in e),a=r.flow===`row`&&r.rows===void 0?!0:i(r.rows);for(let[o,s]of[[`width`,i(r.columns)],[`height`,a]]){let r=ml(e,o);r===void 0?s||n.addIssue({code:`custom`,path:[...t,`literals`,o],message:hc[`grid-axis-indefinite`]}):r===`hug`&&s&&n.addIssue({code:`custom`,path:[...t,`literals`,o],message:hc[`grid-hug-flex-axis`]})}}function gl(e,t){let n=(e,n)=>t.addIssue({code:`custom`,path:e,message:n}),r=e.layout,i=Object.entries(e.parts??{});{let e=new Set(Object.keys(r?.areas??{}));for(let[n,a]of i)a.layout?.display===`grid`&&(r?.display===`grid`&&!pl(a)&&(a.placement!==void 0||e.has(n)||r.flow===`row`)||hl(a,[`parts`,n],t))}if(r?.display!==`grid`){for(let[e,t]of i)t.placement&&n([`parts`,e,`placement`],`part "${e}" carries "placement" but its parent does not declare layout.display "grid" â placement is a grid-cell fact (G2)`);return}e.layoutByProp&&n([`layoutByProp`],`a grid part may not carry layoutByProp â a layout.mode change is STRUCTURAL (P10: the canvas physically destroys tracks on mode switch); per-variant grids are separate parts`);let a=r.rows?.length??0,o=r.columns?.length??0,s=r.flow===`row`,c=r.areas??{},l=i.filter(([,e])=>!pl(e));for(let[e,t]of i)pl(t)&&t.placement&&n([`parts`,e,`placement`],`out-of-flow part "${e}" may not carry placement â overlays and absolutely positioned parts keep the out-of-flow grammar (P13: absolute children even report bogus 0,0 anchors, which readers must gate; G9.2)`),t.layout?.grow&&n([`parts`,e,`layout`,`grow`],hc[`grid-child-grow`]),t.placement&&c[e]&&n([`parts`,e,`placement`],`part "${e}" is named by an area AND carries explicit placement â the area name IS the placement anchor; one source of truth (G4)`);if(s){for(let[e,t]of l)t.placement&&n([`parts`,e,`placement`],`flow: "row" places by CHILD ORDER â part "${e}" may not carry placement (P5: setGridChildPosition is refused under auto-flow)`);if(r.rows!==void 0&&o>0){let e=Math.max(1,Math.ceil(l.length/o));a<e&&n([`rows`],`${hc[`grid-implicit-tracks`]} â flow: "row" over ${o} column(s) with ${l.length} in-flow child(ren) needs ${e} declared row track(s), found ${a} (G5â²)`)}return}let u=l.filter(([e,t])=>!t.placement&&!c[e]).map(([e])=>e);if(u.length>0){n([`parts`],u.length<l.length?`manual grid: every direct child must carry placement (or take an area's), or none may (auto-flow, G5) â mixing is schema-invalid; unplaced: ${u.join(`, `)}`:`manual grid: no direct child carries placement â declare flow: "row" for order-placed grids (G5) or place every child (G2)`);return}let d=[];for(let[e,t]of l){let n=t.placement??c[e];n&&d.push({who:`part "${e}"`,r:n.row,c:n.column,rs:n.rowSpan??1,cs:n.columnSpan??1})}let f=new Set(l.map(([e])=>e));for(let[e,t]of Object.entries(c))f.has(e)||d.push({who:`area "${e}"`,r:t.row,c:t.column,rs:t.rowSpan??1,cs:t.columnSpan??1});for(let e of d)e.r+e.rs>a&&n([`parts`],`${e.who}: Row span exceeds grid row count â anchor ${e.r} + span ${e.rs} > ${a} declared rows (P3's exact throw class; the canvas would absorb overflow by rewriting the declaration, P9)`),e.c+e.cs>o&&n([`parts`],`${e.who}: Column span exceeds grid column count â anchor ${e.c} + span ${e.cs} > ${o} declared columns (P3's exact throw class)`);for(let e=0;e<d.length;e++)for(let t=e+1;t<d.length;t++){let r=d[e],i=d[t];r.r<i.r+i.rs&&i.r<r.r+r.rs&&r.c<i.c+i.cs&&i.c<r.c+r.cs&&n([`parts`],`${r.who} and ${i.who} overlap on the grid â placements+spans may not occupy the same cell (P3: the canvas throws the occupancy error mid-script; the contract refuses BEFORE emitting)`)}}var _l=ic(()=>V({description:B().optional(),element:B().optional(),roleException:B().optional(),layout:Dc.optional(),placement:Tc.optional(),layoutByProp:kc.optional(),stylesWhen:Ss(el).optional(),overlay:tl.optional(),shape:nl.optional(),tokens:Ms(B(),dc).optional(),tokensByProp:jc.optional(),literals:Uc.optional(),literalsByProp:Ss(Wc).min(1).optional(),declared:Ms(B(),Qc).optional(),declaredStates:Ms(B(),Ms(B(),Qc)).optional(),hugsBelowMaxWidth:gs().optional(),states:Ms(B(),Ms(B(),dc)).optional(),statesByProp:Ss(Mc).min(1).optional(),content:V({prop:B()}).optional(),text:B().optional(),textByProp:dl.optional(),meter:V({valueProp:B(),maxProp:B()}).optional(),animation:Ps([`spin`,`pulse`]).optional(),slot:ul.optional(),component:fl.optional(),overridable:Ss(B()).optional(),repeat:sl.optional(),icon:V({asset:B(),size:fs().optional()}).optional(),attrs:Ms(B(),B()).optional(),visibleWhen:cl.optional(),optional:gs().optional(),parts:Ms(B(),_l).optional()}).superRefine(gl)),vl=V({name:B().regex(/^[a-z][a-zA-Z0-9]*$/),description:B().optional(),bindings:V({code:V({prop:B().regex(/^on[A-Z][a-zA-Z0-9]*$/)})}
94),trigger:B(),toggles:ws({prop:B(),between:As([B(),B()]),aria:Ps([`expanded`,`checked`,`pressed`,`selected`]).optional()}).optional()}),yl=V({version:Is(1),canonicalRevision:B().regex(/^sha256:[0-9a-f]{64}$/),source:V({kind:Ps([`code`,`design`]),adapter:B().min(1),revision:B().regex(/^sha256:[0-9a-f]{64}$/)}),awaitingCodeAdoption:V({designRevision:B().regex(/^sha256:[0-9a-f]{64}$/),sourceRevision:B().regex(/^sha256:[0-9a-f]{64}$/)}).optional()}),bl=V({$schema:B().optional(),id:B().regex(/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/),name:B(),version:B().regex(/^\d+\.\d+\.\d+$/,`version must be semver (MAJOR.MINOR.PATCH)`),status:Ps([`draft`,`stable`,`deprecated`]).default(`draft`),description:B(),semantics:V({element:Ps(`button.span.div.a.input.article.section.header.footer.label.nav.hr.ul.li.p.textarea.select.fieldset.blockquote.code.kbd.h1.h2.h3.h4.h5.h6`.split(`.`)),role:B().optional(),roleException:B().optional(),roleByProp:ws({prop:B(),map:Ms(B(),B())}).optional(),elementByProp:ws({prop:B(),map:Ms(B(),B())}).optional()}),props:Ss(mc),events:Ss(vl).optional(),states:Ss(Ps(uc)).default([]),figmaRepresentation:Ps([`component`,`native`]).optional(),modes:Ss(B()).optional(),figmaStatePreviews:gs().optional(),anatomy:Ms(B(),_l),a11y:ws({focusVisible:gs().optional(),minHitArea:fs().optional(),contrast:Ps([`AA`,`AAA`]).optional()}).optional(),anchors:V({figma:V({fileKey:B().nullable(),componentSetKey:B().nullable(),nodeId:B().nullable().optional()}),code:V({importPath:B(),export:B()})}),provenance:yl.optional()}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.anatomy??{}))hl(r,[`anatomy`,n],t)});function xl(e,t){let n=e.layout,r=e.layoutByProp,i=r?r.map[t[r.prop]??``]:void 0;return i?{...n,...i}:n}function Sl(e,t){let n=e.tokens??{};for(let r of Cl(e)){let e=r.map[t[r.prop]??``];e&&(n={...n,...e})}return n}function Cl(e){let t=e.tokensByProp;return t?Array.isArray(t)?t:[t]:[]}function wl(e,t){let n=e.literals??{};for(let r of e.literalsByProp??[]){let e=r.map[t[r.prop]??``];e&&(n={...n,...e})}return n}function Tl(e){return e.element===`input`&&(e.attrs?.type===`checkbox`||e.attrs?.type===`radio`)}var El=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]);function U(e){let t=[],n=(e,r,i)=>{t.push({name:e,part:r,path:i});for(let[e,t]of Object.entries(r.parts??{}))n(e,t,[...i,e])};for(let[t,r]of Object.entries(e.anatomy))n(t,r,[t]);return t}var Dl=e=>U(e).filter(e=>e.part.slot).map(e=>({...e,slot:e.part.slot})),Ol=e=>e.charAt(0).toUpperCase()+e.slice(1),kl=`State`,Al=`Default`,jl=e=>e.split(`-`).map(Ol).join(` `);function Ml(e,t){return e?`${e}, ${kl}=${t}`:`${kl}=${t}`}function Nl(e){let t=/^(.*?)(?:, )?State=([^,]*)$/.exec(e);return t?{axisPart:t[1],state:t[2]}:{axisPart:e,state:null}}function Pl(e){let{axisPart:t,state:n}=Nl(e);return n===null||n===`Default`?null:Ml(t,Al)}function Fl(e){let t=new Set(e.props.filter(e=>typeof e.type==`object`&&`enum`in e.type).map(e=>e.name)),n=new Set,r=U(e).map(e=>e.part.states??{});for(let i of e.states)for(let e of r)for(let r of Object.values(e[i]??{}))for(let e of r.matchAll(/\{([a-z][\w-]*)\}/g))t.has(e[1])&&n.add(e[1]);return[...n]}var Il=e=>e.figmaProperty??Ol(e.name);function Ll(e,t,n){if(!(!e||typeof e!=`object`))for(let[r,i]of Object.entries(e))r.startsWith(`$`)||i&&typeof i==`object`&&(`$value`in i?n.add([...t,r].join(`.`)):Ll(i,[...t,r],n))}function Rl(e){let t=new Set;for(let n of e)Ll(n,[],t);return t}function zl(e,t=[],n=``,r=new Map){let i=typeof e.$type==`string`?e.$type:n;for(let[n,a]of Object.entries(e))if(!n.startsWith(`$`)&&a&&typeof a==`object`){let e=a;if(`$value`in e){let a=typeof e.$type==`string`?e.$type:i;r.set([...t,n].join(`.`),{value:e.$value,type:a,...e.$extensions&&typeof e.$extensions==`object`&&!Array.isArray(e.$extensions)?{extensions:e.$extensions}:{}})}else zl(e,[...t,n],i,r)}return r}var Bl=/^\{([^}]+)\}$/,W=e=>typeof e==`string`?e.match(Bl)?.[1]??null:null,G=e=>{if(typeof e==`number`)return e;let t=String(e).trim(),n=parseFloat(t);return Number.isNaN(n)?null:/^[+-]?[\d.]+(rem|em)$/.test(t)?n*16:/^[+-]?\d*\.?\d+(px)?$/.test(t)?n:null},K=e=>{if(typeof e==`number`)return e;let t=String(e).trim(),n=parseFloat(t);if(Number.isNaN(n))throw Error(`Not a numeric token value: ${e}`);return/^-?[\d.]+(rem|em)$/.test(t)?n*16:n};function q(e){return t=>{let n=e.get(t),r=0;for(;n&&r++<10;){let t=W(n.value);if(!t)return n.value;n=e.get(t)}throw Error(`Cannot resolve token "${t}"`)}}var Vl={400:`Regular`,500:`Medium`,600:`Semi Bold`,700:`Bold`};function Hl(e){let t=zl(e.primitives),n=zl(e.semantic),r=zl(e.light),i=zl(e.brandDefault),a=new Map([...t,...i,...n,...r]),o=e=>{let t=a.get(e),n=0;for(;t&&n++<10;){let e=W(t.value);if(e===null)return t.value;t=a.get(e)}throw Error(`Cannot resolve token "${e}"`)},s=[];for(let[e]of n){let t=e.match(/^font\.(.+?)\.size(?:\.([^.]+))?$/);if(!t)continue;let r=t[1],i=[r,...t[2]?[t[2]]:[]].join(`/`).split(`.`).join(`/`),a=`font.${r}.weight`,c=n.has(a),l=c?Vl[K(o(a))]??`Medium`:`Medium`;s.push({name:i,tokenPath:e,...c?{weightPath:a}:{},fontSize:K(o(e)),fontStyle:l})}s.sort((e,t)=>
94e.name.localeCompare(t.name));let c=new Map,l=e=>{if(typeof e==`number`)return String(e);if(typeof e!=`string`)return null;let t=e.replace(/^#/,``).toLowerCase();if(/^[0-9a-f]{6}$/.test(t))return`#${t}`;let n=parseFloat(e);return Number.isNaN(n)?e:String(n)},u=e=>{for(let[t]of e){let e=null;try{e=l(o(t))}catch{continue}if(e===null)continue;let n=c.get(e)??[];n.includes(t)||n.push(t),c.set(e,n)}};return u(n),u(r),u(t),{semantic:n,resolveLiteral:o,has:e=>a.has(e),textStyles:s,textStyleByName:new Map(s.map(e=>[e.name,e])),suggestFor:e=>c.get(l(e)??``)??[]}}function Ul(e){if(typeof e==`number`)return`number`;let t=e.trim();if(/^#[0-9a-fA-F]{3,8}$/.test(t)&&[3,4,6,8].includes(t.length-1)||/^(rgb|rgba|hsl|hsla|color)\(/.test(t))return`color`;if(/^-?\d*\.?\d+(px|rem|em)$/.test(t))return`dimension`;if(/^-?\d*\.?\d+m?s$/.test(t))return`duration`;if(/^-?\d*\.?\d+$/.test(t))return`number`}var Wl=e=>typeof e==`string`||typeof e==`number`,Gl=(e,t)=>{let n=typeof t==`string`?t:Ul(e);return{$value:e,...n?{$type:n}:{}}};function Kl(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=!1,n=e=>{if(!(!e||typeof e!=`object`||Array.isArray(e)))if(`$value`in e)t=!0;else for(let t of Object.values(e))n(t)};if(n(e),t)return null;let r=[],i=0,a=(e,t)=>{let n={};for(let[o,s]of Object.entries(e)){let e=[...t,o].join(`.`);if(Wl(s)){n[o]=Gl(s),i++;continue}if(s&&typeof s==`object`&&!Array.isArray(s)){let c=s;if(Wl(c.value)){n[o]=Gl(c.value,c.type),i++;continue}let l=a(c,[...t,o]);Object.keys(l).length>
940?n[o]=l:r.push({path:e,reason:`group has no wrappable entries`});continue}r.push({path:e,reason:Array.isArray(s)?`array value â not a plain scalar token; wrap refuses to guess a representation`:`${s===null?`null`:typeof s} value â not a plain scalar token`})}return n},o=a(e,[]);return i===0?null:{tree:o,count:i,skipped:r}}var ql=`imported`,Jl=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9-]+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``);return t.length>0?t:`part`},Yl=e=>{let t=e.split(`/`).filter(e=>e.length>0).map(Jl);return t.length>0?t.join(`-`):`root`},Xl=(e,t)=>e===`color`?`#${String(t).replace(/^#/,``).toLowerCase()}`:e===`px`||e===`size`&&typeof t==`number`?`${t}px`:String(t),Zl=(e,t)=>e===`size`?typeof t==`number`?`dimension`:void 0:Ql[e],Ql={color:`color`,px:`dimension`,number:`number`,shadow:`shadow`,gradient:`gradient`},$l=(e,t)=>e===`color`?`color-${String(t).replace(/^#/,``).toLowerCase()}`:e===`shadow`||e===`gradient`?`${e}-${Jl(String(t))}`:`${e===`number`?`num`:`size`}-${String(t).replace(/^-/,`neg-`).replace(/\./g,`-`)}`,eu=(e,t)=>`${e}.${t}`,tu=e=>e.join(`.`);function nu(e,t,n,r){if(e.occurrences.length===0)return{kind:`none`,reason:`no occurrences observed â nothing minted`};let i=e.occurrences.map(e=>e.value);if(i.every(e=>e===i[0]))return{kind:`uniform`,value:i[0]};let a=e.part===``?t:t.filter(e=>!e.bool);for(let t of a){let n=new Map,r=!0;for(let i of e.occurrences){let e=i.axisValues[t.propName];if(e===void 0){r=!1;break}let a=n.get(e);if(a!==void 0&&a!==i.value){r=!1;break}n.set(e,i.value)}if(r){let r=t.values.filter(e=>!n.has(e));if(r.length===0)return{kind:`variant`,axis:t,byValue:n};if(e.sparse!==void 0&&r.length<t.values.length){for(let t of r)n.set(t,e.sparse);return{kind:`variant`,axis:t,byValue:n}}}}if(!(e.part===``||n))return{kind:`none`,reason:`resolved values differ across variants without correlating to any variant axis â nothing minted; bind manually`};let o=(t,n)=>{let r=new Map;for(let i of e.occurrences){let e=i.axisValues[t.propName],a=i.axisValues[n.propName];if(e===void 0||a===void 0)return null;let o=eu(e,a),s=r.get(o);if(s!==void 0&&s!==i.value)return null;r.set(o,i.value)}return r},s=(e,t,n)=>{let r=[];for(let i of e.values)for(let e of t.values)n.has(eu(i,e))||r.push(eu(i,e));return r};for(let t=0;t<a.length;
94t++)for(let n=t+1;n<a.length;n++){let[r,i]=[a[t],a[n]],c=o(r,i);if(c!==null){let t=s(r,i,c),n=r.values.length*i.values.length,a=e.occurrences.length<=n;if(t.length===0)return{kind:`variant2`,axes:[r,i],byValue:c,unwitnessed:a};if(e.sparse!==void 0&&c.size>0){for(let n of t)c.set(n,e.sparse);return{kind:`variant2`,axes:[r,i],byValue:c,unwitnessed:a}}}}if(r!==void 0)for(let n=0;n<a.length;n++)for(let i=n+1;i<a.length;i++){let[c,l]=[a[n],a[i]],u=o(c,l);if(u===null||u.size===0)continue;let d=s(c,l,u);if(d.length===0)continue;let f=new Set,p=!0;for(let e of r){let t=e[c.propName],n=e[l.propName];if(t===void 0||n===void 0){p=!1;break}f.add(eu(t,n))}if(!p||!d.every(e=>!f.has(e)))continue;let m=e=>t.map(t=>{let n=t.values.indexOf(e.axisValues[t.propName]??``);return String(n<0?t.values.length:n).padStart(4,`0`)}).join(`.`),h=[...e.occurrences].sort((e,t)=>m(e)<m(t)?-1:+(m(e)>m(t)))[0].value;for(let e of d)u.set(e,h);let g=c.values.length*l.values.length-d.length;return{kind:`variant2`,axes:[c,l],byValue:u,unwitnessed:e.occurrences.length<=g,undrawn:d}}if(e.part!==``)return{kind:`none`,reason:`resolved values differ across variants without correlating to any variant axis or axis PAIR â a nested part carries at most a pair (one map axis + one placeholder); nothing minted, bind manually`};for(let t=0;t<a.length;
94t++)for(let n=t+1;n<a.length;n++)for(let r=n+1;r<a.length;r++){let i=[a[t],a[n],a[r]],o=new Map,s=!0;for(let t of e.occurrences){let e=i.map(e=>t.axisValues[e.propName]);if(e.some(e=>e===void 0)){s=!1;break}let n=tu(e),r=o.get(n);if(r!==void 0&&r!==t.value){s=!1;break}o.set(n,t.value)}if(s){let t=[];for(let e of i[0].values)for(let n of i[1].values)for(let r of i[2].values)o.has(tu([e,n,r]))||t.push(tu([e,n,r]));if(t.length===0)return{kind:`variant3`,axes:i,byValue:o};if(e.sparse!==void 0&&o.size>0){for(let n of t)o.set(n,e.sparse);return{kind:`variant3`,axes:i,byValue:o}}}}return{kind:`none`,reason:`resolved values differ across variants without correlating to any variant axis (or axis pair/triple) â nothing minted; bind manually`}}function ru(e,t,n,r){let i=Jl(e),a=t.map(e=>nu(e,n,r?.nestedPairs===!0,r?.realizedCombos)),o=new Map;a.forEach((e,n)=>{if(e.kind!==`uniform`)return;let r=`${t[n].kind}|${Xl(t[n].kind,e.value)}`;o.set(r,(o.get(r)??0)+1)});let s=new Map,c=e=>[...s.keys()].some(t=>t.startsWith(`${e}.`)),l=(e,t,n,r,i)=>{let a=Xl(t,n);for(let o=1;;o++){let l=o===1?e:`${e}-${o}`,u=s.get(l);if(!u){if(c(l))continue;return s.set(l,{ref:`{${l}}`,value:a,usageSites:[r],type:Zl(t,n),...i?{textStyle:i}:{}}),l}if(u.value===a&&JSON.stringify(u.textStyle??null)===JSON.stringify(i??null))return u.usageSites.includes(r)||u.usageSites.push(r),l}},u=a.map((e,n)=>{let r=t[n];if(e.kind===`none`)return{nodePath:r.nodePath,cssProperty:r.cssProperty,ref:null,reason:e.reason};let a=r.styleName===void 0?`${ql}.${i}.${Yl(r.part)}.${r.cssProperty}`:`${ql}.text.${Jl(r.styleName)}.${r.cssProperty}`,u=`${r.nodePath} ${r.cssProperty}`;if(e.kind===`uniform`){let t=`${r.kind}|${Xl(r.kind,e.value)}`,n=r.styleName===void 0&&(o.get(t)??0)>=3?`${ql}.shared.${$l(r.kind,e.value)}`:a,i=l(n,r.kind,e.value,u,r.styleName?{name:r.styleName,...r.styleKey?{key:r.styleKey}:{}}:void 0);return{nodePath:r.nodePath,cssProperty:r.cssProperty,ref:`{${i}}`}}let d=e.kind===`variant`?[e.axis.propName]:e.axes.map(e=>e.propName),f=e=>e.split(`.`).map((e,t)=>`${d[t]}=${e}`).join(`, `);for(let t=1;;t++){let n=t===1?a:`${a}-${t}`;if(!(!s.has(n)&&[...e.byValue.entries()].every(([e,t])=>{let i=s.get(`${n}.${e}`);return i===void 0?!c(`${n}.${e}`):i.value===Xl(r.kind,t)})))continue;let i=new Set(e.kind===`variant2`?e.undrawn??[]:[]),o=e=>{let t=e.split(`.`),n=r.occurrences.find(e=>d.every((n,r)=>e.axisValues[n]===t[r]));if(n?.styleName!==void 0)return{name:n.styleName,...n.styleKey?{key:n.styleKey}:{}};if(r.styleName!==void 0)return{name:r.styleName,...r.styleKey?{key:r.styleKey}:{}}};for(let[t,a]of e.byValue)l(`${n}.${t}`,r.kind,a,i.has(t)?`${u} (${f(t)} â NOT DRAWN in the variant set; base value supplied so the pair can carry)`:`${u} (${f(t)})`,o(t));let p=e.kind===`variant2`?e.axes[0].values.length*e.axes[1].values.length:0,m=[],h=e.kind===`variant2`?e.undrawn?.length??0:0;if(e.kind===`variant2`&&e.undrawn!==void 0&&h>0){let t=p-h,n=e.byValue.get(e.undrawn[0]);m.push(`the pair "${d[0]}" x "${d[1]}" is RAGGED â the variant set draws ${t} of its ${p} cell(s), and each of those ${t} is a measured observation. The ${h} cell(s) the set never draws (${e.undrawn.map(e=>f(e)).join(`; `)}) carry ${Xl(r.kind,n)} â the value of the lowest DECLARED axis combination that is drawn â so the substituted ref resolves at every combination the prop types allow. Those cells are SUPPLIED, not measured. NOTHING IN THE DESIGN DRAWS THEM, but the generated component still RENDERS them if it is called with that prop combination (the emitted prop types permit every combination; the Figma variant set does not have every combination). Give them a reviewed value or constrain the props â the drawn cells are the contract.`)}if(e.kind===`variant2`&&e.unwitnessed){let t=e.undrawn===void 0||h===0?[...e.byValue.values()]:[...e.byValue.entries()].filter(([t])=>!e.undrawn.includes(t)).map(([,e])=>e),n=p-h;m.push(`${h>0?`every DRAWN cell here is measured`:`every value carried here is measured`}, but the pair "${d[0]}" x "${d[1]}" is SATURATED (${r.occurrences.length} observation(s) over ${n} drawn cell(s) â at most one per cell, so ANY values would fit): the per-cell values reproduce the drawing exactly, but the CORRELATION is unwitnessed and may be drift rather than
94intent â review before treating it as a rule. Values are ${new Set(t.map(e=>Xl(r.kind,e))).size} distinct over ${n} drawn cell(s)${new Set(t).size<n?` â the repetition across cells is structure, which an arbitrary assignment would not show`:` â one distinct value per cell, which is what uncorrelated drift looks like`}`)}return{nodePath:r.nodePath,cssProperty:r.cssProperty,ref:`{${n}.${d.map(e=>`{${e}}`).join(`.`)}}`,...m.length>0?{caveat:m.join(` ALSO: `)}:{}}}}),d={};for(let[e,t]of s){let n=e.split(`.`),r=d;for(let e of n.slice(0,-1))r=r[e]??={};r[n[n.length-1]]={$value:t.value,...t.type===void 0?{}:{$type:t.type},...t.textStyle?{$extensions:{dsContracts:{textStyle:t.textStyle}}}:{}}}return{tree:d,count:s.size,entries:[...s.values()].map(({ref:e,value:t,usageSites:n,textStyle:r})=>({ref:e,value:t,usageSites:n,...r?{textStyle:r}:{}})),bindings:u}}function iu(e){let t=e=>e.split(`.`).join(`-`),n=[`:root {`];for(let[r,i]of zl(e)){let e=W(i.value);n.push(` --${t(r)}: ${e?`var(--${t(e)})`:String(i.value)};`)}return n.push(`}`),n.join(` 95`)}var au=e=>typeof e==`object`&&!!e&&`variants`in e;function ou(e){let t=e.split(`/`).join(`.`);return t.includes(`â¤`)?{path:t.split(`â¤`).join(`-`),folded:!0}:{path:t,folded:!1}}function su(e){let t={};for(let n of e){let e=n.path.split(`.`),r=t;for(let t of e.slice(0,-1))r=r[t]??={};r[e[e.length-1]]={$value:n.value,$type:n.type}}return t}function cu(e){let t=e._variables;if(!t||typeof t!=`object`||Array.isArray(t)||Object.keys(t).length===0)return null;let n=new Set,r=e=>{e.bound?.opacity&&n.add(e.bound.opacity);for(let t of e.children??[])r(t)};for(let t of Object.values(e))if(au(t))for(let e of t.variants)r(e);let i=new Set(Object.keys(t).map(e=>ou(e)).filter(e=>!e.folded).map(e=>e.path)),a=[],o=[],s=new Set;for(let[e,r]of Object.entries(t)){if(!r||typeof r!=`object`)continue;let{path:t,folded:c}=ou(e);if(c&&(i.has(t)||s.has(t))){o.push({name:e,reason:`U+2024 fold target "${t}" collides with another captured variable â not registrable; rename the variable or map it manually`});continue}if(c&&s.add(t),!/^[a-z0-9.-]+$/i.test(t)){o.push({name:e,reason:`name contains characters outside the token-ref grammar ([a-z0-9.-]) â not registrable; rename the variable or map it manually`});continue}let l=t=>{if(!r.modes||typeof r.modes!=`object`)return;let n={};for(let[i,a]of Object.entries(r.modes)){let s=t(a);if(s===null){o.push({name:e,reason:`mode "${i}" value ${JSON.stringify(a)} does not spell as resolved type ${String(r.type)} â mode value not registered`});continue}n[i]=s}return Object.keys(n).length>0?n:void 0};if(r.type===`COLOR`&&typeof r.value==`string`){let n=l(e=>typeof e==`string`?e:null);a.push({path:t,name:e,value:r.value,type:`color`,...n?{modes:n}:{}})}else if(r.type===`FLOAT`&&typeof r.value==`number`){let i=n.has(e),o=l(e=>typeof e==`number`?i?String(e):`${e}px`:null);a.push(i?{path:t,name:e,value:String(r.value),type:`number`,...o?{modes:o}:{}}:{path:t,name:e,value:`${r.value}px`,type:`dimension`,...o?{modes:o}:{}})}else o.push({name:e,reason:`resolved type ${String(r.type)} has no CSS custom-property projection â not registered`})}let c=new Set(a.map(e=>e.path)),l=a.filter(e=>{let t=[...c].some(t=>t!==e.path&&t.startsWith(`${e.path}.`));return t&&o.push({name:e.name,reason:`the name is a group prefix of another captured variable â a leaf cannot sit on a group path; not registered`}),!t}),u=[...new Set(l.flatMap(e=>Object.keys(e.modes??{})))],d={};for(let e of u){let t=l.filter(t=>t.modes?.[e]!==void 0).map(t=>({...t,value:t.modes[e]}));d[e]={tree:su(t),count:t.length}}return{tree:su(l),count:l.length,entries:l,...u.length>0?{modes:d}:{},skipped:o}}function lu(e){let t=``,n=0;for(;n<e.length;){let r=e.slice(n).match(/@(media|supports|container)[^{;]*\{/);if(!r||r.index===void 0){t+=e.slice(n);break}t+=e.slice(n,n+r.index),n+=r.index+r[0].length;let i=1;for(;n<e.length&&i>0;)e[n]===`{`?i++:e[n]===`}`&&i--,n++}return t}function uu(e){let t=new Map;for(let n of e){let e=lu(n.replace(/\/\*[\s\S]*?\*\//g,``)),r=/(^|[}{;\s])(:root|html|body)(\s*,\s*(?::root|html|body))*\s*\{/g;for(;r.exec(e)!==null;){let n=1,i=r.lastIndex,a=``;for(;i<e.length&&n>0;i++){let r=e[i];if(r===`{`)n++,a=``;else if(r===`}`)n--,a=``;else if(r===`;`){let e=a.indexOf(`:`);
95if(e!==-1){let n=a.slice(0,e).trim(),r=a.slice(e+1).trim().replace(/\s+/g,` `);n.startsWith(`--`)&&r.length>0&&t.set(n.slice(2),r)}a=``}else a+=r}let o=a.indexOf(`:`);if(o!==-1){let e=a.slice(0,o).trim(),n=a.slice(o+1).trim().replace(/\s+/g,` `);e.startsWith(`--`)&&n.length>0&&t.set(e.slice(2),n)}r.lastIndex=i}}return t}function du(e){let t=e.match(/^var\(\s*--([A-Za-z0-9_-]+)\s*(?:,([\s\S]*))?\)$/);if(!t)return null;if(t[2]===void 0)return{name:t[1]};let n=t[2].trim(),r=0;for(let e of n)if(e===`(`)r++;else if(e===`)`&&--r<0)return null;return r===0?{name:t[1],fallback:n}:null}function fu(e,t,n=0){if(n>8)return{ok:!1,reason:`custom-property chain deeper than 8 hops â not followed`};let r=du(e.trim());if(!r)return{ok:!0,value:e.trim()};let i=t.get(r.name);return i===void 0?r.fallback===void 0?{ok:!1,reason:`no :root declaration for --${r.name} in the fetched CSS set and no fallback`}:fu(r.fallback,t,n+1):fu(i,t,n+1)}var pu=/^(rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color)\(/i,mu=/^#[0-9a-fA-F]{3,8}$/,hu=/^-?\d*\.?\d+(px|rem|em|%|vw|vh|ch|ex|pt)$/,gu=/^-?\d*\.?\d+$/;function _u(e){let t=e.trim();return mu.test(t)||pu.test(t)||/^(transparent|currentcolor)$/i.test(t)?{kind:`color`,formatted:t.toLowerCase()}:hu.test(t)?{kind:`dimension`,formatted:t}:gu.test(t)?{kind:`number`,formatted:t}:null}var vu=(e,t)=>e===`number`?t===`font-weight`?`fontWeight`:`number`:e,yu=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9-]+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``);return t.length>0?t:`part`};function bu(e,t){if(e===`color`)return`color-${yu(t.replace(/^#/,``))}`;if(e===`dimension`){let e=t.match(/^(-?\d*\.?\d+)px$/);return`size-${yu((e?e[1]:t).replace(/^-/,`neg-`))}`}return`num-${yu(t.replace(/^-/,`neg-`))}`}function xu(e,t,n,r){let i=yu(e),a=[],o=new Map(n.map(e=>[e.propName,e])),s=new Map,c=[];for(let e of t){let t=fu(e.raw,r);if(!t.ok){a.push({selector:e.selector,part:e.part,cssProperty:e.cssProperty,...e.state?{state:e.state}:{},...e.axis?{axis:e.axis}:{},expression:e.raw.trim(),reason:t.reason});continue}let n=_u(t.value),i=[e.part,e.state??``,e.cssProperty].join(` `);s.has(i)||(s.set(i,{part:e.part,cssProperty:e.cssProperty,...e.state?{state:e.state}:{},byAxis:new Map,selector:e.selector}),c.push(i));let o=s.get(i);if(!n){o.unmintable=`\`${e.selector} { ${e.cssProperty}: ${e.raw} }\` resolves to "${t.value}" â not a color, dimension, or number; not mintable`;continue}let l={finding:e,kind:n.kind,formatted:n.formatted};if(e.axis){let t=o.byAxis.get(e.axis.prop)??new Map;t.set(e.axis.value,l),o.byAxis.set(e.axis.prop,t)}else o.base=l}let l=c.map(e=>{let t=s.get(e);if(t.unmintable)return{kind:`none`,group:t,reason:t.unmintable};let n=[...t.byAxis.keys()];if(n.length===0)return t.base?{kind:`uniform`,group:t,occ:t.base}:{kind:`none`,group:t,reason:`no resolvable occurrence â nothing minted`};if(n.length>1)return{kind:`none`,group:t,reason:`values conditioned on more than one enum axis (${n.join(`, `)}) â a single substituted ref cannot express that; nothing minted`};let r=o.get(n[0]);if(!r)return{kind:`none`,group:t,reason:`modifier classes reference "${n[0]}" which is not a declared enum axis â nothing minted`};let i=new Map(t.byAxis.get(r.propName));for(let e of r.values)!i.has(e)&&t.base&&i.set(e,t.base);let a=r.values.filter(e=>!i.has(e));if(a.length>0)return{kind:`none`,group:t,reason:`"${r.propName}" classes cover ${r.values.length-a.length}/${r.values.length} values (missing ${a.join(`, `)}) and no base rule fills the gap â nothing minted`};let c=[...i.values()];return c.every(e=>e.formatted===c[0].formatted&&e.kind===c[0].kind)?{kind:`uniform`,group:t,occ:c[0]}:{kind:`variant`,group:t,axis:r,byValue:i}}),u=new Map;for(let e of l){if(e.kind!==`uniform`)continue;let t=`${e.occ.kind}|${e.occ.formatted}`;u.set(t,(u.get(t)??0)+1)}let d=new Map,f=e=>[...d.keys()].some(t=>t.startsWith(`${e}.`)),p=(e,t,n)=>{for(let r=1;;r++){let i=r===1?e:`${e}-${r}`,a=d.get(i);if(!a){if(f(i))continue;return d.set(i,{ref:`{${i}}`,value:t.formatted,usageSites:[n],type:vu(t.kind,t.finding.cssProperty)}),i}if(a.value===t.formatted)return a.usageSites.includes(n)||a.usageSites.push(n),i}},m=e=>`${e.part}${e.state?` :${e.state}`:``} ${e.cssProperty}`,h=l.map(e=>{let{group:t}=e,n={part:t.part,cssProperty:t.cssProperty,...t.state?{state:t.state}:{}};if(e.kind===`none`)return{...n,ref:null,reason:e.reason};let r=[ql,i,yu(t.part),...t.state?[yu(t.state)]:[],t.cssProperty].join(`.`),a=m(t);if(e.kind===`uniform`){let t=`${e.occ.kind}|${e.occ.formatted}`,i=(u.get(t)??0)>=3?`${ql}
95.shared.${bu(e.occ.kind,e.occ.formatted)}`:r,o=p(i,e.occ,a);return{...n,ref:`{${o}}`}}for(let t=1;;t++){let i=t===1?r:`${r}-${t}`;if(!d.has(i)&&[...e.byValue.entries()].every(([e,t])=>{let n=d.get(`${i}.${e}`);return n===void 0?!f(`${i}.${e}`):n.value===t.formatted})){for(let[t,n]of e.byValue)p(`${i}.${t}`,n,`${a} (${e.axis.propName}=${t})`);return{...n,ref:`{${i}.{${e.axis.propName}}}`}}}}),g={};for(let[e,t]of d){let n=e.split(`.`),r=g;for(let e of n.slice(0,-1))r=r[e]??={};r[n[n.length-1]]={$value:t.value,$type:t.type}}return{tree:g,count:d.size,entries:[...d.values()].map(({ref:e,value:t,usageSites:n})=>({ref:e,value:t,usageSites:n})),bindings:h,carriedVerbatim:a}}var Su={checkbox:{hosts:[`input`],native:`<input type="checkbox">`},radio:{hosts:[`input`],native:`<input type="radio">`},switch:{hosts:[`input`],native:`<input type="checkbox"> (role="switch" on it is the modern switch pattern)`},button:{hosts:[`button`],native:`<button>`},link:{hosts:[`a`],native:`<a href>`},textbox:{hosts:[`input`,`textarea`],native:`<input> / <textarea>`},slider:{hosts:[`input`],native:`<input type="range">`},progressbar:{hosts:[`progress`],native:`<progress>`},spinbutton:{hosts:[`input`],native:`<input type="number">`}},Cu=e=>e.slice(1,-1),J=e=>`var(--${e.split(`.`).join(`-`)})`;function wu(e){return[...e.matchAll(/\{([a-z][\w-]*)\}/g)].map(e=>e[1])}function Tu(e,t){let n=[[]];for(let r of e){let e=[];for(let i of n)for(let n of t.get(r)??[])e.push([...i,[r,n]]);n=e}return n}var Eu={hover:`:hover:not(:disabled)`,active:`:active:not(:disabled)`,"focus-visible":`:focus-visible`,disabled:`:disabled`},Du=new Set([`color`,`background-color`,`border-color`]),Ou=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`p`,`blockquote`,`figure`,`hr`,`ul`,`ol`,`dl`,`dd`,`pre`,`fieldset`]),ku=new Set([`button`]),Au=[`background`,`background-color`,`background-image`];function ju(e){let t=e.semantics.elementByProp;return[e.semantics.element,...t?Object.values(t.map):[]]}var Mu=e=>Object.entries(e.anatomy),Nu=e=>new Set(Mu(e).map(([e])=>e)),Pu=e=>Mu(e).length>1,Fu={top:[`bottom: 100%`,`left: 0`],bottom:[`top: 100%`,`left: 0`],start:[`right: 100%`,`top: 0`],end:[`left: 100%`,`top: 0`]},Iu={start:`flex-start`,center:`center`,end:`flex-end`,stretch:`stretch`,baseline:`baseline`},Lu={start:`flex-start`,center:`center`,end:`flex-end`,"space-between":`space-between`},Ru=e=>typeof e.type==`object`&&`enum`in e.type,zu=e=>e.type===`boolean`&&e.bindings.figma.kind===`VARIANT`,Bu=e=>typeof e.type==`object`&&`arrayOf`in e.type;function Vu(e){return e.props.filter(Ru)}function Hu(e){return e.props.filter(e=>e.type===`boolean`)}function Uu(e){return e.props.filter(e=>e.type===`number`)}function Wu(e){return e.props.filter(Bu)}function Gu(e){return e.props.filter(e=>e.type===`text`)}function Ku(e){return Gu(e).filter(e=>e.bindings.code.prop!==`children`)}function Y(e){return Dl(e).filter(e=>e.slot.name!==`children`)}function qu(e){let t=Gu(e).find(e=>e.bindings.code.prop===`children`);return typeof t?.default==`string`?t.default:e.name}var Ju=e=>!!(e.parts||e.slot||e.layout||e.layoutByProp)&&!e.content&&!e.component;function Yu(e){let t=[];return e.display&&t.push(`display: ${e.display}`),e.direction&&t.push(`flex-direction: ${e.direction}`),e.align&&t.push(`align-items: ${Iu[e.align]}`),e.justify&&t.push(`justify-content: ${Lu[e.justify]}`),t}var Xu=e=>`px`in e?`${e.px}px`:`fr`in e?`${e.fr}fr`:`fit-content(100%)`,Zu={start:`start`,center:`center`,end:`end`};function Qu(e,t,n){let r=Array.from({length:e},()=>Array.from({length:t},()=>`.`));for(let[e,t]of Object.entries(n))for(let n=t.row;n<t.row+(t.rowSpan??1);n++)for(let i=t.column;i<t.column+(t.columnSpan??1);i++)r[n][i]=e;return r.map(e=>`"${e.join(` `)}"`).join(` `)}function $u(e,t,n){if(typeof e==`number`)return`${e}px`;let r=Cu(e);if(wu(r).length>0)throw Error(`Refused â grid-gap-substituted-ref: ${n} carries a substituted gap ref "${e}" â a per-variant grid gap has no single static CSS spelling; bind a plain token ref (the canvas surface resolves substitution per compiled variant)`);return t(r)}function ed(e,t,n){let r=[`display: grid`];return e.rows&&r.push(`grid-template-rows: ${e.rows.map(Xu).join(` `)}`),r.push(`grid-template-columns: ${(e.columns??[]).map(Xu).join(` `)}`),e.areas&&e.rows&&r.push(`grid-template-areas: ${Qu(e.rows.length,(e.columns??[]).length,e.areas)}`),e.flow===`row`&&r.push(`grid-auto-flow: row`),e.gap&&(r.push(`row-gap: ${$u(e.gap.row,t,n)}`),r.push(`column-gap: ${$u(e.gap.column,t,n)}`)),r}function td(e){let t=[`grid-row: ${e.row+1}${e.rowSpan&&e.rowSpan>1?` / span ${e.rowSpan}`:``}`,`grid-column: ${e.column+1}${e.columnSpan&&e.columnSpan>1?` / span ${e.columnSpan}`:``}`];return e.alignX&&e.alignX!==`auto`&&t.push(`justify-self: ${Zu[e.alignX]}`),e.alignY&&e.alignY!==`auto`&&t.push(`align-self: ${Zu[e.alignY]}`),t}var nd=e=>e.layout?.align||e.layout?.display===`grid`?[]:[`align-items: flex-start`];function rd(e){let t=new Map,n=new Map,r=new Set,i=new Set;for(let{part:t}of U(e))if(t.layout?.display===`grid`)for(let[e,n]of Object.entries(t.parts??{}))n.overlay||i.add(e);for(let{name:i,part:a}of U(e)){let e=a.layout;if(e?.display!==`grid`||e.flow===`row`)continue;let o=e.areas??{},s=Object.entries(a.parts??{});for(let[e,n]of s){if(n.overlay)continue;let i=o[e]?[`grid-area: ${e}`]:n.placement?td(n.placement):null;i&&(t.set(e,i),n.component&&r.add(e))}let c=new Set(s.map(([e])=>e)),l=Object.keys(o).filter(e=>!c.has(e));l.length>0&&n.set(i,l)}return{cells:t,placeholders:n,wrappedInstances:r,gridChildren:i}}function id(e,t,n){let r=new Set,i=(e,t)=>{let a=t.indexOf(e);if(a>=0)return[...t.slice(a),e];if(r.has(e))return null;let o=n.get(e);if(!o)return null;let s=[...t,e];
95for(let e of U(o)){let t=[...e.part.component?[e.part.component.id]:[],...(e.part.slot?.defaultContent??[]).map(e=>e.id)];for(let e of t){let t=i(e,s);if(t)return t}}return r.add(e),null};return i(t,[e])}function ad(e,t,n,r){let i=new Set(Vu(e).map(e=>e.name)),a=e=>e.props.some(e=>e.type===`text`&&e.bindings.code.prop===`children`),o=new Set;for(let{name:s,path:c,part:l}of U(e)){if(o.has(s)&&n.push(`${e.id}: duplicate anatomy part name "${s}"`),o.add(s),l.component){let r=t.get(l.component.id);r||n.push(`${e.id}: part "${s}" references component "${l.component.id}" which has no contract in scope`);let o=id(e.id,l.component.id,t);o&&n.push(`${e.id}: part "${s}" component ref creates a cycle (${o.join(` â `)}) â a contract cannot compose itself`);for(let[t,a]of Object.entries(l.component.props??{})){r&&!r.props.some(e=>e.name===t)&&n.push(`${e.id}: part "${s}" sets unknown ${r.id} prop "${t}"`);let o=r?.props.find(e=>e.name===t);o&&Bu(o)&&n.push(`${e.id}: part "${s}" sets ${r.id} arrayOf prop "${t}" â structured values cannot be fixed in anatomy`);let c=typeof a==`string`?a.match(/^\{([a-z][\w-]*)\}$/):null;c&&!i.has(c[1])&&n.push(`${e.id}: part "${s}" maps "{${c[1]}}" but no enum prop "${c[1]}" exists on this contract`)}l.component.text!==void 0&&r&&!a(r)&&n.push(`${e.id}: part "${s}" sets text but ${r.id} has no children text prop`);for(let t of Object.keys(l.component.overrides??{})){if(!Xc[t]){n.push(`${e.id}: part "${s}" component override channel "${t}" is not registered (REF_OVERRIDE_CHANNELS: ${Object.keys(Xc).join(`, `)})`);continue}r&&!(r.anatomy.root?.overridable??[]).includes(t)&&n.push(`${e.id}: part "${s}" overrides "${t}" but ${r.id} does not declare it overridable â the child's CSS would never consume the custom property (silent no-op refused)`)}}if(l.overridable){c.length===1&&c[0]===`root`||n.push(`${e.id}: part "${s}" declares overridable â only the root part consumes per-instance overrides`);for(let t of l.overridable){let r=Xc[t];if(!r){n.push(`${e.id}: part "${s}" overridable channel "${t}" is not registered (REF_OVERRIDE_CHANNELS: ${Object.keys(Xc).join(`, `)})`);continue}for(let i of r.css)l.tokens?.[i]||n.push(`${e.id}: part "${s}" declares "${t}" overridable but binds no "${i}" token â nothing to consume the override through`)}}for(let r of l.slot?.defaultContent??[]){let i=t.get(r.id);i||n.push(`${e.id}: slot "${l.slot.name}" defaultContent references "${r.id}" which has no contract in scope`);let o=id(e.id,r.id,t);o&&n.push(`${e.id}: slot "${l.slot.name}" defaultContent "${r.id}" creates a cycle (${o.join(` â `)}) â a contract cannot compose itself`),r.text!==void 0&&i&&!a(i)&&n.push(`${e.id}: slot "${l.slot.name}" defaultContent sets text but ${i.id} has no children text prop`)}if(l.slot){let t=l.slot,r=(t.defaultContent??[]).length;if(t.min!==void 0&&t.max!==void 0&&t.min>t.max&&n.push(`${e.id}: slot "${t.name}" declares min ${t.min} > max ${t.max} â no content can satisfy it`),t.required===!0&&t.min!==void 0&&t.min<1&&n.push(`${e.id}: slot "${t.name}" is required but declares min ${t.min} â a required slot cannot accept emptiness`),t.max!==void 0&&r>t.max&&n.push(`${e.id}: slot "${t.name}" declares max ${t.max} but its defaultContent ships ${r} item(s)`),t.min!==void 0&&r>0&&r<t.min&&n.push(`${e.id}: slot "${t.name}" declares min ${t.min} but its defaultContent ships only ${r} item(s)`),t.acceptsMode===`restrict`){(!t.accepts||t.accepts.length===0)&&n.push(`${e.id}: slot "${t.name}" is acceptsMode "restrict" but lists no accepts â restricting to nothing admits nothing`);for(let r of t.defaultContent??[])t.accepts&&!t.accepts.includes(r.id)&&n.push(`${e.id}: slot "${t.name}" is acceptsMode "restrict" but its defaultContent ships "${r.id}", which is not in accepts [${(t.accepts??[]).join(`, `)}] â the contract violates its own restriction`)}}if(c.length>1)for(let t of Object.values(l.tokens??{}))for(let r of wu(Cu(t)))Vu(e).some(e=>e.name===r)||n.push(`${e.id}: part "${s}" token "${t}" substitutes unknown enum prop "${r}"`);if(l.content&&(e.props.find(e=>e.type===`text`&&e.bindings.code.prop===l.content.prop)||n.push(`${e.id}: part "${s}" binds content to unknown text prop "${l.content.prop}"`)),l.layoutByProp){let t=l.layoutByProp,r=e.props.find(e=>e.name===t.prop);if(!r)n.push(`${e.id}: part "${s}" layoutByProp references unknown prop "${t.prop}"`);else if(!Ru(r))n.push(`${e.id}: part "${s}" layoutByProp prop "${t.prop}" must be an enum prop`);else for(let i of Object.keys(t.map))r.type.enum.includes(i)||n.push(`${e.id}: part "${s}" layoutByProp map key "${i}" is not a value of prop "${t.prop}"`);l.component&&n.push(`${e.id}: part "${s}" is a component instance â layoutByProp cannot restyle it (the child contract owns its layout)`)}let u=Cl(l);for(let t of u){let r=e.props.find(e=>e.name===t.prop);if(!r)n.push(`${e.id}: part "${s}" tokensByProp references unknown prop "${t.prop}"`);else if(!Ru(r))n.push(`${e.id}: part "${s}" tokensByProp prop "${t.prop}" must be an enum prop`);else for(let[i,a]of Object.entries(t.map)){r.type.enum.includes(i)||n.push(`${e.id}: part "${s}" tokensByProp map key "${i}" is not a value of prop "${t.prop}"`);for(let r of Object.values(a)){let i=wu(Cu(r));i.length>1?n.push(`${e.id}: part "${s}" tokensByProp ref "${r}" carries ${i.length}
95 placeholders â per-value maps hold at most one`):i.length===1&&i[0]===t.prop?n.push(`${e.id}: part "${s}" tokensByProp ref "${r}" substitutes the entry's own prop "${t.prop}" â the per-value map IS that substitution`):i.length===1&&!Vu(e).some(e=>e.name===i[0])&&n.push(`${e.id}: part "${s}" tokensByProp ref "${r}" substitutes unknown enum prop "${i[0]}"`)}}l.component&&n.push(`${e.id}: part "${s}" is a component instance â tokensByProp cannot restyle it (the child contract owns its styling)`)}{let t=new Map,r=(r,i,a)=>{let o=`${r}|${i}`,c=t.get(o);c?n.push(`${e.id}: part "${s}" carries channel "${i}" for prop "${r}" in two entries (${c} and ${a}) â a conflicting channel+prop pair is refused by name`):t.set(o,a)};u.forEach((e,t)=>{let n=new Set(Object.values(e.map).flatMap(e=>Object.keys(e)));for(let i of n)r(e.prop,i,`tokensByProp[${t}]`)}),(l.literalsByProp??[]).forEach((e,t)=>{let n=new Set(Object.values(e.map).flatMap(e=>Object.keys(e)));for(let i of n)r(e.prop,i,`literalsByProp[${t}]`)})}let d=(t,r)=>{Yc[t]||n.push(`${e.id}: part "${s}" ${r} sets "${t}" which is not a token channel (TOKEN_CHANNELS registry â no emitter renders it; register the channel with its canvas verdict and its CSS spelling, or move the fact to declared/literals)`)};for(let e of Object.keys(l.tokens??{}))d(e,`tokens`);if(Cl(l).forEach((e,t)=>{for(let n of Object.values(e.map??{}))for(let e of Object.keys(n))d(e,`tokensByProp[${t}]`)}),c.length===1)for(let[e,t]of Object.entries(l.states??{}))for(let n of Object.keys(t??{}))d(n,`states.${e}`);for(let[t]of Object.entries(l.literals??{}))Hc.has(t)||n.push(`${e.id}: part "${s}" literals sets "${t}" which is not a literal channel (${[...Hc].join(`, `)})`),l.tokens&&t in l.tokens&&n.push(`${e.id}: part "${s}" carries channel "${t}" as BOTH a token binding and a literal â ambiguous, refused by name`);for(let t of l.literalsByProp??[]){let r=e.props.find(e=>e.name===t.prop);if(!r)n.push(`${e.id}: part "${s}" literalsByProp references unknown prop "${t.prop}"`);else if(!Ru(r)&&!zu(r))n.push(`${e.id}: part "${s}" literalsByProp prop "${t.prop}" must be an enum prop or VARIANT-bound boolean`);else{let i=Ru(r)?r.type.enum:[`true`,`false`];for(let[r,a]of Object.entries(t.map)){i.includes(r)||n.push(`${e.id}: part "${s}" literalsByProp map key "${r}" is not a value of prop "${t.prop}"`);for(let t of Object.keys(a))Hc.has(t)||n.push(`${e.id}: part "${s}" literalsByProp sets "${t}" which is not a literal channel (${[...Hc].join(`, `)})`)}}l.component&&n.push(`${e.id}: part "${s}" is a component instance â literalsByProp cannot restyle it (the child contract owns its styling)`)}l.literals&&l.component&&n.push(`${e.id}: part "${s}" is a component instance â literals cannot restyle it (the child contract owns its styling)`);let f=(t,r,i)=>{let a=qc[t];if(!a){n.push(`${e.id}: part "${s}" ${i} sets "${t}" which is not a declared channel (DECLARED_CHANNELS registry â token/literal vocabulary channels belong in tokens/literals)`);return}a.value.test(r)||n.push(`${e.id}: part "${s}" ${i} "${t}" value ${JSON.stringify(r)} is outside the channel's bounded grammar (${a.value})`)};(l.declared||l.declaredStates)&&(l.component||l.slot)&&n.push(`${e.id}: part "${s}" is a ${l.component?`component instance`:`slot`} â declared facts cannot restyle it (the child contract / consumer owns its styling)`),l.hugsBelowMaxWidth!==void 0&&!(l.tokens&&`max-width`in l.tokens)&&!(l.declared&&`max-width`in l.declared)&&!(l.literals&&`max-width`in l.literals)&&n.push(`${e.id}: part "${s}" carries hugsBelowMaxWidth but no "max-width" channel â the flag qualifies that channel and qualifies nothing here`);for(let[t,r]of Object.entries(l.declared??{}))f(t,r,`declared`),l.tokens&&t in l.tokens&&n.push(`${e.id}: part "${s}" carries channel "${t}" as BOTH a token binding and a declared fact â ambiguous, refused by name`),l.literals&&t in l.literals&&n.push(`${e.id}: part "${s}" carries channel "${t}" as BOTH a literal and a declared fact â ambiguous, refused by name`);for(let[t,r]of Object.entries(l.declaredStates??{})){if(!(t in Eu)){n.push(`${e.id}: part "${s}" declaredStates declares unknown state "${t}" â must be one of ${Object.keys(Eu).join(`, `)}`);continue}e.states.includes(t)||n.push(`${e.id}: part "${s}" declaredStates declares "${t}" but the contract's \`states\` does not â declare it or drop the override`);for(let[e,n]of Object.entries(r))f(e,n,`declaredStates.${t}`)}if(l.states&&c.length>1){l.component&&n.push(`${e.id}: part "${s}" is a component instance â states cannot restyle it (the child contract owns its styling)`),l.slot&&n.push(`${e.id}: part "${s}" is a slot â states cannot restyle its content (the consumer owns it)`);for(let[t,r]of Object.entries(l.states)){if(!(t in Eu)){n.push(`${e.id}: part "${s}" states declares unknown state "${t}" â must be one of ${Object.keys(Eu).join(`, `)}`);continue}e.states.includes(t)||n.push(`${e.id}: part "${s}" states declares "${t}" but the contract's \`states\` does not â declare it or drop the override`);for(let i of Object.keys(r))Du.has(i)||n.push(`${e.id}: part "${s}" states.${t} sets "${i}" which is not a part-state channel (${[...Du].join(`, `)}
95 â color-kind only, v13)`)}}for(let t of l.statesByProp??[]){let r=`statesByProp[${t.prop}/${t.state}]`;if(l.component&&n.push(`${e.id}: part "${s}" is a component instance â ${r} cannot restyle it (the child contract owns its styling)`),l.slot&&n.push(`${e.id}: part "${s}" is a slot â ${r} cannot restyle its content (the consumer owns it)`),!(t.state in Eu)){n.push(`${e.id}: part "${s}" ${r} declares unknown state "${t.state}" â must be one of ${Object.keys(Eu).join(`, `)}`);continue}e.states.includes(t.state)||n.push(`${e.id}: part "${s}" ${r} declares "${t.state}" but the contract's \`states\` does not â declare it or drop the override`);let i=e.props?.find(e=>e.name===t.prop)?.type?.enum;if(!i)n.push(`${e.id}: part "${s}" ${r} keys on "${t.prop}" which is not a declared enum prop`);else for(let a of Object.keys(t.map))i.includes(a)||n.push(`${e.id}: part "${s}" ${r} maps "${a}" which is not one of "${t.prop}"'s values (${i.join(`, `)})`);for(let i of Object.values(t.map))for(let a of Object.keys(i))c.length>1&&!Du.has(a)&&n.push(`${e.id}: part "${s}" ${r} sets "${a}" which is not a part-state channel (${[...Du].join(`, `)}
95 â color-kind only, v13)`),c.length===1&&d(a,r),l.states?.[t.state]?.[a]!==void 0&&n.push(`${e.id}: part "${s}" binds "${a}" for state "${t.state}" in BOTH states and ${r} â ambiguous; keep the per-value map or the single ref, not both`)}l.overlay&&(c.length===1&&n.push(`${e.id}: the root part cannot be an overlay â overlays attach to the root`),l.layout?.grow&&n.push(`${e.id}: part "${s}" is an overlay â it cannot also grow (grow is in-flow sizing)`),l.layout?.overlap&&n.push(`${e.id}: part "${s}" is an overlay â it cannot also overlap children (in-flow semantics)`)),l.stylesWhen&&l.component&&n.push(`${e.id}: part "${s}" is a component instance â stylesWhen cannot restyle it (the child contract owns its styling)`);for(let t of l.stylesWhen??[]){let r=e.props.find(e=>e.name===t.prop);r?Ru(r)?t.equals===void 0?n.push(`${e.id}: part "${s}" stylesWhen on enum prop "${t.prop}" requires "equals"`):r.type.enum.includes(t.equals)||n.push(`${e.id}: part "${s}" stylesWhen.equals "${t.equals}" is not a value of prop "${t.prop}"`):r.type===`boolean`?t.equals!==void 0&&n.push(`${e.id}: part "${s}" stylesWhen on boolean prop "${t.prop}" must omit "equals"`):n.push(`${e.id}: part "${s}" stylesWhen prop "${t.prop}" must be a boolean or enum prop`):n.push(`${e.id}: part "${s}" stylesWhen references unknown prop "${t.prop}"`);for(let[r,i]of Object.entries(t.styles))$c.has(r)||n.push(`${e.id}: part "${s}" stylesWhen sets "${r}" which is not in the literal whitelist (${[...$c].join(`, `)})`),i.includes(`{`)&&n.push(`${e.id}: part "${s}" stylesWhen "${r}" value ${JSON.stringify(i)} looks like a token reference â stylesWhen is literal CSS; token-driven styling belongs in "tokens"`)}if(l.shape){for(let[t,r]of Object.entries({parts:l.parts,slot:l.slot,component:l.component,content:l.content,text:l.text,icon:l.icon,meter:l.meter}))r!==void 0&&n.push(`${e.id}: part "${s}" is a shape (leaf decor) â it cannot also carry "${t}"`);l.shape.sides!==void 0&&l.shape.kind!==`polygon`&&n.push(`${e.id}: part "${s}" shape kind "${l.shape.kind}" cannot declare sides â side count is polygon vocabulary`),l.shape.arc!==void 0&&l.shape.kind!==`ellipse`&&n.push(`${e.id}: part "${s}" shape kind "${l.shape.kind}" cannot declare arc â sweep is ellipse vocabulary`)}if(l.repeat){l.component||n.push(`${e.id}: part "${s}" declares repeat but no component â the item template is a component ref (v12; text/frame templates have no vocabulary)`);for(let[t,r]of Object.entries({slot:l.slot,content:l.content,text:l.text,meter:l.meter,icon:l.icon,shape:l.shape,parts:l.parts}))r!==void 0&&n.push(`${e.id}: part "${s}" is a repeat template â it cannot also carry "${t}"`);let r=e.props.find(e=>e.name===l.repeat.itemsProp);if(!r)n.push(`${e.id}: part "${s}" repeat references unknown prop "${l.repeat.itemsProp}"`);else if(!Bu(r))n.push(`${e.id}: part "${s}" repeat prop "${l.repeat.itemsProp}" must be an arrayOf prop`);else{let i=l.component?t.get(l.component.id):void 0,a={text:`text`,boolean:`boolean`,number:`number`};for(let[t,o]of Object.entries(r.type.arrayOf)){if(l.component?.props&&t in l.component.props&&n.push(`${e.id}: part "${s}" repeat field "${t}" collides with a fixed component prop â a field is per-item, a fixed prop is constant`),!i)continue;let r=i.props.find(e=>e.name===t);r?r.type!==a[o]&&n.push(`${e.id}: part "${s}" repeat field "${t}" (${o}) does not match ${i.id} prop "${t}" (${typeof r.type==`object`?JSON.stringify(r.type):r.type}) â per-item enum differences are P10 and stay receipted`):n.push(`${e.id}: part "${s}" repeat field "${t}" names no ${i.id} prop`)}for(let[t,i]of l.repeat.sample.entries())for(let[a,o]of Object.entries(i)){let i=r.type.arrayOf[a];i===void 0?n.push(`${e.id}: part "${s}" repeat sample[${t}] key "${a}" is not a field of "${l.repeat.itemsProp}"`):(i===`boolean`!=(typeof o==`boolean`)||i===`number`!=(typeof o==`number`))&&n.push(`${e.id}: part "${s}" repeat sample[${t}].${a} is a ${typeof o} but the field is ${i}`)}}}if(l.visibleWhen){let t=e.props.find(e=>e.name===l.visibleWhen.prop);if(!t)n.push(`${e.id}: part "${s}" visibleWhen references unknown prop "${l.visibleWhen.prop}"`);else if(l.visibleWhen.equals!==void 0){let r=Array.isArray(l.visibleWhen.equals)?l.visibleWhen.equals:[l.visibleWhen.equals],i=typeof t.type==`object`&&`enum`in t.type?t.type.enum:[];for(let t of r)i.includes(t)||n.push(`${e.id}: part "${s}" visibleWhen.equals "${t}" is not a value of prop "${l.visibleWhen.prop}"`)}}if(l.textByProp){let t=e.props.find(e=>e.name===l.textByProp.prop);if(l.text===void 0&&n.push(`${e.id}: part "${s}" textByProp requires a base \`text\``),!t)n.push(`${e.id}: part "${s}" textByProp references unknown prop "${l.textByProp.prop}"`);else{let r=typeof t.type==`object`&&`enum`in t.type?t.type.enum:[];for(let t of Object.keys(l.textByProp.map))r.includes(t)||n.push(`${e.id}: part "${s}" textByProp map key "${t}" is not a value of prop "${l.textByProp.prop}"`)}}if(l.icon){let t=l.icon.asset.match(/^\{([a-z][\w-]*)\}$/),i=t?(()=>{let n=e.props.find(e=>e.name===t[1]);return n&&typeof n.type==`object`&&`enum`in n.type?n.type.enum:[]})():[l.icon.asset];for(let t of i)r.has(t)||n.push(`${e.id}: part "${s}" needs icon asset "assets/icons/${t}.svg" which does not exist`)}for(let t of Object.values(l.attrs??{})){let r=t.match(/^\{([a-z][\w-]*)\}$/);r&&!e.props.some(e=>
95e.name===r[1])&&n.push(`${e.id}: part "${s}" attrs references unknown prop "${r[1]}"`)}}Mu(e).length===0&&n.push(`${e.id}: anatomy must have at least one top-level (root) part`),/^[A-Z][A-Za-z0-9]*$/.test(e.name)||n.push(`${e.id}: contract name "${e.name}" must be PascalCase â it becomes the exported component and its file names`);let s=new Set,c=new Set,l=new Set(U(e).filter(e=>e.part.slot).map(e=>e.part.slot.name));for(let t of e.props){s.has(t.name)&&n.push(`${e.id}: duplicate prop name "${t.name}"`),s.add(t.name);let r=t.bindings.code.prop;r!==`children`&&l.has(r)&&n.push(`${e.id}: duplicate code binding "${r}" â two props/slots/events share one code name (check for a bad merge)`),l.add(r),/^[a-z][A-Za-z0-9]*$/.test(t.bindings.code.prop)||n.push(`${e.id}: prop "${t.name}" code binding "${t.bindings.code.prop}" is not a legal camelCase identifier`);let i=t.bindings.figma.property;if(i!==void 0&&(c.has(i)&&n.push(`${e.id}: two props bind the same design property "${i}" â the canvas cannot host both`),c.add(i)),t.default!==void 0&&(Ru(t)&&(typeof t.default!=`string`||!t.type.enum.includes(t.default))&&n.push(`${e.id}: prop "${t.name}" default ${JSON.stringify(t.default)} is not one of its enum values [${t.type.enum.join(`, `)}]`),t.type===`boolean`&&typeof t.default!=`boolean`&&n.push(`${e.id}: boolean prop "${t.name}" default must be a boolean (got ${JSON.stringify(t.default)})`),t.type===`number`&&typeof t.default!=`number`&&n.push(`${e.id}: number prop "${t.name}" default must be a number (got ${JSON.stringify(t.default)})`),t.type===`text`&&typeof t.default!=`string`&&n.push(`${e.id}: text prop "${t.name}" default must be a string (got ${JSON.stringify(t.default)})`)),Bu(t)?(t.bindings.figma.kind!==`NONE`&&n.push(`${e.id}: arrayOf prop "${t.name}" must bind figma kind "NONE" â structured props are code-only by declared fidelity limit`),t.default!==void 0&&n.push(`${e.id}: arrayOf prop "${t.name}" cannot declare a default â it renders as an optional array in code`),Object.keys(t.type.arrayOf).length===0&&n.push(`${e.id}: arrayOf prop "${t.name}" must declare at least one field`)):t.bindings.figma.kind===`NONE`&&t.type!==`text`?n.push(`${e.id}: prop "${t.name}" binds figma kind "NONE" but is neither an arrayOf prop nor a text prop â every other scalar prop has a canvas manifestation`):t.bindings.figma.kind===`NONE`&&typeof t.default!=`string`&&n.push(`${e.id}: text prop "${t.name}" binds figma kind "NONE" (code-only) but declares no string default â the default IS what the canvas draws for it`),t.type===`text`&&t.required&&typeof t.default!=`string`&&n.push(`${e.id}: required text prop "${t.name}" must declare a string default (canvas default + story sample) â add "default": "<sample text>" to the "${t.name}" prop in the seed contract`),Ru(t)&&t.bindings.figma.values){let r=Object.keys(t.bindings.figma.values);for(let i of t.type.enum)r.includes(i)||n.push(`${e.id}: prop "${t.name}" figma values map is missing enum value "${i}"`);for(let i of r)t.type.enum.includes(i)||n.push(`${e.id}: prop "${t.name}" figma values map has key "${i}" which is not an enum value`)}}let u=/^\{[^{}]*(\{[a-z][\w-]*\}[^{}]*)*\}$/;for(let{name:t,part:r}of U(e))for(let[i,a]of Object.entries(r.tokens??{}))(!u.test(a)||a===`{}`)&&n.push(`${e.id}: part "${t}" token "${i}" ref ${JSON.stringify(a)} is malformed â expected "{token.path}" with optional "{prop}" placeholders`);let d=new Map(U(e).map(e=>[e.name,e.part])),f=new Set;for(let t of e.events??[]){let r=t.bindings.code.prop;f.has(r)&&n.push(`${e.id}: duplicate event code prop "${r}"`),f.add(r),(e.props.some(e=>e.bindings.code.prop===r)||U(e).some(e=>e.part.slot?.name===r))&&n.push(`${e.id}: event "${t.name}" code prop "${r}" collides with a data prop or slot`);let i=d.get(t.trigger);if(i?!Nu(e).has(t.trigger)&&i.element!==`button`&&!Tl(i)&&n.push(`${e.id}: event "${t.name}" trigger part "${t.trigger}" must have element "button" or be a native checkable input (input[type=checkbox|radio]) (got "${i.element??`div`}")`):n.push(`${e.id}: event "${t.name}" trigger references unknown part "${t.trigger}"`),t.toggles){let r=e.props.find(e=>
95e.name===t.toggles.prop);if(!r)n.push(`${e.id}: event "${t.name}" toggles unknown prop "${t.toggles.prop}"`);else if(!(typeof r.type==`object`&&`enum`in r.type))n.push(`${e.id}: event "${t.name}" toggles non-enum prop "${t.toggles.prop}"`);else for(let i of t.toggles.between)r.type.enum.includes(i)||n.push(`${e.id}: event "${t.name}" toggles between "${i}" which is not a value of "${t.toggles.prop}"`)}}if(e.figmaStatePreviews){e.figmaRepresentation===`native`&&n.push(`${e.id}: figmaStatePreviews requires a generated Figma component â figmaRepresentation "native" declares there is none`),e.states.length===0&&n.push(`${e.id}: figmaStatePreviews is set but the contract declares no interaction states â nothing to preview`);for(let t of e.states){let r=Mu(e).some(([,e])=>Object.keys(e.states?.[t]??{}).length>0),i=U(e).some(e=>e.path.length>1&&Object.keys(e.part.states?.[t]??{}).length>0),a=U(e).some(e=>(e.part.statesByProp??[]).some(e=>e.state===t&&Object.keys(e.map).length>0));!r&&!i&&!a&&n.push(`${e.id}: figmaStatePreviews â state "${t}" declares no token overrides on anatomy.root.states (or any part's states), so its preview variant would render identically to Default`)}let t=Fl(e);t.length>1&&n.push(`${e.id}: figmaStatePreviews â state overrides substitute ${t.length} enum props (${t.join(`, `)}); previews multiply exactly ONE primary axis`),e.props.some(e=>e.bindings.figma.property===`State`)&&n.push(`${e.id}: figmaStatePreviews reserves the design property "${kl}" for the preview axis, but a prop already binds it`)}let p=e.semantics.elementByProp;if(p){let t=e.props.find(e=>e.name===p.prop);if(!t)n.push(`${e.id}: semantics.elementByProp references unknown prop "${p.prop}"`);else if(!Ru(t))n.push(`${e.id}: semantics.elementByProp prop "${p.prop}" must be an enum prop`);else{for(let r of t.type.enum)r in p.map||n.push(`${e.id}: semantics.elementByProp map is missing enum value "${r}"`);for(let[r,i]of Object.entries(p.map))t.type.enum.includes(r)||n.push(`${e.id}: semantics.elementByProp map key "${r}" is not a value of prop "${p.prop}"`),i in ud||n.push(`${e.id}: semantics.elementByProp maps "${r}" to unknown element "${i}" â must be one of the element vocabulary`)}}{let t=e=>{let t=Object.keys(e.parts??{}).length;return t>0?`${t} child part(s)`:e.slot?`a slot ("${e.slot.name}")`:e.content?`bound text content (prop "${e.content.prop}")`:e.text===void 0?e.icon?`an icon glyph`:null:`static text`},r=(t,r,i)=>{n.push(`${e.id}: ${t} mounts ${i}, but children cannot mount inside void element <${r}>
95 â React refuses it at runtime and the component renders NOTHING. Re-root the part (host the children on a container element â div/span/label per context â and mount the <${r}> control as a child part) or wrap the control`)};if(!Pu(e)){let n=e.anatomy.root,i=n===void 0?null:t(n)??(Gu(e).some(e=>e.bindings.code.prop===`children`)?`the children-bound text prop`:null);if(i)for(let t of new Set(ju(e)))El.has(t)&&r(`anatomy.root (semantics.element "${t}")`,t,i)}for(let{name:n,part:i,path:a}of U(e)){if(!Pu(e)&&a.length===1&&n===`root`)continue;let o=i.element;if(!o||!El.has(o))continue;let s=t(i);s&&r(`part "${n}" (element "${o}")`,o,s)}}{let t=(e,t)=>{if(!e)return!1;let n=Su[e];return!!(n&&!n.hosts.includes(t))},r=e=>typeof e==`string`&&e.trim().length>0,i=(t,r,i,a)=>{let o=Su[t];n.push(`${e.id}: ${i} claims role "${t}" on element "${r}" â native ${o.native} exists; use it or declare the exception (${a}: "<one-sentence reason>")`)},a=e.semantics.element,o=[];t(e.semantics.role,a)&&o.push({role:e.semantics.role,site:`semantics.role`});for(let[n,r]of Object.entries(e.semantics.roleByProp?.map??{}))t(r,a)&&o.push({role:r,site:`semantics.roleByProp["${n}"]`});for(let[n,r]of Mu(e)){let e=r.attrs?.role;t(e,a)&&o.push({role:e,site:`anatomy.${n} attrs.role`})}if(r(e.semantics.roleException))o.length===0&&n.push(`${e.id}: semantics.roleException is declared but no root-level role claim needs it â exceptions never ride along silently`);else for(let e of o)i(e.role,a,e.site,`semantics.roleException`);for(let{name:a,part:o,path:s}of U(e)){if(s.length===1)continue;let c=o.element??(o.content||o.text!==void 0?`span`:`div`),l=o.attrs?.role,u=t(l,c);u&&!r(o.roleException)?i(l,c,`part "${a}"`,`roleException`):!u&&r(o.roleException)&&n.push(`${e.id}: part "${a}" declares roleException but claims no role that needs it â exceptions never ride along silently`)}}}function od(e,t,n,r){let i=[];for(let a of n.stylesWhen??[]){let n=e.props.find(e=>
95e.name===a.prop);if(!n)continue;let o;if(Ru(n))o=`.${a.prop}-${a.equals}`;else{let t=n.name===`disabled`&&ud[e.semantics.element]?.supportsDisabled,r=n.name.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();o=t?`.root:disabled`:`.root[data-${r}]`}let s=r?o:`${o} .${t}`,c=Object.entries(a.styles).map(([e,t])=>` ${e}: ${t};`).join(` 96`);i.push(`\n${s} {\n${c}\n}`)}return i}function sd(e){let t=e.indexOf(`: `);return[e.slice(0,t),e.slice(t+2)]}function cd(e,t,n){let r=new Map(Vu(e).map(e=>[e.name,e.type.enum])),i=[`/* GENERATED FILE â DO NOT EDIT.`,` * Source of truth: contracts/${e.id.replace(/^[^.]+\./,``)}.contract.json (${e.id} v${e.version})`,` * Regenerate with: npm run generate`,` */`],a=Object.keys(e.anatomy);i.push(``,a.flatMap(e=>[`.${e}`,`.${e} *`,`.${e} *::before`,`.${e} *::after`]).join(`, 97`)+` {`,` box-sizing: border-box;`,`}`);let o=(r,i)=>t.has(r)?!0:(n.push(`${e.id}: ${i} references token "{${r}}" which does not exist in tokens/`),!1),s=rd(e),c=(t,n)=>ed(n.layout,J,`${e.id}.anatomy.${t}.layout.gap`),l=e=>(s.placeholders.get(e)??[]).flatMap(e=>[``,`.${e} {`,` grid-area: ${e};`,`}`]);if(Pu(e)){for(let{name:t,part:n}of U(e)){if(n.component){let e=s.cells.get(t);e&&i.push(``,`.${t} {`,...[...e,`display: grid`].map(e=>` ${e};`),`}`);continue}let e=[];Ju(n)&&(n.layout?.display===`grid`?e.push(...c(t,n)):(e.push(`display: ${n.layout?.display??`flex`}`),n.layout?.direction&&e.push(`flex-direction: ${n.layout.direction}`),n.layout?.wrap&&e.push(`flex-wrap: wrap`),n.layout?.align?e.push(`align-items: ${Iu[n.layout.align]}`):s.gridChildren.has(t)&&e.push(...nd(n)),n.layout?.justify&&e.push(`justify-content: ${Lu[n.layout.justify]}`))),e.push(...s.cells.get(t)??[]),n.layout?.grow&&e.push(`flex: 1 1 auto`,`min-width: 0`),n.element&&Ou.has(n.element)&&e.push(`margin: 0`),n.overlay&&e.push(`position: absolute`,...Fu[n.overlay.placement]),n.shape&&e.push(...ol(n.shape)),n.element===`button`&&e.push(`appearance: none`,`background: none`,`border: none`,`font: inherit`,`color: inherit`,`cursor: pointer`),n.icon&&(e.push(`display: inline-flex`,`flex-shrink: 0`),n.icon.size&&i.push(``,`.${t} svg {`,` width: ${n.icon.size}px;`,` height: ${n.icon.size}px;`,`}`));for(let[r,i]of Object.entries(n.tokens??{})){let n=Cu(i);wu(n).length>0||o(n,`anatomy.${t}.tokens.${r}`)&&e.push(`${r}: ${J(n)}`)}for(let[t,r]of Object.entries(n.literals??{}))e.push(`${t}: ${r}`);for(let[t,r]of Object.entries(n.declared??{}))e.push(`${t}: ${r}`);e.length>0&&i.push(``,`.${t} {`,...e.map(e=>` ${e};`),`}`),i.push(...l(t))}return i.join(` 98`)+` 99`}let u=e.anatomy.root,d=[];u.layout?u.layout.display===`grid`?d.push(...c(`root`,u)):(d.push(`display: ${u.layout.display??`flex`}`),u.layout.direction&&d.push(`flex-direction: ${u.layout.direction}`),u.layout.wrap&&d.push(`flex-wrap: wrap`),u.layout.align&&d.push(`align-items: ${Iu[u.layout.align]}`),u.layout.justify&&d.push(`justify-content: ${Lu[u.layout.justify]}`)):d.push(`display: inline-flex`,`align-items: center`,`justify-content: center`);let f=u.tokens??{},p=new Map;for(let t of u.overridable??[])for(let n of Xc[t]?.css??[])p.set(n,Zc(e.id,t));let m=(e,t)=>{let n=p.get(e);return n?`var(${n}, ${t})`:t};ju(e).some(e=>Ou.has(e))&&d.push(`margin: 0`),`border-width`in f||`border-width`in(u.literals??{})?d.push(`border-style: solid`):d.push(`border: 0`),d.push(...al(u.literals,`literals`,u.declared));let h=Au.some(e=>e in f)||(e=>Au.some(t=>t in(e?.tokens??{})||t in(e?.literals??{})))(u)||(Array.isArray(u.tokensByProp)?u.tokensByProp:u.tokensByProp?[u.tokensByProp]:[]).some(e=>Object.values(e.map).some(e=>Au.some(t=>t in e)))||(Array.isArray(u.literalsByProp)?u.literalsByProp:u.literalsByProp?[u.literalsByProp]:[]).some(e=>Object.values(e.map).some(e=>Au.some(t=>t in e)));ku.has(e.semantics.element)&&!h&&d.push(`appearance: none`,`background: none`);let g=`max-width`in f&&`height`in f&&Object.keys(u.parts??{}).length>0&&Object.values(u.parts??{}).every(e=>e.slot!==void 0);`max-width`in f&&(u.hugsBelowMaxWidth!==!0&&d.push(`width: 100%`),g||d.push(`min-width: fit-content`));let _=!!u.declared?.cursor||!!u.declaredStates?.disabled?.cursor;e.semantics.element===`button`&&!_&&d.push(`cursor: pointer`),U(e).some(e=>e.part.overlay||(e.part.stylesWhen??[]).some(e=>e.styles.position===`absolute`))&&d.push(`position: relative`);let v=new Map,y=[],b=[],x=new Set(Hu(e).map(e=>e.name)),S=e=>r.get(e)??(x.has(e)?[`true`,`false`]:void 0),C=(t,n)=>{let r=t===`disabled`&&ud[e.semantics.element]?.supportsDisabled?`:disabled`:`[data-${t.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}]`;return n===`true`?r:`:not(${r})`},w=e=>{let t=e.filter(([e])=>!x.has(e)).map(([e,t])=>`${e}-${t}`).join(`.`),n=e.filter(([e])=>x.has(e)).map(([e,t])=>C(e,t)).join(``);return(t.length>0?t:`root`)+n};for(let[t,i]of Object.entries(f)){let a=Cu(i),s=g&&t===`max-width`;if(t===`gap`&&u.layout?.overlap){let e=wu(a);if(e.length===1)for(let t of r.get(e[0])??[]){let n=a.replaceAll(`{${e[0]}}`,t);o(n,`anatomy.root.tokens.gap`)&&b.push(`\n.${e[0]}-${t} > * + * {\n margin-left: ${J(n)};\n}`)}else o(a,`anatomy.root.tokens.gap`)&&b.push(`\n.root > * + * {\n margin-left: ${J(a)};\n}`);continue}let c=wu(a);if(c.length===0)o(a,`anatomy.root.tokens.${t}`)&&(d.push(`${t}: ${m(t,J(a))}`),s&&d.push(`min-width: ${J(a)}`));else if(c.length===1){let r=S(c[0]);if(!r){n.push(`${e.id}: root token "${t}" substitutes unknown enum prop "${c[0]}"`);continue}for(let e of r){let n=a.replaceAll(`{${c[0]}}`,e);if(!o(n,`anatomy.root.tokens.${t}`))continue;let r=w([[c[0],e]]);v.has(r)||v.set(r,new Map),v.get(r).set(t,m(t,J(n))),s&&v.get(r).set(`min-width`,J(n))}}else if(c.length===2){let[r,i]=c,s=S(r),l=S(i);if(!s||!l){n.push(`${e.id}: root token "${t}" substitutes unknown enum prop "${s?i:r}"`);continue}for(let e of s)for(let n of l){let s=a.replaceAll(`{${r}}`,e).replaceAll(`{${i}}`,n);if(!o(s,`anatomy.root.tokens.${t}`))continue;for(let[t,a]of[[r,e],[i,n]]){if(x.has(t))continue;let e=`${t}-${a}`;v.has(e)||v.set(e,new Map)}let c=w([[r,e],[i,n]]);v.has(c)||v.set(c,new Map),v.get(c).set(t,m(t,J(s)))}}else if(c.length===3){let[r,i,s]=c,l=c.map(e=>S(e));if(l.some(e=>!e)){let r=c[l.findIndex(e=>!e)];n.push(`${e.id}: root token "${t}" substitutes unknown enum prop "${r}"`);continue}for(let e of l[0])for(let n of l[1])for(let c of l[2]){let l=a.replaceAll(`{${r}}`,e).replaceAll(`{${i}}`,n).replaceAll(`{${s}}`,c);if(!o(l,`anatomy.root.tokens.${t}`))continue;for(let[t,a]of[[r,e],[i,n],[s,c]]){if(x.has(t))continue;let e=`${t}-${a}`;v.has(e)||v.set(e,new Map)}let u=w([[r,e],[i,n],[s,c]]);v.has(u)||v.set(u,new Map),v.get(u).set(t,m(t,J(l)))}}else n.push(`${e.id}: root token "${t}" uses ${c.length} substitutions (max 3)`)}for(let{prop:e,map:t}of Cl(u))for(let[n,i]of Object.entries(t)){for(let[t,a]of Object.entries(i)){let i=Cu(a),s=g&&t===`max-width`,c=wu(i);if(c.length===1){for(let a of r.get(c[0])??[]){let r=i.replaceAll(`{${c[0]}}`,a);if(!o(r,`anatomy.root.tokensByProp.${n}.${t}`))continue;for(let t of[`${e}-${n}`,`${c[0]}-${a}`])v.has(t)||v.set(t,new Map);let l=`${e}-${n}.${c[0]}-${a}`;v.has(l)||v.set(l,new Map),v.get(l).set(t,J(r)),s&&v.get(l).set(`min-width`,J(r))}continue}if(!o(i,`anatomy.root.tokensByProp.${n}.${t}`))continue;let l=`${e}-${n}`;v.has(l)||v.set(l,new Map),v.get(l).set(t,J(i)),s&&v.get(l).set(`min-width`,J(i))}for(let t of al(i,`tokens`,u.declared)){let[r,i]=sd(t),a=`${e}-${n}`;v.has(a)||v.set(a,new Map),v.get(a).set(r,i)}}for(let[e,t]of Object.entries(u.literals??{}))d.push(`${e}: ${t}`);for(let{prop:e,map:t}of u.literalsByProp??[])for(let[n,r]of Object.entries(t)){let t=`${e}-${n}`;for(let[e,n]of Object.entries(r))v.has(t)||v.set(t,new Map),v.get(t).set(e,n);for(let e of al(r,`literals`,u.declared)){let[n,r]=sd(e);v.has(t)||v.set(t,new Map),v.get(t).set(n,r)}}for(let[e,t]of Object.entries(u.declared??{})){if(e===`position`&&d.includes(`position: relative`)){if(t===`relative`)continue;d.splice(d.indexOf(`position: relative`),1)}d.push(`${e}: ${t}`)}let T=e.a11y?.minHitArea;typeof T==`number`&&!d.includes(`position: relative`)&&d.push(`position: relative`),i.push(``,`.root {`);for(let e of d)i.push(` ${e};`);i.push(`}`),i.push(...l(`root`)),i.push(...b),typeof T==`number`&&i.push(``,`/* a11y.minHitArea: non-visual hit-target floor â see contract */`,`.root::before {`,` content: '';`,` position: absolute;`,` left: 50%;`,` top: 50%;`,` width: max(100%, ${T}px);`,` height: max(100%, ${T}px);`,` transform: translate(-50%, -50%);`,`}`),e.states.includes(`focus-visible`)&&i.push(``,`.root:focus-visible {`,` outline-style: solid;`,` outline-offset: 2px;`,`}`),e.states.includes(`disabled`)&&e.semantics.element===`button`&&!_&&i.push(``,`.root:disabled {`,` cursor: n
99ot-allowed;`,`}`);for(let[e,t]of v){i.push(``,`.${e} {`);for(let[e,n]of t)i.push(` ${e}: ${n};`);i.push(`}`)}if(u.layoutByProp)for(let[e,t]of Object.entries(u.layoutByProp.map)){let n=Yu(t);if(n.length!==0){i.push(``,`.${u.layoutByProp.prop}-${e} {`);for(let e of n)i.push(` ${e};`);i.push(`}`)}}for(let[t,i]of Object.entries(u.states??{})){let a=Eu[t];if(!a){n.push(`${e.id}: unknown state "${t}"`);continue}for(let[e,n]of Object.entries(i)){let i=Cu(n),s=wu(i);if(s.length===0)o(i,`anatomy.root.states.${t}.${e}`)&&y.push(`\n.root${a} {\n ${e}: ${J(i)};\n}`);else if(s.length===1){let n=r.get(s[0])??[];for(let r of n){let n=i.replaceAll(`{${s[0]}}`,r);o(n,`anatomy.root.states.${t}.${e}`)&&y.push(`\n.${s[0]}-${r}${a} {\n ${e}: ${J(n)};\n}`)}}}}for(let e of u.statesByProp??[]){let t=Eu[e.state];if(t)for(let[n,r]of Object.entries(e.map))for(let[i,a]of Object.entries(r)){let r=Cu(a);o(r,`anatomy.root.statesByProp.${e.prop}.${n}.${e.state}.${i}`)&&y.push(`\n.${e.prop}-${n}${t} {\n ${i}: ${J(r)};\n}`)}}i.push(...y);for(let[e,t]of Object.entries(u.declaredStates??{})){let n=Eu[e];if(!n)continue;let r=Object.entries(t).map(([e,t])=>` ${e}: ${t};`);r.length>0&&i.push(``,`.root${n} {`,...r,`}`)}i.push(...od(e,`root`,u,!0));let E=new Set;for(let{name:t,part:n,path:a}of U(e)){if(a[0]===`root`&&a.length===1)continue;if(n.component){let e=Object.entries(n.component.overrides??{}),a=s.cells.get(t);if(e.length===0&&a&&i.push(``,`.${t} {`,...[...a,`display: grid`].map(e=>` ${e};`),`}`),e.length>0){let s=a?[...a,`display: grid`]:[`display: inline-flex`],c=[];for(let[i,a]of e){let e=Zc(n.component.id,i),l=Cu(a),u=wu(l);if(u.length>=1){for(let n of Tu(u,r)){let r=l;for(let[e,t]of n)r=r.replaceAll(`{${e}}`,t);if(!o(r,`anatomy.${t}.component.overrides.${i}`))continue;let a=n.map(([e,t])=>`.${e}-${t}`).join(``);c.push(`\n${a} .${t} {\n ${e}: ${J(r)};\n}`)}continue}o(l,`anatomy.${t}.component.overrides.${i}`)&&s.push(`${e}: ${J(l)}`)}i.push(``,`.${t} {`,...s.map(e=>` ${e};`),`}`),i.push(...c)}continue}let u=[];Ju(n)&&(n.layout?.display===`grid`?u.push(...c(t,n)):(u.push(`display: ${n.layout?.display??`flex`}`),n.layout?.direction&&u.push(`flex-direction: ${n.layout.direction}`),n.layout?.wrap&&u.push(`flex-wrap: wrap`),n.layout?.align?u.push(`align-items: ${Iu[n.layout.align]}`):s.gridChildren.has(t)&&u.push(...nd(n)),n.layout?.justify&&u.push(`justify-content: ${Lu[n.layout.justify]}`))),u.push(...s.cells.get(t)??[]),n.layout?.grow&&u.push(`flex: 1 1 auto`,`min-width: 0`),n.element&&Ou.has(n.element)&&u.push(`margin: 0`),n.overlay&&u.push(`position: absolute`,...Fu[n.overlay.placement]),n.shape&&u.push(...ol(n.shape)),n.element===`button`&&(e.events??[]).some(e=>e.trigger===t)&&u.push(`appearance: none`,`background: none`,`border: none`,`margin: 0`,`padding: 0`,`font: inherit`,`color: inherit`,`text-align: inherit`,`cursor: pointer`),!Tl(n)&&(n.element===`input`||n.element===`textarea`||n.element===`select`)&&u.push(`appearance: none`,`border: none`,`background: transparent`,`font: inherit`,`color: inherit`,`letter-spacing: inherit`,`margin: 0`,`padding: 0`,`outline: none`),Tl(n)&&u.push(`position: absolute`,`inset: 0`,`width: 100%`,`height: 100%`,`margin: 0`,`padding: 0`,`opacity: 0`,`cursor: pointer`),n.icon&&(u.push(`display: inline-flex`,`flex-shrink: 0`),n.icon.size&&i.push(``,`.${t} svg {`,` width: ${n.icon.size}px;`,` height: ${n.icon.size}px;`,`}`),n.element===`button`&&u.push(`align-items: center`,`justify-content: center`,`background: none`,`border: none`,`padding: 0`,`color: inherit`,`cursor: pointer`));let d=[];n.animation&&(u.push(n.animation===`spin`?`animation: ds-spin 0.8s linear infinite`:`animation: ds-pulse 1.6s ease-in-out infinite`),E.add(n.animation));for(let[e,i]of Object.entries(n.tokens??{})){let a=Cu(i);if(e===`gap`&&n.layout?.overlap){let e=wu(a);if(e.length===1)for(let n of r.get(e[0])??[]){let r=a.replaceAll(`{${e[0]}}`,n);o(r,`anatomy.${t}.tokens.gap`)&&d.push(`\n.${e[0]}-${n} .${t} > * + * {\n margin-left: ${J(r)};\n}`)}else o(a,`anatomy.${t}.tokens.gap`)&&d.push(`\n.${t} > * + * {\n margin-left: ${J(a)};\n}`);continue}let s=wu(a);if(s.length>=1){for(let n of Tu(s,r)){let r=a;for(let[e,t]of n)r=r.replaceAll(`{${e}}`,t);if(!o(r,`anatomy.${t}.tokens.${e}`))continue;let i=n.map(([e,t])=>`.${e}-${t}`).join(``);d.push(`\n${i} .${t} {\n ${e}: ${J(r)};\n}`)}continue}if(o(a,`anatomy.${t}.tokens.${e}`)){let t=f[e]===i;u.push(`${e}: ${t?m(e,J(a)):J(a)}`)}}(n.tokens&&`border-width`in n.tokens||n.literals&&`border-width`in n.literals)&&u.push(`border-style: solid`),u.push(...al(n.literals,`literals`,n.declared));for(let e of Cl(n))for(let[i,a]of Object.entries(e.map)){for(let[n,s]of Object.entries(a)){let a=Cu(s),c=wu(a);if(c.length===1){for(let s of r.get(c[0])??[]){let r=a.replaceAll(`{${c[0]}}`,s);if(o(r,`anatomy.${t}.tokensByProp.${i}.${n}`)){for(let t of[`${e.prop}-${i}`,`${c[0]}-${s}`])v.has(t)||v.set(t,new Map);d.push(`\n.${e.prop}-${i}.${c[0]}-${s} .${t} {\n ${n}: ${J(r)};\n}`)}}continue}o(a,`anatomy.${t}.tokensByProp.${i}.${n}`)&&d.push(`\n.${e.prop}-${i} .${t} {\n ${n}: ${J(a)};\n}`)}for(let r of al(a,`tokens`,n.declared))d.push(`\n.${e.prop}-${i} .${t} {\n ${r};\n}`)}for(let[e,t]of Object.entries(n.literals??{}))u.push(`${e}: ${t}`);for(let e of n.literalsByProp??[])for(let[r,i]of Object.entries(e.map)){let a=Object.entries(i).map(([e,t])=>` ${e}: ${t};`);for(let e of al(i,`literals`,n.declared))a.push(` ${e};`);a.length!==0&&d.push(`\n.${e.prop}-${r} .${t} {\n${a.join(` 100`)}\n}`)}for(let[e,t]of Object.entries(n.declared??{}))u.push(`${e}: ${t}`);n.element===`img`&&n.declared?.position===`absolute`&&u.push(`width: 100%`,`height: 100%`);for(let[e,r]of Object.entries(n.declaredStates??{})){let n=Eu[e];
100if(!n)continue;let i=Object.entries(r).map(([e,t])=>` ${e}: ${t};`);i.length>0&&d.push(`\n.root${n} .${t} {\n${i.join(` 101`)}\n}`)}let p=n.statesByProp??[];for(let[e,i]of Object.entries(n.states??{})){let n=Eu[e];if(n)for(let[a,s]of Object.entries(i)){let i=Cu(s),c=wu(i);if(c.length===0)o(i,`anatomy.${t}.states.${e}.${a}`)&&d.push(`\n.root${n} .${t} {\n ${a}: ${J(i)};\n}`);else if(c.length===1)for(let s of r.get(c[0])??[]){let r=i.replaceAll(`{${c[0]}}`,s);o(r,`anatomy.${t}.states.${e}.${a}`)&&d.push(`\n.${c[0]}-${s}${n} .${t} {\n ${a}: ${J(r)};\n}`)}}}for(let e of p){let n=Eu[e.state];if(n)for(let[r,i]of Object.entries(e.map))for(let[a,s]of Object.entries(i)){let i=Cu(s);o(i,`anatomy.${t}.statesByProp.${e.prop}.${r}.${e.state}.${a}`)&&d.push(`\n.${e.prop}-${r}${n} .${t} {\n ${a}: ${J(i)};\n}`)}}if(n.layoutByProp)for(let[e,r]of Object.entries(n.layoutByProp.map)){let i=Yu(r);i.length!==0&&d.push(`\n.${n.layoutByProp.prop}-${e} .${t} {\n${i.map(e=>` ${e};`).join(` 102`)}\n}`)}for(let[e,r]of Object.entries(n.parts??{}))Tl(r)&&(u.push(`position: relative`),d.push(`\n.${t}:has(> .${e}:focus-visible) {\n outline-style: solid;\n outline-offset: 2px;\n}`));if(d.push(...od(e,t,n,!1)),!(u.length===0&&d.length===0)){if(u.length>0){i.push(``,`.${t} {`);for(let e of u)i.push(` ${e};`);i.push(`}`)}i.push(...l(t)),i.push(...d),n.icon&&n.element&&i.push(``,`.${t}Glyph {`,` display: inline-flex;`,`}`)}}return E.has(`spin`)&&i.push(``,`@keyframes ds-spin {`,` to { transform: rotate(360deg); }`,`}`),E.has(`pulse`)&&i.push(``,`@keyframes ds-pulse {`,` 0%, 100% { opacity: 1; }`,` 50% { opacity: 0.45; }`,`}`),ld(i.join(` 103`)+` 104`)}function ld(e){let t=Object.keys(Yc).filter(e=>Yc[e].css===`canvas-only`);if(!t.some(t=>e.includes(`${t}:`)))return e;let n=RegExp(`^\\s*(${t.join(`|`)})\\s*:[^\\n]*$`),r=new Set,i=[];for(let t of e.split(` 105`)){let e=n.exec(t);if(e){r.add(e[1]);continue}i.push(t)}let a=[];for(let e=0;e<i.length;e++){if(/\{\s*$/.test(i[e])&&i[e+1]!==void 0&&/^\s*\}\s*$/.test(i[e+1])){e++;continue}a.push(i[e])}return`${[`/* code-only facts â REFUSED BY NAME, not silently dropped:`,...[...r].sort().map(e=>` ${e}: ${Yc[e].note}`),` CSS has no per-component translate longhand and this contract conditions`," the components on different axes, so no single `translate:` declaration",` can carry them. The canvas lowers them to absolute placement. */`].join(` 106`)}\n${a.join(` 107`).replace(/\n{3,}/g,` 108 109`)}`}var ud={button:{attrs:`ButtonHTMLAttributes`,el:`HTMLButtonElement`,supportsDisabled:!0},span:{attrs:`HTMLAttributes`,el:`HTMLSpanElement`,supportsDisabled:!1},div:{attrs:`HTMLAttributes`,el:`HTMLDivElement`,supportsDisabled:!1},a:{attrs:`AnchorHTMLAttributes`,el:`HTMLAnchorElement`,supportsDisabled:!1},input:{attrs:`InputHTMLAttributes`,el:`HTMLInputElement`,supportsDisabled:!0},article:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},section:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},header:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},footer:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},label:{attrs:`LabelHTMLAttributes`,el:`HTMLLabelElement`,supportsDisabled:!1},nav:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},hr:{attrs:`HTMLAttributes`,el:`HTMLHRElement`,supportsDisabled:!1},ul:{attrs:`HTMLAttributes`,el:`HTMLUListElement`,supportsDisabled:!1},li:{attrs:`LiHTMLAttributes`,el:`HTMLLIElement`,supportsDisabled:!1},p:{attrs:`HTMLAttributes`,el:`HTMLParagraphElement`,supportsDisabled:!1},textarea:{attrs:`TextareaHTMLAttributes`,el:`HTMLTextAreaElement`,supportsDisabled:!0},select:{attrs:`SelectHTMLAttributes`,el:`HTMLSelectElement`,supportsDisabled:!0},fieldset:{attrs:`FieldsetHTMLAttributes`,el:`HTMLFieldSetElement`,supportsDisabled:!0},blockquote:{attrs:`HTMLAttributes`,el:`HTMLQuoteElement`,supportsDisabled:!1},code:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},kbd:{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1},h1:{attrs:`HTMLAttributes`,el:`HTMLHeadingElement`,supportsDisabled:!1},h2:{attrs:`HTMLAttributes`,el:`HTMLHeadingElement`,supportsDisabled:!1},h3:{attrs:`HTMLAttributes`,el:`HTMLHeadingElement`,supportsDisabled:!1},h4:{attrs:`HTMLAttributes`,el:`HTMLHeadingElement`,supportsDisabled:!1},h5:{attrs:`HTMLAttributes`,el:`HTMLHeadingElement`,supportsDisabled:!1},h6:{attrs:`HTMLAttributes`,el:`HTMLHeadingElement`,supportsDisabled:!1}},dd=/^\{([a-z][\w-]*)\}$/;function fd(e,t,n){let r=[];for(let[i,a]of Object.entries(t)){let t=e.props.find(e=>e.name===i),o=t?.bindings.code.prop??i;if(typeof a==`object`){let e=(n?.props.find(e=>
109e.name===a.prop))?.bindings.code.prop??a.prop,t=Object.entries(a.map).map(([t,n])=>`${e} === '${t}' ? '${n}' : `).join(``);r.push(` ${o}={${t}undefined}`);continue}if(typeof a==`boolean`){if(t&&t.type!==`boolean`)throw Error(`${e.id}: applied value for prop "${i}" is a boolean but the dependency types it ${JSON.stringify(t.type)} â fix the composing contract (cross-contract prop types are load-bearing)`);r.push(a?` ${o}`:t?.default===!1?``:` ${o}={false}`);continue}let s=a.match(dd);if(t?.type===`boolean`&&!(s&&n))throw Error(`${e.id}: applied value ${JSON.stringify(a)} for prop "${i}" is a string but the dependency types it boolean â coerce at composition ('False' â false), never pass the spelling through`);if(s&&n){let e=n.props.find(e=>e.name===s[1]);r.push(` ${o}={${e?.bindings.code.prop??s[1]}}`)}else r.push(` ${o}="${a}"`)}return r.join(``)}function pd(e,t,n=0){return n>3?``:e.map(e=>{let r=t.get(e.id),i=fd(r,e.props??{}),a=Gu(r).find(e=>e.bindings.code.prop===`children`),o=Dl(r).find(e=>e.slot.name===`children`&&(e.slot.defaultContent?.length??0)>0);return e.text===void 0?o?`<${r.name}${i}>\n${pd(o.slot.defaultContent,t,n+1)}\n</${r.name}>`:typeof a?.default==`string`?`<${r.name}${i}>${a.default}</${r.name}>`:`<${r.name}${i} />`:`<${r.name}${i}>${e.text}</${r.name}>`}).join(` 110`)}function md(e,t,n=new Set,r=0){if(r>3)return n;for(let i of e){let e=t.get(i.id);n.add(e.name);let a=Dl(e).find(e=>e.slot.name===`children`&&(e.slot.defaultContent?.length??0)>0);a&&md(a.slot.defaultContent,t,n,r+1)}return n}function hd(e){let t=new Set;for(let n of e.replace(/\/\*[\s\S]*?\*\//g,``).matchAll(/([^{}]+)\{/g))for(let e of n[1].matchAll(/\.(-?[A-Za-z_][A-Za-z0-9_-]*)/g))t.add(e[1]);return t}function gd(e,t,n,r){let i=e.semantics.elementByProp,a=i?{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1}:ud[e.semantics.element],o=e.name,s=Vu(e),c=Hu(e),l=Ku(e),u=Y(e),d=t=>e.props.find(e=>e.name===t)?.bindings.code.prop??t,f=[...new Set(U(e).filter(e=>e.part.component).map(e=>t.get(e.part.component.id).name))],p=e.events??[],m=new Set(p.filter(e=>e.toggles).map(e=>d(e.toggles.prop))),h=[];for(let t of e.props){let e=t.description?` /** ${t.description} */\n`:``;if(Ru(t)){let n=t.type.enum.map(e=>`'${e}'`).join(` | `);h.push(`${e} ${t.bindings.code.prop}?: ${n};`)}else if(Bu(t)){let n=Object.entries(t.type.arrayOf).map(([e,t])=>`${e}: ${t===`text`?`string`:t}`).join(`; `);h.push(`${e} ${t.bindings.code.prop}?: Array<{ ${n} }>;`)}else t.type===`boolean`?h.push(`${e} ${t.bindings.code.prop}?: boolean;`):t.type===`number`?h.push(`${e} ${t.bindings.code.prop}?: number;`):t.bindings.code.prop!==`children`&&h.push(`${e} ${t.bindings.code.prop}${t.required?``:`?`}: string;`)}for(let{slot:e,part:t}of u){let n=t.description?` /** ${t.description} */\n`:``;h.push(`${n} ${e.name}?: ReactNode;`)}for(let e of p){let t=e.description??`Fires when the ${e.trigger} is activated.`;h.push(` /** ${t} */\n ${e.bindings.code.prop}?: () => void;`)}let g=[];for(let e of s)g.push(m.has(e.bindings.code.prop)?`${e.bindings.code.prop}: ${e.bindings.code.prop}Prop`:`${e.bindings.code.prop} = '${e.default}'`);for(let e of c)g.push(`${e.bindings.code.prop} = ${e.default===!0}`);for(let t of Uu(e))g.push(`${t.bindings.code.prop} = ${typeof t.default==`number`?t.default:0}`);for(let e of l)g.push(e.required||e.default===void 0?e.bindings.code.prop:`${e.bindings.code.prop} = '${e.default}'`);for(let t of Wu(e))g.push(t.bindings.code.prop);for(let{slot:e}of u)g.push(e.name);for(let e of p)g.push(e.bindings.code.prop);let _=Gu(e).find(e=>e.bindings.code.prop===`children`),v=_&&_.bindings.figma.kind===`NONE`&&typeof _.default==`string`?`children = ${JSON.stringify(_.default)}`:`children`;g.push(`className`,v,`...rest`);let y=[];for(let t of p){if(!t.toggles)continue;let n=e.props.find(e=>e.name===t.toggles.prop),r=n.bindings.code.prop,i=n.type.enum.map(e=>`'${e}'`).join(` | `);y.push(` const [${r}Uncontrolled, set${Ol(r)}Uncontrolled] = useState<${i}>('${n.default}');`,` const ${r} = ${r}Prop ?? ${r}Uncontrolled;`)}for(let t of p){let n=[];if(t.toggles){let r=e.props.find(e=>
110e.name===t.toggles.prop).bindings.code.prop,[i,a]=t.toggles.between;n.push(`set${Ol(r)}Uncontrolled(${r} === '${a}' ? '${i}' : '${a}');`)}n.push(`${t.bindings.code.prop}?.();`),y.push(` const handle${Ol(t.name)} = () => { ${n.join(` `)} };`)}let b=(t,n,r)=>{let i=p.find(e=>e.trigger===t);if(!i)return``;if(n&&Tl(n)){let t=``;if(i.toggles){let n=e.props.find(e=>e.name===i.toggles.prop),r=n.bindings.code.prop,[a,o]=i.toggles.between,s=n.type.enum.filter(e=>e!==a&&e!==o);if(t+=` checked={${r} === '${o}'}`,s.length>0){let e=s.map(e=>`${r} === '${e}'`).join(` || `);t+=` ref={(el) => { if (el) el.indeterminate = ${e}; }}`}}return t+=` onChange={handle${Ol(i.name)}}`,t}let a=r===`button`?` type="button"`:``;if(a+=` onClick={handle${Ol(i.name)}}`,i.toggles?.aria){let t=e.props.find(e=>e.name===i.toggles.prop),n=t.bindings.code.prop,[r,o]=i.toggles.between,s=t.type.enum.filter(e=>e!==r&&e!==o);a+=s.length?` aria-${i.toggles.aria}={${n} === '${o}' ? true : ${n} === '${r}' ? false : 'mixed'}`:` aria-${i.toggles.aria}={${n} === '${o}'}`}return a},x=r===void 0?null:hd(r),S=[],C=[`styles.root`,...s.filter(e=>{if(x===null)return!0;for(let t of x)if(t.startsWith(`${e.name}-`))return!0;return S.push(e.name),!1}).map(e=>`styles[\`${e.name}-\${${e.bindings.code.prop}}\`]`),`className`],w=S.length===0?``:` // axis-inert (ledgered, not a throw): ${S.join(`, `)} â no \`.<axis>-*\` rule\n // exists in ${o}.module.css, so no class is composed for ${S.length===1?`it`:`them`}. A reference\n // to an unemitted class resolves to \`undefined\` and is filtered out, so emitting\n // one only made a style-less axis LOOK styled. Whatever ${S.length===1?`this axis carries`:`these axes carry`} rides\n // structure (a gated part, a per-value text/icon lookup, a child's own props) â\n // or, where the source drew no difference at all, nothing.\n`,T=a.supportsDisabled&&c.some(e=>e.name===`disabled`),E=[`ref={ref}`,`className={classes}`];T&&E.push(`disabled={disabled}`);for(let e of c){if(e.name===`disabled`&&T)continue;let t=e.name.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();E.push(`data-${t}={${e.bindings.code.prop} || undefined}`)}let ee=e.semantics.roleByProp,te=``;ee?(te=`const ROLE_MAP: Record<string, string> = ${JSON.stringify(ee.map)};\n\n`,E.push(`role={ROLE_MAP[${d(ee.prop)}]}`)):e.semantics.role&&e.semantics.role!==e.semantics.element&&E.push(`role="${e.semantics.role}"`);let ne=``;i&&(ne=`const ELEMENT_MAP: Record<string, ElementType> = ${JSON.stringify(i.map)};\n\n`);let D=p.find(e=>e.trigger===`root`);if(D&&(e.semantics.element===`button`&&E.push(`type="button"`),E.push(`onClick={handle${Ol(D.name)}}`),D.toggles?.aria)){let t=e.props.find(e=>e.name===D.toggles.prop).bindings.code.prop,[,n]=D.toggles.between;E.push(`aria-${D.toggles.aria}={${t} === '${n}'}`)}E.push(`{...rest}`);let O=new Map;for(let{part:t}of U(e)){if(!t.icon)continue;let r=t.icon.asset.match(/^\{([a-z][\w-]*)\}$/);if(r){let t=e.props.find(e=>e.name===r[1]);if(t&&Ru(t))for(let e of t.type.enum)O.set(e,n.get(e)??``)}else O.set(t.icon.asset,n.get(t.icon.asset)??``)}let re=O.size>0?`const ICONS: Record<string, string> = {\n${[...O.entries()].map(([e,t])=>` ${JSON.stringify(e)}: ${JSON.stringify(t)},`).join(` 111`)}\n};\n\n`:``,ie=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ae=e=>ie.test(e)?`styles.${e}`:`styles[${JSON.stringify(e)}]`,oe=new Set([`rows`,`cols`,`tabIndex`,`colSpan`,`rowSpan`]),k=e=>Object.entries(e.attrs??{}).map(([e,t])=>{let n=t.match(/^\{([a-z][\w-]*)\}$/);return n?` ${e}={String(${d(n[1])})}`:oe.has(e)&&/^\d+$/.test(t)?` ${e}={${t}}`:` ${e}=${JSON.stringify(t)}`}).join(``),A=(e,t)=>{if(!e.visibleWhen)return t;let n=d(e.visibleWhen.prop),r=e.visibleWhen.equals;return`{${r===void 0?n:Array.isArray(r)?r.map(e=>`${n} === '${e}'`).join(` || `):`${n} === '${r}'`} ? (${t}) : null}`},se=rd(e),j=e=>(se.placeholders.get(e)??[]).map(e=>`<div className={${ae(e)}} />`).join(` 112`),ce=(n,r)=>{if(r.icon){let e=r.icon.asset.match(/^\{([a-z][\w-]*)\}$/),t=`dangerouslySetInnerHTML={{ __html: ICONS[${e?d(e[1]):JSON.stringify(r.icon.asset)}] }}`,i=r.element?`<${r.element} className={${ae(n)}}${k(r)}${b(n,r,r.element)}><span aria-hidden="true" className={${ae(`${n}Glyph`)}} ${t} /></${r.element}>`:`<span className={${ae(n)}} aria-hidden="true" ${t} />`;return A(r,i)}if(r.repeat&&r.component){let n=t.get(r.component.id),i=e.props.find(e=>e.name===r.repeat.itemsProp),a=i.bindings.code.prop,o=fd(n,r.component.props??{},e),s=null,c=Object.keys(i.type.arrayOf).map(e=>{let t=n.props.find(t=>t.name===e);return t.bindings.code.prop===`children`?(s=e,``):` ${t.bindings.code.prop}={item.${e}}`}).join(``),l=s?`<${n.name} key={index}${o}${c}>{item.${s}}</${n.name}>`:`<${n.name} key={index}${o}${c} />`;return A(r,`{${a}?.map((item, index) => (${l}))}`)}if(r.component){let i=t.get(r.component.id),a=fd(i,r.component.props??{},e),o=Gu(i).find(e=>e.bindings.code.prop===`children`),s=o!==void 0&&r.component.props?.[o.name]!==void 0,c=o?.bindings.figma.kind===`NONE`,l=r.component.text??(!s&&!c&&typeof o?.default==`string`?o.default:void 0),u=l===void 0?`<${i.name}${a} />`:`<${i.name}${a}>${l}</${i.name}>`,d=Object.keys(r.component.overrides??{}).length>0||se.wrappedInstances.has(n)?`<span className={${ae(n)}}>${u}</span>`:u;return A(r,d)}if(r.slot){let e=r.element??`div`,t=r.slot.name===`children`?`children`:r.slot.name,i=`<${e} className={${ae(n)}}${k(r)}>{${t}}</${e}>`;return r.optional?`{${t} != null ? ${i} : null}`:A(r,i)}if(r.content){let t=r.element??`span`,i=e.props.find(e=>e.type===`text`&&e.bindings.code.prop===r.content.prop);return A(r,`<${t} className={${ae(n)}}${k(r)}${b(n,r,t)}>{${i.bindings.code.prop}}</${t}>`)}if(r.text!==void 0){let e=r.element??`span`,t=r.textByProp,i=t?`{${Object.entries(t.map).map(([e,n])=>`${d(t.prop)} === '${e}' ? ${JSON.stringify(n)} : `).join(``)}${JSON.stringify(r.text)}}`:r.text;return A(r,`<${e} className={${ae(n)}}${k(r)}>${i}</${e}>`)}
112if(r.meter){let e=d(r.meter.valueProp),t=d(r.meter.maxProp);return A(r,`<div className={${ae(n)}} style={{ width: \`\${Math.min(100, Math.max(0, (${e} / ${t}) * 100))}%\` }} />`)}let i=r.element??`div`,a=[...Object.entries(r.parts??{}).map(([e,t])=>ce(e,t)),...j(n)?[j(n)]:[]].join(` 113`);return A(r,`<${i} className={${ae(n)}}${k(r)}${b(n,r,i)}>\n${a}\n</${i}>`)};if(Pu(e)){let t=Mu(e).map(([e,t])=>ce(e,t)).join(` 114 `),n=[a.attrs,...u.length>0?[`ReactNode`]:[]].join(`, `),r=f.map(e=>`import { ${e} } from '../${e}';`).join(` 115`);return`/** 116 * GENERATED FILE â DO NOT EDIT. 117 * Source of truth: contracts/${e.id.replace(/^[^.]+\./,``)}.contract.json (${e.id} v${e.version}) 118 * Regenerate with: npm run generate 119 * 120 * MULTI-ROOT composite â the anatomy declares ${Mu(e).length} top-level roots 121 * (${Mu(e).map(([e])=>e).join(`, `)}). They render as SIBLINGS in a 122 * Fragment; there is no single wrapping element (a Modal's backdrop + dialog 123 * are position-driven siblings). Each root's class is styles.<rootName>. 124 */ 125import type { ${n} } from 'react'; 126${r}${r?` 127`:``}import styles from './${o}.module.css'; 128 129${re}export interface ${o}Props extends ${a.attrs}<${a.el}> { 130${h.join(` 131`)} 132} 133 134/** ${e.description} */ 135export function ${o}({ ${g.join(`, `)} }: ${o}Props) { 136 return ( 137 <> 138 ${t} 139 </> 140 ); 141} 142`}let M=e.anatomy.root,N=M.parts||se.placeholders.has(`root`)?[...Object.entries(M.parts??{}).map(([e,t])=>ce(e,t)),...j(`root`)?[j(`root`)]:[]].join(` 143`):`{children}`,P=i?`Tag`:e.semantics.element;i&&y.push(` const Tag = ELEMENT_MAP[${d(i.prop)}] ?? '${e.semantics.element}';`);let le=[a.attrs,...u.length>0?[`ReactNode`]:[],...i?[`ElementType`]:[]].join(`, `),ue=f.map(e=>`import { ${e} } from '../${e}';`).join(` 144`);return`/** 145 * GENERATED FILE â DO NOT EDIT. 146 * Source of truth: contracts/${e.id.replace(/^[^.]+\./,``)}.contract.json (${e.id} v${e.version}) 147 * Regenerate with: npm run generate 148 */ 149import { forwardRef${p.some(e=>e.toggles)?`, useState`:``} } from 'react'; 150import type { ${le} } from 'react'; 151${ue}${ue?` 152`:``}import styles from './${o}.module.css'; 153 154${re}${te}${ne}export interface ${o}Props extends ${a.attrs}<${a.el}> { 155${h.join(` 156`)} 157} 158 159/** ${e.description} */ 160export const ${o} = forwardRef<${a.el}, ${o}Props>(function ${o}( 161 { ${g.join(`, `)} }, 162 ref, 163) { 164${y.length>0?y.join(` 165`)+` 166`:``}${w} const classes = [${C.join(`, `)}].filter(Boolean).join(' '); 167 return ( 168 <${P} ${E.join(` `)}> 169 ${N} 170 </${P}> 171 ); 172}); 173`}function _d(e,t){let n=e.name,r=Vu(e),i=Hu(e),a=Y(e),o=Dl(e).some(e=>e.slot.name===`children`),s=qu(e),c=e.events??[],l=new Set(c.filter(e=>e.toggles).map(e=>e.toggles.prop)),u=[],d=[];for(let t of e.props){let n=t.bindings.code.prop,r=t.description?`, description: '${t.description.replace(/'/g,`\\'`)}'`:``;if(Ru(t))u.push(` ${n}: { control: 'select', options: [${t.type.enum.map(e=>`'${e}'`).join(`, `)}]${r} },`),t.default!==void 0&&!l.has(t.name)&&d.push(` ${n}: '${t.default}',`);else if(Bu(t)){u.push(` ${n}: { control: false${r} },`);let i=U(e).find(e=>e.part.repeat?.itemsProp===t.name);i&&d.push(` ${n}: ${JSON.stringify(i.part.repeat.sample)},`)}else t.type===`boolean`?(u.push(` ${n}: { control: 'boolean'${r} },`),d.push(` ${n}: ${t.default===!0},`)):t.type===`number`?(u.push(` ${n}: { control: { type: 'number' }${r} },`),typeof t.default==`number`&&d.push(` ${n}: ${t.default},`)):(u.push(` ${n}: { control: 'text'${r} },`),typeof t.default==`string`&&d.push(` ${n}: '${t.default}',`))}for(let{slot:e}of a)u.push(` ${e.name}: { control: false },`);for(let e of c){let t=(e.description??`Fires when the ${e.trigger} is activated.`).replace(/'/g,`\\'`);u.push(` ${e.bindings.code.prop}: { control: false, description: '${t}' },`)}let f=Dl(e).find(e=>e.slot.name===`children`),p=f&&(f.slot.defaultContent?.length??0)>0?pd(f.slot.defaultContent,t):null;o&&!p&&(u.push(` children: { control: 'text' },`),d.push(` children: 'The quick brown fox jumps over the lazy dog.',`)),p&&u.push(` children: { control: false },`);let m=r.length>0?r[0].type.enum.map(e=>{let t=e.replace(/[^a-zA-Z0-9]+([a-zA-Z0-9])/g,(e,t)=>t.toUpperCase()).replace(/[^a-zA-Z0-9]/g,``),i=Ol(t)===n?`${Ol(t)}Variant`:Ol(t);return/^[A-Za-z_]/.test(i)||(i=`${Ol(r[0].name)}${i}`),` 174export const ${i}: Story = { 175 args: { ${r[0].bindings.code.prop}: '${e}' }, 176};`}).join(` 177`):``,h=new Set;if(p)for(let e of md(f.slot.defaultContent,t))h.add(e);let g=``;for(let{slot:e}of a){let r;if((e.defaultContent?.length??0)>0){r=`<>${pd(e.defaultContent,t)}</>`;for(let n of md(e.defaultContent,t))h.add(n)}else{let n=e.accepts?.[0];if(!n)continue;let i=t.get(n);h.add(i.name);let a=i.props.filter(e=>e.type===`text`&&e.required&&e.bindings.code.prop!==`children`&&typeof e.default==`string`).map(e=>` ${e.bindings.code.prop}="${e.default}"`).join(``);r=i.props.some(e=>e.type===`text`&&e.bindings.code.prop===`children`)?`<${i.name}${a}>${qu(i)}</${i.name}>`:`<${i.name}${a} />`}g+=` 178/** The "${e.name}" slot accepts: ${(e.accepts??[]).join(`, `)||`anything`}. */ 179export const With${Ol(e.name)}
179: Story = { 180 render: (args) => ( 181 <${n} {...args} ${e.name}={${r}} /> 182 ), 183};`}let _=p?` 184 render: (args) => ( 185 <${n} {...args}> 186 ${p.split(` 187`).join(` 188 `)} 189 </${n}> 190 ),`:``,v=``;if(r.length>0&&!p){let t=r[0],i=r.slice(1),a=[[]];for(let e of i){let t=[];for(let n of a)for(let r of e.type.enum)t.push([...n,r]);a=t}let c=e.props.filter(e=>e.type===`text`&&e.required&&typeof e.default==`string`&&e.bindings.code.prop!==`children`).map(e=>`${e.bindings.code.prop}="${e.default}"`),l=[];for(let r of t.type.enum){let u=a.map(a=>{let l=[`${t.bindings.code.prop}="${r}"`,...i.map((e,t)=>`${e.bindings.code.prop}="${a[t]}"`),...c].join(` `);return o||Gu(e).some(e=>e.bindings.code.prop===`children`)?` <${n} ${l}>${s}</${n}>`:` <${n} ${l} />`}).join(` 191`);l.push(u)}let u=a.length;v=` 192/** Every legal combination the contract defines${i.length>0?` (${r.map(e=>e.name).join(` Ã `)})`:``}. */ 193export const Matrix: Story = { 194 parameters: { controls: { disable: true } }, 195 render: () => ( 196 <div 197 style={{ 198 display: 'grid', 199 gap: 16, 200 gridTemplateColumns: 'repeat(${u}, max-content)', 201 alignItems: 'center', 202 justifyItems: 'start', 203 }} 204 > 205${l.join(` 206`)} 207 </div> 208 ), 209};`}let y=i.some(e=>e.name===`disabled`)?` 210export const Disabled: Story = { 211 args: { disabled: true }, 212};`:``,b=[...h].map(e=>`import { ${e} } from '../${e}';`).join(` 213`);return`/** 214 * GENERATED FILE â DO NOT EDIT. 215 * Source of truth: contracts/${e.id.replace(/^[^.]+\./,``)}.contract.json (${e.id} v${e.version}) 216 * Regenerate with: npm run generate 217 */ 218import type { Meta, StoryObj } from '@storybook/react-vite'; 219${b}${b?` 220`:``}import { ${n} } from './${n}'; 221 222const meta = { 223 title: 'Components/${n}', 224 component: ${n}, 225 tags: ['autodocs'], 226 parameters: { 227 docs: { description: { component: ${JSON.stringify(e.description)} } }, 228 },${_} 229 argTypes: { 230${u.join(` 231`)} 232 }, 233 args: { 234${d.join(` 235`)} 236 }, 237} satisfies Meta<typeof ${n}>; 238 239export default meta; 240type Story = StoryObj<typeof meta>; 241 242export const Playground: Story = {}; 243${m}${y}${g}${v} 244`}function vd(e,t){let n=[];ad(e,t.contracts,n,t.icons);let r=cd(e,t.tokens,n);if(n.length>0)throw Error(`Refused â ${n.length} contract violation(s):\n${n.map(e=>` - ${e}`).join(` 245`)}`);return{tsx:gd(e,t.contracts,t.icons,r),css:r,stories:_d(e,t.contracts)}}var yd=e=>/^on[A-Z]/.test(e),bd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[\s_]+/g,`-`).toLowerCase(),xd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim(),X=e=>e.slice(1,-1),Z=e=>`var(--${e.split(`.`).join(`-`)})`;function Sd(e,t){let n=[[]];for(let r of e){let e=[];for(let i of n)for(let n of t.get(r)??[])e.push([...i,[r,n]]);n=e}return n}var Cd=e=>[...e.matchAll(/\{([a-z][\w-]*)\}/g)].map(e=>e[1]),wd={hover:`:hover:not(:disabled)`,active:`:active:not(:disabled)`,"focus-visible":`:focus-visible`,disabled:`:disabled`},Td={top:[`bottom: 100%`,`left: 0`],bottom:[`top: 100%`,`left: 0`],start:[`right: 100%`,`top: 0`],end:[`left: 100%`,`top: 0`]},Ed={start:`flex-start`,center:`center`,end:`flex-end`,stretch:`stretch`,baseline:`baseline`},Dd={start:`flex-start`,center:`center`,end:`flex-end`,"space-between":`space-between`};function Od(e){let t=[];return e.display&&t.push(`display: ${e.display}`),e.direction&&t.push(`flex-direction: ${e.direction}`),e.align&&t.push(`align-items: ${Ed[e.align]}`),e.justify&&t.push(`justify-content: ${Dd[e.justify]}`),t}var kd=e=>!!(e.parts||e.slot||e.layout||e.layoutByProp)&&!e.content&&!e.component;function Ad(e,t,n=!1){let r=[];return n&&r.push(...nd(e)),kd(e)&&(e.layout?.display===`grid`?r.push(...ed(e.layout,Z,t)):(r.push(`display: ${e.layout?.display??`flex`}`),e.layout?.direction&&r.push(`flex-direction: ${e.layout.direction}`),e.layout?.wrap&&r.push(`flex-wrap: wrap`),e.layout?.align&&r.push(`align-items: ${Ed[e.layout.align]}`),e.layout?.justify&&r.push(`justify-content: ${Dd[e.layout.justify]}`))),e.layout?.grow&&r.push(`flex: 1 1 auto`,`min-width: 0`),r}function jd(e){let t=bd(e.name),n=`.${t}`,r=e=>`.${t}__${e}`,i=(e,n)=>`.${t}--${e}-${n}`,a=new Map(Vu(e).map(e=>[e.name,e.type.enum])),o=rd(e),s=t=>`${e.id}.anatomy.${t}.layout.gap`,c=e=>(o.placeholders.get(e)??[]).map(e=>[r(e),[`grid-area: ${e}`]]),l=[`/* ${e.name} â from ${e.id} v${e.version} (core/emit-html.ts) */`,``,`.${t}, .${t} *, .${t} *::before, .${t} *::after {`,` box-sizing: border-box;`,`}`];if(Pu(e)){let t=(e,t)=>{t.length!==0&&l.push(``,`${e} {`,...t.map(e=>` ${e};`),`}`)};for(let{name:n,part:i}of U(e)){if(i.component){let e=o.cells.get(n);e&&t(r(n),[...e,`display: grid`]);continue}let e=Ad(i,s(n),o.gridChildren.has(n));e.push(...o.cells.get(n)??[]),i.element&&Ou.has(i.element)&&e.push(`margin: 0`),i.overlay&&e.push(`position: absolute`,...Td[i.overlay.placement]),i.shape&&e.push(...ol(i.shape)),i.element===`button`&&e.push(`appearance: none`,`background: none`,`border: none`,`font: inherit`,`color: inherit`,`cursor: pointer`),i.icon&&(e.push(`display: inline-flex`,`flex-shrink: 0`),i.icon.size&&l.push(``,`${r(n)} svg {`,` width: ${i.icon.size}px;`,` height: ${i.icon.size}px;`,`}`));for(let[t,n]of Object.entries(i.tokens??{})){let r=X(n);Cd(r).length>0||e.push(`${t}: ${Z(r)}`)}for(let[t,n]of Object.entries(i.literals??{}))e.push(`${t}: ${n}`);for(let[t,n]of Object.entries(i.declared??{}))e.push(`${t}: ${n}`);t(r(n),e);for(let[e,r]of c(n))t(e,r)}return l}let u=e.anatomy.root,d=[];u.layout?u.layout.display===`grid`?d.push(...ed(u.layout,Z,s(`root`))):(d.push(`display: ${u.layout.display??`flex`}`),u.layout.direction&&d.push(`flex-direction: ${u.layout.direction}`),u.layout.wrap&&d.push(`flex-wrap: wrap`),u.layout.align&&d.push(`align-items: ${Ed[u.layout.align]}`),u.layout.justify&&d.push(`justify-content: ${Dd[u.layout.justify]}`)):d.push(`display: inline-flex`,`align-items: center`,`justify-content: center`);let f=u.tokens??{};ju(e).some(e=>Ou.has(e))&&d.push(`margin: 0`);let p=u.literals??{};`border-width`in f||`border-width`in p?d.push(`border-style: solid`):d.push(`border: 0`),d.push(...al(p,`literals`,u.declared));let m=`max-width`in f&&`height`in f&&Object.keys(u.parts??{}).length>0&&Object.values(u.parts??{}).every(e=>e.slot!==void 0);`max-width`in f&&(u.hugsBelowMaxWidth!==!0&&d.push(`width: 100%`),m||d.push(`min-width: fit-content`));let h=!!u.declared?.cursor||!!u.declaredStates?.disabled?.cursor;e.semantics.element===`button`&&!h&&d.push(`cursor: pointer`),U(e).some(e=>e.part.overlay||(e.part.stylesWhen??[]).some(e=>e.styles.position===`absolute`))&&d.push(`position: relative`);let g=new Map,_=[],v=[];for(let[e,t]of Object.entries(f)){let r=X(t);if(e===`gap`&&u.layout?.overlap){let e=Cd(r);if(e.length===1)for(let t of a.get(e[0])??[]){let n=r.replaceAll(`{${e[0]}}`,t);v.push([`${i(e[0],t)} > * + *`,[`margin-left: ${Z(n)}`]])}else v.push([`${n} > * + *`,[`margin-left: ${Z(r)}`]]);continue}let o=Cd(r),s=m&&e===`max-width`;if(o.length===0)d.push(`${e}: ${Z(r)}`),s&&d.push(`min-width: ${Z(r)}`);else if(o.length===1)for(let t of a.get(o[0])??[]){let n=r.replaceAll(`{${o[0]}}`,t),i=`${o[0]}�${t}`,a=g.get(i)??{prop:o[0],value:t,decls:[]};a.decls.push(`${e}: ${Z(n)}`),s&&a.decls.push(`min-width: ${Z(n)}`),g.set(i,a)}else if(o.length===2){let[t,n]=o;for(let o of a.get(t)??[])for(let s of a.get(n)??[]){let a=r.replaceAll(`{${t}}`,o).replaceAll(`{${n}}`,s);_.push({selector:`${i(t,o)}${i(n,s)}`,decls:[`${e}: ${Z(a)}`]})}}else if(o.length===3){let[t,n,s]=o;for(let o of a.get(t)??[])for(let c of a.get(n)??[])for(let l of a.get(s)??[]){let a=r.replaceAll(`{${t}}`,o).replaceAll(`{${n}}`,c).replaceAll(`{${s}}`,l);_.push({selector:`${i(t,o)}${i(n,c)}${i(s,l)}`,decls:[`${e}: ${Z(a)}`]})}}}for(let{prop:e,map:t}of Cl(u))for(let[n,r]of Object.entries(t)){for(let[t,o]of Object.entries(r)){let r=X(o),s=Cd(r),c=m&&t===`max-width`;if(s.length===1){for(let o of a.get(s[0])??[]){let a=r.replaceAll(`{${s[0]}}`,o);
245_.push({selector:`${i(e,n)}${i(s[0],o)}`,decls:c?[`${t}: ${Z(a)}`,`min-width: ${Z(a)}`]:[`${t}: ${Z(a)}`]})}continue}let l=`${e} ${n}`,u=g.get(l)??{prop:e,value:n,decls:[]};u.decls.push(`${t}: ${Z(r)}`),c&&u.decls.push(`min-width: ${Z(r)}`),g.set(l,u)}for(let t of al(r,`tokens`,u.declared)){let r=`${e} ${n}`,i=g.get(r)??{prop:e,value:n,decls:[]};i.decls.push(t),g.set(r,i)}}for(let[e,t]of Object.entries(u.literals??{}))d.push(`${e}: ${t}`);for(let[e,t]of Object.entries(u.declared??{})){if(e===`position`&&d.includes(`position: relative`)){if(t===`relative`)continue;d.splice(d.indexOf(`position: relative`),1)}d.push(`${e}: ${t}`)}for(let{prop:e,map:t}of u.literalsByProp??[])for(let[n,r]of Object.entries(t)){let t=`${e} ${n}`;for(let[i,a]of Object.entries(r)){let r=g.get(t)??{prop:e,value:n,decls:[]};r.decls.push(`${i}: ${a}`),g.set(t,r)}for(let i of al(r,`literals`,u.declared)){let r=g.get(t)??{prop:e,value:n,decls:[]};r.decls.push(i),g.set(t,r)}}let y=(e,t)=>{t.length!==0&&l.push(``,`${e} {`,...t.map(e=>` ${e};`),`}`)},b=e.a11y?.minHitArea;typeof b==`number`&&!d.includes(`position: relative`)&&d.push(`position: relative`),y(n,d);for(let[e,t]of c(`root`))y(e,t);for(let[e,t]of v)y(e,t);typeof b==`number`&&y(`${n}::before`,[`content: ''`,`position: absolute`,`left: 50%`,`top: 50%`,`width: max(100%, ${b}px)`,`height: max(100%, ${b}px)`,`transform: translate(-50%, -50%)`]),e.states.includes(`focus-visible`)&&y(`${n}:focus-visible`,[`outline-style: solid`,`outline-offset: 2px`]),e.states.includes(`disabled`)&&e.semantics.element===`button`&&!h&&y(`${n}:disabled`,[`cursor: not-allowed`]);for(let{prop:e,value:t,decls:n}of g.values())y(i(e,t),n);if(u.layoutByProp)for(let[e,t]of Object.entries(u.layoutByProp.map))y(i(u.layoutByProp.prop,e),Od(t));for(let{selector:e,decls:t}of _)y(e,t);for(let[e,t]of Object.entries(u.states??{})){let r=wd[e];if(r)for(let[e,o]of Object.entries(t)){let t=X(o),s=Cd(t);if(s.length===0)y(`${n}${r}`,[`${e}: ${Z(t)}`]);else if(s.length===1)for(let n of a.get(s[0])??[]){let a=t.replaceAll(`{${s[0]}}`,n);y(`${i(s[0],n)}${r}`,[`${e}: ${Z(a)}`])}}}for(let e of u.statesByProp??[]){let t=wd[e.state];if(t)for(let[n,r]of Object.entries(e.map))for(let[a,o]of Object.entries(r))y(`${i(e.prop,n)}${t}`,[`${a}: ${Z(X(o))}`])}for(let[e,t]of Object.entries(u.declaredStates??{})){let r=wd[e];r&&y(`${n}${r}`,Object.entries(t).map(([e,t])=>`${e}: ${t}`))}let x=t=>{let r=e.props.find(e=>e.name===t);if(!r||Ru(r))return null;let i=t.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();return`${n}[data-${i}]`},S=(t,n,r)=>{for(let a of t.stylesWhen??[]){let t=e.props.find(e=>
245e.name===a.prop);if(!t)continue;let o=Ru(t)?i(a.prop,a.equals??``):x(a.prop),s=r?o:`${o} ${n}`;y(s,Object.entries(a.styles).map(([e,t])=>`${e}: ${t}`))}};S(u,n,!0);let C=new Set;for(let{name:l,part:u,path:d}of U(e)){if(d[0]===`root`&&d.length===1)continue;if(u.component){let e=o.cells.get(l);e&&y(r(l),[...e,`display: grid`]);continue}let f=Ad(u,s(l),o.gridChildren.has(l));f.push(...o.cells.get(l)??[]),u.element&&Ou.has(u.element)&&f.push(`margin: 0`),u.overlay&&f.push(`position: absolute`,...Td[u.overlay.placement]),u.shape&&f.push(...ol(u.shape)),u.element===`button`&&(e.events??[]).some(e=>e.trigger===l)&&f.push(`appearance: none`,`background: none`,`border: none`,`margin: 0`,`padding: 0`,`font: inherit`,`color: inherit`,`text-align: inherit`,`cursor: pointer`),!Tl(u)&&(u.element===`input`||u.element===`textarea`||u.element===`select`)&&f.push(`appearance: none`,`border: none`,`background: transparent`,`font: inherit`,`color: inherit`,`letter-spacing: inherit`,`margin: 0`,`padding: 0`,`outline: none`),Tl(u)&&f.push(`position: absolute`,`inset: 0`,`width: 100%`,`height: 100%`,`margin: 0`,`padding: 0`,`opacity: 0`,`cursor: pointer`),u.icon&&(f.push(`display: inline-flex`,`flex-shrink: 0`),y(`${r(l)} svg`,[`display: block`,...u.icon.size?[`width: ${u.icon.size}px`,`height: ${u.icon.size}px`]:[]]),u.element===`button`&&f.push(`align-items: center`,`justify-content: center`,`background: none`,`border: none`,`padding: 0`,`color: inherit`,`cursor: pointer`)),u.animation&&(f.push(u.animation===`spin`?`animation: ${t}-spin 0.8s linear infinite`:`animation: ${t}-pulse 1.6s ease-in-out infinite`),C.add(u.animation));let p=[];for(let[e,t]of Object.entries(u.tokens??{})){let n=X(t);if(e===`gap`&&u.layout?.overlap){let e=Cd(n);if(e.length===1)for(let t of a.get(e[0])??[]){let a=n.replaceAll(`{${e[0]}}`,t);p.push([`${i(e[0],t)} ${r(l)} > * + *`,[`margin-left: ${Z(a)}`]])}else p.push([`${r(l)} > * + *`,[`margin-left: ${Z(n)}`]]);continue}let o=Cd(n);if(o.length>=1){for(let t of Sd(o,a)){let a=n;for(let[e,n]of t)a=a.replaceAll(`{${e}}`,n);let o=`${t.map(([e,t])=>i(e,t)).join(``)} ${r(l)}`;p.push([o,[`${e}: ${Z(a)}`]])}continue}f.push(`${e}: ${Z(n)}`)}(u.tokens&&`border-width`in u.tokens||u.literals&&`border-width`in u.literals)&&f.push(`border-style: solid`),f.push(...al(u.literals,`literals`,u.declared));for(let[e,t]of Object.entries(u.literals??{}))f.push(`${e}: ${t}`);for(let[e,t]of Object.entries(u.declared??{}))f.push(`${e}: ${t}`);u.element===`img`&&u.declared?.position===`absolute`&&f.push(`width: 100%`,`height: 100%`);for(let[e,t]of Object.entries(u.declaredStates??{})){let i=wd[e];i&&p.push([`${n}${i} ${r(l)}`,Object.entries(t).map(([e,t])=>`${e}: ${t}`)])}for(let e of u.literalsByProp??[])for(let[t,n]of Object.entries(e.map))p.push([`${i(e.prop,t)} ${r(l)}`,[...Object.entries(n).map(([e,t])=>`${e}: ${t}`),...al(n,`literals`,u.declared)]]);for(let[e,t]of Object.entries(u.parts??{}))Tl(t)&&(f.push(`position: relative`),p.push([`${r(l)}:has(> ${r(e)}:focus-visible)`,[`outline-style: solid`,`outline-offset: 2px`]]));y(r(l),f);for(let[e,t]of c(l))y(e,t);for(let[e,t]of p)y(e,t);for(let e of Cl(u))for(let[t,n]of Object.entries(e.map)){let o=[];for(let[s,c]of Object.entries(n)){let n=X(c),u=Cd(n);if(u.length===1){for(let o of a.get(u[0])??[]){let a=n.replaceAll(`{${u[0]}}`,o);y(`${i(e.prop,t)}${i(u[0],o)} ${r(l)}`,[`${s}: ${Z(a)}`])}continue}o.push(`${s}: ${Z(n)}`)}o.push(...al(n,`tokens`,u.declared)),o.length>0&&y(`${i(e.prop,t)} ${r(l)}`,o)}for(let[e,t]of Object.entries(u.states??{})){let o=wd[e];if(o)for(let[e,s]of Object.entries(t)){let t=X(s),c=Cd(t);if(c.length===0)y(`${n}${o} ${r(l)}`,[`${e}: ${Z(t)}`]);else if(c.length===1)for(let n of a.get(c[0])??[]){let a=t.replaceAll(`{${c[0]}}`,n);y(`${i(c[0],n)}${o} ${r(l)}`,[`${e}: ${Z(a)}`])}}}for(let e of u.statesByProp??[]){let t=wd[e.state];if(t)for(let[n,a]of Object.entries(e.map))for(let[o,s]of Object.entries(a))y(`${i(e.prop,n)}${t} ${r(l)}`,[`${o}: ${Z(X(s))}`])}if(u.layoutByProp)for(let[e,t]of Object.entries(u.layoutByProp.map))y(`${i(u.layoutByProp.prop,e)} ${r(l)}`,Od(t));S(u,r(l),!1),u.icon&&u.element&&y(`${r(l)}-glyph`,[`display: inline-flex`])}return C.has(`spin`)&&l.push(``,`@keyframes ${t}
245-spin {`,` to { transform: rotate(360deg); }`,`}`),C.has(`pulse`)&&l.push(``,`@keyframes ${t}-pulse {`,` 0%, 100% { opacity: 1; }`,` 50% { opacity: 0.45; }`,`}`),l}var Md=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`),Nd=/^[A-Za-z][A-Za-z0-9-]*$/,Pd=/^[A-Za-z_:][A-Za-z0-9_.:-]*$/,Fd=/^[A-Za-z0-9_-]+$/,Id=/^[a-z][a-z0-9-]*$/,Ld=(e,t,n)=>{throw Error(`Refused â unsafe static HTML ${e} ${JSON.stringify(t)} at ${n}`)},Rd=(e,t)=>(Id.test(e)||Ld(`role`,e,t),e),zd=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`--`,`--`);function Bd(e,t){let n=new Set,r=e=>{if(n.has(e.id))return;n.add(e.id);let i=bd(e.name);Fd.test(i)||Ld(`component class fragment`,i,`${e.id}.name`),Nd.test(e.semantics.element)||Ld(`element name`,e.semantics.element,`${e.id}.semantics.element`),e.semantics.role&&Rd(e.semantics.role,`${e.id}.semantics.role`);for(let[t,n]of Object.entries(e.semantics.roleByProp?.map??{}))Rd(n,`${e.id}.semantics.roleByProp.map.${t}`);for(let[t,n]of Object.entries(e.semantics.elementByProp?.map??{}))Nd.test(n)||Ld(`element name`,n,`${e.id}.semantics.elementByProp.map.${t}`);for(let t of Vu(e)){Fd.test(t.name)||Ld(`class fragment`,t.name,`${e.id}.props.${t.name}.name`);for(let n of t.type.enum)Fd.test(n)||Ld(`enum class fragment`,n,`${e.id}.props.${t.name}.type.enum`)}for(let{name:n,part:i,path:a}of U(e)){let o=`${e.id}.anatomy.${a.join(`.`)}`;Fd.test(n)||Ld(`part class fragment`,n,o),i.element&&!Nd.test(i.element)&&Ld(`element name`,i.element,`${o}.element`);for(let[e,t]of Object.entries(i.attrs??{}))(!Pd.test(e)||/^on/i.test(e))&&Ld(`attribute name`,e,`${o}.attrs`),e.toLowerCase()===`role`&&!/^\{[a-z][\w-]*\}$/.test(t)&&Rd(t,`${o}.attrs.role`);if(i.component){let e=t.contracts.get(i.component.id);e&&r(e)}for(let e of i.slot?.defaultContent??[]){let n=t.contracts.get(e.id);n&&r(n)}}};r(e)}function Vd(e,t,n,r,i){let a=bd(e.name),o=e.anatomy.root,s=rd(e),c=(e,t)=>(s.placeholders.get(e)??[]).map(e=>`${t}<div class="${a}__${e}"><!-- ${zd(e)} area: empty (grid placeholder) --></div>`),l=e=>{let t=Gu(e).find(e=>e.bindings.code.prop===`children`);return t?typeof t.default==`string`?t.default:e.name:``},u=e=>n.subst[e],d=t=>{let r=e.props.find(e=>e.type===`text`&&e.bindings.code.prop===t);return r&&n.subst[r.name]!==void 0?n.subst[r.name]:typeof r?.default==`string`?r.default:e.name},f=e=>{if(!e.visibleWhen)return!0;let t=e.visibleWhen;return t.equals===void 0?n.bools[t.prop]===!0:(u(t.prop)??``)===t.equals},p=t=>Object.entries(t.attrs??{}).map(([t,n])=>{let r=n.match(/^\{([a-z][\w-]*)\}$/);if(!r)return` ${t}
245="${Md(t.toLowerCase()===`role`?Rd(n,`${e.id}.attrs.${t}`):n)}"`;let i=e.props.find(e=>e.name===r[1]),a=u(r[1])??(i?.default===void 0?``:String(i.default));return` ${t}="${Md(t.toLowerCase()===`role`?Rd(a,`${e.id}.attrs.${t}`):a)}"`}).join(``),m=(n,r,o,l=`div`)=>{if(!f(r))return``;let h=`${a}__${n}`,g=r.element??(l===`select`?`option`:`span`);if(r.icon){let n=r.icon.asset.match(/^\{([a-z][\w-]*)\}$/),i=n?u(n[1])??String(e.props.find(e=>e.name===n[1])?.default??``):r.icon.asset,a=t.icons.get(i)??``;return r.element?`${o}<${r.element} class="${h}"${p(r)}><span class="${h}-glyph" aria-hidden="true">${a}</span></${r.element}>`:`${o}<span class="${h}" aria-hidden="true">${a}</span>`}if(r.repeat&&r.component){let e=t.contracts.get(r.component.id);return r.repeat.sample.map(n=>{let i={subst:{},bools:{}};for(let t of Vu(e))i.subst[t.name]=String(t.default??t.type.enum[0]);for(let t of Hu(e))i.bools[t.name]=t.default===!0;for(let[e,t]of Object.entries(r.component.props??{})){if(typeof t==`boolean`){i.bools[e]=t;continue}if(typeof t==`object`){let n=t.map[u(t.prop)??``];n!==void 0&&(i.subst[e]=n);continue}let n=t.match(/^\{([a-z][\w-]*)\}$/);i.subst[e]=n?u(n[1])??t:t}let a;for(let[t,r]of Object.entries(n)){let n=e.props.find(e=>e.name===t);if(typeof r==`boolean`){i.bools[t]=r;continue}if(n?.bindings.code.prop===`children`){a=String(r);continue}i.subst[t]=String(r)}return Vd(e,t,i,o,a)}).join(` 246`)}if(r.component){let e=t.contracts.get(r.component.id),i={subst:{},bools:{}};for(let t of Vu(e))i.subst[t.name]=String(t.default??t.type.enum[0]);for(let t of Hu(e))i.bools[t.name]=t.default===!0;for(let[e,t]of Object.entries(r.component.props??{})){if(typeof t==`boolean`){i.bools[e]=t;continue}if(typeof t==`object`){let n=t.map[u(t.prop)??``];n!==void 0&&(i.subst[e]=n);continue}let n=t.match(/^\{([a-z][\w-]*)\}$/);i.subst[e]=n?u(n[1])??t:t}return s.wrappedInstances.has(n)?`${o}<div class="${h}">\n${Vd(e,t,i,o+` `,r.component.text??void 0)}\n${o}</div>`:Vd(e,t,i,o,r.component.text??void 0)}if(r.slot){let e=r.element??`div`,n=r.slot.defaultContent??[];if(n.length===0)return`${o}<${e} class="${h}"${p(r)}><!-- ${zd(r.slot.name)} slot: no content --></${e}>`;let i=n.map(e=>{let n=t.contracts.get(e.id),r={subst:{},bools:{}};for(let e of Vu(n))r.subst[e.name]=String(e.default??e.type.enum[0]);for(let e of Hu(n))r.bools[e.name]=e.default===!0;for(let[t,n]of Object.entries(e.props??{}))typeof n==`boolean`?r.bools[t]=n:r.subst[t]=n;return Vd(n,t,r,o+` `,e.text)}).join(` 247`);return`${o}<${e} class="${h}"${p(r)}>\n${i}\n${o}</${e}>`}if(r.content||r.text!==void 0){let e=r.textByProp?r.textByProp.map[u(r.textByProp.prop)??``]??r.text:r.text,t=r.content?r.content.prop===`children`&&i!==void 0?i:d(r.content.prop):e,n=Object.entries(r.parts??{}).map(([e,t])=>m(e,t,o+` `,g)).filter(Boolean).join(` 248`);return n?`${o}<${g} class="${h}"${p(r)}>${Md(t)}\n${n}\n${o}</${g}>`:`${o}<${g} class="${h}"${p(r)}>${Md(t)}</${g}>`}if(r.meter){let t=(t,n)=>{let r=e.props.find(e=>e.name===t);return typeof r?.default==`number`?r.default:n};return`${o}<div class="${h}" style="width: ${Math.min(100,Math.max(0,t(r.meter.valueProp,0)/(t(r.meter.maxProp,100)||100)*100))}%"></div>`}if(Tl(r)){let t=(e.events??[]).find(e=>e.trigger===n&&e.toggles),i=``,a=``;if(t?.toggles){let[e,n]=t.toggles.between,r=u(t.toggles.prop);r===n?i=` checked`:r!==void 0&&r!==e&&(a=`\n${o}<!-- value "${zd(r)}" is a DOM property (el.indeterminate = true), not an attribute â static HTML shows it via the glyph only. AT reads this input as unchecked here: a script-less surface cannot set the property (declared fidelity limit); the React surface sets it via callback ref -->`)}return`${o}<input class="${h}"${p(r)}${i}>${a}`}let _=r.element??`div`,v=[...Object.entries(r.parts??{}).map(([e,t])=>m(e,t,o+` `,_)),...c(n,o+` `)].filter(Boolean).join(` 249`);return v?`${o}<${_} class="${h}"${p(r)}>\n${v}\n${o}</${_}>`:`${o}<${_} class="${h}"${p(r)}></${_}>`};if(Pu(e))return Mu(e).map(([e,t])=>m(e,t,r)).filter(Boolean).join(` 250`);let h=e.semantics.elementByProp,g=h?h.map[u(h.prop)??``]??e.semantics.element:e.semantics.element,_=ne
250w Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),v=e=>e.parts!==void 0||e.component!==void 0||e.icon!==void 0||e.slot!==void 0||e.repeat!==void 0||e.meter!==void 0||e.element!==void 0&&e.element!==`option`&&e.element!==`optgroup`,y=Object.entries(o.parts??{}),b=y.length>0&&(g===`textarea`||_.has(g)||g===`select`&&y.some(([,e])=>v(e))),x=b?`div`:g,S=b?`${r}<!-- root element "${zd(g)}" cannot host the drawn anatomy (${g===`textarea`?`raw-text content model â child markup would render as literal text`:_.has(g)?`void element â children would hoist out of the box`:`select drops non-option children`}); box projected as <div>, element inference stays on the contract -->\n`:``,C=[`class="${[a,...Vu(e).filter(e=>n.subst[e.name]!==void 0).map(e=>`${a}--${e.name}-${n.subst[e.name]}`)].join(` `)}"`];for(let[t,n]of Object.entries(o.attrs??{})){let r=n.match(/^\{([a-z][\w-]*)\}$/);if(!r){let r=t.toLowerCase()===`role`?Rd(n,`${e.id}.anatomy.root.attrs.role`):n;C.push(`${t}="${Md(r)}"`);continue}let i=e.props.find(e=>e.name===r[1]),a=u(r[1])??(i?.default===void 0?``:String(i.default)),o=t.toLowerCase()===`role`?Rd(a,`${e.id}.anatomy.root.attrs.role`):a;C.push(`${t}="${Md(o)}"`)}let w=[`button`,`input`,`textarea`,`select`,`fieldset`].includes(x);for(let t of Hu(e)){if(!n.bools[t.name])continue;if(t.name===`disabled`&&w){C.push(`disabled`);continue}let e=t.name.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();C.push(`data-${e}="true"`)}let T=e.semantics.roleByProp;if(T){let t=T.map[u(T.prop)??``];t&&C.push(`role="${Md(Rd(t,`${e.id}.semantics.roleByProp`))}"`)}else e.semantics.role&&e.semantics.role!==e.semantics.element&&C.push(`role="${Md(Rd(e.semantics.role,`${e.id}.semantics.role`))}"`);let E=Md(i??l(e)),ee=o.parts||s.placeholders.has(`root`)?[...Object.entries(o.parts??{}).map(([e,t])=>m(e,t,r+` `,x)),...c(`root`,r+` `)].filter(Boolean).join(` 251`):x===`select`?`${r} <option>${E}</option>`:`${r} ${E}`;return`${S}${r}<${x} ${C.join(` `)}>\n${ee}\n${r}</${x}>`}function Hd(e,t){Bd(e,t);let n=[];if(ad(e,t.contracts,n,t.icons),n.length>0)throw Error(`Refused â ${n.length} contract violation(s):\n${n.map(e=>` - ${e}`).join(` 252`)}`);let r=bd(e.name),i=[],a=new Set,o=e=>{if(!a.has(e.id)){a.add(e.id);for(let n of U(e)){n.part.component&&o(t.contracts.get(n.part.component.id));for(let e of n.part.slot?.defaultContent??[])o(t.contracts.get(e.id))}i.push(ld(jd(e).join(` 253`)))}};o(e);let s=()=>{let t={subst:{},bools:{}};for(let n of Vu(e))n.default!==void 0&&(t.subst[n.name]=String(n.default));for(let n of Hu(e))t.bools[n.name]=n.default===!0;return t},c=[],l=(n,r)=>{c.push(` <div class="showcase__item">\n <p class="showcase__label">${Md(n)}</p>\n${Vd(e,t,r,` `)}\n </div>`)};l(`default`,s());for(let t of Vu(e))for(let e of t.type.enum){if(e===String(t.default??``))continue;let n=s();n.subst[t.name]=e,l(`${t.name}=${e}`,n)}for(let t of Hu(e)){if(t.default===!0)continue;let e=s();e.bools[t.name]=!0,l(`${t.name}=true`,e)}let u=`<!-- 254 ${zd(e.name)} â static HTML+CSS emitted from contract ${e.id} v${e.version} by core/emit-html.ts. 255 Token values arrive via CSS custom properties (the same custom-property names the CSS Modules 256 bind) â include the token stylesheet (src/styles/tokens.css) on the page or nothing resolves. 257 Fidelity: no events, no interactivity beyond CSS states (:hover/:focus-visible/:disabled). 258 Slots render their declared defaultContent; an empty slot renders its wrapper empty (absent content 259 is absent â named in an inline comment, never painted as placeholder text). Booleans render per showcase item. 260-->`,d=[`.showcase { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; font-family: sans-serif; }`,`.showcase__label { margin: 0 0 8px; font: 12px/1 monospace; opacity: 0.6; }`].join(` 261`);return{html:`${u}\n<section class="showcase showcase--${r}">\n${c.join(` 262`)}\n</section>\n`,css:`${i.join(` 263 264`)}\n\n/* showcase chrome */\n${d}\n`}}var Ud={start:`flex-start`,center:`center`,end:`flex-end`,stretch:`stretch`,baseline:`baseline`},Wd={start:`flex-start`,center:`center`,end:`flex-end`,"space-between":`space-between`},Gd={top:{bottom:`100%`,left:0},bottom:{top:`100%`,left:0},start:{right:`100%`,top:0},end:{left:`100%`,top:0}},Kd=e=>e.slice(1,-1),qd=e=>[...e.matchAll(/\{([a-z][\w-]*)\}/g)].map(e=>e[1]),Jd=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),Yd=(e,t,n,r)=>{for(let i of al(t,n,r)){let t=i.indexOf(`: `);e[Jd(i.slice(0,t))]=i.slice(t+2)}},Xd=e=>!!(e.parts||e.slot||e.layout||e.layoutByProp)&&!e.content&&!e.component;function Zd(e,t){let n=[];if(ad(e,t.contracts,n,t.icons),n.length>0)throw Error(`Refused â ${n.length} contract violation(s):\n${n.map(e=>` - ${e}`).join(` 265`)}`);let r=t.mode??`light`,i=zl(t.tokens.primitives),a=zl(t.tokens.semantic),o=zl(r===`dark`?t.tokens.dark:t.tokens.light),s=t.tokens.brands.default?zl(t.tokens.brands.default):new Map,c=q(new Map([...i,...s,...a,...o])),l=e=>{let t=c(e);return typeof t==`number`?t:String(t)},u=rd(e),d=e=>{let t=l(e);return typeof t==`number`?`${t}px`:t},f=(e,t)=>{for(let n of t){let t=n.indexOf(`: `);e[Jd(n.slice(0,t))]=n.slice(t+2)}},p=e.name,m=Vu(e),h=Hu(e),g=e.events??[],_=t=>e.props.find(e=>e.name===t)?.bindings.code.prop??t,v={},y={},b=new Map,x=(e,t,n,r)=>{let i=`${e}-${t}`;y[i]??={},y[i][n]={...y[i][n]??{},...r},b.has(n)||b.set(n,new Set),b.get(n).add(e)},S={},C=new Map,w=(e,t,n)=>{let r=e.map(([e,t])=>`${e}-${t}`).join(`+`);S[r]??={},S[r][t]={...S[r][t]??{},...n},C.has(t)||C.set(t,new Set),C.get(t).add(e.map(([e])=>e).join(`+`))},T=new Map(m.map(e=>[e.name,e.type.enum])),E=new Map([...T,...h.map(e=>[e.name,[`true`,`false`]])]),ee=new Set,te=e=>`max-width`in(e.tokens??{})&&`height`in(e.tokens??{})&&Object.keys(e.parts??{}).length>0&&Object.values(e.parts??{}).every(e=>e.slot!==void 0),ne=(t,n,r)=>{let i={};if(f(i,u.cells.get(t)??[]),u.gridChildren.has(t)&&f(i,nd(n)),r){n.layout?n.layout.display===`grid`?f(i,ed(n.layout,d,`${e.
265id}.anatomy.${t}.layout.gap`)):(i.display=n.layout.display??`flex`,n.layout.direction&&(i.flexDirection=n.layout.direction),n.layout.wrap&&(i.flexWrap=`wrap`),n.layout.align&&(i.alignItems=Ud[n.layout.align]),n.layout.justify&&(i.justifyContent=Wd[n.layout.justify])):(i.display=`inline-flex`,i.alignItems=`center`,i.justifyContent=`center`);let r=n.tokens??{};ju(e).some(e=>Ou.has(e))&&(i.margin=0),`border-width`in r||`border-width`in(n.literals??{})?i.borderStyle=`solid`:i.border=0,Yd(i,n.literals,`literals`,n.declared);let a=te(n);if(`max-width`in r)if(i.width=`100%`,a){let e=Kd(r[`max-width`]);qd(e).length===0&&(i.minWidth=l(e))}else i.minWidth=`fit-content`;e.semantics.element===`button`&&(i.cursor=`pointer`),U(e).some(e=>e.part.overlay||(e.part.stylesWhen??[]).some(e=>e.styles.position===`absolute`))&&(i.position=`relative`)}else{if(Xd(n)&&(n.layout?.display===`grid`?f(i,ed(n.layout,d,`${e.id}.anatomy.${t}.layout.gap`)):(i.display=n.layout?.display??`flex`,n.layout?.direction&&(i.flexDirection=n.layout.direction),n.layout?.wrap&&(i.flexWrap=`wrap`),n.layout?.align&&(i.alignItems=Ud[n.layout.align]),n.layout?.justify&&(i.justifyContent=Wd[n.layout.justify]))),n.layout?.grow&&(i.flex=`1 1 auto`,i.minWidth=0),n.overlay&&Object.assign(i,{position:`absolute`},Gd[n.overlay.placement]),n.shape)for(let e of ol(n.shape)){let t=e.indexOf(`: `);i[Jd(e.slice(0,t))]=e.slice(t+2)}n.element===`button`&&g.some(e=>e.trigger===t)&&Object.assign(i,{appearance:`none`,background:`none`,border:`none`,margin:0,padding:0,font:`inherit`,color:`inherit`,textAlign:`inherit`,cursor:`pointer`}),Tl(n)&&Object.assign(i,{position:`absolute`,inset:0,width:`100%`,height:`100%`,margin:0,padding:0,opacity:0,cursor:`pointer`}),Object.values(n.parts??{}).some(e=>Tl(e))&&(i.position=`relative`),n.icon&&(i.display=`inline-flex`,i.flexShrink=0,n.element===`button`&&Object.assign(i,{alignItems:`center`,justifyContent:`center`,background:`none`,border:`none`,padding:0,color:`inherit`,cursor:`pointer`})),n.animation&&(i.animation=n.animation===`spin`?`ds-inline-spin 0.8s linear infinite`:`ds-inline-pulse 1.6s ease-in-out infinite`,ee.add(n.animation)),(n.tokens&&`border-width`in n.tokens||n.literals&&`border-width`in n.literals)&&(i.borderStyle=`solid`),Yd(i,n.literals,`literals`,n.declared)}for(let[e,r]of Object.entries(n.tokens??{})){let a=Kd(r);if(e===`gap`&&n.layout?.overlap)continue;let o=qd(a);if(o.length===0)i[Jd(e)]=l(a);else if(o.length===1)for(let n of E.get(o[0])??[]){let r=a.replaceAll(`{${o[0]}}`,n);x(o[0],n,t,{[Jd(e)]:l(r)})}else if(o.length===2){let[n,r]=o;for(let i of E.get(n)??[])for(let o of E.get(r)??[]){let s=a.replaceAll(`{${n}}`,i).replaceAll(`{${r}}`,o);w([[n,i],[r,o]],t,{[Jd(e)]:l(s)})}}else if(o.length===3){let[n,r,i]=o;for(let o of E.get(n)??[])for(let s of E.get(r)??[])for(let c of E.get(i)??[]){let u=a.replaceAll(`{${n}}`,o).replaceAll(`{${r}}`,s).replaceAll(`{${i}}`,c);w([[n,o],[r,s],[i,c]],t,{[Jd(e)]:l(u)})}}}for(let e of Cl(n))for(let[i,a]of Object.entries(e.map)){let o={};for(let[e,t]of Object.entries(a))o[Jd(e)]=l(Kd(t)),r&&e===`max-width`&&te(n)&&(o.minWidth=l(Kd(t)));Yd(o,a,`tokens`,n.declared),x(e.prop,i,t,o)}for(let[e,t]of Object.entries(n.literals??{}))i[Jd(e)]=t;for(let e of n.literalsByProp??[])for(let[r,i]of Object.entries(e.map)){let a={};for(let[e,t]of Object.entries(i))a[Jd(e)]=t;Yd(a,i,`literals`,n.declared),x(e.prop,r,t,a)}for(let[e,t]of Object.entries(n.declared??{}))i[Jd(e)]=t;if(n.layoutByProp)for(let[e,r]of Object.entries(n.layoutByProp.map)){let r=xl(n,{[n.layoutByProp.prop]:e}),i={};r?.display&&(i.display=r.display),r?.direction&&(i.flexDirection=r.direction),r?.align&&(i.alignItems=Ud[r.align]),r?.justify&&(i.justifyContent=Wd[r.justify]),x(n.layoutByProp.prop,e,t,i)}v[t]=i};for(let{name:t,part:n,path:r}of U(e))n.component||ne(t,n,r.length===1);for(let e of u.placeholders.values())for(let t of e)v[t]={gridArea:t};for(let e of u.wrappedInstances){let t={};f(t,u.cells.get(e)??[]),t.display=`grid`,v[e]=t}let D={};if(h.some(e=>e.name===`disabled`)){for(let[t,n]of Object.entries(e.anatomy.root?.states?.disabled??{})){let e=Kd(n);qd(e).length===0&&!t.startsWith(`outline`)&&(D[Jd(t)]=l(e))}for(let[t,n]of Object.entries(e.anatomy.root?.declaredStates?.disabled??{}))t.startsWith(`outline`)||(D[Jd(t)]=n)}let O=e.semantics.elementByProp,re=O?{attrs:`HTMLAttributes`,el:`HTMLElement`,supportsDisabled:!1}:ud[e.semantics.element],ie=Y(e),ae=Ku(e),oe=new Set(g.filter(e=>e.toggles).map(e=>
265_(e.toggles.prop))),k=[];for(let t of e.props){let e=t.description?` /** ${t.description} */\n`:``;if(Ru(t))k.push(`${e} ${t.bindings.code.prop}?: ${t.type.enum.map(e=>`'${e}'`).join(` | `)};`);else if(Bu(t)){let n=Object.entries(t.type.arrayOf).map(([e,t])=>`${e}: ${t===`text`?`string`:t}`).join(`; `);k.push(`${e} ${t.bindings.code.prop}?: Array<{ ${n} }>;`)}else t.type===`boolean`?k.push(`${e} ${t.bindings.code.prop}?: boolean;`):t.type===`number`?k.push(`${e} ${t.bindings.code.prop}?: number;`):t.bindings.code.prop!==`children`&&k.push(`${e} ${t.bindings.code.prop}${t.required?``:`?`}: string;`)}for(let{slot:e,part:t}of ie){let n=t.description?` /** ${t.description} */\n`:``;k.push(`${n} ${e.name}?: ReactNode;`)}for(let e of g){let t=e.description??`Fires when the ${e.trigger} is activated.`;k.push(` /** ${t} */\n ${e.bindings.code.prop}?: () => void;`)}let A=[];for(let e of m)A.push(oe.has(e.bindings.code.prop)?`${e.bindings.code.prop}: ${e.bindings.code.prop}Prop`:`${e.bindings.code.prop} = '${e.default}'`);for(let e of h)A.push(`${e.bindings.code.prop} = ${e.default===!0}`);for(let t of Uu(e))A.push(`${t.bindings.code.prop} = ${typeof t.default==`number`?t.default:0}`);for(let e of ae)A.push(e.required||e.default===void 0?e.bindings.code.prop:`${e.bindings.code.prop} = '${e.default}'`);for(let t of Wu(e))A.push(t.bindings.code.prop);for(let{slot:e}of ie)A.push(e.name);for(let e of g)A.push(e.bindings.code.prop);A.push(`style`,`children`,`...rest`);let se=[];for(let t of g){if(!t.toggles)continue;let n=e.props.find(e=>e.name===t.toggles.prop),r=n.bindings.code.prop,i=n.type.enum.map(e=>`'${e}'`).join(` | `);se.push(` const [${r}Uncontrolled, set${Ol(r)}Uncontrolled] = useState<${i}>('${n.default}');`,` const ${r} = ${r}Prop ?? ${r}Uncontrolled;`)}for(let t of g){let n=[];if(t.toggles){let r=e.props.find(e=>e.name===t.toggles.prop).bindings.code.prop,[i,a]=t.toggles.between;n.push(`set${Ol(r)}Uncontrolled(${r} === '${a}' ? '${i}' : '${a}');`)}n.push(`${t.bindings.code.prop}?.();`),se.push(` const handle${Ol(t.name)} = () => { ${n.join(` `)} };`)}let j=(t,n,r)=>{let i=g.find(e=>e.trigger===t);if(!i)return``;if(n&&Tl(n)){let t=``;if(i.toggles){let n=e.props.find(e=>e.name===i.toggles.prop),r=n.bindings.code.prop,[a,o]=i.toggles.between,s=n.type.enum.filter(e=>e!==a&&e!==o);if(t+=` checked={${r} === '${o}'}`,s.length>0){let e=s.map(e=>`${r} === '${e}'`).join(` || `);t+=` ref={(el) => { if (el) el.indeterminate = ${e}; }}`}}return t+=` onChange={handle${Ol(i.name)}}`,t}let a=r===`button`?` type="button"`:``;if(a+=` onClick={handle${Ol(i.name)}}`,i.toggles?.aria){let t=e.props.find(e=>e.name===i.toggles.prop),n=t.bindings.code.prop,[r,o]=i.toggles.between,s=t.type.enum.filter(e=>e!==r&&e!==o);a+=s.length?` aria-${i.toggles.aria}={${n} === '${o}' ? true : ${n} === '${r}' ? false : 'mixed'}`:` aria-${i.toggles.aria}={${n} === '${o}'}`}return a},ce=e=>[...b.get(e)??[]],M=(e,t,n=[])=>{let r=[`...${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`S.${e}`:`S[${JSON.stringify(e)}]`}`];for(let t of ce(e))r.push(`...(V[\`${t}-\${${_(t)}}:${e}\`] ?? {})`);for(let t of C.get(e)??[]){let n=t.split(`+`).map(e=>`${e}-\${${_(e)}}`).join(`+`);r.push(`...(V[\`${n}:${e}\`] ?? {})`)}return r.push(...n),t&&Object.keys(D).length>0&&r.push(`...(${_(`disabled`)} ? DISABLED_STYLE : {})`),t&&r.push(`...style`),`{{ ${r.join(`, `)} }}`},N=t=>{let n=[];for(let r of t.stylesWhen??[]){let t=e.props.find(e=>e.name===r.prop);if(!t)continue;let i=Object.fromEntries(Object.entries(r.styles).map(([e,t])=>[Jd(e),t])),a=Ru(t)?`${_(r.prop)} === '${r.equals}'`:_(r.prop);n.push(`...(${a} ? ${JSON.stringify(i)} : {})`)}return n},P=(e,t)=>{if(!e.visibleWhen)return t;let n=_(e.visibleWhen.prop),r=e.visibleWhen.equals;return`{${r===void 0?n:Array.isArray(r)?r.map(e=>`${n} === '${e}'`).join(` || `):`${n} === '${r}'`} ? (${t}) : null}`},le=new Set([`rows`,`cols`,`tabIndex`,`colSpan`,`rowSpan`]),ue=e=>Object.entries(e.attrs??{}).map(([e,t])=>{let n=t.match(/^\{([a-z][\w-]*)\}$/);return n?` ${e}={String(${_(n[1])})}`:le.has(e)&&/^\d+$/.test(t)?` ${e}={${t}}`:` ${e}=${JSON.stringify(t)}`}).join(``),de=new Map;for(let{part:n}of U(e)){if(!n.icon)continue;let r=n.icon.asset.match(/^\{([a-z][\w-]*)\}$/);if(r){let n=e.props.find(e=>e.name===r[1]);if(n&&Ru(n))for(let e of n.type.enum)de.set(e,t.icons.get(e)??``)}else de.set(n.icon.asset,t.icons.get(n.icon.asset)??``)}let fe=[...new Set(U(e).filter(e=>e.part.component).map(e=>t.contracts.get(e.part.component.id).name))],pe=(t,n)=>{let r=[];for(let[i,a]of Object.entries(n)){let n=t.props.find(e=>e.name===i),o=n?.bindings.code.prop??i;if(typeof a==`object`){let t=e.props.find(e=>
265e.name===a.prop)?.bindings.code.prop??a.prop,n=Object.entries(a.map).map(([e,n])=>`${t} === '${e}' ? '${n}' : `).join(``);r.push(` ${o}={${n}undefined}`);continue}if(typeof a==`boolean`){r.push(a?` ${o}`:n?.default===!1?``:` ${o}={false}`);continue}let s=a.match(/^\{([a-z][\w-]*)\}$/);if(s){let t=e.props.find(e=>e.name===s[1]);r.push(` ${o}={${t?.bindings.code.prop??s[1]}}`)}else r.push(` ${o}="${a}"`)}return r.join(``)},me=(n,r)=>{if(r.icon){let e=r.icon.asset.match(/^\{([a-z][\w-]*)\}$/),t=`dangerouslySetInnerHTML={{ __html: ICONS[${e?_(e[1]):JSON.stringify(r.icon.asset)}] }}`,i=r.element?`<${r.element} style=${M(n,!1,N(r))}${ue(r)}${j(n,r,r.element)}><span aria-hidden="true" style={{ display: 'inline-flex' }} ${t} /></${r.element}>`:`<span style=${M(n,!1,N(r))} aria-hidden="true" ${t} />`;return P(r,i)}if(r.repeat&&r.component){let e=t.contracts.get(r.component.id);return P(r,r.repeat.sample.map(t=>{let n,i=``;for(let[r,a]of Object.entries(t)){let t=e.props.find(e=>e.name===r)?.bindings.code.prop??r;typeof a==`string`&&t===`children`?n=a:typeof a==`boolean`?i+=a?` ${t}`:``:typeof a==`number`?i+=` ${t}={${a}}`:i+=` ${t}="${a}"`}let a=pe(e,r.component.props??{})+i;return n===void 0?`<${e.name}${a} />`:`<${e.name}${a}>${n}</${e.name}>`}).join(` 266`))}if(r.component){let e=t.contracts.get(r.component.id),i=pe(e,r.component.props??{}),a=Gu(e).find(e=>e.bindings.code.prop===`children`),o=a!==void 0&&r.component.props?.[a.name]!==void 0,s=a?.bindings.figma.kind===`NONE`,c=r.component.text??(!o&&!s&&typeof a?.default==`string`?a.default:void 0),l=c===void 0?`<${e.name}${i} />`:`<${e.name}${i}>${c}</${e.name}>`;return u.wrappedInstances.has(n)?`<span style=${M(n,!1,[])}>${l}</span>`:l}if(r.slot){let e=r.element??`div`,t=r.slot.name===`children`?`children`:r.slot.name,i=`<${e} style=${M(n,!1,N(r))}${ue(r)}>{${t}}</${e}>`;return r.optional?`{${t} != null ? ${i} : null}`:P(r,i)}if(r.content){let t=r.element??`span`,i=e.props.find(e=>e.type===`text`&&e.bindings.code.prop===r.content.prop);return P(r,`<${t} style=${M(n,!1,N(r))}${ue(r)}${j(n,r,t)}>{${i.bindings.code.prop}}</${t}>`)}if(r.text!==void 0){let e=r.element??`span`,t=r.textByProp,i=t?`{${Object.entries(t.map).map(([e,n])=>`${_(t.prop)} === '${e}' ? ${JSON.stringify(n)} : `).join(``)}${JSON.stringify(r.text)}}`:r.text;return P(r,`<${e} style=${M(n,!1,N(r))}${ue(r)}>${i}</${e}>`)}if(r.meter){let e=_(r.meter.valueProp),t=_(r.meter.maxProp);return P(r,`<div style=${M(n,!1,[`width: \`\${Math.min(100, Math.max(0, (${e} / ${t}) * 100))}%\``])} />`)}let i=r.element??`div`,a=[...Object.entries(r.parts??{}).map(([e,t])=>me(e,t)),...(u.placeholders.get(n)??[]).map(e=>`<div style=${M(e,!1,[])} />`)].join(` 267`);return P(r,`<${i} style=${M(n,!1,N(r))}${ue(r)}${j(n,r,i)}>\n${a}\n</${i}>`)},he=e.anatomy.root,ge=he?.parts||u.placeholders.has(`root`)?[...Object.entries(he?.parts??{}).map(([e,t])=>me(e,t)),...(u.placeholders.get(`root`)??[]).map(e=>`<div style=${M(e,!1,[])} />`)].join(` 268`):`{children}`,_e=O?`Tag`:e.semantics.element;O&&se.push(` const Tag = ELEMENT_MAP[${_(O.prop)}] ?? '${e.semantics.element}';`);let ve=re.supportsDisabled&&h.some(e=>e.name===`disabled`),ye=[`ref={ref}`,`style=${M(`root`,!0,he?N(he):[])}`];ve&&ye.push(`disabled={disabled}`);for(let e of h){if(e.name===`disabled`&&ve)continue;let t=e.name.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();ye.push(`data-${t}={${e.bindings.code.prop} || undefined}`)}let be=e.semantics.roleByProp,xe=``;be?(xe=`const ROLE_MAP: Record<string, string> = ${JSON.stringify(be.map)};\n\n`,ye.push(`role={ROLE_MAP[${_(be.prop)}]}`)):e.semantics.role&&e.semantics.role!==e.semantics.element&&ye.push(`role="${e.semantics.role}"`);let Se=``;O&&(Se=`const ELEMENT_MAP: Record<string, ElementType> = ${JSON.stringify(O.map)};\n\n`);let Ce=g.find(e=>e.trigger===`root`);Ce&&ye.push(`onClick={handle${Ol(Ce.name)}}`),ye.push(`{...rest}`);let we={};for(let[e,t]of Object.entries({...y,...S}))for(let[n,r]of Object.entries(t))we[`${e}:${n}`]=r;let Te=de.size>0?`const ICONS: Record<string, string> = {\n${[...de.entries()].map(([e,t])=>` ${JSON.stringify(e)}: ${JSON.stringify(t)},`).join(` 269`)}\n};\n\n`:``,Ee=[];
269ee.has(`spin`)&&Ee.push(`@keyframes ds-inline-spin { to { transform: rotate(360deg); } }`),ee.has(`pulse`)&&Ee.push(`@keyframes ds-inline-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }`);let De=Ee.length>0?`const KEYFRAMES = ${JSON.stringify(Ee.join(` 270`))};\n\n`:``,Oe=Ee.length>0?`<style>{KEYFRAMES}</style> 271 `:``,ke=[`CSSProperties`,re.attrs,...ie.length>0?[`ReactNode`]:[],...O?[`ElementType`]:[]].join(`, `),Ae=fe.map(e=>`import { ${e} } from './${e}';`).join(` 272`),je=U(e).some(e=>e.part.layout?.overlap&&e.part.tokens?.gap)?` 273 * Fidelity: the overlap gap (negative child margins) needs a child selector â not 274 * expressible inline; children render without the overlap offset.`:``,Me=U(e).some(e=>e.part.repeat)?` 275 * Fidelity: repeat collections render the contract's OBSERVED sample as fixed 276 * instances (the array prop is declared but not mapped on this surface) â the 277 * full React surface maps the live array.`:``,Ne=new Set(Object.keys(Yc).filter(e=>Yc[e].css===`canvas-only`).map(Jd)),Pe=new Set;for(let e of[...Object.values(v),...Object.values(we)])for(let t of Object.keys(e))Ne.has(t)&&(delete e[t],Pe.add(t));let Fe=Pe.size>0?`\n * Fidelity: ${[...Pe].sort().join(`, `)} REFUSED BY NAME â synthetic\n * canvas-only channel(s) (decomposeTranslate) with no CSS spelling; the canvas\n * lowers them to absolute placement.`:``;if(Pu(e)){let t=Mu(e).map(([e,t])=>me(e,t)).join(` 278 `);return{tsx:`/** 279 * GENERATED FILE (inline-styles emitter) â DO NOT EDIT. 280 * Source of truth: contracts/${e.id.replace(/^[^.]+\./,``)}.contract.json (${e.id} v${e.version}) 281 * Emitted by core/emit-react-inline.ts â token references RESOLVED to literals. 282 * Resolution mode: ${r} (brand: default). 283 * MULTI-ROOT composite â ${Mu(e).length} top-level roots (${Mu(e).map(([e])=>e).join(`, `)}) 284 * render as SIBLINGS in a Fragment; there is no single wrapping element.${Fe} 285 */ 286import type { ${ke} } from 'react'; 287${Ae}${Ae?` 288`:``} 289${Te}${De}const S: Record<string, CSSProperties> = ${JSON.stringify(v,null,2)}; 290 291/** Per-variant overrides, resolved per enum value: "prop-value:part" â styles. */ 292const V: Record<string, CSSProperties> = ${JSON.stringify(we,null,2)}; 293 294export interface ${p}Props extends ${re.attrs}<${re.el}> { 295${k.join(` 296`)} 297} 298 299/** ${e.description} */ 300export function ${p}({ ${A.join(`, `)} }: ${p}Props) { 301 return ( 302 <> 303 ${Oe}${t} 304 </> 305 ); 306} 307`}}return{tsx:`/** 308 * GENERATED FILE (inline-styles emitter) â DO NOT EDIT. 309 * Source of truth: contracts/${e.id.replace(/^[^.]+\./,``)}.contract.json (${e.id} v${e.version}) 310 * Emitted by core/emit-react-inline.ts â the zero-infrastructure output: 311 * every token reference was RESOLVED to its literal value from the design 312 * tokens at emit time. Resolution mode: ${r} (brand: default). To retheme, 313 * re-emit against different tokens â do not edit literals by hand. 314 * Fidelity: :hover/:focus-visible state tokens are not expressible as inline 315 * styles and are omitted; ROOT disabled-state tokens apply via the disabled 316 * prop; PART-level state overrides (Part.states, v13) are omitted â the same 317 * declared limit as the hover states (state-selected descendant styling).${je}${Me}${Fe} 318 */ 319import { forwardRef${g.some(e=>e.toggles)?`, useState`:``} } from 'react'; 320import type { ${ke} } from 'react'; 321${Ae}${Ae?` 322`:``} 323${Te}${xe}${Se}${De}const S: Record<string, CSSProperties> = ${JSON.stringify(v,null,2)}; 324 325/** Per-variant overrides, resolved per enum value: "prop-value:part" â styles. */ 326const V: Record<string, CSSProperties> = ${JSON.stringify(we,null,2)}; 327${Object.keys(D).length>0?`\nconst DISABLED_STYLE: CSSProperties = ${JSON.stringify(D)};\n`:``} 328export interface ${p}Props extends ${re.attrs}<${re.el}> { 329${k.join(` 330`)} 331} 332 333/** ${e.description} */ 334export const ${p} = forwardRef<${re.el}, ${p}Props>(function ${p}( 335 { ${A.join(`, `)} }, 336 ref, 337) { 338${se.length>0?se.join(` 339`)+` 340`:``} return ( 341 <${_e} ${ye.join(` `)}> 342 ${Oe}${ge} 343 </${_e}> 344 ); 345}); 346`}}var Qd=` 347var dsVarNames = {}; 348var dsVarNamesLoaded = false; 349function dsSetVarNames(m) { dsVarNames = m || {}; dsVarNamesLoaded = true; return dsVarNames; } 350// Callers with an async prologue (the emitted script's top-level await, the 351// plugin's check-drift handler) populate the map ONCE; the sync walk reads it. 352async function dsLoadVarNames() { 353 var m = {}; 354 try { 355 var all = await figma.variables.getLocalVariablesAsync(); 356 for (var i = 0; i < all.length; i++) m[all[i].id] = all[i].name; 357 } catch (e) {} 358 return dsSetVarNames(m); 359} 360// THE UNLOADED MAP IS A REFUSAL, NOT A DIFFERENT ANSWER. 361// 362// v6 spells bindings by NAME, and the name map can only be filled from an 363// ASYNC api. A call site that forgets to await dsLoadVarNames() used to get a 364// perfectly well-formed hash -- computed over (unresolved) everywhere -- that 365// simply did not equal the stamp. Three separate sites hit that in one round 366// (the emitted script, the plugin's inventory walk, and the engine gate's own 367// new-Function harness), and every one reported a FALSE 'canvas-edited' 368// verdict on an untouched file rather than an error. Telling a designer that 369// applying would overwrite edits that do not exist is a louder wrong answer 370// than the missed detach v6 was built to catch. 371// 372// So the unloaded state now refuses BY NAME at the first binding it is asked 373// to resolve. A forgotten preload becomes an immediate, located error instead 374// of a plausible hash -- the same reason styledChannels takes a REQUIRED 375// FusionEnv rather than an optional one. dsSetVarNames({}) is the way to say
376// deliberately that no names are available. 377function dsVarName(id) { 378 if (!id) return '(none)'; 379 if (!dsVarNamesLoaded) { 380 throw new Error( 381 'dsCanvasFingerprint: the variable-name map was never loaded. v6 spells bindings by NAME, so every path that COMPUTES a fingerprint must ' + 382 'await dsLoadVarNames() (or call dsSetVarNames({}) to state deliberately that no names are available) before walking. ' + 383 'Without it every bound field resolves to (unresolved) and the hash silently disagrees with the stamp.', 384 ); 385 } 386 if (dsVarNames[id]) return dsVarNames[id]; 387 // Real Figma (non-dynamic-page documents) still answers synchronously; 388 // where it does not, the preloaded map above is the answer. 389 try { 390 if (typeof figma !== 'undefined' && figma.variables && figma.variables.getVariableById) { 391 var v = figma.variables.getVariableById(id); 392 if (v && v.name) { dsVarNames[id] = v.name; return v.name; } 393 } 394 } catch (e) {} 395 return '(unresolved)'; 396} 397// Paints serialize with aliases as NAMES: a run-scoped VariableID makes the 398// line unusable across files, which is the whole defect v6 closes. 399function dsPaints(paints) { 400 return JSON.stringify(paints, function (k, v) { 401 if (v && typeof v === 'object' && v.type === 'VARIABLE_ALIAS' && typeof v.id === 'string') { 402 return { var: dsVarName(v.id) }; 403 } 404 return v; 405 }); 406} 407function dsCanvasSnapshot(root) { 408 var lines = []; 409 var r1 = function (n) { return typeof n === 'number' ? Math.round(n * 10) / 10 : n; }; 410 var factsOf = function (n, id) { 411 var out = []; 412 try { if (n.fills && n.fills !== undefined) out.push(id + '|fill|' + dsPaints(n.fills)); } catch (e) {} 413 try { if (n.strokes && n.strokes.length) out.push(id + '|stroke|' + dsPaints(n.strokes) + ' w' + (n.strokeWeight || 0)); } catch (e) {} 414 try { out.push(id + '|radius|' + r1(n.topLeftRadius || n.cornerRadius || 0) + ',' + r1(n.topRightRadius || 0) + ',' + r1(n.bottomLeftRadius || 0) + ',' + r1(n.bottomRightRadius || 0)); } catch (e) {} 415 try { if (n.layoutMode && n.layoutMode !== 'NONE') out.push(id + '|layout|' + n.layoutMode + ' ' + n.primaryAxisAlignItems + '/' + n.counterAxisAlignItems + ' gap ' + r1(n.itemSpacing) + ' pad ' + r1(n.paddingTop) + ',' + r1(n.paddingRight) + ',' + r1(n.paddingBottom) + ',' + r1(n.paddingLeft)); } catch (e) {} 416 try { out.push(id + '|sizing|' + (n.layoutSizingHorizontal || '') + '/' + (n.layoutSizingVertical || '') + ' ' + (n.layoutPositioning || '')); } catch (e) {} 417 try { if (n.type === 'TEXT') out.push(id + '|text|"' + n.characters + '" ' + String(n.fontSize) + 'px ' + JSON.stringify(n.fontName)); } catch (e) {} 418 try { if (n.opacity !== undefined && n.opacity !== 1) out.push(id + '|opacity|' + r1(n.opacity)); } catch (e) {} 419 try { if (n.effects && n.effects.length) out.push(id + '|effects|' + n.effects.length); } catch (e) {} 420 try { if (n.visible === false) out.push(id + '|hidden|true'); } catch (e) {} 421 // v6: DIRECT variable bindings, one channel per field so the drift 422 // reporter can pair each independently. Array-valued aliases 423 // (fills/strokes/characters) are skipped â they ride their own channel, 424 // the same split dump.plugin.js makes. 425 try { 426 var bv = n.boundVariables; 427 if (bv) { 428 var bf = Object.keys(bv).sort(); 429 for (var bi = 0; bi < bf.length; bi++) { 430 var al = bv[bf[bi]]; 431 if (!al || Object.prototype.toString.call(al) === '[object Array]' || !al.id) continue; 432 out.push(id + '|bound:' + bf[bi] + '|' + dsVarName(al.id)); 433 } 434 } 435 } catch (e) {} 436 // v4 (live finding: description + added property were invisible): 437 try { if (n.description) out.push(id + '|description|' + n.description); } catch (e) {} 438 try { 439 if (n.componentPropertyDefinitions) { 440 var defs = n.componentPropertyDefinitions; 441 var names = Object.keys(defs).sort(); 442 for (var d = 0; d < names.length; d++) { 443 var def = defs[names[d]]; 444 out.push(id + '|propdef|' + names[d] + ':' + def.type + '=' + String(def.defaultValue)); 445 } 446 } 447 } catch (e) {} 448 // v5 (prototype-wiring round): interactions are generated facts now. 449 // Destination by NAME (resolved among the node's siblings â a variant 450 // swap is always intra-set); an unresolvable id is named honestly rather 451 // than leaked as a run-scoped number. 452 try { 453 var rx = n.reactions; 454 if (rx && rx.length) { 455 var destName = function (nn, destId) { 456 if (!destId) return '(none)'; 457 try { 458 var p = nn.parent; 459 var sibs = (p && p.children) || []; 460 for (var s = 0; s < sibs.length; s++) if (sibs[s].id === destId) return sibs[s].name; 461 } catch (e2) {} 462 return '(external)'; 463 }; 464 for (var ri = 0; ri < rx.length; ri++) { 465 var rr = rx[ri]; 466 var acts = rr.actions || (rr.action ? [rr.action] : []); 467 var trg = (rr.trigger && rr.trigger.type) || '(none)'; 468 for (var ai = 0; ai < acts.length; ai++) { 469 var ac = acts[ai]; 470 out.push(id + '|reaction|' + trg + String.fromCharCode(8594) + (ac.navigation || ac.type) + ' ' + destName(n, ac.destinationId)); 471 } 472 } 473 } 474 } catch (e) {} 475 return out; 476 }; 477 var walk = function (n, path) { 478 var id = path + ':' + n.type + '/' + n.name; 479 var fs = factsOf(n, id); 480 for (var i = 0; i < fs.length; i++) lines.push(fs[i]); 481 var kids = n.children || []; 482 for (var i2 = 0; i2 < kids.length; i2++) walk(kids[i2], path + '/' + i2); 483 }; 484 walk(root, ''); 485 return lines; 486} 487function dsCanvasSetSnapshot(node) { 488 // the SET's OWN facts only (description, property definitions, name) â 489 // small enough to store on the set node; variants own their subtrees. 490 var lines = []; 491 var id = ':' + node.type + '/' + node.name; 492 try { if (node.description) lines.push(id + '|description|' + node.description); } catch (e) {} 493 try { 494 if (node.componentPropertyDefinitions) { 495 var defs = node.componentPropertyDefinitions; 496 var names = Object.keys(defs).sort(); 497 for (var d = 0; d < names.length; d++) { 498 var def = defs[names[d]]; 499 lines.push(id + '|propdef|' + names[d] + ':' + def.type + '=' + String(def.defaultValue)); 500 } 501 } 502 } catch (e) {} 503 return lines; 504} 505function dsCanvasFingerprint(root) { 506 var s = dsCanvasSnapshot(root).join(String.fromCharCode(10));
507 var h = 5381; 508 for (var i = 0; i < s.length; i++) h = (((h << 5) + h) + s.charCodeAt(i)) >>> 0; 509 return 'v6:' + String(h); 510} 511`,$d=[{state:`hover`,trigger:`ON_HOVER`},{state:`active`,trigger:`ON_PRESS`}],ef=e=>e?` 512function remeasureBirthBox(node, label, hasW, hasH) { 513 for (const axis of ['Vertical', 'Horizontal']) { 514 // A DECLARED SIZE IS NOT A BIRTH BOX. This repair dissolves Figma's 515 // 100x100 default by shrinking a HUG axis to 1 and letting it re-measure 516 // â which is right for a node whose size is supposed to come from its 517 // content, and destructive for one the CONTRACT sized. A childless frame 518 // has nothing to re-measure against, so the axis hugs to 1 and stays 519 // there: MUI's switch-track is declared 34x14 and shipped 1x1 exactly 520 // this way (the compile receipt's pin caught it, and the pin was right). 521 if (axis === 'Horizontal' && hasW) continue; 522 if (axis === 'Vertical' && hasH) continue; 523 const prop = 'layoutSizing' + axis; 524 let mode; 525 try { mode = node[prop]; } catch (e) { continue; } 526 if (mode !== 'HUG') continue; 527 try { 528 node[prop] = 'FIXED'; 529 node.resize(axis === 'Horizontal' ? 1 : node.width, axis === 'Vertical' ? 1 : node.height); 530 node[prop] = 'HUG'; 531 } catch (e) { 532 throw new Error( 533 '"' + label + '": ' + axis.toLowerCase() + " axis reports HUG but kept Figma's 100px " + 534 'birth box, and the FIXED round-trip that forces the re-measure was refused (' + 535 e.message + ') â FC-SLOT-BIRTH-BOX', 536 ); 537 } 538 } 539} 540`:``,tf=(e,t,n)=>e?` 541 // FC-SLOT-BIRTH-BOX: dissolve Figma's 100x100 birth box now that every child 542 // (including a slot's defaultContent) is in place. Only a node that ENDED UP 543 // childless is affected â one with children has already relaid out â and GRID 544 // is excluded because a resize there reverts HUG tracks to FLEX (G8/GP4b). 545 // A DECLARED layout is required, and that is not the timidity it looks like. 546 // I relaxed it to applyFrameSpec's default on the theory that a layout-less 547 // root was a latent hole. It was speculation â the divider roots this fix 548 // exists for all declare layout â and the canvas refuted it: MUI Switch's 549 // switch-track is a childless FRAME with no declared layout that measures 550 // 34x14 FIXED live (read from 21:612). Under the relaxed guard it entered 551 // the re-measure, hugged to nothing and shipped 1x1, breaking the mui 552 // compile receipt's 34x14 pin. A node the contract gave no layout is not a 553 // node whose sizing this repair understands. 554 // 555 // \`children\` IS the container test, and it stays explicit: a TEXT node 556 // answers 'layoutSizingVertical' in node just as truthfully as a frame does 557 // and has no children array at all. Only FRAME / COMPONENT / SLOT carry a 558 // birth box; a text or vector leaf measures itself. 559 if (${n}.layout && ${n}.layout.mode !== 'GRID' && 560 'layoutSizingVertical' in ${t} && ${t}.children && 561 (${n}.type === 'slot' || ${t}.children.length === 0)) { 562 remeasureBirthBox(${t}, ${n}.type === 'slot' ? ${n}.slotProperty : ${n}.name, 563 Boolean(${n}.fixedWidth), Boolean(${n}.fixedHeight)); 564 }`:``,nf=`rt15-standalone-components-stamp-identity`;function rf(e,t){return af(t).buildComponentScript(e,t.contracts,t.fileKey,t.mintedTokens)}function af(e){let t=e.variableCollection,n=zl,r=n(e.tokens.primitives),i=n(e.tokens.semantic),a=n(e.tokens.light),o=n(e.tokens.dark),s=Object.keys(e.tokens.brands).sort((e,t)=>e==="default"?-1:t==="default"?1:e.localeCompare(t)),c=new Map(s.map(t=>[t,n(e.tokens.brands[t])])),l=e=>e.split(`.`).join(`/`),u=e=>`var(--${e.split(`.`).join(`-`)})`;function d(e){let t=new Map([...r,...c.get(`default`),...i,...a]),n=t.get(e),o=0;for(;n&&o++<10;){let e=W(n.value);if(!e)return n.value;n=t.get(e)}throw Error(`Cannot resolve token "${e}"`)}let f={100:`Thin`,200:`Extra Light`,300:`Light`,400:`Regular`,500:`Medium`,600:`Semi Bold`,700:`Bold`,800:`Extra Bold`,900:`Black`};function p(e){if(e.type===`color`)return`COLOR`;if(e.type===`fontFamily`)return`STRING`;let t=W(e.value);if(t!==null){let e=new Set,n=t;
564for(;n!==null&&!e.has(n);){e.add(n);let t=r.get(n);if(!t)return`FLOAT`;let i=W(t.value);if(i===null)return p(t);n=i}return`FLOAT`}return G(e.value)===null?`STRING`:`FLOAT`}function m(e){if(e.type===`color`||e.type===`fontFamily`||W(e.value)!==null)return e.value;let t=G(e.value);return t===null?String(e.value):t}function h(e,t){return t.type===`color`?[`ALL_FILLS`,`STROKE_COLOR`]:e.startsWith(`space`)?[`GAP`,`WIDTH_HEIGHT`]:e.startsWith(`size`)||e.startsWith(`container`)?[`WIDTH_HEIGHT`]:e.startsWith(`radius`)?[`CORNER_RADIUS`]:e.startsWith(`border-width`)||e.startsWith(`border.width`)?[`STROKE_FLOAT`]:t.type===`fontWeight`?[`FONT_WEIGHT`]:t.type===`fontFamily`?[`FONT_FAMILY`]:e.includes(`font`)&&e.includes(`size`)?[`FONT_SIZE`]:e.startsWith(`opacity`)?[`OPACITY`]:[`ALL_SCOPES`]}function g(){let e=[],t=new Map,n=new Map;for(let[r]of i){let a=r.match(/^font\.(.+?)\.size(?:\.([^.]+))?$/);if(!a)continue;let o=a[1],s=[o,...a[2]?[a[2]]:[]].join(`/`).split(`.`).join(`/`),c=`font.${o}.weight`,l=i.has(c)?f[K(d(c))]??`Medium`:`Medium`,u={name:s,tokenPath:r,fontSize:K(d(r)),fontStyle:l};e.push(u),n.set(s,u),t.set(r,u)}let a=/^(.+)\.font-size(?:\.[^.]+)?$/,o=e=>e.startsWith(`imported.text.`),s=[];for(let[e,t]of r){if(!a.test(e))continue;let n=t.extensions?.dsContracts?.textStyle;!n||typeof n.name!=`string`||s.push({path:e,identity:{name:n.name,...typeof n.key==`string`?{key:n.key}:{},...typeof n.weight==`number`?{weight:n.weight}:{}}})}s.sort((e,t)=>{let n=Number(o(t.path))-Number(o(e.path));return n===0?e.path.localeCompare(t.path):n});for(let{path:i,identity:a}of s){let o=`${i.replace(/\.font-size(?:\.[^.]+)?$/,``)}.font-weight`,s=typeof a.weight==`number`?f[a.weight]??`Medium`:r.has(o)?f[K(d(o))]??`Medium`:`Medium`,c=K(d(i)),l=n.get(a.name);if(!l)l={name:a.name,tokenPath:i,fontSize:c,fontStyle:s,...a.key?{sourceStyleKey:a.key}:{}},e.push(l),n.set(a.name,l);else if(l.fontSize!==c||l.fontStyle!==s)throw Error(`text-style-identity-refused: text style ${JSON.stringify(a.name)} has conflicting definitions (${l.fontSize}px/${l.fontStyle} via ${l.tokenPath} vs ${c}px/${s} via ${i})`);else!l.sourceStyleKey&&a.key&&(l.sourceStyleKey=a.key);t.set(i,l)}return e.sort((e,t)=>e.name.localeCompare(t.name)),{styles:e,byTokenPath:t}}let{styles:_,byTokenPath:v}=g();function y(e){let t=[...r].map(([e,t])=>({name:l(e),type:p(t),value:m(t),scopes:h(e,t),codeSyntax:u(e)})),n=c.get(`default`),d=[];for(let[e,t]of n){let n={};for(let[t,r]of c){let i=W(r.get(e)?.value);if(!i)throw Error(`Brand token "${e}" must be an alias in brand "${t}"`);n[Ol(t)]=l(i)}d.push({name:l(e),type:p(t),perBrand:n,scopes:h(e.replace(/^brand\./,``),t),codeSyntax:u(e)})}let f=[];for(let[e,t]of i){let n=W(t.value);if(!n)throw Error(`Semantic token "${e}" must be an alias`);f.push({name:l(e),type:p(t),light:l(n),dark:l(n),scopes:h(e,t),codeSyntax:u(e)})}for(let[e,t]of a){let n=W(t.value),r=o.get(e),i=r?W(r.value):null;if(!n||!i)throw Error(`Mode token "${e}" must be an alias in both modes`);f.push({name:l(e),type:p(t),light:l(n),dark:l(i),scopes:h(e,t),codeSyntax:u(e)})}return`// GENERATED by scripts/generate-figma.ts â DO NOT EDIT. 565// Source of truth: tokens/*.tokens.json 566// Upserts variable collections: Primitives (mode "Value"), Brand (one mode 567// per brand), Semantic (modes "Light"/"Dark", aliasing primitives AND brand). 568const PRIMITIVES = ${JSON.stringify(t)}; 569const BRAND = ${JSON.stringify(d)}; 570const BRAND_MODES = ${JSON.stringify(s.map(e=>Ol(e)))}; 571const SEMANTIC = ${JSON.stringify(f)}; 572// Named text styles derived from semantic font.<group>.size tokens. 573const TEXT_STYLES = ${JSON.stringify(_)}; 574 575// File guard: multi-file bridge routing has been observed to hit the wrong 576// file â never write without verifying the target. 577const EXPECTED_FILE_KEY = ${JSON.stringify(e)}; 578if (EXPECTED_FILE_KEY && figma.fileKey && figma.fileKey !== EXPECTED_FILE_KEY) { 579 throw new Error('WRONG FILE: expected ' + EXPECTED_FILE_KEY + ', got ' + figma.fileKey); 580} 581 582function hexToRgb(value) { 583 // Foreign DTCG wraps carry color values VERBATIM â Polaris spells them as 584 // 'rgba(r, g, b, a)' strings, not hex (the Phase B live run failed on 585 // setValueForMode with NaN channels; the fix now lives at the source).
586 // Accepts #rgb / #rrggbb / #rrggbbaa and rgb() / rgba(); alpha preserved. 587 const v = String(value).trim(); 588 const fn = v.match(/^rgba?\\(([^)]+)\\)$/); 589 if (fn) { 590 const parts = fn[1].split(/[\\s,/]+/).filter(Boolean).map(parseFloat); 591 const c = { r: parts[0] / 255, g: parts[1] / 255, b: parts[2] / 255 }; 592 if (parts.length > 3 && !Number.isNaN(parts[3])) c.a = parts[3]; 593 return c; 594 } 595 let h = v.replace('#', ''); 596 if (h.length === 3) h = h.split('').map((ch) => ch + ch).join(''); 597 const c = { 598 r: parseInt(h.slice(0, 2), 16) / 255, 599 g: parseInt(h.slice(2, 4), 16) / 255, 600 b: parseInt(h.slice(4, 6), 16) / 255, 601 }; 602 if (h.length === 8) c.a = parseInt(h.slice(6, 8), 16) / 255; 603 return c; 604} 605 606const collections = await figma.variables.getLocalVariableCollectionsAsync(); 607const allVars = await figma.variables.getLocalVariablesAsync(); 608const varsIn = (col) => allVars.filter((v) => v.variableCollectionId === col.id); 609 610let prim = collections.find((c) => c.name === 'Primitives'); 611if (!prim) prim = figma.variables.createVariableCollection('Primitives'); 612if (prim.modes[0].name !== 'Value') prim.renameMode(prim.modes[0].modeId, 'Value'); 613const primModeId = prim.modes[0].modeId; 614const primByName = {}; 615for (const v of varsIn(prim)) primByName[v.name] = v; 616let createdPrim = 0; 617for (const t of PRIMITIVES) { 618 let v = primByName[t.name]; 619 if (!v) { 620 v = figma.variables.createVariable(t.name, prim, t.type); 621 primByName[t.name] = v; 622 createdPrim++; 623 } 624 v.setValueForMode(primModeId, t.type === 'COLOR' ? hexToRgb(t.value) : t.value); 625 v.scopes = t.scopes; 626 v.setVariableCodeSyntax('WEB', t.codeSyntax); 627} 628 629let brandCol = collections.find((c) => c.name === 'Brand'); 630if (!brandCol) brandCol = figma.variables.createVariableCollection('Brand'); 631if (brandCol.modes[0].name !== BRAND_MODES[0]) brandCol.renameMode(brandCol.modes[0].modeId, BRAND_MODES[0]); 632const brandModeIds = {}; 633brandModeIds[BRAND_MODES[0]] = brandCol.modes[0].modeId; 634for (const modeName of BRAND_MODES.slice(1)) { 635 const existing = brandCol.modes.find((m) => m.name === modeName); 636 brandModeIds[modeName] = existing ? existing.modeId : brandCol.addMode(modeName); 637} 638const brandByName = {}; 639for (const v of varsIn(brandCol)) brandByName[v.name] = v; 640let createdBrand = 0; 641for (const t of BRAND) { 642 let v = brandByName[t.name]; 643 if (!v) { 644 v = figma.variables.createVariable(t.name, brandCol, t.type); 645 brandByName[t.name] = v; 646 createdBrand++; 647 } 648 for (const modeName of BRAND_MODES) { 649 const target = primByName[t.perBrand[modeName]]; 650 if (!target) throw new Error('Missing primitive ' + t.perBrand[modeName] + ' for ' + t.name); 651 v.setValueForMode(brandModeIds[modeName], { type: 'VARIABLE_ALIAS', id: target.id }); 652 } 653 v.scopes = t.scopes; 654 v.setVariableCodeSyntax('WEB', t.codeSyntax); 655} 656 657let sem = collections.find((c) => c.name === 'Semantic'); 658if (!sem) sem = figma.variables.createVariableCollection('Semantic'); 659if (sem.modes[0].name !== 'Light') sem.renameMode(sem.modes[0].modeId, 'Light'); 660const lightModeId = sem.modes[0].modeId; 661let darkMode = sem.modes.find((m) => m.name === 'Dark'); 662const darkModeId = darkMode ? darkMode.modeId : sem.addMode('Dark'); 663const semByName = {}; 664for (const v of varsIn(sem)) semByName[v.name] = v; 665let createdSem = 0; 666for (const t of SEMANTIC) { 667 let v = semByName[t.name]; 668 if (!v) { 669 v = figma.variables.createVariable(t.name, sem, t.type); 670 semByName[t.name] = v; 671 createdSem++; 672 } 673 const lightVar = primByName[t.light] || brandByName[t.light]; 674 const darkVar = primByName[t.dark] || brandByName[t.dark]; 675 if (!lightVar || !darkVar) throw new Error('Missing primitive/brand for ' + t.name); 676 v.setValueForMode(lightModeId, { type: 'VARIABLE_ALIAS', id: lightVar.id }); 677 v.setValueForMode(darkModeId, { type: 'VARIABLE_ALIAS', id: darkVar.id }); 678 v.scopes = t.scopes; 679 v.setVariableCodeSyntax('WEB', t.codeSyntax); 680} 681 682// Text styles: upsert by IDENTITY MARKER (ds_contracts/textStyleToken = 683// the semantic size-token path), never by name â a rename on either side 684// must not fork identity, and a foreign style that happens to share a name 685// is never touched (same rule as component sets). Idempotent: re-runs 686// update the marked style in place. 687const localTextStyles = await figma.getLocalTextStylesAsync(); 688const styleByToken = {}; 689for (const s of localTextStyles) { 690 const tp = s.getSharedPluginData('ds_contracts', 'textStyleToken'); 691 if (tp) styleByToken[tp] = s; 692} 693let createdStyles = 0; 694for (const t of TEXT_STYLES) { 695 let s = styleByToken[t.tokenPath]; 696 if (!s) { 697 s = figma.createTextStyle(); 698 s.setSharedPluginData('ds_contracts', 'textStyleToken', t.tokenPath); 699 styleByToken[t.tokenPath] = s; 700 createdStyles++; 701 } 702 if (t.sourceStyleKey) { 703 s.setSharedPluginData('ds_contracts', 'sourceTextStyleKey', t.sourceStyleKey); 704 } 705 await figma.loadFontAsync({ family: 'Inter', style: t.fontStyle }); 706 s.name = t.name; 707 s.fontName = { family: 'Inter', style: t.fontStyle }; 708 s.fontSize = t.fontSize; 709 s.description = 'ds_contracts: derived from tokens/' + t.tokenPath; 710} 711 712return { 713 primitives: { collectionId: prim.id, total: PRIMITIVES.length, created: createdPrim }, 714 brand: { collectionId: brandCol.id, modes: BRAND_MODES, total: BRAND.length, created: createdBrand }, 715 semantic: { collectionId: sem.id, total: SEMANTIC.length, created: createdSem }, 716 textStyles: { total: TEXT_STYLES.length, created: createdStyles }, 717}; 718`}let b=e=>{let t=e.fontStyle??`Medium`;
718return e.fontItalic?t===`Regular`?`Italic`:`${t} Italic`:t};function x(e){let t=e.trim().match(/^(-?[\d.]+)px (-?[\d.]+)px ([\d.]+)px(?: (-?[\d.]+)px)? (#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?)$/);if(!t)return;let n={x:parseFloat(t[1]),y:parseFloat(t[2]),radius:parseFloat(t[3]),color:t[5].toLowerCase()};return t[4]!==void 0&&parseFloat(t[4])!==0&&(n.spread=parseFloat(t[4])),n}function S(e){let t=[],n=0,r=``;for(let i of e)i===`(`&&n++,i===`)`&&n--,i===`,`&&n===0?(t.push(r.trim()),r=``):r+=i;return r.trim()&&t.push(r.trim()),t}function C(e){return j(e)}function w(e){if(e.trim()===`none`)return[];let t=S(e.trim()),n=[];for(let e of t){let t=e.trim(),r=!1;/(^| )inset( |$)/.test(t)&&(r=!0,t=t.replace(/(^| )inset( |$)/,` `).trim());let i=t.match(/(#[0-9a-fA-F]{3,8}|rgba?\([^)]*\))/);if(!i)return;let a=C(i[1]);if(!a)return;t=t.replace(i[1],``).trim();let o=t.split(/\s+/).filter(Boolean);if(o.length<2||o.length>4)return;let s=o.map(e=>{let t=e.match(/^(-?[\d.]+)(px|rem|em)?$/);if(!t)return NaN;let n=parseFloat(t[1]);return t[2]===`rem`||t[2]===`em`?n*16:t[2]===`px`||n===0?n:NaN});if(s.some(Number.isNaN))return;let c={...r?{inner:!0}:{},x:s[0],y:s[1],radius:s[2]??0,color:a};s[3]!==void 0&&s[3]!==0&&(c.spread=s[3]),n.push(c)}return n}function T(e){let t=e.trim().match(/^linear-gradient\((.*)\)$/s);if(!t)return;let n=S(t[1]);if(n.length===0)return;let r=180,i=n,a=n[0].trim(),o=a.match(/^(-?[\d.]+)deg$/);if(o)r=parseFloat(o[1]),i=n.slice(1);else if(a.startsWith(`to `)){let e={"to top":0,"to right":90,"to bottom":180,"to left":270};if(!(a in e))return;r=e[a],i=n.slice(1)}if(i.length<2)return;let s=[];for(let e of i){let t=e.trim().match(/^(#[0-9a-fA-F]{3,8}|rgba?\([^)]*\))(?:\s+(-?[\d.]+)%)?$/);if(!t)return;let n=C(t[1]);if(!n)return;s.push({color:n,position:t[2]===void 0?-1:parseFloat(t[2])/100})}s[0].position===-1&&(s[0].position=0),s[s.length-1].position===-1&&(s[s.length-1].position=1);for(let e=0;e<s.length;e++){if(s[e].position!==-1)continue;let t=e;for(;s[t].position===-1;)t++;let n=s[e-1].position,r=(s[t].position-n)/(t-e+1);for(let i=e;i<t;i++)s[i].position=n+r*(i-e+1)}for(let e of s)e.position=Math.min(1,Math.max(0,e.position));return{angle:(r%360+360)%360,stops:s}}let E={start:`MIN`,center:`CENTER`,end:`MAX`,stretch:`MIN`,baseline:`BASELINE`},ee={start:`MIN`,center:`CENTER`,end:`MAX`,"space-between":`SPACE_BETWEEN`};function te(e,t,n,r){let i=t.declared?.position;if(i===`relative`||i===`static`||i===`sticky`)return;let a=Sl(t,n),o=wl(t,n);if(![`top`,`right`,`bottom`,`left`].every(e=>{if(a[e]!==void 0){let t=a[e].slice(1,-1);for(let[e,r]of Object.entries(n))t=t.replaceAll(`{${e}}`,r);return K(d(t))===0}return o[e]===void 0?!1:K(o[e])===0}))return;let s=e.fixedWidth!==void 0||e.lits?.width!==void 0,c=e.fixedHeight!==void 0||e.lits?.height!==void 0;if(!s&&!c)return;let l=`${e.fixedWidth?.px??e.lits?.width??`â`}Ã${e.fixedHeight?.px??e.lits?.height??`â`}`;delete e.fixedWidth,delete e.fixedHeight,e.lits&&(delete e.lits.width,delete e.lits.height),e.bindings&&(delete e.bindings.width,delete e.bindings.height),e.scrimBounded=!0,r.add(`root: viewport-pinned overlay scrim (inset:0) â captured box ${l} is the CAPTURE STAGE, not the component; the canvas box is bound to the overlay's content (deliberate canvas-vs-DOM divergence; the contract's inset/width/height channels are unchanged)`)}let ne={start:`MIN`,center:`CENTER`,end:`MAX`};function D(e,t,n={}){let r=xl(e,n);if(r?.display===`grid`){let t=e=>`px`in e?{type:`FIXED`,value:e.px}:`fr`in e?{type:`FLEX`,value:e.fr}:{type:`HUG`,value:1},i=e=>{if(e===void 0)return 0;if(typeof e==`number`)return e;let t=e.slice(1,-1);for(let[e,r]of Object.entries(n))t=t.replaceAll(`{${e}}`,r);let r=G(String(d(t)));if(r===null)throw Error(`grid gap token "${e}" does not resolve to a px value`);return r};return{mode:`GRID`,primary:`MIN`,counter:`MIN`,grid:{rows:(r.rows??[]).map(t),columns:(r.columns??[]).map(t),rowGap:i(r.gap?.row),columnGap:i(r.gap?.column),...r.flow===`row`?{flow:`ROW_AUTO_FLOW`}:{},...ml(e,`width`)===`hug`?{hugWidth:!0}:{},...ml(e,`height`)===`hug`?{hugHeight:!0}:{}}}}if(r&&!r.direction&&e.declared?.display===`block`){let e=r.align?E[r.align]:`MIN`;return{mode:`VERTICAL`,primary:r.justify?ee[r.justify]:`MIN`,counter:e===`BASELINE`?`MIN`:e,stretchChildren:!0}}if(!r&&t)return e.declared?.display===`block`?{mode:`VERTICAL`,primary:`MIN`,counter:`MIN`,stretchChildren:!0}:{mode:`HORIZONTAL`,primary:`CENTER`,counter:`CENTER`};if(!r&&!t&&new Set([`block`,`list-item`,`flow-root`,`inline`]).has(e.declared?.display??``)){let t=e=>e.declared?.position===`absolute`||e.declared?.position===`fixed`||e.declared?.display===`none`||(e.stylesWhen??[]).some(e=>e.styles.position===`absolute`||e.styles.position===`fixed`),n=Object.values(e.parts??{}).filter(e=>!t(e)),r=e=>{let t=e.layout?.display??e.declared?.display;return t===`flex`||t===`block`||t===`grid`||t===`list-item`||t===`table`||t===`flow-root`},i=n.some((e,t)=>t>0&&!r(e)&&!r(n[t-1]));if(n.length>=2&&(n.every(r)||n.some(r)&&!i))return{mode:`VERTICAL`,primary:`MIN`,counter:`MIN`,stretchChildren:!0}}let i=r?.direction?.startsWith(`column`)?`VERTICAL`:`HORIZONTAL`,a=r?.align?E[r.align]:`MIN`;return{mode:i,primary:r?.justify?ee[r.justify]:`MIN`,counter:a===`BASELINE`&&i===`VERTICAL`?`MIN`:a,stretchChildren:r?.align===`stretch`||r!==void 0&&r.align===void 0||void 0,...r?.wrap?{wrap:!0}:{}}}let O=(e,t)=>xl(e,t)?.direction?.endsWith(`-reverse`)??!1;function re(e,t,n,r,i,a){let o={...r},s=a?.[`outline-style`]!==void 0&&a[`outline-style`]!==`none`,c=[`border-top-color`,`border-right-color`,`border-bottom-color`,`border-left-color`].filter(e=>t[e]!==void 0).map(e=>{let r=t[e].slice(1,-1);for(let[e,t]of Object.entries(n))r=r.replaceAll(`{${e}}`,t);return r}),u=new Set(c.map(e=>String(d(e)))),p=[`border-width`,`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`].some(e=>t[e]!==void 0),m=c.length>0&&u.size===1&&p?l(c[0]):null,h=t[`border-color`]!==void 0||m!==null,g=(()=>{let e=t[`outline-color`];if(e===void 0)return!1;let r=e.slice(1,-1);for(let[e,t]of Object.entries(n))r=r.replaceAll(`{${e}}`,t);let i=String(d(r)).trim().toLowerCase();return i===`transparent`||i===`none`||/^#[0-9a-f]{6}00$/.test(i)||/^#[0-9a-f]{3}0$/.test(i)?!1:i.match(/^rgba?\([^)]*?,\s*0*(?:\.0+)?\s*\)$/)===null})(),_=s&&g&&t[`outline-width`]!==void 0&&!h;for(let[r,c]of Object.entries(t)){let u=c.slice(1,-1);for(let[e,t]of Object.entries(n))u=u.replaceAll(`{${e}}`,t);let p=l(u);switch(r){case`background`:case`background-color`:e.fill=p;break;case`border-color`:e.stroke=p;break;case`border-top-color`:case`border-right-color`:case`border-bottom-color`:case`border-left-color`:m!==null&&e.stroke===void 0?e.stroke=m:m===null&&oe(e,r,`per-side border COLOURS disagree (or no border width is carried) â one Figma strokes paint list serves all four sides.`);break;case`border-width`:e.bindings={...e.bindings,strokeWeight:p};break;case`color`:o.textFill=p,o.textFillPath=u;break;case`fill`:o.glyphFillPath=u;break;case`font-size`:o.fontSize=K(d(u)),o.fontSizePath=u,o.fontSizeVar=p;break;case`font-weight`:o.fontStyle=f[K(d(u))]??`Medium`,o.fontWeightV
718ar=p;break;case`font-family`:{let e=ge(String(d(u)));e&&(o.fontFamily=e);break}case`padding-inline`:e.bindings={...e.bindings,paddingLeft:p,paddingRight:p};break;case`padding-block`:e.bindings={...e.bindings,paddingTop:p,paddingBottom:p};break;case`padding-left`:e.bindings={...e.bindings,paddingLeft:p};break;case`padding-right`:e.bindings={...e.bindings,paddingRight:p};break;case`padding-top`:e.bindings={...e.bindings,paddingTop:p};break;case`padding-bottom`:e.bindings={...e.bindings,paddingBottom:p};break;case`gap`:e.bindings={...e.bindings,itemSpacing:p};break;case`column-gap`:(e.layout?.mode??`HORIZONTAL`)===`HORIZONTAL`?e.bindings={...e.bindings,itemSpacing:p}:oe(e,r,`the cross axis of a VERTICAL stack â Figma has one itemSpacing and it is the main axis.`);break;case`row-gap`:e.layout?.mode===`VERTICAL`?e.bindings={...e.bindings,itemSpacing:p}:oe(e,r,`the cross axis of a HORIZONTAL stack â Figma has one itemSpacing and it is the main axis.`);break;case`margin-top`:{let t=K(d(u));Number.isNaN(t)||(e.margins={...e.margins,top:t},e.marginVars={...e.marginVars,top:p});break}case`margin-right`:{let t=K(d(u));Number.isNaN(t)||(e.margins={...e.margins,right:t},e.marginVars={...e.marginVars,right:p});break}case`margin-bottom`:{let t=K(d(u));Number.isNaN(t)||(e.margins={...e.margins,bottom:t},e.marginVars={...e.marginVars,bottom:p});break}case`margin-left`:{let t=K(d(u));Number.isNaN(t)||(e.margins={...e.margins,left:t},e.marginVars={...e.marginVars,left:p});break}case`outline-color:outline-preview`:e.stroke=p,e.strokeOutside=!0;break;case`outline-width:outline-preview`:e.bindings={...e.bindings,strokeWeight:p};break;case`outline-color`:_?(e.stroke=p,e.strokeOutside=!0):oe(e,r,ie(s&&g,h,`outline-width`));break;case`outline-width`:_?e.bindings={...e.bindings,strokeWeight:p}:oe(e,r,ie(s&&g,h,`outline-color`));break;case`border-radius`:e.bindings={...e.bindings,topLeftRadius:p,topRightRadius:p,bottomLeftRadius:p,bottomRightRadius:p};break;case`border-top-left-radius`:e.bindings={...e.bindings,topLeftRadius:p};break;case`border-top-right-radius`:e.bindings={...e.bindings,topRightRadius:p};break;case`border-bottom-left-radius`:e.bindings={...e.bindings,bottomLeftRadius:p};break;case`border-bottom-right-radius`:e.bindings={...e.bindings,bottomRightRadius:p};break;case`border-top-width`:e.bindings={...e.bindings,strokeTopWeight:p};break;case`border-right-width`:e.bindings={...e.bindings,strokeRightWeight:p};break;case`border-bottom-width`:e.bindings={...e.bindings,strokeBottomWeight:p};break;case`border-left-width`:e.bindings={...e.bindings,strokeLeftWeight:p};break;case`background-image`:{let t=String(d(u));if(t!==`none`){let n=T(t);n?e.gradient=n:e.gradientMiss=t.slice(0,60)}break}case`width`:if(k(d(u))||i===!0)break;e.fixedWidth={px:K(d(u)),varName:p};break;case`max-width`:{let t=K(d(u));e.type!==`text`&&Number.isFinite(t)&&(e.type!==`root`||i===!0)?(e.bindings={...e.bindings,maxWidth:p},i===!0&&(e.hugCeiling=!0)):e.fixedWidth={px:t,varName:p};break}case`min-width`:e.bindings={...e.bindings,minWidth:p};break;case`min-height`:t.height===void 0&&(e.bindings={...e.bindings,minHeight:p});break;case`height`:if(k(d(u)))break;e.fixedHeight={px:K(d(u)),varName:p};break;case`opacity`:{let t=K(d(u));Number.isNaN(t)||(e.opacity=Math.min(1,Math.max(0,t)));break}case`box-shadow`:{let t=String(d(u)),n=x(t);if(n)e.dropShadow=n;else{let n=w(t);n?e.effectStack=n:e.shadowMiss=t.slice(0,60)}break}case`line-height`:o.lineHeight=se(d(u)),o.lineHeightVar=p;break;case`letter-spacing`:{let e=K(d(u));Number.isNaN(e)||(o.letterSpacing=e);break}default:{let t=Yc[r];t&&t.canvas!==`draw`?oe(e,r,t.note):t&&ae.has(r)&&(a?.position??`static`)!==`absolute`&&oe(e,r,`bound on an in-flow box (position: ${a?.position??`static`}) â Figma lowers offsets only for absolutely-placed, inset-overlay and full-bleed parts, and has no offset field for a child in auto-layout, so this binding draws nothing and cannot be read back`);break}}}return o}function ie(e,t,n){return e?t?`a Figma node carries ONE strokes paint and a border already claims it â a drawn border and a drawn outline cannot both be strokes, so the BORDER (the resting fact) wins and the outline is named here.`:`a drawn outline needs BOTH halves and ${n} is not carried â carry the pair and it returns as an OUTSIDE-aligned stroke.`:"a resting outline with no drawn `outline-style` paints n
718othing in CSS â this is the focus-ring-reservation idiom (`outline: Npx solid transparent`), so it correctly draws no canvas stroke either. An OUTSIDE-aligned canvas stroke declares outline-style and DOES draw."}let ae=new Set([`top`,`right`,`bottom`,`left`]);function oe(e,t,n){(e.channelMiss??=[]).push(`${t}: ${n}`)}let k=e=>String(e??``).trim()===`fit-content`;function A(e){let t=e.trim().match(/^(-?\d+(?:\.\d+)?)(px|rem|em)?$/);if(!t)return;let n=parseFloat(t[1]);return t[2]===`rem`||t[2]===`em`?n*16:n}function se(e){if(e==null||e===``)return;if(typeof e==`number`&&Number.isFinite(e))return e>0&&e<=4?{value:e*100,unit:`PERCENT`}:{value:e,unit:`PIXELS`};let t=String(e).trim();if(/^\d+(\.\d+)?$/.test(t)){let e=parseFloat(t);return e>0&&e<=4?{value:e*100,unit:`PERCENT`}:{value:e,unit:`PIXELS`}}let n=G(t);if(n===null)try{return{value:K(t),unit:`PIXELS`}}catch{return}return{value:n,unit:`PIXELS`}}function j(e){let t=e.trim(),n=t.match(/^rgba?\(([^)]+)\)$/);if(n){let e=n[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<3||e.slice(0,3).some(Number.isNaN))return;let t={r:e[0]/255,g:e[1]/255,b:e[2]/255};return e.length>3&&!Number.isNaN(e[3])&&(t.a=e[3]),t}let r=t.replace(`#`,``);if(!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(r))return;r.length===3&&(r=r.split(``).map(e=>e+e).join(``));let i={r:parseInt(r.slice(0,2),16)/255,g:parseInt(r.slice(2,4),16)/255,b:parseInt(r.slice(4,6),16)/255};return r.length===8&&(i.a=parseInt(r.slice(6,8),16)/255),i}function ce(e,t,n){let r={...n},i=()=>e.lits??={};for(let[n,a]of Object.entries(t))switch(n){case`background`:case`background-color`:{if(a===`transparent`){e.fill||(i().fillClear=!0);break}let t=j(a);t&&(i().fillColor=t);break}case`width`:{if(a.trim()===`100%`){e.grow=!0;break}if(k(a))break;let t=A(a);t===void 0?a.trim().endsWith(`%`)&&(e.channelMiss??=[]).push(`width: ${a.trim()} â a fractional width has no canvas twin (Figma sizing is FIXED / HUG / FILL; only 100% lowers, as FILL)`):i().width=t;break}case`height`:{if(k(a))break;let e=A(a);e!==void 0&&(i().height=e);break}case`min-width`:{let e=A(a);e!==void 0&&(i().minWidth=e);break}case`min-height`:{let e=A(a);e!==void 0&&(i().minHeight=e);break}case`padding-block`:{let e=A(a);e!==void 0&&(i().paddingTop=e,i().paddingBottom=e);break}case`padding-inline`:{let e=A(a);e!==void 0&&(i().paddingLeft=e,i().paddingRight=e);break}case`padding-left`:{let e=A(a);e!==void 0&&(i().paddingLeft=e);break}case`padding-right`:{let e=A(a);e!==void 0&&(i().paddingRight=e);break}case`padding-top`:{let e=A(a);e!==void 0&&(i().paddingTop=e);break}case`padding-bottom`:{let e=A(a);e!==void 0&&(i().paddingBottom=e);break}case`gap`:{let e=A(a);e!==void 0&&(i().itemSpacing=e);break}case`column-gap`:{let t=A(a);t!==void 0&&(e.layout?.mode??`HORIZONTAL`)===`HORIZONTAL`&&(i().itemSpacing=t);break}case`row-gap`:{let t=A(a);t!==void 0&&e.layout?.mode===`VERTICAL`&&(i().itemSpacing=t);break}case`margin-top`:{let t=A(a);t!==void 0&&(e.margins={...e.margins,top:t});break}case`margin-right`:{let t=A(a);t!==void 0&&(e.margins={...e.margins,right:t});break}case`margin-bottom`:{let t=A(a);t!==void 0&&(e.margins={...e.margins,bottom:t});break}case`margin-left`:{let t=A(a);t!==void 0&&(e.margins={...e.margins,left:t});break}case`border-radius`:{let e=A(a);e!==void 0&&(i().radius=e);break}case`border-width`:{let e=A(a);e!==void 0&&(i().strokeWeight=e);break}case`border-top-left-radius`:{let e=A(a);e!==void 0&&((i().radiusCorners??={}).tl=e);break}case`border-top-right-radius`:{let e=A(a);e!==void 0&&((i().radiusCorners??={}).tr=e);break}case`border-bottom-left-radius`:{let e=A(a);e!==void 0&&((i().radiusCorners??={}).bl=e);break}case`border-bottom-right-radius`:{let e=A(a);e!==void 0&&((i().radiusCorners??={}).br=e);break}case`border-top-width`:{let e=A(a);e!==void 0&&((i().strokeSides??={}).top=e);break}case`border-right-width`:{let e=A(a);e!==void 0&&((i().strokeSides??={}).right=e);break}case`border-bottom-width`:{let e=A(a);e!==void 0&&((i().strokeSides??={}).bottom=e);break}case`border-left-width`:{let e=A(a);e!==void 0&&((i().strokeSides??={}).left=e);break}case`border-color`:{let t=j(a);t&&!e.stroke&&(i().strokeColor=t);break}case`border-top-color`:case`border-right-color`:case`border-bottom-color`:case`border-left-color`:{if(e.stroke)break;let n=[`border-top-color`,`border-right-color`,`border-bottom-color`,`border-left-color`].filter(e=>t[e]!==void 0).map(e=>t[e]);if(new Set(n).size!==1)break;let r=j(a);r&&(i().strokeColor=r);break}case`letter-spacing`:{let e=A(a);e!==void 0&&(r.letterSpacing=e);break}case`font-size`:{let e=A(a);e!==void 0&&(r.fontSize=e,r.fontSizePath=void 0);break}case`line-height`:{let e=se(a);e!==void 0&&(r.lineHeight=e);break}case`box-shadow`:{let t=x(a);if(t)e.dropShadow=t;else{let t=w(a);t?e.effectStack=t:e.shadowMiss=a.slice(0,60)}break}
718default:break}return N(e),fe(e),e.lits&&Object.keys(e.lits).length===0&&delete e.lits,r}let M=new WeakMap;function N(e){let t=e.lits;if(!t?.strokeSides||!t.strokeColor||e.fill||t.fillColor||!(t.fillClear||t.fillColor===void 0))return;let n=t.strokeSides,r=[`top`,`right`,`bottom`,`left`].filter(e=>(n[e]??0)>0);if(r.length!==1)return;let i=r[0],a=n[i],o=t.strokeColor,s=t.height??e.shape?.height,c=t.width??e.shape?.width;t.fillColor=o,delete t.fillClear,delete t.strokeSides,delete t.strokeColor,delete t.strokeWeight,i===`bottom`||i===`top`?s!=null&&Number.isFinite(s)&&(M.set(e,{side:i,prior:s}),t.height=a,e.shape&&(e.shape.height=a)):c!=null&&Number.isFinite(c)&&(M.set(e,{side:i,prior:c}),t.width=a,e.shape&&(e.shape.width=a))}function P(e){let t=M.get(e);if(!t||!e.absolute)return;let n=t.side===`bottom`||t.side===`top`?e.lits?.height??e.shape?.height:e.lits?.width??e.shape?.width;if(n==null)return;let r=t.prior-n;t.side===`bottom`&&e.absolute.top!=null?e.absolute.top+=r:t.side===`right`&&e.absolute.left!=null&&(e.absolute.left+=r),M.delete(e)}let le=[[`left`,`bottom`],[`left`,`top`],[`right`,`bottom`],[`right`,`top`]];function ue(e){let t=Math.round(e.r*255),n=Math.round(e.g*255),r=Math.round(e.b*255);return e.a!==void 0&&e.a<1?`rgba(${t},${n},${r},${e.a})`:`rgb(${t},${n},${r})`}function de(e,t,n,r,i){let a=i/2,o=[e,t].sort().join(`+`);return o===`bottom+left`?`${a},${a} ${a},${r-a} ${n-a},${r-a}`:o===`left+top`?`${a},${r-a} ${a},${a} ${n-a},${a}`:o===`bottom+right`?`${n-a},${a} ${n-a},${r-a} ${a},${r-a}`:o===`right+top`?`${n-a},${r-a} ${n-a},${a} ${a},${a}`:``}function fe(e){if(e.type!==`shape`||!e.shape)return;let t=e.lits;if(!t?.strokeSides||!t.strokeColor||e.fill||t.fillColor||!(t.fillClear||t.fillColor===void 0)||e.svg)return;let n=t.strokeSides,r=[`top`,`right`,`bottom`,`left`].filter(e=>(n[e]??0)>0);if(r.length!==2)return;let[i,a]=r;if(!le.some(([e,t])=>e===i&&t===a||e===a&&t===i))return;let o=n[i];if(o!==n[a])return;let s=o,c=t.width??e.shape.width,l=t.height??e.shape.height;if(!(c>0)||!(l>0)||!(s>0))return;let u=de(i,a,c,l,s);u&&(e.svg=`<svg xmlns="http://www.w3.org/2000/svg" width="${c}" height="${l}" viewBox="0 0 ${c} ${l}" fill="none"><polyline points="${u}" stroke="${ue(t.strokeColor)}" stroke-width="${s}" stroke-linecap="round" stroke-linejoin="round"/></svg>`,delete t.fillClear,delete t.strokeSides,delete t.strokeColor,delete t.strokeWeight)}function pe(e){let t=e.filter(e=>e.type===`shape`&&e.shape?.kind===`rect`&&!e.svg&&e.shape.width>=12&&e.shape.height>=12&&Math.abs(e.shape.width-e.shape.height)<=2);if(t.length===0)return;let n=t[0],r=n.shape.width,i=n.shape.height;for(let t of e)if(!(t.type!==`frame`||!t.insetOverlay||!t.children?.length))for(let e of t.children){if(e.type!==`svg`||!e.iconSize)continue;let t=e.iconSize;e.absolute={h:`MIN`,v:`MIN`,left:(r-t)/2,top:(i-t)/2},delete e.insetOverlay,delete e.insetOffsets}}function me(e){pe(e);let t=e.filter(e=>e.type===`shape`&&e.shape?.kind===`rect`&&!e.svg&&e.absolute?.left!=null&&e.absolute?.top!=null&&e.shape.width>=12&&e.shape.height>=12&&Math.abs(e.shape.width-e.shape.height)<=2);if(t.length!==0)for(let n of e){if(n.type!==`shape`||!n.svg||!n.shape||!n.absolute)continue;let e=n.shape.rotation;if(typeof e!=`number`||Math.abs(Math.abs(e)-45)>1)continue;let r=n.shape.width,i=n.shape.height,a=(n.absolute.left??0)+r/2,o=(n.absolute.top??0)+i/2,s=t[0],c=1/0;for(let e of t){let t=e.absolute.left+e.shape.width/2,n=e.absolute.top+e.shape.height/2,r=(t-a)**2+(n-o)**2;r<c&&(c=r,s=e)}let l=s.absolute.left+s.shape.width/2,u=s.absolute.top+s.shape.height/2;n.absolute.left=l-r/2,n.absolute.top=u-i/2;let d=Math.min(r,i)*.2;e<0?n.absolute.top-=d:n.absolute.top+=d,n.absolute.h=`MIN`,n.absolute.v=`MIN`}}let he=/^(sans-serif|serif|monospace|cursive|fantasy|math|system-ui|ui-sans-serif|ui-serif|ui-monospace|ui-rounded|-apple-system|BlinkMacSystemFont|inherit|initial|revert|revert-layer|unset)$/i;function ge(e){let t=S(e)[0]?.trim().replace(/^["']|["']$/g,``);return t&&!he.test(t)?t:void 0}function _e(e,t){if(!e)return t;let n={...t};for(let[t,r]of Object.entries(e))switch(t){case`text-transform`:{let e={uppercase:`UPPER`,lowercase:`LOWER`,capitalize:`TITLE`,none:`ORIGINAL`};e[r]&&(n.textCase=e[r]);break}case`text-decoration-line`:r===`underline`?n.textDecoration=`UNDERLINE`:r===`line-through`?n.textDecoration=`STRIKETHROUGH`:r===`none`&&(n.textDecoration=`NONE`);break;case`text-align`:{let e={left:`LEFT`,start:`LEFT`,center:`CENTER`,right:`RIGHT`,end:`RIGHT`,justify:`JUSTIFIED`};e[r]&&(n.textAlignH=e[r]);break}case`font-family`:{let e=ge(r);e&&(n.fontFamily=e);break}case`text-overflow`:r===`ellipsis`&&(n.textTruncation=!0);break;case`font-style`:n.fontItalic=r===`italic`||r===`oblique`;break;default:break}return n}
718function ve(e,t,n,r){let i=re(e,Sl(t,n),n,r,t.hugsBelowMaxWidth,t.declared),a=ce(e,wl(t,n),i);if(t.declared?.[`box-sizing`]===`content-box`&&e.lits){let t=e.lits;t.height!==void 0&&(t.height+=(t.paddingTop??0)+(t.paddingBottom??0)),t.width!==void 0&&(t.width+=(t.paddingLeft??0)+(t.paddingRight??0))}let o=_e(t.declared,a);for(let n of[`overflow-x`,`overflow-y`]){let r=t.declared?.[n];r!==void 0&&Gc(n,r)&&(e.clipsContent=!0)}let s=t.declared?.[`aspect-ratio`];if(s&&!e.fixedHeight&&e.lits?.height===void 0){let t=/^([\d.]+)(?: \/ ([\d.]+))?$/.exec(s);if(t){let n=Number(t[1])/Number(t[2]??`1`);n>0&&e.fixedWidth&&Number.isFinite(e.fixedWidth.px)?e.fixedHeight={px:e.fixedWidth.px/n}:n>0&&e.lits?.width!==void 0&&(e.lits.height=e.lits.width/n)}}return o}function ye(e,t){let n=e.fixedWidth?.px??e.lits?.width;if(!(n===void 0||!Number.isFinite(n))&&!(e.fixedHeight||e.lits?.height!==void 0))for(let r of Object.values(t.parts??{})){let t=r.declared?.[`aspect-ratio`];if(!t||r.declared?.position!==`absolute`)continue;let i=/^([\d.]+)(?: \/ ([\d.]+))?$/.exec(t);if(!i)continue;let a=Number(i[1])/Number(i[2]??`1`);if(a>0){(e.lits??={}).height=n/a;return}}}function be(e){let t=e[`outline-color`]!==void 0&&e[`outline-width`]!==void 0,n={};for(let[r,i]of Object.entries(e))r===`outline-color`||r===`outline-width`?t&&(n[`${r}:outline-preview`]=i):n[r]=i;return n}function xe(e,t,n={}){let r=!1,i={};for(let[a,o]of Object.entries(e)){let e=o,s=o.parts?xe(o.parts,t,n):void 0;s&&s!==o.parts&&(e={...e,parts:s});let c={};for(let e of o.statesByProp??[]){if(e.state!==t)continue;let r=n[e.prop];r!==void 0&&Object.assign(c,e.map[r]??{})}let l={...o.states?.[t]??{},...c};Object.keys(l).length>0&&!o.component&&!o.slot&&(e={...e,tokens:{...e.tokens??{},...be(l)}}),e!==o&&(r=!0),i[a]=e}return r?i:e}function Se(e){if(!e.fontSizePath)return;let t=v.get(e.fontSizePath);if(t&&!(t.fontSize!==e.fontSize||t.fontStyle!==b(e)))return t.name}function Ce(e){let t={...e.fontWeightVar===void 0?{}:{fontWeightVar:e.fontWeightVar},...e.lineHeightVar===void 0?{}:{lineHeightVar:e.lineHeightVar}},n=Se(e);return n===void 0?e.fontSizeVar===void 0?t:{fontSizeVar:e.fontSizeVar,...t}:{textStyle:n,...t}}function we(e,t){Object.assign(e,Ce(t))}let Te=e=>typeof e.type==`object`&&`enum`in e.type,Ee=e=>e.type===`boolean`&&e.bindings.figma.kind===`VARIANT`,De=e=>e.default===!0?[`true`,`false`]:[`false`,`true`],Oe=e=>{let t=e.props.filter(e=>Te(e)||Ee(e)).reduce((e,t)=>e*(Te(t)?t.type.enum.length:2),1),n=!!e.figmaStatePreviews&&e.states.length>0;return t===1&&!n},ke=e.icons;function Ae(e,t,n){if(!n)return;let r=new Set;for(let t of e.matchAll(/\s(?:fill|stroke)="([^"]+)"/g))t[1]!==`none`&&r.add(t[1]);return r.size===1&&r.has(t)?l(n):void 0}function je(e,t,n){let r=e.icon.asset,i=r.match(Pe);if(i){let e=t[i[1]];if(e===void 0)throw Error(`Cannot resolve icon asset reference "{${i[1]}}"`);r=e}let a=ke.get(r);if(!a)throw Error(`Unknown icon asset "${r}" (expected assets/icons/${r}.svg)`);let o=n.glyphFillPath??n.textFillPath,s=o?String(d(o)):`#000000`,c=a.replaceAll(`currentColor`,s),l=/<svg\b[^>]*\sfill=/.test(c),u=/<(path|circle|rect|polygon|ellipse|g)[^>]*\sfill=/.test(c);return o&&!l&&!u&&(c=c.replace(/^<svg /,`<svg fill="${s}" `)),e.icon.size&&(c=c.replace(/^(<svg\b[^>]*?)\swidth="[^"]*"/,`$1 width="${e.icon.size}"`).replace(/^(<svg\b[^>]*?)\sheight="[^"]*"/,`$1 height="${e.icon.size}"`)),c}let Me=/^\{([a-z][\w-]*)\}$/;function Ne(e,t,n,r,i){if(t.element!==`input`&&t.element!==`textarea`)return null;let a={type:`frame`,name:e,layout:{mode:`HORIZONTAL`,primary:`MIN`,counter:`CENTER`},grow:t.layout?.grow||void 0},o=ve(a,t,i,r),s=(t.attrs?.placeholder??``).match(Me),c=s?n.props.find(e=>e.type===`text`&&e.name===s[1]):void 0,l=``;if(typeof c?.default==`string`&&c.default.length)l=c.default;else if(c)l=``;else{let e=t.attrs?.placeholder??``;l=Me.test(e)?``:e}return a.children=[{type:`text`,name:`placeholder`,characters:l,fontSize:o.fontSize??16,fontStyle:b(o),...o.lineHeight===void 0?{}:{lineHeight:o.lineHeight},...We(o),...Ce(o),textFill:o.textFill,contentProp:c?.bindings.figma.property}],a}let Pe=/^\{([a-z][\w-]*)\}$/;function Fe(e,t,n,r,i){let a={},o=Oe(e);for(let[r,s]of Object.entries(t)){let t=e.props.find(e=>e.name===r);if(!t)continue;if(t.bindings.figma.kind===`NONE`){(typeof s==`string`||typeof s==`object`)&&i?.pu
718sh(`${e.name} prop "${r}" set to ${typeof s==`object`?`a per-value lookup on "${s.prop}"`:JSON.stringify(s)}: not wired â the dependency binds it figma kind NONE (code-only), so the canvas instance renders ${e.name}'s own default`);continue}let c;if(typeof s==`object`){let e=s.map[n[s.prop]??``];if(e===void 0)continue;c=e}else c=s;if(typeof c==`string`){let e=c.match(Pe);if(e){let t=n[e[1]];if(t===void 0)throw Error(`Cannot resolve parent prop mapping "{${e[1]}}"`);c=t}}let l=t.bindings.figma;if(l.kind===`VARIANT`&&o){let n=typeof c==`boolean`?String(c):c,r=Te(t)&&t.type.enum.length===1?t.type.enum[0]:void 0;(r===void 0||n!==r)&&i?.push(`${e.name} variant property "${l.property}" bound to "${n}": not wired â the dependency emits standalone (single variant, no variant properties) and renders its only form${r===void 0?``:` ("${r}")`}`);continue}typeof c==`boolean`?l.kind===`VARIANT`?a[l.property]=l.values?.[String(c)]??String(c):a[l.property]=c:a[l.property]=l.values?.[c]??c}if(r!==void 0){let t=e.props.find(e=>e.type===`text`&&e.bindings.code.prop===`children`);t&&t.bindings.figma.kind===`NONE`?i?.push(`${e.name} children text "${r}": not wired â ${e.id} exposes no TEXT component property for it (the canvas carries such labels as raw instance overrides, which the contract vocabulary does not model)`):t&&(a[t.bindings.figma.property]=r)}return a}function Ie(e,t,n){if(!t.visibleWhen||t.visibleWhen.equals!==void 0)return;let r=n.props.find(e=>e.name===t.visibleWhen.prop);!r||r.type!==`boolean`||r.bindings.figma.kind!==`VARIANT`&&(e.visibleProp=r.bindings.figma.property,e.visibleDefault=r.default===!0)}function Le(e,t,n,r){for(let i of t.stylesWhen??[]){let t=i.styles.opacity;if(t===void 0||!(i.equals===void 0?r[i.prop]===void 0?n.props.find(e=>e.name===i.prop)?.default===!0:r[i.prop]===`true`:r[i.prop]===i.equals))continue;let a=Number.parseFloat(t);Number.isNaN(a)||(e.opacity=a)}}function Re(e,t,n){let r={},i=/^(-?[\d.]+)px$/;for(let a of e.stylesWhen??[]){if(!(a.equals===void 0?n[a.prop]===void 0?t.props.find(e=>
718e.name===a.prop)?.default===!0:n[a.prop]===`true`:n[a.prop]===a.equals))continue;let e=a.styles;if(e.position!==`absolute`){let t=(e.transform??``).match(/rotate\((-?[\d.]+)deg\)/);t&&(r.rotation=parseFloat(t[1]));continue}let o={h:`MIN`,v:`MIN`},s=e.transform??``,c=e=>{let t=(e??``).match(i);return t?parseFloat(t[1]):void 0};e.left===`50%`&&s.includes(`translateX(-50%)`)?o.h=`CENTER`:c(e.right)===void 0?c(e.left)!==void 0&&(o.h=`MIN`,o.left=c(e.left)):(o.h=`MAX`,o.right=c(e.right)),e.top===`50%`&&s.includes(`translateY(-50%)`)?o.v=`CENTER`:c(e.bottom)===void 0?c(e.top)!==void 0&&(o.v=`MIN`,o.top=c(e.top)):(o.v=`MAX`,o.bottom=c(e.bottom)),r.absolute=o;let l=s.match(/rotate\((-?[\d.]+)deg\)/);l&&(r.rotation=parseFloat(l[1]))}return r}function ze(e,t){return e.declared?.position===`absolute`||e.declared?.position===`fixed`?!0:(e.stylesWhen??[]).some(e=>e.equals!==void 0&&t[e.prop]===e.equals&&(e.styles.position===`absolute`||e.styles.position===`fixed`))}function Be(e,t,n){if(!ze(t,n))return;let r=Ve(t,n);r&&(e.absolute=r)}function Ve(e,t){let n=Sl(e,t),r=wl(e,t),i=e=>{let i=n[e],a;if(i){let e=i.slice(1,-1);for(let[n,r]of Object.entries(t))e=e.replaceAll(`{${n}}`,r);a=String(d(e))}else r[e]!==void 0&&(a=String(r[e]));if(a!==void 0)return A(a)},a=i(`left`),o=i(`right`),s=i(`top`),c=i(`bottom`);if(a===void 0&&o===void 0&&s===void 0&&c===void 0)return null;let l=/^matrix\(1, 0, 0, 1, (-?[\d.]+), (-?[\d.]+)\)$/.exec(e.declared?.transform??``),u=i(`translate-x`)??(l?parseFloat(l[1]):0),f=i(`translate-y`)??(l?parseFloat(l[2]):0),p={h:`MIN`,v:`MIN`};return a!==void 0&&o!==void 0?(p.h=`STRETCH`,p.left=a+u,p.right=o-u):a===void 0?o===void 0?(p.h=`MIN`,p.left=u):(p.h=`MAX`,p.right=o-u):(p.h=`MIN`,p.left=a+u),s!==void 0&&c!==void 0?(p.v=`STRETCH`,p.top=s+f,p.bottom=c-f):s===void 0?c===void 0?(p.v=`MIN`,p.top=f):(p.v=`MAX`,p.bottom=c-f):(p.v=`MIN`,p.top=s+f),p}function He(e,t){if(e.declared?.position===`relative`)return null;let n=Sl(e,t),r=wl(e,t),i={top:0,right:0,bottom:0,left:0},a=0,o=!0;for(let e of[`top`,`right`,`bottom`,`left`]){let s,c=n[e];if(c){let e=c.slice(1,-1);for(let[n,r]of Object.entries(t))e=e.replaceAll(`{${n}}`,r);s=String(d(e))}else r[e]!==void 0&&(s=String(r[e]));if(s===void 0)continue;a++;let l=A(s);l===void 0?o=!1:i[e]=l}if(a===4&&o){let e=e=>{let i=n[e];if(i){let e=i.slice(1,-1);for(let[n,r]of Object.entries(t))e=e.replaceAll(`{${n}}`,r);return A(String(d(e)))??0}return(r[e]===void 0?void 0:A(String(r[e])))??0},a=e(`translate-x`),o=e(`translate-y`);return a!==0||o!==0?{top:i.top+o,bottom:i.bottom-o,left:i.left+a,right:i.right-a}:i}return a===0&&e.declared?.position===`absolute`&&(e.declared?.[`aspect-ratio`]!==void 0||e.declared?.[`max-width`]===`100%`||e.declared?.[`max-height`]===`100%`)?{top:0,right:0,bottom:0,left:0}:null}function Ue(e,t){let n=Object.entries(e),r=e=>e.declared?.position===`absolute`||(e.stylesWhen??[]).some(e=>e.styles.position===`absolute`&&(e.equals===void 0||t[e.prop]===e.equals));return n.sort((e,t)=>Number(r(e[1]))-Number(r(t[1]))),n.filter(([,e])=>{if(Tl(e))return!1;let n=e.visibleWhen;if(n&&n.equals!==void 0){let e=t[n.prop],r=Array.isArray(n.equals)?n.equals:[n.equals];if(e!==void 0&&!r.includes(e))return!1}else if(n&&t[n.prop]!==void 0&&t[n.prop]!==`true`)return!1;for(let n of e.stylesWhen??[])if(n.equals!==void 0&&t[n.prop]===n.equals&&n.styles.display===`none`)return!1;return!(e.declared?.display===`none`&&!(e.stylesWhen??[]).some(e=>e.equals!==void 0&&t[e.prop]===e.equals&&e.styles.display!==void 0&&e.styles.display!==`none`))})}function We(e){return{...e.letterSpacing===void 0?{}:{letterSpacing:e.letterSpacing},...e.textCase===void 0?{}:{textCase:e.textCase},...e.textDecoration===void 0?{}:{textDecoration:e.textDecoration},...e.textAlignH===void 0?{}:{textAlignH:e.textAlignH},...e.fontFamily===void 0?{}:{fontFamily:e.fontFamily},...e.textTruncation?{textTruncation:!0}:{}}}function Ge(e,t,n){let r=e.layout?.grid;if(!r||e.layout?.mode!==`GRID`)return;let i=e.children??[];if(r.flow){if(r.rows.length===0){let e=i.filter(e=>!e.overlay&&!e.insetOverlay&&!e.absolute).length,t=Math.max(1,Math.ceil(e/Math.max(1,r.columns.length)));r.rows=Array.from({length:t},()=>({type:`FLEX`,value:1}))}return}let a=xl(t,n)?.areas??{},o=t.parts??{};
718for(let e of i){let t=o[e.name];if(!t||t.overlay)continue;let n=t.placement??a[e.name];if(!n)continue;let r=`alignX`in n?n.alignX:void 0,i=`alignY`in n?n.alignY:void 0;e.cell={row:n.row,column:n.column,...n.rowSpan&&n.rowSpan>1?{rowSpan:n.rowSpan}:{},...n.columnSpan&&n.columnSpan>1?{columnSpan:n.columnSpan}:{},...r&&r!==`auto`?{hAlign:ne[r]}:{},...i&&i!==`auto`?{vAlign:ne[i]}:{}}}let s=new Set(i.map(e=>e.name));for(let[e,t]of Object.entries(a))s.has(e)||i.push({type:`frame`,name:e,layout:{mode:`HORIZONTAL`,primary:`MIN`,counter:`MIN`},children:[],cell:{row:t.row,column:t.column,...t.rowSpan&&t.rowSpan>1?{rowSpan:t.rowSpan}:{},...t.columnSpan&&t.columnSpan>1?{columnSpan:t.columnSpan}:{}}});e.children=i}function Ke(e,t,n,r,i,a){if(t.repeat&&t.component){let i=r.get(t.component.id);return t.repeat.sample.map((r,o)=>{let s={};for(let[e,t]of Object.entries(r))s[e]=typeof t==`number`?String(t):t;let c={type:`instance`,name:o===0?e:`${e} ${o+1}`,dep:i.name,depContractId:i.id,...i.anchors.figma.componentSetKey?{depAnchorKey:i.anchors.figma.componentSetKey}:{},depProps:Fe(i,{...t.component.props??{},...s},a,t.component.text)};return Ie(c,t,n),c})}if(t.declared?.display===`contents`){for(let e of t.stylesWhen??[])if(e.equals!==void 0&&a[e.prop]===e.equals&&e.styles.display===`none`)return[];return Ue(t.parts??{},a).flatMap(([e,t])=>Ke(e,t,n,r,i,a))}return[qe(e,t,n,r,i,a)]}function qe(e,t,n,r,i,a){let o=Je(e,t,n,r,i,a);return t.overlay&&(o.overlay=t.overlay),Le(o,t,n,a),o}function Je(e,t,n,r,i,a){if(t.icon){let r=re({type:`frame`,name:`_`},Sl(t,a),a,i),o=je(t,a,r),s=r.glyphFillPath??r.textFillPath,c=Ae(o,s?String(d(s)):`#000000`,s),l=(t.declared?.transform??``).match(/rotate\((-?[\d.]+)deg\)/),u=l?parseFloat(l[1]):void 0,f={type:`svg`,name:e,svg:o,...c?{svgPaintVar:c}:{},grow:t.layout?.grow||void 0,...t.icon.size?{iconSize:t.icon.size}:{},...u!==void 0&&!Number.isNaN(u)?{rotation:u}:{}};if(![...Object.keys(Sl(t,a)),...Object.keys(wl(t,a))].some(e=>e===`background-color`||e===`background-image`||e===`box-shadow`||e.startsWith(`padding`)||/^border-(top|right|bottom|left)-width$/.test(e))){let e=He(t,a);return e?(f.insetOverlay=!0,(e.top!==0||e.right!==0||e.bottom!==0||e.left!==0)&&(f.insetOffsets=e)):Be(f,t,a),Ie(f,t,n),f}let p={type:`frame`,name:e,layout:xl(t,a)?D(t,!1,a):{mode:`HORIZONTAL`,primary:`CENTER`,counter:`CENTER`},grow:t.layout?.grow||void 0,children:[{...f,name:`${e}-icon`,grow:void 0}]};ve(p,t,a,i);let m=He(t,a);return m?(p.insetOverlay=!0,(m.top!==0||m.right!==0||m.bottom!==0||m.left!==0)&&(p.insetOffsets=m)):Be(p,t,a),Ie(p,t,n),p}if(t.shape){let r={type:`shape`,name:e,shape:{...t.shape}};ve(r,t,a,i),r.lits?.width!==void 0&&(r.shape.width=r.lits.width),r.lits?.height!==void 0&&(r.shape.height=r.lits.height);let o=Re(t,n,a);if(o.absolute)r.absolute=o.absolute;else if(t.declared?.position===`absolute`){let e=Ve(t,a);e&&(r.absolute=e)}let s=Ve(t,a);return s&&(r.absolute?(s.left!=null&&(r.absolute.left=s.left),s.top!=null&&(r.absolute.top=s.top),s.right!=null&&(r.absolute.right=s.right),s.bottom!=null&&(r.absolute.bottom=s.bottom)):r.absolute=s),P(r),o.rotation!==void 0&&(r.shape.rotation=o.rotation),r.shape.rotation===void 0&&delete r.shape.rotation,Ie(r,t,n),r}{let r=Ne(e,t,n,i,a);if(r)return Ie(r,t,n),r}if(t.component){let i=r.get(t.component.id),o=[],s={type:`instance`,name:e,dep:i.name,depContractId:i.id,...i.anchors.figma.componentSetKey?{depAnchorKey:i.anchors.figma.componentSetKey}:{},depProps:Fe(i,t.component.props??{},a,t.component.text,o)};for(let e of o)(s.channelMiss??=[]).push(e);for(let[n,r]of Object.entries(t.component.overrides??{}))(s.channelMiss??=[]).push(`${e} per-instance override "${n}" (${r}): canvas emission not carried this round â the instance draws the child's own defaults`);return Ie(s,t,n),s}if(t.slot){let o={type:`slot`,name:e,layout:D(t,!1,a),slotProperty:Il(t.slot),slotOptional:t.optional||void 0,slotAccepts:(t.slot.accepts??[]).map(e=>{let t=r.get(e);return{dep:t.name,contractId:t.id,...t.anchors.figma.componentSetKey?{anchorKey:t.anchors.figma.componentSetKey}:{}}})},s=Xe(t.slot);return s&&(o.slotDescription=s),(t.slot.defaultContent?.length??0)>0&&(o.slotDefault=t.slot.defaultContent.map(e=>{let t=r.get(e.id);return{dep:t.name,contractId:t.id,...t.anchors.figma.componentSetKey?{anchorKey:t.anchors.figma.componentSetKey}:{},props:Fe(t,e.props??{},a,e.text)}}
718)),ve(o,t,a,i),Ie(o,t,n),o}let o=()=>[...Object.keys(Sl(t,a)),...Object.keys(wl(t,a))].some(e=>e.startsWith(`padding`)),s=o=>{let s={type:`frame`,name:e,layout:xl(t,a)?D(t,!1,a):{mode:`HORIZONTAL`,primary:`MIN`,counter:`MIN`},grow:t.layout?.grow||void 0,children:[o]},c=ve(s,t,a,i);return o.name=`${e}-text`,o.fontSize=c.fontSize??14,o.fontStyle=b(c),we(o,c),o.textFill=c.textFill,c.lineHeight!==void 0&&(o.lineHeight=c.lineHeight),Object.assign(o,We(c)),s.children.push(...Ue(t.parts??{},a).flatMap(([e,t])=>Ke(e,t,n,r,c,a))),Be(s,t,a),Ie(s,t,n),s};if(t.text!==void 0){let r=t.textByProp?t.textByProp.map[a[t.textByProp.prop]??``]??t.text:t.text;if(o()||Object.keys(t.parts??{}).length>0)return s({type:`text`,name:e,characters:r});let c={type:`text`,name:e};t.layout?.grow&&(c.grow=!0);let l=ve(c,t,a,i);return c.characters=r,c.fontSize=l.fontSize??14,c.fontStyle=b(l),we(c,l),c.textFill=l.textFill,l.lineHeight!==void 0&&(c.lineHeight=l.lineHeight),Object.assign(c,We(l)),Be(c,t,a),Ie(c,t,n),c}if(t.meter){let r=(e,t)=>{let r=n.props.find(t=>t.name===e);return typeof r?.default==`number`?r.default:t},o={type:`frame`,name:e,layout:{mode:`HORIZONTAL`,primary:`MIN`,counter:`MIN`},pct:Math.min(1,Math.max(0,r(t.meter.valueProp,0)/(r(t.meter.maxProp,100)||100))),children:[]};return ve(o,t,a,i),Ie(o,t,n),o}let c=t.content!==void 0&&t.parts!==void 0&&Object.keys(t.parts).length>0&&typeof n.props.find(e=>e.type===`text`&&e.bindings.code.prop===t.content.prop)?.default!=`string`;if(t.content&&!c){let r=n.props.find(e=>e.type===`text`&&e.bindings.code.prop===t.content.prop),c=typeof r.default==`string`?r.default:n.name;if(o())return s({type:`text`,name:e,characters:c,contentProp:r.bindings.figma.property});let l={type:`text`,name:e};t.layout?.grow&&(l.grow=!0);let u=ve(l,t,a,i);return l.characters=c,l.fontSize=u.fontSize??16,l.fontStyle=b(u),we(l,u),l.textFill=u.textFill,u.lineHeight!==void 0&&(l.lineHeight=u.lineHeight),Object.assign(l,We(u)),l.contentProp=r.bindings.figma.property,Ie(l,t,n),l}let l={type:`frame`,name:e,layout:D(t,!1,a),grow:t.layout?.grow||void 0};{let e=He(t,a);if(e)l.insetOverlay=!0,(e.top!==0||e.right!==0||e.bottom!==0||e.left!==0)&&(l.insetOffsets=e);else if(ze(t,a)){let e=Ve(t,a);e&&(l.absolute=e)}}let u=ve(l,t,a,i);return t.element===`img`&&(l.imgPlaceholder=!0,!l.fill&&l.lits?.fillColor===void 0&&l.lits?.fillClear===void 0&&((l.lits??={}).fillColor={r:217/255,g:217/255,b:217/255})),ye(l,t),l.children=Ue(t.parts??{},a).flatMap(([e,t])=>Ke(e,t,n,r,u,a)),O(t,a)&&l.children.reverse(),me(l.children),Ge(l,t,a),l.insetOverlay&&l.layout&&l.children.length>0&&(l.layout={...l.layout,primary:`CENTER`,counter:`CENTER`}),Ie(l,t,n),l}function Ye(e){let t=[],n=e=>{for(let[r,i]of Object.entries(e.parts??{}))i.slot&&t.push(r),n(i)};return n(e),t}function Xe(e){let t=[],n=e.accepts??[],r=e.acceptsMode??(n.length>0?`prefer`:`open`);if(n.length>0&&t.push(r===`restrict`?`Accepts ONLY: ${n.join(`, `)} â REFUSED BY FIGMA: acceptsMode "restrict" has no canvas enforcement (preferredValues is a picker hint), so off-list content is a differ finding, not a canvas impossibility.`:`Accepts: ${n.join(`, `)} (preferred â Figma sorts these first; any component may still be placed).`),e.min!==void 0||e.max!==void 0){let n=e.min!==void 0&&e.max!==void 0?`${e.min}â${e.max}`:e.min===void 0?`at most ${e.max}`:`at least ${e.min}`;t.push(`Expects ${n} item(s) â REFUSED BY FIGMA: a slot carries no count constraint.`)}return e.required&&t.push(`Required â REFUSED BY FIGMA: an empty slot is always legal on canvas.`),t.join(` `)}function Ze(e,t){let n=[];for(let{name:r,part:i}of U(e)){i.component&&!t.has(i.component.id)&&n.push(`${e.id}: part "${r}" references component "${i.component.id}" which has no contract in scope`);for(let r of i.slot?.defaultContent??[])t.has(r.id)||n.push(`${e.id}: slot "${i.slot.name}" defaultContent references "${r.id}" which has no contract in scope`);for(let r of i.slot?.accepts??[])t.has(r)||n.push(`${e.id}: slot "${i.slot.name}" accepts "${r}" which has no contract in scope`);if(i.slot&&i.layout?.display===`grid`&&n.push(`${e.id}: slot "${i.slot.name}" declares display:grid â Figma refuses it verbatim ("GRID layoutMode cannot be applied to Slot frames"); a slot interior is NONE/HORIZONTAL/VERTICAL only`),i.slot){let t=Ye(i);t.length>0&&n.push(`${e.id}: slot "${i.slot.name}" contains slot part(s) "${t.join(`", "`)}" â slot-in-slot is out of contract (API-tolerated but unspecified; the emitter never produces one)`)}}let r=new Map;for(let{name:t,part:n}of U(e)){if(!n.slot)continue;let e=Il(n.slot);r.set(e,[...r.get(e)??[],t])}for(let[t,i]of r)i.length>1&&n.push(`${e.id}: slot parts "${i.join(`", "`)}" all resolve to the Figma property "${t}" â one SLOT property cannot serve two areas (set slot.figmaProperty to disambiguate)`);if(n.length>0)throw Error(`Refused â ${n.length} contract violation(s):\n${n.map(e=>` - ${e}`).join(` 719`)}`)}function Qe(e){let t=e=>!e.overlay&&!e.insetOverlay&&!e.absolute,n=e=>e.fixedWidth!==void 0||e.lits?.width!==void 0||e.pct!=null,r=e=>n(e)||e.type===`text`||e.type===`svg`||e.type===`instance`||e.shape!==void 0?!0:(e.children??[]).filter(t).some(r),i=(e,a)=>{let o=e.children??[],s=t=>{let n=(e.layout?.mode??`HORIZONTAL`)===`VERTICAL`?e.layout?.counter??`MIN`:e.layout?.primary??`MIN`,r={LEFT:`MIN`,CENT
719ER:`CENTER`,RIGHT:`MAX`}[t.textAlignH??`LEFT`];return r!==void 0&&n===r},c=r=>t(r)&&!n(r)&&!(r.type===`text`&&!r.textTruncation&&s(r))&&(r.grow===!0||e.layout?.stretchChildren===!0&&(e.layout?.mode??`HORIZONTAL`)===`VERTICAL`&&r.type!==`instance`),l=o.some(e=>t(e)&&!c(e)&&r(e)),u=(a||l)&&e.hugCeiling!==!0,d=e.layout?.mode===`GRID`;for(let e of o){let t=!d&&u&&c(e);t&&(e.fillW=!0,e.type===`text`&&!e.textTruncation&&(e.fillText=!0)),i(e,t||n(e)||d)}};i(e,n(e))}function $e(e,t){Ze(e,t);let n=e.props.filter(e=>Te(e)||Ee(e)),r=e.props.find(e=>e.type===`text`&&e.bindings.code.prop===`children`),i=e.props.filter(e=>e.type===`boolean`&&!Ee(e)).map(e=>({property:e.bindings.figma.property,default:e.default===!0})),a=typeof r?.default==`string`?r.default:e.name,o=e=>{if(!Te(e))return De(e);let t=[...e.type.enum],n=e.default===void 0?-1:t.indexOf(String(e.default));return n>0&&(t.splice(n,1),t.unshift(String(e.default))),t},s=e.anatomy.root,c=new Set,l=[],u=n.map(e=>({prop:e,values:o(e)})),d=[[]];for(let e of u){let t=[];for(let n of d)for(let r=0;r<e.values.length;r++)t.push([...n,r]);d=t}let f=new Set([`Medium`]);for(let n of d){let i={},o=[],d=0;for(let e=0;e<u.length;e++){let{prop:t,values:r}=u[e],a=r[n[e]];i[t.name]=a,o.push(`${t.bindings.figma.property}=${t.bindings.figma.values?.[a]??a}`),e>=1&&(d=d*r.length+n[e])}let p=n[0]??0;if(Pu(e)){let n={layout:{display:`flex`,direction:`column`}},r={type:`root`,name:o.join(`, `)||e.name,layout:D(n,!0,i)},a=ve(r,n,i,{});r.children=Mu(e).flatMap(([n,r])=>Ke(n,r,e,t,a,i));let s=e=>{e.fontStyle&&f.add(e.fontStyle),(e.children??[]).forEach(s)};s(r),l.push({name:r.name,row:p,col:d,spec:r});continue}let m={type:`root`,name:o.join(`, `)||e.name,layout:D(s,!0,i)},h=ve(m,s,i,{});Le(m,s,e,i),te(m,s,i,c),ye(m,s),s.declared?.display===`block`&&!m.fixedWidth&&m.lits?.width===void 0&&(m.blockRoot=!0),s.icon&&Object.keys(s.parts??{}).length===0?m.children=Ke(`icon`,{icon:s.icon,tokens:s.tokens,declared:s.declared},e,t,h,i):s.parts?(m.children=Ue(s.parts,i).flatMap(([n,r])=>Ke(n,r,e,t,h,i)),O(s,i)&&m.children.reverse(),me(m.children),Ge(m,s,i)):r&&(m.children=[{type:`text`,name:`label`,characters:a,fontSize:h.fontSize??16,fontStyle:b(h),...Ce(h),textFill:h.textFill,...h.lineHeight===void 0?{}:{lineHeight:h.lineHeight},...We(h),contentProp:r.bindings.figma.property}]);let g=e=>{e.fontStyle&&f.add(e.fontStyle),(e.children??[]).forEach(g)};g(m),l.push({name:m.name,row:p,col:d,spec:m})}let p=[],m;if(e.figmaStatePreviews&&e.states.length>0){let n=s.states??{},i=Fl(e),o=Math.max(0,u.findIndex(e=>i.includes(e.prop.name))),l=u[o],d=l?l.values:[null],h=(e,t)=>e.prop.bindings.figma.values?.[t]??t;m={axis:kl,default:Al,states:e.states.map(e=>jl(e)),primary:l?.prop.bindings.figma.property??null,pinned:Object.fromEntries(u.filter((e,t)=>t!==o||!l).map(e=>[e.prop.bindings.figma.property,h(e,e.values[0])]))};let g=u.slice(1).reduce((e,t)=>e*t.values.length,1);for(let i=0;i<e.states.length;i++){let m=e.states[i];for(let h=0;h<d.length;h++){let _={},v=[];for(let e=0;e<u.length;e++){let{prop:t,values:n}=u[e],r=e===o?n[h]:n[0];_[t.name]=r,v.push(`${t.bindings.figma.property}=${t.bindings.figma.values?.[r]??r}`)}let y=Ml(v.join(`, `),jl(m)),x=o===0&&l?h:0,S=o===0||!l?g+i:g+i*d.length+h,C={type:`root`,name:y,layout:D(s,!0,_)},w=ve(C,s,_,{}),T={};for(let e of s.statesByProp??[]){if(e.state!==m)continue;let t=_[e.prop];t!==void 0&&Object.assign(T,e.map[t]??{})}let E=re(C,be({...n[m]??{},...T}),_,w,s.hugsBelowMaxWidth);Le(C,s,e,_),te(C,s,_,c),ye(C,s),s.declared?.display===`block`&&!C.fixedWidth&&C.lits?.width===void 0&&(C.blockRoot=!0),s.parts?(C.children=Ue(xe(s.parts,m,_),_).flatMap(([n,r])=>Ke(n,r,e,t,E,_)),O(s,_)&&C.children.reverse(),me(C.children),Ge(C,s,_)):r&&(C.children=[{type:`text`,name:`label`,characters:a,fontSize:E.fontSize??16,fontStyle:b(E),...Ce(E),textFill:E.textFill,...E.lineHeight===void 0?{}:{lineHeight:E.lineHeight},...We(E),contentProp:r.bindings.figma.property}]);let ee=e=>{e.fontStyle&&f.add(e.fontStyle),(e.children??[]).forEach(ee)};ee(C),p.push({name:C.name,row:x,col:S,spec:C})}}}let h=[];if(p.length>0){let t=new Set(p.map(e=>e.name)),n=new Set;for(let r of p){let i=Pl(r.name);if(i===null||n.has(i))continue;n.add(i);let a=i===`State=Default`?``:i.slice(0,i.length-`, ${kl}=${Al}`.length);for(let{state:n,trigger:r}of $d){if(!e.states.includes(n))continue;let o=Ml(a,jl(n));t.has(o)&&h.push({from:i,trigger:r,to:o})}}}let g=new Set,_=e=>
719{e.contentProp&&g.add(e.contentProp),(e.children??[]).forEach(_)};l.forEach(e=>_(e.spec));let v=e.props.filter(e=>(e.type===`text`||e.type===`number`)&&e.bindings.figma.kind!==`NONE`&&!g.has(e.bindings.figma.property)).map(e=>({property:e.bindings.figma.property,default:typeof e.default==`string`?e.default:typeof e.default==`number`?String(e.default):``})),y=new Set;for(let{name:t,part:n}of U(e)){let e=(e,n,r)=>{qc[e]&&(Gc(e,n)&&!r||y.add(`${t}.${e}: ${n}${r?` [${r}]`:``}`))};for(let[t,r]of Object.entries(n.declared??{}))e(t,r);for(let[t,r]of Object.entries(n.declaredStates??{}))for(let[n,i]of Object.entries(r))e(n,i,t)}let x=new Set,S=new Set,C=new Set,w=e=>{if(e.gradientMiss!==void 0&&(x.add(`${e.name}.background-image: ${e.gradientMiss}`),delete e.gradientMiss),e.shadowMiss!==void 0&&(S.add(`${e.name}.box-shadow: ${e.shadowMiss}`),delete e.shadowMiss),e.channelMiss!==void 0){for(let t of e.channelMiss)C.add(`${e.name}.${t}`);delete e.channelMiss}delete e.scrimBounded,(e.children??[]).forEach(w)};for(let e of l)w(e.spec);for(let e of p)w(e.spec);for(let e of l)it(e.spec);for(let e of p)it(e.spec);let T=e=>{delete e.marginVars,(e.children??[]).forEach(T)};for(let e of l)T(e.spec);for(let e of p)T(e.spec);for(let e of l)Qe(e.spec);for(let e of p)Qe(e.spec);let E=U(e).some(e=>e.part.meter),ee=[...l,...p].some(e=>at(e.spec,e=>e.imgPlaceholder===!0||e.blockRoot===!0)),ne=(e.events??[]).length>0||y.size>0||x.size>0||S.size>0||C.size>0||E||c.size>0||ee;return{setName:e.name,contractId:e.id,anchorKey:e.anchors.figma.componentSetKey??null,description:`${e.name} â generated from contract ${e.id} v${e.version}${ne?` â `:``}`,isSet:l.length+p.length>1,boolProps:i,textProps:v,fontStyles:[...f],variants:l,...(()=>{let t={};for(let n of e.props??[]){let e=n.bindings?.figma?.property;typeof e==`string`&&e&&n.name&&(t[e]=n.name)}return Object.keys(t).length>0?{propNames:t}:{}})(),...e.semantics&&(e.semantics.element||e.semantics.role)?{semantics:{...e.semantics.element?{element:e.semantics.element}:{},...e.semantics.role?{role:e.semantics.role}:{}}}:{},...p.length>0?{stateVariants:p}:{},...p.length>0&&m?{statePreviewAxis:m}:{},...h.length>0?{stateReactions:h}:{},colW:Math.max(380,...[...l,...p].map(e=>(e.spec.fixedWidth?.px??0)+60))}}function et(e,t){let r=e?n(e):null;if(!r||r.size===0)return``;let i=[...r].filter(([,e])=>e.type!==`shadow`&&e.type!==`gradient`&&!k(e.value)).map(([e,n])=>{let r=W(n.value);if(r){let i=t?.(r);if(i===void 0)throw Error(`minted alias {${r}} does not resolve in the token corpus â the provisional preamble has no literal fallback to embed`);let a={...n,value:String(i)};return{name:l(e),type:p(a),value:m(a),alias:r.split(`.`).join(`/`)}}return{name:l(e),type:p(n),value:m(n)}});if(i.length===0)return``;let a=i.some(e=>`alias`in e);return`// --------------------------------------------------------------------------- 720// PROVISIONAL VARIABLES â minted from resolved values by a degraded import. 721// This contract binds ${i.length} provisional token(s) whose real variable names were 722// unrecoverable, so this section upserts each one as a Figma variable in a 723// collection named 'Imported (provisional)' â idempotent by name, within that 724// collection only â before the bindings below look anything up. The values 725// are literal-fidelity stand-ins, not your design vocabulary: rename them 726// against your real tokens when you adopt the contract. 727// --------------------------------------------------------------------------- 728const MINTED_VARIABLES = ${JSON.stringify(i)}; 729{ 730 // Minted colors may be 8-digit hex (paint opacity captured by dump v1.1) â 731 // Figma COLOR variables accept RGBA, so the alpha channel survives. 732 const hexToRgb = (hex) => { 733 const h = hex.replace('#', ''); 734 const c = { 735 r: parseInt(h.slice(0, 2), 16) / 255, 736 g: parseInt(h.slice(2, 4), 16) / 255,
737 b: parseInt(h.slice(4, 6), 16) / 255, 738 }; 739 if (h.length === 8) c.a = parseInt(h.slice(6, 8), 16) / 255; 740 return c; 741 }; 742 const cols = await figma.variables.getLocalVariableCollectionsAsync(); 743 let col = cols.find((c) => c.name === 'Imported (provisional)'); 744 if (!col) col = figma.variables.createVariableCollection('Imported (provisional)'); 745 const modeId = col.modes[0].modeId; 746 const byName = {};${a?` 747 // Source-aliased leaves (task #26): when the origin file already carries the 748 // REAL token variable (p/font-weight-medium â polaris's 00-tokens script 749 // upserts the full set), the provisional variable aliases it natively, so it 750 // inherits mode values instead of freezing a literal. In a file without the 751 // target (the headless compile receipt runs in an empty file) the embedded 752 // resolved literal is the named fallback. 753 const allByName = {};`:``} 754 for (const v of await figma.variables.getLocalVariablesAsync()) { 755 if (v.variableCollectionId === col.id) byName[v.name] = v;${a?` 756 allByName[v.name] = v;`:``} 757 } 758 for (const t of MINTED_VARIABLES) { 759 let v = byName[t.name]; 760 if (!v) { v = figma.variables.createVariable(t.name, col, t.type); byName[t.name] = v; }${a?` 761 const aliasTarget = t.alias ? allByName[t.alias] : null; 762 if (aliasTarget && aliasTarget.id !== v.id) { 763 v.setValueForMode(modeId, { type: 'VARIABLE_ALIAS', id: aliasTarget.id }); 764 continue; 765 }`:``} 766 v.setValueForMode(modeId, t.type === 'COLOR' ? hexToRgb(t.value) : t.value); 767 } 768} 769 770`}let tt=e=>typeof e.opacity==`number`||(e.children??[]).some(tt),nt=e=>[...e.variants,...e.stateVariants??[]].some(e=>tt(e.spec)),rt=e=>e?` 771 // Node opacity (dump v1.2 channel): applies to every node kind. 772 if (typeof spec.opacity === 'number') node.opacity = spec.opacity;`:``;function it(e){for(let t of e.children??[])it(t);if(!e.layout||e.bindings?.itemSpacing!==void 0||e.lits?.itemSpacing!==void 0)return;let t=(e.children??[]).filter(e=>!e.overlay&&!e.insetOverlay&&!e.absolute);if(t.length<2)return;let n=(e.layout.mode??`HORIZONTAL`)===`HORIZONTAL`,r=n?`left`:`top`,i=n?`right`:`bottom`,a=[];for(let e=0;e<t.length-1;e++){let n=t[e].margins?.[i]??0,o=t[e+1].margins?.[r]??0,s=[];n!==0&&s.push(t[e].marginVars?.[i]??null),o!==0&&s.push(t[e+1].marginVars?.[r]??null),a.push({px:n+o,vars:s})}let o=a[0].px;if(o<=0||!a.every(e=>e.px===o))return;let s=new Set(a.flatMap(e=>e.vars));s.size===1&&a.every(e=>e.vars.length===1)&&!s.has(null)?e.bindings={...e.bindings,itemSpacing:[...s][0]}:(e.lits??={}).itemSpacing=o;for(let e=0;e<t.length;e++){let n=t[e].margins;n&&(e<t.length-1&&(delete n[i],t[e].marginVars&&delete t[e].marginVars[i]),e>0&&(delete n[r],t[e].marginVars&&delete t[e].marginVars[r]),Object.values(n).every(e=>e===void 0)&&delete t[e].margins)}}let at=(e,t)=>
772t(e)||(e.children??[]).some(e=>at(e,t)),ot=(e,t)=>[...e.variants,...e.stateVariants??[]].some(e=>at(e.spec,t)),st=e=>e?`spec.strokeOutside ? 'OUTSIDE' : 'INSIDE'`:`'INSIDE'`,ct=e=>e?` 773// Round 5d: auto-layout has no per-child margin â a child carrying residual 774// margins gets its CSS MARGIN BOX as a fixed wrapper frame (clipsContent 775// false), the child placed at (left, top). Negative margins shrink the flow 776// box and let the glyph overhang â the exact CSS geometry (the Badge pip's 777// -2/-2/-8 is what keeps the real pill 20px tall). Out-of-flow children 778// (overlay / inset / absolute) and FILL-sized children keep their own 779// lowering. 780function applyMarginBox(parent, childNode, childSpec, registry) { 781 const m = childSpec.margins; 782 if (!m || childSpec.overlay || childSpec.insetOverlay || childSpec.absolute || childSpec.grow) return; 783 try { 784 if (childNode.layoutSizingHorizontal === 'FILL' || childNode.layoutSizingVertical === 'FILL') return; 785 } catch (e) { /* nodes without layout sizing */ } 786 const t = m.top || 0, r = m.right || 0, b = m.bottom || 0, l = m.left || 0; 787 if (!t && !r && !b && !l) return; 788 const w = Math.max(childNode.width + l + r, 0.01); 789 const h = Math.max(childNode.height + t + b, 0.01); 790 const box = figma.createFrame(); 791 box.name = childSpec.name + ' (margin box)'; 792 box.fills = []; 793 box.clipsContent = false; 794 parent.insertChild(parent.children.indexOf(childNode), box); 795 box.resize(w, h); 796 box.appendChild(childNode); 797 childNode.x = l; 798 childNode.y = t; 799 // Wave B.4 / Polaris Button: a Show-bound child wrapped in a margin box 800 // must transfer the visible binding to the WRAPPER â hiding only the 801 // inner icon leaves the ~20px margin box in auto-layout (blank left gap). 802 if (childSpec.visibleProp && registry && registry.visibles) { 803 for (const vis of registry.visibles) { 804 if (vis.node === childNode) vis.node = box; 805 } 806 childNode.visible = true; 807 } 808} 809`:``,lt=(e,t)=>e?` 810 applyMarginBox(${t});`:``,ut=e=>e?` 811 if (spec.svgPaintVar) { 812 const glyphPaint = boundPaint(spec.svgPaintVar, node); 813 const rebind = (n) => { 814 if (Array.isArray(n.fills) && n.fills.length > 0) n.fills = [glyphPaint]; 815 if (Array.isArray(n.strokes) && n.strokes.length > 0) n.strokes = [glyphPaint]; 816 if (n.children) for (const c of n.children) rebind(c); 817 }; 818 for (const c of node.children) rebind(c); 819 }`:``,dt=(e,t,n,r=!1,i=!1)=>e?` else if (spec.type === 'shape') { 820 // FC-PSEUDO-STROKE-GLYPH: adjacent two-side border L collapsed to a 821 // ROUND-cap polyline SVG (see collapseTwoSideStrokeGlyph). Keep type 822 // 'shape' so absolute/rotation placement still uses shape.width/height. 823 if (spec.svg) { 824 node = figma.createNodeFromSvg(spec.svg); 825 node.fills = []; 826 node.clipsContent = false; 827 try { node.resize(spec.shape.width, spec.shape.height); } catch (e) { /* svg intrinsic */ } 828 if (typeof spec.shape.rotation === 'number' && spec.shape.rotation !== 0) node.rotation = -spec.shape.rotation;${t} 829 } else { 830 // v9 shape (#42): a REAL parametric node with native rotation. 831 node = spec.shape.kind === 'ellipse' ? figma.createEllipse() 832 : spec.shape.kind === 'rect' ? figma.createRectangle() 833 : figma.createPolygon(); 834 if (spec.shape.kind === 'polygon' && spec.shape.sides) node.pointCount = spec.shape.sides; 835 node.resize(spec.shape.width, spec.shape.height); 836${i?` // Constant ellipse arc sweep (round 2 iteration 4): native arcData, the 837 // exact radians the dump captured (Figma ArcData semantics both ways). 838 if (spec.shape.kind === 'ellipse' && spec.shape.arc) { 839 node.arcData = { startingAngle: spec.shape.arc.start, endingAngle: spec.shape.arc.end, innerRadius: spec.shape.arc.innerRadius }; 840 } 841`:``} // Shape nodes ship a default gray paint â a spec with NO fill channel 842 // clears it (a canvas artifact is not contract data; Phase B deviation 3). 843 // Round 5f (B5E finding 2): a shape's LITERAL fill (lits.fillColor â the 844 // RadioButton checked dot's white, compiled from the decor's 845 // background-color literal) was DROPPED here (the shape branch never runs
846 // applyFrameSpec's litsRuntime), so the dot landed with no fill and had to 847 // be hand-corrected on canvas each re-amend. Apply it at the SOURCE: 848 // bound fill wins; else a literal fill; else clear. 849 node.fills = spec.fill 850 ? [boundPaint(spec.fill, node)] 851 : (spec.lits && spec.lits.fillColor) 852 ? [{ type: 'SOLID', color: { r: spec.lits.fillColor.r, g: spec.lits.fillColor.g, b: spec.lits.fillColor.b }, opacity: spec.lits.fillColor.a === undefined ? 1 : spec.lits.fillColor.a }] 853 : []; 854 // spec.stroke + spec.bindings apply exactly as on frames (Phase B 855 // deviation 2: the emitted shape branch silently dropped the checkbox / 856 // radio backdrop strokes and radii â the shim now lives at the source). 857 if (spec.stroke) { 858 node.strokes = [boundPaint(spec.stroke, node)]; 859 node.strokeAlign = ${n}; 860 }${r?` 861 // CARBON LIVE-DEFECT ROUND (D2): a shape's LITERAL RING. An unchecked 862 // Carbon checkbox box is a transparent square with a 1px border â a ring 863 // with no paint, no weight and no radius is not a box. 864 else if (spec.lits && spec.lits.strokeColor) { 865 node.strokes = [{ type: 'SOLID', color: { r: spec.lits.strokeColor.r, g: spec.lits.strokeColor.g, b: spec.lits.strokeColor.b }, opacity: spec.lits.strokeColor.a === undefined ? 1 : spec.lits.strokeColor.a }]; 866 node.strokeAlign = ${n}; 867 } 868 if (spec.lits && spec.lits.strokeWeight !== undefined) node.strokeWeight = spec.lits.strokeWeight; 869 if (spec.lits && spec.lits.strokeSides) { 870 const sw = spec.lits.strokeSides; 871 // ELLIPSE/LINE/etc. expose strokeWeight only â per-side props throw 872 // "Cannot add property strokeTopWeight, object is not extensible". 873 if ('strokeTopWeight' in node) { 874 if (sw.top !== undefined) node.strokeTopWeight = sw.top; 875 if (sw.right !== undefined) node.strokeRightWeight = sw.right; 876 if (sw.bottom !== undefined) node.strokeBottomWeight = sw.bottom; 877 if (sw.left !== undefined) node.strokeLeftWeight = sw.left; 878 } else { 879 const w = sw.top !== undefined ? sw.top : (sw.right !== undefined ? sw.right : (sw.bottom !== undefined ? sw.bottom : sw.left)); 880 if (w !== undefined) node.strokeWeight = w; 881 } 882 } 883 if (spec.lits && spec.lits.radius !== undefined) node.cornerRadius = spec.lits.radius;`:``} 884 for (const [field, varName] of Object.entries(spec.bindings || {})) { 885 node.setBoundVariable(field, need(varName)); 886 } 887 if (typeof spec.shape.rotation === 'number' && spec.shape.rotation !== 0) node.rotation = -spec.shape.rotation;${t} 888 } 889 }`:``,ft=e=>e?` 890 if (typeof spec.lineHeight === 'number') node.lineHeight = { unit: 'PIXELS', value: spec.lineHeight }; 891 else if (spec.lineHeight && typeof spec.lineHeight === 'object' && typeof spec.lineHeight.value === 'number') { 892 node.lineHeight = { unit: spec.lineHeight.unit === 'PERCENT' ? 'PERCENT' : 'PIXELS', value: spec.lineHeight.value }; 893 }`:``,pt=e=>e?` 894 if (spec.dropShadow) { 895 // Single DROP_SHADOW (dump v1.2 box-shadow grammar) as a native effect. 896 const s8 = spec.dropShadow.color.replace('#', ''); 897 node.effects = [{ 898 type: 'DROP_SHADOW', 899 color: { 900 r: parseInt(s8.slice(0, 2), 16) / 255, 901 g: parseInt(s8.slice(2, 4), 16) / 255,
902 b: parseInt(s8.slice(4, 6), 16) / 255, 903 a: s8.length === 8 ? parseInt(s8.slice(6, 8), 16) / 255 : 1, 904 }, 905 offset: { x: spec.dropShadow.x, y: spec.dropShadow.y }, 906 radius: spec.dropShadow.radius, 907 spread: spec.dropShadow.spread || 0, 908 visible: true, 909 blendMode: 'NORMAL', 910 }]; 911 }`:``,mt=e=>e?` 912 if (spec.effectStack) { 913 // v15: full box-shadow stack â multi-layer + inset as native effects. 914 node.effects = spec.effectStack.map((e) => ({ 915 type: e.inner ? 'INNER_SHADOW' : 'DROP_SHADOW', 916 color: { r: e.color.r, g: e.color.g, b: e.color.b, a: e.color.a === undefined ? 1 : e.color.a }, 917 offset: { x: e.x, y: e.y }, 918 radius: e.radius, 919 spread: e.spread || 0, 920 visible: true, 921 blendMode: 'NORMAL', 922 })); 923 }`:``,ht=e=>e?` 924 if (spec.gradient) { 925 // CSS angle: 0deg = to top, clockwise. Unit-square gradientTransform. 926 const ga = ((spec.gradient.angle - 90) * Math.PI) / 180; 927 const gc = Math.cos(ga), gs = Math.sin(ga); 928 const paint = { 929 type: 'GRADIENT_LINEAR', 930 gradientTransform: [[gc, gs, (1 - gc - gs) / 2], [-gs, gc, (1 + gs - gc) / 2]], 931 gradientStops: spec.gradient.stops.map((st) => ({ position: st.position, color: { r: st.color.r, g: st.color.g, b: st.color.b, a: st.color.a === undefined ? 1 : st.color.a } })), 932 }; 933 const base = node.fills === figma.mixed ? [] : (node.fills || []); 934 node.fills = base.concat([paint]); 935 }`:``,gt=(e,t)=>e?`${t?` 936 // â layout.wrap on a COLUMN stack is NOT applied â Figma's layoutWrap is 937 // HORIZONTAL-only and setting it on a column THROWS, so the guard below skips 938 // it and the column renders as a single unwrapped stack. CSS wraps a column 939 // happily; the canvas has no such thing.`:``} 940 if (l.wrap && node.layoutMode === 'HORIZONTAL') node.layoutWrap = 'WRAP';`:``,_t=e=>e?` 941// The SLOT property id a slot node is bound to (the \`slotContentId\` key of 942// componentPropertyReferences â a native reference kind, not \`mainComponent\`). 943function slotKeyOf(slotNode) { 944 const refs = slotNode.componentPropertyReferences || {}; 945 return refs.slotContentId || null; 946} 947 948// \`accepts\` â preferredValues, resolved through the SAME identity path the 949// nested-instance emission uses. Soft by construction: Figma sorts these to 950// the top of the picker and refuses nothing (probe 2b). 951function slotPreferredValues(spec) { 952 const out = []; 953 for (const depRef of spec.slotAccepts || []) { 954 // G10 (2026-08-08) â \`accepts\` IS a HARD EMISSION-ORDER DEPENDENCY, and 955 // this is where that was discovered: resolving a preferred value needs the 956 // accepted component to ALREADY EXIST IN THE FILE, so an accepts list 957 // silently defines a build order. The order itself is handled (contracts 958 // emit in topological order of the accepts graph, sortByDependencies), but 959 // a PARTIAL emission legitimately cannot see outside its own subset â and 960 // throwing there made the whole component unshippable over a picker hint. 961 // The accepted component is not required for the slot to work: preferredValues 962 // is a sort order and Figma refuses nothing (probe 2b). So an unresolvable 963 // entry is a NAMED DEFERRAL, never a throw â the slot ships without that one 964 // preferred value and says which one and why. 965 const target = resolveComponentIdentity( 966 { contractId: depRef.contractId, anchorKey: depRef.anchorKey, name: depRef.dep }, 967 'Slot "' + spec.slotProperty + '" preferred value', 968 true, 969 ); 970 if (!target) { 971 console.log( 972 'slot-accepts-deferred: Slot "' + spec.slotProperty + '" accepts "' + depRef.contractId + 973 '", which is not in this file (a partial emission cannot carry a slot constraint pointing ' + 974 'outside the emitted subset) â the slot ships WITHOUT that preferred value; emit "' + 975 depRef.contractId + '" first to carry it (G10)' 976 ); 977 continue; 978 } 979 out.push({ type: target.type === 'COMPONENT_SET' ? 'COMPONENT_SET' : 'COMPONENT', key: target.key }); 980 } 981 return out; 982} 983 984// THE LOAD-BEARING RULE (probe 2d): one slot property per contract slot, 985// shared by every variant's slot node. \`existingKey\` is the PRESERVED 986// identity â the id an earlier variant minted (create path) or the id the set 987// already carried under this display name (amend path). When the freshly 988// minted id differs, the rebuilt node is rebound to the preserved one and the 989// duplicate is deleted in the same pass; instance fills keyed to the 990// preserved id come back verbatim. 991function bindSlot(owner, sl, existingKey) { 992 const minted = slotKeyOf(sl.slot); 993 if (!minted && !existingKey) { 994 throw new Error( 995 'Slot "' + sl.spec.slotProperty + '": createSlot() minted no linked SLOT property ' +
996 '(componentPropertyReferences.slotContentId absent) â refusing to ship an unbound slot', 997 ); 998 } 999 const key = existingKey || minted; 1000 let rebound = false; 1001 if (existingKey && minted && minted !== existingKey) { 1002 sl.slot.componentPropertyReferences = { slotContentId: existingKey }; 1003 owner.deleteComponentProperty(minted); 1004 rebound = true; 1005 } 1006 // Non-destructive on every pass (proposal §3.6): accepts/description edits 1007 // never touch the id, so they cost no content. 1008 const preferred = slotPreferredValues(sl.spec); 1009 const patch = {}; 1010 if (preferred.length > 0) patch.preferredValues = preferred; 1011 if (sl.spec.slotDescription) patch.description = sl.spec.slotDescription; 1012 if (Object.keys(patch).length > 0) owner.editComponentProperty(key, patch); 1013 return { key: key, rebound: rebound }; 1014} 1015 1016// MIGRATION (proposal §6): a set emitted under the old convention carries an 1017// INSTANCE_SWAP property (defaulting to the dashed "Slot" utility) where the 1018// contract now wants a native SLOT. The two property types cannot share an 1019// id, so the legacy property is retired â and every instance that OVERRODE 1020// it is named, because a swap override is an instance and a slot fill is a 1021// child subtree: the transfer is not automatic, and a silent drop would take 1022// a designer's choice with it. 1023async function strandedSwapOverrides(legacyKey, legacyDefault) { 1024 const out = []; 1025 for (const page of figma.root.children) { 1026 for (const inst of page.findAll((n) => n.type === 'INSTANCE')) { 1027 let props = {}; 1028 try { props = inst.componentProperties || {}; } catch (e) { continue; } 1029 const def = props[legacyKey]; 1030 if (!def || def.value === undefined || def.value === null) continue; 1031 if (String(def.value) === String(legacyDefault)) continue; 1032 let chosen = String(def.value);
1033 try { 1034 const node = await figma.getNodeByIdAsync(String(def.value)); 1035 if (node && node.name) chosen = node.name; 1036 } catch (e) { /* the swapped main may be gone â the id is still the truth */ } 1037 out.push(inst.name + ' (' + inst.id + ') â ' + chosen); 1038 } 1039 } 1040 return out; 1041} 1042 1043async function migrateLegacySlotProperty(owner, legacyKey, legacyDef, name, report) { 1044 const stranded = await strandedSwapOverrides(legacyKey, legacyDef.defaultValue); 1045 owner.deleteComponentProperty(legacyKey); 1046 report.migratedSlots = (report.migratedSlots || []).concat([name]); 1047 if (stranded.length > 0) { 1048 report.strandedSwapOverrides = (report.strandedSwapOverrides || []).concat(stranded); 1049 } 1050} 1051 1052function findSlotUtility() { 1053 for (const page of figma.root.children) { 1054 const hit = page.findOne((n) => n.type === 'COMPONENT' && n.name === 'Slot'); 1055 if (hit) return hit; 1056 } 1057 return null; 1058} 1059 1060// Proposal §6.4: the utility component goes LAST, and only when nothing in 1061// the file still points at it. Refusing to delete is reported with its 1062// reason â a stranded utility is a fact, not a failure. 1063function retireSlotUtility() { 1064 const util = findSlotUtility(); 1065 if (!util) return null; 1066 for (const t of allSyncTargets()) { 1067 let defs = {}; 1068 try { defs = t.componentPropertyDefinitions || {}; } catch (e) { defs = {}; } 1069 for (const k of Object.keys(defs)) { 1070 const d = defs[k]; 1071 if (d && d.type === 'INSTANCE_SWAP' && String(d.defaultValue) === util.id) { 1072 return { retired: false, reason: 'INSTANCE_SWAP property "' + k.split('#')[0] + '" on "' + t.name + '" still defaults to the Slot utility' }; 1073 } 1074 } 1075 } 1076 for (const page of figma.root.children) { 1077 const live = page.findOne((n) => n.type === 'INSTANCE' && n.name === 'Slot'); 1078 if (live) return { retired: false, reason: 'a "Slot" utility instance is still placed on page "' + page.name + '"' }; 1079 } 1080 util.remove(); 1081 return { retired: true }; 1082} 1083`:``,vt=e=>e?` 1084 if (spec.fontFamily) { 1085 // PER-FAMILY STYLE SPELLING. The compiled style name comes from 1086 // FONT_STYLE_BY_WEIGHT, which is spelled Inter's way ("Semi Bold", 1087 // "Extra Light"). Other families spell the same face WITHOUT the space 1088 // â IBM Plex Sans ships "SemiBold", "ExtraLight" â so the Inter-spelled 1089 // load THROWS and the node silently keeps the Inter fallback assigned 1090 // above. That is a SUBSTITUTION, not a failure: nothing was logged, 1091 // nothing was refused, and the canvas rendered a different typeface at 1092 // different advance widths (altitude heading 194px of Inter Semi Bold 1093 // where IBM Plex Sans SemiBold is 185px). 1094 // 1095 // A space-free retry was tried on 2026-08-08 and REVERTED because the 1096 // then-pinned references were CONTRACT renders made by a harness that 1097 // loaded no @font-face, so the truer canvas font scored WORSE. That 1098 // premise is dead: the references are now the real library renders 1099 // (extract/computed/out/<lane>/<comp>/orig-shots/, committed by 1100 // run.ts --keep-originals) and the capture harness loads the library's 1101 // own faces (cfg.fonts). Truer is now also closer. 1102 // 1103 // The fallback is kept â a family Figma does not have at all must still 1104 // draw something â but it is no longer SILENT: an unresolved style is 1105 // named on the console with a stable code. 1106 const wantStyle = spec.fontStyle || 'Medium'; 1107 const styleCandidates = [wantStyle]; 1108 const tightStyle = wantStyle.split(' ').join(''); 1109 if (tightStyle !== wantStyle) styleCandidates.push(tightStyle); 1110 let fontResolved = false; 1111 for (let i = 0; i < styleCandidates.length; i++) { 1112 try { 1113 await figma.loadFontAsync({ family: spec.fontFamily, style: styleCandidates[i] }); 1114 node.fontName = { family: spec.fontFamily, style: styleCandidates[i] }; 1115 fontResolved = true; 1116 break; 1117 } catch (e) { /* try this family's own spelling of the same face */ } 1118 } 1119 if (!fontResolved) { 1120 console.warn( 1121 'FC-FONT-STYLE-UNRESOLVED: ' + spec.fontFamily + ' / ' + wantStyle + 1122 ' is not available in this file (tried ' + styleCandidates.join(', ') + 1123 ') â Inter ' + wantStyle + ' stands in, so the glyph metrics are NOT the library ones', 1124 ); 1125 } 1126 } 1127 if (typeof spec.letterSpacing === 'number') node.letterSpacing = { unit: 'PIXELS', value: spec.letterSpacing }; 1128 if (spec.textCase) node.textCase = spec.textCase; 1129 if (spec.textDecoration) node.textDecoration = spec.textDecoration; 1130 if (spec.textAlignH) node.textAlignHorizontal = spec.textAlignH; 1131 if (spec.textTruncation) { try { node.textTruncation = 'ENDING'; } catch (e) { /* older API */ } }`:``,F=e=>e?` 1132// A2 grid: declaration order is API-pinned (P2: sizes must match the CURRENT 1133// count â "Grid track sizes must be the same length as the grid column 1134// count"), so counts are written FIRST, then sizes, then gaps, then flow. 1135// P10 hazard guard (mode-switch destroys tracks): entering GRID resets the 1136// canvas to a default 2Ã2 â safe ONLY because the full declaration is 1137// rewritten here every time, and applyGridChildren re-verifies the canvas 1138// holds EXACTLY the declared lists before any placement. Nothing ever relies 1139// on tracks surviving a mode switch. 1140function applyGridFrame(node, l) { 1141 const g = l.grid; 1142 node.layoutMode = 'GRID'; 1143 node.gridRowCount = g.rows.length; 1144 node.gridColumnCount = g.columns.length; 1145 // FC-GRID-HUG-VALUE. READ and WRITE are not symmetric here. P2b observed a 1146 // HUG track reading back as {type:'HUG', value:1} and this emitter mirrored 1147 // that shape into the WRITE â but writing {type:'HUG', value:1} makes the 1148 // API reinterpret the entry as FIXED at that value, so every "fit" track 1149 // silently became a 1px fixed track (live probe: {type:'HUG'} round-trips 1150 // as HUG; {type:'HUG', value:1} reads back FIXED, and re-setting it with a 1151 // value can never recover). HUG is written as the bare type, never valued. 1152 const trackWrite = (t) => (t.type === 'HUG' ? { type: 'HUG' } : { type: t.type, value: t.value }); 1153 node.gridRowSizes = g.rows.map(trackWrite); 1154 node.gridColumnSizes = g.columns.map(trackWrite); 1155 node.gridRowGap = g.rowGap; 1156 node.gridColumnGap = g.columnGap; 1157 if (g.flow) node.gridItemsPositioning = g.flow; 1158 // FC-GRID-ROOT-VSIZE â CLOSED by G8 (2026-08-08). NOT here: see applyGridHug, 1159 // which runs LAST. primaryAxisSizingMode/counterAxisSizingMode = 'AUTO' (the 1160 // flex spelling of hug, applied by the caller) are INERT on a GRID frame 1161 // (GP1b/GP8: they read back HUG while the frame keeps its FIXED size), so a 1162 // grid frame kept createFrame's FIXED 100 on any unpinned axis. The contract 1163 // now states the fact â literals width/height "fit-content" â and the ONLY 1164 // faithful lowering is layoutSizing{Horizontal,Vertical}='HUG', written after 1165 // resize() and after every child (GP4b: a later resize of a hugged axis 1166 // silently reverts BOTH the sizing mode and the track list). 1167} 1168 1169// G8 â the LAST write on a grid frame. Deliberately separate from 1170// applyGridFrame: hug must follow resize() and every child append (GP4b), so 1171// applyGridChildren calls it at its own tail. Hugging an axis that carries an 1172// {fr} track destroys the ratio silently (GP1/GP5/GP12), so the schema refuses 1173// that combination BY NAME (grid-hug-flex-axis) and this function asserts it
1174// rather than trusting the compile step. 1175function applyGridHug(node, l) { 1176 const g = l.grid; 1177 if (!g) return; 1178 if (g.hugWidth) { 1179 if (g.columns.some(function (t) { return t.type === 'FLEX'; })) 1180 throw new Error('grid-hug-flex-axis: refusing to hug the width of a grid whose column tracks contain FLEX â the ratio would be silently normalized to HUG (GP1/GP12)'); 1181 node.layoutSizingHorizontal = 'HUG'; 1182 } 1183 if (g.hugHeight) { 1184 if (g.rows.some(function (t) { return t.type === 'FLEX'; })) 1185 throw new Error('grid-hug-flex-axis: refusing to hug the height of a grid whose row tracks contain FLEX â the ratio would be silently normalized to HUG (GP1/GP5)'); 1186 node.layoutSizingVertical = 'HUG'; 1187 } 1188} 1189 1190// A2 grid: children were appended by the caller â now the probe-pinned tail: 1191// place ALL children (child.setGridChildPosition, the child-side setter, P3) 1192// BEFORE any span (the occupancy throw) â but placement is a PERMUTATION, 1193// not a loop, because appendChild already auto-placed every child row-major 1194// (FC-GRID-APPEND-AUTOPLACE, see below) â then FILL (G3: a placed part fills 1195// both axes of its cell; fixed channels keep their box; TEXT hugs â the flex 1196// fence re-proved under grid, P4), then per-child aligns (P3's four-value 1197// fence). Out-of-flow children are skipped throughout (P13). 1198function applyGridChildren(parent, spec, built) { 1199 const l = spec.layout; 1200 if (!l || l.mode !== 'GRID' || !l.grid) return; 1201 // P9/P10 declaration guard: Figma absorbs placement overflow by REWRITING
1202 // gridRowCount (P9) and destroys tracks on mode switch (P10). A mismatch 1203 // here means the canvas holds a declaration the contract did not make â 1204 // refuse loudly, never carry the rewrite. 1205 if (parent.gridRowSizes.length !== l.grid.rows.length || parent.gridColumnSizes.length !== l.grid.columns.length) { 1206 throw new Error( 1207 'grid-declaration-rewritten: canvas holds ' + parent.gridRowSizes.length + 'x' + parent.gridColumnSizes.length + 1208 ' tracks but the contract declared ' + l.grid.rows.length + 'x' + l.grid.columns.length + 1209 ' (P9 overflow absorption / P10 mode-switch loss) â refusing to carry a write the contract did not make' 1210 ); 1211 } 1212 const inFlow = built.filter((p) => !p[0].overlay && !p[0].insetOverlay && !p[0].absolute && p[1].layoutPositioning !== 'ABSOLUTE'); 1213 const placed = inFlow.filter((p) => p[0].cell); 1214 if (!l.grid.flow) { 1215 // FC-GRID-APPEND-AUTOPLACE. appendChild does not park a grid child 1216 // nowhere â the canvas AUTO-PLACES it row-major into the next free cell 1217 // (live probe: five appends land (0,0)(0,1)(0,2)(0,3)(1,0)). So by the 1218 // time this runs every child already OCCUPIES a cell, and a naive 1219 // one-pass "place them all in contract order" throws P3's occupancy 1220 // error the moment a target cell is still held by a sibling that has not 1221 // been moved yet â which the canonical bento hits on its SECOND child. 1222 // Placement is therefore a PERMUTATION problem, not a loop: repeatedly 1223 // place every child whose target is free, and when only cycles remain, 1224 // park one child in a spare cell to break the cycle. Spans stay in the 1225 // second pass (all children at span 1 while the permutation resolves â 1226 // the probe-pinned place-before-span rule is what makes that sound). 1227 const rowCount = l.grid.rows.length; 1228 const colCount = l.grid.columns.length; 1229 const cellKey = (r, c) => r + ',' + c; 1230 const liveOccupancy = () => { 1231 const m = {}; 1232 for (const p of placed) m[cellKey(p[1].gridRowAnchorIndex, p[1].gridColumnAnchorIndex)] = p; 1233 return m; 1234 }; 1235 const moveTo = (p, r, c) => { p[1].setGridChildPosition(r, c); }; 1236 const remaining = placed.slice(); 1237 let guard = remaining.length * remaining.length + remaining.length + 8; 1238 while (remaining.length > 0) { 1239 if (guard-- <= 0) { 1240 throw new Error( 1241 'grid-placement-unresolvable: could not sequence ' + remaining.length + 1242 ' grid placement(s) without an occupancy collision (FC-GRID-APPEND-AUTOPLACE guard)' 1243 ); 1244 } 1245 const occ = liveOccupancy(); 1246 let moved = false; 1247 for (let i = remaining.length - 1; i >= 0; i--) { 1248 const p = remaining[i]; 1249 const t = cellKey(p[0].cell.row, p[0].cell.column); 1250 const holder = occ[t]; 1251 if (holder && holder !== p) continue; // still blocked by a sibling 1252 moveTo(p, p[0].cell.row, p[0].cell.column); 1253 remaining.splice(i, 1); 1254 moved = true; 1255 } 1256 if (moved || remaining.length === 0) continue; 1257 // Every remaining target is blocked by another remaining child â a 1258 // permutation CYCLE. Park one of them in a cell nobody wants and that 1259 // nobody currently holds; the next pass then has a free target. 1260 const occ2 = liveOccupancy(); 1261 const wanted = {}; 1262 for (const p of remaining) wanted[cellKey(p[0].cell.row, p[0].cell.column)] = true; 1263 let spare = null; 1264 for (let r = 0; r < rowCount && !spare; r++) { 1265 for (let c = 0; c < colCount && !spare; c++) { 1266 const k = cellKey(r, c); 1267 if (!occ2[k] && !wanted[k]) spare = { r: r, c: c }; 1268 } 1269 } 1270 if (!spare) { 1271 throw new Error( 1272 'grid-placement-cycle-no-spare: the declared ' + rowCount + 'x' + colCount + 1273 ' grid has no free cell to break a placement cycle through â refusing rather than throwing P3 mid-script' 1274 ); 1275 } 1276 moveTo(remaining[0], spare.r, spare.c); 1277 } 1278 for (const p of placed) { 1279 if (p[0].cell.rowSpan) p[1].gridRowSpan = p[0].cell.rowSpan; 1280 if (p[0].cell.columnSpan) p[1].gridColumnSpan = p[0].cell.columnSpan; 1281 } 1282 } 1283 for (const p of inFlow) { 1284 const cs = p[0], cn = p[1];
1285 if (cs.type === 'text') continue; // text hugs its glyphs (P4's fence) 1286 // G8: a child that declares its OWN intrinsic axis keeps it â FILL would 1287 // silently overwrite the hug applied by that child's own applyGridHug. 1288 const childGrid = cs.layout && cs.layout.grid ? cs.layout.grid : null; 1289 // G3â² (2026-08-08, probe GP14) â FILL AND HUG ON THE SAME AXIS IS CIRCULAR. 1290 // G3's default is that a placed part fills both axes of its cell. On an axis 1291 // the PARENT hugs, that makes the track's size a function of the child and 1292 // the child's size a function of the track: Figma resolves the loop by 1293 // FREEZING whatever box the node already had. Measured live: a hugging 1294 // two-column root with two FILL slots reported layoutSizingVertical 'HUG' 1295 // and stayed 640x100; the instant its children stopped filling, the root 1296 // collapsed to the real content height, and restoring FILL did not undo it. 1297 // A frozen box is worse than a wrong one â it is a stale box that reads as 1298 // a measurement. So on a hugged axis the child HUGS (its own content is what 1299 // the track must measure) and never fills. CSS agrees: against a 1300 // fit-content track, align-self:stretch resolves to the content size â the 1301 // track is sized first and the child stretches into the RESULT. 1302 // A non-auto-layout frame refuses HUG (P4) and keeps its drawn box, which is 1303 // exactly the right contribution. 1304 const hugW = !!(l.grid.hugWidth || (childGrid && childGrid.hugWidth)); 1305 const hugH = !!(l.grid.hugHeight || (childGrid && childGrid.hugHeight)); 1306 if (!cs.fixedWidth && !(cs.lits && cs.lits.width !== undefined) && !hugW) { 1307 try { cn.layoutSizingHorizontal = 'FILL'; } catch (e) { /* HUG-only nodes */ } 1308 } else if (l.grid.hugWidth && !cs.fixedWidth && !(cs.lits && cs.lits.width !== undefined)) { 1309 try { cn.layoutSizingHorizontal = 'HUG'; } catch (e) { /* keeps its drawn box */ } 1310 } 1311 if (!cs.fixedHeight && !(cs.lits && cs.lits.height !== undefined) && !hugH) { 1312 try { cn.layoutSizingVertical = 'FILL'; } catch (e) { /* HUG-only nodes */ } 1313 } else if (l.grid.hugHeight && !cs.fixedHeight && !(cs.lits && cs.lits.height !== undefined)) { 1314 try { cn.layoutSizingVertical = 'HUG'; } catch (e) { /* keeps its drawn box */ } 1315 } 1316 } 1317 for (const p of placed) { 1318 if (p[0].cell.hAlign) p[1].gridChildHorizontalAlign = p[0].cell.hAlign; 1319 if (p[0].cell.vAlign) p[1].gridChildVerticalAlign = p[0].cell.vAlign; 1320 } 1321 // G8 â LAST, after resize and after every child (GP4b). 1322 applyGridHug(parent, spec.layout); 1323} 1324`:``,yt=(e,t)=>e?` 1325 applyGridChildren(${t});`:``,bt=e=>e?` 1326// v9 shape placement: exact offsets vs the parent box, after append. 1327function applyShapeAbsolute(parent, childNode, childSpec) { 1328 if (!childSpec.absolute) return; 1329 try { 1330 // CSS overflow:visible â unclip parent AND FRAME/COMPONENT ancestors so 1331 // overhanging absolute thumbs (Slider left:-10) aren't half-cut by a 1332 // grandparent track that still defaults to clipsContent:true. 1333 for (let n = parent; n && 'clipsContent' in n; n = n.parent) { 1334 if (n.type === 'COMPONENT_SET' || n.type === 'PAGE' || n.type === 'SECTION') break; 1335 if (dsDeclaredClipStops(n)) break; 1336 n.clipsContent = false; 1337 dsOverhangUnclip.add(n.id); 1338 } 1339 childNode.layoutPositioning = 'ABSOLUTE'; 1340 const a = childSpec.absolute; 1341 // absolute-position round: STRETCH pins BOTH sides â size derives from 1342 // the parent box minus the offsets (rail: left 0 + right 0, fixed height). 1343 if (a.h === 'STRETCH' || a.v === 'STRETCH') { 1344 const w2 = a.h === 'STRETCH' ? Math.max(parent.width - (a.left || 0) - (a.right || 0), 0.01) : childNode.width; 1345 const h2 = a.v === 'STRETCH' ? Math.max(parent.height - (a.top || 0) - (a.bottom || 0), 0.01) : childNode.height; 1346 childNode.resize(w2, h2); 1347 } 1348 childNode.constraints = { 1349 horizontal: a.h === 'STRETCH' ? 'STRETCH' : a.h === 'MAX' ? 'MAX' : a.h === 'CENTER' ? 'CENTER' : 'MIN', 1350 vertical: a.v === 'STRETCH' ? 'STRETCH' : a.v === 'MAX' ? 'MAX' : a.v === 'CENTER' ? 'CENTER' : 'MIN', 1351 }; 1352 if (a.h === 'STRETCH' || a.v === 'STRETCH') { 1353 childNode.x = a.h === 'STRETCH' ? (a.left || 0) : childNode.x; 1354 childNode.y = a.v === 'STRETCH' ? (a.top || 0) : childNode.y; 1355 if (a.h !== 'STRETCH' && a.left !== undefined) childNode.x = a.left; 1356 if (a.h !== 'STRETCH' && a.right !== undefined) childNode.x = parent.width - a.right - childNode.width; 1357 if (a.v !== 'STRETCH' && a.top !== undefined) childNode.y = a.top; 1358 if (a.v !== 'STRETCH' && a.bottom !== undefined) childNode.y = parent.height - a.bottom - childNode.height; 1359 return; 1360 } 1361 const w = childSpec.shape ? childSpec.shape.width : childNode.width; 1362 const h = childSpec.shape ? childSpec.shape.height : childNode.height; 1363 // Center of the intrinsic box in parent coordinates (MIN pins left/top, 1364 // MAX pins right/bottom, CENTER centers): 1365 const cx = a.left !== undefined ? a.left + w / 2 : a.right !== undefined ? parent.width - a.right - w / 2 : parent.width / 2; 1366 const cy = a.top !== undefined ? a.top + h / 2 : a.bottom !== undefined ? parent.height - a.bottom - h / 2 : parent.height / 2; 1367 // Rotation moves the measured box â correct against the actual bounds. 1368 const bb = childNode.absoluteBoundingBox; 1369 const pb = parent.absoluteBoundingBox; 1370 if (bb && pb) { 1371 childNode.x += cx - bb.width / 2 - (bb.x - pb.x); 1372 childNode.y += cy - bb.height / 2 - (bb.y - pb.y); 1373 } else { 1374 childNode.x = cx - w / 2; 1375 childNode.y = cy - h / 2; 1376 } 1377 } catch (e) { /* parent not auto-layout â leave in flow */ } 1378} 1379`:``,xt=(e,t)=>
1379e?` 1380 applyShapeAbsolute(${t});`:``,St=e=>e?` 1381// B-3 finding 5: an inset-0 overlay part (top/right/bottom/left all 0) is 1382// lowered out of flow â ABSOLUTE, stretched to the parent, BEHIND the 1383// in-flow siblings â matching the declared anatomy and the HTML render. 1384function applyInsetOverlay(parent, childNode, childSpec) { 1385 if (!childSpec.insetOverlay) return; 1386 try { 1387 // CSS overflow:visible â unclip parent AND FRAME/COMPONENT ancestors so 1388 // overhanging thumbs/rails aren't clipped by a grandparent track 1389 // (Astryx Slider semi-circle residual under default clipsContent:true). 1390 for (let n = parent; n && 'clipsContent' in n; n = n.parent) { 1391 if (n.type === 'COMPONENT_SET' || n.type === 'PAGE' || n.type === 'SECTION') break; 1392 if (dsDeclaredClipStops(n)) break; 1393 n.clipsContent = false; 1394 dsOverhangUnclip.add(n.id); 1395 } 1396 // Round 5f (B5E finding 3): only a childless BACKDROP overlay (an 1397 // inset:0 fill layer â TextField's backdrop) lowers BEHIND the in-flow 1398 // siblings (index 0). A CONTENT overlay that carries glyphs (the Checkbox 1399 // check, the RadioButton dot, a remove button) must stay ON TOP at its 1400 // natural post-backdrop index â else the opaque backdrop sibling paints 1401 // over the glyph (the checkbox backdrop-over-glyph z-order the owner saw, 1402 // previously hand-corrected on canvas each re-amend). 1403 // Absolute-position round: the backdrop shove applies ONLY to true 1404 // inset-0 backdrops (no offsets). An OFFSET overlay (Slider's rail/track 1405 // at their y positions) keeps its compile-time paint order â the shove 1406 // was inverting rail/track stacking. 1407 if ((!childNode.children || childNode.children.length === 0) && !childSpec.insetOffsets) { 1408 parent.insertChild(0, childNode); 1409 } 1410 childNode.layoutPositioning = 'ABSOLUTE'; 1411 const o = childSpec.insetOffsets || { top: 0, right: 0, bottom: 0, left: 0 }; 1412 // Astryx Slider thumb finding: inset overlays with fixedWidth/fixedHeight 1413 // (20Ã20 disk) must NOT STRETCH into a hug-zero display:contents parent â 1414 // that collapsed thumbs into 1px lines / semi-circles. Keep intrinsic size. 1415 const fw = childSpec.fixedWidth && typeof childSpec.fixedWidth.px === 'number' ? childSpec.fixedWidth.px : null; 1416 const fh = childSpec.fixedHeight && typeof childSpec.fixedHeight.px === 'number' ? childSpec.fixedHeight.px : null; 1417 if (fw != null || fh != null) { 1418 childNode.constraints = { 1419 horizontal: fw != null ? 'MIN' : 'STRETCH', 1420 vertical: fh != null ? 'MIN' : 'STRETCH', 1421 }; 1422 childNode.x = o.left; 1423 childNode.y = o.top; 1424 childNode.resize( 1425 Math.max(1, fw != null ? fw : (parent.width - o.left - o.right)), 1426 Math.max(1, fh != null ? fh : (parent.height - o.top - o.bottom)), 1427 ); 1428 } else { 1429 childNode.constraints = { horizontal: 'STRETCH', vertical: 'STRETCH' }; 1430 childNode.x = o.left; 1431 childNode.y = o.top; 1432 childNode.resize( 1433 Math.max(1, parent.width - o.left - o.right), 1434 Math.max(1, parent.height - o.top - o.bottom), 1435 ); 1436 } 1437 } catch (e) { /* parent not auto-layout â leave in flow */ } 1438} 1439`:``,Ct=(e,t)=>e?` 1440 applyInsetOverlay(${t});`:``,wt=e=>e?` 1441function resizeOutOfFlow(parent, built) { 1442 for (const pair of built) { 1443 const childSpec = pair[0], childNode = pair[1]; 1444 try { 1445 if (childSpec.insetOverlay) { 1446 const o = childSpec.insetOffsets || { top: 0, right: 0, bottom: 0, left: 0 }; 1447 childNode.x = o.left || 0; 1448 childNode.y = o.top || 0; 1449 const fw = childSpec.fixedWidth && typeof childSpec.fixedWidth.px === 'number' ? childSpec.fixedWidth.px : null; 1450 const fh = childSpec.fixedHeight && typeof childSpec.fixedHeight.px === 'number' ? childSpec.fixedHeight.px : null; 1451 if (fw != null || fh != null) { 1452 childNode.resize( 1453 Math.max(1, fw != null ? fw : (parent.width - (o.left || 0) - (o.right || 0))), 1454 Math.max(1, fh != null ? fh : (parent.height - (o.top || 0) - (o.bottom || 0))), 1455 ); 1456 } else { 1457 childNode.resize( 1458 Math.max(1, parent.width - (o.left || 0) - (o.right || 0
1458)), 1459 Math.max(1, parent.height - (o.top || 0) - (o.bottom || 0)), 1460 ); 1461 } 1462 } else if (childSpec.absolute && (childSpec.absolute.h === 'STRETCH' || childSpec.absolute.v === 'STRETCH')) { 1463 const a = childSpec.absolute; 1464 childNode.resize( 1465 a.h === 'STRETCH' ? Math.max(parent.width - (a.left || 0) - (a.right || 0), 0.01) : childNode.width, 1466 a.v === 'STRETCH' ? Math.max(parent.height - (a.top || 0) - (a.bottom || 0), 0.01) : childNode.height, 1467 ); 1468 if (a.h === 'STRETCH') childNode.x = a.left || 0; 1469 if (a.v === 'STRETCH') childNode.y = a.top || 0; 1470 } 1471 } catch (e) { /* parent not auto-layout â the child stayed in flow */ } 1472 } 1473} 1474`:``,Tt=(e,t)=>e?` 1475 resizeOutOfFlow(${t});`:``,Et=e=>e?` 1476function propagateOverflowVisible(childNode, parent) { 1477 if (!childNode || !('clipsContent' in childNode) || childNode.clipsContent !== false) return; 1478 if (!dsOverhangUnclip.has(childNode.id)) return; 1479 for (let n = parent; n && 'clipsContent' in n; n = n.parent) { 1480 if (n.type === 'COMPONENT_SET' || n.type === 'PAGE' || n.type === 'SECTION') break; 1481 if (dsDeclaredClipStops(n)) break; 1482 n.clipsContent = false; 1483 dsOverhangUnclip.add(n.id); 1484 } 1485} 1486`:``,Dt=(e,t,n)=>e?` 1487 propagateOverflowVisible(${t}, ${n});`:``,Ot=(e,t=!1)=>e?` 1488 if (spec.lits) { 1489 // v14 literals: no variable to bind â plain values, compile-parsed. 1490 const li = spec.lits; 1491 if (li.paddingTop !== undefined) node.paddingTop = li.paddingTop; 1492 if (li.paddingBottom !== undefined) node.paddingBottom = li.paddingBottom; 1493 if (li.paddingLeft !== undefined) node.paddingLeft = li.paddingLeft; 1494 if (li.paddingRight !== undefined) node.paddingRight = li.paddingRight; 1495 if (li.itemSpacing !== undefined) node.itemSpacing = li.itemSpacing; 1496 if (li.radius !== undefined) node.cornerRadius = li.radius; 1497 if (li.strokeWeight !== undefined) node.strokeWeight = li.strokeWeight; 1498 if (li.minWidth !== undefined) { try { node.minWidth = li.minWidth; } catch (e) { /* needs auto-layout */ } } 1499 if (li.minHeight !== undefined) { try { node.minHeight = li.minHeight; } catch (e) { /* needs auto-layout */ } } 1500 // #60 fix 1 (fillClear precedence): a spec-carried fill is NEVER 1501 // trampled â fillClear only clears when no fill was spec'd. The compile 1502 // side already drops fillClear when a fill binding exists (applyLiterals); 1503 // this runtime guard makes the emitted script safe even for hand-fed 1504 // specs carrying both. 1505 if (li.fillClear && !spec.fill) node.fills = []; 1506 else if (li.fillColor) node.fills = [{ type: 'SOLID', color: { r: li.fillColor.r, g: li.fillColor.g, b: li.fillColor.b }, opacity: li.fillColor.a === undefined ? 1 : li.fillColor.a }]; 1507 if (li.radiusCorners) { 1508 const rc = li.radiusCorners; 1509 if (rc.tl !== undefined) node.topLeftRadius = rc.tl; 1510 if (rc.tr !== undefined) node.topRightRadius = rc.tr; 1511 if (rc.bl !== undefined) node.bottomLeftRadius = rc.bl; 1512 if (rc.br !== undefined) node.bottomRightRadius = rc.br; 1513 } 1514${t?` if (li.strokeColor) node.strokes = [{ type: 'SOLID', color: { r: li.strokeColor.r, g: li.strokeColor.g, b: li.strokeColor.b }, opacity: li.strokeColor.a === undefined ? 1 : li.strokeColor.a }]; 1515`:``} if (li.strokeSides) { 1516 const sw = li.strokeSides; 1517 // ELLIPSE/LINE expose strokeWeight only â per-side props throw 1518 // "Cannot add property strokeTopWeight, object is not extensible" 1519 // (Tailwind ToggleSwitch thumb live finding, Wave B.1). 1520 if ('strokeTopWeight' in node) { 1521 if (sw.top !== undefined) node.strokeTopWeight = sw.top; 1522 if (sw.right !== undefined) node.strokeRightWeight = sw.right; 1523 if (sw.bottom !== undefined) node.strokeBottomWeight = sw.bottom; 1524 if (sw.left !== undefined) node.strokeLeftWeight = sw.left; 1525 } else { 1526 const w = sw.top !== undefined ? sw.top : (sw.right !== undefined ? sw.right : (sw.bottom !== undefined ? sw.bottom : sw.left)); 1527 if (w !== undefined) node.strokeWeight = w; 1528 } 1529 } 1530 if (li.width !== undefined || li.height !== undefined) { 1531 node.resize(li.width !== undefined ? li.width : node.width, li.height !== undefined ? li.height : node.height); 1532 // GRID's primary axis is HORIZONTAL (GP1b: primaryAxisSizingMode='AUTO' 1533 // reads back as layoutSizingHorizontal 'HUG'), like a HORIZONTAL frame. 1534 const gm = (spec.layout || { mode: 'HORIZONTAL' }).mode; 1535 const horizontalIsPrimary = gm === 'HORIZONTAL' || gm === 'GRID'; 1536 if (li.width !== undefined) { 1537 if (horizontalIsPrimary) node.primaryAxisSizingMode = 'FIXED'; else node.counterAxisSizingMode = 'FIXED'; 1538 } 1539 if (li.height !== undefined) { 1540 if (horizontalIsPrimary) node.counterAxisSizingMode = 'FIXED'; else node.primaryAxisSizingMode = 'FIXED'; 1541 } 1542 } 1543 }`:``;function kt(n,r,i,a){let o=[];if(ad(n,r,o,e.icons),o.length>0)throw Error(`Refused â ${o.length} contract violation(s):\n${o.map(e=>` - ${e}`).join(` 1544`)}`);return At([$e(n,r)],i??n.anchors.figma.fileKey,{header:`// GENERATED by scripts/generate-figma.ts â DO NOT EDIT. 1545// Source of truth: contracts/${n.id.replace(/^[^.]+\./,``)}.contract.json (${n.id} v${n.version}) 1546// Amend-capable (#60): an existing component (set) carrying our identity 1547// marker is reconciled IN PLACE (same node id + key); unchanged specs skip.`,preamble:et(a,d),variableCollection:t})}function I(e,t){return At(e,t,{header:`// GENERATED by scripts/generate-figma.ts â DO NOT EDIT. 1548// Batch sync: ${e.map(e=>e.setName).join(`, `)} (unchanged components skip; changed ones amend in place).`,preamble:``})}function At(e,t,n){let r=e.some(nt),i=e.some(e=>ot(e,e=>e.shape!==void 0)),a=e.some(e=>ot(e,e=>e.shape!==void 0&&e.shape.arc!==void 0)),o=e.some(e=>ot(e,e=>e.dropShadow!==void 0)),s=e.some(e=>ot(e,e=>e.lineHeight!==void 0)),c=e.some(e=>ot(e,e=>e.absolute!==void 0)),l=e.some(e=>ot(e,e=>e.lits!==void 0)),u=e.some(e=>ot(e,e=>e.lits?.strokeColor!==void 0)),d=e.some(e=>ot(e,e=>e.shape!==void 0&&(e.lits?.strokeColor!==void 0||e.lits?.strokeWeight!==void 0||e.lits?.strokeSides!==void 0||e.lits?.radiu
1548s!==void 0))),f=e.some(e=>ot(e,e=>e.layout?.mode===`GRID`)),p=e.some(e=>ot(e,e=>e.type===`slot`)),m=e.some(e=>ot(e,e=>(e.children??[]).length===0&&(e.type===`slot`||e.type===`frame`||e.type===`root`)&&e.layout?.mode!==`GRID`)),h=e.some(e=>ot(e,e=>e.layout?.wrap===!0)),g=e.some(e=>ot(e,e=>e.layout?.wrap===!0&&e.layout?.mode!==`HORIZONTAL`)),_=e.some(e=>ot(e,e=>e.effectStack!==void 0)),v=e.some(e=>ot(e,e=>e.gradient!==void 0)),y=e.some(e=>ot(e,e=>e.insetOverlay===!0)),b=e.some(e=>ot(e,e=>e.margins!==void 0)),x=e.some(e=>ot(e,e=>e.strokeOutside===!0)),S=e.some(e=>ot(e,e=>e.svgPaintVar!==void 0)),C=e.some(e=>ot(e,e=>e.letterSpacing!==void 0||e.textCase!==void 0||e.textDecoration!==void 0||e.textAlignH!==void 0||e.fontFamily!==void 0||e.textTruncation===!0));return`${n.header} 1549const COMPONENTS = ${JSON.stringify(e,null,2)}; 1550const ROW_H = 240, PAD = 40; 1551 1552const EXPECTED_FILE_KEY = ${JSON.stringify(t)}; 1553if (EXPECTED_FILE_KEY && figma.fileKey && figma.fileKey !== EXPECTED_FILE_KEY) { 1554 throw new Error('WRONG FILE: expected ' + EXPECTED_FILE_KEY + ', got ' + figma.fileKey); 1555} 1556 1557await figma.loadAllPagesAsync(); 1558 1559${n.preamble}const allVars = await figma.variables.getLocalVariablesAsync(); 1560const varByName = {}; 1561for (const v of allVars) varByName[v.name] = v; 1562// FC-THEME-ISO: a multi-library file carries colliding variable names across 1563// collections (four \`imported/badge/root/background-color/info\`s on the 1564// Testing file). The last-created-collection-wins map above silently rebound 1565// fills across libraries (altitude Badge rendered a Polaris provisional 1566// light-blue). Prefer the single collection covering the MOST of THIS 1567// script's referenced names; names unique to one collection still resolve 1568// globally, and an explicit preferred collection (below) still wins. 1569{ 1570 const _names = new Set(allVars.map((v) => v.name)); 1571 const _wanted = new Set(); 1572 const _walk = (x) => { 1573 if (typeof x === 'string') { if (_names.has(x)) _wanted.add(x); return; } 1574 if (Array.isArray(x)) { for (const y of x) _walk(y); return; } 1575 if (x && typeof x === 'object') { for (const k in x) _walk(x[k]); } 1576 }; 1577 _walk(COMPONENTS); 1578 let _dupe = false; 1579 const _seen = new Set(); 1580 for (const v of allVars) { 1581 if (!_wanted.has(v.name)) continue; 1582 if (_seen.has(v.name)) { _dupe = true; break; } 1583 _seen.add(v.name); 1584 } 1585 if (_dupe) { 1586 const _cov = new Map(); 1587 for (const v of allVars) { 1588 if (!_wanted.has(v.name)) continue; 1589 if (!_cov.has(v.variableCollectionId)) _cov.set(v.variableCollectionId, new Set()); 1590 _cov.get(v.variableCollectionId).add(v.name); 1591 } 1592 let _best = null, _bestN = 0; 1593 for (const [_colId, _covered] of _cov) { 1594 if (_covered.size > _bestN) { _best = _colId; _bestN = _covered.size; } 1595 } 1596 if (_best !== null) { 1597 for (const v of allVars) { 1598 if (v.variableCollectionId === _best && _wanted.has(v.name)) varByName[v.name] = v; 1599 } 1600 } 1601 } 1602}${n.variableCollection?` 1603{ 1604 const _cols = await figma.variables.getLocalVariableCollectionsAsync(); 1605 const _prefCol = _cols.find((c) => c.name === ${JSON.stringify(n.variableCollection)}); 1606 if (_prefCol) { 1607 for (const v of allVars) { 1608 if (v.variableCollectionId === _prefCol.id) varByName[v.name] = v; 1609 } 1610 } 1611}`:``} 1612const need = (name) => { 1613 const v = varByName[name]; 1614 if (!v) throw new Error('Missing variable: ' + name); 1615 return v; 1616}; 1617const boundPaint = (varName, consumer) => { 1618 // Seed the base with the resolved value when a consumer node is known: 1619 // Figma keeps rendering a reassigned bound paint's BASE color on 1620 // pre-existing nodes (fresh nodes normalize at assignment) â without the 1621 // seed, amended variants render black. The binding itself is unchanged. 1622 // B-3 finding 2: the resolved ALPHA rides the seed too (paint opacity) â 1623 // discarding it rendered Badge's rgba(0,0,0,.06) pill as opaque black on 1624 // amended nodes. 1625 const v = need(varName); 1626 let base = { r: 0, g: 0, b: 0 }; 1627 let alpha = 1; 1628 if (consumer) { 1629 try { 1630 const r = v.resolveForConsumer(consumer); 1631 if (r && r.value && r.value.r !== undefined) { 1632 base = { r: r.value.r, g: r.value.g, b: r.value.b }; 1633 if (typeof r.value.a === 'number') alpha = r.value.a; 1634 } 1635 } catch (e) { /* fall back to black base */ } 1636 } 1637 return figma.variables.setBoundVariableForPaint({ type: 'SOLID', color: base, opacity: alpha }, 'color', v); 1638}; 1639 1640// Named text styles (synced by 01-tokens.js): consumers look up O
1640UR styles 1641// only â the ds_contracts/textStyleToken marker is identity, a foreign style 1642// sharing a name is never used. When a compiled spec carries textStyle, the 1643// named style MUST bind â missing or failed setTextStyleIdAsync refuses by 1644// the stable code text-style-identity-refused (never silently keep raw props). 1645let _textStyleMap = null; 1646async function ourTextStyle(name) { 1647 if (!_textStyleMap) { 1648 _textStyleMap = {}; 1649 for (const s of await figma.getLocalTextStylesAsync()) { 1650 if (s.getSharedPluginData('ds_contracts', 'textStyleToken')) _textStyleMap[s.name] = s; 1651 } 1652 } 1653 return _textStyleMap[name] || null; 1654} 1655 1656const fontStyles = new Set(['Medium']); 1657for (const C of COMPONENTS) for (const s of C.fontStyles) fontStyles.add(s); 1658for (const style of fontStyles) { 1659 await figma.loadFontAsync({ family: 'Inter', style }); 1660} 1661 1662// State previews (figmaStatePreviews): merge the enum-API cartesian with the 1663// canvas-only preview overlay; base variants gain an explicit State=Default 1664// segment so every variant in the set carries the axis (Figma derives 1665// variant properties from names). Contracts without previews pass through 1666// untouched â names, hashes, and amend reconciliation are unchanged. 1667function withStateAxis(C) { 1668 if (!C.stateVariants || C.stateVariants.length === 0) return C.variants; 1669 return C.variants.map((v) => { 1670 const name = v.name.indexOf('=') >= 0 ? v.name + ', State=${Al}' : 'State=${Al}'; 1671 return Object.assign({}, v, { name: name, spec: Object.assign({}, v.spec, { name: name }) }); 1672 }).concat(C.stateVariants); 1673} 1674 1675// PROTOTYPE WIRING: turn the State preview axis into LIVE behavior. Each 1676// State=Default variant that has a hover/active twin gets a Figma prototype 1677// reaction CHANGE_TO that twin, so presentation mode swaps on hover/press 1678// instead of showing a static grid of previews. 1679// 1680// Shapes are pinned by figma-sync/plugin/typings/reactions.d.ts (vendored 1681// from @figma/[email protected]): trigger {type:'ON_HOVER'|'ON_PRESS'}, 1682// action {type:'NODE', destinationId, navigation:'CHANGE_TO', transition}. 1683// transition is ALWAYS null â durations/easings are not contract facts, and 1684// the capability matrix keeps animation code-only. 1685// 1686// The write goes through setReactionsAsync, never \`node.reactions = [â¦]\`: 1687// the property is read-only whenever a manifest declares 1688// documentAccess: dynamic-page, and the async setter is correct in BOTH 1689// modes. The headless mock enforces this (assignment THROWS there). 1690// 1691// OWNERSHIP: within a set the contract opts in for, variant reactions are 1692// contract-owned â every variant is normalized (sources get their pair, 1693// everything else is cleared). Sets whose contract carries no stateReactions 1694// are NEVER touched, so hand-authored prototyping elsewhere survives. 1695async function wireStateReactions(setNode, byName, C) { 1696 const wires = C.stateReactions || []; 1697 if (wires.length === 0) return 0; 1698 if (!C.isSet) { 1699 throw new Error('State reactions on a non-set component (' + C.setName + ') â variant swaps need siblings'); 1700 } 1701 const grouped = {}; 1702 for (const w of wires) { 1703 const src = byName.get(w.from); 1704 const dst = byName.get(w.to); 1705 // REFUSE BY NAME rather than silently skipping: the emitter guarantees 1706 // both variants exist in every path that reaches here. 1707 if (!src) throw new Error('State reaction source variant not found in "' + C.setName + '": ' + w.from); 1708 if (!dst) throw new Error('State reaction destination variant not found in "' + C.setName + '": ' + w.to); 1709 (grouped[w.from] = grouped[w.from] || []).push({ 1710 trigger: { type: w.trigger }, 1711 actions: [{ type: 'NODE', destinationId: dst.id, navigation: 'CHANGE_TO', transition: null }], 1712 }); 1713 } 1714 let wired = 0; 1715 for (const child of setNode.children) { 1716 const want = grouped[child.name] || []; 1717 const have = child.reactions || []; 1718 if (want.length === 0 && have.length === 0) continue; 1719 await child.setReactionsAsync(want); 1720 if (want.length > 0) wired++; 1721 } 1722 return wired; 1723} 1724 1725function isSyncTarget(n) { 1726 return n.type === 'COMPONENT_SET' || 1727 (n.type === 'COMPONENT' && (!n.parent || n.parent.type !== 'COMPONENT_SET')); 1728} 1729 1730function allSyncTargets() { 1731 const out = []; 1732 for (const page of figma.root.children) { 1733 for (const node of page.findAll((n) => isSyncTarget(n))) out.push(node); 1734 } 1735 return out; 1736} 1737 1738// One resolver for nested instances, slot defaults/preferred values, and 1739// top-level amend targets. Semantic identity wins; names are admitted only 1740// for explicit pre-contractId generated nodes.
1741function resolveComponentIdentity(ref, purpose, allowMissing) { 1742 const targets = allSyncTargets(); 1743 const exact = targets.filter( 1744 (n) => n.getSharedPluginData('ds_contracts', 'contractId') === ref.contractId, 1745 ); 1746 if (exact.length > 1) { 1747 throw new Error( 1748 purpose + ': duplicate ds_contracts/contractId "' + ref.contractId + 1749 '" on ' + exact.length + ' component targets â refusing ambiguous identity', 1750 ); 1751 } 1752 if (exact.length === 1) return exact[0]; 1753 1754 if (ref.anchorKey) { 1755 const anchored = targets.filter((n) => n.key === ref.anchorKey); 1756 if (anchored.length > 1) { 1757 throw new Error( 1758 purpose + ': duplicate Figma anchor key "' + ref.anchorKey + 1759 '" â refusing ambiguous identity', 1760 ); 1761 } 1762 if (anchored.length === 1) { 1763 const marker = anchored[0].getSharedPluginData('ds_contracts', 'contractId'); 1764 if (marker && marker !== ref.contractId) { 1765 throw new Error( 1766 purpose + ': anchor key "' + ref.anchorKey + '" belongs to contractId "' + 1767 marker + '", not "' + ref.contractId + '" â refusing contradictory identity', 1768 ); 1769 } 1770 return anchored[0]; 1771 } 1772 } 1773 1774 const legacy = targets.filter( 1775 (n) => n.name === ref.name && 1776 n.getSharedPluginData('ds_contracts', 'contractId') === '' && 1777 n.getSharedPluginData('ds_contracts', 'specHash') !== '', 1778 ); 1779 if (legacy.length > 1) { 1780 throw new Error( 1781 purpose + ': duplicate explicit legacy-generated name "' + ref.name + 1782 '" on ' + legacy.length + ' unmarked component targets â refusing ambiguous identity', 1783 ); 1784 } 1785 if (legacy.length === 1) return legacy[0]; 1786 if (allowMissing) return null; 1787 throw new Error( 1788 purpose + ': component not found for contractId "' + ref.contractId + '"' + 1789 (ref.anchorKey ? ', anchor key "' + ref.anchorKey + '"' : '') + 1790 ', or unique explicit legacy-generated name "' + ref.name + '" (sync it first)', 1791 ); 1792} 1793 1794function setInstanceProps(inst, props, owner) { 1795 // REAL-FIGMA QUIRK (live finding 2026-07-22, pinned by the named refusal + 1796 // Desktop Bridge probes; supersedes the 07-21 "mixed VARIANT+TEXT call" 1797 // inference, which was wrong): a freshly created instance's 1798 // componentProperties can LAG behind its component set within a session, 1799 // listing only the VARIANT axes â the live composite refused with 1800 // "available: Variant, Size, State" on a Button set that demonstrably 1801 // carried Label/Disabled/Loading. The set's componentPropertyDefinitions 1802 // are always complete, and setProperties with the FULL set-level key 1803 // applies correctly even while the instance's view lags (probe-verified). 1804 // So: resolve against the instance first, fall back to the OWNER's 1805 // definitions, and refuse by name only when neither knows the property. 1806 const instProps = inst.componentProperties; 1807 const instKeys = Object.keys(instProps); 1808 let ownerDefs = {}; 1809 try { ownerDefs = (owner && owner.componentPropertyDefinitions) || {}; } catch (e) { ownerDefs = {}; } 1810 const ownerKeys = Object.keys(ownerDefs); 1811 const variantProps = {}; 1812 const otherProps = {}; 1813 const missing = []; 1814 for (const [wanted, value] of Object.entries(props)) { 1815 const match = (k) => k === wanted || k.startsWith(wanted + '#'); 1816 const key = instKeys.find(match) || ownerKeys.find(match); 1817 if (!key) { missing.push(wanted); continue; } 1818 const def = instProps[key] || ownerDefs[key] || {}; 1819 if (def.type === 'VARIANT') variantProps[key] = value; else otherProps[key] = value; 1820 } 1821 // 2026-07-21 (live-canvas finding, handoff 08#1): the old silent no-op is 1822 // exactly how the repeated Badge instances kept their default text live â 1823 // the contract said Label="Shipping", nothing matched, nothing was 1824 // reported, the build claimed success. A contract binding the runtime 1825 // cannot honor is a refusal, BY NAME, like every other refusal here. 1826 if (missing.length > 0) { 1827 const seen = instKeys.concat(ownerKeys.filter((k) => instKeys.indexOf(k) < 0)); 1828 throw new Error( 1829 'Instance "' + inst.name + '": component propert' + (missing.length === 1 ? 'y "' : 'ies "') + missing.join('", "') + 1830 '" not found (instance + set expose: ' + (seen.map((k) => k.split('#')[0]).join(', ') || 'none') + 1831 ') â the dependency does not expose the properties this contract binds; sync the dependency component first', 1832 ); 1833 } 1834 // Defensive two-phase apply (cheap): variant swap first, then non-variant 1835 // values on the settled instance â set-level property ids are stable 1836 // across the swap, so the resolved keys stay valid either way. 1837 if (Object.keys(variantProps).length > 0) inst.setProperties(variantProps); 1838 if (Object.keys(otherProps).length > 0) inst.setProperties(otherProps); 1839} 1840 1841// Owner request (2026-07-21, roadmap P1): generated components land ON a 1842// named SECTION with a light background â not floating on the canvas. The 1843// section is identity-marked (ds_contracts/hostFor) so create and amend both 1844// re-fit the SAME section instead of stacking new ones; a component already 1845// hosted keeps its section. 1846function ensureHostSection(page, target, displayName) { 1847 const HOST_PAD = 60; 1848 const contractId = target.getSharedPluginData('ds_contracts', 'contractId'); 1849 let section = null; 1850 for (const child of page.children) {
1851 if (child.type === 'SECTION' && child.getSharedPluginData('ds_contracts', 'hostFor') === contractId) { 1852 section = child; 1853 break; 1854 } 1855 } 1856 if (!section) { 1857 section = figma.createSection(); 1858 page.appendChild(section); 1859 section.setSharedPluginData('ds_contracts', 'hostFor', contractId); 1860 } 1861 section.name = displayName; 1862 section.fills = [{ type: 'SOLID', color: { r: 0.969, g: 0.973, b: 0.98 } }]; 1863 section.appendChild(target); 1864 target.x = HOST_PAD; 1865 target.y = HOST_PAD; 1866 section.resizeWithoutConstraints(target.width + HOST_PAD * 2, target.height + HOST_PAD * 2); 1867 section.x = 100; 1868 section.y = 100; 1869 return section; 1870} 1871 1872${_t(p)}${ef(m)} 1873// FC-OVERFLOW-CLIP-LOST: node ids whose clip the CONTRACT declared 1874// (overflow-x/y hidden|clip). The unclip walks consult this so a declared clip 1875// can never be reverted silently by an overhanging descendant. 1876const dsDeclaredClip = new Set(); 1877// Ancestors an OVERHANG (absolute / inset overlay) actually unclipped â see 1878// propagateOverflowVisible. Distinguishes "unclipped because something hangs 1879// out of it" from "unclipped because CSS overflow defaults to visible". 1880const dsOverhangUnclip = new Set(); 1881/** Does a DECLARED clip stop the unclip walk at this node? See the body â the 1882 * contract's captured overflow outranks the emitter's out-of-flow heuristic, 1883 * and the walk ends rather than reverting a fact the contract stated. */ 1884function dsDeclaredClipStops(n) { 1885 // A DECLARED clip beats the unclip heuristic, and the walk STOPS here. 1886 // 1887 // The heuristic is broader than CSS: it unclips every ancestor of any 1888 // out-of-flow child, but position:absolute does not ask its ancestors to 1889 // stop clipping â an absolutely positioned child inside overflow:hidden is 1890 // clipped, normally and correctly. The rule exists for one real case (a 1891 // Slider thumb at left:-10 genuinely hanging outside its track), and it was 1892 // reading "is out of flow" as if it meant "hangs outside the box". 1893 // 1894 // Fluent Spinner is the counter-example that made this visible: its root 1895 // declares overflow hidden (captured from the real component) and its 1896 // spinnerTail declares position:absolute INSIDE that root. Nothing overhangs. 1897 // The heuristic would have silently thrown the captured clip away. 1898 // 1899 // A captured fact outranks an inference about one. Stopping is also 1900 // sufficient: content clipped at this boundary cannot be revealed by 1901 // unclipping anything above it. 1902 return dsDeclaredClip.has(n.id); 1903} 1904function applyFrameSpec(node, spec) { 1905 const l = spec.layout || { mode: 'HORIZONTAL', primary: 'MIN', counter: 'MIN' };${f?` 1906 // A2 grid: GRID frames take the declaration path â the flex fields below 1907 // (axis aligns, layoutWrap) are not grid facts and are never written. 1908 if (l.mode === 'GRID') { applyGridFrame(node, l); } else {`:``} 1909 node.layoutMode = l.mode; 1910 node.primaryAxisAlignItems = l.primary; 1911 node.counterAxisAlignItems = l.counter;${gt(h,g)}${f?` 1912 }`:``} 1913 node.primaryAxisSizingMode = 'AUTO'; 1914 node.counterAxisSizingMode = 'AUTO'; 1915 // FC-FIGMA-CLIP-DEFAULT: createFrame/createComponent default clipsContent=true, 1916 // but CSS overflow defaults to visible. Clipping HUG text (Inter vs capture 1917 // font) truncates trailing glyphs (Carbon Tabs "Settings" â "Setting"). 1918 // Unclip unless the contract explicitly asks for canvas clip. 1919 node.clipsContent = spec.clipsContent === true; 1920 // FC-OVERFLOW-CLIP-LOST: remember WHO asked for the clip. Three runtime 1921 // loops (applyShapeAbsolute / applyInsetOverlay / propagateOverflowVisible) 1922 // walk every ancestor setting clipsContent=false for an overhanging child, 1923 // and they would silently revert a clip the contract declared â last write 1924 // wins and nothing reports it. Measured across the whole corpus: NO 1925 // clip-declaring part has an absolute/insetOverlay/overlay descendant, so 1926 // this never fires today. It is recorded rather than trusted, because the 1927 // collision is one contract away and a silent revert is indistinguishable 1928 // from the fact never having been carried. 1929 if (spec.clipsContent === true) dsDeclaredClip.add(node.id); 1930 if (node.type === 'FRAME') node.fills = []; 1931 // FC-AMEND-CANNOT-CLEAR (astryx/banner live-canvas round, 2026-08-11). 1932 // 1933 // This function only ever SET what the spec declares, so on the AMEND path 1934 // a spacing fact the contract has since DROPPED survived on the node 1935 // forever. The create path never showed it â a fresh createComponent starts 1936 // at 0 â so the two paths silently disagreed, and \`specHash\` matching made 1937 // it invisible: the script reports "skipped: unchanged" while the canvas 1938 // carries a value the contract does not claim. 1939 // 1940 // Measured: astryx/banner's root carried a bound 12/16 padding + gap 8 that 1941 // its committed spec does not declare, applying the header's padding TWICE 1942 // (header 299x64 â root 331x88) against a reference and a contract render 1943 // that both measure 64 tall. Across all 77 scored cells on the two 1944 // connected files it is the ONLY root in that state â every other root with 1945 // padding declares it â so this reset changes exactly one scored cell. 1946 // 1947 // Only the ROOT needs it: amend removes and rebuilds every child, so no
1948 // descendant can carry stale state. Reset to Figma's own defaults FIRST, 1949 // then apply what the spec declares below. 1950 for (const field of ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'itemSpacing']) { 1951 if (spec.bindings && spec.bindings[field] !== undefined) continue; 1952 if (spec.lits && spec.lits[field] !== undefined) continue; 1953 try { 1954 if (node.boundVariables && node.boundVariables[field]) node.setBoundVariable(field, null); 1955 } catch (e) { /* field not bindable on this node type */ } 1956 try { node[field] = 0; } catch (e) { /* not an auto-layout frame */ } 1957 } 1958 for (const [field, varName] of Object.entries(spec.bindings || {})) { 1959 node.setBoundVariable(field, need(varName)); 1960 } 1961 if (spec.fill) node.fills = [boundPaint(spec.fill, node)]; 1962 if (spec.stroke) { 1963 node.strokes = [boundPaint(spec.stroke, node)]; 1964 node.strokeAlign = ${st(x)}; 1965 }${pt(o)}${mt(_)} 1966 if (spec.fixedWidth || spec.fixedHeight) { 1967 const w = spec.fixedWidth ? spec.fixedWidth.px : node.width; 1968 const h = spec.fixedHeight ? spec.fixedHeight.px : node.height; 1969 node.resize(w, h); 1970 // GRID's primary axis is HORIZONTAL (GP1b), like a HORIZONTAL frame. 1971 const horizontalIsPrimary = l.mode === 'HORIZONTAL' || l.mode === 'GRID'; 1972 if (spec.fixedWidth) { 1973 if (horizontalIsPrimary) node.primaryAxisSizingMode = 'FIXED'; 1974 else node.counterAxisSizingMode = 'FIXED'; 1975 node.setBoundVariable('width', need(spec.fixedWidth.varName)); 1976 } 1977 if (spec.fixedHeight) { 1978 if (horizontalIsPrimary) node.counterAxisSizingMode = 'FIXED'; 1979 else node.primaryAxisSizingMode = 'FIXED'; 1980 if (spec.fixedHeight.varName) node.setBoundVariable('height', need(spec.fixedHeight.varName)); 1981 } 1982 }${Ot(l,u)}${ht(v)} 1983} 1984 1985// v7 overlay: out-of-flow edge attachment. Must run AFTER appendChild â 1986// layoutPositioning ABSOLUTE requires an auto-layout parent. 1987function applyOverlay(parent, childNode, childSpec) { 1988 if (!childSpec.overlay) return; 1989 try { 1990 childNode.layoutPositioning = 'ABSOLUTE'; 1991 const p = childSpec.overlay.placement; 1992 childNode.constraints = 1993 p === 'bottom' ? { horizontal: 'MIN', vertical: 'MAX' } : 1994 p === 'end' ? { horizontal: 'MAX', vertical: 'MIN' } : 1995 { horizontal: 'MIN', vertical: 'MIN' }; 1996 if (p === 'top') { childNode.x = 0; childNode.y = -childNode.height; } 1997 else if (p === 'bottom') { childNode.x = 0; childNode.y = parent.height; } 1998 else if (p === 'start') { childNode.x = -childNode.width; childNode.y = 0; } 1999 else { childNode.x = parent.width; childNode.y = 0; } 2000 } catch (e) { /* parent not auto-layout â leave in flow */ } 2001} 2002${bt(c)}${St(y)}${wt(y||c)}${Et(c||y)}${ct(b)}${F(f)} 2003async function buildNode(spec, registry) { 2004 let node; 2005 if (spec.type === 'svg') { 2006 node = figma.createNodeFromSvg(spec.svg); 2007 node.fills = []; 2008 node.clipsContent = false; 2009 if (spec.iconSize) node.resize(spec.iconSize, spec.iconSize);${ut(S)} 2010 // FC-SVG-ROTATION: CSS-clockwise â Plugin API counterclockwise 2011 if (typeof spec.rotation === 'number' && spec.rotation !== 0) node.rotation = -spec.rotation; 2012 } else if (spec.type === 'text') { 2013 node = figma.createText(); 2014 node.fontName = { family: 'Inter', style: spec.fontStyle || 'Medium' }; 2015 node.fontSize = spec.fontSize || 16; 2016 node.characters = spec.characters || '';${ft(s)}${vt(C)} 2017 if (spec.textStyle) { 2018 // Exact-definition match compiled in: ride the named style. Text 2019 // styles own typography only â the bound fill paint below coexists. 2020 // Fail closed: a compiled textStyle that cannot bind is identity loss. 2021 const st = await ourTextStyle(spec.textStyle); 2022 if (!st) { 2023 throw new Error( 2024 'text-style-identity-refused: missing local text style "' + spec.textStyle + 2025 '" (run the tokens sync so ds_contracts/textStyleToken styles exist)', 2026 ); 2027 } 2028 try { 2029 await node.setTextStyleIdAsync(st.id); 2030 } catch (e) { 2031 throw new Error( 2032 'text-style-identity-refused: setTextStyleIdAsync failed for "' + spec.textStyle +
2033 '": ' + (e && e.message ? e.message : String(e)), 2034 ); 2035 } 2036 } else if (spec.fontSizeVar) { 2037 // FC-WEIGHT-IDENTITY: no style could carry this node's size token (it 2038 // overrides its group's weight, and Figma clears textStyleId on any 2039 // fontName write), so the SIZE VARIABLE carries the identity instead. 2040 // Bound AFTER fontName/fontSize so the literal stays the fallback. 2041 node.setBoundVariable('fontSize', need(spec.fontSizeVar)); 2042 } 2043 // FC-WEIGHT-IDENTITY, second half. Figma exposes no bindable field for 2044 // font weight, so the token cannot ride a variable the way the size does. 2045 // Stamp it instead: without this the node draws "Medium" and a reader 2046 // cannot tell a DECLARED weight from the runtime default. Written as '' 2047 // (which deletes the key) when the contract binds no weight, so a node 2048 // that stops declaring one cannot keep answering with a stale token. 2049 node.setSharedPluginData('ds_contracts', 'fontWeightVar', spec.fontWeightVar || ''); 2050 node.setSharedPluginData('ds_contracts', 'lineHeightVar', spec.lineHeightVar || ''); 2051 if (spec.textFill) node.fills = [boundPaint(spec.textFill, node)];
2052 if (spec.contentProp) { 2053 registry.texts.push({ prop: spec.contentProp, node, default: spec.characters || '' }); 2054 } 2055 if (spec.fill || spec.fixedWidth || spec.fixedHeight || spec.bindings) { 2056 // Styled static text (page chips, dots, thumbs): wrap in a frame so 2057 // fills/dimensions/radius apply to a container, not the glyphs. 2058 // 2059 // TASK #37, second live-canvas finding: "Modal's Label renders CENTERED 2060 // at the top rather than top-left". The wrapper's CENTER/CENTER was 2061 // hard-coded for the chip/dot/thumb case â a DRAWN box, where centering 2062 // the glyph is right. But 46 of the corpus's 62 wrapped texts have no 2063 // fill and no fixed size at all: they are wrapped only to carry 2064 // min-width/min-height bindings the floor promoted (Carbon's own reset 2065 // declares \`min-width: 0\`), and then the wrapper re-centered text that 2066 // CSS lays out at the start of its line box. Carbon's Modal "Label" is 2067 // exactly that: a bare h2 with \`min-width: 0\`, FILLing the header, so 2068 // the wrapper centered it in a 430px row. 2069 // 2070 // A wrapper with no drawn box inherits the CSS truth (start/start); a 2071 // wrapper that DOES draw a box keeps the centering it was built for. 2072 const boxed = Boolean(spec.fill || spec.fixedWidth || spec.fixedHeight); 2073 const wrap = figma.createFrame(); 2074 wrap.layoutMode = 'HORIZONTAL'; 2075 wrap.primaryAxisAlignItems = boxed ? 'CENTER' : 'MIN'; 2076 wrap.counterAxisAlignItems = boxed ? 'CENTER' : 'MIN'; 2077 wrap.primaryAxisSizingMode = 'AUTO'; 2078 wrap.counterAxisSizingMode = 'AUTO'; 2079 // FC-FIGMA-CLIP-DEFAULT â text hosts must not clip Semi Bold overhang. 2080 wrap.clipsContent = false; 2081 wrap.fills = []; 2082 for (const [field, varName] of Object.entries(spec.bindings || {})) { 2083 wrap.setBoundVariable(field, need(varName)); 2084 } 2085 if (spec.fill) wrap.fills = [boundPaint(spec.fill, wrap)]; 2086 if (spec.stroke) { wrap.strokes = [boundPaint(spec.stroke, wrap)]; wrap.strokeAlign = ${st(x)}; } 2087 if (spec.characters) wrap.appendChild(node); else node.remove(); 2088 if (spec.fixedWidth || spec.fixedHeight) { 2089 wrap.resize(spec.fixedWidth ? spec.fixedWidth.px : wrap.width, spec.fixedHeight ? spec.fixedHeight.px : wrap.height); 2090 if (spec.fixedWidth) { wrap.primaryAxisSizingMode = 'FIXED'; wrap.setBoundVariable('width', need(spec.fixedWidth.varName)); } 2091 if (spec.fixedHeight) { wrap.counterAxisSizingMode = 'FIXED'; if (spec.fixedHeight.varName) wrap.setBoundVariable('height', need(spec.fixedHeight.varName)); else wrap.resize(wrap.width, spec.fixedHeight.px); } 2092 } 2093 wrap.name = spec.name; 2094 node = wrap; 2095 } 2096 } else if (spec.type === 'instance') { 2097 const target = resolveComponentIdentity( 2098 { contractId: spec.depContractId, anchorKey: spec.depAnchorKey, name: spec.dep }, 2099 'Instance "' + spec.name + '"', 2100 false, 2101 ); 2102 const main = target.type === 'COMPONENT_SET' ? target.defaultVariant : target; 2103 node = main.createInstance(); 2104 if (spec.depProps) setInstanceProps(node, spec.depProps, target); 2105 } else if (spec.type === 'slot') { 2106 // NATIVE SLOT. createSlot() exists on ComponentNode only (probe 2a), so 2107 // the slot is minted by the variant component that owns it and moved into 2108 // place by the ordinary child append below â a slot in a nested frame 2109 // keeps its property binding (probe 2f). 2110 if (!registry.owner) { 2111 throw new Error( 2112 'Slot "' + spec.slotProperty + '": no owning COMPONENT in scope â figma.createSlot is a ComponentNode method ' + 2113 '(never on a frame or a component SET); a slot outside a component build is refused', 2114 ); 2115 } 2116 node = registry.owner.createSlot(); 2117 applyFrameSpec(node, spec); 2118 // An empty native slot renders as Figma's own thing: no dashed chrome, no 2119 // "Slot" text, no placeholder instance (proposal §2). createSlot's default 2120 // solid-white fill is Figma's, not the contract's â the part's own styling 2121 // (usually nothing) is the truth. 2122 if (!spec.fill) node.fills = []; 2123 for (const item of spec.slotDefault || []) {
2124 const target = resolveComponentIdentity( 2125 { contractId: item.contractId, anchorKey: item.anchorKey, name: item.dep }, 2126 'Slot "' + spec.name + '" default', 2127 false, 2128 ); 2129 const main = target.type === 'COMPONENT_SET' ? target.defaultVariant : target; 2130 const inst = main.createInstance(); 2131 if (item.props) setInstanceProps(inst, item.props, target); 2132 node.appendChild(inst); 2133 if (spec.layout && spec.layout.stretchChildren) { 2134 try { inst.layoutSizingHorizontal = 'FILL'; } catch (e) { /* fixed-size deps */ } 2135 } 2136 } 2137 registry.slots.push({ spec, slot: node }); 2138 }${dt(i,`${pt(o)}${mt(_)}`,st(x),d,a)} else { 2139 node = spec.type === 'root' ? figma.createComponent() : figma.createFrame(); 2140 applyFrameSpec(node, spec);${p?` 2141 // The variant COMPONENT is the slot owner for everything built below it 2142 // (figma.createSlot is a ComponentNode method). 2143 if (spec.type === 'root') registry.owner = node;`:``} 2144 } 2145${p?` // A native slot's LAYER NAME is its property's display name: renaming the 2146 // layer renames the linked SLOT property (probe 2b), so the contract's 2147 // slot.figmaProperty is spelled here and nowhere else. 2148 node.name = spec.type === 'slot' ? spec.slotProperty : spec.name;`:` node.name = spec.name;`}${rt(r)} 2149 if (spec.visibleProp) { 2150 registry.visibles.push({ node, prop: spec.visibleProp, default: spec.visibleDefault === true }); 2151 } 2152 const built = []; 2153 for (const child of spec.children || []) { 2154 const childNode = await buildNode(child, registry); 2155 node.appendChild(childNode);${Dt(c||y,`childNode`,`node`)} 2156 built.push([child, childNode]); 2157 applyOverlay(node, childNode, child);${xt(c,`node, childNode, child`)} 2158 if (child.pct != null) { 2159 try { 2160 childNode.resize(Math.max(1, Math.round(node.width * child.pct)), childNode.height); 2161 childNode.primaryAxisSizingMode = 'FIXED'; 2162 } catch (e) { /* track not fixed-width */ } 2163 } 2164 if ( 2165 child.type === 'frame' && (!child.children || child.children.length === 0) &&
2166 !child.fixedHeight && !(child.lits && child.lits.height !== undefined) && !child.shape && 2167 // ROUND 6: an OUT-OF-FLOW child is not in the auto-layout flow â FILL 2168 // sizing is meaningless there (real Figma drops it the moment 2169 // layoutPositioning becomes ABSOLUTE) and the instruction only made 2170 // the Dialog backdrop LOOK healthy in the headless mock while the 2171 // canvas drew a squat band. Out-of-flow boxes are sized by 2172 // resizeOutOfFlow against the parent's final box. 2173 !child.overlay && !child.insetOverlay && !child.absolute 2174 ) { 2175 // #60 fix 4: empty runtime-sized geometry gets DECLARED defaults â 2176 // height follows the auto-layout parent (FILL), never Figma's 100Ã100 2177 // createFrame artifact (Phase B-2 finding 4: ProgressBar indicators 2178 // overflowed their fixed-height tracks). Width stays the spec'd 2179 // fraction (meter pct) or the placeholder box, named in the component 2180 // description. 2181 try { childNode.layoutSizingVertical = 'FILL'; } catch (e) { /* parent not auto-layout */ } 2182 } 2183 // FILL is compiled (annotateFillW): candidates only fill when the parent 2184 // width is established â the hugâfill collapse class stays impossible. 2185 if (child.fillW && !(child.type === 'text' && !child.textTruncation && child.fillText !== true) && 'layoutSizingHorizontal' in childNode) { 2186 try { childNode.layoutSizingHorizontal = 'FILL'; } catch (e) { /* HUG-only nodes */ } 2187 }${Ct(y,`node, childNode, child`)}${lt(b,`node, childNode, child, registry`)} 2188 }${yt(f,`node, spec, built`)}${Tt(y||c,`node, built`)}${tf(m,`node`,`spec`)} 2189 return node; 2190} 2191 2192 2193// djb2 over the compiled spec â stored on the set so unchanged components 2194// skip cheaply and CHANGED ones amend in place. 2195${Qd} 2196// v6: bindings are fingerprinted by variable NAME, and every Figma variable 2197// API that survives dynamic-page loading is async â so the idâname map is 2198// filled ONCE here, from the emitted script's top-level await, and the sync 2199// walk reads it. This runs AFTER the source above on purpose: the 2200// dsVarNames initializer would clobber an earlier fill. 2201await dsLoadVarNames(); 2202 2203// DRIFT ROUND: stamp the node â and, for a SET, each VARIANT child â so 2204// Check Drift can LOCALIZE an edit to the exact variant (live finding: 2205// "canvas edited" over 63 Button variants is not actionable). 2206function dsStampFingerprints(node) { 2207 node.setSharedPluginData('ds_contracts', 'canvasFingerprint', dsCanvasFingerprint(node)); 2208 // v3: variants also store the SNAPSHOT the hash derives from, so Check 2209 // Drift can say WHAT changed, not just that something did. Each variant 2210 // node owns its own pluginData quota â the set never carries the bulk. 2211 if (node.type === 'COMPONENT_SET') { 2212 node.setSharedPluginData('ds_contracts', 'canvasSetSnapshot', JSON.stringify(dsCanvasSetSnapshot(node))); 2213 for (const child of node.children) { 2214 child.setSharedPluginData('ds_contracts', 'canvasFingerprint', dsCanvasFingerprint(child)); 2215 child.setSharedPluginData('ds_contracts', 'canvasSnapshot', JSON.stringify(dsCanvasSnapshot(child))); 2216 } 2217 } else { 2218 node.setSharedPluginData('ds_contracts', 'canvasSetSnapshot', JSON.stringify(dsCanvasSetSnapshot(node))); 2219 node.setSharedPluginData('ds_contracts', 'canvasSnapshot', JSON.stringify(dsCanvasSnapshot(node))); 2220 } 2221} 2222 2223// Bump when the emitted RUNTIME template changes without a COMPONENTS JSON 2224// delta (e.g. FC-FIGMA-CLIP-DEFAULT clipsContent default). Otherwise amend 2225// skips as "unchanged" and canvas keeps the old runtime behavior. 2226const RUNTIME_EMIT_REV = '${nf}'; 2227function specHash(C) { 2228 let h = 5381; const s = JSON.stringify(C) + '|' + RUNTIME_EMIT_REV; 2229 for (let i = 0; i < s.length; i++) h = (((h << 5) + h) + s.charCodeAt(i)) >>> 0; 2230 return String(h); 2231} 2232 2233// IN-PLACE AMEND (2026-07-08, closes the create-only gap): reconcile an 2234// existing COMPONENT_SET against the compiled spec while preserving what 2235// instances bind to â the set node + key, each variant COMPONENT node, and 2236// existing componentProperty IDs. Variant interiors are contract-owned and 2237// rebuilt from spec (manual interior edits are drift by definition); 2238// instance-level property overrides survive because property IDs do. 2239// Destructive changes (extra variants from removed enum values) are 2240// REPORTED, never deleted â except State preview leftovers when 2241// figmaStatePreviews is off (FC-STATE-PREVIEW-NOISE), which amend removes. 2242async function amendSet(set, C) { 2243 set.setSharedPluginData('ds_contracts', 'contractId', C.contractId); 2244 // The DECLARED sparse-matrix shape, refreshed BEFORE the specHash early 2245 // return so a set that skips as unchanged still carries a current marker. 2246 // Written as '' (which deletes the key) when the contract no longer opts 2247 // into previews â a stale descriptor would describe a matrix nobody drew. 2248 set.setSharedPluginData('ds_contracts', 'statePreviewAxis', 2249 C.statePreviewAxis ? JSON.stringify(C.statePreviewAxis) : ''); 2250 set.setSharedPluginData('ds_contracts', 'semantics', 2251 C.semantics ? JSON.stringify(C.semantics) : ''); 2252 set.setSharedPluginData('ds_contracts', 'propNames', 2253 C.propNames ? JSON.stringify(C.propNames) : ''); 2254 const hash = specHash(C); 2255 if (set.getSharedPluginData('ds_contracts', 'specHash') === hash) { 2256 // DRIFT ROUND migration: no stamp OR a pre-v2 stamp (geometry-bearing â 2257 // unstable under real Figma's deferred layout) re-baselines NOW. A 2258 // current-version stamp is never overwritten on skip: canvas edits stay 2259 // detectable. 2260 var fpSkip = set.getSharedPluginData('ds_contracts', 'canvasFingerprint'); 2261 if (!fpSkip || fpSkip.indexOf('v6:') !== 0) { 2262 dsStampFingerprints(set); 2263 } 2264 return { name: C.setName, contractId: C.contractId, skipped: true, reason: 'unchanged', nodeId: set.id, key: set.key }; 2265 } 2266 const report = { name: C.setName, contractId: C.contractId, amended: true, nodeId: set.id, key: set.key, 2267 addedVariants: [], rebuiltVariants: 0, extraVariants: [], addedProps: [], editedDefaults: [] }; 2268 const defs = set.componentPropertyDefinitions; 2269 const newKeys = {}; 2270 const defKey = (name) => newKeys[name] || 2271 Object.keys(defs).find((k) => k.split('#')[0] === name) || null; 2272 2273 for (const w of [ 2274 ...C.boolProps.map((bp) => ({ name: bp.property, type: 'BOOLEAN', def: bp.default })), 2275 ...(C.textProps || []).map((tp) => ({ name: tp.property, type: 'TEXT', def: tp.default })), 2276 ]) {
2277 const k = defKey(w.name); 2278 if (!k) { newKeys[w.name] = set.addComponentProperty(w.name, w.type, w.def); report.addedProps.push(w.name); } 2279 else if (defs[k].type === w.type && defs[k].defaultValue !== w.def) { 2280 set.editComponentProperty(k, { defaultValue: w.def }); 2281 report.editedDefaults.push(w.name); 2282 } 2283 } 2284 2285 // Sets gaining/losing the State preview axis reconcile by RENAME, not 2286 // duplication: an existing variant whose name matches an expected name 2287 // minus the ', State=Default' segment IS that variant (instances point at 2288 // it), so it is renamed in place â every variant node ID is preserved. 2289 // Main-file finding, 2026-07-08: name-only matching built 12 duplicates 2290 // and stranded the 12 originals as off-axis extras. 2291 const EV = withStateAxis(C); 2292 const expected = new Map(EV.map((v) => [v.name, v])); 2293 for (const ch of set.children) { 2294 if (expected.has(ch.name)) continue; 2295 const gained = ch.name + ', State=Default'; 2296 const lost = ch.name.replace(', State=Default', ''); 2297 if (expected.has(gained) && !set.children.some((o) => o.name === gained)) { 2298 ch.name = gained; 2299 report.renamedVariants = report.renamedVariants || []; 2300 report.renamedVariants.push(gained); 2301 } else if (lost !== ch.name && expected.has(lost) && !set.children.some((o) => o.name === lost)) { 2302 ch.name = lost; 2303 report.renamedVariants = report.renamedVariants || []; 2304 report.renamedVariants.push(lost); 2305 } else { 2306 report.extraVariants.push(ch.name); 2307 } 2308 } 2309 // FC-STATE-PREVIEW-NOISE: when the State preview axis is off, leftover 2310 // State=Focus Visible (etc.) variants from a prior figmaStatePreviews:true 2311 // sync must be removed â otherwise amend leaves a doubled showcase grid. 2312 const expectedHasState = EV.some((v) => /, State=/.test(v.name)); 2313 if (!expectedHasState && report.extraVariants.length) { 2314 const removed = []; 2315 for (const name of [...report.extraVariants]) { 2316 if (!/, State=/.test(name)) continue; 2317 const ch = set.children.find((c) => c.name === name); 2318 if (ch) { 2319 ch.remove(); 2320 removed.push(name); 2321 } 2322 } 2323 if (removed.length) { 2324 report.extraVariants = report.extraVariants.filter((n) => !removed.includes(n)); 2325 report.removedVariants = removed; 2326 } 2327 } 2328 const existingByName = new Map(set.children.map((ch) => [ch.name, ch])); 2329 2330 for (const v of EV) {
2331 let comp = existingByName.get(v.name); 2332 const registry = { texts: [], slots: [], visibles: [] }; 2333 if (!comp) { 2334 comp = await buildNode(v.spec, registry); 2335 set.appendChild(comp); 2336 report.addedVariants.push(v.name); 2337 } else { 2338 for (const child of [...comp.children]) child.remove(); 2339 applyFrameSpec(comp, v.spec);${p?` 2340 registry.owner = comp;`:``} 2341 const built = []; 2342 for (const childSpec of v.spec.children || []) { 2343 const childNode = await buildNode(childSpec, registry); 2344 comp.appendChild(childNode);${Dt(c||y,`childNode`,`comp`)} 2345 built.push([childSpec, childNode]); 2346 applyOverlay(comp, childNode, childSpec);${xt(c,`comp, childNode, childSpec`)} 2347 if (childSpec.pct != null) { 2348 try { childNode.resize(Math.max(1, Math.round(comp.width * childSpec.pct)), childNode.height); childNode.primaryAxisSizingMode = 'FIXED'; } catch (e) {} 2349 } 2350 if ( 2351 childSpec.type === 'frame' && (!childSpec.children || childSpec.children.length === 0) && 2352 !childSpec.fixedHeight && !(childSpec.lits && childSpec.lits.height !== undefined) && !childSpec.shape && 2353 !childSpec.overlay && !childSpec.insetOverlay && !childSpec.absolute 2354 ) { 2355 // #60 fix 4 (amend path): same empty-child declared default. 2356 try { childNode.layoutSizingVertical = 'FILL'; } catch (e) { /* parent not auto-layout */ } 2357 } 2358 if (childSpec.fillW && !(childSpec.type === 'text' && !childSpec.textTruncation && childSpec.fillText !== true) && 'layoutSizingHorizontal' in childNode) { 2359 try { childNode.layoutSizingHorizontal = 'FILL'; } catch (e) {} 2360 }${Ct(y,`comp, childNode, childSpec`)}${lt(b,`comp, childNode, childSpec, registry`)} 2361 }${yt(f,`comp, v.spec, built`)}${Tt(y||c,`comp, built`)}${tf(m,`comp`,`v.spec`)} 2362 report.rebuiltVariants++; 2363 } 2364 for (const t of registry.texts) { 2365 let k = defKey(t.prop); 2366 if (!k) { k = set.addComponentProperty(t.prop, 'TEXT', t.default); newKeys[t.prop] = k; report.addedProps.push(t.prop); } 2367 else if (defs[k] && defs[k].defaultValue !== t.default && !report.editedDefaults.includes(t.prop)) { 2368 set.editComponentProperty(k, { defaultValue: t.default }); 2369 report.editedDefaults.push(t.prop); 2370 } 2371 t.node.componentPropertyReferences = { characters: k }; 2372 } 2373 for (const sl of registry.slots) { 2374 let k = defKey(sl.spec.slotProperty); 2375 // MIGRATION (proposal §6.2): the same display name carried by the OLD 2376 // INSTANCE_SWAP convention is the same slot â but the two property 2377 // types cannot share an id, so the legacy one retires here (reported) 2378 // and the natively minted SLOT property takes over. ANY OTHER type 2379 // sharing the name is not a slot in disguise: deleting a TEXT/BOOLEAN 2380 // property to make room would destroy every instance override bound to 2381 // it, so that refuses by name instead. 2382 if (k && defs[k] && defs[k].type !== 'SLOT') { 2383 if (defs[k].type !== 'INSTANCE_SWAP') { 2384 throw new Error( 2385 'Slot "' + sl.spec.slotProperty + '": the set already carries a ' + defs[k].type + 2386 ' property with that name â a slot cannot adopt it, and deleting it would strip every instance override bound to it; rename the contract slot (slot.figmaProperty) or retire the property in Figma', 2387 ); 2388 } 2389 await migrateLegacySlotProperty(set, k, defs[k], sl.spec.slotProperty, report); 2390 k = null; 2391 } 2392 const bound = bindSlot(set, sl, k); 2393 if (!k) { 2394 newKeys[sl.spec.slotProperty] = bound.key; 2395 report.addedProps.push(sl.spec.slotProperty); 2396 } else if (bound.rebound) { 2397 // The headline invariant: the rebuilt slot went back onto the 2398 // PRESERVED property id, so every instance fill keyed to it survives 2399 // this amend (probe 2d.3). 2400 report.preservedSlots = (report.preservedSlots || []).concat([sl.spec.slotProperty]); 2401 } 2402 if (sl.spec.slotOptional) { 2403 let vk = defKey('Show ' + sl.spec.slotProperty); 2404 // Optional slots default hidden â an empty slot still occupies its box 2405 // (Toast/ChatMessage live finding). Designers opt in. 2406 if (!vk) { vk = set.addComponentProperty('Show ' + sl.spec.slotProperty, 'BOOLEAN', false); newKeys['Show ' + sl.spec.slotProperty] = vk; } 2407 // BOTH references in one write: componentPropertyReferences is
2408 // replaced wholesale, and dropping slotContentId here would unbind 2409 // the slot (and strand its content) to gain a visibility toggle. 2410 sl.slot.componentPropertyReferences = { slotContentId: bound.key, visible: vk }; 2411 sl.slot.visible = false; 2412 } 2413 } 2414 for (const vis of registry.visibles) { 2415 const k = defKey(vis.prop); 2416 if (!k) continue; 2417 vis.node.componentPropertyReferences = { visible: k }; 2418 vis.node.visible = vis.default; 2419 } 2420 } 2421 2422 // Contract default combo must be the FIRST variant (Figma default = first). 2423 const first = set.children.find((ch) => ch.name === EV[0].name); 2424 if (first && set.children[0] !== first) set.insertChild(0, first); 2425 2426 // Grid re-layout with the create path's math. 2427 const specByName = new Map(EV.map((sv) => [sv.name, sv])); 2428 const rowsN = Math.max(...EV.map((vv) => vv.row)) + 1; 2429 const colsN = Math.max(...EV.map((vv) => vv.col)) + 1; 2430 const colWs = new Array(colsN).fill(0); 2431 const rowHs = new Array(rowsN).fill(0); 2432 for (const child of set.children) { 2433 const sp = specByName.get(child.name); 2434 if (!sp) continue; 2435 colWs[sp.col] = Math.max(colWs[sp.col], child.width); 2436 rowHs[sp.row] = Math.max(rowHs[sp.row], child.height); 2437 } 2438 for (const child of set.children) { 2439 const sp = specByName.get(child.name); 2440 if (!sp) continue; 2441 let x = PAD, y = PAD; 2442 for (let i = 0; i < sp.col; i++) x += colWs[i] + PAD; 2443 for (let i = 0; i < sp.row; i++) y += rowHs[i] + PAD; 2444 child.x = x; child.y = y; 2445 } 2446 // B-3 finding 4: after re-gridding, the SET CONTAINER refits to the 2447 // children's extent + grid padding (the create path's exact math) â 2448 // without this, added variants/columns stayed clipped by stale bounds 2449 // (Banner's Focus column, Button's 220-cell grid, ProgressBar's height). 2450 // Extra (human-owned) variants may sit beyond the grid; never shrink 2451 // below their extent. 2452 { 2453 let totalW = colWs.reduce((a, b) => a + b, 0) + PAD * (colsN + 1); 2454 let totalH = rowHs.reduce((a, b) => a + b, 0) + PAD * (rowsN + 1); 2455 for (const child of set.children) { 2456 totalW = Math.max(totalW, child.x + child.width + PAD); 2457 totalH = Math.max(totalH, child.y + child.height + PAD); 2458 } 2459 set.resizeWithoutConstraints(totalW, totalH); 2460 } 2461 set.description = C.description; 2462 set.setSharedPluginData('ds_contracts', 'specHash', hash); 2463 // PROTOTYPE WIRING â BEFORE the fingerprint stamp, so the v5 reaction facts 2464 // are part of what gets stamped (a stripped reaction is drift). 2465 report.wiredReactions = await wireStateReactions(set, new Map(set.children.map((ch) => [ch.name, ch])), C); 2466 // DRIFT ROUND: the canvas fingerprint â recomputed by Check Drift; a 2467 // mismatch means the canvas was edited after generation. 2468 dsStampFingerprints(set); 2469 // Re-fit (or adopt into) the host section â legacy un-hosted sets gain one. 2470 const setPage = set.parent && set.parent.type === 'SECTION' ? set.parent.parent : set.parent; 2471 if (setPage && setPage.type === 'PAGE') ensureHostSection(setPage, set, set.name); 2472 return report; 2473} 2474 2475// #60 fix 3: IN-PLACE AMEND for standalone COMPONENTs (non-set: Badge/Tag 2476// class) â the same identity-marker update semantics as amendSet: the 2477// component node (and key) instances bind to is preserved; the interior is 2478// contract-owned and rebuilt from spec; existing componentProperty IDs 2479// survive via defKey. Unchanged specs skip on the stored specHash. 2480async function amendComponent(comp, C) { 2481 comp.setSharedPluginData('ds_contracts', 'contractId', C.contractId); 2482 // A STANDALONE component gets the identity stamps too. amendSet and the 2483 // create path carried these from the start; this path did not, so Card and 2484 // Kbd â the two Flowbite stems that are plain COMPONENTs rather than variant 2485 // sets â re-synced with no semantics and no propNames, and the inverter fell 2486 // back to guessing their host element and prop names. Same '' -> delete rule 2487 // as everywhere else. (No backticks in this region: it is inside the emitted 2488 // runtime's template literal, and one would terminate it.) 2489 comp.setSharedPluginData('ds_contracts', 'statePreviewAxis', 2490 C.statePreviewAxis ? JSON.stringify(C.statePreviewAxis) : ''); 2491 comp.setSharedPluginData('ds_contracts', 'semantics', 2492 C.semantics ? JSON.stringify(C.semantics) : ''); 2493 comp.setSharedPluginData('ds_contracts', 'propNames', 2494 C.propNames ? JSON.stringify(C.propNames) : ''); 2495 const hash = specHash(C); 2496 if (comp.getSharedPluginData('ds_contracts', 'specHash') === hash) { 2497 var fpSkipC = comp.getSharedPluginData('ds_contracts', 'canvasFingerprint'); 2498 if (!fpSkipC || fpSkipC.indexOf('v6:') !== 0) { 2499 dsStampFingerprints(comp); 2500 } 2501 return { name: C.setName, contractId: C.contractId, skipped: true, reason: 'unchanged', nodeId: comp.id, key: comp.key }; 2502 } 2503 const report = { name: C.setName, contractId: C.contractId, amended: true, standalone: true, nodeId: comp.id, key: comp.key, addedProps: [], editedDefaults: [] }; 2504 const defs = comp.componentPropertyDefinitions; 2505 const newKeys = {}; 2506 const defKey = (name) => newKeys[name] || 2507 Object.keys(defs).find((k) => k.split('#')[0] === name) || null; 2508 for (const w of [ 2509 ...C.boolProps.map((bp) => ({ name: bp.property, type: 'BOOLEAN', def: bp.default })), 2510 ...(C.textProps || []).map((tp) => ({ name: tp.property, type: 'TEXT', def: tp.default })), 2511 ]) {
2512 const k = defKey(w.name); 2513 if (!k) { newKeys[w.name] = comp.addComponentProperty(w.name, w.type, w.def); report.addedProps.push(w.name); } 2514 else if (defs[k].type === w.type && defs[k].defaultValue !== w.def) { 2515 comp.editComponentProperty(k, { defaultValue: w.def }); 2516 report.editedDefaults.push(w.name); 2517 } 2518 } 2519 const v = C.variants[0]; 2520 const registry = { texts: [], slots: [], visibles: [] }; 2521 for (const child of [...comp.children]) child.remove(); 2522 applyFrameSpec(comp, v.spec);${p?` 2523 registry.owner = comp;`:``} 2524 const built = []; 2525 for (const childSpec of v.spec.children || []) { 2526 const childNode = await buildNode(childSpec, registry); 2527 comp.appendChild(childNode);${Dt(c||y,`childNode`,`comp`)} 2528 built.push([childSpec, childNode]); 2529 applyOverlay(comp, childNode, childSpec);${xt(c,`comp, childNode, childSpec`)} 2530 if (childSpec.pct != null) { 2531 try { childNode.resize(Math.max(1, Math.round(comp.width * childSpec.pct)), childNode.height); childNode.primaryAxisSizingMode = 'FIXED'; } catch (e) {} 2532 } 2533 if ( 2534 childSpec.type === 'frame' && (!childSpec.children || childSpec.children.length === 0) &&
2535 !childSpec.fixedHeight && !(childSpec.lits && childSpec.lits.height !== undefined) && !childSpec.shape && 2536 !childSpec.overlay && !childSpec.insetOverlay && !childSpec.absolute 2537 ) { 2538 // #60 fix 4 (standalone amend path): same empty-child declared default. 2539 try { childNode.layoutSizingVertical = 'FILL'; } catch (e) { /* parent not auto-layout */ } 2540 } 2541 if (childSpec.fillW && !(childSpec.type === 'text' && !childSpec.textTruncation && childSpec.fillText !== true) && 'layoutSizingHorizontal' in childNode) { 2542 try { childNode.layoutSizingHorizontal = 'FILL'; } catch (e) {} 2543 }${Ct(y,`comp, childNode, childSpec`)} 2544 }${yt(f,`comp, v.spec, built`)}${Tt(y||c,`comp, built`)}${tf(m,`comp`,`v.spec`)} 2545 for (const t of registry.texts) { 2546 let k = defKey(t.prop); 2547 if (!k) { k = comp.addComponentProperty(t.prop, 'TEXT', t.default); newKeys[t.prop] = k; report.addedProps.push(t.prop); } 2548 else if (defs[k] && defs[k].defaultValue !== t.default && !report.editedDefaults.includes(t.prop)) { 2549 comp.editComponentProperty(k, { defaultValue: t.default }); 2550 report.editedDefaults.push(t.prop); 2551 } 2552 t.node.componentPropertyReferences = { characters: k }; 2553 } 2554 for (const sl of registry.slots) { 2555 let k = defKey(sl.spec.slotProperty); 2556 if (k && defs[k] && defs[k].type !== 'SLOT') { 2557 if (defs[k].type !== 'INSTANCE_SWAP') { 2558 throw new Error( 2559 'Slot "' + sl.spec.slotProperty + '": the component already carries a ' + defs[k].type + 2560 ' property with that name â a slot cannot adopt it, and deleting it would strip every instance override bound to it; rename the contract slot (slot.figmaProperty) or retire the property in Figma', 2561 ); 2562 } 2563 await migrateLegacySlotProperty(comp, k, defs[k], sl.spec.slotProperty, report); 2564 k = null; 2565 } 2566 const bound = bindSlot(comp, sl, k); 2567 if (!k) { 2568 newKeys[sl.spec.slotProperty] = bound.key; 2569 report.addedProps.push(sl.spec.slotProperty); 2570 } else if (bound.rebound) { 2571 report.preservedSlots = (report.preservedSlots || []).concat([sl.spec.slotProperty]); 2572 } 2573 if (sl.spec.slotOptional) { 2574 let vk = defKey('Show ' + sl.spec.slotProperty); 2575 if (!vk) { vk = comp.addComponentProperty('Show ' + sl.spec.slotProperty, 'BOOLEAN', false); newKeys['Show ' + sl.spec.slotProperty] = vk; } 2576 sl.slot.componentPropertyReferences = { slotContentId: bound.key, visible: vk }; 2577 sl.slot.visible = false; 2578 } 2579 } 2580 for (const vis of registry.visibles) { 2581 const k = defKey(vis.prop); 2582 if (!k) continue; 2583 vis.node.componentPropertyReferences = { visible: k }; 2584 vis.node.visible = vis.default; 2585 } 2586 comp.description = C.description; 2587 comp.setSharedPluginData('ds_contracts', 'specHash', hash); 2588 dsStampFingerprints(comp); 2589 // Re-fit (or adopt into) the host section â mirrors amendSet. 2590 const compPage2 = comp.parent && comp.parent.type === 'SECTION' ? comp.parent.parent : comp.parent; 2591 if (compPage2 && compPage2.type === 'PAGE') ensureHostSection(compPage2, comp, comp.name); 2592 return report; 2593} 2594 2595async function syncOne(C) { 2596 // Semantic marker â stable anchor â unique explicit legacy-generated name. 2597 // A same-name foreign node has neither marker and is never adopted. 2598 let existing = resolveComponentIdentity( 2599 { contractId: C.contractId, anchorKey: C.anchorKey, name: C.setName }, 2600 'Sync target "' + C.setName + '"', 2601 true, 2602 ); 2603 // CREATE-ONLY APPLY DOOR. Amend-in-place is the product â it is how a 2604 // designer's file stays in sync without losing node ids or keys â but it 2605 // means "apply this bundle" on a file that already carries these stems 2606 // REWRITES them. A first look, a spare file, or any run that must not touch 2607 // shipped pages needs a door that cannot write over existing work. 2608 // 2609 // Set globalThis.DS_CREATE_ONLY = true before running this script and an 2610 // already-identified set is REFUSED BY NAME instead of amended: nothing is 2611 // written to it, not even the identity re-stamp below. Fresh stems on the 2612 // same file still create normally, so a partially-populated file fills in 2613 // its gaps without disturbing what is already there. 2614 // 2615 // This deliberately adds NO second identity scheme: the same
2616 // resolveComponentIdentity decides what "already exists" means, so the door 2617 // can never adopt a node the amend path would have refused. 2618 const DS_CREATE_ONLY = 2619 typeof globalThis !== 'undefined' && globalThis.DS_CREATE_ONLY === true; 2620 if (existing && DS_CREATE_ONLY) { 2621 return { 2622 name: C.setName, 2623 contractId: C.contractId, 2624 skipped: true, 2625 createOnly: true, 2626 reason: 'create-only apply: "' + C.setName + '" already exists on this file (' + 2627 existing.type + ' ' + existing.id + ') â refusing to amend it. Re-run without ' + 2628 'DS_CREATE_ONLY to sync it in place, or apply to a file that does not carry it.', 2629 nodeId: existing.id, 2630 key: existing.key, 2631 }; 2632 } 2633 if (existing && existing.getSharedPluginData('ds_contracts', 'contractId') === '') { 2634 existing.setSharedPluginData('ds_contracts', 'contractId', C.contractId); 2635 } 2636 if (existing && existing.type === 'COMPONENT_SET' && C.isSet) { 2637 return await amendSet(existing, C); 2638 } 2639 // #60 fix 3: standalone COMPONENTs (Badge/Tag class) amend in place too â 2640 // the "amend supports variant sets in v1" skip forced delete+recreate and 2641 // re-minted node ids/keys (Phase B-2 named finding 2). 2642 if (existing && existing.type === 'COMPONENT' && !C.isSet) { 2643 return await amendComponent(existing, C); 2644 } 2645 if (existing) { 2646 existing.setSharedPluginData('ds_contracts', 'contractId', C.contractId); 2647 return { name: C.setName, contractId: C.contractId, skipped: true, reason: 'set/standalone shape mismatch (' + existing.type + ' vs isSet=' + C.isSet + ') â a human retires the old node', nodeId: existing.id, key: existing.key }; 2648 } 2649 2650 // A same-named unmarked set is foreign: leave it alone, disambiguate ours. 2651 let displayName = C.setName; 2652 for (const page of figma.root.children) { 2653 const foreign = page.findOne( 2654 (n) => (n.type === 'COMPONENT_SET' || n.type === 'COMPONENT') && n.name === C.setName, 2655 ); 2656 if (foreign) { displayName = C.setName + ' (' + C.contractId + ')'; break; } 2657 } 2658 2659 // One page per component (see figma-sync/arrange.js for the file layout). 2660 let compPage = figma.root.children.find((p) => p.name === displayName); 2661 if (!compPage) { compPage = figma.createPage(); compPage.name = displayName; } 2662 2663 const EV = withStateAxis(C); 2664 const built = []; 2665 for (const v of EV) { 2666 const registry = { texts: [], slots: [], visibles: [] }; 2667 const comp = await buildNode(v.spec, registry); 2668 built.push({ v, comp, registry }); 2669 } 2670 2671 let target; 2672 if (C.isSet) { 2673 // combineAsVariants requires the nodes to already be ON the parent page. 2674 for (const b of built) compPage.appendChild(b.comp); 2675 target = figma.combineAsVariants(built.map((b) => b.comp), compPage); 2676 } else { 2677 target = built[0].comp; 2678 compPage.appendChild(target); 2679 } 2680 2681 // Component properties are minted on the PROPERTY OWNER â the SET for a 2682 // variant component, the component itself for a standalone â AFTER 2683 // combineAsVariants, one key per property name, wired into every variant. 2684 // (2026-07-21, live-canvas finding, handoff 08#1: the old per-variant 2685 // pre-combine minting produced id-suffixed keys that real set-instances 2686 // never surface, so an instance's TEXT property silently failed to apply â 2687 // repeated Badge instances kept the default "Badge" live. The amend path 2688 // (amendSet) always minted set-level; the create path now matches it.) 2689 const keys = {}; 2690 const mintOnce = (name, type, def, opts) => { 2691 if (!keys[name]) keys[name] = target.addComponentProperty(name, type, def, opts); 2692 return keys[name]; 2693 }; 2694 for (const bp of C.boolProps) mintOnce(bp.property, 'BOOLEAN', bp.default); 2695 for (const tp of C.textProps || []) mintOnce(tp.property, 'TEXT', tp.default); 2696 for (const b of built) { 2697 for (const t of b.registry.texts) { 2698 t.node.componentPropertyReferences = { characters: mintOnce(t.prop, 'TEXT', t.default) }; 2699 } 2700 for (const s of b.registry.slots) { 2701 // UNIFICATION (probe 2c): each variant's createSlot() minted its OWN 2702 // property; after combineAsVariants they all sit on the set under the 2703 // same display name. The first variant's id is canonical â every other 2704 // slot node rebinds to it and its duplicate is deleted, so the set ends 2705 // with ONE SLOT property that instance fills can ride across a variant 2706 // switch. 2707 const bound = bindSlot(target, s, keys[s.spec.slotProperty] || null); 2708 keys[s.spec.slotProperty] = bound.key; 2709 if (s.spec.slotOptional) { 2710 s.slot.componentPropertyReferences = {
2711 slotContentId: bound.key, 2712 visible: mintOnce('Show ' + s.spec.slotProperty, 'BOOLEAN', false), 2713 }; 2714 s.slot.visible = false; 2715 } 2716 } 2717 for (const vis of b.registry.visibles) { 2718 const key = keys[vis.prop]; 2719 if (!key) continue; 2720 vis.node.componentPropertyReferences = { visible: key }; 2721 vis.node.visible = vis.default; 2722 } 2723 } 2724 2725 if (C.isSet) { 2726 // Tight grid: rows = first axis, columns = second; per-track max sizing. 2727 const specByName = new Map(EV.map((s) => [s.name, s])); 2728 const rowsN = Math.max(...EV.map((v) => v.row)) + 1; 2729 const colsN = Math.max(...EV.map((v) => v.col)) + 1; 2730 const colWs = new Array(colsN).fill(0); 2731 const rowHs = new Array(rowsN).fill(0); 2732 for (const child of target.children) { 2733 const spec = specByName.get(child.name); 2734 if (!spec) continue; 2735 colWs[spec.col] = Math.max(colWs[spec.col], child.width); 2736 rowHs[spec.row] = Math.max(rowHs[spec.row], child.height); 2737 } 2738 for (const child of target.children) { 2739 const spec = specByName.get(child.name); 2740 if (!spec) continue; 2741 let x = PAD, y = PAD; 2742 for (let i = 0; i < spec.col; i++) x += colWs[i] + PAD; 2743 for (let i = 0; i < spec.row; i++) y += rowHs[i] + PAD; 2744 child.x = x; 2745 child.y = y; 2746 } 2747 const totalW = colWs.reduce((a, b) => a + b, 0) + PAD * (colsN + 1); 2748 const totalH = rowHs.reduce((a, b) => a + b, 0) + PAD * (rowsN + 1); 2749 target.resizeWithoutConstraints(totalW, totalH); 2750 } 2751 target.name = displayName; 2752 target.description = C.description; 2753 target.setSharedPluginData('ds_contracts', 'specHash', specHash(C)); 2754 target.setSharedPluginData('ds_contracts', 'contractId', C.contractId); 2755 target.setSharedPluginData('ds_contracts', 'statePreviewAxis', 2756 C.statePreviewAxis ? JSON.stringify(C.statePreviewAxis) : ''); 2757 target.setSharedPluginData('ds_contracts', 'semantics', 2758 C.semantics ? JSON.stringify(C.semantics) : ''); 2759 target.setSharedPluginData('ds_contracts', 'propNames', 2760 C.propNames ? JSON.stringify(C.propNames) : ''); 2761 // PROTOTYPE WIRING â BEFORE the fingerprint stamp (see amendSet). 2762 const wiredReactions = await wireStateReactions(target, new Map(built.map((b) => [b.v.name, b.comp])), C); 2763 dsStampFingerprints(target); 2764 ensureHostSection(compPage, target, displayName); 2765 2766 return { 2767 name: C.setName, 2768 contractId: C.contractId, 2769 nodeId: target.id, 2770 key: target.key, 2771 variants: C.isSet ? target.children.length : 1, 2772 properties: Object.keys(target.componentPropertyDefinitions || {}), 2773 ...(wiredReactions > 0 ? { wiredReactions: wiredReactions } : {}), 2774 }; 2775} 2776 2777const results = []; 2778for (const C of COMPONENTS) { 2779 results.push(await syncOne(C)); 2780}${p?` 2781// Proposal §6.4 â the dashed "Slot" utility goes LAST, and only once no 2782// INSTANCE_SWAP slot reference remains anywhere in the file. 2783const slotUtility = retireSlotUtility();`:``} 2784return { createdNodeIds: results.filter((r) => !r.skipped).map((r) => r.nodeId), results${p?`, ...(slotUtility ? { slotUtility: slotUtility } : {})`:``} }; 2785`}return{buildTokensScript:y,compileComponentData:$e,buildComponentScript:kt,buildBatchScript:I}}var of=e=>Rl([e.primitives,e.semantic,e.light,e.dark]),sf=[{name:`react`,label:`React + CSS Modules (the shipping generator)`,emit(e,t){let{tsx:n,css:r,stories:i}=vd(e,{tokens:of(t.tokens),icons:t.icons,contracts:t.contracts});return[{path:`${e.name}.tsx`,contents:n},{path:`${e.name}.module.css`,contents:r},{path:`${e.name}.stories.tsx`,contents:i}]}},{name:`html`,label:`Static HTML + CSS (no build step)`,emit(e,t){let{html:n,css:r}=Hd(e,{tokens:of(t.tokens),icons:t.icons,contracts:t.contracts});return[{path:`${bd(e.name)}.html`,contents:n},{path:`${bd(e.name)}.css`,contents:r}]}},{name:`react-inline`,label:`React + inline styles, tokens resolved to literals (no token pipeline)`,emit(e,t){let{tsx:n}=Zd(e,{tokens:t.tokens,icons:t.icons,contracts:t.contracts,mode:t.mode});return[{path:`${e.name}.inline.tsx`,contents:n}]}},{name:`figma-script`,label:`Figma Plugin API sync script (the canvas as an emit target)`,emit(e,t){return[{path:`${bd(e.name)}.figma.js`,contents:rf(e,{tokens:t.tokens,icons:t.icons,contracts:t.contracts,fileKey:t.fileKey,mintedTokens:t.mintedTokens}
2785)}]}}];new Map(sf.map(e=>[e.name,e]));function cf(e){return e===null||typeof e==`boolean`||typeof e==`string`?JSON.stringify(e):typeof e==`number`?Number.isFinite(e)?JSON.stringify(e):`null`:Array.isArray(e)?`[${e.map(e=>cf(e===void 0?null:e)).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${JSON.stringify(e)}:${cf(t)}`).join(`,`)}}`:`null`}function lf(e){let t=new TextEncoder().encode(e),n=t.length*8,r=Math.ceil((t.length+9)/64)*64,i=new Uint8Array(r);i.set(t),i[t.length]=128;let a=new DataView(i.buffer);a.setUint32(r-4,n>>>0),a.setUint32(r-8,Math.floor(n/4294967296));let o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],c=new Uint32Array(64),l=(e,t)=>e>>>t|e<<32-t;for(let e=0;e<i.length;e+=64){for(let t=0;t<16;t++)c[t]=a.getUint32(e+t*4);for(let e=16;e<64;e++){let t=l(c[e-15],7)^l(c[e-15],18)^c[e-15]>>>3,n=l(c[e-2],17)^l(c[e-2],19)^c[e-2]>>>10;c[e]=c[e-16]+t+c[e-7]+n>>>0}let[t,n,r,i,u,d,f,p]=s;for(let e=0;e<64;e++){let a=l(u,6)^l(u,11)^l(u,25),s=u&d^~u&f,m=p+a+s+o[e]+c[e]>>>0,h=(l(t,2)^l(t,13)^l(t,22))+(t&n^t&r^n&r)>>>0;p=f,f=d,d=u,u=i+m>>>0,i=r,r=n,n=t,t=m+h>>>0}[t,n,r,i,u,d,f,p].forEach((e,t)=>{s[t]=s[t]+e>>>0})}return s.map(e=>e.toString(16).padStart(8,`0`)).join(``)}var uf=e=>`sha256:${lf(cf(e))}`,df=e=>{let t=e.trim().split(/[\s_-]+/).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``),n=t.replace(/[^A-Za-z0-9]/g,``);return n.length>0?n:t},ff=e=>{let t=e.split(`#`)[0].trim();if(/^[a-z][A-Za-z0-9]*$/.test(t))return t;let n=df(t.replace(/[^A-Za-z0-9 _-]+/g,` `).trim());return/^[a-z]/.test(n)?n:`p${n}`},pf=new Map([`EXACT_DEFINITIONS_MISSING`,`EXACT_DEFINITION_CONTRADICTORY`,`EXACT_PROPERTY_CANONICAL_COLLISION`,`EXACT_VALUE_CANONICAL_COLLISION`,`EXACT_TUPLE_MISSING`,`EXACT_TUPLE_INCOMPLETE`,`EXACT_TUPLE_UNKNOWN_PROPERTY`,`EXACT_TUPLE_INVALID_VALUE`,`EXACT_TUPLE_DUPLICATE`,`EXACT_MATRIX_RAGGED`,`EXACT_ROWS_MISSING`,`EXACT_ROWS_EXTRA`,`EXACT_PROJECTION_COUNT_MISMATCH`].map((e,t)=>[e,t])),mf=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),hf=e=>typeof e==`object`&&!!e&&!Array.isArray(e),gf=(e,t)=>JSON.stringify(e.map(e=>[e,t[e]])),_f=e=>uf([...e].sort()).slice(7),vf=e=>{let t=[{}];for(let n of e)t=t.flatMap(e=>n.options.map(t=>({...e,[n.name]:t})));return t.map(t=>gf(e.map(e=>e.name),t)).sort()},yf=e=>{if(!hf(e))return null;let t=e.axis,n=e.default,r=e.states,i=e.primary??null;if(typeof t!=`string`||t.length===0||typeof n!=`string`||n.length===0||!Array.isArray(r)||r.length===0||!r.every(e=>typeof e==`string`&&e.length>0)||i!==null&&typeof i!=`string`)return null;let a=e.pinned??{};return!hf(a)||!Object.values(a).every(e=>typeof e==`string`)?null:{axis:t,default:n,states:r,primary:i,pinned:a}},bf=(e,t)=>{let n=e.map(e=>e.name),r=e.find(e=>e.name===t.axis);if(!r)return null;let i=e.filter(e=>e.name!==t.axis),a=[t.default,...t.states];if(r.options.length!==a.length||!a.every(e=>r.options.includes(e))||new Set(a).size!==a.length)return null;let o=t.primary===null?null:i.find(e=>e.name===t.primary);if(t.primary!==null&&!o)return null;let s=i.filter(e=>!o||e.name!==o.name).map(e=>e.name).sort(),c=Object.keys(t.pinned).sort();if(c.length!==s.length||!c.every((e,t)=>e===s[t]))return null;for(let[e,n]of Object.entries(t.pinned)){let t=i.find(t=>t.name===e);if(!t||!t.options.includes(n))return null}let l=[],u=[{}];for(let e of i)u=u.flatMap(t=>e.options.map(n=>({...t,[e.name]:n})));for(let e of u)l.push(gf(n,{...e,[t.axis]:t.default}));let d=o?o.options:[null];for(let e of t.states)for(let r of d){let a={[t.axis]:e};for(let e of i)a[e.name]=o&&e.name===o.name?r:t.pinned[e.name];l.push(gf(n,a))}return new Set(l).size===l.length?l.sort():null},xf=e=>({code:`EXACT_DEFINITION_CONTRADICTORY`,message:e}),Sf=(e,t)=>
2785{let n=new Map;for(let r of e){let e=t(r),i=n.get(e)??[];i.push(r),n.set(e,i)}return[...n.entries()].filter(([,e])=>new Set(e).size>1).sort(([e],[t])=>e.localeCompare(t)).map(([,e])=>[...new Set(e)].sort())},Cf=e=>{let t=[],n=[],r=Object.keys(e).filter(t=>hf(e[t])&&e[t].type===`VARIANT`).sort();for(let e of Sf(r,ff))n.push({code:`EXACT_PROPERTY_CANONICAL_COLLISION`,message:`Variant properties ${e.map(e=>JSON.stringify(e)).join(`, `)} canonicalize to ${JSON.stringify(ff(e[0]))}.`,tuples:e});for(let r of Object.keys(e).sort()){let i=e[r];if(!hf(i)||typeof i.type!=`string`){n.push(xf(`Property definition ${JSON.stringify(r)} requires a string type.`));continue}if(i.type!==`VARIANT`)continue;let a=i.variantOptions,o=i.defaultValue;if(!Array.isArray(a)||a.length===0||a.some(e=>typeof e!=`string`)||typeof o!=`string`){n.push(xf(`Variant definition ${JSON.stringify(r)} requires a string defaultValue and non-empty string variantOptions.`));continue}let s=a;if(new Set(s).size!==s.length){n.push(xf(`Variant definition ${JSON.stringify(r)} contains duplicate options.`));continue}if(!s.includes(o)){n.push(xf(`Variant definition ${JSON.stringify(r)} has a defaultValue outside variantOptions.`));continue}for(let e of Sf(s,df))n.push({code:`EXACT_VALUE_CANONICAL_COLLISION`,message:`Variant property ${JSON.stringify(r)} values ${e.map(e=>JSON.stringify(e)).join(`, `)} canonicalize to ${JSON.stringify(df(e[0]))}.`,tuples:e});t.push({name:r,options:[...s].sort()})}return{axes:t,refusals:n}},wf=(e,t,n,r)=>{let i=t.map(e=>e.name),a=new Map(t.map(e=>[e.name,new Set(e.options)])),o=[],s=[],c=new Set;return e.forEach((e,t)=>{let l=hf(e)?e.variantProperties:void 0,u=r&&l===void 0?{}:l;if(!hf(u)){s.push({code:`EXACT_TUPLE_MISSING`,message:`${n} row ${t} has no structured variantProperties tuple.`});return}let d=Object.keys(u),f=i.filter(e=>!mf(u,e)),p=d.filter(e=>!a.has(e)).sort(),m=i.filter(e=>mf(u,e)&&!a.get(e)?.has(u[e])).sort();if(f.length>0&&s.push({code:`EXACT_TUPLE_INCOMPLETE`,message:`${n} row ${t} is missing properties: ${f.map(e=>JSON.stringify(e)).join(`, `)}.`}),p.length>0&&s.push({code:`EXACT_TUPLE_UNKNOWN_PROPERTY`,message:`${n} row ${t} has unknown properties: ${p.map(e=>JSON.stringify(e)).join(`, `)}.`}),m.length>0&&s.push({code:`EXACT_TUPLE_INVALID_VALUE`,message:`${n} row ${t} has invalid values for: ${m.map(e=>JSON.stringify(e)).join(`, `)}.`}),f.length>0||p.length>0)return;let h=gf(i,u);if(c.has(h)){s.push({code:`EXACT_TUPLE_DUPLICATE`,message:`${n} row ${t} duplicates tuple ${h}.`,tuples:[h]});return}c.add(h),o.push(h)}),{tuples:o.sort(),refusals:s}},Tf=e=>[...e].sort((e,t)=>(pf.get(e.code)??2**53-1)-(pf.get(t.code)??2**53-1)||e.message.localeCompare(t.message)),Ef=e=>{let t=Tf(e);return{status:`refused`,code:t[0].code,refusals:t}},Df=e=>Array.isArray(e)?e:e.variants;function Of(e,t){let n=e.type===`COMPONENT`,r=mf(e,`propertyDefinitions`),i=e.variants.some(e=>hf(e)&&mf(e,`variantProperties`));if(!n&&!i)return{status:`legacy-unverified`,reason:`structured-exact-evidence-absent`};let a;if(n&&!r)a={};else if(hf(e.propertyDefinitions))a=e.propertyDefinitions;else return Ef([{code:`EXACT_DEFINITIONS_MISSING`,message:`Structured tuple evidence requires a propertyDefinitions record.`}]);let{axes:o,refusals:s}=Cf(a);if(s.length>0)return Ef(s);let c=n&&o.length===0;if(o.length===0&&!c)return Ef([{code:`EXACT_DEFINITIONS_MISSING`,message:`propertyDefinitions contains no VARIANT definitions.`}]);let l=yf(e.statePreviewAxis),u=(l&&bf(o,l))??vf(o),d=new Set(u),f=wf(e.variants,o,`source`,c);if(f.refusals.length>0)return Ef(f.refusals);let p=new Set(f.tuples),m=u.filter(e=>!p.has(e)),h=f.tuples.filter(e=>!d.has(e));if(m.length>0||h.length>0||f.tuples.length!==u.length)return Ef([{code:`EXACT_MATRIX_RAGGED`,message:`Source matrix has ${f.tuples.length} rows; Cartesian definitions require ${u.length}.`,tuples:[...m,...h].sort(),expected:u.length,actual:f.tuples.length}]);if(t!==void 0){let e=Df(t),n=wf(e,o,`returned`,c),r=new Set(n.tuples),i=f.tuples.filter(e=>!r.has(e)),a=n.tuples.filter(e=>!p.has(e)),s=[...n.refusals];if(i.length>0&&s.push({code:`EXACT_ROWS_MISSING`,message:`Returned projection is missing ${i.length} source tuple(s).`,tuples:i}),a.length>0&&s.push({code:`EXACT_ROWS_EXTRA`,message:`Returned projection contains ${a.length} tuple(s) absent from the source.`,tuples:a}),e.length!==f.tuples.length&&s.push({code:`EXACT_PROJECTION_COUNT_MISMATCH`,message:`Returned projection has ${e.length} rows; source has ${f.tuples.length}.`,expected:f.tuples.length,actual:e.length}),s.length>0)return Ef(s)}return{status:t===void 0?`source-matrix-verified`:`verified-exact`,propertyNames:o.map(e=>e.name),expectedCount:u.length,observedCount:f.tuples.length,tupleSetHash:_f(f.tuples),tuples:f.tuples}}var Q=e=>{let t=e.trim().split(/[\s_-]+/).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``),n=t.replace(/[^A-Za-z0-9]/g,``);return n.length>0?n:t},kf=e=>ou(e).path,Af=e=>`{${kf(e)}}`,jf=e=>{let t=e.split(`#`)[0].trim();if(/^[a-z][A-Za-z0-9]*$/.test(t))return t;let n=Q(t.replace(/[^A-Za-z0-9 _-]+/g,` `).trim());return/^[a-z]/.test(n)?n:`p${n}`},Mf=e=>/[^A-Za-z0-9 _-]/.test(e.split(`#`)[0].trim()),Nf=e=>{let t=e.split(`#`)[0].trim();return/^[a-z][A-Za-z0-9]*$/.test(t)?!1:!/^[a-z]/.test(Q(t.replace(/[^A-Za-z0-9 _-]+/g,` `).trim()))},Pf=e=>{let t=bd(e).replace(/[^a-z0-9-]+/g,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``);return/^[a-z]/.test(t)?t:`c${t?`-${t}`:``}`},Ff=e=>Pf(e)!==bd(e),If=e=>{let t=e.replace(/[^A-Za-z0-9]+/g,` `).trim().split(/\s+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return/^[A-Za-z]/.test(t)?t:`C${t||`omponent`}`},Lf=e=>e?typeof e.dumpVersion==`string`?!0:/dump v1\.[1-9]/.test(e.note??``):!1,Rf=e=>{if(!e.includes(`=`))return{};let t={};for(let n of e.split(`,`)){let[e,r]=n.split(`=`).map(e=>e.trim());e&&r!==void 0&&(t[e]=r)}return t};function zf(e){let t=[];for(let n of e)for(let[e,r]of Object.entries(Rf(n))){let n=t.find(t=>t.property===e);n||(n={property:e,propName:jf(e),values:[]},t.push(n)),n.values.includes(r)||n.values.push(r)}return t}var Bf=e=>{let t=new Set(e.map(e=>e.trim().toLowerCase()));return t.size===2&&t.has(`true`)&&t.has(`false`)},Vf={default:`default`,hover:`hover`,active:`active`,pressed:`active`,focus:`focus-visible`,"focus-visible":`focus-visible`,disabled:`disabled`},Hf=e=>e.trim().toLowerCase().replace(/[\s_]+/g,`-`);function Uf(e,t){for(let n of e){if(Bf(n.values))continue;let e=/^states?$/i.test(n.property.trim()),r=n.values.filter(e=>Vf[Hf(e)]===void 0);if(r.length>0){e&&t.push(`variant axis "${n.property}
2785": named like an interaction-state axis but value(s) ${r.join(`, `)} are outside the interaction-state vocabulary (default|hover|focus|focus-visible|active|pressed|disabled) â kept as an enum prop, review`);continue}let i=n.values.map(e=>({value:e,state:Vf[Hf(e)]})),a=i.find(e=>e.state==="default")?.value,o=i.filter(e=>e.state!=="default");if(a===void 0||o.length===0){e&&t.push(`variant axis "${n.property}": carries interaction-state values but no default/non-default split to promote â kept as an enum prop, review`);continue}if(!e&&o.length<2)continue;let s=[],c;for(let e of o){if(e.state===`disabled`){c=e.value;continue}let r=s.find(t=>t.state===e.state);if(r){t.push(`variant axis "${n.property}": values "${r.value}" and "${e.value}" both map to contract state "${e.state}" â "${e.value}" is not promoted, review`);continue}s.push({value:e.value,state:e.state})}return{axis:n,defaultValue:a,promoted:s,disabledValue:c}}return null}function Wf(e,t,n){if(!e.includes(`=`))return e;let r=e.split(`,`).map(e=>e.trim()).filter(e=>e.split(`=`)[0].trim()!==t);return r.length>0?r.join(`, `):n}var Gf=/^(theme|mode|color[\s_-]?scheme|scheme|appearance)$/i,Kf=new Set([`light`,`dark`,`high-contrast`,`dim`,`black`,`white`]);function qf(e,t,n,r){if(e.type!==t.type)return`${n}: node type ${e.type} vs ${t.type}`;let i=e.bound??{},a=t.bound??{};for(let e of new Set([...Object.keys(i),...Object.keys(a)])){if(i[e]!==a[e])return`${n}: field "${e}" binds "${i[e]??`(unbound)`}" vs "${a[e]??`(unbound)`}"`;r&&i[e]!==void 0&&r.carriers++}let o=e=>e===void 0?`none`:e.var===void 0?`raw`:`var:${e.var}`;if(o(e.fill)!==o(t.fill))return`${n}: fill ${o(e.fill)} vs ${o(t.fill)}`;if(o(e.stroke)!==o(t.stroke))return`${n}: stroke ${o(e.stroke)} vs ${o(t.stroke)}`;if(r)for(let[n,i]of[[e.fill,t.fill],[e.stroke,t.stroke]])n===void 0||i===void 0||(n.var===void 0?(n.hex!==i.hex||(n.alpha??1)!==(i.alpha??1))&&r.rawDeltas++:r.carriers++);if(JSON.stringify(e.layout??null)!==JSON.stringify(t.layout??null))return`${n}: auto-layout differs`;if((e.cornerRadius??null)!==(t.cornerRadius??null))return`${n}: corner radius differs`;if((e.strokeWeight??null)!==(t.strokeWeight??null))return`${n}: stroke weight differs`;if((e.opacity??1)!==(t.opacity??1))return`${n}: node opacity differs`;if((e.hidden??!1)!==(t.hidden??!1))return`${n}: visibility differs`;for(let r of[`minWidth`,`minHeight`,`maxWidth`,`maxHeight`])if((e[r]??null)!==(t[r]??null))return`${n}: ${r} differs`;if(e.text===void 0!=(t.text===void 0))return`${n}: text presence differs`;if(e.text&&t.text){let i=e.text,a=t.text;if(i.characters!==a.characters||i.fontSize!==a.fontSize||i.fontStyle!==a.fontStyle||(i.lineHeight??null)!==(a.lineHeight??null)||(i.style??null)!==(a.style??null))return`${n}: text/typography differs`;if((i.fillVar??null)!==(a.fillVar??null))return`${n}: text fill binds "${i.fillVar??`(raw)`}" vs "${a.fillVar??`(raw)`}"`;r&&i.fillVar!==void 0&&r.carriers++}let s=e=>JSON.stringify((e??[]).map(e=>({t:e.type,o:e.offset??null,r:e.radius??null,s:e.spread??null})));if(s(e.effects)!==s(t.effects))return`${n}: effects differ`;if(r){let n=e=>JSON.stringify((e??[]).map(e=>e.color??null));n(e.effects)!==n(t.effects)&&r.rawDeltas++}if((e.instanceOf??null)!==(t.instanceOf??null))return`${n}: nested instance differs`;if(JSON.stringify(e.componentProperties??null)!==JSON.stringify(t.componentProperties??null))return`${n}: applied instance props differ`;if(JSON.stringify(e.propRefs??null)!==JSON.stringify(t.propRefs??null))return`${n}: property references differ`;let c=e.children??[],l=t.children??[];if(c.length!==l.length)return`${n}: ${c.length} vs ${l.length} children`;for(let e=0;e<c.length;e++){if(c[e].name!==l[e].name)return`${n}: child "${c[e].name}" vs "${l[e].name}"`;let t=qf(c[e],l[e],`${n}/${c[e].name}`,r);if(t)return t}return null}function Jf(e,t,n,r){for(let i of e){if(!Gf.test(i.property.trim())||Bf(i.values))continue;let e=i.values.filter(e=>!Kf.has(Hf(e)));if(e.length>0){r.push(`variant axis "${i.property}": named like a token-mode axis but value(s) ${e.join(`, `)} are outside the mode vocabulary (light|dark|high-contrast|dim|black|white) â kept as an enum prop, review`);continue}if(t.some(e=>Rf(e.name)[i.property]===void 0)){r.push(`variant axis "${i.property}": token-mode axis detected but some variant names omit the pair â promotion unsafe, axis kept as an enum prop; review`);continue}let a=i.values[0],o=e=>Wf(e.name,i.property,n),s=new Map;for(let e of t)Rf(e.name)[i.property]===a&&s.set(o(e),e);let c=null,l={carriers:0,rawDeltas:0};for(let e of t){if(Rf(e.name)[i.property]===a)continue;let t=s.get(o(e));if(!t){c=`variant "${e.name}" has no ${i.property}=${a} counterpart`;break}if(c=qf(t,{...e,name:t.name},o(e),l),c)break}if(c){r.push(`variant axis "${i.property}" (${i.values.join(`|`)}): named like a token mode but the variants differ beyond color across its values (${c}) â NOT promoted; kept as an enum prop (if this is theming, unify the drawn structure), review`);continue}if(l.rawDeltas>0&&l.carriers===0){r.push(`variant axis "${i.property}" (${i.values.join(`|`)}): named like a token mode and structurally corroborated, but its ${l.rawDeltas} differing color literal(s) are RAW â the set binds NO variables along the axis, so there are no variable modes for the deltas to ride and promotion would drop the axis's styling entirely â NOT promoted; kept as an enum prop with per-axis-value style carriage (bind the colors to mode-switched variables to make this a token mode), review`);continue}return{axis:i,defaultValue:a}}return null}function Yf(e,t,n){let r=t=>`semantics: ${t} inferred from the set name "${e}" â inference is mechanical (name/axis table), review`;if(/\bgroup\b/i.test(e))return null;if(/\b(button|btn)\b/i.test(e))return{element:`button`,note:r(`element "button"`)};if(/\blink\b/i.test(e))return{element:`a`,note:r(`element "a" ("link")`)};if(/\btooltip\b/i.test(e))return{element:`div`,role:`tooltip`,note:r(`element "div" + role "tooltip"`)};if(/\b(heading|title)\b/i.test(e)){let e=t.find(e=>/^levels?$/i.test(e.property.trim())&&!Bf(e.values)&&e.values.every(e=>/^h?[1-6]$/i.test(e.trim())));if(e){let t=e=>`h${e.trim().replace(/^h/i,``)}`;return{element:t(e.values[0]),elementByProp:{prop:e.propName,map:Object.fromEntries(e.values.map(e=>[Q(e),t(e)]))},note:r(`heading semantics (element "${t(e.values[0])}" + elementByProp over the "${e.property}" axis)`)}}return null}return/\b(switch|toggle)\b/i.test(e)?{element:`input`,role:`switch`,note:r(`element "input" + role "switch"`)}:/\bcheckbox\b/i.test(e)?{element:`input`,note:r(`element "input" ("checkbox"; the type="checkbox" attribute is not canvas-recoverable â author it)`)}:/\btext\s?area\b/i.test(e)?{element:`textarea`,note:r(`element "textarea"`)}:/\b(select|dropdown)\b/i.test(e)?{element:`select`,note:r(`element "select"`)}:/\b(input|text\s?field)\b/i.test(e)?{element:`input`,note:r(`element "input"`)}:n?{element:`button`,note:`semantics: element "button" inferred STRUCTURALLY â the set carries an interaction-state variant axis (hover/pressed/⦠are platform states of an interactive element) and the name gave no signal; review`}:null}function Xf(e){let t=[];for(let n of e){let e=0;for(let r of n){let n=t.indexOf(r);if(n>=0){e=n+1;continue}t.splice(e,0,r),e++}}return t}var Zf=e=>{let t=new Map;return e.map(e=>
2785{let n=t.get(e.name)??0;return t.set(e.name,n+1),n===0?e.name:`${e.name}\u0000${n}`})};function Qf(e,t,n,r){let i=e=>`${e.name}�${e.type}`,a=new Map;for(let n of e)for(let e of t.get(n)){if(e.type!==`FRAME`&&e.type!==`GROUP`||(e.children??[]).length===0)continue;let t=a.get(e.name);t||a.set(e.name,t={type:e.type,firstNode:e,childKeys:new Set,present:new Set}),t.present.add(n);for(let n of e.children??[])t.childKeys.add(i(n))}let o=new Set;for(let[e,n]of a)for(let r of n.present)for(let a of t.get(r))a.name!==e&&n.childKeys.has(i(a))&&o.add(i(a));for(let[s,c]of a){if(c.present.size===e.length||c.present.size===0)continue;let a=new Set([...c.childKeys].filter(e=>!o.has(e)));if(a.size!==0)for(let o of e){if(c.present.has(o))continue;let e=t.get(o);if(e.some(e=>e.name===s&&!c.childKeys.has(i(e))))continue;let l=e.filter(e=>a.has(i(e)));if(l.length===0)continue;let u=e.indexOf(l[0]),d={...c.firstNode,children:l,__synthetic:!0},f=e.filter(e=>!l.includes(e));f.splice(Math.min(u,f.length),0,d),t.set(o,f),n.push(`${r}: variant "${o.variant}" draws ${l.map(e=>`"${e.name}"`).join(`, `)} flat where other variants nest under wrapper "${s}" â folded into the wrapper so the union keeps ONE part per canvas node (wrapper-union identity)`)}}}function $f(e,t,n,r){let i=[...new Set(t.map(e=>e.node.type))];i.length>1&&n.push(`${r}: node type differs across variants (${i.join(`, `)}) â using ${i[0]}`);let a=new Map;for(let e of t)a.set(e,e.node.children??[]);t.length>1&&Qf(t,a,n,r);let o=Xf(t.map(e=>Zf(a.get(e)))),s=new Map;for(let e of o){let t=e.split(`\0`)[0];s.set(t,(s.get(t)??0)+1)}let c=o.map(e=>{let[i,o]=e.split(`\0`),c=o?Number(o):0,l=[];for(let e of t){let t=a.get(e).filter(e=>e.name===i)[c];t&&l.push({variant:e.variant,node:t})}let u=i;if((s.get(i)??0)>1){let e=[...new Set(l.map(e=>e.node.propRefs?.mainComponent).filter(e=>e!==void 0))];u=e.length===1?e[0]:c===0?i:`${i} ${c+1}`}return $f(u,l,n,`${r}/${u}`)});return{name:e,type:i[0],occ:t,children:c}}var ep=e=>e===void 0?void 0:typeof e==`string`?e:`f(${e.propName}):${JSON.stringify(e.byValue)}`;function tp(e,t){let n=e.filter(e=>e.path!==void 0);if(n.length===0)return{kind:`none`};let r=n.find(e=>!/^[a-z0-9.-]+$/i.test(e.path));if(r)return{kind:`drift`,detail:`variable name "${r.path.split(`.`).join(`/`)}" contains characters outside the token-ref grammar ([a-z0-9.-]) â binding not proposed; rename the variable or map it manually`};if(n.length!==e.length)return{kind:`drift`,detail:`bound in ${n.length}/${e.length} variants (${n.map(e=>e.variant).join(`, `)}) â inconsistent, not proposed`};let i=[...new Set(n.map(e=>e.path))];if(i.length===1)return{kind:`ref`,ref:`{${i[0]}}`};let a=n.map(e=>e.path.split(`.`)),o=a[0].length,s=a.every(e=>e.length===o);if(s){let e=[];for(let t=0;t<o;t++)new Set(a.map(e=>e[t])).size>1&&e.push(t);if(e.length===1){let r=e[0];for(let e of t)if(n.every((t,n)=>{let i=Rf(t.variant)[e.property];return i!==void 0&&a[n][r]===Q(i)})){let t=[...a[0]];return t[r]=`{${e.propName}}`,{kind:`ref`,ref:`{${t.join(`.`)}}`}}}}for(let e of t){if(Bf(e.values))continue;let t=new Map,r=!0;for(let i of n){let n=Rf(i.variant)[e.property];if(n===void 0){r=!1;break}let a=t.get(n);if(a!==void 0&&a!==i.path){r=!1;break}t.set(n,i.path)}if(!(!r||!e.values.every(e=>t.has(e))))return{kind:`per-value`,perValue:{propName:e.propName,defaultValue:Q(e.values[0]),byValue:Object.fromEntries([...t].map(([e,t])=>[Q(e),`{${t}}`]))}}}return s?{kind:`drift`,detail:`bindings differ across variants without correlating to any variant axis: ${i.join(` vs `)}`}:{kind:`drift`,detail:`token paths differ in depth: ${i.join(` vs `)}`}}var np=`text-style-identity-refused`,rp=class extends Error{code;projection;constructor(e,t,n){super(t),this.name=`ExactProjectionError`,this.code=e,this.projection=n}},ip=class extends Error{code=np;constructor(e){super(e.startsWith(`text-style-identity-refused:`)?e:`${np}: ${e}`),this.name=`TextStyleIdentityError`}};function ap(e,t){if(e.status===t)return e;if(e.status===`refused`){let t=e.refusals[0];throw new rp(e.code,t?.message??`Exact variant projection refused (${e.code}).`,e)}throw new rp(`EXACT_DEFINITIONS_MISSING`,e.status===`legacy-unverified`?`Exact proposal requires structured propertyDefinitions and variantProperties evidence.`:`Exact proposal requires projection status ${t}; received ${e.status}.`,e)}function op(e){let t=e.statePreviewAxis;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t,r=n.pinned??{};return typeof n.axis!=`string`||!n.axis||typeof n.default!=`string`||!n.default||!Array.isArray(n.states)||n.states.length===0||!n.states.every(e=>typeof e==`string`&&e)||n.primary!==null&&n.primary!==void 0&&typeof n.primary!=`string`||typeof r!=`object`||!r||Array.isArray(r)||!Object.values(r).every(e=>typeof e==`string`)?null:{axis:n.axis,default:n.default,states:n.states,primary:n.primary??null,pinned:r}}var sp=(e,t,n)=>{throw new rp(`EXACT_SEMANTIC_PROJECTION_AMBIGUOUS`,`Exact proposal cannot promote variant axis ${JSON.stringify(t.property)} to ${n} semantics because that changes the authoritative Figma variant projection.`,e)};function cp(e,t){let n=Array.isArray(e.props)?e.props:[],r=[];for(let e of n){if(typeof e!=`object`||!e||Array.isArray(e))continue;let t=e.bindings;if(typeof t!=`object`||!t||Array.isArray(t))continue;let n=t.figma;if(typeof n!=`object`||!n||Array.isArray(n))continue;let i=n;if(i.kind!==`VARIANT`||typeof i.property!=`string`||i.values===null||typeof i.values!=`object`||Array.isArray(i.values))continue;let a=Object.values(i.values).filter(e=>typeof e==`string`);r.push({property:i.property,values:a})}let i=[{}];for(let e of r)i=i.flatMap(t=>e.values.map(n=>({...t,[e.property]:n})));let a=t;if(a&&e.figmaStatePreviews===!0){let t=Array.isArray(e.states)?e.states.filter(e=>typeof e==`string`):[],n=[...a.states].sort(),o=t.map(e=>jl(e)).sort(),s=n.every(e=>o.includes(e)),c=r.find(e=>e.property===a.primary),l=Object.entries(a.pinned).every(([e,t])=>{let n=r.find(t=>t.property===e);return n?n.values.includes(t):!1});
2785if(s&&l&&(a.primary===null||c)){let e=i.map(e=>({...e,[a.axis]:a.default})),t=c?c.values:[null];for(let n of a.states)for(let i of t){let t={[a.axis]:n};for(let e of r)t[e.property]=c&&e.property===c.property?i:a.pinned[e.property];e.push(t)}return e.map(e=>({variantProperties:e}))}}return i.map(e=>({variantProperties:e}))}function lp(e,t){let n=t.startsWith(`text-style-identity-refused:`)?t:`${np}: ${t}`;if(e.projectionMode===`exact`)throw new ip(n);e.notes.push(n)}var up=(e,t)=>{for(let n of e){let e=t(n.node);if(e!==void 0)return e}};function dp(e,t,n,r){e.unbound.push({nodePath:t,property:n,value:r,suggestions:e.corpus.suggestFor(r).slice(0,5)})}var fp=e=>{let t=e.indexOf(`:root`);return t>=0?e.slice(t+5).replace(/^\//,``):``},pp=`linear-gradient(135deg, #f2f4f7 0%, #d0d5dd 100%)`,mp=e=>typeof e==`string`&&e!==``?`url('./assets/images/${e.replace(/[^a-zA-Z0-9._-]+/g,`-`)}.png')`:e===!0?pp:`none`,hp=e=>{let t=e.declared??{};t[`background-size`]===void 0&&(t[`background-size`]=`cover`),t[`background-position`]===void 0&&(t[`background-position`]=`50% 50%`),t[`background-repeat`]===void 0&&(t[`background-repeat`]=`no-repeat`),e.declared=t};function $(e,t,n,r,i,a,o,s,c,l){e.mint&&e.mint.observations.push({nodePath:n,part:fp(n),...c===void 0?{}:{styleName:c},...l===void 0?{}:{styleKey:l},cssProperty:r,kind:i,occurrences:a.map(t=>({variant:t.variant,axisValues:e.mint.axisValuesByVariant.get(t.variant)??{},value:t.value,...t.styleName===void 0?{}:{styleName:t.styleName},...t.styleKey===void 0?{}:{styleKey:t.styleKey}})),target:t,source:o,...s===void 0?{}:{sparse:s}})}var gp=(e,t)=>e.occ.map(e=>({variant:e.variant,value:t(e.node)??0}));function _p(e,t){let n=e.mint;if(!n)return null;let r=n.observations.find(e=>e.nodePath===t.where&&e.cssProperty===t.chan);if(!r||r.occurrences.length<2)return null;let i=(t.part.literalsByProp??[]).filter(e=>Object.values(e.map).some(e=>t.chan in e)),a=r.occurrences[0].axisValues,o=null;for(let e of n.axes){if(e.bool||i.some(t=>t.prop!==e.propName))continue;let t=n.axes.filter(t=>t.propName!==e.propName),s=new Map;for(let n of r.occurrences){if(t.some(e=>n.axisValues[e.propName]!==a[e.propName]))continue;let r=n.axisValues[e.propName];r===void 0||s.has(r)||typeof n.value!=`number`||s.set(r,n.value)}let c=[...s.values()],l=new Set(c).size;if(l<2)continue;let u=Math.max(...c)-Math.min(...c),d=new Map;for(let t of e.values)s.has(t)&&d.set(t,s.get(t));for(let[e,t]of s)d.has(e)||d.set(e,t);let f={prop:e.propName,byValue:d,span:u,distinct:l,baseCombo:t.map(e=>`${e.propName}=${a[e.propName]??`â
`}`).join(`, `)};(o===null||f.span>o.span||f.span===o.span&&(f.distinct>o.distinct||f.distinct===o.distinct&&f.byValue.size>o.byValue.size))&&(o=f)}return o===null?null:{prop:o.prop,byValue:o.byValue,baseCombo:o.baseCombo}}function vp(e,t,n,r){let i=tp(e.occ.map(e=>({variant:e.variant,path:e.node.bound?.[t]?kf(e.node.bound[t]):void 0})),n.axes);if(i.kind===`ref`)return i.ref;if(i.kind===`per-value`)return i.perValue;i.kind===`drift`&&n.notes.push(`${r} ${t}: ${i.detail}`)}function yp(e,t,n,r,i,a){if(r===void 0)return;if(typeof r==`string`){e[n]=r;return}if(t.prop!==void 0&&t.prop!==r.propName){i.notes.push(`${a} ${n}: bindings are a function of enum axis "${r.propName}" by value, but this part's per-value overrides already ride "${t.prop}" â tokensByProp carries ONE axis per part; NAMED, not proposed (review)`);return}t.prop=r.propName;let o=r.byValue[r.defaultValue];e[n]=o;let s=[];for(let[e,i]of Object.entries(r.byValue))e===r.defaultValue||i===o||((t.map[e]??={})[n]=i,s.push(`${e}=${i}`));i.notes.push(`${a} ${n}: bindings are a function of variant axis "${r.propName}" by VALUE (default ${r.defaultValue}=${o}${s.length>0?`; ${s.join(`, `)}`:``}) â carried as tokensByProp overrides (v10; the token names do not spell the axis values, so the substituted-ref shape cannot carry them)`)}function bp(e,t){t.prop!==void 0&&Object.keys(t.map).length>0&&(e.tokensByProp={prop:t.prop,map:t.map})}var xp=e=>{if(e.alpha===void 0||e.alpha>=1)return`#${e.hex}`;let t=Math.round(Math.max(0,Math.min(1,e.alpha))*255).toString(16).padStart(2,`0`);return`#${e.hex}${t}`};function Sp(e,t,n,r,i,a){let o=e.occ.map(e=>({variant:e.variant,paint:t(e.node),node:e.node})),s=e=>
2785typeof a?.absentAs==`function`?a.absentAs(e.node):a?.absentAs;if(o.every(e=>e.paint===void 0))return;let c=o.find(e=>e.paint?.hex!==void 0);if(c){if(dp(n,r,i,xp(c.paint)),n.mint&&a){let e=o.every(e=>e.paint?.hex!==void 0),t=a.absentAs!==void 0&&o.every(e=>e.paint===void 0?s(e)!==void 0:e.paint.hex!==void 0);if(e||t){let t=[...new Set(o.filter(e=>e.paint===void 0).map(e=>s(e)))];$(n,a.target,r,a.cssProperty,`color`,o.map(e=>({variant:e.variant,value:e.paint===void 0?s(e):xp(e.paint)})),`${r}|${i}`,e?void 0:a.sparse),e||n.notes.push(`${r} ${i}: drawn in ${o.filter(e=>e.paint!==void 0).length}/${o.length} variant(s) â the ABSENT variants mint ${t.join(`/`)} (their absence is a DRAWN fact this node explains: a strokeless node is a zero-width transparent stroke, and a node whose paint stack is an imageFill draws no solid under it), so ${a.cssProperty} carries for the whole axis instead of falling back to currentColor or dropping`)}else n.mint.partialSources.add(`${r}|${i}`)}return}let l=tp(o.map(e=>({variant:e.variant,path:e.paint?.var?kf(e.paint.var):void 0})),n.axes);if(l.kind===`ref`||l.kind===`per-value`){let e=o.find(e=>e.paint?.var!==void 0&&(e.paint.alpha??1)<1);return e&&n.notes.push(`${r} ${i}: paint opacity ${e.paint.alpha} rides the bound variable "${e.paint.var}" â alpha is not representable on a token ref; binding proposed at full opacity, review`),l.kind===`ref`?l.ref:l.perValue}if(l.kind===`drift`){if(n.mint&&a&&o.every(e=>e.paint?.var!==void 0)){let e=o.map(e=>n.capturedValues?.get(kf(e.paint.var)));if(e.every(e=>e!==void 0)){$(n,a.target,r,a.cssProperty,`color`,o.map((t,n)=>({variant:t.variant,value:e[n]})),`${r}|${i}`),n.notes.push(`${r} ${i}: ${l.detail} â routed to the mint pass at captured-value literal fidelity (per-variant leaves when it classifies: any single axis, or an axis pair/triple on the root; otherwise the mint pass refuses BY NAME below); the observed refs here are the rename targets`);return}}n.notes.push(`${r} ${i}: ${l.detail}`)}}function Cp(e,t,n){let r=e.occ.filter(e=>e.node.stroke!==void 0),i=new Set(r.map(e=>e.node.strokeAlign).filter(e=>e!==void 0));if(i.size===0)return`border`;if(i.size>1)return t.notes.push(`${n}: stroke alignment differs across variants [${[...i].sort().join(`, `)}] â one node lowers to ONE border/outline vocabulary, so the mixed case is REFUSED BY NAME and the stroke carries as an INSIDE border (review)`),`border`;let[a]=i;return a===`OUTSIDE`?`outline`:(a===`CENTER`&&t.notes.push(`${n}: strokeAlign CENTER â half the weight is drawn inside the box and half outside; CSS border draws wholly inward and outline wholly outward, so neither carries it exactly. REFUSED BY NAME (capture receipt stroke-align-unsupported); the stroke carries as an INSIDE border, off by half its weight per side (review)`),`border`)}function wp(e){let t=.001,n=e.end.x-e.start.x,r=e.end.y-e.start.y,i=Math.abs(r)<=t&&Math.abs(n)>t;if(!i&&!(Math.abs(n)<=t&&Math.abs(r)>t))return{refuse:Math.abs(n)<=t&&Math.abs(r)<=t?`degenerate GRADIENT_LINEAR (start â end handle) â no axis to carry`:`OBLIQUE GRADIENT_LINEAR (handles (${e.start.x}, ${e.start.y}) â (${e.end.x}, ${e.end.y})) â the CSS angle and stop scale depend on the drawn box's aspect ratio, so no size-independent exact carriage exists`};let a=i?n>0?90:270:r>0?180:0,o=t=>i?(t-e.start.x)/n:(t-e.start.y)/r,s=o(i?n>0?0:1:r>0?0:1),c=o(i?+(n>0):+(r>0));if(!(c>s)||!isFinite(s)||!isFinite(c))return{refuse:`GRADIENT_LINEAR handles produce an empty visible segment (${s}..${c}) â not carried`};let l=e.alpha??1,u=[...e.stops].sort((e,t)=>e.position-t.position),d=e=>{let t=e.hex.length===6?e.hex:e.hex.padEnd(6,`0`);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),(e.alpha??1)*l]},f=e=>{if(e<=u[0].position)return d(u[0]);if(e>=u[u.length-1].position)return d(u[u.length-1]);for(let t=0;t<u.length-1;t++){let n=u[t],r=u[t+1];if(e<n.position||e>r.position)continue;let i=r.position===n.position?0:(e-n.position)/(r.position-n.position),a=d(n),o=d(r);return[0,1,2,3].map(e=>a[e]+(o[e]-a[e])*i)}return d(u[u.length-1])},p=([e,t,n,r])=>xp({hex:[e,t,n].map(e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,`0`)).join(``),alpha:Math.round(r*1e4)/1e4}),m=e=>`${Math.round((e-s)/(c-s)*1e4)/100}%`,h=[`${p(f(s))} 0%`];for(let e of u)e.position>s&&e.position<c&&h.push(`${p(d(e))} ${m(e.position)}`);return h.push(`${p(f(c))} 100%`),{css:`linear-gradient(${a}deg, ${h.join(`, `)})`}}function Tp(e,t,n,r){let i=e.occ.filter(e=>e.node.gradient!==void 0);if(i.length===0)return;if(e.occ.some(e=>e.node.imageFill!==void 0)){t.notes.push(`${n}: fill stack carries BOTH a GRADIENT_LINEAR and an IMAGE marker across the variants â background-image is claimed by the image channel; gradient NAMED, not carried (review)`);return}let a=[...new Set(i.flatMap(e=>e.node.gradient.stops.map(e=>e.var).filter(e=>e!==void 0)))];
2785if(!t.mint){t.notes.push(`${n}: GRADIENT_LINEAR fill captured (dump v1.16) in ${i.length}/${e.occ.length} variant(s) â background-image not proposed without minting (a gradient value has no token-ref spelling)`);return}let o=[];for(let r of e.occ){if(r.node.gradient===void 0){o.push({variant:r.variant,value:`none`});continue}let e=wp(r.node.gradient);if(`refuse`in e){t.notes.push(`${n} fill (${r.variant}): ${e.refuse} â background-image REFUSED BY NAME for the whole node (carrying the other variants would mint 'none' here, an absence the canvas contradicts); the captured handles/stops stay in the dump for a later carriage, review`);return}o.push({variant:r.variant,value:e.css})}a.length>0&&t.notes.push(`${n}: gradient stop(s) ride bound variable(s) ${a.map(e=>`"${e}"`).join(`, `)} â a token ref has no spelling inside a gradient value, so the ramp carries their RESOLVED colors (rename story: the variable names live here, review)`),t.notes.push(`${n}: GRADIENT_LINEAR fill (dump v1.16) carried as background-image â axis-aligned ramp normalized to the box's visible segment (pixel-exact inside the drawn box; stops respell against the box edges), 'none' minted where a variant draws no gradient (its ground rides background-color)`),$(t,r,n,`background-image`,`gradient`,o,`${n}|gradient`,`none`)}function Ep(e,t,n,r,i,a,o){let s={},c=new Set;for(let t of e.occ)for(let e of Object.keys(t.node.bound??{}))c.add(e);let l=t=>c.has(t)?vp(e,t,n,r):void 0,u=(e,t)=>yp(s,i,e,t,n,r),d=Cp(e,n,r),f=`${d}-color`,p=`${d}-width`;d===`outline`&&o&&(o[`outline-style`]=`solid`),u(`background-color`,Sp(e,e=>e.type===`TEXT`?void 0:e.fill,n,r,`fill`,{cssProperty:`background-color`,target:s,absentAs:e=>typeof e.imageFill==`string`?`#00000000`:void 0,sparse:`#00000000`})),Tp(e,n,r,s),u(f,Sp(e,e=>e.stroke,n,r,`stroke`,{cssProperty:f,target:s,absentAs:`#00000000`}));let m=(e,t)=>e!==void 0&&ep(e)===ep(t)?e:void 0;for(let{shorthand:e,label:t,sides:i}of[{shorthand:`padding-inline`,label:`left/right`,sides:[[`padding-left`,`paddingLeft`],[`padding-right`,`paddingRight`]]},{shorthand:`padding-block`,label:`top/bottom`,sides:[[`padding-top`,`paddingTop`],[`padding-bottom`,`paddingBottom`]]}]){let a=i.map(([,e])=>l(e)),o=m(a[0],a[1]);if(o){u(e,o);continue}i.some(([,e])=>c.has(e))&&(i.forEach(([e],t)=>u(e,a[t])),n.notes.push(`${r}: ${t} padding bindings differ â ${e} is not representable; carried as separate ${i.map(([e])=>e).join(`/`)} channels`))}let h=[`topLeftRadius`,`topRightRadius`,`bottomLeftRadius`,`bottomRightRadius`];if(h.some(e=>c.has(e))){let e=h.map(e=>l(e));e[0]!==void 0&&e.every(t=>ep(t)===ep(e[0]))?u(`border-radius`,e[0]):n.notes.push(`${r}: corner radii bindings are not uniform â border-radius not representable, review`)}let g=[`strokeTopWeight`,`strokeRightWeight`,`strokeBottomWeight`,`strokeLeftWeight`];if(g.some(e=>c.has(e))||c.has(`strokeWeight`)){let e=c.has(`strokeWeight`)?l(`strokeWeight`):(()=>{let e=g.map(e=>l(e));return e[0]!==void 0&&e.every(t=>ep(t)===ep(e[0]))?e[0]:void 0})();e?u(p,e):n.notes.push(`${r}: stroke weight bindings are not uniform â ${p} not representable, review`)}u(`gap`,l(`itemSpacing`)),t&&l(`width`)!==void 0&&n.notes.push(`${r}: root width binding ${l(`width`)} carries as **max-width**, not width â a component's outer size is fluid-up-to in code and the canvas draws the max. Same token, translated channel; nothing dropped`),u(t?`max-width`:`width`,l(`width`)),u(`height`,l(`height`)),u(`min-width`,l(`minWidth`)),u(`min-height`,l(`minHeight`)),s[`max-width`]===void 0?u(`max-width`,l(`maxWidth`)):c.has(`maxWidth`)&&n.notes.push(`${r}: bound maxWidth collides with the root widthâmax-width convention â binding NAMED, not proposed (review)`),u(`max-height`,l(`maxHeight`)),u(`opacity`,l(`opacity`));let _=new Set([`paddingLeft`,`paddingRight`,`paddingTop`,`paddingBottom`,`topLeftRadius`,`topRightRadius`,`bottomLeftRadius`,`bottomRightRadius`,`strokeTopWeight`,`strokeRightWeight`,`strokeBottomWeight`,`strokeLeftWeight`,`strokeWeight`,`itemSpacing`,`width`,`height`,`opacity`,`minWidth`,`minHeight`,`maxWidth`,`maxHeight`]);for(let e of c)_.has(e)||n.notes.push(`${r}
2785: bound variable on "${e}" has no contract vocabulary â binding NAMED, not proposed (review)`);let v=e.occ[0].node,y=(t,n)=>e.occ.find(e=>{let r=t(e.node);return r!==void 0&&r!==n})?.node??v;if(!c.has(`itemSpacing`)&&e.occ.some(e=>(e.node.children?.length??0)>1)&&e.occ.some(e=>(e.node.layout?.spacing??0)!==0)){let t=e.occ.map(e=>e.node.layout?.spacing??0),i=t.filter(e=>e<0).length;dp(n,r,`itemSpacing`,y(e=>e.layout?.spacing,0).layout.spacing??0),i>0&&i<t.length?(n.mint?.partialSources.add(`${r}|itemSpacing`),n.notes.push(`${r}: itemSpacing is NEGATIVE in ${i}/${t.length} variant(s) (${[...new Set(t)].join(`/`)}) â children overlap only there, but layout.overlap is a per-part invariant with no per-variant form (P21); gap NOT minted (a mixed-sign spacing cannot carry, and a plain negative-px gap token is an invalid CSS fact), NAMED for review`)):$(n,s,r,`gap`,`px`,gp(e,e=>e.layout?.spacing),`${r}|itemSpacing`)}!c.has(`paddingLeft`)&&!c.has(`paddingTop`)&&e.occ.some(e=>(e.node.layout?.padding??[0,0,0,0]).some(e=>e!==0))&&(dp(n,r,`padding`,e.occ.find(e=>(e.node.layout?.padding??[0,0,0,0]).some(e=>e!==0)).node.layout.padding.join(` `)),Bp(n,s,e,r,a)),!h.some(e=>c.has(e))&&e.occ.some(e=>e.node.cornerRadius!==void 0)&&(dp(n,r,`cornerRadius`,y(e=>e.cornerRadius,void 0).cornerRadius??0),$(n,s,r,`border-radius`,`px`,gp(e,e=>e.cornerRadius),`${r}|cornerRadius`)),!g.some(e=>c.has(e))&&!c.has(`strokeWeight`)&&e.occ.some(e=>e.node.strokeWeight!==void 0&&e.node.stroke!==void 0)&&(dp(n,r,`strokeWeight`,e.occ.find(e=>e.node.strokeWeight!==void 0&&e.node.stroke!==void 0).node.strokeWeight),$(n,s,r,p,`px`,gp(e,e=>e.strokeWeight),`${r}|strokeWeight`));for(let[t,i]of[[`minWidth`,`min-width`],[`minHeight`,`min-height`],[`maxWidth`,`max-width`],[`maxHeight`,`max-height`]]){if(c.has(t))continue;let a=e=>e[t],o=e.occ.filter(e=>typeof a(e.node)==`number`);if(o.length!==0){if(s[i]!==void 0){n.notes.push(`${r}: literal ${t} also present where "${i}" already carries a binding â literal NAMED, not minted (review)`);continue}if(dp(n,r,t,a(o[0].node)),o.length!==e.occ.length){n.mint?.partialSources.add(`${r}|${t}`),n.notes.push(`${r}: literal ${t} present in ${o.length}/${e.occ.length} variants â inconsistent, NAMED, not minted; review`);continue}$(n,s,r,i,`px`,e.occ.map(e=>({variant:e.variant,value:a(e.node)})),`${r}|${t}`)}}return s}function Dp(e,t,n,r,i){if(e.occ.some(e=>e.node.bound?.opacity))return;let a=e.occ.map(e=>({variant:e.variant,value:e.node.opacity??1}));if(a.every(e=>e.value===1))return;let o=[...new Set(a.map(e=>e.value))];if(o.length>1)for(let e of r.axes){if(!Bf(e.values))continue;let n=t=>new Set(a.filter(n=>(Rf(n.variant)[e.property]??``).trim().toLowerCase()===t).map(e=>e.value)),o=n(`true`),s=n(`false`);if(s.size===1&&s.has(1)&&o.size===1&&!o.has(1)){let n=[...o][0],a=t.stylesWhen??[];a.push({prop:e.propName,styles:{opacity:String(n)}}),t.stylesWhen=a,r.notes.push(`${i}: node opacity ${n} rides boolean axis "${e.property}" (opaque when false) â proposed as stylesWhen { prop: ${e.propName}, styles: { opacity } } (dump v1.2)`);return}if(o.size===1&&o.has(1)&&s.size===1&&!s.has(1)){r.notes.push(`${i}: node opacity ${[...s][0]} rides the FALSE side of boolean axis "${e.property}" â stylesWhen cannot express negation; not proposed, review`);return}}dp(r,i,`opacity`,a[0].value),$(r,n,i,`opacity`,`number`,a,`${i}|opacity`),!r.mint&&o.length>1&&r.notes.push(`${i}: node opacity differs across variants (${o.join(`, `)}) without a boolean-axis correlation â not representable without minting; review`)}var Op=e=>{let t=e=>`${Math.round(e*100)/100}px`,n=e.spread!==void 0&&e.spread!==0?` ${t(e.spread)}`:``;return`${t(e.offset?.x??0)} ${t(e.offset?.y??0)} ${t(e.radius??0)}${n} ${xp(e.color??{hex:`000000`})}`};function kp(e,t,n,r){if(e.occ.every(e=>(e.node.effects?.length??0)===0))return;let i=[...new Set(e.occ.flatMap(e=>(e.node.effects??[]).map(e=>e.type)))];if(!e.occ.every(e=>{let t=e.node.effects??[];return t.length>=1&&t.every(e=>e.type===`DROP_SHADOW`)})){n.notes.push(`${r}: visible effect(s) [${i.join(`, `)}] â only DROP_SHADOW layers present in every variant map to box-shadow (dump v1.2; a multi-layer stack carries comma-separated); channel NAMED, not proposed`);return}let a=e.occ.map(e=>({variant:e.variant,value:e.node.effects.map(Op).join(`, `)})),o=Math.max(...e.occ.map(e=>(e.node.effects??[]).length));dp(n,r,`effects`,a[0].value),$(n,t,r,`box-shadow`,`shadow`,a,`${r}|effects`),n.notes.push(`${r}: ${o>1?`a DROP_SHADOW stack (up to ${o}
2785 layers) proposed as a comma-separated box-shadow value`:`DROP_SHADOW proposed as a box-shadow value`} (dump v1.2) â CSS surfaces render it; the canvas preview and the Figma sync script project it as a native DROP_SHADOW effect (dump v1.3)`)}function Ap(e,t,n,r){if(t.visibleWhen===void 0&&!e.occ.every(e=>e.node.hidden!==!0)){if(e.occ.every(e=>e.node.hidden===!0)){n.notes.push(`${r}: hidden in every variant â drawn as a design-time helper; proposed anyway, review`);return}for(let i of n.axes)if(Bf(i.values)){if(e.occ.every(e=>{let t=(Rf(e.variant)[i.property]??``).trim().toLowerCase();return e.node.hidden===!0==(t===`false`)})){t.visibleWhen={prop:i.propName},n.notes.push(`${r}: hidden exactly where "${i.property}" is false â proposed as visibleWhen { prop: ${i.propName} } (dump v1.1 hidden channel)`);return}}else{let a=new Set(e.occ.filter(e=>e.node.hidden!==!0).map(e=>Rf(e.variant)[i.property])),o=new Set(e.occ.filter(e=>e.node.hidden===!0).map(e=>Rf(e.variant)[i.property])),s=a.size===1?[...a][0]:void 0;if(s!==void 0&&!o.has(s)){t.visibleWhen={prop:i.propName,equals:Q(s)},n.notes.push(`${r}: visible only where "${i.property}" = "${s}" â proposed as visibleWhen { prop: ${i.propName}, equals: ${Q(s)} }`);return}}n.notes.push(`${r}: hidden in ${e.occ.filter(e=>e.node.hidden===!0).length}/${e.occ.length} variants without correlating to any axis â kept unconditional, review`)}}function jp(e){if(e.x===void 0||e.y===void 0)return null;let t={position:`absolute`},n=[],r,i=e=>`${Math.round(e*100)/100}px`,a=e.constraints?.horizontal??`LEFT`;if(a===`RIGHT`&&e.right!==void 0)t.right=i(e.right);else if(a===`CENTER`&&e.right!==void 0){t.left=`50%`,n.push(`translateX(-50%)`);let i=Math.round(Math.abs(e.x-e.right)*50)/100;i>.01&&(r=Math.max(r??0,i))}else t.left=i(e.x);let o=e.constraints?.vertical??`TOP`;if(o===`BOTTOM`&&e.bottom!==void 0)t.bottom=i(e.bottom);else if(o===`CENTER`&&e.bottom!==void 0){t.top=`50%`,n.push(`translateY(-50%)`);let i=Math.round(Math.abs(e.y-e.bottom)*50)/100;i>.01&&(r=Math.max(r??0,i))}else t.top=i(e.y);return{styles:t,translate:n,centerResidue:r}}function Mp(e,t,n,r){let i=e.occ.filter(e=>e.node.shape!==void 0);if(i.length===0)return;if(i.length!==e.occ.length){n.notes.push(`${r}: shape geometry captured in ${i.length}/${e.occ.length} variants (the rest are arbitrary-path nodes) â the CAPTURED variants' shape is carried; the uncaptured variants render the same shape (declared approximation, review)`),Mp({...e,occ:i},t,n,r);return}let a=e.occ.map(e=>({variant:e.variant,hidden:e.node.hidden===!0,sh:e.node.shape})),o=[...new Set(a.map(e=>e.sh.kind))];if(o.length>1){n.notes.push(`${r}: shape kind differs across variants (${o.join(`, `)}) â shape not carried; review`);return}let s=a[0].sh,c=Math.PI*2,l=e=>e.kind===`ellipse`&&e.arc!==void 0&&e.arc.end-e.arc.start>0&&e.arc.end-e.arc.start<c-.01?e.arc:void 0,u=a.some(e=>e.sh.arc!==void 0),d=a.map(e=>l(e.sh)),f=d.some(e=>e!==void 0),p=f&&new Set(d.map(e=>e?`${e.start}|${e.end}`:`none`)).size>1;u&&(a.some(e=>e.sh.arc!==void 0&&l(e.sh)===void 0&&e.sh.arc.end-e.sh.arc.start>=c-.01)&&n.notes.push(`${r}: ellipse arc with a FULL sweep (⥠2Ï â dump v1.7 \`shape.arc\`) â redundant with the plain ellipse, dropped`),a.some(e=>e.sh.kind!==`ellipse`&&e.sh.arc!==void 0)&&n.notes.push(`${r}: arc captured on a non-ellipse shape â outside the arc grammar, NOT carried; review`),a.some(e=>e.sh.arc!==void 0&&e.sh.arc.end-e.sh.arc.start<=0)&&n.notes.push(`${r}: arc with a non-positive sweep (end ⤠start) â outside the arc grammar, NOT carried; review`),a.some(e=>l(e.sh)!==void 0&&l(e.sh).innerRadius!==1)&&n.notes.push(`${r}: arc innerRadius < 1 (a filled donut hole) â the hole fraction is NOT carried (code renders the sweep mask only; the observed ring class is border-drawn); review`),f&&n.notes.push(`${r}: arc ends render square (CSS hard color stops) â stroke cap style is not on the dump surface; a canvas ROUND cap is a named residue`));let m={kind:s.kind,width:s.width,height:s.height};if(f&&!p&&d.every(e=>e!==void 0)){let e=d[0];m.arc={start:e.start,end:e.end,innerRadius:e.innerRadius},n.notes.push(`${r}: constant ellipse arc sweep carried as shape.arc ({${e.start}, ${e.end}} rad â dump v1.7) â code surfaces render a conic-gradient mask; the Figma generator sets native arcData`)}let h=[...new Set(a.map(e=>`${e.sh.width}Ã${e.sh.height}`))];if(h.length>1&&n.notes.push(`${r}: shape size differs across variants (${h.join(`, `)}) â the first variant's ${h[0]} carried; review`),s.kind===`polygon`){let e=[...new Set(a.map(e=>e.sh.sides).filter(e=>e!==void 0))];e.length>=1?(m.sides=e[0],e.length>1&&n.notes.push(`${r}: polygon side count differs across variants (${e.join(`, `)}) â ${e[0]} carried; review`)):(m.sides=3,n.notes.push(`${r}: polygon point count is not on the REST surface â sides: 3 (the Figma default, a triangle) ASSUMED; verify against the canvas`))}let g=a.map(e=>e.sh.rotation??0),_=[...new Set(g)],v=_.length>1;!v&&_[0]!==0&&(m.rotation=_[0]),t.shape=m;let y=e=>{let t=l(e.sh);return t?il(t.start,t.end):null},b=e=>{let t=jp(e.sh);return JSON.stringify({p:t?.styles??null,t:t?.translate??[],r:v?e.sh.rotation??0:0,a:p?y(e):null})};if(!a.some(e=>jp(e.sh)!==null)&&!v&&!p)return;let x=e=>{let t=jp(e.sh),i=[...t?.translate??[]];v&&(e.sh.rotation??0)!==0&&i.push(`rotate(${e.sh.rotation}deg)`);let a={...t?.styles??{}};if(p){let t=y(e);t&&(a.mask=t)}return i.length>0&&(a.transform=i.join(` `)),t?.centerResidue!==void 0&&n.notes.push(`${r}: CENTER-constrained placement carried as 50% + translate â the drawn offset differs from the exact center by ${t.centerResidue}px (canvas pixel snap); review`),Object.keys(a).length>0?a:null};for(let e of n.axes){if(Bf(e.values))continue;let i=new Map,s=!0;for(let t of a){let n=Rf(t.variant)[e.property];if(n===void 0){s=!1;break}let r=i.get(n);if(r&&b(r)!==b(t)){s=!1;break}r||i.set(n,t)}if(!s||!e.values.every(e=>i.has(e)))continue;let c=t.stylesWhen??[],l=0,u=0;for(let t of e.values){if(a.filter(n=>Rf(n.variant)[e.property]===t).every(e=>e.hidden)){c.push({prop:e.propName,equals:Q(t),styles:{display:`none`}}),u++;continue}let n=x(i.get(t));n&&(c.push({prop:e.propName,equals:Q(t),styles:n}),l++)}l+u>0&&(t.stylesWhen=c),n.notes.push(`${r}: ${o[0]} decor carried as a shape part (${String(m.width)}Ã${String(m.height)}${m.sides===void 0?``:`, ${String(m.sides)} sides`}) with per-variant absolute placement${v?` + rotation`:``}${p?` + arc sweep (conic-gradient mask)`:``} as stylesWhen on \`${e.propName}\` (${l} placement(s)${u>0?`; ${u} value(s) where the shape is hidden in every drawn variant carry display: none`:``}; offsets EXACT from the captured boxes â dump v1.3, #42)`);return}if([...new Set(a.map(b))].length===1){let e=x(a[0]),i=t.visibleWhen;if(e&&i&&i.equals===void 0){let a=t.stylesWhen??[];a.push({prop:i.prop,styles:e}),t.stylesWhen=a,n.notes.push(`${r}: uniform absolute placement carried as stylesWhen on the part's own visibility boolean \`${i.prop}\` (the part only renders when it holds) â dump v1.3, #42`)}else if(e)if(Object.entries(e).every(([e,t])=>e===`position`||[`left`,`right`,`top`,`bottom`].includes(e)&&/^-?\d+(\.\d+)?px$/.test(t))){let i=t.declared??{};i.position===void 0&&(i.position=`absolute`),t.declared=i;let a=t.literals??{};for(let[t,n]of Object.entries(e))t!==`position`&&a[t]===void 0&&(a[t]=n);t.literals=a,n.notes.push(`${r}: uniform unconditional absolute placement carried as position: absolute + literal offsets (${Object.entries(e).filter(([e])=>e!==`position`).map(([e,t])=>`${e}: ${t}`).join(`, `)}
2785) â the overlay-flattened spelling (round 2 iteration 2)`)}else n.notes.push(`${r}: absolute placement is uniform across variants but rides spellings outside the literal grammar (50% + translate / rotation) â placement NAMED, not proposed (${JSON.stringify(e)}); review`);return}n.notes.push(`${r}: shape placement/rotation${p?`/arc`:``} differs across variants without correlating to any enum axis â NAMED, not proposed; review`)}var Np=e=>e.occ.every(e=>e.node.shape!==void 0&&e.node.shape.kind===`rect`&&(e.node.shape.rotation===void 0||e.node.shape.rotation===0));function Pp(e,t,n,r,i){let a=e.occ.map(e=>({variant:e.variant,sh:e.node.shape})),o=[...new Set(a.map(e=>`${e.sh.width}Ã${e.sh.height}`))];if(!r.mint)r.notes.push(`${i}: plain-rect geometry captured (${o.join(`, `)}px â dump v1.7) but minting is off â width/height not proposed; bind the drawn size manually`);else{for(let a of[`width`,`height`])n[a]!==void 0||e.occ.some(e=>e.node.bound?.[a])||($(r,n,i,a,`px`,e.occ.map(e=>({variant:e.variant,value:
2785Math.round(e.node.shape[a]*100)/100})),void 0,e.occ.length<r.totalVariants.length?`0`:void 0),r.mint.absFallbacks.push({part:t,tokens:n,chan:a,value:Math.round(e.occ[0].node.shape[a]*100)/100,where:i}));r.notes.push(`${i}: plain-rect geometry (dump v1.7) carried as width/height mint observations (${o.join(`; `)}px) â an in-flow fixed-size box; fill/radius ride the existing channels`)}}function Fp(e,t,n,r,i){if(e.occ.filter(e=>e.node.fixedSize!==void 0).length===0)return;let a=e.occ.length<r.totalVariants.length?`0`:void 0,o=[];for(let s of[`width`,`height`]){let c=e.occ.map(e=>e.node.fixedSize?.[s]);if(!c.every(e=>e===void 0)&&!(n[s]!==void 0||e.occ.some(e=>e.node.bound?.[s]))){if(c.some(e=>e===void 0)){r.notes.push(`${i}: fixed in-flow ${s} captured in ${c.filter(e=>e!==void 0).length}/${e.occ.length} variant occurrence(s) only (mixed sizing modes across variants) â not carried; review`);continue}if(!r.mint){r.notes.push(`${i}: fixed in-flow ${s} captured (dump v1.8 \`fixedSize\`) but minting is off â not proposed; bind the drawn size manually`);continue}$(r,n,i,s,`px`,e.occ.map(e=>({variant:e.variant,value:e.node.fixedSize[s]})),`${i}|fixed-${s}`,a),r.mint.absFallbacks.push({part:t,tokens:n,chan:s,value:e.occ[0].node.fixedSize[s],where:i}),o.push(s)}}o.length>0&&r.notes.push(`${i}: fixed-size in-flow box (dump v1.8 \`fixedSize\`) carried as ${o.join(`/`)} mint observation(s) â the drawn box of a non-auto-layout child inside auto-layout, which no other channel carries; per-variant values classify through the standard mint machinery`)}var Ip=e=>{if(e.abs)return e.abs;let t=e.shape;if(t&&t.x!==void 0&&t.y!==void 0&&t.right!==void 0&&t.bottom!==void 0)return{x:t.x,y:t.y,right:t.right,bottom:t.bottom,width:t.width,height:t.height,constraints:t.constraints}};function Lp(e,t,n,r,i,a={}){let o=e.occ.map(e=>({variant:e.variant,box:Ip(e.node)}));if(o.every(e=>e.box===void 0))return!1;let s=e=>(r.notes.push(`${i}: absolute placement captured (dump v1.7 \`abs\`) but NOT carried â ${e}; the part renders in flow (ledgered by name)`),!1),c=o.filter(e=>e.box!==void 0);if(c.length!==o.length)return s(`captured on ${c.length}/${o.length} variant(s) only (a per-variant in-flow/absolute identity mix has no single spelling)`);if(e.occ.some(e=>e.node.__synthetic===!0))return s(`the box rides a wrapper-union SYNTHETIC clone (a clone is not an observation) â the wrapper stays a pass-through in-flow box`);if(!r.mint)return s(`minting is off â the per-variant px offsets have no carrier`);let l=new Set([`GROUP`]),u=e.occ.filter(e=>Ip(e.node)?.constraints===void 0&&!l.has(e.node.type??``)).length;u>0&&r.notes.push(`${i}: ${u} of ${o.length} occurrence(s) carry NO constraints field, so the placement is read as LEFTÃTOP â an ASSUMPTION, not an observation. A pre-v1.13 dump also omitted the field for STRETCH/SCALE nodes (only MIN/MAX/CENTER had a spelling), so a box drawn pinned to all four edges is indistinguishable here from one pinned top-left; re-capture with dump v1.13+ to tell them apart`);let d=[...new Set(o.map(e=>e.box.constraints?.horizontal??`LEFT`))],f=[...new Set(o.map(e=>e.box.constraints?.vertical??`TOP`))];if(d.length>1||f.length>1)return s(`constraints differ across variants (${d.join(`|`)} Ã ${f.join(`|`)})`);let p=t=>n[t]!==void 0||e.occ.some(e=>e.node.bound?.[t]),m=d[0]===`STRETCH`,h=f[0]===`STRETCH`,g=m&&!p(`width`),_=h&&!p(`height`);if((m&&!g||h&&!_)&&r.notes.push(`${i}: constraint ${d[0]}Ã${f[0]} STRETCHes an axis whose size is ALREADY BOUND (${[m&&!g?`width`:null,h&&!_?`height`:null].filter(Boolean).join(`, `)}) â the two contradict (a stretch sizes from the parent, a bound size does not), so the design's own binding is kept and the stretch is NOT carried on that axis; the part pins ONE edge and holds its bound size`),d[0]===`SCALE`||f[0]===`SCALE`)return s(`constraint ${d[0]}Ã${f[0]} has no carried offset spelling â SCALE resizes the box PROPORTIONALLY with its parent and CSS has no equivalent on a positioned element (STRETCH is carried as both edges; SCALE is not)`);if(![`LEFT`,`RIGHT`,`CENTER`,`STRETCH`].includes(d[0])||![`TOP`,`BOTTOM`,`CENTER`,`STRETCH`].includes(f[0]))return s(`constraint ${d[0]}Ã${f[0]} has no carried offset spelling`);let v=e=>Math.round(e*100)/100,y=e.occ.length<r.totalVariants.length?`0`:void 0,b=[],x=(e,a)=>{$(r,n,i,e,`px`,o.map(e=>({variant:e.variant,value:v(a(e.box))})),`${i}|abs-${e}`,y),r.mint.absFallbacks.push({part:t,tokens:n,chan:e,value:v(a(o[0].box)),where:i}
2785),b.push(e)},S=t.declared??{},C=a.text===!0&&o.every(e=>Math.abs(e.box.x-e.box.right)<=1);if(C||g?(x(`left`,e=>e.x),x(`right`,e=>e.right),C&&S[`text-align`]===void 0&&(S[`text-align`]=`center`)):d[0]===`RIGHT`?x(`right`,e=>e.right):x(`left`,e=>e.x),_?(x(`top`,e=>e.y),x(`bottom`,e=>e.bottom)):f[0]===`BOTTOM`?x(`bottom`,e=>e.bottom):x(`top`,e=>e.y),a.size===!0&&a.text!==!0)for(let t of[`width`,`height`])t===`width`&&g||t===`height`&&_||n[t]!==void 0||e.occ.some(e=>e.node.bound?.[t])||x(t,e=>e[t]);(g||_)&&r.notes.push(`${i}: constraint ${d[0]}Ã${f[0]} â the ${[g?`HORIZONTAL`:null,_?`VERTICAL`:null].filter(Boolean).join(` and `)} axis is STRETCH, carried as BOTH edges with NO size on that axis (CSS left+right / top+bottom), so the box tracks its parent exactly as the canvas draws it; a baked width/height would have frozen it at the drawn size`),S.position===void 0&&(S.position=`absolute`),t.declared=S;let w=d[0]===`CENTER`||f[0]===`CENTER`;return r.notes.push(`${i}: absolute placement carried (dump v1.7 \`abs\`) â position: absolute with minted px channels [${b.join(`, `)}]${C?` + text-align: center (horizontally symmetric text box â the center-preserving spelling)`:``}${w&&!C?` (CENTER constraint carried as the exact drawn offset â center-tracking under parent resize is not carried, a declared limit)`:``}; per-variant values classify through the standard mint machinery`),r.notes.push(`${i}: the CSS that PRODUCED this box is not recoverable from it â a child's \`margin-*\` (which the emitter lowers into a "(margin box)" wrapper) and a bound inset quartet (\`left\`/\`right\`/\`top\`/\`bottom\`) both draw as the same absolute rectangle. Those channels are NAMED here and NOT carried; the offsets above are the drawn geometry, not the authored spacing (Option B â geometry is not read back, \`FC-GEOMETRY-EXCLUDED\`); review`),!0}function Rp(e,t,n,r,i){if(!t.component&&!t.slot||e.occ.every(e=>Ip(e.node)===void 0))return t;if(t.slot)return n.notes.push(`${r}: absolute placement captured (dump v1.7 \`abs\`) on a SLOT part â slot parts refuse styling (the consumer owns the content box) and a positioned slot wrapper is not carried this round; ledgered by name, the slot renders in flow`),t;let a={},o={};return Lp(e,a,o,n,r,{size:!0})?(km(n,a,o),t.visibleWhen!==void 0&&(a.visibleWhen=t.visibleWhen,delete t.visibleWhen),a.parts={[Om(`instance`,n,r,i)]:t},n.notes.push(`${r}: the positioned part is a component ref â placement rides a structural wrapper part (the child contract owns its own styling; the ref renders inside unchanged, visibility hoisted onto the wrapper)`),a):t}function zp(e,t,n){if(!Object.values(t).some(e=>e.declared?.position===`absolute`)||n&&n.occ.some(e=>e.node.__synthetic===!0))return;let r=e.declared??{};r.position===void 0&&(r.position=`relative`),e.declared=r}function Bp(e,t,n,r,i){if(!e.mint)return;let a=`${r}|padding`,o=(n,a)=>{i&&a!==0&&e.mint.absFallbacks.push({part:i,tokens:t,chan:n,value:a,where:r})};for(let{cssProperty:i,a:s,b:c,label:l,sides:u}of[{cssProperty:`padding-inline`,a:3,b:1,label:`left/right`,sides:[[`padding-left`,3],[`padding-right`,1]]},{cssProperty:`padding-block`,a:0,b:2,label:`top/bottom`,sides:[[`padding-top`,0],[`padding-bottom`,2]]}]){let d=e=>e.layout?.padding??[0,0,0,0];if(!n.occ.every(e=>d(e.node)[s]===d(e.node)[c])){let o=[];for(let[i,s]of u)n.occ.every(e=>d(e.node)[s]===0)||($(e,t,r,i,`px`,gp(n,e=>d(e)[s]),a),o.push(i));e.notes.push(`${r}: ${l} padding literals differ â ${i} is not representable; carried as per-side ${o.join(`/`)} instead (asymmetric padding)`);continue}n.occ.every(e=>d(e.node)[s]===0)||($(e,t,r,i,`px`,gp(n,e=>d(e)[s]),a),o(i,d(n.occ[0].node)[s]))}}var Vp={thin:100,extralight:200,ultralight:200,light:300,regular:400,normal:400,medium:500,semibold:600,demibold:600,bold:700,extrabold:800,ultrabold:800,black:900,heavy:900};function Hp(e){let t=e.toLowerCase().replace(/[\s_-]+/g,``),n=!1;return t.endsWith(`italic`)&&(n=!0,t=t.slice(0,-6)),t===``?{weight:n?400:void 0,italic:n}:{weight:Vp[t],italic:n}}function Up(e){return e.occ.filter(e=>e.node.text!==void 0).map(e=>
2785e.node.text.fontWeightVar)}function Wp(e,t){let{weight:n}=Hp(t);if(n===void 0)return;let r=e.corpus.suggestFor(n).filter(e=>e.split(`.`).includes(`weight`));return r.length===1?`{${r[0]}}`:void 0}function Gp(e,t,n,r,i,a,o,s){let c=e.occ.filter(e=>e.node.text!==void 0);if(c.length===0)return;let l=e=>{if(!s)return{};let t=s.find(t=>t.variant===e),n=t?.node.text?.style,r=t?.node.text?.styleKey;return{...n===void 0?{}:{styleName:n},...r===void 0?{}:{styleKey:r}}},u=[...new Set(c.map(e=>e.node.text.fontWeightVar))];u.length===1&&u[0]!==void 0&&(t[`font-weight`]=Af(u[0]));let d=t[`font-weight`]!==void 0;if(i.weight&&!d){let e=c.map(e=>({variant:e.variant,fontStyle:e.node.text.fontStyle??`Medium`,...Hp(e.node.text.fontStyle??`Medium`)})),i=[...new Set(e.filter(e=>e.weight===void 0).map(e=>e.fontStyle))];i.length>0?n.notes.push(`${r}: font style name(s) ${i.map(e=>`"${e}"`).join(`, `)} are outside the weight-name table (Thinâ¦Black) â font-weight NAMED, not proposed; review`):(dp(n,r,`fontWeight`,e[0].weight),$(n,t,r,`font-weight`,`number`,e.map(e=>({variant:e.variant,value:e.weight,...l(e.variant)})),`${r}|fontWeight`,void 0,a,o));let s=e.filter(e=>e.italic);s.length>0&&n.notes.push(`${r}: italic font style ("${s[0].fontStyle}") â font-style has no contract vocabulary; italic NAMED, not carried (review)`)}let f=[...new Set(c.map(e=>e.node.text.lineHeightVar))];if(f.length===1&&f[0]!==void 0){t[`line-height`]=Af(f[0]);return}let p=c.filter(e=>typeof e.node.text.lineHeight==`number`);if(p.length!==0){if(p.length!==c.length){n.notes.push(`${r}: line-height captured in ${p.length}/${c.length} variants (absent means AUTO or an older dump) â inconsistent, NAMED, not proposed; review`);return}dp(n,r,`lineHeight`,p[0].node.text.lineHeight),$(n,t,r,`line-height`,`px`,p.map(e=>({variant:e.variant,value:e.node.text.lineHeight,...l(e.variant)})),`${r}|lineHeight`,void 0,a,o)}}var Kp={UPPER:`uppercase`,LOWER:`lowercase`,TITLE:`capitalize`};function qp(e,t,n,r){let i=e.occ.filter(e=>e.node.text!==void 0);if(i.length===0)return;let a=[...new Set(i.map(e=>e.node.text.textCase))],o=a.filter(e=>e!==void 0);if(o.length===0)return;if(a.length>1){n.notes.push(`${r}: textCase differs across variants (${a.map(e=>e??`ORIGINAL/not captured`).join(`, `)}) â text-transform is a declared literal with no per-variant vocabulary; NAMED, not proposed (review)`);return}let s=Kp[o[0]],c=t.declared??{};c[`text-transform`]===void 0&&(c[`text-transform`]=s),t.declared=c,n.notes.push(`${r}: textCase ${o[0]} drawn in every variant â carried as declared text-transform: ${s} (dump v1.16; a canvas-drawable channel, the return leg writes Figma textCase)`)}function Jp(e,t,n,r){let i={};yp(i,r,`color`,Sp(e,e=>e.text?.fillVar?{var:e.text.fillVar}:e.fill,t,n,`text fill`,{cssProperty:`color`,target:i}),t,n);let a=up(e.occ,e=>e.text);if(!a)return i;let o=e.occ.filter(e=>e.node.text!==void 0),s=[...new Set(o.map(e=>e.node.text.fontSize))],c=[...new Set(o.map(e=>e.node.text.fontStyle??`Medium`))];if(s.length>1||c.length>1){let r=[...new Set(o.map(e=>e.node.text.style).filter(e=>e!==void 0))],l=[...new Set(o.map(e=>e.node.text.styleKey).filter(e=>e!==void 0))],u=r.length===1?r[0]:void 0,d=u&&l.length===1?l[0]:void 0,f=u===void 0&&r.length>1;return f?t.notes.push(`${n}: typography varies across variants (fontSize ${s.join(`/`)}, weight ${c.join(`/`)}) with distinct text styles (${r.join(`, `)}) â font-size ${t.mint?`minted per variant with per-leaf text-style identity (exact Figma style name/key)`:`not proposed without minting`}${c.length>1?`; font-weight minted per variant through the weight-name table where every name maps (unknown names stay NAMED)`:``}`):t.notes.push(`${n}: typography varies across variants (fontSize ${s.join(`/`)}, weight ${c.join(`/`)}) â ${u?`shared text style "${u}" kept as identity; `:``}font-size ${t.mint?`minted per variant where axis-correlated`:`not proposed without minting`}${c.length>1?`; font-weight minted per variant through the weight-name table where every name maps (unknown names stay NAMED)`:``} (review)`),!t.mint&&r.length>0&&lp(t,`${n}: named text style(s) ${r.map(e=>JSON.stringify(e)).join(`, `)} observed but minting is off â exact style identity cannot be proposed`),dp(t,n,`fontSize`,a.fontSize),$(t,i,n,`font-size`,`px`,o.map(e=>({variant:e.variant,value:e.node.text.fontSize,...f&&e.node.text.style!==void 0?{styleName:e.node.text.style,...e.no
2785de.text.styleKey===void 0?{}:{styleKey:e.node.text.styleKey}}:{}})),`${n}|fontSize`,void 0,u,d),Gp(e,i,t,n,{weight:!0},u,d,f?o:void 0),i}let l=[...new Set(o.map(e=>e.node.text.fontSizeVar))],u=l.length===1?l[0]:void 0;if(u!==void 0){i[`font-size`]=Af(u);let r=a.fontStyle??`Medium`,o,s=[...new Set(Up(e))];return s.length===1&&s[0]!==void 0?(i[`font-weight`]=Af(s[0]),Gp(e,i,t,n,{weight:!1}),i):(s.length>1&&t.notes.push(`${n}: the weight token differs across variants (${s.map(e=>`"${e}"`).join(`, `)}) â one text node carries one font-weight binding, so it is NAMED, not proposed; review`),r!==`Medium`&&(o=Wp(t,r),o?i[`font-weight`]=o:t.notes.push(`${n}: font weight "${r}" is drawn on a node riding no text style and the corpus does not spell it with exactly one weight token â minted rather than bound to a guess (review)`)),Gp(e,i,t,n,{weight:r!==`Medium`&&o===void 0}),i)}let d=[...new Set(e.occ.map(e=>e.node.text?.style).filter(e=>e!==void 0))],f=[...new Set(e.occ.map(e=>e.node.text?.styleKey).filter(e=>e!==void 0))];d.length>1&&lp(t,`${n}: text style names differ across variants (${d.join(`, `)}) while fontSize/weight are uniform â cannot pick one identity`);let p=d.length===1?d[0]:void 0,m=p?t.corpus.textStyleByName.get(p):void 0,h=p&&!m?p:void 0,g=h&&f.length===1?f[0]:void 0;if(h&&t.notes.push(`${n}: rides text style "${h}" which is not a token-derived style (the kit binds no variable to its typography) â minted under the STYLE's own name as \`imported.text.${h.replace(/[^a-zA-Z0-9-]+/g,`-`).toLowerCase()}\`, shared by every part riding it; rename against your real type tokens (provisional)`),!m){let e=t.corpus.textStyles.filter(e=>e.fontSize===a.fontSize&&e.fontStyle===(a.fontStyle??`Medium`));e.length===1?m=e[0]:d.length===0&&t.notes.push(`${n}: typography (${a.fontSize}px ${a.fontStyle}) matches ${e.length} derived text styles â font tokens not proposed, review`)}return m?(i[`font-size`]=`{${m.tokenPath}}`,m.weightPath&&m.fontStyle!==`Medium`&&(i[`font-weight`]=`{${m.weightPath}}`),(a.fontStyle??`Medium`)!==m.fontStyle&&t.notes.push(`${n}: node weight "${a.fontStyle}" overrides style "${m.name}" â override not token-recoverable, review`)):t.mint&&a.fontSize>0?$(t,i,n,`font-size`,`px`,gp(e,e=>e.text?.fontSize),void 0,void 0,h,g):p&&lp(t,`${n}: named text style ${JSON.stringify(p)} observed but minting is off â exact style identity cannot be proposed`),Gp(e,i,t,n,{weight:!m},h,g),i}var Yp={MIN:void 0,CENTER:`center`,MAX:`end`,SPACE_BETWEEN:`space-between`},Xp={MIN:void 0,CENTER:`center`,MAX:`end`,BASELINE:`baseline`};function Zp(e){let t=e.occ[0].node.layout;if(!t||t.mode!==`VERTICAL`)return!1;let n=e.children.filter(e=>{let t=e.occ[0].node;return(t.type===`FRAME`||t.type===`TEXT`)&&!t.bound?.width});return n.length===0?!1:n.every(e=>e.occ.every(e=>e.node.fillWidth===!0))}function Qp(e,t){let n=new Map;for(let t of e.occ)n.set(t.variant,t.node.layout?.mode??null);let r=e.occ[0]?.node.layout?.mode??null,i=em(e,t);return{base:r,byVariant:n,...i?{grid:i}:{}}}var $p={MIN:`start`,CENTER:`center`,MAX:`end`};function em(e,t){let n=e.occ.map(e=>e.node.layout).find(e=>e!==void 0);if(!n||n.mode!==`GRID`)return;let r=n.grid;if(!r)return{carried:!1,flow:!1,reason:`layoutMode GRID captured WITHOUT grid facts (pre-v1.17 producer) â no layout block proposed; anatomy under it is order-only`};let i=r.flow===`row`,a=[...r.rows,...r.columns].find(e=>!(e.fit===!0||typeof e.px==`number`&&e.px>0||typeof e.fr==`number`&&e.fr>0));if(a)return{carried:!1,flow:i,reason:`captured track ${JSON.stringify(a)} is outside the carriable vocabulary ({px>0} | {fr>0} | {fit:true} â the grid-track-zero/grid-track-percent fence, P2b)`};if(r.columns.length===0||!i&&r.rows.length===0)return{carried:!1,flow:i,reason:`empty declared track list â a grid contract requires declared tracks (G1)`};if(i){let t=Math.max(1,Math.ceil(e.children.length/r.columns.length));return r.rows.length<t?{carried:!1,flow:i,reason:`ROW_AUTO_FLOW grid whose ${r.rows.length} declared row track(s) do not cover the flow â ${e.children.length} child(ren) over ${r.columns.length} column(s) occupy ${t} row(s), so children flow PAST the declared list while gridRowCount stays put (GP10; the grid-implicit-tracks refusal, P9)`}:{carried:!0,flow:i}}let o=new Set;for(let n of e.children){if(n.occ.some(e=>e.node.cell!==void 0))continue;let e=n.occ.filter(e=>e.node.abs!==void 0);if(e.length===0)return{carried:!1,flow:i,reason:`child "${n.name}" carries no grid cell and no \`abs\` â a pre-v1.17 capture (the producer predates the cell channel), which is NOT the same fact as "cell 0,0": a manual grid contract must place every in-flow child (G2), and inventing anchors for an unmeasured child is exactly what this refusal exists to prevent; grid not carried`};let r=e.length===n.occ.length?n.occ.some(e=>e.node.__synthetic===!0)?`its box rides a wrapper-union SYNTHETIC clone (a clone is not an observation)`:t?null:`minting is off, so the per-variant px offsets have no carrier`:`its \`abs\` box is captured on ${e.length}/${n.occ.length} variant(s) only`;if(r)return{carried:!1,flow:i,reason:`child "${n.name}" is an ABSOLUTE overlay inside the grid (dump \`abs\` present, no \`cell\` â P13's gate working as de
2785signed) and the out-of-flow door is shut: ${r}. It would therefore render IN FLOW, in a grid that must place every in-flow child (G2), so the grid is not carried. The edge spelling is not the blocker â that is refused permanently and separately (grid-overlay-edge-inversion, G9.1)`};o.add(n.name)}let s=e.children.filter(e=>!o.has(e.name)).map(e=>{let t=e.occ.find(e=>e.node.cell!==void 0).node.cell;return{name:e.name,r:t.row,c:t.column,rs:t.rowSpan??1,cs:t.columnSpan??1}});for(let e of s)if(e.r+e.rs>r.rows.length||e.c+e.cs>r.columns.length)return{carried:!1,flow:i,reason:`child "${e.name}" occupies beyond the declared tracks (anchor ${e.r},${e.c} span ${e.rs}Ã${e.cs} vs ${r.rows.length}Ã${r.columns.length} declared) â implicit tracks are refused BY NAME (grid-implicit-tracks, P9)`};for(let e=0;e<s.length;e++)for(let t=e+1;t<s.length;t++){let n=s[e],r=s[t];if(n.r<r.r+r.rs&&r.r<n.r+n.rs&&n.c<r.c+r.cs&&r.c<n.c+n.cs)return{carried:!1,flow:i,reason:`children "${n.name}" and "${r.name}" overlap on the grid â placements+spans may not occupy the same cell (P3's occupancy throw, refused contract-side)`}}return{carried:!0,flow:i}}function tm(e,t,n,r){let i=t??em(e,n.mint!==void 0);if(!i)return;if(new Set(e.occ.filter(e=>e.node.layout!==void 0).map(e=>JSON.stringify([e.node.layout.mode,e.node.layout.grid??null]))).size>1&&n.notes.push(`${r}: GRID layout differs across variants (mode or grid facts) â a grid part has no per-variant layout vocabulary (layoutByProp is refused on grid parts; P10: a mode switch destroys tracks), so the DEFAULT variant's grid is carried for every variant; review`),!i.carried){n.notes.push(`${r}: GRID drawn but NOT carried â ${i.reason}`);return}let a=e.occ.map(e=>e.node.layout).find(e=>e!==void 0).grid,o=e=>e.fit===!0?{fit:!0}:e.px===void 0?{fr:e.fr}:{px:e.px},s={display:`grid`},c=Math.max(1,Math.ceil(e.children.length/Math.max(1,a.columns.length))),l=a.rows.length===c&&a.rows.every(e=>e.fr===1);(!i.flow||!l)&&(s.rows=a.rows.map(o));for(let t of e.children)t.occ.some(e=>e.node.cell!==void 0)||t.occ.some(e=>e.node.abs!==void 0)&&n.notes.push(`${r}/${t.name}: ABSOLUTE child inside the grid carried OUT OF FLOW through the abs door (position: absolute + minted insets), NOT as Part.overlay â ${hc[`grid-overlay-edge-inversion`]}`);s.columns=a.columns.map(o);let u=e.occ[0].node.bound??{},d=u.gridRowGap?Af(u.gridRowGap):a.rowGap,f=u.gridColumnGap?Af(u.gridColumnGap):a.columnGap;return(d!==0||f!==0)&&(s.gap={row:d,column:f}),i.flow&&(s.flow=`row`),s}function nm(e,t,n,r){let i=t.layout;if(i?.display!==`grid`)return;let a=e.occ.map(e=>e.node.layout).find(e=>e!==void 0);if(!a)return;let o=t.tokens??{},s=t.literals??{},c=e=>Array.isArray(e)&&e.some(e=>typeof e==`object`&&!!e&&`fr`in e),l=[];for(let t of[`width`,`height`]){let u=i.flow===`row`&&i.rows===void 0;if((t===`width`?c(i.columns):u||c(i.rows))||s[t]!==void 0||o[t]!==void 0||t===`width`&&i.grow===!0)continue;let d=t===`width`?a.primarySizing:a.counterSizing;if(d===`AUTO`){s[t]=`fit-content`,n.notes.push(`${r}: grid ${t} axis drawn HUG â carried as literals.${t} "fit-content" (G8: the CSS twin of Figma HUG; absence would resolve as FIXED 100 on canvas and content-size in CSS â FC-GRID-ROOT-VSIZE)`);continue}let f=e.occ.map(e=>e.node.fixedSize?.[t]??e.node.bbox?.[t]??e.node.abs?.[t]).find(e=>typeof e==`number`);if(typeof f==`number`){s[t]=`${Math.round(f)}px`,n.notes.push(`${r}: grid ${t} axis drawn FIXED â carried as literals.${t} ${s[t]} (G8: a grid axis must be definite; the drawn box is the evidence)`);continue}l.push(`${t}: drawn ${String(d??`UNKNOWN`)} with no captured box (fixedSize/bbox/abs all absent)`)}if(l.length>0){n.notes.push(`${r}: GRID drawn but NOT carried â ${hc[`grid-axis-indefinite`]}; unresolved: ${l.join(`; `)}`),delete t.layout;for(let e of Object.values(t.parts??{}))delete e.placement;return}Object.keys(s).length>0&&(t.literals=s)}function rm(e,t,n,r,i){let a=t?.grid;if(!a||!a.carried||a.flow)return;let o=e.occ.map(e=>e.node.cell).filter(e=>e!==void 0),s=o[0];if(!s)return;new Set(o.map(e=>JSON.stringify(e))).size>1&&r.notes.push(`${i}: grid cell differs across variants â placement is a per-part invariant (layoutByProp is refused on grid parts, P10), so the DEFAULT variant's cell is carried; review`);let c={row:s.row,column:s.column};s.rowSpan&&s.rowSpan>1&&(c.rowSpan=s.rowSpan),s.columnSpan&&s.columnSpan>1&&(c.columnSpan=s.columnSpan),s.alignX&&$p[s.alignX]&&(c.alignX=$p[s.alignX]),s.alignY&&$p[s.alignY]&&(c.alignY=$p[s.alignY]),n.placement=c}function im(e,t,n){let r=e.layout;if(!r||r.display!==`grid`||r.flow===`row`)return;let i=e.parts;if(!i)return;let a={};for(let[e,r]of Object.entries(i)){let i=r.placement;
2785if(!(!r.slot||!i)){if(i.alignX!==void 0||i.alignY!==void 0){t.notes.push(`${n}/${e}: slot part under a grid parent keeps EXPLICIT placement â its cell carries alignment, which an area rect cannot spell (GridAreaSchema is row/column/spans only); not hoisted to layout.areas`);continue}a[e]={...i},delete r.placement,t.notes.push(`${n}/${e}: slot part's grid cell hoisted to layout.areas["${e}"] â the area name IS the slot anchor (G4); the canvas cannot carry area names, the contract owns them`)}}Object.keys(a).length>0&&(r.areas=a);let o=Object.entries(i).filter(([,e])=>e.placement!==void 0).map(([e])=>e);if(o.length>0){let e=Object.keys(a);t.notes.push(`${n}: ${o.length} grid child(ren) (${o.join(`, `)}) carry EXPLICIT placement rects, not named areas â Figma has no native area names (G4: the CONTRACT owns them, the canvas carries only the rect), so an area name survives the round trip ONLY through a part that already has a name on the canvas: a SLOT node`+(e.length>0?` (${e.length} did â ${e.join(`, `)})`:` (none here did)`)+". The code side emits these as grid-row/grid-column LONGHANDS rather than grid-template-areas + grid-area â the named LOWERED disposition `grid-area-nonrectangular`. Nothing is lost geometrically; the NAMES are, and they are re-authored contract-side, never invented from the canvas")}}function am(e,t,n,r,i){if(!t)return;let a=e.occ.map(e=>({variant:e.variant,mode:t.byVariant.get(e.variant)??t.base})),o=a.filter(e=>e.mode===`VERTICAL`),s=a.filter(e=>e.mode===`HORIZONTAL`);if(!(o.length===0||s.length===0)&&e.occ.every(e=>e.node.fillWidth===!0)){for(let e of r.axes){if(Bf(e.values))continue;let t=new Map,o=!0;for(let n of a){let r=Rf(n.variant)[e.property];if(r===void 0){o=!1;break}let i=t.get(r);if(i!==void 0&&i!==n.mode){o=!1;break}t.set(r,n.mode)}if(!o||!e.values.every(e=>t.has(e)))continue;let s=n.literalsByProp??[];if(s.some(t=>t.prop!==e.propName&&Object.values(t.map).some(e=>`width`in e)))break;let c=s.find(t=>t.prop===e.propName);c||(c={prop:e.propName,map:{}},s.push(c));let l=[];for(let[e,n]of t){if(n!==`VERTICAL`)continue;let t=Q(e);(c.map[t]??={}).width===void 0&&(c.map[t].width=`100%`,l.push(t))}if(l.length===0)return;n.literalsByProp=s,r.notes.push(`${i}: drawn FILL-width under a parent whose auto-layout mode is a function of axis "${e.property}" â a Figma FILL is a GROW along the parent's primary axis and a cross-axis STRETCH across it, so the two meanings split by variant: \`layout.grow\` carries the ROW plane(s) and the COLUMN plane(s) (${l.join(`, `)}) carry width: 100% through literalsByProp on \`${e.propName}\` (the cross-axis stretch). Carrying the default variant's meaning everywhere filled the wrong dimension`);return}r.notes.push(`${i}: drawn FILL-width under a parent whose auto-layout mode CHANGES across variants (${s.length} row, ${o.length} column) without correlating to any variant axis â the cross-axis stretch is NOT carried (the row meaning, \`layout.grow\`, stands for every variant); review`)}}function om(e,t,n,r,i){let a=e.occ.map(e=>e.node.layout).filter(e=>e!==void 0)[0],o=(n?.base??null)===`HORIZONTAL`&&e.occ.every(e=>e.node.fillWidth===!0)?!0:void 0;if(!a)return o?{grow:o}:void 0;if(a.mode===`GRID`){let t=tm(e,void 0,r,i);return t?(o&&(t.grow=o),t):o?{grow:o}:void 0}let s=e.children.length>0,c=s&&e.occ.length>0&&e.occ.every(e=>(e.node.layout?.spacing??0)<0)?!0:void 0;c&&r.notes.push(`${i}: negative itemSpacing in every variant â children OVERLAP (P21); proposed as layout.overlap: true, with the gap channel carrying the DRAWN (negative) magnitude â the schema's negative-margin projection (CSS: a negative child margin from the gap token, the ds.avatar-group owner-precedent where {space.overlap} = -8px; canvas: negative itemSpacing) â never an invalid CSS \`gap\``);let l={},u=a.mode===`VERTICAL`?`column`:`row`,d=Yp[a.primary??`MIN`],f=Xp[a.counter??`MIN`]??(Zp(e)?`stretch`:void 0),p=e.occ.filter(e=>e.node.layout?.wrap===!0).length,m=p>0&&p===e.occ.filter(e=>e.node.layout!==void 0).length;if(t){if(u===`row`&&d===`center`&&f===`center`&&!o&&!c&&p===0)return;l.display=`flex`}if((s||u===`column`)&&(l.direction=u),d&&s&&(l.justify=d),f&&s&&(l.align=f),o&&(l.grow=o),c&&(l.overlap=c),p>0)if(m){l.wrap=!0;let t=new Set(e.occ.map(e=>e.node.layout?.rowSpacing).filter(e=>e!==void 0));t.size>0&&r.notes.push(`${i}: wrapping stack whose ROW gap (${[...t].join(`, `)}
2785px) differs from its column gap â carried as layout.wrap with the single \`gap\` channel holding the COLUMN spacing; the distinct row spacing is not carried (the schema's gap is one value on both axes, and CSS row-gap would need its own channel). The wrapped LINES sit at the column gap`)}else r.notes.push(`${i}: auto-layout WRAPS in ${p} of ${e.occ.filter(e=>e.node.layout!==void 0).length} auto-layout variant(s) â wrap is a per-part invariant here (layoutByProp carries direction/justify/align only), so it is NOT carried and every variant renders as a single line; split the part or make the wrap uniform`);return Object.keys(l).length>0?l:void 0}var sm={start:`flex-start`,center:`center`,end:`flex-end`,"space-between":`space-between`},cm={start:`flex-start`,center:`center`,end:`flex-end`,stretch:`stretch`,baseline:`baseline`};function lm(e,t){if(t){if(t.kind===`byProp`){e.layoutByProp=t.byProp;return}e.stylesWhen=[...e.stylesWhen??[],...t.stylesWhen]}}function um(e,t,n){if(e.occ.some(e=>e.node.layout?.mode===`GRID`))return;let r=e.children.map(e=>e.name),i=e=>{let t=e.node.layout;if(!t)return null;let n=t.mode===`VERTICAL`?`column`:`row`,i=(e.node.children??[]).map(e=>e.name),a=r.filter(e=>i.includes(e));return i.length>=2&&i.join(`\0`)!==a.join(`\0`)&&i.join(`\0`)===[...a].reverse().join(`\0`)&&(n+=`-reverse`),{direction:n,justify:Yp[t.primary??`MIN`]??`start`,align:Xp[t.counter??`MIN`]??`start`}},a=e.occ.map(e=>({variant:e.variant,tuple:i(e)}));if(a.some(e=>e.tuple===null))return;let o=e=>`${e.direction}|${e.justify}|${e.align}`,s=a[0].tuple;if(!a.every(e=>o(e.tuple)===o(s))){for(let e of t.axes){if(Bf(e.values))continue;let r=new Map,i=!0;for(let t of a){let n=Rf(t.variant)[e.property];if(n===void 0){i=!1;break}let a=r.get(n);if(a&&o(a)!==o(t.tuple)){i=!1;break}r.set(n,t.tuple)}if(!i||!e.values.every(e=>r.has(e)))continue;let c={};for(let t of e.values){let e=r.get(t),n={};e.direction!==s.direction&&(n.direction=e.direction),e.justify!==s.justify&&(n.justify=e.justify),e.align!==s.align&&(n.align=e.align),Object.keys(n).length>0&&(c[Q(t)]=n)}return Object.keys(c).length===0?void 0:(t.notes.push(`${n}: auto-layout differs across variants as a function of axis "${e.property}" â proposed layoutByProp on \`${e.propName}\` (${Object.keys(c).length} override(s); reversed child order spelled as -reverse directions)`),{kind:`byProp`,byProp:{prop:e.propName,map:c}})}for(let e of t.axes){if(!Bf(e.values))continue;let r=new Map,i=!0;for(let t of a){let n=Rf(t.variant)[e.property];if(n===void 0){i=!1;break}let a=r.get(n);if(a&&o(a)!==o(t.tuple)){i=!1;break}r.set(n,t.tuple)}if(!i||r.size!==2)continue;let c=[...r.keys()].find(e=>/^true$/i.test(e));if(c===void 0)continue;let l=r.get(c);if(o(l)===o(s)){t.notes.push(`${n}: auto-layout differs across variants as a function of the BOOLEAN axis "${e.property}", but the deviating plane is its FALSE value â stylesWhen's boolean condition is truthy-only (\`equals\` is enum-only) and layoutByProp needs an enum prop, so the difference is NOT carried; the default variant's layout stands for both planes. Re-draw the axis with the deviating plane as TRUE, or promote it to an enum, to carry it`);break}let u={};if(l.direction!==s.direction&&(u[`flex-direction`]=l.direction),l.justify!==s.justify&&(u[`justify-content`]=sm[l.justify]??l.justify),l.align!==s.align&&(u[`align-items`]=cm[l.align]??l.align),Object.keys(u).length===0)break;return t.notes.push(`${n}: auto-layout differs across variants as a function of the BOOLEAN axis "${e.property}" â layoutByProp is an ENUM-keyed map, so the same fact carries through \`stylesWhen\` on \`${e.propName}\` (${Object.entries(u).map(([e,t])=>`${e}: ${t}`).join(`; `)}), the existing boolean-conditioned literal-CSS vocabulary; the code leg emits \`.root[data-${e.propName.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}]\`, the canvas leg does not represent conditional restyling (standing documented limit)`),{kind:`stylesWhen`,stylesWhen:[{prop:e.propName,styles:u}]}}t.notes.push(`${n}: auto-layout differs across variants without correlating to any variant axis â using the default variant's`)}}function dm(e,t,n,r){let i=e.occ.filter(e=>e.node.text?.characters!==void 0).map(e=>({variant:e.variant,chars:e.node.text.characters}));if(!(i.length<2||new Set(i.map(e=>e.chars)).size<=1)){for(let e of n.axes.filter(e=>!Bf(e.values))){let a=new Map,o=!0;for(let t of i){let n=Rf(t.variant)[e.property];if(n===void 0){o=!1;break}let r=a.get(n);if(r===void 0)a.set(n,t.chars);else if(r!==t.chars){o=!1;break}}if(!o||a.size<=1)continue;let s=e.values.filter(e=>a.has(e)),c=s[0],l={};for(let e of s){let t=a.get(e);e!==c&&t!==a.get(c)&&(l[Q(e)]=t)}t.text=a.get(c),Object.keys(l).length>0&&(t.textByProp={prop:e.propName,map:l}),n.notes.push(`${r}: drawn characters are a pure function of the "${e.property}" axis (${s.map(e=>`${Q(e)}â${JSON.stringify(a.get(e))}`).join(`, `)}) â bound as text + textByProp instead of pinning the first variant's value`);return}n.notes.push(`${r}: drawn characters vary across variants (${[...new Set(i.map(e=>JSON.stringify(e.chars)))].slice(0,6).join(`, `)}) without tracking any enum axis â first value pinned, review`)}}var fm={OMIT:!0};function pm(e,t,n){if(e.occ.length===t.totalVariants.length)return;let r=new Set(e.occ.map(e=>e.variant)),i;for(let e of t.axes)for(let a of e.values)if(t.totalVariants.every(t=>Rf(t)[e.property]===a===r.has(t))){if(Bf(e.values)){if(a.trim().toLowerCase()===`true`)return t.notes.push(`${n}: present exactly where "${e.property}" is true â proposed as visibleWhen { prop: ${e.propName} } (boolean axis, truthy form)`),{prop:e.propName};i=e;continue}return{prop:e.propName,equals:Q(a)}}for(let e of t.axes){if(Bf(e.values))continue;let i=e.values.filter(n=>t.totalVariants.some(t=>r.has(t)&&Rf(t)[e.property]===n));if(!(i.length<2||i.length===e.values.length)&&t.totalVariants.every(t=>i.includes(Rf(t)[e.property]??``)===r.has(t)))return t.notes.push(`${n}: present exactly where "${e.property}" is one of ${i.map(e=>`"${e}"`).join(`, `)} â proposed as visibleWhen { prop: ${e.propName}, equals: [${i.map(e=>Q(e)).join(`, `)}] } (value-subset form)`),{prop:e.propName,equals:i.map(e=>Q(e))}}if(i){t.notes.push(`${n}: present exactly where "${i.property}" is false â the visibleWhen vocabulary has no negated form, so the condition is inexpressible; kept unconditional (declared fidelity limit), review`);return}if(t.totalVariants.every(e=>r.has(e)||t.flattenedVariants.has(e))){t.notes.push(`${n}: absent only in base-instance-flattened variant(s), where the base component's internals are not captured â kept unconditional`);return}if(e.occ.length*2>t.totalVariants.length){t.notes.push(`${n}: present in ${e.occ.length}/${t.totalVariants.length} variants without correlating to any axis value â MAJORITY presence, kept unconditional (the lesser error; named, review)`);return}return t.notes.push(`${n}: DEGRADATION part omitted â present in only ${e.occ.length}/${t.totalVariants.length} variants and no single axis (value, subset, or boolean) predicts presence; emitting it unconditionally would render it in the majority of variants that never carried it. Review the set's variant structure or gate it manually.`),fm}var mm=e=>e.selfId;function hm(e,t){return(t.contractIdByName.get(e)??`${t.prefix}.${Pf(e)}`)===mm(t)||Pf(e)===Pf(t.setName)}function gm(e,t,n){for(let n of t.stubs.values())if(n.instanceOf===e)return{id:n.id,collidedWith:null};let r=n?.setKey??n?.key,i=e=>{if(r===void 0)return!1;let n=t.contractsById?.get(e)?.anchors?.figma?.componentSetKey??null;return n!==null&&n!==r},a=`${t.prefix}.${Pf(e)}`,o=a;for(let e=2;t.stubs.has(o)||o===mm(t)||i(o);e+=1)o=`${a}-${e}`;return{id:o,collidedWith:o===a?null:t.stubs.get(a)?.instanceOf??(i(a)?`the in-scope contract ${a} (its componentSetKey contradicts this instance's key)`:t.setName)}}function _m(e,t,n){let r=n.contractIdByKey;if(r){let e=(t.setKey===void 0?void 0:r.get(t.setKey))??(t.key===void 0?void 0:r.get(t.key));if(e)return{id:e,mechanism:`key`}}let i=n.contractIdByName.get(e);if(!i)return{id:null,mechanism:null};let a=t.setKey??t.key,o=n.contractsById?.get(i)?.anchors?.figma?.componentSetKey??null;return a!==void 0&&o!==null&&o!==a?{id:null,mechanism:null,keyMismatch:{contractId:i,contractKey:o,instanceKey:a}}:{id:i,mechanism:`name`}}var vm=e=>({setKey:up(e.occ,e=>e.instanceSetKey),key:up(e.occ,e=>e.instanceKey)});function ym(e,t,n,r){let i=gm(e,n,vm(t)),a=i.id,o=!n.stubs.has(a),s=n.stubs.get(a)??{id:a,instanceOf:e,applied:[],observed:[]};if(s.setKey===void 0){let e=up(t.occ,e=>e.instanceSetKey)??up(t.occ,e=>e.instanceKey);e!==void 0&&(s.setKey=e)}for(let e of t.occ)e.node.componentProperties&&s.applied.push(e.node.componentProperties),e.node.bbox&&s.observed.push({variant:e.variant,...e.no
2785de.componentProperties?{applied:e.node.componentProperties}:{},...e.node.instanceKey?{instanceKey:e.node.instanceKey}:{},bbox:e.node.bbox,...e.node.fill?{fill:e.node.fill}:{},...e.node.instancePrimaryFill?{instancePrimaryFill:e.node.instancePrimaryFill}:{},...e.node.stroke?{stroke:e.node.stroke}:{},...e.node.strokeWeight===void 0?{}:{strokeWeight:e.node.strokeWeight},...e.node.cornerRadius===void 0?{}:{cornerRadius:e.node.cornerRadius},...e.node.imageFill===void 0?{}:{imageFill:e.node.imageFill}});return n.stubs.set(a,s),o&&Ff(e)&&n.notes.push(`${r}: nested instance name "${e}" contains characters a contract id cannot carry â stub id sanitized to "${a}" (rule: lowercase kebab, illegal characters â hyphens, runs collapsed, edge hyphens stripped, digit-led/empty gets "c"); the original spelling stays on the stub's name/description and in this note`),o&&i.collidedWith&&n.notes.push(`${r}: sanitized stub id for "${e}" collides with the id already claimed for "${i.collidedWith}" â disambiguated deterministically to "${a}" (arrival order), never silently merged`),a}function bm(e,t,n,r,i){e.mechanism===`key`?r.notes.push(`${i}: nested instance of "${t}" LINKED to ${e.id} by componentSetKey ${n.setKey??n.key} (dump v1.5 â rename-safe: the key matches the contract's anchors, whatever either side is named)`):e.mechanism===`name`&&e.id?r.notes.push(`${i}: nested instance of "${t}" linked to ${e.id} by NAME${n.setKey??n.key?` (the instance carries a key but the contract's componentSetKey anchor is null â key confirmation unavailable; verify the link)`:` (no key captured â pre-v1.5 dump; verify the link)`}`):e.keyMismatch&&r.notes.push(`${i}: nested instance of "${t}" name-matches ${e.keyMismatch.contractId} but the keys CONTRADICT (instance ${e.keyMismatch.instanceKey} vs contract anchor ${e.keyMismatch.contractKey}) â name-coincidence link REFUSED (dump v1.5); a stub carries the child instead`)}function xm(e,t,n,r,i){if(t.length<2)return;let a=n.axes.filter(e=>!Bf(e.values));for(let o of Object.keys(e)){let s=t.filter(e=>e.canonical[o]!==void 0).map(e=>({variant:e.variant,value:e.canonical[o]})),c=[...new Set(s.map(e=>String(e.value)))];if(c.length<=1)continue;let l=a.find(e=>s.every(t=>{let n=Rf(t.variant)[e.property];return n!==void 0&&typeof t.value==`string`&&Q(n)===t.value}));if(l){e[o]=`{${l.propName}}`,n.notes.push(`${r}: applied prop "${o}" of the nested "${i}" tracks the "${l.propName}" axis exactly across all ${s.length} occurrence(s) â threaded as "{${l.propName}}" (the child follows the parent per variant)`);continue}let u;for(let e of a){let t=new Map,n=s.length>0;for(let r of s){let i=Rf(r.variant)[e.property];if(i===void 0||typeof r.value!=`string`){n=!1;break}let a=t.get(i);if(a===void 0)t.set(i,r.value);else if(a!==r.value){n=!1;break}}if(!n||t.size<=1)continue;let r={};for(let n of e.values){let e=t.get(n);e!==void 0&&(r[Q(n)]=e)}u={axis:e,map:r};break}u?(e[o]={prop:u.axis.propName,map:u.map},n.notes.push(`${r}: applied prop "${o}" of the nested "${i}" is a pure function of the "${u.axis.propName}" axis (${Object.entries(u.map).map(([e,t])=>`${e}â${t}`).join(`, `)}) â bound as a per-value lookup instead of pinning the first variant's value`)):n.notes.push(`${r}: applied prop "${o}" of the nested "${i}" varies across variants (${c.join(`, `)}) without tracking any enum axis â first value "${String(e[o])}" carried, review`)}}function Sm(e,t,n,r,i,a){let o=e.occ.filter(e=>e.node.textOverrides!==void 0);if(o.length===0)return;let s=i.textOverridesVisited??=new Set;for(let e of o)for(let[t,n]of Object.entries(e.node.textOverrides))s.add(`${t} ${n}`);let c=[...new Set(o.flatMap(e=>Object.keys(e.node.textOverrides)))].sort(),l=c.map(e=>`"${e}" = ${[...new Set(o.map(t=>t.node.textOverrides[e]).filter(e=>e!==void 0))].map(e=>JSON.stringify(e)).join(`/`)}`).join(`; `);if(!n){i.notes.push(`${a}: this host overrides the characters of the nested "${r}" (${l}, dump v1.10) but the child is an auto-proposed STUB with no anatomy â the override is NOT carried (import the real child set); named, never invented`);return}let u=(i.contractsById?.get(n)?.props??[]).filter(e=>e.type===`text`);if(c.length!==1||u.length!==1){i.notes.push(`${a}: this host overrides the characters of the nested "${r}" (${l}
2785, dump v1.10) but the pairing is not unambiguous â ${c.length} overridden path(s) against ${u.length} text prop(s) on ${n}; NOT carried (a wrong pairing would put the host's label on the wrong node)`);return}let d=u[0].name,f=c[0],p=e.occ.map(e=>({variant:e.variant,value:e.node.textOverrides?.[f]})).filter(e=>typeof e.value==`string`),m=[...new Set(p.map(e=>e.value))],h=t.props??{};if(h[d]!==void 0){i.notes.push(`${a}: character override "${f}" of the nested "${r}" collides with an applied "${d}" the drawn properties already set â the DRAWN property wins, the override is not carried (named)`);return}if(m.length===1){h[d]=m[0],t.props=h,i.notes.push(`${a}: the nested "${r}" carries a HOST character override (dump v1.10) â "${f}" reads ${JSON.stringify(m[0])} in all ${p.length} occurrence(s), carried as component.props.${d} (the child's own default ${JSON.stringify(String(u[0].default??``))} would otherwise render)`);return}for(let e of i.axes.filter(e=>!Bf(e.values))){let n=new Map,o=!0;for(let t of p){let r=Rf(t.variant)[e.property];if(r===void 0){o=!1;break}let i=n.get(r);if(i===void 0)n.set(r,t.value);else if(i!==t.value){o=!1;break}}if(!o||n.size<=1)continue;let s={};for(let t of e.values){let e=n.get(t);e!==void 0&&(s[Q(t)]=e)}h[d]={prop:e.propName,map:s},t.props=h,i.notes.push(`${a}: the nested "${r}" carries a HOST character override that VARIES (dump v1.10) â "${f}" is a pure function of the "${e.propName}" axis (${Object.entries(s).map(([e,t])=>`${e}â${JSON.stringify(t)}`).join(`, `)}), carried as a per-value lookup on component.props.${d}`);return}i.notes.push(`${a}: the nested "${r}" carries a HOST character override that varies across variants (${m.map(e=>JSON.stringify(e)).join(`, `)}, dump v1.10) without tracking any enum axis â NOT carried (pinning one variant's label would be wrong everywhere else); the child renders its own default`)}function Cm(e,t,n,r,i=!1){let a=n.swapPreferredValues?.[t];if(!a||a.length===0){n.notes.push(i?`${r}: slot "${t}" accepts (SLOT preferredValues) is not captured in this dump â the plugin dump is the authoritative slot reader (REST returns componentPropertyDefinitions EMPTY for SLOT properties, so accepts is INVISIBLE over REST); author \`accepts\` manually or re-dump through the plugin`:`${r}: slot "${t}" accepts (INSTANCE_SWAP preferredValues) is not captured in dump v1 â author \`accepts\` manually`);return}let o=[],s=[];for(let e of a){let t=n.contractIdByKey?.get(e.key);t&&!o.includes(t)?o.push(t):t||s.push(e.key)}o.length>0&&(e.accepts=o,e.acceptsMode=`prefer`,n.notes.push(`${r}: slot "${t}" accepts proposed from INSTANCE_SWAP preferredValues (dump v1.5) â ${o.join(`, `)} resolved by component key; acceptsMode 'prefer' (Figma's preferredValues tier)`)),s.length>0&&n.notes.push(`${r}: slot "${t}" preferredValues name ${s.length} component key(s) with no in-scope contract (${s.join(`, `)}) â not carried into \`accepts\` (import the referenced set(s) to resolve them by key)`)}function wm(e,t,n,r,i){let a=up(n.occ,e=>e.instanceOf);if(!a||a===`Slot`){r.notes.push(`${i}: Slot-utility instance styling is the utility's own â elided`);return}let o=vm(n),s=_m(a,o,r),c=s.id,l=!1;if(c)bm(s,a,o,r,i);else{if(!n.occ.some(e=>e.node.bbox!==void 0)){r.notes.push(`${i}: slot "${t}" holds a "${a}" instance as design-time content â defaultContent not proposed (${s.keyMismatch?`name-matches ${s.keyMismatch.contractId} but the keys contradict, and no observed geometry is captured`:`no contract in scope and no observed geometry captured (pre-v1.5 dump)`}), review`);return}bm(s,a,o,r,i),c=ym(a,n,r,i),l=!0}let u=e.accepts;if(u&&!u.includes(c)){r.notes.push(`${i}: slot "${t}" design-time content "${a}" (${c}) is outside the slot's proposed accepts (${u.join(`, `)}) â defaultContent not proposed (defaultContent must be drawn from accepts), review`);return}let d={id:c},f=up(n.occ,e=>e.componentProperties);if(f&&!l){let e=zm(a,f,s.id,r,i);Object.keys(e).length>0&&(d.props=e)}e.defaultContent=[d],r.notes.push(l?`${i}: slot "${t}" design-time content "${a}" proposed as defaultContent [${c}] â a STUB rendering the OBSERVED geometry only (dump v1.5 bbox + primary paint; PROVISIONAL â import the real child set to replace it)`:`${i}: slot "${t}" design-time content "${a}" proposed as defaultContent [${c}] (linked contract in scope, dump v1.5)`)}var Tm=e=>e.type===`FRAME`&&e.children.length===0&&e.occ.every(e=>!e.node.fill&&!e.node.stroke&&!e.node.bound&&!e.node.text&&e.node.imageFill===void 0&&e.node.fixedSize===void 0),Em=e=>{let t=e.occ[0].node,n=t.layout;return e.type===`FRAME`&&e.children.length===0&&n!==void 0&&n.mode===`HORIZONTAL`&&n.primary===`CENTER`&&n.counter===`CENTER`&&n.spacing===0&&n.padding.every(e=>e===0)&&(t.fill!==void 0||t.bound!==void 0)},Dm=24;
2785function Om(e,t,n,r){let i=Q(e).replace(/[^A-Za-z0-9]/g,``),a=(t.drawnByThisPipeline===!0?/^[A-Za-z][A-Za-z0-9-]*$/.test(e):/^[A-Za-z][A-Za-z0-9]*$/.test(e))?e:/^[A-Za-z]/.test(i)?i:`part`;if(a.length>Dm){let e=a.slice(0,Dm);t.notes.push(`${n}: derived part name "${a.slice(0,40)}${a.length>40?`â¦`:``}" (${a.length} chars) exceeds the ${Dm}-char identifier cap â truncated to "${e}" (deterministic: first ${Dm} characters; the drawn text itself is untouched)`),a=e}let o=t.partNames,s=a;if(o.has(a)){let e=r&&r!==`root`&&r!==a?`${r}${a.charAt(0).toUpperCase()}${a.slice(1)}`:``;if(e&&!o.has(e))s=e;else for(let e=2;o.has(s);e++)s=`${a}${e}`;t.notes.push(`${n}: part name "${a}" already names another part of this contract (part names are contract-wide: CSS classes, swap layers, and note paths key on them) â renamed to "${s}" (rule: first drawn part keeps the name; later collisions take the parent-derived prefix, else an ordinal suffix)`)}return o.add(s),s}function km(e,t,n){e.mint?.attach.push({holder:t,tokens:n}),Object.keys(n).length>0&&(t.tokens=n)}function Am(e,t){return e.propNames?.[t]??jf(t)}function jm(e,t,n,r=Am(e,t)){e.textProps.some(e=>e.property===t)||e.textProps.push({name:r,property:t,default:n})}function Mm(e,t,n){let r=[],i=(e,t)=>{e.type===`TEXT`&&r.push({path:t.join(`/`),name:e.name});for(let n of e.children)i(n,[...t,n.name])};for(let t of e.children)i(t,[t.name]);let a=new Map,o=new Set([...n.axes.map(e=>e.propName),...n.textProps.map(e=>e.name)]),s=e=>{for(let t of e.occ){let e=t.node.propRefs?.characters;e&&o.add(jf(e))}for(let t of e.children)s(t)};s(e);for(let e of[...t].sort()){let t=e.split(`/`).pop(),i=r.filter(t=>t.path===e),s=i.length>0?i:r.filter(e=>e.name===t);if(s.length===0){n.notes.push(`${n.setName}: a host was observed overriding the characters of "${e}" inside an instance of this set (dump v1.10 \`textOverrides\`), but no TEXT node in this set's merged tree matches that path or the node name "${t}" â the override is REFUSED, not invented; this set's own characters stand`);continue}if(s.length>1){n.notes.push(`${n.setName}: a host overrides the characters of "${e}" inside an instance of this set, but ${s.length} TEXT nodes here answer to the name "${t}" (${s.map(e=>`"${e.path}"`).join(`, `)}) â ambiguous, so NO text prop is promoted (a wrong node would silently take the host's label)`);continue}let c=s[0];if(a.has(c.path))continue;let l=a.size===0&&!o.has(`children`)?`children`:jf(c.name);if(o.has(l)){n.notes.push(`${n.setName}: the host-overridden text node "${c.path}" would need prop name "${l}", which this set's drawn API already claims â no promotion (the drawn property wins; rename the node or the axis to carry the override)`);continue}o.add(l),a.set(c.path,l),n.notes.push(`${n.setName}: text node "${c.path}"${c.path===e?``:` (matched by node name from the host's drawn path "${e}" â a wrapper union folds this node differently in this set's own tree)`} is OVERRIDDEN by at least one host instance (dump v1.10 \`textOverrides\`) â promoted from a literal to text prop \`${l}\` with the drawn characters as its default; bindings.figma.kind is NONE because this set exposes NO TEXT component property for it (the canvas carries the override as a raw instance override, which the contract vocabulary does not model â declared limit, named here)`)}return a}function Nm(e,t,n,r){let i=[...new Set(e.occ.map(e=>e.node.propRefs?.[t]).filter(e=>e!==void 0))];return i.length>1&&n.notes.push(`${r}: ${t} property reference differs across variants (${i.join(`, `)}) â using ${i[0]}`),i[0]}function Pm(e,t,n){let r=e=>e.type===`INSTANCE`&&up(e.occ,e=>e.propRefs?.mainComponent)===void 0&&up(e.occ,e=>e.componentProperties)!==void 0&&!hm(up(e.occ,e=>e.instanceOf)??e.name,n);if(!r(e[t]))return null;let i=up(e[t].occ,e=>e.instanceOf)??e[t].name,a=e=>Object.keys(up(e.occ,e=>e.componentProperties)??{}).map(e=>e.split(`#`)[0]).sort().join(`\0`),o=a(e[t]),s=[];for(let n=t;n<e.length;n++){let t=e[n];if(!r(t)||(up(t.occ,e=>e.instanceOf)??t.name)!==i||a(t)!==o)break;s.push(t)}return s.length>=3?s:null}function Fm(e,t,n,r){let i=e[0],a=up(i.occ,e=>e.instanceOf)??i.name,o=vm(i),s=_m(a,o,t),c=s.id??gm(a,t,o).id,l=t.contractsById?.get(c),u=e.map(e=>(e.occ.find(e=>e.variant===t.totalVariants[0])??e.occ[0]).node.componentProperties??{}),d={},f={},p=[],m=(e,r,i,a)=>
2785d[e]===void 0?(d[e]=r,f[e]=i,!0):(t.notes.push(`${n}: per-item field name "${e}" (from applied prop "${a}") collides with another field â not carried, review (P9)`),!1);for(let e of Object.keys(u[0])){let r=e.split(`#`)[0],i=u.map(t=>t[e]),a=new Set(i.map(e=>String(e))).size>1,o=l?.props.find(e=>e.bindings.figma.property===r);if(typeof i[0]==`boolean`){a?l&&(!o||o.type!==`boolean`)?t.notes.push(`${n}: per-item boolean "${r}" does not map through ${l.id}'s bindings as a boolean prop â not carried as a field; verify the child contract is current (P9)`):m(o?.name??jf(r),`boolean`,e,r):p.push(e);continue}(l?o?.type===`text`:e.includes(`#`))?m(o?.name??jf(r),`text`,e,r):a?l&&!o?t.notes.push(`${n}: applied prop "${r}" varies per sibling (${[...new Set(i.map(String))].join(`, `)}) but does not map through ${l.id}'s bindings â not carried as a field; verify the child contract is current (P9)`):l?t.notes.push(`${n}: applied prop "${r}" varies per sibling (${[...new Set(i.map(String))].join(`, `)}) â per-item enum/state differences are P10 (selected-item) with no repeat vocabulary; receipted, the sample renders ${l.id}'s default (review)`):t.notes.push(`${n}: applied prop "${r}" varies per sibling (${[...new Set(i.map(String))].join(`, `)}) but a bare string key is VARIANT/TEXT-ambiguous (pre-v1.5 dump, no "#id" suffix) â not carried as a field; recapture with the v1.5 plugin to carry per-item text (review)`):p.push(e)}if(Object.keys(d).length===0)return t.notes.push(`${n}: ${e.length} adjacent sibling instances of "${a}" (repeated-children collection, P9) but no per-item field is carriable â kept as ${e.length} fixed parts, review`),null;if(bm(s,a,o,t,n),!s.id)for(let r of e)ym(a,r,t,n);let h=[...new Set(e.map(e=>up(e.occ,e=>e.propRefs?.visible)).filter(e=>e!==void 0))];h.length>0&&t.notes.push(`${n}: per-sibling visibility bindings (${h.join(`, `)}) are the canvas's drawn COUNT controls ("Show item N", the P9 canvas count spelling) â not promoted to boolean props (the array prop owns the count in code); regeneration renders repeat.sample's items, the drawn booleans stay on the source set (rename story, named here)`);let g=new Set([...t.axes.map(e=>e.propName),...t.textProps.map(e=>e.name),...t.boolProps.map(e=>e.name),...t.arrayProps.map(e=>e.name)]).has(`items`)?`${r}Items`:`items`;t.arrayProps.push({name:g,fields:d,instanceOf:a}),t.notes.push(`prop \`${g}\`: structured array prop proposed for the repeated "${a}" collection â code-only by declared fidelity limit (bindings.figma.kind NONE: the canvas has no list-of-records property type); the canvas renders repeat.sample instead`);let _=u.map(e=>{let t={};for(let[n,r]of Object.entries(f)){let i=e[r];i!==void 0&&(t[n]=i)}return t}),v={},y={id:c},b={};for(let e of p)b[e]=u[0][e];if(Object.keys(b).length>0){let e=zm(a,b,s.id,t,n,!1,o);xm(e,i.occ.filter(e=>e.node.componentProperties!==void 0).map(e=>{let r={};for(let t of p){let n=e.node.componentProperties[t];n!==void 0&&(r[t]=n)}return{variant:e.variant,canonical:zm(a,r,s.id,t,n,!0,o)}}),t,n,a),Object.keys(e).length>0&&(y.props=e)}if(v.component=y,v.repeat={itemsProp:g,sample:_},e.some(e=>e.occ.length!==t.totalVariants.length)){let r=t.totalVariants.map(t=>e.filter(e=>e.occ.some(e=>e.variant===t)).length);t.notes.push(`${n}: sibling count varies per variant (${[...new Set(r)].join(`/`)}) â repeat.sample carries the UNION of drawn siblings; the live count is the array prop's (code side), review`)}return t.notes.push(`${n}: ${e.length} adjacent sibling instances of "${a}" with a homogeneous applied-prop shape â proposed as ONE item-template part with repeat over arrayOf prop \`${g}\` (P9; fields: ${Object.entries(d).map(([e,t])=>`${e}:${t}`).join(`, `)}); the drawn siblings become the canvas's static sample (repeat.sample â the meter discipline: canvas and static surfaces render the OBSERVED sample; code maps the live array)`),v}function Im(e,t,n,r,i,a){let o={},s=t?.grid?.carried===!0&&!t.grid.flow,c=0;for(;c<e.length;){let l=e[c],u=s?void 0:Pm(e,c,n);if(u){let e=Om(l.name,n,`${r}/${l.name}`,i);a&&!a.has(l.name)&&a.set(l.name,e);let s=Fm(u,n,`${r}/${l.name}`,e);if(s){u.some(e=>e.occ.some(e=>Ip(e.node)!==void 0))&&n.notes.push(`${r}/${l.name}: absolute placement captured (dump v1.7 \`abs\`) on a repeated-collection sibling â a repeat template renders its items in flow; placement not carried (ledgered by name)`),o[e]=s,c+=u.length;continue}let d=Lm(l,t,n,`${r}/${l.name}`,e);d&&(o[e]=Rp(l,d,n,`${r}/${l.name}`,e)),c++;continue}let d=Om(l.name,n,`${r}/${l.name}`,i);a&&!a.has(l.name)&&a.set(l.name,d);let f=Lm(l,t,n,`${r}/${l.name}`,d);f&&(rm(l,t,f,n,`${r}/${l.name}`),o[d]=Rp(l,f,n,`${r}/${l.name}`,d)),c++}return o}function Lm(e,t,n,r,i){let a={},o=pm(e,n,r);if(o===fm)return null;if(e.occ.some(e=>e.node.imageFill!==void 0)&&n.notes.push(e.occ.some(e=>typeof e.node.imageFill==`string`)?`${r}: IMAGE fill carried BY HASH (dump v1.9 \`imageFill\`) â a FRAME part renders the exported asset (url('./assets/images/<hash>.png')); a nested-instance part renders through the child contract's own carriage (a per-instance photo override is NOT carried â named limit); the placeholder gradient remains the fallback when the asset is absent`:`${r}: IMAGE fill captured BY NAME only (dump v1.7 \`imageFill\`) â the image itself is NOT exported (a later round exports the asset); a FRAME part renders the neutral placeholder gradient in its place (stub instances via their stub geometry; other node classes render without the image)`),e.type===`TEXT`){let t={map:{}},i=Jp(e,n,r,t);bp(a,t),qp(e,a,n,r),Dp(e,a,i,n,r),e.occ.some(e=>(e.node.effects?.length??0)>0)&&n.notes.push(`${r}: visible effect(s) on a TEXT node â a text shadow has no contract vocabulary (box-shadow is a box channel); channel NAMED, not proposed (dump v1.2)`);let s=Nm(e,`characters`,n,r),c=up(e.occ,e=>e.text?.characters)??``,l=s?void 0:n.textPromote?.get(r.slice(`${n.setName}:root/`.length));if(s)jm(n,s,c),a.content={prop:Am(n,s)};else if(l){jm(n,`�textOverride:${r}`,c,l);let e=n.textProps.find(e=>e.name===l);e&&(e.figmaless=!0),a.content={prop:l}}else a.text=c,dm(e,a,n,r);return Lp(e,a,i,n,r,{text:!0}),km(n,a,i),o&&(a.visibleWhen=o),a}if(e.type===`SLOT`){let t={name:jf(e.name)}
2785;Cm(t,e.name,n,r,!0);let i=e.children.filter(e=>e.type===`INSTANCE`);i.length===1?wm(t,e.name,i[0],n,r):i.length>1&&n.notes.push(`${r}: native slot "${e.name}" holds ${i.length} drawn instances as design-time content â defaultContent not proposed (a multi-child default is carriable, but which children are DEFAULT content and which are a designer's fill is not readable from the canvas), review`);let s=n.slotDescriptions?.[e.name];s&&s.includes(`REFUSED BY FIGMA`)&&n.notes.push(`${r}: native slot "${e.name}" carries a SLOT description naming a constraint the canvas cannot enforce â "${s}". The contract-side constraint (min/max/required/acceptsMode "restrict") is NOT proposed from it: the canvas holds the words, not the rule; re-declare it in the contract if it still applies`),a.slot=t;let c=Nm(e,`visible`,n,r),l=c===`Show ${e.name}`;return l?a.optional=!0:c&&Rm(a,c,n,r,e),n.notes.push(`${r}: NATIVE Figma slot node "${e.name}" (Schema 2025) â proposed as slot part; regeneration reproduces a native slot, never an INSTANCE_SWAP placeholder`),n.slots.push({part:a,property:e.name,optional:l||c!==void 0}),o&&(a.visibleWhen=o),a}if(e.type===`INSTANCE`){let t=e.occ.find(e=>(e.node.opacity??1)<1);t&&n.notes.push(`${r}: node opacity ${t.node.opacity} on a nested instance â parent-context opacity is not representable on a component ref (dump v1.2); review`),e.occ.some(e=>(e.node.effects?.length??0)>0)&&n.notes.push(`${r}: visible effect(s) on a nested instance â not representable on a component ref (dump v1.2); review`);let i=Nm(e,`mainComponent`,n,r);if(i){n.notes.push(`${r}: INSTANCE_SWAP-bound instance without a dedicated wrapper frame â slot proposed without layout, review`);let t={name:jf(i)};Cm(t,i,n,r),wm(t,i,e,n,r),a.slot=t;let s=Nm(e,`visible`,n,r),c=s===`Show ${i}`;return c?a.optional=!0:s&&Rm(a,s,n,r,e),n.slots.push({part:a,property:i,optional:c||s!==void 0}),o&&!a.visibleWhen&&(a.visibleWhen=o),a}let s=up(e.occ,e=>e.instanceOf)??e.name;if(hm(s,n)){let t=up(e.occ,e=>e.componentProperties),i=t?Object.keys(t).map(e=>e.split(`#`)[0]):[],c=t?`flattening heuristic not met â the variant carries more than one instance of the set itself`:`componentProperties not captured â dump v1 stops at instances`;return n.notes.push(`${r}: nested instance of the set's own base component "${s}" â no component ref proposed (a contract cannot reference itself); props ${i.length>0?i.join(`, `):`(unknown)`} not extracted (${c})`),e.occ.some(e=>Ip(e.node)!==void 0)&&n.notes.push(`${r}: absolute placement captured (dump v1.7 \`abs\`) on the refused self-instance â not carried (nothing renders here); ledgered by name`),o&&(a.visibleWhen=o),a}let c=vm(e),l=_m(s,c,n),u=l.id;if(bm(l,s,c,n,r),!u){let t=ym(s,e,n,r);n.notes.push(`${r}: nested instance of "${s}" has no known contract â component ref proposed as "${t}" with a STUB child contract auto-proposed alongside (childStubs; API from observed applied values only, anatomy not captured â import the real child set to replace it)`)}let d={id:u??gm(s,n,c).id},f=e.occ.filter(e=>e.node.componentProperties!==void 0);if(f.length>0){let e=zm(s,f[0].node.componentProperties,u,n,r,!1,c);xm(e,f.map(e=>({variant:e.variant,canonical:zm(s,e.node.componentProperties,u,n,r,!0,c)})),n,r,s),Object.keys(e).length>0&&(d.props=e)}else n.notes.push(`${r}: fixed prop values of the nested "${s}" instance are not captured in dump v1 â declared fidelity limit, author them if the instance is configured`);Sm(e,d,u,s,n,r);let p=!1;if(n.instanceOverrides&&n.mint&&u){let t=(n.contractsById?.get(u))?.anatomy?.root,i=new Set(t?.overridable??[]),a=t?.tokens??{};if(i.size>0){let t=e.occ.map(e=>e.node.componentProperties?zm(s,e.node.componentProperties,u,n,r,!0,c):{}),o=(e,t)=>{let r=a[e];if(typeof r!=`string`)return;let i=r.replace(/^\{|\}$/g,``);for(let e of[...i.matchAll(/\{([a-z][\w-]*)\}/g)]){let n=t[e[1]];if(n===void 0)return;i=i.replaceAll(e[0],String(n))}return n.instanceOverrides.get(i)},l={},f=!1,m=!1;if(i.has(`background-image`)){let a=e.occ.map(e=>Um(e.node.instancePrimaryFill)?Wm(e.node.instancePrimaryFill):void 0);if(a.length>0&&a.every(e=>e!==void 0)){let c=!1,d=!1;e.occ.forEach((e,n)=>{let r=o(`background-image`,t[n]);r===void 0?d=!0:r!==a[n]&&(c=!0)}),c&&!i.has(`size`)?n.notes.push(`${r}: the nested "${s}" draws a DIFFERENT ring than ${u} mints (dump v1.7 stroke/ellipse witness) but the child declares no size channel â ring and box carry together or not at all; per-usage ring NOT carried, review`):c?($(n,l,r,`background-image`,`gradient`,e.occ.map((e,t)=>({variant:e.variant,value:a[t]}))),f=!0,m=!0,n.notes.push(`${r}: PER-INSTANCE RING OVERRIDE proposed (round 7) â this host's observed stroke ring (${[...new Set(e.occ.map(e=>Um(e.node.instancePrimaryFill)?`#${e.node.instancePrimaryFill.hex} @ ${e.node.instancePrimaryFill.src}px`:``))].join(`, `)}) diverges from the ring ${u} minted for its first claimant; carried as component.overrides['background-image'], recomputed at THIS host's drawn radius`)):d&&n.notes.push(`${r}: per-instance ring observed on the LINKED instance but ${u}'s own value could not be resolved from the minted ledger â divergence unproven, ring override NOT carried (the instance renders the child's default), review`)}}if(i.has(`background-image`)&&!m){let i=e.occ.filter(e=>typeof e.node.imageFill==`string`);if(i.length>0){let a=!1,s=!1;e.occ.forEach((e,n)=>{if(typeof e.node.imageFill!=`string`)return;let r=o(`background-image`,t[n]);r===void 0?s=!0:r!==mp(e.node.imageFill)&&(a=!0)}),a?($(n,l,r,`background-image`,`gradient`,i.map(e=>({variant:e.variant,value:mp(e.node.imageFill)})),void 0,`none`),f=!0,n.notes.push(`${r}: PER-INSTANCE IMAGE OVERRIDE proposed (iteration 9) â the instance's own imageFill hash (dump v1.9) diverges from what ${u} renders for the applied props; carried as component.overrides['background-image'] (the child's declared overridable channel)`)):s&&n.notes.push(`${r}: per-instance image observed on the LINKED instance but ${u}'s own value could not be resolved from the minted ledger â divergence unproven, override NOT carried (the instance renders the child's default), review`)}}if(i.has(`size`)){let i=e.occ.filter(e=>e.node.bbox!==void 0);if(i.length===e.occ.length&&i.length>0)if(i.some(e=>Math.abs(e.node.bbox.width-e.node.bbox.height)>.5))n.notes.push(`${r}: observed instance box is NOT square â the size override channel carries ONE square custom property (glyph-box vocabulary); override not carried, review`);else{let i=!1;e.occ.forEach((e,n)=>{let r=o(`width`,t[n]),a=o(`height`,t[n]);
2785r===void 0||a===void 0||(Math.abs(e.node.bbox.width-parseFloat(r))>.5||Math.abs(e.node.bbox.height-parseFloat(a))>.5)&&(i=!0)});let a=t.some(e=>(o(`background-image`,e)??``).startsWith(`radial-gradient(`));i&&a&&!m?n.notes.push(`${r}: the observed box of the nested "${s}" diverges from ${u}'s minted box, but ${u} paints the RING WITNESS (baked radii) and this host's ring could not be recomputed from its own observation â box and ring carry together or not at all; size override NOT carried, review`):i&&($(n,l,r,`size`,`px`,e.occ.map(e=>({variant:e.variant,value:e.node.bbox.width}))),f=!0,n.notes.push(`${r}: PER-INSTANCE SIZE OVERRIDE proposed (iteration 9) â the observed box diverges from what ${u} renders for the applied props; carried as component.overrides['size'] (one square custom property driving the child root's width/height and any part bound to the same refs)`))}}if(i.has(`background-color`)){let i=e.occ.map(e=>{let t=e.node.instancePrimaryFill;return t&&t.stroke!==!0&&t.hex!==void 0&&t.var===void 0?`#${t.hex}`:void 0});if(i.length>0&&i.every(e=>e!==void 0)){let a=!1;e.occ.forEach((e,n)=>{let r=o(`background-color`,t[n]);r!==void 0&&r.toLowerCase()!==i[n].toLowerCase()&&(a=!0)}),a&&($(n,l,r,`background-color`,`color`,e.occ.map((e,t)=>({variant:e.variant,value:i[t]}))),f=!0,p=!0,n.notes.push(`${r}: PER-INSTANCE PAINT OVERRIDE proposed (iteration 9) â the observed instance paint (dump v1.7 instancePrimaryFill) diverges from ${u}'s own minted paint;
2785 carried as component.overrides['background-color']`))}}m&&(p=!0),f&&n.mint.refOverrides.push({component:d,target:l})}}if(n.mint&&u===null&&n.stubs.has(String(d.id))){let t=e.occ.map(e=>e.node.bbox),i=t.every(e=>e!==void 0&&Math.abs(e.width-e.height)<=.5),a=new Set(t.map(e=>e?.width)).size,o=new Map;for(let t of e.occ){let e=JSON.stringify(t.node.componentProperties??{});(o.get(e)??o.set(e,new Set).get(e)).add(t.node.bbox?.width??-1)}let c=[...o.values()].every(e=>e.size===1);if(i&&a>1&&!c){let i={};$(n,i,r,`size`,`px`,e.occ.map(e=>({variant:e.variant,value:e.node.bbox.width}))),n.mint.refOverrides.push({component:d,target:i}),n.notes.push(`${r}: PER-INSTANCE SIZE OVERRIDE proposed (round 10, SELF-CLAIMED stub) â this set is the claimant of "${s}"'s stub, so the stub does not exist yet and its minted box cannot be consulted; it carries ONE provisional box and this host drew ${a} (${[...new Set(t.map(e=>`${e.width}Ã${e.height}`))].join(`, `)}), which proves the divergence without the ledger. Carried as component.overrides['size']`)}}if(u&&!p){let t=up(e.occ,e=>e.instancePrimaryFill);t&&n.notes.push(`${r}: observed subtree paint (${t.var===void 0?`hex ${t.hex}`:`var ${t.var}`}, dump v1.7 instancePrimaryFill) on an instance LINKED to ${u} â the child contract owns its paint; a per-usage paint override is not representable on a component ref (ledgered, review if the linked contract's paint differs)`)}a.component=d;let m=Nm(e,`visible`,n,r);return m&&Rm(a,m,n,r,e),o&&!a.visibleWhen&&(a.visibleWhen=o),a}let s=t?.grid?.carried===!0&&!t.grid.flow&&e.occ.some(e=>e.node.abs!==void 0);if(Tm(e)&&!s){let i=om(e,!1,t,n,r);return i&&(a.layout=i),lm(a,um(e,n,r)),e.occ.some(e=>Ip(e.node)!==void 0)&&n.notes.push(`${r}: absolute placement captured (dump v1.7 \`abs\`) on a SPACER part â a spacer's job is in-flow growth; placement not carried (ledgered by name)`),o&&(a.visibleWhen=o),a}let c={map:{}},l={},u=Ep(e,!1,n,r,c,a,l);if(Object.keys(l).length>0&&(a.declared={...a.declared,...l}),bp(a,c),e.occ.some(e=>e.node.imageFill!==void 0)&&($(n,u,r,`background-image`,`gradient`,e.occ.map(e=>({variant:e.variant,value:mp(e.node.imageFill)})),void 0,`none`),e.occ.some(e=>typeof e.node.imageFill==`string`)&&hp(a)),e.occ.some(e=>e.node.shape!==void 0))return o&&(a.visibleWhen=o),Ap(e,a,n,r),Np(e)?(Pp(e,a,u,n,r),Lp(e,a,u,n,r,{size:!1})):Mp(e,a,n,r),Dp(e,a,u,n,r),kp(e,u,n,r),km(n,a,u),a;let d=e.children.length===1?e.children[0]:void 0,f=d?.type===`INSTANCE`?Nm(d,`mainComponent`,n,`${r}/${d.name}`):void 0;if(d&&f){let i=om(e,!1,t,n,r);i&&(a.layout=i),lm(a,um(e,n,r)),Dp(e,a,u,n,r),kp(e,u,n,r),km(n,a,u),nm(e,a,n,r);let s={name:jf(f)};Cm(s,f,n,r),wm(s,f,d,n,r);let c=Nm(e,`visible`,n,r),l=c===`Show ${f}`;return l?a.optional=!0:c&&Rm(a,c,n,r,e),a.slot=s,n.slots.push({part:a,property:f,optional:l}),o&&(a.visibleWhen=o),a}if(Em(e))return Dp(e,a,u,n,r),kp(e,u,n,r),Lp(e,a,u,n,r,{size:!0}),km(n,a,u),o&&(a.visibleWhen=o),a;let p=om(e,!1,t,n,r);p&&(a.layout=p),lm(a,um(e,n,r)),am(e,t,a,n,r),Dp(e,a,u,n,r),kp(e,u,n,r),Lp(e,a,u,n,r,{size:!0}),Fp(e,a,u,n,r),km(n,a,u),nm(e,a,n,r);let m=Nm(e,`visible`,n,r);m&&Rm(a,m,n,r,e);let h=Qp(e,n.mint!==void 0),g=Im(e.children,h,n,r,i);return Object.keys(g).length>0&&(a.parts=g),im(a,n,r),zp(a,g,e),o&&(a.visibleWhen=o),a}function Rm(e,t,n,r,i){let a=jf(t);if(!n.boolProps.some(e=>e.property===t)){let e=n.boolDefaults?.[t],o=i?.occ.find(e=>e.variant===n.totalVariants[0]),s=o?.node.hidden===!0;e===void 0?s?(n.boolProps.push({name:a,property:t,default:!1}),n.notes.push(`${r}: visibility bound to BOOLEAN "${t}" â proposed as prop \`${a}\` (default false: the node is hidden in the default variant, dump v1.1)`)):n.hiddenCaptured&&o?(n.boolProps.push({name:a,property:t,default:!0}),n.notes.push(`${r}: visibility bound to BOOLEAN "${t}" â proposed as prop \`${a}\` (default true: the node is visible in the default variant and this dump's producer captures visibility â dump v1.1+ provenance)`)):(n.boolProps.push({name:a,property:t}),n.notes.push(`${r}: visibility bound to BOOLEAN "${t}" â proposed as prop \`${a}\` (default not recoverable from dump v1, review)`)):(n.boolProps.push({name:a,property:t,default:e}),n.notes.push(`${r}: visibility bound to BOOLEAN "${t}" â proposed as prop \`${a}\` (default ${e}: the property definition's defaultValue, dump v1.5)`))}e.visibleWhen={prop:a}}function zm(e,t,n,r,i,a=!1,o){let s={},c=e=>{a||r.notes.push(e)},l=(n?r.contractsById?.get(n):void 0)??r.contractsById?.get(gm(e,r,o).id),u=0,d=0;for(let[n,r]of Object.entries(t)){let t=l?.props.find(e=>e.bindings.figma.property===n.split(`#`)[0]);if(t&&typeof r==`string`){let e=t.bindings.figma.values,n=e?Object.entries(e).find(([,e])=>e===r)?.[0]:void 0;if(n!==void 0){s[t.name]=t.type===`boolean`?n===`true`:n,u++;continue}}if(t&&typeof r==`string`&&!t.bindings.figma.values){s[t.name]=r,u++;continue}if(t&&typeof r==`boolean`){s[t.name]=r,u++;continue}if(l){d++,c(`${i}: applied prop "${n.split(`#`)[0]}" on nested "${e}" does not map through ${l.id}'s bindings â not carried; verify the child contract is current`);continue}let a=n.includes(`#`)&&typeof r==`string`;s[jf(n.split(`#`)[0])]=typeof r==`string`&&!a?Q(r):r}return l&&u===Object.keys(t).length?c(`${i}: fixed props of "${e}" canonicalized through ${l.id}'s bindings`):c(l?`${i}: fixed props of "${e}": ${u} canonicalized through ${l.id}'s bindings, ${d} dropped as unmappable (named per prop above)`:`${i}: fixed props of "${e}
2785" canonicalized by spelling (dump v1.1) â verify against the child contract's bindings`),s}function Bm(e,t){let n=[];for(let r of e){let e=r.children??[],i=e.map((e,t)=>({node:e,index:t})).filter(({node:e})=>e.type===`INSTANCE`&&!e.propRefs?.mainComponent&&hm(e.instanceOf??e.name,t)&&e.componentProperties!==void 0);if(i.length!==1)continue;let{node:a,index:o}=i[0];a.layout&&(r.layout=a.layout),a.cornerRadius!==void 0&&(r.cornerRadius=a.cornerRadius),a.fill&&(r.fill=a.fill),a.stroke&&(r.stroke=a.stroke,a.strokeWeight!==void 0&&(r.strokeWeight=a.strokeWeight)),a.bound&&(r.bound={...r.bound??{},...a.bound}),a.fillWidth!==void 0&&(r.fillWidth=a.fillWidth),a.opacity!==void 0&&(r.opacity=a.opacity),a.minWidth!==void 0&&(r.minWidth=a.minWidth),a.minHeight!==void 0&&(r.minHeight=a.minHeight),a.maxWidth!==void 0&&(r.maxWidth=a.maxWidth),a.maxHeight!==void 0&&(r.maxHeight=a.maxHeight),r.children=[...e.slice(0,o),...a.children??[],...e.slice(o+1)],n.push({variant:r.name,instanceOf:a.instanceOf??a.name,properties:a.componentProperties}),t.flattenedVariants.add(r.name)}if(n.length>0){let e=n[0].instanceOf;t.notes.push(`${t.setName}:root: ${n.length}/${t.totalVariants.length} variant(s) wrap an instance of the set's own base component "${e}" â flattened: the instance's styling and captured componentProperties speak for those variants (no self-referencing component ref; base component internals not captured â dump v1 stops at instances; anatomy reflects the wrapper)`)}return n}function Vm(e,t,n){if(e.length===0)return;let r=e[0].instanceOf,i=[];for(let t of e)for(let e of Object.keys(t.properties))i.includes(e)||i.push(e);for(let a of i){let i=a.split(`#`)[0],o=jf(i),s=e.map(e=>e.properties[a]).filter(e=>e!==void 0),c=s[0],l=[...new Set(s.map(e=>String(e)))];if(t.axes.some(e=>e.property===i||e.propName===o)){t.notes.push(`base instance "${r}": property "${i}" is one of the set's own variant axes (pinned to ${l.join(`, `)} in the flattened variant(s)) â not promoted`);continue}if(l.length>1&&t.notes.push(`base instance "${r}": property "${i}" varies across the flattened variants (${l.join(`, `)}) â default taken from the first`),typeof c==`boolean`){let e=t.boolProps.find(e=>e.property===i);if(e){e.default===void 0&&(e.default=c,t.notes.push(`prop \`${e.name}\`: default ${c} adopted from the base instance "${r}" (BOOLEAN property "${i}")`));continue}
2785if(n?.fillOnly)continue;t.boolProps.push({name:o,property:i,default:c}),t.notes.push(`prop \`${o}\`: promoted from the base instance "${r}" (BOOLEAN property "${i}", default ${c})`)}else if(a.includes(`#`)){if(t.textProps.some(e=>e.property===i)||n?.fillOnly)continue;jm(t,i,c,o),t.notes.push(`prop \`${o}\`: promoted from the base instance "${r}" (TEXT property "${i}", default "${c}")`)}else if(t.textProps.some(e=>e.property===i))continue;else n?.fillOnly||t.notes.push(`base instance "${r}": string property "${i}" = "${c}" not promoted â without a "#id" suffix it is indistinguishable from the base component's own VARIANT property; model it as an axis on the set if it belongs in the API`)}}function Hm(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];t&&typeof t==`object`&&r&&typeof r==`object`&&!(`$value`in r)?Hm(t,r):e[n]=r}}var Um=e=>typeof e==`object`&&!!e&&e.stroke===!0&&e.ellipse===!0&&typeof e.src==`number`&&e.hex!==void 0;function Wm(e){let t=e=>Math.round(e*100)/100,n=e.weight??1,r=e.src/2,i=e.align===`INSIDE`?r-n:e.align===`OUTSIDE`?r:r-n/2,a=e.align===`INSIDE`?r:e.align===`OUTSIDE`?r+n:r+n/2,o=xp(e);return`radial-gradient(circle, transparent ${t(i)}px, ${o} ${t(i)}px, ${o} ${t(a)}px, transparent ${t(a)}px)`}function Gm(e,t,n,r=null){if(!n.mint)return null;let i=r!==null&&r.kind!==`circleFill`,a=e.observed.filter(e=>e.bbox!==void 0);if(a.length===0)return null;let o=t.filter(e=>typeof e.type==`object`&&e.type!==null&&`enum`in e.type),s=o.map(e=>({propName:e.name,values:e.type.enum})),c=e=>{let t={};for(let n of o){let r=n.bindings.figma.property;for(let[i,a]of Object.entries(e.applied??{}))i.split(`#`)[0]===r&&typeof a==`string`&&(t[n.name]=Q(a))}return t},l=!i&&a.every(e=>e.stroke?.hex!==void 0&&typeof e.strokeWeight==`number`)&&new Set(a.map(e=>e.strokeWeight)).size===1;!i&&!l&&a.some(e=>e.stroke!==void 0)&&n.notes.push(`stub ${e.id}: stroke drawn on ${a.filter(e=>e.stroke).length}/${a.length} observed occurrence(s) (or var-bound/non-uniform) â border not carried on the stub geometry (presence is not a function of the stub's axes), review`);let u=[],d=(t,n,r,i)=>{let o=a.map(e=>({variant:e.variant,axisValues:c(e),value:r(e)}));o.some(e=>e.value===null)||u.push({nodePath:`stub ${e.id}`,part:``,cssProperty:t,kind:n,occurrences:o,...i===void 0?{}:{sparse:i}})};d(`width`,`px`,e=>Math.round(e.bbox.width*100)/100),d(`height`,`px`,e=>Math.round(e.bbox.height*100)/100);let f=e=>e.fill??e.instancePrimaryFill,p=e=>e.fill===void 0&&e.instancePrimaryFill?.stroke===!0,m=i?[]:a.filter(e=>f(e)!==void 0),h=m.filter(p),g=null,_=!1,v=!1;if(h.length>0&&h.length<m.length)n.notes.push(`stub ${e.id}: observed subtree paint is a STROKE on ${h.length}/${m.length} painted occurrence(s) and a FILL on the rest â one channel is not a function of the stub's axes; neither carried, review`);else if(h.length>0){let t=!l&&h.every(e=>{let t=f(e);return t.ellipse===!0&&typeof t.src==`number`&&t.hex!==void 0});l?n.notes.push(`stub ${e.id}: subtree stroke paint observed but the instance draws its OWN stroke (already carried as the border) â subtree stroke paint not carried, review`):t?(_=!0,d(`background-image`,`gradient`,e=>{let t=f(e);return t===void 0||!p(e)||!Um(t)?`none`:Wm(t)},`none`),n.notes.push(`stub ${e.id}: stroke source is a centered CIRCLE with an observed box (dump v1.7 \`ellipse\`/\`src\`) â the ring renders at the DRAWN radius as an exact radial-gradient band on the stub root (align-aware), not a border at the instance edge`)):n.notes.push(`stub ${e.id}: stroke-observed subtree paint (dump v1.7) but the drawn geometry is not derivable (stroke source is not a centered circle with an observed box) â nothing rendered for it; a box border around a glyph is invented geometry (refused by name, review)`),a.every(e=>Math.abs(e.bbox.width-e.bbox.height)<.5)&&!a.some(e=>(e.cornerRadius??0)!==0)&&h.every(e=>f(e).ellipse===!0)&&(n.instanceOverrides?v=!0:d(`border-radius`,`px`,e=>Math.round(e.bbox.width/2*100)/100),n.notes.push(`stub ${e.id}: circular stroke source on every observed occurrence (dump v1.7 stroke-aware walk) â circular border-radius derived from the observed box (${n.instanceOverrides?`spelled as the parametric 50% literal, correct under a host size override`:`width/2`}), the stub box renders round`))}else if(m.length>0&&m.every(e=>f(e).hex!==void 0))d(`background-color`,`color`,e=>{let t=f(e);return t?xp(t):`#00000000`});else if(m.length>0){let t=[...new Set(m.map(e=>f(e).var).filter(e=>e!==void 0))];t.length===1&&m.length===a.length&&m.every(e=>f(e).var!==void 0)?(g=Af(t[0]),n.notes.push(`stub ${e.id}: observed primary paint is bound to variable "${t[0]}" on every occurrence â background-color carried as ${g} (resolves through the captured-token layer; dump v1.7 instancePrimaryFill)`)):n.notes.push(`stub ${e.id}: observed paint var-bound on some occurrence(s) but not one variable across all â background not carried on the stub geometry, review`)}if(l&&(d(`border-color`,`color`,e=>e.stroke?xp(e.stroke):`#00000000`),d(`border-width`,`px`,e=>e.stroke?e.strokeWeight:0)),!i&&a.some(e=>(e.cornerRadius??0)!==0)&&d(`border-radius`,`px`,e=>e.cornerRadius??0),r?.kind===`circleFill`&&a.every(e=>Math.abs(e.bbox.width-e.bbox.height)<.5)&&!a.some(e=>(e.cornerRadius??0)!==0)&&(n.instanceOverrides?(v=!0,n.notes.push(`stub ${e.id}: exported glyph is a PURE CIRCLE FILL (iteration 8 witness) â the observed solid-fill path stays (the export bakes its source component's ink, which the observed per-usage paints contradict); the circular radius is spelled as the parametric border-radius: 50% literal (iteration 9 â value-identical to the witnessed width/2, and correct under a host's per-instance size override); the baked SVG is committed as the export receipt, not rendered`)):(d(`border-radius`,`px`,e=>Math.round(e.bbox.width/2*100)/100),n.notes.push(`stub ${e.id}: exported glyph is a PURE CIRCLE FILL (iteration 8 witness) â the observed solid-fill path stays (the export bakes its source component's ink, which the observed per-usage paints contradict) and the circular border-radius derives from the observed box (width/2); the baked SVG is committed as the export receipt, not rendered`))),!i&&a.some(e=>e.imageFill!==void 0)&&(d(`background-image`,`gradient`,e=>mp(e.imageFill),`none`),n.notes.push(a.some(e=>typeof e.imageFill==`string`)?`stub ${e.id}: IMAGE fill carried BY HASH (dump v1.9 \`imageFill\`) â the stub renders the exported asset (url('./assets/images/<hash>.png')); the placeholder gradient remains the fallback when the asset is absent`:`stub ${e.id}: IMAGE fill captured BY NAME only (dump v1.7 \`imageFill\`) â the image itself is NOT exported; the stub renders the neutral placeholder gradient (${pp}) in its place`)),u.length===0)return null;let y=`stub-${e.id.split(`.`).slice(1).join(`-`)}`,b=ru(y,u,s),x=[`width`,`height`].map(e=>u.findIndex(t=>t.cssProperty===e));if(x.every(e=>e>=0&&!b.bindings[e].ref)){for(let e of x)u[e]={...u[e],occurrences:[u[e].occurrences[0]]};b=ru(y,u,s),n.notes.push(`stub ${e.id}: the observed box is not a function of the stub's own axes (${[...new Set(a.map(e=>`${e.bbox.width}Ã${e.bbox.height}`))].join(`, `)} across ${a.length} occurrence(s)) â the PROVISIONAL box falls back to the base occurrence (${u[x[0]].occurrences[0].value}Ã${u[x[1]].occurrences[0].value}px), which is what makes the box overridable: a host whose own observation diverges carries it per usage through component.overrides['size']. Without the fallback the channel drops and the glyph draws at its export size in every box`)}let S={};
2785return b.bindings.forEach((t,r)=>{t.ref?S[u[r].cssProperty]=t.ref:t.reason&&n.notes.push(`stub ${e.id} ${u[r].cssProperty}: ${t.reason}`)}),g!==null&&(S[`background-color`]=g),Object.keys(S).length===0&&!v?null:{tokens:S,tree:b.tree,count:b.count,entries:b.entries,circleRadius50:v,ringWitness:_}}function Km(e,t,n){if(!n.iconAssets||e.observed.length===0)return null;let r=[],i=0;for(let t of e.observed){let e=t.instanceKey===void 0?void 0:n.iconAssets.get(t.instanceKey);e&&i++,r.push(e)}if(i===0)return null;if(i<e.observed.length)return n.notes.push(`stub ${e.id}: exported glyph assets cover ${i}/${e.observed.length} observed occurrence(s) â glyph not carried (partial evidence), witness geometry stands; review`),null;if(r.every(e=>e.circleFill===!0))return{kind:`circleFill`};let a={width:r[0].naturalWidth,height:r[0].naturalHeight},o=[...new Set(r.map(e=>e.asset))];if(o.length===1)return{kind:`fixed`,asset:o[0],natural:a};let s=t.filter(e=>typeof e.type==`object`&&e.type!==null&&`enum`in e.type),c=[];for(let t of s){let n=t.bindings.figma.property,i=!0;for(let t=0;t<e.observed.length;t++){let a=e.observed[t].applied??{},o;for(let[e,t]of Object.entries(a))e.split(`#`)[0]===n&&typeof t==`string`&&(o=Q(t));if(o===void 0||o!==r[t].asset){i=!1;break}}i&&c.push(String(t.name))}return c.length===1?{kind:`byProp`,prop:c[0],natural:a}:(n.notes.push(`stub ${e.id}: ${o.length} exported glyph assets across occurrences but the choice is not a function of exactly one variant axis with value-named assets${c.length>1?` (ambiguous axes: ${c.join(`, `)})`:``} â glyph not carried, witness geometry stands; review`),null)}function qm(e,t,n){let r=new Map;for(let t of e.applied)for(let[e,n]of Object.entries(t)){let t=e.split(`#`)[0],i=r.get(t)??{suffixed:e.includes(`#`),values:[]};i.values.push(n),r.set(t,i)}let i=[];for(let[e,{suffixed:t,values:n}]of r){let r=jf(e),a=n[0];if(typeof a==`boolean`)i.push({name:r,type:`boolean`,default:a,bindings:{figma:{kind:`BOOLEAN`,property:e},code:{prop:r}}});else if(t)i.push({name:r,type:`text`,default:a,bindings:{figma:{kind:`TEXT`,property:e},code:{prop:r}}});else{let t=new Map;for(let e of n)typeof e==`string`&&!t.has(Q(e))&&t.set(Q(e),e);i.push({name:r,type:{enum:[...t.keys()]},default:Q(String(a)),bindings:{figma:{kind:`VARIANT`,property:e,values:Object.fromEntries(t)},code:{prop:r}}})}}let a=If(e.instanceOf),o=Km(e,i,t),s=Gm(e,i,t,o),c={},l=i.find(e=>e.type===`text`);if(c.parts=l?{[String(l.name)]:{content:{prop:String(l.name)}}}:{},o&&o.kind!==`circleFill`){let n=s!==null&&s.tokens.width!==void 0&&s.tokens.height!==void 0,r={asset:o.kind===`byProp`?`{${o.prop}}`:o.asset,...n?{}:{size:o.natural.width}};c.parts.glyph={icon:r,...n?{tokens:{width:s.tokens.width,height:s.tokens.height}}:{}},t.notes.push(`stub ${e.id}: renders the EXPORTED VECTOR GLYPH (iteration 8 â SVG exported at 1x from the stub source's main component, assets/icons/${o.kind===`byProp`?`<${o.prop}>`:o.asset}.svg${o.kind===`byProp`?`, selected by the stub's "${o.prop}" prop via the {prop} enum-expansion convention`:``}) ${n?`scaled to the minted observed box`:`at the export's own ${o.natural.width}Ã${o.natural.height}px (no minted box)`}; witness paint channels are NOT minted (the svg bakes the drawn ink) and per-usage ink divergence, if any, stays with the export's baked colors â import the real child set to replace the stub`)}if(s){if(Object.keys(s.tokens).length>0&&(c.tokens=s.tokens),s.circleRadius50&&(c.literals={"border-radius":`50%`}),s.tokens[`background-image`]&&e.observed.some(e=>typeof e.imageFill==`string`)&&hp(c),t.instanceOverrides){let n=s.entries.some(e=>e.ref.includes(`.background-image`)&&!/^(url\(|none$)/.test(String(e.value))),r=!!s.ringWitness&&s.tokens[`background-image`]!==void 0,i=[];s.tokens.width!==void 0&&s.tokens.height!==void 0&&(!n||r)&&i.push(`size`),s.tokens[`background-image`]!==void 0&&(!n||r)&&i.push(`background-image`),s.tokens[`background-color`]!==void 0&&i.push(`background-color`),i.length>0?(c.overridable=i,t.notes.push(r?`stub ${e.id}: overridable [${i.join(`, `)}] declared (round 7) â the minted background-image is the RING WITNESS, whose baked radii are a function of the same observation as the box, so a host overrides the ring and the box TOGETHER (either alone is refused by name on the host side); absent an override the stub renders its own minted values unchanged`:`stub ${e.id}: overridable [${i.join(`, `)}] declared (iteration 9) â a host whose OBSERVED per-instance facts diverge from this stub's minted ones may override them per usage; absent an override the stub renders its own minted values unchanged`)):n&&t.notes.push(`stub ${e.id}: overridable NOT declared â the minted background-image bakes drawn-geometry px and is NOT the ring witness (whose radii are recomputable per usage); a per-instance size/image override would tear the baked geometry, so host divergence stays a named note`)}t.notes.push(`stub ${e.id}
2785: renders HONEST OBSERVED GEOMETRY (dump v1.5 bounding box${s.tokens[`background-color`]?` + primary paint`:``}${s.tokens[`border-color`]?` + border`:``}) via minted imported.stub-* tokens â a correctly-sized box, NOT the child's anatomy (still not captured); import the real child set to replace it`)}return{contract:{$schema:`./contract.schema.json`,id:e.id,name:a,version:`0.1.0`,status:`draft`,description:`STUB contract auto-proposed for the nested "${e.instanceOf}" instances of ${t.setName} â the child set was not imported. Props are the observed applied values ONLY; anatomy and styling are NOT captured (dump v1 stops at instance boundaries)${s?`; the root renders the OBSERVED bounding box and primary paint (dump v1.5) as honest provisional geometry`:``}${o&&o.kind!==`circleFill`?`; the root renders the source component's exported vector glyph (SVG, iteration 8) in place of witness paints`:``}. Import the child set to replace this stub.`,semantics:{element:`span`},props:i,states:[],anatomy:{root:c},anchors:{figma:{fileKey:n,componentSetKey:e.setKey??null},code:{importPath:`src/components/${a}`,export:a}}},geometry:s}}function Jm(e,t,n,r,i){if(!r.mint)return;let a=e.occ.filter(e=>e.node.bbox!==void 0);if(a.length===0)return;if(a.length!==e.occ.length){r.notes.push(`${i}: root bbox captured on ${a.length}/${e.occ.length} variant(s) only â fixed root size not proposed (partial evidence), review`);return}let o=(e,t)=>{let n=e.node.layout;return n?(n.mode===`HORIZONTAL`==(t===`width`)?n.primarySizing:n.counterSizing)===`FIXED`:!0};for(let s of[`width`,`height`]){let c=a.filter(e=>o(e,s));if(!(n[s]!==void 0||e.occ.some(e=>e.node.bound?.[s]))){if(c.length===0){let e=t.literals??{};if(e[s]!==void 0)continue;e[s]=`fit-content`,t.literals=e,r.notes.push(`${i}: root ${s} HUGS in every variant â carried as the literal \`${s}: fit-content\` (v16 grammar), the CSS twin of Figma HUG. The drawn ${[...new Set(a.map(e=>e.node.bbox[s]))].join(`/`)}px is a measurement of the DEFAULT content, not a design value, so it is NOT minted; the emitted box is content-sized and no longer cross-stretches when this component is nested inside another`);continue}if(c.length!==a.length){$(r,n,i,s,`size`,a.map(e=>({variant:e.variant,value:o(e,s)?Math.round(e.node.bbox[s]*100)/100:`fit-content`}))),r.notes.push(`${i}: root ${s} is DRAWN FIXED in ${c.length}/${a.length} variants and HUG in the rest â minted as root ${s} with the fixed planes' observed bbox and \`fit-content\` on the hug planes (the sizing MODE each plane actually draws; a pinned hug measure would freeze a box sized for the DEFAULT content and clip or float whatever a host puts in it)`);continue}$(r,n,i,s,`px`,a.map(e=>({variant:e.variant,value:Math.round(e.node.bbox[s]*100)/100}))),r.notes.push(`${i}: root ${s} is DRAWN FIXED in every variant â the observed dimension (${[...new Set(a.map(e=>e.node.bbox[s]))].join(`/`)}px, dump v1.5 bbox) is proposed as a minted root token (the drawn value is the only witness; rename against your real tokens)`)}}}var Ym=e=>e===void 0?`none`:e.var===void 0?`hex:${xp(e)}`:`var:${e.var}`;function Xm(e,t,n,r,i,a,o,s){e.mint&&e.mint.observations.push({nodePath:s?`${e.setName}:root/${s} (state ${n})`:`${e.setName}:root (state ${n})`,part:s?`${s}/state-${n}`:`state-${n}`,cssProperty:r,kind:i,occurrences:a.map(t=>({variant:t.variant,axisValues:e.mint.axisValuesByVariant.get(t.variant)??{},value:t.value})),target:t,source:o})}function Zm(e,t,n,r,i,a,o,s,c,l,u){let d=`${e.setName}:root`,f=n.filter(e=>!r.get(e.name));f.length>0&&e.notes.push(`${d}: state "${t}" variant(s) ${f.map(e=>e.name).join(`, `)} have no matching default-state variant â state diffs skipped for them, review`);let p=n.filter(e=>r.has(e.name)).map(e=>({variant:e.name,node:e,base:r.get(e.name)}));if(p.length===0)return;let m=(n,r,i)=>{if(!p.some(e=>Ym(i(e.node))!==Ym(i(e.base))))return;let s=p.map(e=>({variant:e.variant,paint:i(e.node)}));if(s.some(e=>e.paint===void 0)){e.notes.push(`${d}: ${r} differs in state "${t}" but is absent in some of its variant(s) â a state override cannot unset a channel; NAMED, not proposed (review)`);return}if(s.every(e=>e.paint.var!==void 0)){let i=tp(s.map(e=>({variant:e.variant,path:kf(e.paint.var)})),e.axes);if(i.kind===`ref`)i.ref!==a[n]&&(o[n]=i.ref);else if(i.kind===`per-value`)if(u){for(let[e,t]of Object.entries(i.perValue.byValue))((u[i.perValue.propName]??={})[e]??={})[n]=t;e.notes.push(`${d} ${r} (state ${t}): bindings are a function of variant axis "${i.perValue.propName}" by VALUE (${Object.entries(i.perValue.byValue).map(([e,t])=>`${e}=${t}`).join(`, `)}
2785) â carried as statesByProp (v17; the token names do not spell the axis values, so neither a substituted ref nor a single state ref can carry them)`)}else e.notes.push(`${d} ${r} (state ${t}): bindings are a function of an enum axis by value and no statesByProp collector was supplied â NAMED, not proposed (review)`);else i.kind===`drift`&&e.notes.push(`${d} ${r} (state ${t}): ${i.detail}`);return}if(s.every(e=>e.paint.hex!==void 0)){dp(e,`${d} (state ${t})`,r,xp(s[0].paint)),Xm(e,o,t,n,`color`,s.map(e=>({variant:e.variant,value:xp(e.paint)})),`${d} (state ${t})|${r}`),e.mint||e.notes.push(`${d}: ${r} changes in state "${t}" (${xp(s[0].paint)}) â a literal state override needs minting (mintUnbound); NAMED, not proposed`);return}e.notes.push(`${d}: ${r} in state "${t}" mixes bound and raw paints across variants â not proposed, review`)},h=(n,r,i,a,s,c)=>{let l=e=>a(e)??s;if(p.some(e=>l(e.node)!==l(e.base))){if(p.some(e=>c.some(t=>e.node.bound?.[t]!==void 0||e.base.bound?.[t]!==void 0))){e.notes.push(`${d}: ${r} differs in state "${t}" with bound variables in play â bound number-channel state inversion is not implemented; NAMED, review`);return}dp(e,`${d} (state ${t})`,r,l(p[0].node)),Xm(e,o,t,n,i,p.map(e=>({variant:e.variant,value:l(e.node)})),`${d} (state ${t})|${r}`),e.mint||e.notes.push(`${d}: ${r} changes in state "${t}" â a literal state override needs minting (mintUnbound); NAMED, not proposed`)}};if(m(`background-color`,`fill`,e=>e.type===`TEXT`?void 0:e.fill),m(`border-color`,`stroke`,e=>e.stroke),h(`border-width`,`strokeWeight`,`px`,e=>e.strokeWeight,0,[`strokeWeight`,`strokeTopWeight`,`strokeRightWeight`,`strokeBottomWeight`,`strokeLeftWeight`]),h(`border-radius`,`cornerRadius`,`px`,e=>e.cornerRadius,0,[`topLeftRadius`,`topRightRadius`,`bottomLeftRadius`,`bottomRightRadius`]),h(`opacity`,`opacity`,`number`,e=>e.opacity,1,[`opacity`]),a[`border-color`]===void 0&&a[`border-width`]===void 0){let n=o[`border-color`]!==void 0||o[`border-width`]!==void 0;if(n&&t===`focus-visible`){for(let[e,t]of[[`border-color`,`outline-color`],[`border-width`,`outline-width`]])o[e]!==void 0&&(o[t]=o[e],delete o[e]);Qm(e,o,t),e.notes.push(`${d}: state "${t}" adds a border the base does not draw â proposed as the focus OUTLINE pair (outline-color/outline-width; the generators' focus boilerplate carries outline-style + offset), review`)}else n&&(delete o[`border-color`],delete o[`border-width`],$m(e,o,t,[`border-color`,`border-width`]),e.notes.push(`${d}: state "${t}" adds a border the base does not draw â the base rule sets border: 0 and a state override cannot add border-style; NAMED, not proposed (review)`))}let g=new Map;for(let e of p)for(let t of e.node.children??[]){if(i.has(t.name))continue;let n=g.get(t.name)??[];n.push({variant:e.variant,node:t}),g.set(t.name,n)}for(let[n,r]of g){let i=`${d}/${n}`,a=r.map(e=>e.node);
2785if(a.every(e=>e.hidden===!0)){e.notes.push(`${i}: drawn only in state "${t}" variants and hidden â design-time helper, not proposed (review)`);continue}let s=a.every(e=>e.stroke!==void 0&&(e.children??[]).length===0&&e.text===void 0);if(t===`focus-visible`&&s){if(a.every(e=>e.stroke.var!==void 0)){let t=[...new Set(a.map(e=>kf(e.stroke.var)))];t.length===1?o[`outline-color`]=`{${t[0]}}`:e.notes.push(`${i}: focus-ring stroke binds differently across variants (${t.join(` vs `)}) â not proposed, review`)}else a.every(e=>e.stroke.hex!==void 0)&&(Xm(e,o,t,`outline-color`,`color`,r.map(e=>({variant:e.variant,value:xp(e.node.stroke)})),`${i} (state ${t})|stroke`),dp(e,`${i} (state ${t})`,`stroke`,xp(a[0].stroke)));a.some(e=>e.strokeWeight!==void 0)&&(Xm(e,o,t,`outline-width`,`px`,r.map(e=>({variant:e.variant,value:e.node.strokeWeight??0})),`${i} (state ${t})|strokeWeight`),dp(e,`${i} (state ${t})`,`strokeWeight`,a[0].strokeWeight??0)),e.notes.push(`${i}: drawn only in the focus state and carries a stroke â inverted to focus-visible outline overrides (outline-color/outline-width); its own corner radius is not carried (the outline follows the root's shape + offset), review`);continue}e.notes.push(`${i}: present only in state "${t}" variants â per-state anatomy has no contract vocabulary; NAMED, not proposed (review)`)}let _=new Map;for(let e of p)for(let t of e.node.children??[]){let n=(e.base.children??[]).find(e=>e.name===t.name);if(!n)continue;let r=_.get(t.name)??[];r.push({variant:e.variant,node:t,base:n}),_.set(t.name,r)}for(let[n,r]of _){let i=r.every(e=>e.node.type===`TEXT`)?[{cssProp:`color`,paintName:`fill`,pick:e=>e.fill}]:[{cssProp:`background-color`,paintName:`fill`,pick:e=>e.fill},{cssProp:`border-color`,paintName:`stroke`,pick:e=>e.stroke}];for(let a of i){if(!r.some(e=>Ym(a.pick(e.node))!==Ym(a.pick(e.base))))continue;let i=`${d}/${n}`,o=c?.get(n),u=o!==void 0&&s?s[o]:void 0,f=o;if(!u&&s){let e=[],t=(r,i)=>{for(let[a,o]of Object.entries(r??{})){let r=o;a===n&&e.push({rec:r,path:[...i,a].join(`/`)}),t(r?.parts,[...i,a])}};t(s,[]),e.length===1&&(u=e[0].rec,f=e[0].path)}if(!u||!l){e.notes.push(`${i}: ${a.paintName} differs in state "${t}" but no anatomy part maps to this drawn child â NAMED, not proposed (review)`);continue}if(u.component!==void 0||u.slot!==void 0||u.repeat!==void 0){e.notes.push(`${i}: ${a.paintName} differs in state "${t}" on a ${u.slot===void 0?`component-ref`:`slot`} part â the child contract owns its styling (part-level state overrides carry on text/icon/box parts only, v13); NAMED, not proposed (review)`);continue}let p=l.find(e=>e.part===u&&e.state===t);p||(p={part:u,state:t,target:{},byProp:{}},l.push(p));let m=r.map(e=>({variant:e.variant,paint:a.pick(e.node)}));if(m.some(e=>e.paint===void 0)){e.notes.push(`${i}: ${a.paintName} differs in state "${t}" but is absent in some of its variant(s) â a state override cannot unset a channel; NAMED, not proposed (review)`);continue}let h=u.tokens??{};if(m.every(e=>e.paint.var!==void 0)){let n=tp(m.map(e=>({variant:e.variant,path:kf(e.paint.var)})),e.axes);if(n.kind===`ref`)n.ref!==h[a.cssProp]&&(p.target[a.cssProp]=n.ref);else if(n.kind===`per-value`){for(let[e,t]of Object.entries(n.perValue.byValue))((p.byProp[n.perValue.propName]??={})[e]??={})[a.cssProp]=t;e.notes.push(`${i} ${a.paintName} (state ${t}): bindings are a function of variant axis "${n.perValue.propName}" by VALUE (${Object.entries(n.perValue.byValue).map(([e,t])=>`${e}=${t}`).join(`, `)}) â carried as statesByProp (v17)`)}else n.kind===`drift`&&e.notes.push(`${i} ${a.paintName} (state ${t}): ${n.detail}`);continue}if(m.every(e=>e.paint.hex!==void 0)){dp(e,`${i} (state ${t})`,a.paintName,xp(m[0].paint)),Xm(e,p.target,t,a.cssProp,`color`,m.map(e=>({variant:e.variant,value:xp(e.paint)})),`${i} (state ${t})|${a.paintName}`,f),e.mint||e.notes.push(`${i}: ${a.paintName} changes in state "${t}" (${xp(m[0].paint)}) â a literal part-state override needs minting (mintUnbound); NAMED, not proposed`);continue}e.notes.push(`${i}: ${a.paintName} in state "${t}" mixes bound and raw paints across variants â not proposed, review`)}}}function Qm(e,t,n){if(e.mint)for(let r of e.mint.observations)r.target!==t||r.part!==`state-${n}`||(r.cssProperty===`border-color`&&(r.cssProperty=`outline-color`),r.cssProperty===`border-width`&&(r.cssProperty=`outline-width`))}function $m(e,t,n,r){e.mint&&(e.mint.observations=e.mint.observations.filter(e=>!(e.target===t&&e.part===`state-${n}`&&r.includes(e.cssProperty))))}function eh(e,t){let n=t.projectionMode??`exact`,r=Of(e),i=op(e);(n===`exact`||r.status===`refused`&&r.code!==`EXACT_DEFINITIONS_MISSING`)&&ap(r,`source-matrix-verified`);let a=t.prefix??`ds`,o=[];{let t=new Set,n=e=>{let r=[...Object.values(e.bound??{}),e.fill?.var,e.stroke?.var,e.text?.fillVar,e.instancePrimaryFill?.var,...e.gradient?.stops.map(e=>e.var)??[]];for(let e of r)e!==void 0&&e.includes(`â¤`)&&t.add(e);for(let t of e.children??[])n(t)};for(let t of e.variants)n(t);for(let e of[...t].sort())o.push(`variable name "${e}" contains U+2024 ONE DOT LEADER â folded to '-' and carried as {${ou(e).path}} everywhere it binds (dump v1.16 fold rule; a RENAME relative to the canvas variable, which keeps its own spelling): rename the variable to match, or remap manually. A fold target another variable already owns refuses registration at the captured-token layer by name`)}let s=Jf(zf(e.variants.map(e=>e.name)),e.variants,e.setName,o);n===`exact`&&s&&sp(r,s.axis,`token-mode`);let c=e.variants;s&&(c=e.variants.filter(e=>Rf(e.name)[s.axis.property]===s.defaultValue).map(t=>({...JSON.parse(JSON.stringify(t)),name:Wf(t.name,s.axis.property,e.setName)})),o.push(`variant axis "${s.axis.property}" (${s.axis.values.join(`|`)}) IS a token-mode axis, not API (§3 â structurally corroborated: identical anatomy and bound variable NAMES across the axis; only color-kind literals/resolved values differ) â excluded from props; anatomy and facts build from the ${c.length} "${s.defaultValue}" (default-mode) variant(s) only; bindings resolve per mode through the variable collection (the captured-token layer carries per-mode values when the dump provides them â dump v1.6 \`modes\`); other modes' resolved literals are NOT minted (a dark-mode hex minting imported.* tokens would fabricate a second palette). Rename story: regeneration draws the default mode only â the axis spelling lives in this note and on the source set, and the contract's \`modes\` metadata names the modes`));let l=Uf(zf(c.map(e=>e.name)),o),u=null,d=new Map,f=[];if(l){let t=l,a=e=>Rf(e.name)[t.axis.property];if(c.some(e=>a(e)===void 0))o.push(`variant axis "${t.axis.property}": interaction-state axis detected but some variant names omit the pair â promotion unsafe, axis kept as an enum prop; review`),l=null;else{let s=i!==null&&i.axis===t.axis.property;n===`exact`&&!s&&sp(r,t.axis,`interaction-state`);let l=n=>({...JSON.parse(JSON.stringify(n)),name:Wf(n.name,t.axis.property,e.setName)});u=c.filter(e=>a(e)===t.defaultValue).map(l);for(let e of t.promoted)d.set(e.state,c.filter(t=>a(t)===e.value).map(l));t.disabledValue!==void 0&&(f=c.filter(e=>a(e)===t.disabledValue).map(l)),o.push(`variant axis "${t.axis.property}" (${t.axis.values.join(`|`)}) IS the platform's interaction states, not API â promoted: the axis is NOT a prop; anatomy and base facts come from the ${u.length} default-state variant(s); ${t.promoted.map(e=>`${e.value}â${e.state}`).join(`, `)} propose root state overrides${t.disabledValue===void 0?``:`; ${t.disabledValue}â a \`disabled\` BOOLEAN prop + disabled state block`}`)}}let p=(u??c).map(e=>e.name),m=zf(p),h=m.filter(e=>!Bf(e.values)),g=`${a}.${Pf(e.setName)}`,_=g,v=e.key??null;if(t.sessionClaimedIds&&v!==null){let e=e=>{if(!t.sessionClaimedIds.has(e))return!1;let n=t.contractsById?.get(e)?.anchors?.figma?.componentSetKey??null;return n!==null&&n!==v};for(let t=2;e(_);t+=1)_=`${g}-${t}`;_!==g&&o.push(`contract id: "${g}" is already claimed in this session by a DIFFERENT drawn component (its componentSetKey contradicts this set's key ${v}) â proposed as "${_}" (deterministic arrival-order suffix, the stubIdFor contradicting-key discipline at proposal time; without it the session registry would rebind the earlier import's child refs onto this contract and the referee reports a cycle that is not drawn). Rename either component to reclaim the base id`)}let y={setName:e.setName,axes:m,totalVariants:p,corpus:t.corpus,contractIdByName:t.contractIdByName,contractsById:t.contractsById,contractIdByKey:t.contractIdByKey,swapPreferredValues:e.swapPreferredValues,boolDefaults:e.boolDefaults,slotDescriptions:e.slotDescriptions,hiddenCaptured:t.hiddenCaptured,capturedValues:t.capturedValues,iconAssets:t.iconAssets,instanceOverrides:t.instanceOverrides,prefix:a,selfId:_,notes:[],unbound:[],textProps:[],boolProps:[],arrayProps:[],slots:[],flattenedVariants:new Set,stubs:new Map,partNames:new Set([`root`]),drawnByThisPipeline:!!(e.propNames||e.semantics||e.statePreviewAxis),...(()=>{let t=e.propNames;if(typeof t!=`object`||!t||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&e&&r&&(n[e]=r);return Object.keys(n).length>0?{propNames:n}:{}})(),projectionMode:n,mint:t.mintUnbound?{axes:[...h.map(e=>({propName:e.propName,values:e.values.map(Q)})),...m.filter(e=>Bf(e.values)).map(e=>({propName:e.propName,values:[`true`,`false`],bool:!0}))],axisValuesByVariant:new Map(p.map(e=>{let t={};for(let[n,r]of Object.entries(Rf(e))){let e=m.find(e=>e.property===n);e&&(t[e.propName]=Bf(e.values)?r.trim().toLowerCase():Q(r))}return[e,t]})),observations:[],partialSources:new Set,attach:[],absFallbacks:[],refOverrides:[]}:void 0};y.notes.push(...o);let b=u??JSON.parse(JSON.stringify(c)),x=Bm(b,y),S=[];if(l){let t={...y,notes:[],flattenedVariants:new Set};for(let e of[...d.values(),f])S.push(...Bm(e,t));S.length>0&&y.notes.push(`${e.setName}: ${S.length} state-axis variant(s) wrapped an instance of the set's own base component â flattened before state diffing (same rule as the default variants); their captured componentProperties only FILL defaults of props the base anatomy already discovered`)}let C=$f(`root`,b.map(e=>({variant:e.name,node:e})),y.notes,`${e.setName}:root`),w=`${e.setName}:root`;if(t.textOverrideDemand){let n=new Set([...e.key?t.textOverrideDemand.get(e.key)??[]:[],...t.textOverrideDemand.get(e.setName)??[]]);n.size>0&&(y.textPromote=Mm(C,n,y))}let T={},E=new Map,ee=om(C,!0,null,y,w);ee&&(T.layout=ee),lm(T,um(C,y,w));let te={map:{}},ne={},D=Ep(C,!0,y,w,te,void 0,ne);Object.keys(ne).length>0&&(T.declared={...T.declared,...ne}),C.occ.some(e=>e.node.imageFill!==void 0)&&(y.notes.push(C.occ.some(e=>typeof e.node.imageFill==`string`)?`${w}: IMAGE fill carried BY HASH (dump v1.9 \`imageFill\`) â the root renders the exported asset (url('./assets/images/<hash>.png')) where the image is drawn; the placeholder gradient remains the fallback when the asset is absent`:`${w}: IMAGE fill captured BY NAME only (dump v1.7 \`imageFill\`) â the image itself is NOT exported (a later round exports the asset); the root renders the neutral placeholder gradient (${pp}) where the image is drawn`),$(y,D,w,`background-image`,`gradient`,C.occ.map(e=>({variant:e.variant,value:mp(e.node.imageFill)})),void 0,`none`),C.occ.some(e=>typeof e.node.imageFill==`string`)&&hp(T));let O=C.children.length===1?C.children[0]:void 0,re=O&&O.type===`TEXT`&&O.name===`label`&&Nm(O,`characters`,y,`${w}/label`);if(O&&re){let e=Jp(O,y,`${w}/label`,te);if(Object.assign(D,e),qp(O,T,y,`${w}/label`),y.mint)for(let t of y.mint.observations)t.target===e&&(t.target=D);jm(y,re,up(O.occ,e=>e.text?.characters)??``,`children`),y.notes.push(`${w}/label: sole root text node named "label" is the generator's auto-injected children label â hoisted to root tokens, bound prop proposed as \`children\``)}else{let e=Qp(C,y.mint!==void 0),t=Im(C.children,e,y,w,`root`,E);Object.keys(t).length>0&&(T.parts=t),im(T,y,w),zp(T,t,null)}Dp(C,T,D,y,w),kp(C,D,y,w),Jm(C,T,D,y,w),nm(C,T,y,w),bp(T,te),km(y,T,D);{let t=y.textOverridesVisited,n=new Map,r=e=>{for(let[r,i]of Object.entries(e.textOverrides??{}))t?.has(`${r} ${i}`)||(n.get(r)??n.set(r,new Set).get(r)).add(i);for(let t of e.children??[])r(t)};for(let t of e.variants)r(t);n.size>0&&y.notes.push(`${e.setName}: ${[...n.values()].reduce((e,t)=>
2785e+t.size,0)} observed character override(s) in this set's dump were NOT carried because no proposed part reaches the instance that holds them (${[...n].map(([e,t])=>`"${e}" = ${[...t].sort().map(e=>JSON.stringify(e)).join(`/`)}`).join(`; `)}) â the usual cause is a part that lives only in variants the proposal excludes (an interaction-state group, a filtered mode); named here so the absence is never read as "nothing was drawn"`)}Vm(x,y),Vm(S,y,{fillOnly:!0});let ie={},ae={},oe=[];if(l){let e=new Map(b.map(e=>[e.name,e])),t=new Set;for(let e of b)for(let n of e.children??[])t.add(n.name);let n=[...d.entries()];f.length>0&&n.push([`disabled`,f]);for(let[r,i]of n){let n=ie[r]??={},a=ae[r]??={};Zm(y,r,i,e,t,D,n,T.parts??{},E,oe,a)}l.disabledValue!==void 0&&(y.boolProps.some(e=>e.name===`disabled`)?y.notes.push(`prop \`disabled\`: axis value "${l.axis.property}=${l.disabledValue}" maps to the disabled state but a \`disabled\` boolean already exists â not re-promoted, review`):(y.boolProps.push({name:`disabled`,property:`Disabled`,default:!1}),y.notes.push(`prop \`disabled\`: promoted from axis value "${l.axis.property}=${l.disabledValue}" â a BOOLEAN prop (native disabled attribute on interactive elements), bound to design property "Disabled" (the forward generator's spelling; the imported set spelled it as an axis value â rename consequence documented here)`)))}let k=y.slots.find(e=>!e.optional);for(let e of y.slots){let t=e===k?`children`:jf(e.property),n=e.part.slot;n.name=t,Ol(t)!==e.property&&(n.figmaProperty=e.property),Mf(e.property)&&y.notes.push(`slot \`${t}\`: Figma property "${e.property}" contains characters outside a legal identifier â name sanitized at proposal; the original spelling stays the design binding (slot.figmaProperty)`),e!==k&&Nf(e.property)&&y.notes.push(`slot \`${t}\`: Figma property "${e.property}" is digit-led â a code identifier cannot start with a digit, so the name gets the deterministic "p" prefix (the componentIdSlug digit-led discipline); the original spelling stays the design binding (slot.figmaProperty)`),e===k&&y.notes.push(`slot "${e.property}": first non-optional slot in tree order â judged the DEFAULT slot (name \`children\`); rename if it is not the main content`)}let A=[];for(let e of m){if(Bf(e.values)){A.push({name:e.propName,type:`boolean`,default:Q(e.values[0])===`true`,bindings:{figma:{kind:`VARIANT`,property:e.property,values:Object.fromEntries(e.values.map(e=>[Q(e),e]))},code:{prop:e.propName}}}),y.notes.push(`prop \`${e.propName}\`: true/false variant axis proposed as a boolean (extract/reconcile.ts boolâaxis rule)`);continue}A.push({name:e.propName,type:{enum:e.values.map(Q)},default:Q(e.values[0]),bindings:{figma:{kind:`VARIANT`,property:e.property,values:Object.fromEntries(e.values.map(e=>[Q(e),e]))},code:{prop:e.propName}}}),e.values.length===2&&y.notes.push(`prop \`${e.propName}\`: two-value axis [${e.values.join(`, `)}] kept as an ENUM (both states render truthfully on both surfaces); a code boolean is a compatible code-side binding â see extract/reconcile.ts boolâaxis treatment`)}for(let e of y.textProps)A.push({name:e.name,type:`text`,default:e.default,bindings:{figma:e.figmaless?{kind:`NONE`}:{kind:`TEXT`,property:e.property},code:{prop:e.name}}});for(let e of y.boolProps)A.push({name:e.name,type:`boolean`,...e.default===void 0?{}:{default:e.default},bindings:{figma:{kind:`BOOLEAN`,property:e.property},code:{prop:e.name}}});for(let e of y.arrayProps)A.push({name:e.name,type:{arrayOf:e.fields},bindings:{figma:{kind:`NONE`},code:{prop:e.name}}});y.textProps.length===1&&y.textProps[0].name!==`children`&&y.notes.push(`prop \`${y.textProps[0].name}\`: the single text prop carries the component's main content â repo contracts bind main content to code prop "children" (ds.button convention); adopt by setting bindings.code.prop to "children" when this is the label (note-only, nothing renamed mechanically)`);let se=If(e.setName);se!==e.setName&&y.notes.push(`contract name: drawn set name "${e.setName}" is not a PascalCase component name â proposed as "${se}" (the canvas set keeps its own name; the componentSetKey/nodeId anchors carry identity)`),Ff(e.setName)&&y.notes.push(`contract id: drawn set name "${e.setName}" contains characters a contract id cannot carry â id proposed as "${_}" (rule: lowercase kebab, illegal characters â hyphens, runs collapsed, edge hyphens stripped, digit-led/empty gets "c"); the canvas set keeps its own name and the componentSetKey/nodeId anchors carry identity`);for(let e of A){let t=e.bindings.figma?.property;t&&Mf(t)&&y.notes.push(`prop \`${String(e.name)}
2785\`: Figma property "${t}" contains characters outside a legal identifier â name sanitized at proposal; the original spelling stays the design binding (bindings.figma.property)`),t&&Nf(t)&&y.notes.push(`prop \`${String(e.name)}\`: Figma property "${t}" is digit-led â a code identifier cannot start with a digit, so the name gets the deterministic "p" prefix (the componentIdSlug digit-led discipline applied to prop code bindings); the original spelling stays the design binding (bindings.figma.property)`)}let j=(()=>{let t=e.semantics;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t,r=typeof n.element==`string`&&n.element?n.element:void 0,i=typeof n.role==`string`&&n.role?n.role:void 0;return!r&&!i?null:{element:r,role:i}})(),ce=j?`semantics: read from the set's own \`ds_contracts/semantics\` stamp (element "${j.element??`div`}"${j.role?`, role "${j.role}"`:``}) â the contract's declared host element, not the name/axis inference`:null,M=Yf(e.setName,m,l!==null),N=Object.keys(T.parts??{}).length,P=M&&El.has(M.element)&&N>0?{element:`div`,note:`semantics: element "${M.element}" matched the name/axis table for set "${e.setName}", but the drawn anatomy mounts ${N} child part(s) and <${M.element}> is a VOID element â children cannot mount inside it (React refuses the shape at runtime and renders NOTHING; the emitters refuse it by name). Proposed as container element "div" instead${M.role?`; the inferred role "${M.role}" is NOT carried (it belongs on the native control, not the container)`:``} â REVIEW: re-root before adoption by mounting the native <${M.element}> control as a child part inside this container`}:M,le={$schema:`./contract.schema.json`,id:_,name:se,version:`0.1.0`,status:`draft`,description:`PROPOSED contract extracted from the design canvas (extract/figma dump v1) â API, anatomy, and token bindings inverted from the drawn structure. Semantics beyond the name/axis inference table, a11y, events, and slot accepts are not canvas-recoverable; review before adoption.`,semantics:j?{element:j.element??`div`,...j.role?{role:j.role}:{}}:P?{element:P.element,...P.role?{role:P.role}:{},...P.elementByProp?{elementByProp:P.elementByProp}:{}}:{element:`div`},props:A,states:[],...s?{modes:s.axis.values.map(Hf)}:{},anatomy:{root:T},anchors:{figma:{fileKey:t.fileKey??null,componentSetKey:e.key??null,...e.no
2785deId?{nodeId:e.nodeId}:{}},code:{importPath:`src/components/${se}`,export:se}}},ue;if(y.mint&&y.mint.observations.length>0){let t=y.mint.observations,n=[...y.mint.axisValuesByVariant.values()],r=ru(Pf(e.setName),t,y.mint.axes,{nestedPairs:!0,realizedCombos:n}),i=new Map;r.bindings.forEach((e,n)=>{let r=t[n];if(e.ref?r.target[r.cssProperty]=e.ref:e.reason&&y.notes.push(`${r.nodePath} ${r.cssProperty}: ${e.reason}`),e.ref&&e.caveat&&y.notes.push(`${r.nodePath} ${r.cssProperty}: ${e.caveat}`),r.source){let t=i.get(r.source)??{total:0,bound:0};t.total++,e.ref&&t.bound++,i.set(r.source,t)}});for(let{holder:e,tokens:t}of y.mint.attach)Object.keys(t).length>0&&e.tokens===void 0&&(e.tokens=t);for(let e of y.mint.refOverrides)Object.keys(e.target).length>0&&(e.component.overrides=e.target);for(let e of y.mint.absFallbacks){if(e.tokens[e.chan]!==void 0)continue;let t=e.part.literals??{};if(t[e.chan]!==void 0)continue;t[e.chan]=`${e.value}px`,e.part.literals=t;let n=_p(y,e);if(!n){y.notes.push(`${e.where} ${e.chan}: per-variant captured values refused classification (named above) â the FIRST occurrence's ${e.value}px carried as a base-combo literal fallback (exact for the default rendering; other variants keep the refusal)`);continue}let r=e.part.literalsByProp??[],i=r.find(e=>e.prop===n.prop);i||(i={prop:n.prop,map:{}},r.push(i));for(let[t,r]of n.byValue)(i.map[t]??={})[e.chan]=`${r}px`;e.part.literalsByProp=r,y.notes.push(`${e.where} ${e.chan}: per-variant captured values refused classification (named above) â PROJECTED onto the "${n.prop}" axis and carried as a per-value literal map (${n.byValue.size} observed value(s): ${[...n.byValue].map(([e,t])=>`${e}=${t}px`).join(`, `)}), each one measured at the base combination of every OTHER axis (${n.baseCombo||`no other axis`}); the base combo's ${e.value}px stays the part literal for axis values the capture never drew. The channel also varies with the other axes at combinations off that slice â those keep the refusal named above`)}let a=y.mint.partialSources;y.unbound=y.unbound.filter(e=>{let t=i.get(`${e.nodePath}|${e.property}`),n=!!(t&&t.bound===t.total&&!a.has(`${e.nodePath}|${e.property}`));return n&&e.suggestions.length>0&&y.notes.push(`${e.nodePath} ${e.property}: observed ${e.value} carried as a PROVISIONAL minted token (rename against your real system) â nearest real tokens by value: ${e.suggestions.map(e=>`{${e}}`).join(`, `)}; the proposal binds the provisional name, never a real token the canvas did not use`),!n});for(let e of r.entries)y.notes.push(e.value===`fit-content`?`MINTED ${e.ref} = fit-content â a SIZING MODE, not a measure: this plane HUGS its content on the canvas, so the leaf states the mode instead of freezing a measurement of the default content. Nothing to rename (no design token names HUG); the canvas leg reads it back as Figma HUG sizing and upserts no variable for it; bound at: ${e.usageSites.join(`, `)}`:`MINTED ${e.ref} = ${e.value} â machine-named from a resolved value â rename against your real tokens (provisional); bound at: ${e.usageSites.join(`, `)}`);ue={tree:r.tree,count:r.count,entries:r.entries}}if(y.instanceOverrides){let e=T.tokens??{},t=[];typeof e[`background-image`]==`string`&&C.occ.some(e=>typeof e.node.imageFill==`string`)&&t.push(`background-image`),typeof e.width==`string`&&typeof e.height==`string`&&t.push(`size`),t.length>0&&(T.overridable=t,y.notes.push(`root: overridable [${t.join(`, `)}] declared (iteration 9) â hosts may carry PROVEN per-instance overrides for these channels; the root's own bindings are the var() fallback, so instances without overrides render identically`))}if(l){let t=[`hover`,`active`,`focus-visible`,`disabled`].filter(e=>ie[e]!==void 0),n=new Set;for(let e of oe)(Object.keys(e.target).length>0||Object.keys(e.byProp).length>0)&&n.add(e.state);let r=t.filter(e=>Object.keys(ie[e]).length>0||Object.keys(ae[e]??{}).length>0||n.has(e));for(let e of t)r.includes(e)||y.notes.push(`state "${e}": promoted from the axis but no root or part override was recoverable â state not declared (its variants render identically to default, or every channel refused by name above)`);for(let t of oe){if(!r.includes(t.state))continue;for(let[e,n]of Object.entries(t.byProp)){let r=t.part.statesByProp??[];r.push({prop:e,state:t.state,map:n}),t.part.statesByProp=r}if(Object.keys(t.target).length===0)continue;let n=t.part.states??{};
2785n[t.state]={...n[t.state]??{},...t.target},t.part.states=n;let i=(e,n)=>{for(let[r,a]of Object.entries(e??{})){let e=a;if(e===t.part)return[...n,r].join(`/`);let o=i(e?.parts,[...n,r]);if(o!==void 0)return o}},a=i(T.parts??{},[])??`(part)`;y.notes.push(`${e.setName}:root/${a}: state "${t.state}" part-level override proposed â ${Object.entries(t.target).map(([e,t])=>`${e}: ${t}`).join(`, `)} (P18 v13; formerly the STYLE-FIDELITY B7 named gap)`)}if(r.length>0){let e=r.filter(e=>Object.keys(ie[e]).length>0);e.length>0&&(T.states=Object.fromEntries(e.map(e=>[e,ie[e]])));let t=[];for(let e of r)for(let[n,r]of Object.entries(ae[e]??{}))t.push({prop:n,state:e,map:r});t.length>0&&(T.statesByProp=t),le.states=r;let n=new Set(A.filter(e=>typeof e.type==`object`&&`enum`in e.type).map(e=>e.name)),i=new Set;for(let e of r){for(let t of Object.values(ie[e]))for(let e of t.matchAll(/\{([a-z][\w-]*)\}/g))n.has(e[1])&&i.add(e[1]);for(let t of oe)if(t.state===e)for(let e of Object.values(t.target))for(let t of e.matchAll(/\{([a-z][\w-]*)\}/g))n.has(t[1])&&i.add(t[1])}let a=A.some(e=>e.bindings.figma?.property===kl);i.size<=1&&!a?(le.figmaStatePreviews=!0,y.notes.push(`figmaStatePreviews: true â regenerating the canvas draws the promoted states as a "${kl}" preview axis (values ${[`Default`,...r.filter(e=>e!==`disabled`).map(jl)].join(`|`)}, the shared spelling rules) â a RENAME relative to the imported axis "${l.axis.property}" (${l.axis.values.join(`|`)}); the contract vocabulary carries no custom state-axis spellings, so the original spelling lives in this note and in the anchors' set`)):y.notes.push(`figmaStatePreviews NOT set: ${a?`a prop already binds the reserved design property "${kl}"`:`state overrides substitute ${i.size} enum props (${[...i].join(`, `)}) â previews multiply exactly ONE primary axis`} â canvas state previews refused by name, review`)}else y.notes.push(`state axis promoted but NO state overrides were recoverable â the contract declares no states; the axis still does not become a prop (its values are platform states), review the notes above`)}let de=[];for(let e of y.stubs.values()){let n=qm(e,y,t.fileKey??null);if(de.push(n.contract),n.geometry){ue||={tree:{},count:0,entries:[]},Hm(ue.tree,n.geometry.tree),ue.count+=n.geometry.count,ue.entries.push(...n.geometry.entries);for(let t of n.geometry.entries)y.notes.push(`MINTED ${t.ref} = ${t.value} â stub geometry (the "${e.instanceOf}" instances' OBSERVED box/paint, dump v1.5; provisional) â bound at: ${t.usageSites.join(`, `)}`)}}bl.parse(le);for(let e of de)bl.parse(e);ce?y.notes.unshift(ce):P?y.notes.unshift(P.note):y.notes.unshift(`semantics.element defaulted to "div" â element/role/ARIA are not drawn on the canvas and the name/axis inference table matched nothing; set the real host element`);for(let e of y.unbound)y.notes.push(`UNBOUND ${e.nodePath} ${e.property} = ${e.value} â no token invented; nearest tokens by value: ${e.suggestions.length>0?e.suggestions.map(e=>`{${e}}`).join(`, `):`(none found)`}`);let fe;if(n===`exact`)fe=ap(Of(e,cp(le,i)),`verified-exact`);else if(r.status===`source-matrix-verified`){let t=Of(e,cp(le,i));fe=t.status===`verified-exact`?t:{status:`legacy-unverified`,reason:`structured-exact-evidence-absent`}}else fe=r;return{contract:le,notes:y.notes,unbound:y.unbound,projection:fe,...ue?{mintedTokens:ue}:{},...de.length>0?{childStubs:de}:{}}}function th(e){let t=e?.issues;if(Array.isArray(t)&&t.length>0&&t.every(e=>e&&typeof e==`object`)){let n=t[0],r=Array.isArray(n.path)?n.path.filter(e=>typeof e==`string`||typeof e==`number`).join(`.`):``,i=typeof n.message==`string`?n.message:`invalid value`,a=t.length>1?` (and ${t.length-1} more issue${t.length===2?``:`s`})`:``;return{headline:`the proposed contract did not fit the contract schema â field "${r||`the contract root`}": ${i}${a}.`,detail:e instanceof Error?e.message:JSON.stringify(t,null,2)}}let n=e instanceof Error?e.message:String(e);return/^\s*[[{"]/.test(n)||n.length>400?{headline:`the proposal failed with a technical error (full text below).`,detail:n}:{headline:n}}function nh(e,t){let n=[],r=[],i=[],a=new Map,o=t.capturedValues??new Map((cu(e)?.entries??[]).map(e=>[e.path,e.value])),s={...t,capturedValues:o},c=e._provenance?.captureGaps,l=Array.isArray(c)?c.filter(e=>typeof e==`string`):[],u=l.length>0?`this dump's reader could not see: ${l.join(`; `)} â absence of these facts is a READ limit of the import route, not evidence about the design; re-import via the plugin dump (extract/figma/dump.plugin.js, dump v1.13) to capture them`:null;for(let[t,o]of Object.entries(e))if(!(t===`_provenance`||!au(o)))try{let e={setName:t,...eh(o,s)};u&&e.notes.unshift(u);let r=e.contract.id;if(typeof r==`string`){let e=a.get(r);e===void 0?a.set(r,t):i.push(`contract id "${r}" is claimed by two sets in this dump ("${e}" and "${t}") â their names sanitize to the same id; rename one set (or edit one id) before adopting both`)}n.push(e)}catch(e){let n=th(e);r.push({setName:t,reason:`Set "${t}" could not be proposed: ${n.headline}`,...n.detail?{detail:n.detail}:{}})}return{proposals:n,skipped:r,notes:i}}var rh={color:{$type:`color`,white:{$value:`#FFFFFF`},black:{$value:`#000000`},gray:{50:{$value:`#F9FAFB`},100:{$value:`#F3F4F6`},200:{$value:`#E5E7EB`},300:{$value:`#D1D5DB`},400:{$value:`#9CA3AF`},500:{$value:`#6B7280`},600:{$value:`#4B5563`},700:{$value:`#374151`},800:{$value:`#1F2937`},900:{$value:`#111827`}},blue:{100:{$value:`#DBEAFE`},300:{$value:`#93C5FD`},400:{$value:`#60A5FA`},500:{$value:`#3B82F6`},600:{$value:`#2563EB`},700:{$value:`#1D4ED8`},900:{$value:`#1E3A8A`}},red:{100:{$value:`#FEE2E2`},300:{$value:`#FCA5A5`},400:{$value:`#F87171`},500:{$value:`#EF4444`},600:{$value:`#DC2626`},700:{$value:`#B91C1C`},900:{$value:`#7F1D1D`}},green:{100:{$value:`#DCFCE7`},500:{$value:`#22C55E`},600:{$value:`#16A34A`},700:{$value:`#15803D`},900:{$value:`#14532D`}},amber:{100:{$value:`#FEF3C7`},500:{$value:`#F59E0B`},600:{$value:`#D97706`},700:{$value:`#B45309`},900:{$value:`#78350F`}},orange:{100:{$value:`#FFEDD5`},700:{$value:`#C2410C`}
2785,900:{$value:`#7C2D12`}},yellow:{100:{$value:`#FEF9C3`},700:{$value:`#A16207`},900:{$value:`#713F12`}},teal:{100:{$value:`#CCFBF1`},700:{$value:`#0F766E`},900:{$value:`#134E4A`},300:{$type:`color`,$value:`#5EEAD4`},400:{$type:`color`,$value:`#2DD4BF`},500:{$type:`color`,$value:`#14B8A6`},600:{$type:`color`,$value:`#0D9488`}},cyan:{100:{$value:`#CFFAFE`},700:{$value:`#0E7490`},900:{$value:`#164E63`}},purple:{100:{$value:`#F3E8FF`},700:{$value:`#7E22CE`},900:{$value:`#581C87`},300:{$type:`color`,$value:`#D8B4FE`},400:{$type:`color`,$value:`#C084FC`},500:{$type:`color`,$value:`#A855F7`},600:{$type:`color`,$value:`#9333EA`}},pink:{100:{$value:`#FCE7F3`},700:{$value:`#BE185D`},900:{$value:`#831843`}}},space:{25:{$value:`2px`},50:{$value:`4px`},100:{$value:`8px`},150:{$value:`12px`},200:{$value:`16px`},250:{$value:`20px`},300:{$value:`24px`},400:{$value:`32px`},$type:`dimension`,overlap:{$value:`-8px`}},radius:{100:{$value:`4px`},200:{$value:`8px`},$type:`dimension`,pill:{$value:`999px`},none:{$value:`0px`}},"border-width":{100:{$value:`1px`},200:{$value:`2px`},$type:`dimension`},container:{$type:`dimension`,sm:{$value:`320px`},xs:{$value:`120px`},md:{$value:`480px`},lg:{$value:`640px`}},font:{family:{sans:{$type:`fontFamily`,$value:`Inter, system-ui, -apple-system, sans-serif`},mono:{$value:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,$type:`fontFamily`}},size:{100:{$value:`12px`},200:{$value:`14px`},300:{$value:`16px`},400:{$value:`18px`},$type:`dimension`},weight:{$type:`fontWeight`,regular:{$value:400},medium:{$value:500},semibold:{$value:600}}},opacity:{$type:`number`,disabled:{$value:.5}},control:{sm:{$value:`28px`},md:{$value:`36px`},lg:{$value:`44px`}}},ih={space:{"inset-x":{$type:`dimension`,sm:{$value:`{space.150}`},md:{$value:`{space.200}`},lg:{$value:`{space.300}`},xs:{$type:`dimension`,$value:`{space.100}`}},"inset-y":{$type:`dimension`,sm:{$value:`{space.50}`},md:{$value:`{space.100}`},lg:{$value:`{space.150}`},xs:{$type:`dimension`,$value:`{space.25}`}},gap:{$type:`dimension`,control:{$value:`{space.100}`},sm:{$value:`{space.100}`},md:{$value:`{space.200}`},lg:{$value:`{space.300}`}},table:{"cell-y":{$type:`dimension`,comfortable:{$value:`{space.150}`},compact:{$value:`{space.50}`}}},list:{compact:{$type:`dimension`,$value:`{space.50}`},balanced:{$type:`dimension`,$value:`{space.100}`},spacious:{$type:`dimension`,$value:`{space.150}`}},avatarGroup:{overlap:{$type:`dimension`,$value:`{space.overlap}`}}},radius:{control:{$type:`dimension`,$value:`{brand.radius.control}`},badge:{$type:`dimension`,$value:`{radius.pill}`},card:{$type:`dimension`,$value:`{radius.200}`},avatar:{$type:`dimension`,$value:`{radius.pill}`},banner:{card:{$type:`dimension`,$value:`{radius.200}`},section:{$type:`dimension`,$value:`{radius.none}`}},skeleton:{text:{$value:`{radius.100}`},rect:{$value:`{radius.200}`},circle:{$value:`{radius.pill}`}}},size:{avatar:{$type:`dimension`,sm:{$value:`{space.300}`},md:{$value:`{space.400}`}},card:{width:{$type:`dimension`,$value:`{container.sm}`}},table:{width:{$type:`dimension`,$value:`{container.md}`},"cell-width":{$type:`dimension`,$value:`{container.xs}`}},banner:{width:{$type:`dimension`,$value:`{container.lg}`}},"icon-button":{sm:{$type:`dimension`,$value:`{control.sm}`},md:{$type:`dimension`,$value:`{control.md}`},lg:{$type:`dimension`,$value:`{control.lg}`}},checkbox:{sm:{$type:`dimension`,$value:`{space.200}`},md:{$type:`dimension`,$value:`{space.250}`}},dot:{$type:`dimension`,$value:`{space.100}`},divider:{length:{$type:`dimension`,$value:`{container.sm}`}},toolbar:{sm:{$type:`dimension`,$value:`{control.sm}`},md:{$type:`dimension`,$value:`{control.md}`},lg:{$type:`dimension`,$value:`{control.lg}`}},progress:{width:{$type:`dimension`,$value:`{container.sm}`},height:{$type:`dimension`,$value:`{space.100}`}},slider:{width:{$type:`dimension`,$value:`{container.sm}`},track:{$type:`dimension`,$value:`{space.50}`},thumb:{$type:`dimension`,$value:`{space.200}`}},switch:{width:{$type:`dimension`,$value:`{space.400}`},height:{$type:`dimension`,$value:`{space.250}`},thumb:{$type:`dimension`,$value:`{space.200}`}},spinner:{sm:{$type:`dimension`,$value:`{space.150}`},md:{$type:`dimension`,$value:`{space.200}`},lg:{$type:`dimension`,$value:`{space.300}`}},skeleton:{text:{width:{$type:`dimension`,$value:`{container.xs}`},height:{$type:`dimension`,$value:`{space.150}`}},rect:{width:{$type:`dimension`,$value:`{container.sm}`},height:{$type:`dimension`,$value:`{space.400}`}},circle:{width:{$type:`dimension`,$value:`{space.400}`},height:{$type:`dimension`,$value:`{space.400}`}}}},border:{width:{$type:`dimension`,focus:{$value:`{border-width.200}`},divider:{subtle:{$value:`{border-width.100}`},strong:{$value:`{border-width.200}`}}}},font:{control:{family:{$type:`fontFamily`,$value:`{brand.font.control-family}`},weight:{$type:`fontWeight`,$value:`{brand.font.control-weight}`},size:{$type:`dimension`,sm:{$value:`{font.size.200}`},md:{$value:`{font.size.300}`},lg:{$value:`{font.size.400}`}}},badge:{size:{$type:`dimension`,$value:`{font.size.100}`}},title:{size:{$type:`dimension`,$value:`{font.size.300}`},weight:{$type:`fontWeight`,$value:`{font.weight.semibold}`}},avatar:{size:{$type:`dimension`,sm:{$value:`{font.size.100}`},md:{$value:`{font.size.200}`}}},code:{family:{$type:`fontFamily`,$value:`{font.family.mono}`}},tab:{default:{weight:{$type:`fontWeight`,$value:`{font.weight.medium}`}},selected:{weight:{$type:`fontWeight`,$value:`{font.weight.semibold}`}}}}},ah={color:{surface:{background:{$value:`{color.gray.50}`},foreground:{$value:`{color.gray.900}`},$type:`color`,raised:{$value:`{color.white}`},sunken:{$value:`{color.gray.100}`}},action:{primary:{background:{$value:`{brand.accent.600}`},"background-hover":{$value:`{brand.accent.700}`},foreground:{$value:`{color.white}`}},secondary:{background:{$value:`{color.gray.200}`},"background-hover":{$value:`{color.gray.300}`},foreground:{$value:`{color.gray.900}`}},danger:{background:{$value:`{color.red.600}`},"background-hover":{$value:`{color.red.700}`},foreground:{$value:`{color.white}`}},$type:`color`,destructive:{background:{$type:`color`,$value:`{color.red.600}`},"background-hover":{$type:`color`,$value:`{color.red.700}`},foreground:{$type:`color`,$value:`{color.white}`}},ghost:{background:{$type:`color`,$value:`{color.gray.50}`},foreground:{$type:`color`,$value:`{color.gray.700}`},"background-hover":{$type:`color`,$value:`{color.gray.200}`}}},border:{focus:{$value:`{brand.accent.500}`},$type:`color`,subtle:{$value:`{color.gray.200}`}},feedback:{info:{background:{$value:`{color.blue.100}`},foreground:{$value:`{color.blue.700}`}},success:{background:{$value:`{color.green.100}`},foreground:{$value:`{color.green.700}
2785`}},warning:{background:{$value:`{color.amber.100}`},foreground:{$value:`{color.amber.700}`}},danger:{background:{$value:`{color.red.100}`},foreground:{$value:`{color.red.700}`}},$type:`color`,error:{background:{$value:`{color.red.100}`},foreground:{$value:`{color.red.700}`}}},identity:{$type:`color`,background:{$value:`{brand.accent.100}`},foreground:{$value:`{brand.accent.700}`}},table:{$type:`color`,row:{default:{$value:`{color.white}`},selected:{$value:`{brand.accent.100}`}}},token:{default:{background:{$type:`color`,$value:`{color.gray.100}`},foreground:{$type:`color`,$value:`{color.gray.700}`}},gray:{background:{$type:`color`,$value:`{color.gray.200}`},foreground:{$type:`color`,$value:`{color.gray.700}`}},red:{background:{$type:`color`,$value:`{color.red.100}`},foreground:{$type:`color`,$value:`{color.red.700}`}},orange:{background:{$type:`color`,$value:`{color.orange.100}`},foreground:{$type:`color`,$value:`{color.orange.700}`}},yellow:{background:{$type:`color`,$value:`{color.yellow.100}`},foreground:{$type:`color`,$value:`{color.yellow.700}`}},green:{background:{$type:`color`,$value:`{color.green.100}`},foreground:{$type:`color`,$value:`{color.green.700}`}},teal:{background:{$type:`color`,$value:`{color.teal.100}`},foreground:{$type:`color`,$value:`{color.teal.700}`}},cyan:{background:{$type:`color`,$value:`{color.cyan.100}`},foreground:{$type:`color`,$value:`{color.cyan.700}`}},blue:{background:{$type:`color`,$value:`{color.blue.100}`},foreground:{$type:`color`,$value:`{color.blue.700}`}},purple:{background:{$type:`color`,$value:`{color.purple.100}`},foreground:{$type:`color`,$value:`{color.purple.700}`}},pink:{background:{$type:`color`,$value:`{color.pink.100}`},foreground:{$type:`color`,$value:`{color.pink.700}`}}},status:{success:{$type:`color`,$value:`{color.green.600}`},warning:{$type:`color`,$value:`{color.amber.500}`},error:{$type:`color`,$value:`{color.red.600}`},accent:{$type:`color`,$value:`{brand.accent.600}`},neutral:{$type:`color`,$value:`{color.gray.400}`}},divider:{subtle:{$type:`color`,$value:`{color.gray.200}`},strong:{$type:`color`,$value:`{color.gray.400}`}},input:{background:{$type:`color`,$value:`{color.white}`},placeholder:{$type:`color`,$value:`{color.gray.500}`}},toast:{info:{background:{$type:`color`,$value:`{color.gray.900}`},foreground:{$type:`color`,$value:`{color.gray.100}`}},error:{background:{$type:`color`,$value:`{color.red.600}`},foreground:{$type:`color`,$value:`{color.white}`}}},text:{secondary:{$type:`color`,$value:`{color.gray.600}`}},checkbox:{unchecked:{background:{$type:`color`,$value:`{color.white}`},border:{$type:`color`,$value:`{color.gray.400}`}},checked:{background:{$type:`color`,$value:`{brand.accent.600}`},border:{$type:`color`,$value:`{brand.accent.600}`}},indeterminate:{background:{$type:`color`,$value:`{brand.accent.600}`},border:{$type:`color`,$value:`{brand.accent.600}`}},icon:{$type:`color`,$value:`{color.white}`}},section:{section:{$type:`color`,$value:`{color.white}`},muted:{$type:`color`,$value:`{color.gray.100}`}},chat:{user:{background:{$type:`color`,$value:`{brand.accent.100}`},foreground:{$type:`color`,$value:`{color.gray.900}`}},assistant:{background:{$type:`color`,$value:`{color.gray.100}`},foreground:{$type:`color`,$value:`{color.gray.900}`}},system:{background:{$type:`color`,$value:`{color.gray.50}`},foreground:{$type:`color`,$value:`{color.gray.600}`}}},tab:{default:{foreground:{$type:`color`,$value:`{color.gray.600}`}},selected:{foreground:{$type:`color`,$value:`{brand.accent.600}`}}},nav:{selected:{background:{$type:`color`,$value:`{brand.accent.100}`},foreground:{$type:`color`,$value:`{brand.accent.700}`}},default:{background:{$type:`color`,$value:`{color.white}`},foreground:{$type:`color`,$value:`{color.gray.700}`}}},switch:{off:{track:{$type:`color`,$value:`{color.gray.300}`}},on:{track:{$type:`color`,$value:`{brand.accent.600}`}},thumb:{$type:`color`,$value:`{color.white}`}},progress:{track:{$type:`color`,$value:`{color.gray.200}`},accent:{$type:`color`,$value:`{brand.accent.600}`},success:{$type:`color`,$value:`{color.green.600}`},warning:{$type:`color`,$value:`{color.amber.500}`},error:{$type:`color`,$value:`{color.red.600}`},neutral:{$type:`color`,$value:`{color.gray.500}`}}
2785,skeleton:{$type:`color`,$value:`{color.gray.200}`}}},oh={color:{surface:{background:{$value:`{color.gray.800}`},foreground:{$value:`{color.gray.100}`},$type:`color`,raised:{$value:`{color.gray.700}`},sunken:{$value:`{color.gray.800}`}},action:{primary:{background:{$value:`{brand.accent.500}`},"background-hover":{$value:`{brand.accent.400}`},foreground:{$value:`{color.white}`}},secondary:{background:{$value:`{color.gray.700}`},"background-hover":{$value:`{color.gray.600}`},foreground:{$value:`{color.gray.100}`}},danger:{background:{$value:`{color.red.500}`},"background-hover":{$value:`{color.red.400}`},foreground:{$value:`{color.white}`}},$type:`color`,destructive:{background:{$type:`color`,$value:`{color.red.500}`},"background-hover":{$type:`color`,$value:`{color.red.400}`},foreground:{$type:`color`,$value:`{color.white}`}},ghost:{background:{$type:`color`,$value:`{color.gray.800}`},foreground:{$type:`color`,$value:`{color.gray.200}`},"background-hover":{$type:`color`,$value:`{color.gray.700}`}}},border:{focus:{$value:`{brand.accent.300}`},$type:`color`,subtle:{$value:`{color.gray.600}`}},feedback:{info:{background:{$value:`{color.blue.900}`},foreground:{$value:`{color.blue.100}`}},success:{background:{$value:`{color.green.900}`},foreground:{$value:`{color.green.100}`}},warning:{background:{$value:`{color.amber.900}`},foreground:{$value:`{color.amber.100}`}},danger:{background:{$value:`{color.red.900}`},foreground:{$value:`{color.red.100}`}},$type:`color`,error:{background:{$value:`{color.red.900}`},foreground:{$value:`{color.red.100}`}}},identity:{$type:`color`,background:{$value:`{brand.accent.900}`},foreground:{$value:`{brand.accent.100}`}},table:{$type:`color`,row:{default:{$value:`{color.gray.700}`},selected:{$value:`{brand.accent.900}`}}},token:{default:{background:{$type:`color`,$value:`{color.gray.700}`},foreground:{$type:`color`,$value:`{color.gray.100}`}},gray:{background:{$type:`color`,$value:`{color.gray.600}`},foreground:{$type:`color`,$value:`{color.gray.100}`}},red:{background:{$type:`color`,$value:`{color.red.900}`},foreground:{$type:`color`,$value:`{color.red.100}`}},orange:{background:{$type:`color`,$value:`{color.orange.900}`},foreground:{$type:`color`,$value:`{color.orange.100}`}},yellow:{background:{$type:`color`,$value:`{color.yellow.900}`},foreground:{$type:`color`,$value:`{color.yellow.100}`}},green:{background:{$type:`color`,$value:`{color.green.900}`},foreground:{$type:`color`,$value:`{color.green.100}`}},teal:{background:{$type:`color`,$value:`{color.teal.900}`},foreground:{$type:`color`,$value:`{color.teal.100}`}},cyan:{background:{$type:`color`,$value:`{color.cyan.900}`},foreground:{$type:`color`,$value:`{color.cyan.100}`}},blue:{background:{$type:`color`,$value:`{color.blue.900}`},foreground:{$type:`color`,$value:`{color.blue.100}`}},purple:{background:{$type:`color`,$value:`{color.purple.900}`},foreground:{$type:`color`,$value:`{color.purple.100}`}},pink:{background:{$type:`color`,$value:`{color.pink.900}`},foreground:{$type:`color`,$value:`{color.pink.100}`}}},status:{success:{$type:`color`,$value:`{color.green.500}`},warning:{$type:`color`,$value:`{color.amber.500}`},error:{$type:`color`,$value:`{color.red.500}`},accent:{$type:`color`,$value:`{brand.accent.400}`},neutral:{$type:`color`,$value:`{color.gray.500}`}},divider:{subtle:{$type:`color`,$value:`{color.gray.600}`},strong:{$type:`color`,$value:`{color.gray.500}`}},input:{background:{$type:`color`,$value:`{color.gray.700}`},placeholder:{$type:`color`,$value:`{color.gray.400}`}},toast:{info:{background:{$type:`color`,$value:`{color.gray.100}`},foreground:{$type:`color`,$value:`{color.gray.900}`}},error:{background:{$type:`color`,$value:`{color.red.500}`},foreground:{$type:`color`,$value:`{color.white}`}}},text:{secondary:{$type:`color`,$value:`{color.gray.300}`}},checkbox:{unchecked:{background:{$type:`color`,$value:`{color.gray.700}`},border:{$type:`color`,$value:`{color.gray.500}`}},checked:{background:{$type:`color`,$value:`{brand.accent.500}`},border:{$type:`color`,$value:`{brand.accent.500}`}},indeterminate:{background:{$type:`color`,$value:`{brand.accent.500}`},border:{$type:`color`,$value:`{brand.accent.500}`}},icon:{$type:`color`,$value:`{color.white}`}},section:{section:{$type:`color`,$value:`{color.gray.700}`},muted:{$type:`color`,$value:`{color.gray.800}`}},chat:{user:{background:{$type:`color`,$value:`{brand.accent.900}`},foreground:{$type:`color`,$value:`{color.gray.100}`}},assistant:{background:{$type:`color`,$value:`{color.gray.700}`},foreground:{$type:`color`,$value:`{color.gray.100}`}},system:{background:{$type:`color`,$value:`{color.gray.800}`},foreground:{$type:`color`,$value:`{color.gray.300}`}}},tab:{default:{foreground:{$type:`color`,$value:`{color.gray.300}`}},selected:{foreground:{$type:`color`,$value:`{brand.accent.400}`}}},nav:{selected:{background:{$type:`color`,$value:`{brand.accent.900}`},foreground:{$type:`color`,$value:`{brand.accent.100}`}},default:{background:{$type:`color`,$value:`{color.gray.700}`},foreground:{$type:`color`,$value:`{color.gray.200}`}}},switch:{off:{track:{$type:`color`,$value:`{color.gray.500}`}}
2785,on:{track:{$type:`color`,$value:`{brand.accent.500}`}},thumb:{$type:`color`,$value:`{color.white}`}},progress:{track:{$type:`color`,$value:`{color.gray.600}`},accent:{$type:`color`,$value:`{brand.accent.400}`},success:{$type:`color`,$value:`{color.green.500}`},warning:{$type:`color`,$value:`{color.amber.500}`},error:{$type:`color`,$value:`{color.red.500}`},neutral:{$type:`color`,$value:`{color.gray.400}`}},skeleton:{$type:`color`,$value:`{color.gray.600}`}}},sh={brand:{accent:{100:{$type:`color`,$value:`{color.blue.100}`},300:{$type:`color`,$value:`{color.blue.300}`},400:{$type:`color`,$value:`{color.blue.400}`},500:{$type:`color`,$value:`{color.blue.500}`},600:{$type:`color`,$value:`{color.blue.600}`},700:{$type:`color`,$value:`{color.blue.700}`},900:{$type:`color`,$value:`{color.blue.900}`}},radius:{control:{$type:`dimension`,$value:`{radius.200}`}},font:{"control-family":{$type:`fontFamily`,$value:`{font.family.sans}`},"control-weight":{$type:`fontWeight`,$value:`{font.weight.medium}`}}}},ch={brand:{accent:{100:{$type:`color`,$value:`{color.teal.100}`},300:{$type:`color`,$value:`{color.teal.300}`},400:{$type:`color`,$value:`{color.teal.400}`},500:{$type:`color`,$value:`{color.teal.500}`},600:{$type:`color`,$value:`{color.teal.600}`},700:{$type:`color`,$value:`{color.teal.700}`},900:{$type:`color`,$value:`{color.teal.900}`}},radius:{control:{$type:`dimension`,$value:`{radius.none}`}},font:{"control-family":{$type:`fontFamily`,$value:`{font.family.mono}`},"control-weight":{$type:`fontWeight`,$value:`{font.weight.semibold}`}}}},lh=`/** 2786 * GENERATED FILE â DO NOT EDIT. 2787 * Source of truth: tokens/*.tokens.json â regenerate with: npm run tokens 2788 */ 2789 2790:root { 2791 --color-white: #FFFFFF; 2792 --color-black: #000000; 2793 --color-gray-50: #F9FAFB; 2794 --color-gray-100: #F3F4F6; 2795 --color-gray-200: #E5E7EB; 2796 --color-gray-300: #D1D5DB; 2797 --color-gray-400: #9CA3AF; 2798 --color-gray-500: #6B7280; 2799 --color-gray-600: #4B5563; 2800 --color-gray-700: #374151; 2801 --color-gray-800: #1F2937; 2802 --color-gray-900: #111827; 2803 --color-blue-100: #DBEAFE; 2804 --color-blue-300: #93C5FD; 2805 --color-blue-400: #60A5FA; 2806 --color-blue-500: #3B82F6; 2807 --color-blue-600: #2563EB; 2808 --color-blue-700: #1D4ED8; 2809 --color-blue-900: #1E3A8A; 2810 --color-red-100: #FEE2E2; 2811 --color-red-300: #FCA5A5; 2812 --color-red-400: #F87171; 2813 --color-red-500: #EF4444; 2814 --color-red-600: #DC2626; 2815 --color-red-700: #B91C1C; 2816 --color-red-900: #7F1D1D; 2817 --color-green-100: #DCFCE7; 2818 --color-green-500: #22C55E; 2819 --color-green-600: #16A34A; 2820 --color-green-700: #15803D; 2821 --color-green-900: #14532D; 2822 --color-amber-100: #FEF3C7; 2823 --color-amber-500: #F59E0B; 2824 --color-amber-600: #D97706; 2825 --color-amber-700: #B45309; 2826 --color-amber-900: #78350F; 2827 --color-orange-100: #FFEDD5; 2828 --color-orange-700: #C2410C; 2829 --color-orange-900: #7C2D12; 2830 --color-yellow-100: #FEF9C3; 2831 --color-yellow-700: #A16207; 2832 --color-yellow-900: #713F12; 2833 --color-teal-100: #CCFBF1; 2834 --color-teal-300: #5EEAD4; 2835 --color-teal-400: #2DD4BF; 2836 --color-teal-500: #14B8A6; 2837 --color-teal-600: #0D9488; 2838 --color-teal-700: #0F766E; 2839 --color-teal-900: #134E4A; 2840 --color-cyan-100: #CFFAFE; 2841 --color-cyan-700: #0E7490; 2842 --color-cyan-900: #164E63; 2843 --color-purple-100: #F3E8FF; 2844 --color-purple-300: #D8B4FE; 2845 --color-purple-400: #C084FC; 2846 --color-purple-500: #A855F7; 2847 --color-purple-600: #9333EA; 2848 --color-purple-700: #7E22CE; 2849 --color-purple-900: #581C87; 2850 --color-pink-100: #FCE7F3; 2851 --color-pink-700: #BE185D; 2852 --color-pink-900: #831843; 2853 --space-25: 2px; 2854 --space-50: 4px; 2855 --space-100: 8px; 2856 --space-150: 12px; 2857 --space-200: 16px; 2858 --space-250: 20px; 2859 --space-300: 24px; 2860 --space-400: 32px; 2861 --space-overlap: -8px; 2862 --radius-100: 4px; 2863 --radius-200: 8px; 2864 --radius-pill: 999px; 2865 --radius-none: 0px; 2866 --border-width-100: 1px; 2867 --border-width-200: 2px; 2868 --container-sm: 320px; 2869 --container-xs: 120px; 2870 --container-md: 480px; 2871 --container-lg: 640px; 2872 --font-family-sans: Inter, system-ui, -apple-system, sans-serif; 2873 --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; 2874 --font-size-100: 12px; 2875 --font-size-200: 14px; 2876 --font-size-300: 16px; 2877 --font-size-400: 18px; 2878 --font-weight-regular: 400; 2879 --font-weight-medium: 500; 2880 --font-weight-semibold: 600; 2881 --opacity-disabled: 0.5; 2882 --control-sm: 28px; 2883 --control-md: 36px; 2884 --control-lg: 44px; 2885 --brand-accent-100: var(--color-blue-100); 2886 --brand-accent-300: var(--color-blue-300); 2887 --brand-accent-400: var(--color-blue-400); 2888 --brand-accent-500: var(--color-blue-500); 2889 --brand-accent-600: var(--color-blue-600); 2890 --brand-accent-700: var(--color-blue-700); 2891 --brand-accent-900: var(--color-blue-900); 2892 --brand-radius-control: var(--radius-200); 2893 --brand-font-control-family: var(--font-family-sans); 2894 --brand-font-control-weight: var(--font-weight-medium); 2895 --space-inset-x-sm: var(--space-150); 2896 --space-inset-x-md: var(--space-200); 2897 --space-inset-x-lg: var(--space-300); 2898 --space-inset-x-xs: var(--space-100); 2899 --space-inset-y-sm: var(--space-50); 2900 --space-inset-y-md: var(--space-100); 2901 --space-inset-y-lg: var(--space-150); 2902 --space-inset-y-xs: var(--space-25); 2903 --space-gap-control: var(--space-100); 2904 --space-gap-sm: var(--space-100); 2905 --space-gap-md: var(--space-200); 2906 --space-gap-lg: var(--space-300); 2907 --space-table-cell-y-comfortable: var(--space-150); 2908 --space-table-cell-y-compact: var(--space-50); 2909 --space-list-compact: var(--space-50); 2910 --space-list-balanced: var(--space-100); 2911 --space-list-spacious: var(--space-150); 2912 --space-avatarGroup-overlap: var(--space-overlap); 2913 --radius-control: var(--brand-radius-control); 2914 --radius-badge: var(--radius-pill); 2915 --radius-card: var(--radius-200); 2916 --radius-avatar: var(--radius-pill); 2917 --radius-banner-card: var(--radius-200); 2918 --radius-banner-section: var(--radius-none); 2919 --radius-skeleton-text: var(--radius-100); 2920 --radius-skeleton-rect: var(--radius-200); 2921 --radius-skeleton-circle: var(--radius-pill); 2922 --size-avatar-sm: var(--space-300); 2923 --size-avatar-md: var(--space-400); 2924 --size-card-width: var(--container-sm); 2925 --size-table-width: var(--container-md); 2926 --size-table-cell-width: var(--container-xs); 2927 --size-banner-width: var(--container-lg); 2928 --size-icon-button-sm: var(--control-sm); 2929 --size-icon-button-md: var(--control-md); 2930 --size-icon-button-lg: var(--control-lg); 2931 --size-checkbox-sm: var(--space-200); 2932 --size-checkbox-md: var(--space-250); 2933 --size-dot: var(--space-100); 2934 --size-divider-length: var(--container-sm); 2935 --size-toolbar-sm: var(--control-sm); 2936 --size-toolbar-md: var(--control-md); 2937 --size-toolbar-lg: var(--control-lg); 2938 --size-progress-width: var(--container-sm); 2939 --size-progress-height: var(--space-100); 2940 --size-slider-width: var(--container-sm); 2941 --size-slider-track: var(--space-50); 2942 --size-slider-thumb: var(--space-200); 2943 --size-switch-width: var(--space-400); 2944 --size-switch-height: var(--space-250); 2945 --size-switch-thumb: var(--space-200); 2946 --size-spinner-sm: var(--space-150); 2947 --size-spinner-md: var(--space-200); 2948 --size-spinner-lg: var(--space-300); 2949 --size-skeleton-text-width: var(--container-xs); 2950 --size-skeleton-text-height: var(--space-150); 2951 --size-skeleton-rect-width: var(--container-sm); 2952 --size-skeleton-rect-height: var(--space-400); 2953 --size-skeleton-circle-width: var(--space-400); 2954 --size-skeleton-circle-height: var(--space-400); 2955 --border-width-focus: var(--border-width-200); 2956 --border-width-divider-subtle: var(--border-width-100); 2957 --border-width-divider-strong: var(--border-width-200); 2958 --font-control-family: var(--brand-font-control-family); 2959 --font-control-weight: var(--brand-font-control-weight); 2960 --font-control-size-sm: var(--font-size-200); 2961 --font-control-size-md: var(--font-size-300); 2962 --font-control-size-lg: var(--font-size-400); 2963 --font-badge-size: var(--font-size-100); 2964 --font-title-size: var(--font-size-300); 2965 --font-title-weight: var(--font-weight-semibold); 2966 --font-avatar-size-sm: var(--font-size-100); 2967 --font-avatar-size-md: var(--font-size-200); 2968 --font-code-family: var(--font-family-mono); 2969 --font-tab-default-weight: var(--font-weight-medium); 2970 --font-tab-selected-weight: var(--font-weight-semibold); 2971 --color-surface-background: var(--color-gray-50); 2972 --color-surface-foreground: var(--color-gray-900); 2973 --color-surface-raised: var(--color-white); 2974 --color-surface-sunken: var(--color-gray-100); 2975 --color-action-primary-background: var(--brand-accent-600); 2976 --color-action-primary-background-hover: var(--brand-accent-700); 2977 --color-action-primary-foreground: var(--color-white); 2978 --color-action-secondary-background: var(--color-gray-200); 2979 --color-action-secondary-background-hover: var(--color-gray-300); 2980 --color-action-secondary-foreground: var(--color-gray-900); 2981 --color-action-danger-background: var(--color-red-600); 2982 --color-action-danger-background-hover: var(--color-red-700); 2983 --color-action-danger-foreground: var(--color-white); 2984 --color-action-destructive-background: var(--color-red-600); 2985 --color-action-destructive-background-hover: var(--color-red-700); 2986 --color-action-destructive-foreground: var(--color-white); 2987 --color-action-ghost-background: var(--color-gray-50); 2988 --color-action-ghost-foreground: var(--color-gray-700); 2989 --color-action-ghost-background-hover: var(--color-gray-200); 2990 --color-border-focus: var(--brand-accent-500); 2991 --color-border-subtle: var(--color-gray-200); 2992 --color-feedback-info-background: var(--color-blue-100); 2993 --color-feedback-info-foreground: var(--color-blue-700); 2994 --color-feedback-success-background: var(--color-green-100); 2995 --color-feedback-success-foreground: var(--color-green-700); 2996 --color-feedback-warning-background: var(--color-amber-100); 2997 --color-feedback-warning-foreground: var(--color-amber-700); 2998 --color-feedback-danger-background: var(--color-red-100); 2999 --color-feedback-danger-foreground: var(--color-red-700); 3000 --color-feedback-error-background: var(--color-red-100); 3001 --color-feedback-error-foreground: var(--color-red-700); 3002 --color-identity-background: var(--brand-accent-100); 3003 --color-identity-foreground: var(--brand-accent-700); 3004 --color-table-row-default: var(--color-white); 3005 --color-table-row-selected: var(--brand-accent-100); 3006 --color-token-default-background: var(--color-gray-100); 3007 --color-token-default-foreground: var(--color-gray-700); 3008 --color-token-gray-background: var(--color-gray-200); 3009 --color-token-gray-foreground: var(--color-gray-700); 3010 --color-token-red-background: var(--color-red-100); 3011 --color-token-red-foreground: var(--color-red-700); 3012 --color-token-orange-background: var(--color-orange-100); 3013 --color-token-orange-foreground: var(--color-orange-700); 3014 --color-token-yellow-background: var(--color-yellow-100); 3015 --color-token-yellow-foreground: var(--color-yellow-700); 3016 --color-token-green-background: var(--color-green-100); 3017 --color-token-green-foreground: var(--color-green-700); 3018 --color-token-teal-background: var(--color-teal-100); 3019 --color-token-teal-foreground: var(--color-teal-700); 3020 --color-token-cyan-background: var(--color-cyan-100); 3021 --color-token-cyan-foreground: var(--color-cyan-700); 3022 --color-token-blue-background: var(--color-blue-100); 3023 --color-token-blue-foreground: var(--color-blue-700); 3024 --color-token-purple-background: var(--color-purple-100); 3025 --color-token-purple-foreground: var(--color-purple-700); 3026 --color-token-pink-background: var(--color-pink-100); 3027 --color-token-pink-foreground: var(--color-pink-700); 3028 --color-status-success: var(--color-green-600); 3029 --color-status-warning: var(--color-amber-500); 3030 --color-status-error: var(--color-red-600); 3031 --color-status-accent: var(--brand-accent-600); 3032 --color-status-neutral: var(--color-gray-400); 3033 --color-divider-subtle: var(--color-gray-200); 3034 --color-divider-strong: var(--color-gray-400); 3035 --color-input-background: var(--color-white); 3036 --color-input-placeholder: var(--color-gray-500); 3037 --color-toast-info-background: var(--color-gray-900); 3038 --color-toast-info-foreground: var(--color-gray-100); 3039 --color-toast-error-background: var(--color-red-600); 3040 --color-toast-error-foreground: var(--color-white); 3041 --color-text-secondary: var(--color-gray-600); 3042 --color-checkbox-unchecked-background: var(--color-white); 3043 --color-checkbox-unchecked-border: var(--color-gray-400); 3044 --color-checkbox-checked-background: var(--brand-accent-600); 3045 --color-checkbox-checked-border: var(--brand-accent-600); 3046 --color-checkbox-indeterminate-background: var(--brand-accent-600); 3047 --color-checkbox-indeterminate-border: var(--brand-accent-600); 3048 --color-checkbox-icon: var(--color-white); 3049 --color-section-section: var(--color-white); 3050 --color-section-muted: var(--color-gray-100); 3051 --color-chat-user-background: var(--brand-accent-100); 3052 --color-chat-user-foreground: var(--color-gray-900); 3053 --color-chat-assistant-background: var(--color-gray-100); 3054 --color-chat-assistant-foreground: var(--color-gray-900); 3055 --color-chat-system-background: var(--color-gray-50); 3056 --color-chat-system-foreground: var(--color-gray-600); 3057 --color-tab-default-foreground: var(--color-gray-600); 3058 --color-tab-selected-foreground: var(--brand-accent-600); 3059 --color-nav-selected-background: var(--brand-accent-100); 3060 --color-nav-selected-foreground: var(--brand-accent-700); 3061 --color-nav-default-background: var(--color-white); 3062 --color-nav-default-foreground: var(--color-gray-700); 3063 --color-switch-off-track: var(--color-gray-300); 3064 --color-switch-on-track: var(--brand-accent-600); 3065 --color-switch-thumb: var(--color-white); 3066 --color-progress-track: var(--color-gray-200); 3067 --color-progress-accent: var(--brand-accent-600); 3068 --color-progress-success: var(--color-green-600); 3069 --color-progress-warning: var(--color-amber-500); 3070 --color-progress-error: var(--color-red-600); 3071 --color-progress-neutral: var(--color-gray-500); 3072 --color-skeleton: var(--color-gray-200); 3073} 3074`,uh=`/** 3075 * GENERATED FILE â DO NOT EDIT. 3076 * Source of truth: tokens/*.tokens.json â regenerate with: npm run tokens 3077 */ 3078 3079[data-theme="dark"] { 3080 --color-surface-background: var(--color-gray-800); 3081 --color-surface-foreground: var(--color-gray-100); 3082 --color-surface-raised: var(--color-gray-700); 3083 --color-surface-sunken: var(--color-gray-800); 3084 --color-action-primary-background: var(--brand-accent-500); 3085 --color-action-primary-background-hover: var(--brand-accent-400); 3086 --color-action-primary-foreground: var(--color-white); 3087 --color-action-secondary-background: var(--color-gray-700); 3088 --color-action-secondary-background-hover: var(--color-gray-600); 3089 --color-action-secondary-foreground: var(--color-gray-100); 3090 --color-action-danger-background: var(--color-red-500); 3091 --color-action-danger-background-hover: var(--color-red-400); 3092 --color-action-danger-foreground: var(--color-white); 3093 --color-action-destructive-background: var(--color-red-500); 3094 --color-action-destructive-background-hover: var(--color-red-400); 3095 --color-action-destructive-foreground: var(--color-white); 3096 --color-action-ghost-background: var(--color-gray-800); 3097 --color-action-ghost-foreground: var(--color-gray-200); 3098 --color-action-ghost-background-hover: var(--color-gray-700); 3099 --color-border-focus: var(--brand-accent-300); 3100 --color-border-subtle: var(--color-gray-600); 3101 --color-feedback-info-background: var(--color-blue-900); 3102 --color-feedback-info-foreground: var(--color-blue-100); 3103 --color-feedback-success-background: var(--color-green-900); 3104 --color-feedback-success-foreground: var(--color-green-100); 3105 --color-feedback-warning-background: var(--color-amber-900); 3106 --color-feedback-warning-foreground: var(--color-amber-100); 3107 --color-feedback-danger-background: var(--color-red-900); 3108 --color-feedback-danger-foreground: var(--color-red-100); 3109 --color-feedback-error-background: var(--color-red-900); 3110 --color-feedback-error-foreground: var(--color-red-100); 3111 --color-identity-background: var(--brand-accent-900); 3112 --color-identity-foreground: var(--brand-accent-100); 3113 --color-table-row-default: var(--color-gray-700); 3114 --color-table-row-selected: var(--brand-accent-900); 3115 --color-token-default-background: var(--color-gray-700); 3116 --color-token-default-foreground: var(--color-gray-100); 3117 --color-token-gray-background: var(--color-gray-600); 3118 --color-token-gray-foreground: var(--color
3118-gray-100); 3119 --color-token-red-background: var(--color-red-900); 3120 --color-token-red-foreground: var(--color-red-100); 3121 --color-token-orange-background: var(--color-orange-900); 3122 --color-token-orange-foreground: var(--color-orange-100); 3123 --color-token-yellow-background: var(--color-yellow-900); 3124 --color-token-yellow-foreground: var(--color-yellow-100); 3125 --color-token-green-background: var(--color-green-900); 3126 --color-token-green-foreground: var(--color-green-100); 3127 --color-token-teal-background: var(--color-teal-900); 3128 --color-token-teal-foreground: var(--color-teal-100); 3129 --color-token-cyan-background: var(--color-cyan-900); 3130 --color-token-cyan-foreground: var(--color-cyan-100); 3131 --color-token-blue-background: var(--color-blue-900); 3132 --color-token-blue-foreground: var(--color-blue-100); 3133 --color-token-purple-background: var(--color-purple-900); 3134 --color-token-purple-foreground: var(--color-purple-100); 3135 --color-token-pink-background: var(--color-pink-900); 3136 --color-token-pink-foreground: var(--color-pink-100); 3137 --color-status-success: var(--color-green-500); 3138 --color-status-warning: var(--color-amber-500); 3139 --color-status-error: var(--color-red-500); 3140 --color-status-accent: var(--brand-accent-400); 3141 --color-status-neutral: var(--color-gray-500); 3142 --color-divider-subtle: var(--color-gray-600); 3143 --color-divider-strong: var(--color-gray-500); 3144 --color-input-background: var(--color-gray-700); 3145 --color-input-placeholder: var(--color-gray-400); 3146 --color-toast-info-background: var(--color-gray-100); 3147 --color-toast-info-foreground: var(--color-gray-900); 3148 --color-toast-error-background: var(--color-red-500); 3149 --color-toast-error-foreground: var(--color-white); 3150 --color-text-secondary: var(--color-gray-300); 3151 --color-checkbox-unchecked-background: var(--color-gray-700); 3152 --color-checkbox-unchecked-border: var(--color-gray-500); 3153 --color-checkbox-checked-background: var(--brand-accent-500); 3154 --color-checkbox-checked-border: var(--brand-accent-500); 3155 --color-checkbox-indeterminate-background: var(--brand-accent-500); 3156 --color-checkbox-indeterminate-border: var(--brand-accent-500); 3157 --color-checkbox-icon: var(--color-white); 3158 --color-section-section: var(--color-gray-700); 3159 --color-section-muted: var(--color-gray-800); 3160 --color-chat-user-background: var(--brand-accent-900); 3161 --color-chat-user-foreground: var(--color-gray-100); 3162 --color-chat-assistant-background: var(--color-gray-700); 3163 --color-chat-assistant-foreground: var(--color-gray-100); 3164 --color-chat-system-background: var(--color-gray-800); 3165 --color-chat-system-foreground: var(--color-gray-300); 3166 --color-tab-default-foreground: var(--color-gray-300); 3167 --color-tab-selected-foreground: var(--brand-accent-400); 3168 --color-nav-selected-background: var(--brand-accent-900); 3169 --color-nav-selected-foreground: var(--brand-accent-100); 3170 --color-nav-default-background: var(--color-gray-700); 3171 --color-nav-default-foreground: var(--color-gray-200); 3172 --color-switch-off-track: var(--color-gray-500); 3173 --color-switch-on-track: var(--brand-accent-500); 3174 --color-switch-thumb: var(--color-white); 3175 --color-progress-track: var(--color-gray-600); 3176 --color-progress-accent: var(--brand-accent-400); 3177 --color-progress-success: var(--color-green-500); 3178 --color-progress-warning: var(--color-amber-500); 3179 --color-progress-error: var(--color-red-500); 3180 --color-progress-neutral: var(--color-gray-400); 3181 --color-skeleton: var(--color-gray-600); 3182} 3183`,dh=`/** 3184 * GENERATED FILE â DO NOT EDIT. 3185 * Source of truth: tokens/*.tokens.json â regenerate with: npm run tokens 3186 */ 3187 3188[data-brand="aurora"] { 3189 --brand-accent-100: var(--color-teal-100); 3190 --brand-accent-300: var(--color-teal-300); 3191 --brand-accent-400: var(--color-teal-400); 3192 --brand-accent-500: var(--color-teal-500); 3193 --brand-accent-600: var(--color-teal-600); 3194 --brand-accent-700: var(--color-teal-700); 3195 --brand-accent-900: var(--color-teal-900); 3196 --brand-radius-control: var(--radius-none); 3197 --brand-font-control-family: var(--font-family-mono); 3198 --brand-font-control-weight: var(--font-weight-semibold); 3199} 3200`,fh={primitives:rh,semantic:ih,light:ah,dark:oh,brands:{default:sh,aurora:ch}},ph=Rl([rh,ih,ah,oh]),mh=Hl({primitives:rh,semantic:ih,light:ah,brandDefault:sh}),hh=[rh,ih,ah,oh],gh={base:lh,dark:uh,brands:dh},_h=Object.assign({"../../../contracts/accordion-item.contract.json":D,"../../../contracts/avatar-group.contract.json":O,"../../../contracts/avatar.contract.json":re,"../../../contracts/badge.contract.json":ie,"../../../contracts/banner.contract.json":ae,"../../../contracts/bento-grid.contract.json":oe,"../../../contracts/blockquote.contract.json":k,"../../../contracts/breadcrumb-item.contract.json":A,"../../../contracts/breadcrumbs.contract.json":se,"../../../contracts/button.contract.json":j,"../../../contracts/card.contract.json":ce,"../../../contracts/chat-message-metadata.contract.json":M,"../../../contracts/chat-message.contract.json":N,"../../../contracts/chat-system-message.contract.json":P,"../../../contracts/checkbox.contract.json":le,"../../../contracts/citation.contract.json":ue,"../../../contracts/code.contract.json":de,"../../../contracts/divider.contract.json":fe,"../../../contracts/empty-state.contract.json":pe,"../../../contracts/field.contract.json":me,"../../../contracts/grid-gallery.contract.json":he,"../../../contracts/heading.contract.json":ge,"../../../contracts/icon-button.contract.json":_e,"../../../contracts/inline.contract.json":ve,"../../../contracts/kbd.contract.json":ye,"../../../contracts/list-item.contract.json":be,"../../../contracts/list.contract.json":xe,"../../../contracts/metadata-list-item.contract.json":Se,"../../../contracts/metadata-list.contract.json":Ce,"../../../contracts/page-shell.contract.json":we,"../../../contracts/pagination.contract.json":Te,"../../../contracts/progress-bar.contract.json":Ee,"../../../contracts/section.contract.json":De,"../../../contracts/side-nav-item.contract.json":Oe,"../../../contracts/sidebar-layout.contract.json":ke,"../../../contracts/skeleton.contract.json":Ae,"../../../contracts/slider.contract.json":je,"../../../contracts/spinner.contract.json":Me,"../../../contracts/stack.contract.json":Ne,"../../../contracts/status-dot.contract.json":Pe,"../../../contracts/switch.contract.json":Fe,"../../../contracts/tab-list.contract.json":Ie,"../../../contracts/tab.contract.json":Le,"../../../contracts/table-cell.contract.json":Re,"../../../contracts/table-header-cell.contract.json":ze,"../../../contracts/table-row.contract.json":Be,"../../../contracts/table.contract.json":Ve,"../../../contracts/text-area.contract.json":He,"../../../contracts/text-field.contract.json":Ue,"../../../contracts/toast.contract.json":We,"../../../contracts/token.contract.json":Ge,"../../../contracts/toolbar.contract.json":Ke,"../../../contracts/top-nav-item.contract.json":qe,"../../../contracts/top-nav.contract.json":Je,"../../../contracts/two-column.contract.json":Ye,"../../../contracts/typeahead-item.contract.json":Xe}),vh=new Map,yh=new Map;for(let e of Object.values(_h)){let t=bl.safeParse(e);t.success&&(vh.set(t.data.id,t.data),yh.set(t.data.id,e))}var bh=new Map([...vh.values()].map(e=>[e.name,e.id])),xh=new Map([...vh.values()].filter(e=>e.anchors.figma.componentSetKey!==null).map(e=>[e.anchors.figma.componentSetKey,e.id])),Sh=new Map(Object.entries(Object.assign({"../../../assets/icons/asterisk.svg":Ze,"../../../assets/icons/check-double.svg":Qe,"../../../assets/icons/check.svg":$e,"../../../assets/icons/chevron-down.svg":et,"../../../assets/icons/chevron-left.svg":tt,"../../../assets/icons/chevron-right.svg":nt,"../../../assets/icons/clock.svg":rt,"../../../assets/icons/close.svg":it,"../../../assets/icons/closed.svg":at,"../../../assets/icons/dash.svg":ot,"../../../assets/icons/delivered.svg":st,"../../../assets/icons/error.svg":ct,"../../../assets/icons/info.svg":lt,"../../../assets/icons/open.svg":ut,"../../../assets/icons/read.svg":dt,"../../../assets/icons/search.svg":ft,"../../../assets/icons/sending.svg":pt,"../../../assets/icons/sent.svg":mt,"../../../assets/icons/spinner.svg":ht,"../../../assets/icons/success.svg":gt,"../../../assets/icons/warning.svg":_t})).map(([e,t])=>[e.split(`/`).pop().replace(/\.svg$/,``),t.trim()]));function Ch(){return(0,f.jsxs)(`div`,{className:`landing`,children:[(0,f.jsx)(`p`,{className:`landing__kicker`,children:`Design-system contracts â proof of concept`}),(0,f.jsx)(`h1`,{children:`The contract loop, in your browser.`}),(0,f.jsxs)(`p`,{className:`landing__pitch`,children:[`A `,(0,f.jsx)(`b`,{children:`contract`}),` is one JSON file per component. It records the things design and engineering have to agree on â the props and their legal values, the parts the component is made of, which design token paints each part, and its states. Both a React component and a real Figma component set are `,(0,f.jsx)(`i`,{children:`generated`}),` from that one file, and then continuously checked against it.`]}),(0,f.jsxs)(`p`,{className:`landing__pitch`,children:[`This page runs the real engine â the same code behind a `,vh.size,`-component library â right in y
3200our browser. Load a contract, change it, and watch what happens: the React, the HTML, the Figma sync script and the canvas preview all move together, and anything the engine canât do it says out loud instead of guessing.`,` `,(0,f.jsx)(`b`,{children:`Nothing you paste leaves your browser`}),`, and there are no accounts.`]}),(0,f.jsxs)(`p`,{className:`landing__pitch`,children:[(0,f.jsx)(`b`,{children:`Start here:`}),` open an example, then break its contract on purpose â delete a required field, or point a token binding at a name that doesnât exist. The refusal that appears, named and on screen, is the whole idea.`]}),(0,f.jsxs)(`p`,{className:`landing__pitch landing__pitch--aside`,children:[`This playground is for `,(0,f.jsx)(`i`,{children:`understanding`}),` the model and trying a contract. Actually building your library into Figma is the CLI plus the companion plugin â`,` `,(0,f.jsx)(`a`,{href:`https://ds-contracts-spec.pages.dev/get-started/`,target:`_blank`,rel:`noreferrer`,children:`the three get-started paths`}),` `,`walk that end to end.`]}),(0,f.jsxs)(`div`,{className:`landing__loop`,"aria-label":`The contract loop`,children:[(0,f.jsx)(`span`,{className:`landing__loop-step`,children:`design / code`}),(0,f.jsx)(`span`,{className:`landing__loop-arrow`,"aria-hidden":!0,children:`â`}),(0,f.jsx)(`b`,{className:`landing__loop-step`,children:`proposed contract`}),(0,f.jsx)(`span`,{className:`landing__loop-arrow`,"aria-hidden":!0,children:`â`}),(0,f.jsx)(`span`,{className:`landing__loop-step`,children:`schema governance (named refusals)`}),(0,f.jsx)(`span`,{className:`landing__loop-arrow`,"aria-hidden":!0,children:`â`}),(0,f.jsx)(`span`,{className:`landing__loop-step`,children:`React · HTML · inline · Figma`})]}),(0,f.jsxs)(`div`,{className:`landing__ctas`,children:[(0,f.jsxs)(_,{to:`/examples`,className:`cta`,children:[(0,f.jsx)(`div`,{className:`cta__title`,children:`Try an example`}),(0,f.jsx)(`div`,{className:`cta__desc`,children:`Pick from the gallery â atoms to compositions, plus foreign code degrading honestly.`})]}),(0,f.jsxs)(_,{to:`/playground?source=figma`,className:`cta`,children:[(0,f.jsx)(`div`,{className:`cta__title`,children:`Import from Figma`}),(0,f.jsx)(`div`,{className:`cta__desc`,children:`Paste a figma.com component URL + token; get a proposed contract with real bindings or named degradations.`})]}),(0,f.jsxs)(_,{to:`/playground?source=code`,className:`cta`,children:[(0,f.jsx)(`div`,{className:`cta__title`,children:`Paste code`}),(0,f.jsx)(`div`,{className:`cta__desc`,children:`TSX + CSS in, a proposed contract out â raw values reported with nearest-token candidates, never invented.`})]})]}),(0,f.jsxs)(`p`,{className:`landing__foot`,children:[`Same engine, no demo copy: the code emitting here generates the repoâs`,` `,vh.size,` shipping components, byte-guarded by its evals.`,` `,(0,f.jsx)(`a`,{href:Dx,target:`_blank`,rel:`noreferrer`,children:`Source on GitHub`}),` `,`·`,` `,(0,f.jsx)(`a`,{href:`${Dx}/blob/main/MILESTONES.md`,target:`_blank`,rel:`noreferrer`,children:`Milestones`})]})]})}var wh=`// FIXTURE: a "foreign" component styled with plain CSS â literal colors and 3201// px values, an unresolvable css var, a data-attribute variant hook, and a 3202// tailwind-ish string className â to prove anatomy extraction DEGRADES BY 3203// NAME on code this repo's generator never emitted: extract what is legible 3204// (structure, slots, content bindings), report the rest per declaration, 3205// and NEVER turn a raw value into an invented token. 3206import styles from './Callout.module.css'; 3207 3208interface CalloutProps { 3209 /** Callout heading text. */ 3210 heading: string; 3211 tone?: 'info' | 'warning'; 3212 children?: React.ReactNode; 3213} 3214 3215export function Callout({ heading, tone = 'info', children }: CalloutProps) { 3216 return ( 3217 <section className={styles.root} data-tone={tone}> 3218 <h3 className={styles.heading}>{heading}</h3> 3219 <span className="badge badge--soft">beta</span> 3220 <div className={styles.body}>{children}</div> 3221 </section> 3222 ); 3223} 3224`,Th=`/* FIXTURE: hand-written styles â nothing here came from a generator. */ 3225 3226.root {
3227 display: flex; 3228 flex-direction: column; 3229 gap: 8px; /* raw â the token tree HAS 8px tokens; candidates, not decisions */ 3230 background-color: #f9fafb; /* raw â equals color.gray.50's value */ 3231 border: 1px solid #f59e0b; /* shorthand â not invertible to one binding */ 3232 border-radius: 6px; /* raw â NO token has this value */ 3233 padding: 12px; /* raw â equals space.150's value */ 3234} 3235 3236.root[data-tone='warning'] { 3237 background-color: #fef3c7; /* variant via data attribute â not an enum class */ 3238} 3239 3240.heading { 3241 margin: 0; 3242 font-size: 14px; /* raw */ 3243 color: var(--text-muted); /* var that resolves to NO token in the tree */ 3244} 3245 3246.body { 3247 color: #374151; /* raw â equals color.gray.700's value */ 3248} 3249 3250@media (max-width: 600px) { 3251 .root { 3252 padding: 8px; 3253 } 3254} 3255`,Eh=(e,t)=>{let n=vh.get(e)?.props.find(e=>e.name===t);return n&&typeof n.type==`object`&&`enum`in n.type?n.type.enum:[]},Dh=[`zero`,`one`,`two`,`three`,`four`,`five`,`six`,`seven`,`eight`,`nine`],Oh=e=>Dh[e]??String(e),kh=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)}${e.length>2?`,`:``} and ${e[e.length-1]}`,Ah=Oh(Eh(`ds.badge`,`variant`).length),jh=kh(vh.get(`ds.button`)?.states??[]),Mh=Eh(`ds.chat-message-metadata`,`status`).join(`, `),Nh=Oh(Eh(`ds.chat-message-metadata`,`status`).length),Ph=[{kind:`contract`,slug:`badge`,contractId:`ds.badge`,name:`Badge`,category:`Atom`,blurb:`Status at a glance. Enum variants bound to feedback tokens â the smallest complete contract.`,caption:`One enum prop fans out on both surfaces: ${Ah} variant classes in the CSS, ${Ah} Figma variants in the sync script â same source line.`},{kind:`contract`,slug:`button`,contractId:`ds.button`,name:`Button`,category:`Atom`,blurb:`Variants, sizes, icon slots, and figmaStatePreviews â the React output ships a state-preview story.`,caption:`State previews: ${jh} ship as extra canvas variants (the State axis) while code keeps them as live CSS states.`},{kind:`contract`,slug:`switch`,contractId:`ds.switch`,name:`Switch`,category:`Atom`,blurb:`An off/on control with a declared toggle boundary. CSS renders both states; the React output wires the handler.`,caption:`A real input[type=checkbox] with role=switch carries the semantics; spacer parts with visibility conditions move the thumb â off/on is an enum, so both states render truthfully on both surfaces.`},{kind:`contract`,slug:`checkbox`,contractId:`ds.checkbox`,name:`Checkbox`,category:`Atom`,blurb:`Checked, unchecked, indeterminate â a native input inside the label; icon assets inlined from the same SVGs the generator uses.`,caption:`All three values render as variants; indeterminate is a DOM property â the React output sets it, static HTML names the limit in a comment while the dash glyph still shows the state. onToggle stays code-only.`},{kind:`contract`,slug:`heading`,contractId:`ds.heading`,name:`Heading`,category:`Atom`,blurb:`Semantic levels with token-bound type styles â element choice driven by the contract.`,caption:`The rendered element follows the level prop: level 2 emits an h2 â semantics live in the contract, not a template.`},{kind:`contract`,slug:`card`,contractId:`ds.card`,name:`Card`,category:`Molecule`,blurb:`Slots on a raised surface. Composition refs resolve through the bundled contract set.`,caption:`Composition: a nested Avatar instance plus children and actions slots â slot content resolves through its own contract, never copied in.`},{kind:`contract`,slug:`banner`,contractId:`ds.banner`,name:`Banner`,category:`Molecule`,blurb:`Feedback surface composing icon + text parts, tone and ARIA role driven by one status enum.`,caption:`Slots with accepts: the endContent slot names ds.button as its preferred filler â guidance both surfaces carry with the insertion point.`},{kind:`contract`,slug:`chat-message`,contractId:`ds.chat-message`,name:`ChatMessage`,category:`Composition`,blurb:`Composes Avatar and ChatMessageMetadata by contract id â the dependency CSS rides along.`,caption:`A layoutByProp entry flips the row when sender is user â the same flip lands in CSS rules and in compiled Figma variants.`},{kind:`contract`,slug:`chat-message-metadata`,contractId:`ds.chat-message-metadata`,name:`ChatMessageMetadata`,category:`Composition`,blurb:`The composed child on its own â small contracts stay independently emittable.`,caption:`The status enum picks the icon asset per variant â ${Mh} â one anatomy part, ${Nh} glyphs.`},{kind:`code`,slug:`callout-foreign`,name:`Callout (foreign code)`,category:`Foreign code`,blurb
3255:`Hand-written CSS this engine never generated. Structure is extracted; every raw value is reported with nearest-token candidates â named degradation, nothing invented.`,caption:`Raw values get reported, never invented â the receipts list every hex and px with its nearest-token candidates. The proposal then refuses on purpose (see below).`,expectedRefusal:`This example refuses ON PURPOSE. The foreign componentâs required "heading" text prop declares no string default, so the generator refuses by name instead of inventing one â the same honesty the receipts apply to its raw values. Add a default (or run Fix with AI) and watch it pass.`,tsx:wh,css:Th,sourcePath:`extract/fixtures/foreign-css/Callout.tsx`}],Fh=new Map(Ph.map(e=>[e.slug,e])),Ih=`ds-playground.workspace`,Lh=1,Rh=e=>e===`figma`||e===`code`||e===`prompt`||e===`json`;function zh(){try{let e=sessionStorage.getItem(Ih);if(!e)return[];let t=JSON.parse(e);return t?.v!==Lh||!Array.isArray(t.entries)?[]:t.entries.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`&&typeof e.name==`string`&&typeof e.contractText==`string`&&typeof e.importedAt==`number`&&Rh(e.source))}catch{return[]}}var Bh=zh(),Vh=new Set,Hh=()=>Vh.forEach(e=>e()),Uh=e=>(Vh.add(e),()=>Vh.delete(e)),Wh=()=>Bh,Gh=()=>Bh;function Kh(){return(0,l.useSyncExternalStore)(Uh,Wh)}function qh(){try{return sessionStorage.setItem(Ih,JSON.stringify({v:Lh,entries:Bh})),null}catch(e){return`workspace-storage-refused: sessionStorage rejected the write (${e instanceof Error?e.message:String(e)}) â this session's workspace lives in memory only.`}}function Jh(e){let t={id:`ws-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name,contractId:e.contractId,source:e.source,contractText:e.contractText,receipts:e.receipts,...e.mintedTokens&&e.mintedTokens.count>0?{mintedTokens:e.mintedTokens}:{},...e.capturedTokens&&e.capturedTokens.count>0?{capturedTokens:e.capturedTokens}:{},...e.childStubs&&e.childStubs.length>0?{childStubs:e.childStubs}:{},importedAt:Date.now()},n=[],r=[t,...Bh.filter(t=>!(t.source===e.source&&t.name===e.name))];if(r.length>30){let e=r.splice(30);for(let t of e)n.push(`workspace: evicted the oldest entry "${t.name}" (${t.source}) â the session keeps 30.`)}Bh=r;let i=qh();if(i&&n.push(i),Hh(),n.length===0)return{entry:t,receipts:e.receipts};let a={title:`Workspace`,kind:`note`,entries:n.map(e=>({message:e}))};return{entry:t,receipts:e.receipts?{...e.receipts,groups:[...e.receipts.groups,a]}:{source:`workspace`,groups:[a]}}}function Yh(e){let t=Bh.filter(t=>t.id!==e);t.length!==Bh.length&&(Bh=t,qh(),Hh())}function Xh(){Bh=[];try{sessionStorage.removeItem(Ih)}catch{}Hh()}var Zh=new Map;function Qh(e){let t=Zh.get(e.id);if(t)return t;let n=null;try{let t=bl.safeParse(JSON.parse(e.contractText));n=t.success?t.data:null}catch{n=null}let r=[];for(let t of e.childStubs??[]){let e=bl.safeParse(t);e.success&&r.push(e.data)}let i={contract:n,stubs:r};return Zh.set(e.id,i),i}function $h(e){let t={contracts:new Map,stubs:new Map,idByName:new Map,idByKey:new Map,mintedTrees:[],capturedLayers:[],layersByContractId:new Map};for(let n of[...e].reverse()){let{contract:e,stubs:r}=Qh(n);for(let e of r)t.stubs.set(e.id,e);if(n.mintedTokens&&n.mintedTokens.count>0&&t.mintedTrees.push(n.mintedTokens.tree),n.capturedTokens&&n.capturedTokens.count>0&&t.capturedLayers.push(n.capturedTokens),!e)continue;t.contracts.set(e.id,e),t.layersByContractId.set(e.id,{name:n.name||e.name,minted:n.mintedTokens&&n.mintedTokens.count>0?n.mintedTokens:null,captured:n.capturedTokens&&n.capturedTokens.count>0?n.capturedTokens:null}),t.idByName.set(e.name,e.id),n.name&&t.idByName.set(n.name,e.id);let i=e.anchors.figma.componentSetKey;i&&t.idByKey.set(i,e.id)}return t}function eg(){return $h(Gh())}var tg=e=>`--${e.split(`.`).join(`-`)}`,ng=/^\{([^}]+)\}$/;function rg(e,t=`:root`){let n=zl(e),r=[],i=[`/* Regenerated in the browser from the pasted DTCG tree(s) â`,` same rules as scripts/build-tokens.mjs, session-only. */`,``,`${t} {`];for(let[e,t]of n){let a=t.value,o;if(typeof a==`string`){let t=a.match(ng);if(t){if(!n.has(t[1])){r.push(`Token "${e}" references "{${t[1]}}" which does not exist in the pasted tree`);continue}o=`var(${tg(t[1])})`}else o=a}else o=String(a);i.push(` ${tg(e)}: ${o};`)}return i.push(`}`,``),{css:i.join(` 3256`),errors:r}}var ig={kind:`repo`,label:`repo tokens (bundled tokens/*.tokens.json)`,tree:fh,inventory:ph,corpus:mh,treesForCode:hh,stylesheets:gh,docCount:4};function ag(e){let t=(e,n)=>{let r={...e};for(let[e,i]of Object.entries(n)){let n=r[e];r[e]=n&&i&&typeof n==`object`&&typeof i==`object`&&!Array.isArray(n)&&!Array.isArray(i)?t(n,i):i}return r};return e.reduce(t,{})}function og(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,errors:[`Not JSON â ${e instanceof Error?e.message:String(e)}`]}}let n=Array.isArray(t)?t:[t],r=[];for(let[e,t]of n.entries())(!t||typeof t!=`object`||Array.isArray(t))&&r.push(`Document ${e+1} is not an object â a DTCG token document is a JSON object of groups and $value leaves`);if(r.length>0)return{ok:!1,errors:r};let i=n,a=Rl(i);if(a.size===0){let e=`Not DTCG-shaped: no $value leaves found â tokens must be objects like { "$value": "#dbeafe", "$type": "color" }`,t=i.map(e=>Kl(e));if(t.length>0&&t.every(e=>e!==null)){let n=t.map(e=>e.tree);return{ok:!1,errors:[e],plainWrap:{text:JSON.stringify(n.length===1?n[0]:n,null,2)+` 3257`,count:t.reduce((e,t)=>
3257e+t.count,0),skipped:t.flatMap(e=>e.skipped)}}}return{ok:!1,errors:[e]}}let o=ag(i),{css:s,errors:c}=rg(o);if(c.length>0)return{ok:!1,errors:c};let l={};return{ok:!0,source:{kind:`user`,label:`your tokens (pasted, session-only â ${n.length} document${n.length===1?``:`s`})`,tree:{primitives:l,semantic:o,light:l,dark:l,brands:{}},inventory:a,corpus:Hl({primitives:l,semantic:o,light:l,brandDefault:l}),treesForCode:[o],stylesheets:{base:s,dark:``,brands:``},docCount:n.length}}}function sg(e,t){let n={};for(let r of e.entries){if(!t.has(r.path))continue;let e=r.path.split(`.`),i=n;for(let t of e.slice(0,-1))i=i[t]??={};i[e[e.length-1]]={$value:r.value,$type:r.type}}return n}function cg(e,t){if(!t||t.count===0)return{source:e,shadowed:[]};let n=t.entries.filter(t=>e.inventory.has(t.path)).map(e=>e.name),r=t.entries.filter(t=>!e.inventory.has(t.path));if(r.length===0)return{source:e,shadowed:n};let i=new Set(r.map(e=>e.path)),a=sg(t,i),o=ag([e.tree.semantic,a]);return{shadowed:n,source:{...e,label:`${e.label} + ${r.length} captured Figma variable${r.length===1?``:`s`}`,tree:{...e.tree,semantic:o},inventory:new Set([...e.inventory,...i]),treesForCode:[...e.treesForCode,a],stylesheets:{...e.stylesheets,base:`${e.stylesheets.base}\n/* Captured tokens (from your Figma variables) â ${r.length} registered; repo tokens win on name collision. */\n${iu(a)}`}}}}function lg(e,t){if(!t||t.count===0)return e;let n=ag([e.tree.semantic,t.tree]);return{...e,label:`${e.label} + ${t.count} minted provisional token${t.count===1?``:`s`} (imported.*)`,tree:{...e.tree,semantic:n},inventory:new Set([...e.inventory,...Rl([t.tree])]),treesForCode:[...e.treesForCode,t.tree],stylesheets:{...e.stylesheets,base:`${e.stylesheets.base}\n/* Minted provisional tokens (imported.*) â literal fidelity, rename against your real tokens. */\n${iu(t.tree)}`}}}var ug=`ds-playground.user-tokens`,dg=ig,fg=null,pg=null,mg=[],hg=ig,gg=new Set,_g=()=>{let e=cg(dg,pg);mg=e.shadowed,hg=lg(e.source,fg)},vg=()=>gg.forEach(e=>e()),yg=()=>hg,bg=()=>mg;function xg(e){let t=e&&e.count>0?e:null;t!==pg&&(pg=t,_g(),vg())}var Sg=()=>dg,Cg=()=>fg;function wg(e){let t=e&&e.count>0?e:null;t!==fg&&(fg=t,_g(),vg())}function Tg(e,t){if(!fg)return{ok:!1,error:`no minted token layer is active`};let n=zl(fg.tree),r=n.get(e);if(!r)return{ok:!1,error:`"${e}" is not a minted leaf in the active layer`};if(!/^[a-zA-Z0-9][a-zA-Z0-9.-]*$/.test(t)||t.endsWith(`.`))return{ok:!1,error:`"${t}" is not a valid dot-separated token path`};n.delete(e);let i=dg.inventory.has(t);if(!i){if(n.has(t))return{ok:!1,error:`"${t}" already exists in the minted layer with a different origin`};n.set(t,r)}let a={};for(let[e,t]of n){let n=e.split(`.`),r=a;for(let e of n.slice(0,-1))r=r[e]??={};r[n[n.length-1]]={$value:t.value,$type:t.type}}return fg={tree:a,count:n.size,entries:fg.entries.map(n=>n.ref===`{${e}}`?{...n,ref:`{${t}}`}:n)},_g(),vg(),{ok:!0,deduped:i}}function Eg(e){return gg.add(e),()=>gg.delete(e)}function Dg(){return(0,l.useSyncExternalStore)(Eg,yg)}function Og(e){let t=og(e);if(t.ok){dg=t.source,_g();try{sessionStorage.setItem(ug,e)}catch{}vg()}return t}function kg(){dg=ig,_g();try{sessionStorage.removeItem(ug)}catch{}vg()}function Ag(){try{return sessionStorage.getItem(ug)??``}catch{return``}}var jg=`{ 3258 "color": { 3259 "$type": "color", 3260 "feedback": { 3261 "info": { "background": { "$value": "#fce7f3" }, "foreground": { "$value": "#9d174d" } }, 3262 "success": { "background": { "$value": "#dcfce7" }, "foreground": { "$value": "#166534" } }, 3263 "warning": { "background": { "$value": "#fef3c7" }, "foreground": { "$value": "#92400e" } }, 3264 "danger": { "background": { "$value": "#fee2e2" }, "foreground": { "$value": "#991b1b" } }, 3265 "error": { "background": { "$value": "#fee2e2" }, "foreground": { "$value": "#7f1d1d" } } 3266 } 3267 }, 3268 "font": { 3269 "badge": { "size": { "$type": "dimension", "$value": "11px" } }, 3270 "control": { 3271 "family": { "$type": "fontFamily", "$value": "Georgia, 'Times New Roman', serif" }, 3272 "weight": { "$type": "fontWeight", "$value": 700 } 3273 } 3274 },
3275 "radius": { 3276 "pill": { "$type": "dimension", "$value": "999px" }, 3277 "badge": { "$type": "dimension", "$value": "{radius.pill}" } 3278 }, 3279 "space": { 3280 "$type": "dimension", 3281 "inset-x": { "sm": { "$value": "12px" } }, 3282 "inset-y": { "sm": { "$value": "4px" } } 3283 } 3284} 3285`,Mg=Ag();if(Mg){let e=og(Mg);e.ok&&(dg=e.source,_g())}var Ng={light:`background: #f5f5f5; color: #1a1a1a;`,dark:`background: #2c2c2c; color: #e6e6e6;`,checker:[`background-color: #ffffff;`,`background-image: conic-gradient(#e4e4e4 0 25%, transparent 0 50%, #e4e4e4 0 75%, transparent 0);`,`background-size: 16px 16px;`,`color: #1a1a1a;`].join(` `)},Pg=e=>` 3286 html { color-scheme: light; } 3287 html[data-theme="dark"] { color-scheme: dark; } 3288 body { 3289 margin: 0; 3290 padding: 20px; 3291 ${Ng[e]} 3292 font-family: var(--font-family-sans, system-ui, sans-serif); 3293 } 3294`;function Fg(){let e=eg(),t=[];for(let n of e.capturedLayers)t.push(`/* Session captured tokens (earlier import â the designer's real variables) */\n${iu(n.tree)}`);for(let n of e.mintedTrees)t.push(`/* Session minted tokens (earlier import, imported.*) */\n${iu(n)}`);return t.join(` 3295`)}function Ig(e,t,n=``){let{stylesheets:r}=yg();return[`<!doctype html>`,`<html${t===`dark`?` data-theme="dark"`:``}>`,`<head><meta charset="utf-8">`,`<style>${Fg()}</style>`,`<style>${r.base}\n${r.dark}\n${r.brands}</style>`,`<style>${Pg(t)}</style>`,`<style>${e.css}</style>`,...n?[`<style>${n}</style>`]:[],`</head><body>`,e.html,`</body></html>`].join(` 3296`)}function Lg(e,t,n){let{inventory:r}=yg(),i;try{i=Hd(e,{tokens:r,icons:Sh,contracts:t})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}return{ok:!0,doc:Ig(i,n)}}function Rg(e,t){let n=structuredClone(e);for(let e of n.props)e.name in t&&(e.default=t[e.name]);return n}var zg=` 3297 .showcase > .showcase__item:nth-child(n + 2) { display: none; } 3298 .showcase__label { display: none; } 3299`;function Bg(e){try{let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`.showcase__item`);return t?(t.querySelector(`.showcase__label`)?.remove(),t.innerHTML.trim()):null}catch{return null}}function Vg(e,t,n,r){let{inventory:i}=yg(),a;try{a=Hd(Rg(e,r),{tokens:i,icons:Sh,contracts:t})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}return{ok:!0,doc:Ig(a,n,zg),instanceHtml:Bg(a.html)}}function Hg({contract:e,contracts:t,title:n,className:r,surface:i=`light`}){let a=(0,l.useMemo)(()=>Lg(e,t,i),[e,t,i,Dg()]);return a.ok?(0,f.jsx)(`iframe`,{className:r,sandbox:``,srcDoc:a.doc,title:n}):(0,f.jsx)(`div`,{className:`output__error`,children:a.error})}function Ug({example:e}){if(e.kind===`code`)return(0,f.jsx)(`div`,{className:`excard__thumb excard__thumb--code`,"aria-hidden":`true`,children:e.tsx.split(` 3300`).slice(6,20).join(` 3301`)});let t=vh.get(e.contractId);return t?(0,f.jsx)(`div`,{className:`excard__thumb`,children:(0,f.jsx)(Hg,{contract:t,contracts:vh,title:`${e.name} preview`})}):(0,f.jsx)(`div`,{className:`excard__thumb`})}function Wg(){return(0,f.jsxs)(`div`,{className:`examples`,children:[(0,f.jsx)(`h1`,{children:`Examples`}),(0,f.jsx)(`p`,{className:`examples__sub`,children:`Every card is rendered live by the same emitter you get in the playground â pick one to open it there, contract and all.`}),(0,f.jsx)(`div`,{className:`examples__grid`,children:Ph.map(e=>(0,f.jsxs)(_,{to:`/playground?example=${e.slug}`,className:`excard`,children:[(0,f.jsx)(Ug,{example:e}),(0,f.jsxs)(`div`,{className:`excard__body`,children:[(0,f.jsx)(`div`,{className:`excard__meta`,children:e.category}),(0,f.jsx)(`div`,{className:`excard__name`,children:e.name}),(0,f.jsx)(`div`,{className:`excard__blurb`,children:e.blurb}),(0,f.jsxs)(`div`,{className:`excard__caption`,children:[(0,f.jsx)(`span`,{className:`excard__caption-label`,children:`What to notice`}),e.caption,e.expectedRefusal?(0,f.jsx)(`span`,{className:`excard__flag`,title:e.expectedRefusal,children:`refuses on purpose`}):null]})]})]},e.slug))})]})}var Gg=e=>{let t=e=>Math.round(e*255).toString(16).padStart(2,`0`);return t(e.r)+t(e.g)+t(e.b)},Kg={400:`Regular`,500:`Medium`,600:`Semi Bold`,700:`Bold`},qg=e=>typeof e==`object`&&!!e&&e.type===`VARIABLE_ALIAS`,Jg=e=>`variable id ${e} unresolvable â variables endpoint unavailable (Enterprise) or not provided; resolved value used`;function Yg(e,t,n,r){let i=e.varNameById.get(t.id);if(i!==void 0)return i;e.report.degradations.push({code:`variable-unresolved`,nodePath:n,field:r,message:Jg(t.id)})}function Xg(e,t,n,r){if(!Array.isArray(e))return;let i=e.filter(e=>e.visible!==!1),a=i.find(e=>e.type===`SOLID`);
3301if(!a){let e=i[0];e&&t.report.degradations.push({code:`paint-unsupported`,nodePath:n,field:r,message:`first visible paint is ${e.type}, not SOLID â dump v1 carries solid paints only; paint omitted`});return}let o=i.filter(e=>e!==a);o.length>0&&t.report.degradations.push({code:`paint-stack-truncated`,nodePath:n,field:r,message:`${i.length} visible ${r} paints (${i.map(e=>e.type).join(`, `)}) â dump v1 carries the first SOLID only; ${o.length} paint(s) dropped`});let s=(a.color?.a??1)*(a.opacity??1),c=e=>s<1?{...e,alpha:Math.round(s*1e4)/1e4}:e,l=a.boundVariables?.color;if(l&&qg(l)){let e=Yg(t,l,n,r);if(e)return c({var:e})}if(a.color)return c({hex:Gg(a.color)})}function Zg(e,t,n){let r=e.gradientHandlePositions;if(!Array.isArray(r)||r.length<2){t.report.degradations.push({code:`paint-unsupported`,nodePath:n,field:`fill`,message:`GRADIENT_LINEAR without gradientHandlePositions â gradient not captured (dump v1.16)`});return}let i=e=>Math.round(e*1e4)/1e4,a=[];for(let r of e.gradientStops??[]){if(!r.color)continue;let e={position:i(r.position),hex:Gg(r.color)},o=r.color.a??1;o<1&&(e.alpha=i(o));let s=r.boundVariables?.color;if(s&&qg(s)){let r=Yg(t,s,n,`fill.gradientStop`);r&&(e.var=r)}a.push(e)}if(a.length<2){t.report.degradations.push({code:`paint-unsupported`,nodePath:n,field:`fill`,message:`GRADIENT_LINEAR with ${a.length} usable stop(s) â gradient not captured (dump v1.16)`});return}let o={start:{x:i(r[0].x),y:i(r[0].y)},end:{x:i(r[1].x),y:i(r[1].y)},stops:a};return(e.opacity??1)<1&&(o.alpha=i(e.opacity)),o}function Qg(e,t,n){let r=e.fills;if(!Array.isArray(r))return{};let i=r.filter(e=>e.visible!==!1),a=i.find(e=>e.type===`SOLID`),o=i.find(e=>e.type===`GRADIENT_LINEAR`),s=o!==void 0&&(a===void 0||i.indexOf(o)>i.indexOf(a))?Zg(o,t,n):void 0;!a&&!s&&i.length>0&&t.report.degradations.push({code:`paint-unsupported`,nodePath:n,field:`fill`,message:`first visible fill paint is ${i[0].type}, not SOLID â dump v1.16 carries SOLID and GRADIENT_LINEAR fills only; paint omitted`});let c=+!!a+ +!!s;c>0&&i.length>c&&t.report.degradations.push({code:`paint-stack-truncated`,nodePath:n,field:`fill`,message:`${i.length} visible fill paints (${i.map(e=>e.type).join(`, `)}) â dump v1.16 carries the first SOLID plus a GRADIENT_LINEAR above it only`});let l=a?Xg([a],t,n,`fill`):void 0;return{...l?{fill:l}:{},...s?{gradient:s}:{}}}var $g={size:{x:`width`,y:`height`},individualStrokeWeights:{top:`strokeTopWeight`,right:`strokeRightWeight`,bottom:`strokeBottomWeight`,left:`strokeLeftWeight`},rectangleCornerRadii:{RECTANGLE_TOP_LEFT_CORNER_RADIUS:`topLeftRadius`,RECTANGLE_TOP_RIGHT_CORNER_RADIUS:`topRightRadius`,RECTANGLE_BOTTOM_LEFT_CORNER_RADIUS:`bottomLeftRadius`,RECTANGLE_BOTTOM_RIGHT_CORNER_RADIUS:`bottomRightRadius`}},e_=new Set([`fills`,`strokes`,`characters`,`textRangeFills`,`componentProperties`,`effects`,`layoutGrids`]);function t_(e,t,n){let r={};for(let[i,a]of Object.entries(e.boundVariables??{})){if(a===void 0||e_.has(i))continue;let e=$g[i];if(e){for(let[i,o]of Object.entries(e)){let e=a[i];if(!e||!qg(e))continue;let s=Yg(t,e,n,o);s&&(r[o]=s)}continue}if(Array.isArray(a)||!qg(a))continue;let o=Yg(t,a,n,i);o&&(r[i]=o)}return Object.keys(r).length>0?r:void 0}function n_(e){let t=e.trim(),n=/^(\d+(?:\.\d+)?)px$/.exec(t);if(n)return{px:Number(n[1])};if(n=/^minmax\(\s*0(?:px)?\s*,\s*(\d+(?:\.\d+)?)fr\s*\)$/.exec(t),n||(n=/^(\d+(?:\.\d+)?)fr$/.exec(t),n))return{fr:Number(n[1])};if(/^fit-content\(\s*100%\s*\)$/.test(t))return{fit:!0}}function r_(e){let t=[],n=0,r=``;for(let i of e)i===`(`&&n++,i===`)`&&n--,/\s/.test(i)&&n===0?(r&&t.push(r),r=``):r+=i;r&&t.push(r);let i=[];for(let e of t){let t=/^repeat\(\s*(\d+)\s*,\s*(.+)\)$/.exec(e);if(t){let e=n_(t[2]);if(!e)return;for(let n=0;n<Number(t[1]);n++)i.push({...e});continue}let n=n_(e);if(!n)return;i.push(n)}return i.length>0?i:void 0}function i_(e,t,n){let r=e.layoutMode;if(!(r===void 0||r===`NONE`)){if(r===`GRID`){let r=r_(e.gridRowsSizing??``),i=r_(e.gridColumnsSizing??``);if(!r||!i){t.report.degradations.push({code:`grid-track-unparsed`,nodePath:n,message:`GRID track sizing not parseable into px/fr/fit tracks (gridRowsSizing "${e.gridRowsSizing??`(absent)`}", gridColumnsSizing "${e.gridColumnsSizing??`(absent)`}") â the carriable vocabulary is Npx | minmax(0,Nfr) | fit-content(100%) | integer repeat() thereof (P2/P14); no layout block emitted, anatomy under it is order-only`});return}(typeof e.gridRowCount==`number`&&e.gridRowCount!==r.length||typeof e.gridColumnCount==`number`&&e.gridColumnCount!==i.length)&&t.report.degradations.push({code:`grid-implicit-tracks-lossy`,nodePath:n,message:`declared grid counts (${e.gridRowCount??`?`}Ã${e.gridColumnCount??`?`}) disagree with the parsed track lists (${r.length}Ã${i.length}) â implicit-track readback is LOSSY (P9); the parsed tracks are captured`});
3301let a={rows:r,columns:i,rowGap:e.gridRowGap??0,columnGap:e.gridColumnGap??0,...e.gridItemsPositioning===`ROW_AUTO_FLOW`?{flow:`row`}:{}};return{mode:`GRID`,padding:[e.paddingTop??0,e.paddingRight??0,e.paddingBottom??0,e.paddingLeft??0],primarySizing:e.primaryAxisSizingMode??`AUTO`,counterSizing:e.counterAxisSizingMode??`AUTO`,grid:a}}return{mode:r,primary:e.primaryAxisAlignItems??`MIN`,counter:e.counterAxisAlignItems??`MIN`,spacing:e.itemSpacing??0,padding:[e.paddingTop??0,e.paddingRight??0,e.paddingBottom??0,e.paddingLeft??0],primarySizing:e.primaryAxisSizingMode??`AUTO`,counterSizing:e.counterAxisSizingMode??`AUTO`}}}function a_(e,t,n){let r=e.rectangleCornerRadii;if(Array.isArray(r)&&r.length===4){if(r.every(e=>e===r[0]))return r[0]===0?void 0:r[0];t.report.degradations.push({code:`radii-nonuniform`,nodePath:n,message:`rectangleCornerRadii [${r.join(`, `)}] are not uniform â dump v1 carries a uniform radius only; omitted`});return}if(typeof e.cornerRadius==`number`&&e.cornerRadius!==0)return e.cornerRadius}function o_(e,t,n){let r=e.style??{},i=r.fontWeight===void 0?void 0:Kg[r.fontWeight];i===void 0?(i=r.fontStyle??`Regular`,t.report.notes.push(`${n}: fontWeight ${r.fontWeight??`(absent)`} is outside the generator's weight table â fontStyle "${i}" passed through`)):r.italic===!0&&!/\bItalic\b/.test(i)&&(i=i===`Regular`?`Italic`:`${i} Italic`);let a={characters:e.characters??``,fontSize:r.fontSize??0,fontStyle:i};r.lineHeightUnit===`PIXELS`&&typeof r.lineHeightPx==`number`&&(a.lineHeight=r.lineHeightPx);let o=[];typeof r.letterSpacing==`number`&&r.letterSpacing!==0&&o.push(`letterSpacing ${r.letterSpacing}`),r.textCase===`UPPER`||r.textCase===`LOWER`||r.textCase===`TITLE`?a.textCase=r.textCase:r.textCase!==void 0&&r.textCase!==`ORIGINAL`&&o.push(`textCase ${r.textCase}`),r.textDecoration!==void 0&&r.textDecoration!==`NONE`&&o.push(`textDecoration ${r.textDecoration}`),r.lineHeightUnit!==void 0&&r.lineHeightUnit!==`INTRINSIC_%`&&r.lineHeightUnit!==`PIXELS`&&o.push(`lineHeight ${r.lineHeightPx??`?`}px (${r.lineHeightUnit} â only PIXELS carries, dump v1.3)`),o.length>0&&t.report.degradations.push({code:`text-channel-unsupported`,nodePath:n,field:`text`,message:`text channel(s) with no dump v1 projection: ${o.join(`; `)} â typography carries (fontSize, fontStyle, style identity) only`});let s=e.styles?.text??e.styles?.TEXT;if(s){let e=t.styleById.get(s);e?(a.style=e.name,e.key&&(a.styleKey=e.key)):t.report.degradations.push({code:`text-style-unresolved`,nodePath:n,field:`text.style`,message:`text style id ${s} has no name in the styles map â style identity omitted; typography falls back to (fontSize, fontStyle) matching`})}return a}function s_(e){let t={};for(let[n,r]of Object.entries(e.componentPropertyReferences??{}))r&&(t[n]=r.split(`#`)[0]);return Object.keys(t).length>0?t:void 0}var c_=new Set([`VECTOR`,`STAR`,`POLYGON`,`LINE`,`BOOLEAN_OPERATION`]),l_={REGULAR_POLYGON:`polygon`,ELLIPSE:`ellipse`,RECTANGLE:`rect`},u_=e=>Math.round(e*100)/100,d_=e=>u_((e??0)*180/Math.PI);function f_(e,t,n,r){let i=l_[e.type];if(i===void 0)return;let a=d_(e.rotation);if(i===`rect`&&a===0)return;let o=e.absoluteBoundingBox;if(!o){t.report.degradations.push({code:`vector-geometry-unsupported`,nodePath:n,message:`${e.type} carries no absoluteBoundingBox â shape geometry not capturable (#42); the node carries paints only and renders as a box`});return}let s=Math.round(a/90),c=Math.abs(a-s*90)<.05,l=c&&s%2!=0;c||t.report.degradations.push({code:`rotation-unsupported`,nodePath:n,message:`rotation ${a}° is not a quarter turn â the intrinsic size is not derivable from the REST bounding box; shape size approximated by the post-rotation box (#42 residue)`});let u=u_(l?o.height:o.width),d=u_(l?o.width:o.height),f={kind:i,width:u,height:d};if(a!==0&&(f.rotation=a),e.layoutPositioning===`ABSOLUTE`&&r){let t=o.x-r.x+o.width/2,n=o.y-r.y+o.height/2;f.x=u_(t-u/2),f.y=u_(n-d/2),f.right=u_(r.width-t-u/2),f.bottom=u_(r.height-n-d/2),e.constraints&&(f.constraints={horizontal:e.constraints.horizontal,vertical:e.constraints.vertical})}return f}function p_(e,t,n,r,i){e.blendMode!==void 0&&e.blendMode!==`NORMAL`&&e.blendMode!==`PASS_THROUGH`&&t.report.degradations.push({code:`blend-mode-unsupported`,nodePath:n,message:`blendMode ${e.blendMode} has no dump v1 projection â node renders as NORMAL`}),!i&&typeof e.rotation==`number`&&Math.abs(e.rotation)>1e-6&&t.report.degradations.push({code:`rotation-unsupported`,nodePath:n,message:`rotation ${e.rotation} on a ${e.type} has no dump projection (rotation is carried only on shape decor â dump v1.3) â node renders unrotated (#42 residue)`}),c_.has(e.type)&&t.report.degradations.push({code:`vector-geometry-unsupported`,nodePath:n,message:`${e.type} geometry (arbitrary paths) is not captured â parametric decor (REGULAR_POLYGON/ELLIPSE/rotated RECTANGLE) IS carried since dump v1.3;
3301 this node carries paints only and renders as a box (#42 residue)`});let a=r&&e.type!==`INSTANCE`,o=e.individualStrokeWeights;if(o&&e.type!==`INSTANCE`){let e=[o.top??0,o.right??0,o.bottom??0,o.left??0];new Set(e).size>1&&t.report.degradations.push({code:`stroke-weights-nonuniform`,nodePath:n,message:`per-side stroke weights [${e.join(`, `)}] â dump v1 carries a uniform strokeWeight only; per-side weights dropped`})}a&&Array.isArray(e.strokeDashes)&&e.strokeDashes.length>0&&t.report.degradations.push({code:`stroke-style-unsupported`,nodePath:n,message:`strokeDashes [${e.strokeDashes.join(`, `)}] â dashed strokes have no dump v1 projection; stroke renders solid`}),a&&e.strokeAlign!==void 0&&e.strokeAlign!==`INSIDE`&&t.report.degradations.push({code:`stroke-style-unsupported`,nodePath:n,message:`strokeAlign ${e.strokeAlign} â dump consumers render INSIDE strokes (CSS borders); alignment dropped`})}function m_(e,t,n,r=null,i=null){let a={name:e.name,type:e.type};if(i?.layoutMode===`GRID`&&i.gridItemsPositioning!==`ROW_AUTO_FLOW`&&e.layoutPositioning!==`ABSOLUTE`){let t={row:e.gridRowAnchorIndex??0,column:e.gridColumnAnchorIndex??0};typeof e.gridRowSpan==`number`&&e.gridRowSpan>1&&(t.rowSpan=e.gridRowSpan),typeof e.gridColumnSpan==`number`&&e.gridColumnSpan>1&&(t.columnSpan=e.gridColumnSpan),e.gridChildHorizontalAlign&&e.gridChildHorizontalAlign!==`AUTO`&&(t.alignX=e.gridChildHorizontalAlign),e.gridChildVerticalAlign&&e.gridChildVerticalAlign!==`AUTO`&&(t.alignY=e.gridChildVerticalAlign),a.cell=t}if(e.type===`COMPONENT`){let t=Object.fromEntries(Object.entries(e.componentProperties??{}).filter(([,e])=>e.type===`VARIANT`&&typeof e.value==`string`).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,String(t.value)]));Object.keys(t).length>0&&(a.variantProperties=t)}e.type===`COMPONENT`&&e.absoluteBoundingBox&&(a.bbox={width:u_(e.absoluteBoundingBox.width),height:u_(e.absoluteBoundingBox.height)}),e.clipsContent===!0&&(a.clipsContent=!0);let o=i_(e,t,n);if(o&&(a.layout=o),o?.grid){let r=0,i=0;for(let t of e.children??[])t.layoutPositioning!==`ABSOLUTE`&&(r=Math.max(r,(t.gridRowAnchorIndex??0)+(t.gridRowSpan??1)),i=Math.max(i,(t.gridColumnAnchorIndex??0)+(t.gridColumnSpan??1)));(r>o.grid.rows.length||i>o.grid.columns.length)&&t.report.degradations.push({code:`grid-implicit-tracks-lossy`,nodePath:n,message:`occupied cells (${r}Ã${i}) exceed the declared track lists (${o.grid.rows.length}Ã${o.grid.columns.length}) â implicit-track readback is LOSSY (P9); the declared tracks are captured, the overflowing placements are not contract-expressible (grid-implicit-tracks refusal downstream)`})}let s=a_(e,t,n);s!==void 0&&(a.cornerRadius=s);let c=t_(e,t,n);c&&(a.bound=c);let l=e.type===`TEXT`?{fill:Xg(e.fills,t,n,`fill`)}:Qg(e,t,n),u=l.fill;u&&e.type!==`TEXT`&&(a.fill=u),`gradient`in l&&l.gradient&&(a.gradient=l.gradient);let d=Xg(e.strokes,t,n,`stroke`);d&&(a.stroke=d,typeof e.strokeWeight==`number`&&(a.strokeWeight=e.strokeWeight));let f=f_(e,t,n,r);f&&(a.shape=f),p_(e,t,n,d!==void 0,f!==void 0),typeof e.minWidth==`number`&&(a.minWidth=e.minWidth),typeof e.minHeight==`number`&&(a.minHeight=e.minHeight),typeof e.maxWidth==`number`&&(a.maxWidth=e.maxWidth),typeof e.maxHeight==`number`&&(a.maxHeight=e.maxHeight),e.layoutSizingHorizontal===`FILL`&&(a.fillWidth=!0),e.visible===!1&&(a.hidden=!0),typeof e.opacity==`number`&&e.opacity<1&&(a.opacity=Math.round(e.opacity*1e4)/1e4);let p=[];for(let t of e.effects??[])if(t.visible!==!1)if((t.type===`DROP_SHADOW`||t.type===`INNER_SHADOW`)&&t.color&&t.offset){let e=t.color.a??1,n={type:t.type,color:e<1?{hex:Gg(t.color),alpha:Math.round(e*1e4)/1e4}:{hex:Gg(t.color)},offset:{x:t.offset.x,y:t.offset.y},radius:t.radius??0};typeof t.spread==`number`&&t.spread!==0&&(n.spread=t.spread),p.push(n)}else p.push(typeof t.radius==`number`?{type:t.type,radius:t.radius}:{type:t.type});p.length>0&&(a.effects=p),e.type===`TEXT`&&(a.text=o_(e,t,n),u&&(a.fill=u,u.var&&(a.text.fillVar=u.var)));let m=s_(e);if(m&&(a.propRefs=m),e.type===`INSTANCE`){let r=e.componentId,i=r?t.components.get(r):void 0;if(i){let e=i.componentSetId?t.componentSets.get(i.componentSetId):void 0;a.instanceOf=e?.name??i.name,i.key&&(a.instanceKey=i.key),e?.key&&(a.instanceSetKey=e.key)}else t.report.degradations.push({code:`instance-main-unresolved`,nodePath:n,field:`instanceOf`,message:`componentId ${r??`(absent)`} has no entry in the response's components map â instanceOf omitted; propose.ts falls back to the node name`});let o={};for(let[t,n]of Object.entries(e.componentProperties??{}))n.type!==`INSTANCE_SWAP`&&(o[t]=n.value);Object.keys(o).length>0&&(a.componentProperties=o);let s=e.absoluteBoundingBox;return s&&(a.bbox={width:u_(s.width),height:u_(s.height)}),a}return Array.isArray(e.children)&&(a.children=e.children.map(r=>m_(r,t,`${n}/${r.name}`,e.absoluteBoundingBox??null,e))),a}var h_=[`multi-mode variable values (dump v1.6 modes): not captured on this route â only one modeâs resolved values are readable, so a theme/mode axis resolves single-mode and the other modesâ values are absent`,`absolute placement on non-shape nodes (dump v1.7): not captured on this route â an out-of-flow FRAME/TEXT (e.g. a corner-pinned badge) re-enters the flow and renders in-line`,`image fills (dump v1.7 imageFill / v1.9 imageHash): not captured on this route â an IMAGE paint (e.g. an avatar photo) is read as no fill and renders as an empty box`,`fixed sizes on plain rectangles (dump v1.8 fixedSize): not captured on this route â a drawn width/height is lost and the node sizes to content`,`instance text overrides (dump v1.10 textOverrides): not captured on this route â a hostâs edited label is read as the childâs own default characters`,`strokeAlign (dump v1.11): not captured on this route â an OUTSIDE stroke (focus ring) will be read as an inward border`,`layout wrap + row spacing (dump v1.12 layout.wrap/rowSpacing): not captured on this route â a wrapping row is read as a single non-wrapping line`,`the full constraints map (dump v1.13): not captured on this route â MIN/MAX/CENTER/STRETCH/SCALE pinning carries only on shape decor, not on other node types`];
3301function g_(e,t={}){let n={fileName:e.name,sets:[],degradations:[],notes:[]},r=new Map;for(let[e,n]of Object.entries(t.variables?.meta?.variables??{}))r.set(n.id??e,n.name);let i={_provenance:{fileKey:t.fileKey??null,extractedAt:new Date().toISOString().slice(0,10),note:`Node-tree dump mapped from the Figma REST API (extract/figma/rest/map.ts, dump v1.5) for designâcontract proposal.`,dumpVersion:`1.5`,captureGaps:[...h_]}};for(let a of Object.values(e.nodes??{})){if(!a)continue;let e=a.document;if(e.type!==`COMPONENT_SET`&&e.type!==`COMPONENT`){n.notes.push(`node ${e.id} "${e.name}" is a ${e.type}, not a COMPONENT_SET or COMPONENT â skipped (target a set or component node-id)`);continue}if(e.name===`Slot`||t.target&&e.name!==t.target)continue;let o=new Map;for(let[e,t]of Object.entries(a.styles??{}))o.set(e,{name:t.name,...t.key?{key:t.key}:{}});for(let[e,n]of Object.entries(t.styles??{}))o.set(e,typeof n==`string`?{name:n}:{name:n.name,...n.key?{key:n.key}:{}});let s={varNameById:r,styleById:o,components:new Map(Object.entries(a.components??{})),componentSets:new Map(Object.entries(a.componentSets??{})),report:n},c=e.type===`COMPONENT_SET`?(e.children??[]).map(t=>m_(t,s,`${e.name}:${t.name}`)):[m_(e,s,`${e.name}:${e.name}`)],l=a.componentSets?.[e.id]?.key??a.components?.[e.id]?.key,u={},d={},f={};for(let[t,n]of Object.entries(e.componentPropertyDefinitions??{}))n.type===`VARIANT`&&typeof n.defaultValue==`string`&&Array.isArray(n.variantOptions)&&n.variantOptions.length>0?f[t]={type:`VARIANT`,defaultValue:n.defaultValue,variantOptions:n.variantOptions.map(String)}:n.type===`BOOLEAN`&&typeof n.defaultValue==`boolean`?f[t]={type:`BOOLEAN`,defaultValue:n.defaultValue}:n.type===`TEXT`&&typeof n.defaultValue==`string`?f[t]={type:`TEXT`,defaultValue:n.defaultValue}:n.type===`INSTANCE_SWAP`&&typeof n.defaultValue==`string`?f[t]={type:`INSTANCE_SWAP`,defaultValue:n.defaultValue,...Array.isArray(n.preferredValues)&&n.preferredValues.length>0?{preferredValues:n.preferredValues.map(e=>({type:e.type,key:e.key}))}:{}}:n.type===`SLOT`&&typeof n.defaultValue==`string`&&(f[t]={type:`SLOT`,defaultValue:n.defaultValue,...Array.isArray(n.preferredValues)&&n.preferredValues.length>0?{preferredValues:n.preferredValues.map(e=>({type:e.type,key:e.key}))}:{},...typeof n.description==`string`?{description:n.description}:{},...n.slotSettings?{slotSettings:n.slotSettings}:{}}),n.type===`INSTANCE_SWAP`&&Array.isArray(n.preferredValues)&&n.preferredValues.length>0&&(u[t.split(`#`)[0]]=n.preferredValues.map(e=>({type:e.type,key:e.key}))),n.type===`BOOLEAN`&&typeof n.defaultValue==`boolean`&&(d[t.split(`#`)[0]]=n.defaultValue);let p={setName:e.name,type:e.type,nodeId:e.id,...l?{key:l}:{},...Object.keys(f).length>0?{propertyDefinitions:f}:{},...Object.keys(u).length>0?{swapPreferredValues:u}:{},...Object.keys(d).length>0?{boolDefaults:d}:{},variants:c};i[e.name]=p,n.sets.push(e.name)}return n.sets.length===0&&n.notes.push(t.target?`no COMPONENT_SET or COMPONENT named "${t.target}" in the response â nothing mapped`:`no COMPONENT_SET or COMPONENT documents in the response â nothing mapped`),t.variables||n.notes.push(`variables response not provided â every bound fact degrades to its resolved literal; see variable-unresolved entries`),{dump:i,report:n}}var __=`https://api.figma.com`;function v_(e){let t;try{t=new URL(e)}catch{throw Error(`Not a URL: ${e}`)}if(!/(^|\.)figma\.com$/.test(t.hostname))throw Error(`Not a figma.com URL: ${t.hostname}`);let n=t.pathname.split(`/`).filter(Boolean),r=n[0];if(![`file`,`design`,`proto`,`board`].includes(r)||!n[1])throw Error(`Unrecognized figma.com URL shape "/${n.join(`/`)}" â expected /file/:key/â¦, /design/:key/â¦, /design/:key/branch/:branchKey/â¦, /proto/:key/⦠or /board/:key/â¦`);let i=n[1],a=n[2]===`branch`&&n[3]?n[3]:void 0,o=t.searchParams.get(`node-id`)??void 0;return{fileKey:a??i,mainFileKey:i,...a?{branchKey:a}:{},...o?{nodeId:decodeURIComponent(o).replace(/-/g,`:`)}:{}}}async function y_(e,t,n){let r=await(n.fetchImpl??fetch)(`${n.apiBase??`https://api.figma.com`}${e}`,{headers:{"X-Figma-Token":t}});if(!r.ok){let t=await r.text().catch(()=>``),n=Error(`Figma API ${r.status} on ${e}${t?` â ${t.slice(0,200)}`:``}`);throw n.status=r.status,n.body=t,n}return r.json()}async function b_(e,t,n,r={}){return await y_(`/v1/files/${e}/nodes?ids=${encodeURIComponent(t.join(`,`))}`,n,r)}function x_(e,t){let n=t??``;return e===403&&/file_variables:read/.test(n)?{status:e,kind:`scope`,userFixable:!0,message:'Figma refused /variables/local: your personal access token is missing the `file_variables:read` scope. This is fixable â mint a new token at figma.com â Settings â Security â Personal access tokens with "Variables: read" enabled, and re-run. (Variable NAMES will be unresolved until you do; the import still works, using resolved values.)',body:n.slice(0,300)}:{status:e,kind:`unknown`,userFixable:!1,message:`Figma refused /variables/local with ${e} and did not name a missing scope. Possible causes include the file's plan tier â UNVERIFIED by this project, see docs/HANDOFF.md. Importing without variable names; resolved values are used instead.`,body:n.slice(0,300)}}async function S_(e,t,n={}){try{return await y_(`/v1/files/${e}/variables/local`,t,n)}catch(e){let t=e;if(t.status===403||t.status===404){n.onVariablesUnavailable?.(x_(t.status,t.body??t.message??``));return}throw e}}async function C_(e,t,n={}){return await y_(`/v1/files/${e}`,t,n)}var w_=(e,t=[])=>{if((e.type===`COMPONENT_SET`||e.type===`COMPONENT`)&&(t.push(e),e.type===`COMPONENT_SET`))return t;for(let n of e.children??[])w_(n,t);return t};async function T_(e,t,n={}){let r=v_(e),i=await S_(r.fileKey,t,n),a={...i?{variables:i}:{},...n.target?{target:n.target}:{},fileKey:r.fileKey};if(r.nodeId)return g_(await b_(r.fileKey,[r.nodeId],t,n),a);let o=await C_(r.fileKey,t,n);if(!o.document)throw Error(`GET /v1/files/${r.fileKey} returned no document`);let s=w_(o.document).filter(e=>n.target?e.name===n.target:!0);if(s.length===0)throw Error(n.target?`No COMPONENT_SET or COMPONENT named "${n.target}" in ${o.name??r.fileKey} â pass a node-id URL or a valid --target`:`No COMPONENT_SET or COMPONENT in ${o.name??r.fileKey}`);return g_({name:o.name,nodes:Object.fromEntries(s.map(e=>[e.id,{document:e,components:o.components,componentSets:o.componentSets,styles:o.styles}
3301]))},a)}var E_=`modulepreload`,D_=function(e){return`/`+e},O_={},k_=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=D_(t,n),t=s(t),t in O_)return;O_[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:E_,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},A_=`https://www.figma.com/design/8nim1d0IPnehMxA7B7SYxC/DS-Contracts-POC?node-id=101-1`;function j_(e,t){return T_(e,t)}async function M_(e){let[t,n]=await Promise.all([k_(()=>import(`./badge.rest-CiTkHBer.js`),[]),k_(()=>import(`./variables.rest-CmPpwUhq.js`),[])]),r=(e,t)=>Promise.resolve({ok:e>=200&&e<300,status:e,json:()=>Promise.resolve(t),text:()=>Promise.resolve(JSON.stringify(t))});return T_(A_,`demo-fixture-token`,{fetchImpl:i=>i.includes(`/variables/local`)?e.degraded?r(403,{status:403,err:`Incompatible plan for this endpoint`}):r(200,n.default):i.includes(`/nodes?ids=`)?r(200,t.default):r(404,{err:`not served by the demo fixture`})})}function N_(e){let t=eg();return nh(e,{corpus:yg().corpus,contractIdByName:new Map([...bh,...t.idByName]),contractIdByKey:new Map([...xh,...t.idByKey]),contractsById:new Map([...t.stubs,...vh,...t.contracts]),sessionClaimedIds:new Set([...t.stubs.keys(),...t.contracts.keys()]),fileKey:e._provenance?.fileKey??null,mintUnbound:!0,hiddenCaptured:Lf(e._provenance)})}var P_=(e,t)=>{let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n};function F_(e,t){let n=0,r=e.length,i=()=>{for(;n<r&&(e[n]===` `||e[n]===` `||e[n]===` 3302`||e[n]===`\r`);)n+=1},a=()=>{n+=1;let t=``;for(;n<r;){let r=e[n];if(r===`\\`){let r=e[n+1];r===`u`?(t+=`�`,n+=6):(t+=r===`n`?` 3303`:r===`t`?` `:r===`r`?`\r`:r??``,n+=2)}else if(r===`"`)return n+=1,t;else t+=r,n+=1}return null},o=()=>{i();let t=e[n];if(t===`"`)return a()!==null;if(t===`{`||t===`[`){let i=t,o=t===`{`?`}`:`]`,s=0;for(;n<r;){let t=e[n];if(t===`"`){if(a()===null)return!1;continue}if(t===i)s+=1;else if(t===o&&(--s,s===0))return n+=1,!0;n+=1}return!1}let o=n;for(;n<r&&!`,]}`.includes(e[n])&&!/\s/.test(e[n]);)n+=1;return n>o},s=t=>{if(i(),t.length===0)return n<r?P_(e,n):null;let c=e[n];if(c===`{`){if(typeof t[0]!=`string`)return null;for(n+=1;;){if(i(),n>=r||e[n]===`}`||e[n]!==`"`)return null;let c=a();if(c===null||(i(),e[n]!==`:`))return null;if(n+=1,c===t[0])return s(t.slice(1));if(!o())return null;if(i(),e[n]===`,`){n+=1;continue}return null}}if(c===`[`){if(typeof t[0]!=`number`)return null;n+=1;let a=0;for(;;){if(i(),n>=r||e[n]===`]`)return null;if(a===t[0])return s(t.slice(1));if(!o())return null;if(i(),e[n]===`,`){n+=1,a+=1;continue}return null}}return null};try{return s(t)}catch{return null}}function I_(e,t){let n=e.split(` 3304`),r=e=>{let t=n.findIndex(t=>t.includes(e));return t===-1?null:t},i=[...t.matchAll(/"([^"]+)"/g)].map(e=>e[1]),a=i.filter(e=>e.startsWith(`{`)&&e.endsWith(`}`));for(let e of a){let t=r(e);if(t!==null)return t}for(let e of i){if(e.startsWith(`{`)&&e.endsWith(`}`))continue;let t=r(`"${e}"`);if(t!==null)return t}return null}function L_(e){let t=e.match(/\(line (\d+) column \d+\)/);return t?Math.max(0,Number(t[1])-1):null}function R_(e,t){return t.map(t=>t.path?F_(e,t.path):I_(e,t.text))}function z_(e){if(e instanceof SyntaxError){let t=L_(e.message);return{headline:`That paste isn't valid JSON â the parser stopped${t===null?``:` at line ${t+1}`}. A missing quote, comma, or bracket is the usual cause.`,detail
3304:e.message}}return th(e)}var B_=`https://ds-contracts-assist.southleft-llc.workers.dev`,V_=`assist-origin-refused: the assist Worker only answers the deployed playground origin (and *.pages.dev previews). From a local dev server it refuses unless the Worker is deployed with ASSIST_DEV_ORIGIN set to your dev origin â see workers/assist/README.md.`;async function H_(e,t,n){let r=n??(typeof window<`u`?window.__ASSIST_FETCH__:void 0)??fetch,i;try{i=await r(`${B_}${e}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}catch(e){return{ok:!1,status:0,message:`${V_} (network detail: ${e instanceof Error?e.message:String(e)})`}}let a=null;try{a=await i.json()}catch{}let o=a&&typeof a==`object`&&typeof a.error==`string`?a.error:null;return i.ok?{ok:!0,data:a}:i.status===403&&!o?{ok:!1,status:403,message:V_}:{ok:!1,status:i.status,message:o??`assist answered ${i.status} with no named message`}}function U_(e,t){return H_(`/v1/assist/name-tokens`,e,t)}var W_=64*1024,G_=3e3;function K_(e,t){return H_(`/v1/assist/fix-contract`,e,t)}function q_(e,t){return H_(`/v1/assist/fetch-plan`,e,t)}var J_=(e,t)=>
3304`ds-playground.repo-profile:${e}@${t}`;async function Y_(e,t){let n=J_(e.repoUrl,e.ref);try{let e=sessionStorage.getItem(n);if(e)return{ok:!0,data:{profile:JSON.parse(e),cached:!0}}}catch{}let r=await H_(`/v1/assist/repo-profile`,e,t);if(r.ok&&r.data.profile)try{sessionStorage.setItem(n,JSON.stringify(r.data.profile))}catch{}return r}var X_=B_,Z_=2500,Q_=`bridge-origin-refused: the bridge only answers the deployed playground origin (and *.pages.dev previews). From a local dev server it refuses unless the Worker is deployed with ASSIST_DEV_ORIGIN set to your dev origin â see workers/assist/README.md.`,$_=async e=>{try{let t=await e.json();if(typeof t.error==`string`)return t.error}catch{}return e.status===403?Q_:`the bridge answered ${e.status} with no named message`},ev=/^[0-9a-f]{48}$/,tv=`X-Bridge-Read-Capability`,nv=(e,t)=>e.split(t).join(`[redacted]`);async function rv(){let e;try{e=await fetch(`${X_}/bridge/session`,{method:`POST`})}catch(e){return{ok:!1,message:`${Q_} (network detail: ${e instanceof Error?e.message:String(e)})`}}if(!e.ok)return{ok:!1,message:await $_(e)};let t=await e.json();return typeof t.code!=`string`||typeof t.readCapability!=`string`||!ev.test(t.readCapability)||typeof t.ttlSeconds!=`number`?{ok:!1,message:`the bridge answered with an unexpected shape â try again`}:{ok:!0,session:{code:t.code,readCapability:t.readCapability,ttlSeconds:t.ttlSeconds}}}async function iv(e,t){if(!ev.test(t))return{status:`error`,fatal:!0,message:`the bridge read capability is missing or malformed â press Receive from plugin again`};let n;try{n=await fetch(`${X_}/bridge/${encodeURIComponent(e)}`,{method:`GET`,headers:{[tv]:t}})}catch(e){return{status:`error`,fatal:!1,message:`network hiccup while waiting (${nv(e instanceof Error?e.message:String(e),t)}) â still listening`}}if(!n.ok)return{status:`error`,fatal:!0,message:nv(await $_(n),t)};let r=await n.json();return r.status===`delivered`?{status:`delivered`,dump:r.dump}:r.status===`waiting`?{status:`waiting`}:{status:`error`,fatal:!0,message:`the bridge answered with an unexpected shape â press Receive from plugin again`}}var av=500*1024;function ov(e){let t;try{t=new URL(e.trim())}catch{throw Error(`Not a URL: ${e}`)}let n=t.pathname.split(`/`).filter(Boolean).map(decodeURIComponent);if(t.hostname===`raw.githubusercontent.com`){if(n.length<4)throw Error(`Unrecognized raw.githubusercontent.com URL shape "/${n.join(`/`)}" â expected /:owner/:repo/:ref/:path`);let e=n[2]===`refs`&&(n[3]===`heads`||n[3]===`tags`)?3:1;return{owner:n[0],repo:n[1],ref:n.slice(2,2+e).join(`/`),path:n.slice(2+e).join(`/`),kind:`file`}}if(!/(^|\.)github\.com$/.test(t.hostname))throw Error(`Not a github.com URL: ${t.hostname}`);let[r,i,a,o,...s]=n;if(!r||!i||!a||!o||![`blob`,`raw`,`tree`].includes(a))throw Error(`Unrecognized github.com URL shape "/${n.join(`/`)}" â expected /:owner/:repo/blob/:ref/:path (file) or /:owner/:repo/tree/:ref/:path (directory)`);return{owner:r,repo:i,ref:o,path:s.join(`/`),kind:a===`tree`?`dir`:`file`}}var sv=(e,t)=>`https://raw.githubusercontent.com/${e.owner}/${e.repo}/${e.ref}/${t.split(`/`).map(encodeURIComponent).join(`/`)}`,cv=(e,t)=>`https://api.github.com/repos/${e.owner}/${e.repo}/contents/${t.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`)}?ref=${encodeURIComponent(e.ref)}`;function lv(e,t){if(e.status!==403&&e.status!==429||e.headers.get(`x-ratelimit-remaining`)!==`0`)return null;let n=Number(e.headers.get(`x-ratelimit-reset`)),r=Number.isFinite(n)&&n>0?new Date(n*1e3).toLocaleTimeString():`soon`;return Error(`GitHub API rate limit exceeded (unauthenticated calls are limited per IP) â resets at ${r}. ${t}`)}async function uv(e,t){let n;try{n=await t(e)}catch(t){throw Error(`Network error fetching ${e} â ${t instanceof Error?t.message:String(t)}`)}if(n.status===404)throw Error(`404 â no file at ${e}. GitHub answers 404 for private and non-existent repos alike, so check that the repo is public and the branch/path are right.`);let r=lv(n,e);if(r)throw r;if(n.status===403)throw Error(`403 â access denied for ${e} (not a public repo?)`);if(!n.ok)throw Error(`GitHub answered ${n.status} for ${e}`);let i=Number(n.headers.get(`content-length`));if(Number.isFinite(i)&&i>av)throw Error(`File too large: ${Math.round(i/1024)} KB exceeds the ${av/1024} KB import limit â ${e}`);let a=await n.text();if(a.length>av)throw Error(`File too large: ${Math.round(a.length/1024)} KB exceeds the ${av/1024} KB import limit â ${e}`);return a}
3304async function dv(e,t,n){let r=cv(e,t),i;try{i=await n(r,{headers:{Accept:`application/vnd.github+json`}})}catch(e){throw Error(`Network error fetching ${r} â ${e instanceof Error?e.message:String(e)}`)}if(i.status===404)throw Error(`404 â GitHub's contents API has no ${t||`(repo root)`} in ${e.owner}/${e.repo}@${e.ref}. Private repos also answer 404 here â the unauthenticated API only sees public repos.`);let a=lv(i,r);if(a)throw a;if(i.status===403)throw Error(`403 â access denied for ${r} (not a public repo?)`);if(!i.ok)throw Error(`GitHub API answered ${i.status} for ${r}`);let o=await i.json();if(!Array.isArray(o))throw Error(`${r} is a file, not a directory listing`);return o}var fv=e=>e.split(`/`).slice(0,-1).join(`/`),pv=e=>e.split(`/`).pop()??e;function mv(e){let t=[];for(let n of e.matchAll(/(?:import|export)\s[^'"]*?['"](\.{1,2}\/[^'"]+)['"]/g))t.includes(n[1])||t.push(n[1]);for(let n of e.matchAll(/import\s+['"](\.{1,2}\/[^'"]+)['"]/g))t.includes(n[1])||t.push(n[1]);return t}function hv(e,t){let n=e?e.split(`/`):[];for(let e of t.split(`/`))if(e===`.`||e===``)continue;else e===`..`?n.pop():n.push(e);return n.join(`/`)}var gv=e=>`${Math.round(e.length/102.4)/10} KB`,_v=/\.(css|scss)$/,vv=/\.(tsx|ts|jsx|js)$/;async function yv(e,t=fetch){let n=ov(e),r=[],i=[],a=n.path;if(n.kind===`dir`){let e=(await dv(n,n.path,t)).filter(e=>e.type===`file`&&/\.(tsx|jsx)$/.test(e.name)&&!/^index\.(tsx|jsx)$/.test(e.name)).filter(e=>!/\.(stories|test|spec)\.(tsx|jsx)$/.test(e.name)).map(e=>e.name);if(e.length===0)throw Error(`No .tsx/.jsx file in ${n.owner}/${n.repo}/${n.path||`(root)`}@${n.ref}`);let i=pv(n.path),o=e.find(e=>e.replace(/\.(tsx|jsx)$/,``)===i);if(!o&&e.length>1)throw Error(`Multiple components in ${n.path||`(root)`} â pick one file URL: ${e.join(`, `)}`);a=[n.path,o??e[0]].filter(Boolean).join(`/`),r.push(`Directory URL â picked ${pv(a)} from the GitHub contents listing.`)}let o=pv(a);if(!/\.(tsx|jsx)$/.test(o))throw Error(`Not a TSX file: ${o} â the code importer reads React component source (.tsx/.jsx)`);let s=await uv(sv(n,a),t);r.push(`Fetched ${o} (${gv(s)}) from ${sv(n,a)}`);let c=`${n.owner}/${n.repo}/`,l=[{sourcePath:`${c}${a}`,source:s}],u=new Map([[a,0]]),d=new Map([[a,s]]),f=[a],p=8,m=async(e,a,o=!1)=>{if(p<=0)return i.push(`trace cap reached (8 referenced files) â ${e} not fetched (${a})`),null;try{let i=await uv(sv(n,e),t);return p--,f.push(e),d.set(e,i),r.push(`Traced ${a} â fetched ${e} (${gv(i)})`),i}catch(e){return o||i.push(`${a}: fetch failed â ${e instanceof Error?e.message:String(e)}`),null}},h=(e,t,n)=>{let a=l[e],o=`/* --- ${t} --- */\n${n}`;a.css=a.css?`${a.css}\n\n${o}`:o,t.endsWith(`.scss`)?i.push(`${t} is SCSS â the CSS-Module anatomy reader parses what it can; SCSS-only syntax (nesting, variables, mixins) degrades by name in the proposal notes`):t.endsWith(`.module.css`)||r.push(`${t} is plain CSS, not a CSS Module â anatomy extraction degrades by name, exactly like the foreign-css fixture.`)},g=[0],_=new Set;for(;g.length>0;){let e=g.shift(),t=e===0,n=fv(l[e].sourcePath.slice(c.length));for(let a of mv(l[e].source)){let o=`${n}|${a}`;if(_.has(o))continue;_.add(o);let s=hv(n,a);if(_v.test(a)){if(u.has(s))continue;let t=await m(s,`import '${a}'`);t!==null&&(u.set(s,e),h(e,s,t));continue}if(!t)continue;if(vv.test(a)){if(u.has(s))continue;let e=await m(s,`import '${a}'`);e!==null&&(u.set(s,l.length),l.push({sourcePath:`${c}${s}`,source:e}),g.push(l.length-1));continue}if(/\.[a-z0-9]+$/i.test(a)){r.push(`import '${a}' skipped â not a .tsx/.ts/.css/.scss source (assets stay where they are)`);continue}let d=[`${s}.tsx`,`${s}.ts`,`${s}/index.tsx`,`${s}/index.ts`],f=!1;for(let e of d){if(u.has(e)){f=!0;break}let t=await m(e,`import '${a}'`,!0);if(t!==null){u.set(e,l.length),l.push({sourcePath:`${c}${e}`,source:t}),g.push(l.length-1),f=!0;break}if(p<=0)break}!f&&p>0&&i.push(`import '${a}' unresolved â tried ${d.map(pv).join(`, `)}`)}}if(!l[0].css){let e=fv(a),i=o.replace(/\.(tsx|jsx)$/,`.module.css`),s=[e,i].filter(Boolean).join(`/`),c=await m(s,`same-name sibling ${i}`,!0);
3304if(c!==null)h(0,s,c);else try{let i=(await dv(n,e,t)).find(e=>e.type===`file`&&e.name.endsWith(`.module.css`));if(i){let t=[e,i.name].filter(Boolean).join(`/`),n=d.get(t);if(n!==void 0)r.push(`Directory listing â ${i.name} â already traced, attached to the entry too`),h(0,t,n);else{let e=await m(t,`directory listing â ${i.name}`);e!==null&&h(0,t,e)}}}catch(e){r.push(`Directory listing for stylesheet discovery failed: ${e instanceof Error?e.message:String(e)}`)}}return l[0].css||i.push(`no stylesheet reached ${o} â the proposal reads the props surface only (no anatomy); the styling source may live outside import-following (theme file, tailwind config, global stylesheet)`),{sourcePath:`${c}${a}`,parsed:n,entryPath:a,files:l,notes:r,gaps:i,alreadyFetched:f}}var bv=/(^|\/)[\w.-]*(token|variable|theme|global|foundation|custom-propert)[\w.-]*\.css$/i,xv=4;async function Sv(e,t=fetch){let n=[],r=[],i=()=>({extraCss:[],paths:[],notes:n,gaps:r}),a=e.files.map(e=>e.css??``).filter(e=>e.length>0);if(a.length===0)return i();let o=new Set;for(let e of a)for(let t of e.matchAll(/var\(\s*--([A-Za-z0-9_-]+)/g))o.add(t[1]);let s=uu(a),c=[...o].filter(e=>!s.has(e));if(c.length===0)return i();n.push(`${c.length} custom propert${c.length===1?`y is`:`ies are`} referenced but never declared in the traced CSS (--${c[0]}${c.length>1?`, â¦`:``}) â searching the repo tree for token stylesheets.`);let l;try{({listing:l}=await Cv(e.parsed,e.entryPath,t))}catch(e){return r.push(`token-stylesheet discovery: repo tree listing failed â ${e instanceof Error?e.message:String(e)}; the undeclared var()s stay carried verbatim`),i()}let u=new Set(e.alreadyFetched),d=l.map(e=>e.path).filter(e=>bv.test(e)&&!u.has(e)).slice(0,xv);if(d.length===0)return r.push(`no token-stylesheet candidate in the repo tree (looked for *token*/*variable*/*theme*/*global* .css) â ${c.length} undeclared custom propert${c.length===1?`y stays`:`ies stay`} carried verbatim`),i();let f=[],p=[],m=new Set(c);for(let i of d)try{let r=await uv(sv(e.parsed,i),t),a=uu([r]),o=c.filter(e=>a.has(e));if(o.length>0){f.push(r),p.push(i);for(let e of o)m.delete(e);n.push(`Fetched ${i} (${gv(r)}) â declares ${o.length} of the ${c.length} missing custom propert${c.length===1?`y`:`ies`}; kept for minting.`)}else n.push(`Fetched ${i} (${gv(r)}) â declares none of the missing custom properties; not used.`)}catch(e){r.push(`token-stylesheet candidate ${i}: fetch failed â ${e instanceof Error?e.message:String(e)}`)}return m.size>0&&r.push(`${m.size} custom propert${m.size===1?`y`:`ies`} still undeclared after discovery (--${[...m][0]}${m.size>1?`, â¦`:``}) â carried verbatim in the proposal`),{extraCss:f,paths:p,notes:n,gaps:r}}async function Cv(e,t,n=fetch){let r=`https://api.github.com/repos/${e.owner}/${e.repo}/git/trees/${encodeURIComponent(e.ref)}?recursive=1`,i;try{i=await n(r,{headers:{Accept:`application/vnd.github+json`}})}catch(e){throw Error(`Network error fetching ${r} â ${e instanceof Error?e.message:String(e)}`)}let a=lv(i,r);if(a)throw a;if(!i.ok)throw Error(`GitHub trees API answered ${i.status} for ${r}`);let o=await i.json(),s=(o.tree??[]).filter(e=>e.type===`blob`&&typeof e.path==`string`),c=fv(t),l=e=>c&&e.startsWith(`${c}/`)?0:e.startsWith(`src/`)?1:2,u=s.map(e=>({path:e.path,...typeof e.size==`number`?{size:e.size}:{}})).sort((e,t)=>l(e.path)-l(t.path)||e.path.localeCompare(t.path));return{listing:u.slice(0,2e3),truncated:!!o.truncated||u.length>2e3}}function wv(e,t,n=fetch){return uv(sv(e,t),n)}var Tv=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Ev(e,t){if(Tv(e))for(let[n,r]of Object.entries(e))Tv(r)&&(t.parts.set(n,JSON.stringify(r)),t.kinds.set(n,r.component===void 0?r.slot===void 0?`part`:`slot`:`component ref`),Ev(r.parts,t))}function Dv(e){let t={parts:new Map,kinds:new Map,props:new Set,events:new Set};if(!Tv(e))return t;if(Ev(e.anatomy,t),Array.isArray(e.props))for(let n of e.props)Tv(n)&&typeof n.name==`string`&&t.props.add(n.name);if(Array.isArray(e.events))for(let n of e.events)Tv(n)&&typeof n.name==`string`&&t.events.add(n.name);return t}var Ov=(e,t)=>
3304`${e} ${t}${e===1?``:`s`}`;function kv(e,t){let n=Dv(e),r=Dv(t),i=[...n.parts.keys()].filter(e=>!r.parts.has(e)),a=[...r.parts.keys()].filter(e=>!n.parts.has(e)),o=[],s=new Set;for(let e of i){let t=n.parts.get(e),i=a.filter(e=>!s.has(e)&&r.parts.get(e)===t);i.length===1&&(o.push({from:e,to:i[0]}),s.add(i[0]))}let c=new Set(o.map(e=>e.from)),l=[];for(let e of i)c.has(e)||l.push(`${n.kinds.get(e)??`part`} "${e}"`);for(let e of n.props)r.props.has(e)||l.push(`prop "${e}"`);for(let e of n.events)r.events.has(e)||l.push(`event "${e}"`);let u=a.filter(e=>!s.has(e)),d=[];return o.length>0&&d.push(`renamed ${Ov(o.length,`part`)} (${o.map(e=>`${e.from} â ${e.to}`).join(`, `)})`),u.length>0&&d.push(`added ${Ov(u.length,`part`)} (${u.join(`, `)})`),d.push(l.length>0?`REMOVED ${l.length} (${l.join(`, `)}) â review before trusting`:`removed NOTHING`),{summary:d.join(`; `),lost:l,renamed:o,added:u}}var Av=[{id:`claude-sonnet-5`,label:`Claude Sonnet 5 â fast, ~$0.02/generation`},{id:`claude-opus-4-8`,label:`Claude Opus 4.8 â strongest reasoning, slower`}],jv=Av[0].id,Mv=`https://api.anthropic.com/v1/messages`,Nv=`2023-06-01`,Pv=`propose_contract`,Fv=8192,Iv={name:Pv,description:`Propose a component contract â the machine-readable single source of truth between design and code. Every token reference must come from the provided inventory; the contract is validated by the same schema and generator that ship the design system, and violations are refused by name.`,input_schema:{type:`object`,additionalProperties:!1,required:[`id`,`name`,`version`,`status`,`description`,`semantics`,`props`,`states`,`anatomy`,`anchors`],$defs:{tokenRef:{type:`string`,pattern:`^\\{[a-z0-9.{}-]+\\}$`,description:`Brace-wrapped token path from the inventory, e.g. "{radius.badge}". May contain an enum-prop placeholder that expands over its values, e.g. "{color.feedback.{variant}.background}".`},layout:{type:`object`,additionalProperties:!1,properties:{display:{enum:[`flex`,`inline-flex`]},direction:{enum:[`row`,`column`]},align:{enum:[`start`,`center`,`end`,`stretch`]},justify:{enum:[`start`,`center`,`end`,`space-between`]},grow:{type:`boolean`}}},part:{type:`object`,additionalProperties:!1,properties:{description:{type:`string`},element:{type:`string`,description:`HTML element for this part (default div/span).`},layout:{$ref:`#/$defs/layout`},tokens:{type:`object`,description:`CSS property â token reference. The stylesheet and Figma bindings are generated from these.`,additionalProperties:{$ref:`#/$defs/tokenRef`}},states:{type:`object`,description:`Root part only: interaction state (hover | focus-visible | disabled) â (CSS property â token reference).`,additionalProperties:{type:`object`,additionalProperties:{$ref:`#/$defs/tokenRef`}}},content:{type:`object`,additionalProperties:!1,required:[`prop`],properties:{prop:{type:`string`,description:`Text prop rendered as this partâs content.`}}},text:{type:`string`,description:`Static literal text, same on both surfaces.`},visibleWhen:{type:`object`,additionalProperties:!1,required:[`prop`],properties:{prop:{type:`string`},equals:{type:`string`,description:`Required for enum props; omit for booleans (truthy).`}}},optional:{type:`boolean`},parts:{type:`object`,description:`Nested child parts â anatomy is a tree.`,additionalProperties:{$ref:`#/$defs/part`}}}}},properties:{id:{type:`string`,pattern:`^[a-z][a-z0-9-]*\\.[a-z][a-z0-9-]*$`,description:`Stable canonical id, namespace.name â use "ds.<kebab-name>".`},name:{type:`string`,description:`PascalCase display/export name, e.g. "Badge".`},version:{type:`string`,pattern:`^\\d+\\.\\d+\\.\\d+$`,description:`Semver. New contracts start at "0.1.0".`},status:{enum:[`draft`,`stable`,`deprecated`],description:`New contracts are "draft".`},description:{type:`string`},semantics:{type:`object`,additionalProperties:!1,required:[`element`],properties:{element:{enum:`button.span.div.a.input.article.section.header.footer.label.nav.hr.ul.li.p.textarea.select.fieldset.blockquote.code.kbd.h1.h2.h3.h4.h5.h6`.split(`.`)},role:{type:`string`,description:`ARIA role when the element alone does not carry it.`}}},props:{type:`array`,items:{type:`object`,additionalProperties:!1,required:[`name`,`type`,`bindings`],properties:{name:{type:`string`,description:`camelCase. The default text slot must be named "children".`},description:{type:`string`},type:{description:`"text" | "boolean" | { "enum": [...] } â enum values are canonical lowercase.`,oneOf:[{enum:[`text`,`boolean`]},{type:`object`,additionalProperties:!1,required:[`enum`],properties:{enum:{type:`array`,items:{type:`string`},minItems:1}}}]},default:{description:`Default value. For enums: one of the values. Text props may omit it and set required.`,oneOf:[{type:`string`},{type:`boolean`}]},required:{type:`boolean`},bindings:{type:`object`,additionalProperties:!1,required:[`figma`,`co
3304de`],properties:{figma:{type:`object`,additionalProperties:!1,required:[`kind`,`property`],properties:{kind:{enum:[`VARIANT`,`BOOLEAN`,`TEXT`]},property:{type:`string`,description:`Figma property name â Title Case, e.g. "Variant", "Label".`},values:{type:`object`,description:`Enum props only: canonical value â Figma variant value, e.g. { "info": "Info" }.`,additionalProperties:{type:`string`}}}},code:{type:`object`,additionalProperties:!1,required:[`prop`],properties:{prop:{type:`string`,description:`The React prop name â usually the canonical name.`}}}}}}}},events:{type:`array`,description:`Optional code-side callbacks fired when a part is activated.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`bindings`,`trigger`],properties:{name:{type:`string`,pattern:`^[a-z][a-zA-Z0-9]*$`},description:{type:`string`},bindings:{type:`object`,additionalProperties:!1,required:[`code`],properties:{code:{type:`object`,additionalProperties:!1,required:[`prop`],properties:{prop:{type:`string`,pattern:`^on[A-Z][a-zA-Z0-9]*$`}}}}},trigger:{type:`string`,description:`Anatomy part name whose activation fires the event; "root" allowed.`}}}},states:{type:`array`,items:{enum:[`hover`,`focus-visible`,`disabled`]},description:`Interaction states the component styles. Empty array for static components.`},anatomy:{type:`object`,description:`Part tree. Must contain a part named "root"; the root part styles the semantics.element.`,additionalProperties:{$ref:`#/$defs/part`}},a11y:{type:`object`,additionalProperties:!1,properties:{focusVisible:{type:`boolean`},minHitArea:{type:`number`},contrast:{enum:[`AA`,`AAA`]}}},anchors:{type:`object`,additionalProperties:!1,required:[`figma`,`code`],description:`Per-side identity anchors. Prompt-born contracts have no canvas yet: every figma anchor is null.`,properties:{figma:{type:`object`,additionalProperties:!1,required:[`fileKey`,`componentSetKey`,`nodeId`],properties:{fileKey:{type:`null`},componentSetKey:{type:`null`},nodeId:{type:`null`}}},code:{type:`object`,additionalProperties:!1,required:[`importPath`,`export`],properties:{importPath:{const:`@ds/components`},export:{type:`string`,description:`PascalCase(name).`}}}}}}}};JSON.stringify(Iv);function Lv(e,t){let{$schema:n,...r}=e;return{...r,version:`0.1.0`,status:`draft`,anchors:{figma:{fileKey:null,componentSetKey:null,nodeId:null},code:{importPath:`@ds/components`,export:t}}}}function Rv(){return JSON.stringify(Lv(ie,`Badge`))}function zv(){let e=Lv(j,`Button`);delete e.figmaStatePreviews;let t=JSON.parse(JSON.stringify(e.anatomy));return t.root.parts?.loadingSpinner&&(t.root.parts.loadingSpinner={description:`Busy indicator, shown while loading.`,element:`span`,text:`â¦`,visibleWhen:{prop:`loading`}}),e.anatomy=t,JSON.stringify(e)}function Bv(){let e=yg(),t=[...e.inventory].sort().join(` 3305`);return[`You author COMPONENT CONTRACTS for a design system. A contract is the`,`machine-readable single source of truth between the Figma canvas and code:`,`props with bindings for both surfaces, an anatomy tree binding CSS`,`properties to design tokens, and per-side identity anchors. You never`,`write component code â the generators do; you produce the contract via`,`the ${Pv} tool, matching its schema exactly.`,``,`HARD RULES â violations are refused by name by the schema and generator:`,`1. Every token reference must be a path from the TOKEN INVENTORY below,`,` brace-wrapped. Never invent, abbreviate, or guess a token path. An`,` enum-prop placeholder like {color.feedback.{variant}.background} is`,` legal ONLY if the expansion for EVERY enum value exists in the`,` inventory.`,`2. Canonical enum values are lowercase (e.g. "info", "primary"); the`,` figma binding "values" map carries the Title Case canvas spellings.`,`3. anchors are EXACTLY: {"figma":{"fileKey":null,"componentSetKey":null,`,` "nodeId":null},"code":{"importPath":"@ds/components","export":`,` PascalCase(name)}} â a prompt-born contract has no canvas yet.`,`4. The anatomy must contain a part named "root". Root styles the`,` semantics.element. Text content binds to a prop via {"content":`,` {"prop":"children"}} on a part.`,`5. id is "ds." + kebab-case(name); version starts at "0.1.0"; status is`,` "draft". Declared "states" require matching root state token`,` overrides.`,`6. Prefer the smallest complete contract: only the props, parts, and`,` states the described component actually needs.`,`7. Every enum prop must DRIVE the rendering: at least one token binding`,` must substitute it ({â¦{prop}â¦} â preferred, see the exemplars) or a`,` part must key on it via visibleWhen equals. An axis that changes`,` nothing visible when switched is a defect, not a contract.`,`8. Every text prop must RENDER: exactly one part binds
3305it via`,` {"content":{"prop":<name>}}. A text prop nothing renders is dead API.`,`9. semantics.element "select" renders content ONLY through parts with`,` element "option" â HTML drops bare text and non-option children`,` inside a select.`,``,`TOKEN INVENTORY (${e.inventory.size} paths â ${e.label}):`,t,``,`EXEMPLAR â minimal, static (Badge):`,Rv(),``,`EXEMPLAR â interactive (Button: two enum axes each driving substituted`,`refs, state overrides, a boolean-gated part, text content):`,zv()].join(` 3306`)}async function Vv(e,t,n,r=jv){let i;try{i=await n(Mv,{method:`POST`,headers:{"content-type":`application/json`,"x-api-key":t,"anthropic-version":Nv,"anthropic-dangerous-direct-browser-access":`true`},body:JSON.stringify({model:r,max_tokens:Fv,thinking:{type:`disabled`},system:Bv(),tools:[Iv],tool_choice:{type:`tool`,name:Pv},messages:e})})}catch(e){throw Error(`Network error calling ${Mv} â ${e instanceof Error?e.message:String(e)}`)}let a=await i.json().catch(()=>null);if(!i.ok){let e=a?.error?.message??`HTTP ${i.status}`;throw i.status===401?Error(`Anthropic answered 401 â the API key was rejected. ${e}`):i.status===429?Error(`Anthropic answered 429 â rate limited. ${e}`):Error(`Anthropic answered ${i.status} (${a?.error?.type??`error`}): ${e}`)}if(!a||!Array.isArray(a.content))throw Error(`Anthropic answered 200 but the body is not a message â nothing to propose from.`);let o=a.content.find(e=>e.type===`tool_use`&&e.name===Pv);if(!o)throw Error(`The response carries no ${Pv} tool call (stop_reason: ${a.stop_reason??`unknown`}) â nothing to propose from.`);return{toolUse:o,usage:a.usage,assistantContent:a.content}}var Hv=(e,t)=>({inputTokens:typeof t?.input_tokens==`number`?(e.inputTokens??0)+t.input_tokens:e.inputTokens,outputTokens:typeof t?.output_tokens==`number`?(e.outputTokens??0)+t.output_tokens:e.outputTokens});function Uv(e){return typeof e==`object`&&e&&!Array.isArray(e)&&`contract`in e&&!(`id`in e)?e.contract:e}async function Wv(e,t,n={}){let r=[{role:`user`,content:e}],{toolUse:i,usage:a,assistantContent:o}=await Vv(r,t,n.fetchImpl??fetch,n.model);return{contract:Uv(i.input),session:{messages:[...r,{role:`assistant`,content:o}],lastToolUseId:i.id,rounds:0,usage:Hv({inputTokens:null,outputTokens:null},a)}}}async function Gv(e,t,n,r={}){if(e.rounds>=2)throw Error(`Fix round limit reached (2) â edit the contract by hand instead.`);let i=[...e.messages,{role:`user`,content:[{type:`tool_result`,tool_use_id:e.lastToolUseId,is_error:!0,content:`The proposed contract was REFUSED by the schema/generator. Named violations: 3307`+t.map(e=>`- ${e}`).join(` 3308`)+`\nCall ${Pv} again with a corrected contract. Fix only what the violations name.`}]}],{toolUse:a,usage:o,assistantContent:s}=await Vv(i,n,r.fetchImpl??fetch,r.model);return{contract:Uv(a.input),session:{messages:[...i,{role:`assistant`,content:s}],lastToolUseId:a.id,rounds:e.rounds+1,usage:Hv(e.usage,o)}}}var Kv=8*1024,qv=e=>{let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...e.subarray(r,r+n));return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)},Jv=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t+`=`.repeat((4-t.length%4)%4)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return r},Yv=async(e,t)=>{let n=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await n.arrayBuffer())},Xv=()=>typeof CompressionStream==`function`;async function Zv(e){let t=new TextEncoder().encode(JSON.stringify({c:e.contract,o:e.output,t:e.theme}));return Xv()?`1.${qv(await Yv(t,new CompressionStream(`deflate-raw`)))}`:`0.${qv(t)}`}async function Qv(e){let t=e.indexOf(`.`),n=t>0?e.slice(0,t):``,r=e.slice(t+1);if(n!==`0`&&n!==`1`||!r)throw Error(`share-link-unreadable: unknown payload version "${n||e.slice(0,8)}"`);let i;try{if(i=Jv(r),n===`1`){if(typeof DecompressionStream!=`function`)throw Error(`this browser has no DecompressionStream to inflate the link`);i=await Yv(i,new DecompressionStream(`deflate-raw`))}}catch(e){throw Error(`share-link-unreadable: the payload does not decode â ${e instanceof Error?e.message:String(e)}`)}let a;try{a=JSON.parse(new TextDecoder().decode(i))}catch{throw Error(`share-link-unreadable: the decoded payload is not JSON`)}let o=a;
3308if(typeof o.c!=`string`||typeof o.o!=`string`)throw Error(`share-link-unreadable: the decoded payload is missing the contract or output tab`);return{contract:o.c,output:o.o,theme:o.t===`dark`?`dark`:`light`}}function $v(){let e=window.location.hash.match(/^#s=(.+)$/);return e?e[1]:null}var ey={trees:[],mintedTrees:[],paths:new Set,receipts:[]};function ty(e,t){let n={};for(let r of e){if(!t.has(r.path))continue;let e=r.path.split(`.`),i=n;for(let t of e.slice(0,-1))i=i[t]??={};i[e[e.length-1]]={$value:r.value,$type:r.type}}return n}function ny(e,t=``,n=[]){for(let[r,i]of Object.entries(e)){if(!i||typeof i!=`object`||Array.isArray(i))continue;let e=t?`${t}.${r}`:r;`$value`in i?n.push(e):ny(i,e,n)}return n}function ry(e){let t=(e,n)=>{let r={...e};for(let[e,i]of Object.entries(n)){let n=r[e];r[e]=n&&i&&typeof n==`object`&&typeof i==`object`&&!Array.isArray(n)&&!Array.isArray(i)?t(n,i):i}return r};return e.reduce(t,{})}function iy(e,t,n,r){if(n.size===0)return ey;let i=[],a=new Set([e.id]),o=e=>{for(let n of U(e)){let e=[];n.part.component&&e.push(n.part.component.id);for(let t of n.part.slot?.defaultContent??[])e.push(t.id);for(let n of e){if(a.has(n))continue;a.add(n),i.push(n);let e=t.get(n);e&&o(e)}}};o(e);let s={trees:[],mintedTrees:[],paths:new Set,receipts:[]};for(let e of i){let t=n.get(e);if(!t)continue;let i=0,a=0,o=0;if(t.minted&&t.minted.count>0){s.trees.push(t.minted.tree),s.mintedTrees.push(t.minted.tree);let e=ny(t.minted.tree);i=e.length;for(let t of e)s.paths.add(t)}if(t.captured&&t.captured.count>0){let e=t.captured.entries.filter(e=>!r.has(e.path));if(o=t.captured.entries.length-e.length,e.length>0){let n=new Set(e.map(e=>e.path));s.trees.push(ty(t.captured.entries,n)),a=e.length;for(let e of n)s.paths.add(e)}}let c=i+a;if(c===0)continue;let l=[...i>0?[`${i} minted`]:[],...a>0?[`${a} captured variable${a===1?``:`s`}`]:[]];s.receipts.push(`resolving through ${t.name}'s imported tokens â ${c} (${l.join(` + `)})${o>0?`; ${o} captured name${o===1?``:`s`} already defined by the active source (base wins, never overridden)`:``}`)}return s.receipts.length>0?s:ey}function ay(e,t){return t.trees.length===0?e:{...e,semantic:ry([...t.trees,e.semantic])}}var oy=null,sy=new Set,cy=()=>sy.forEach(e=>e()),ly=()=>oy;function uy(e){let t=[],n=[];if(!e||e.length===0)return oy!==null&&(oy=null,cy()),{registered:t,refused:n};let r=new Map,i=[];for(let a of e){let e=bl.safeParse(a);if(e.success)r.set(e.data.id,e.data),t.push(e.data),i.push(a);else{let t=a?.id;n.push(`child stub ${typeof t==`string`?`"${t}"`:`(unnamed)`} failed the contract schema and was NOT registered: ${e.error.issues[0]?.message??`invalid`}`)}}return oy=r.size>0?{stubs:r,raw:i}:null,cy(),{registered:t,refused:n}}function dy(e){if(!e.trim())return{status:`empty`};let t;try{t=JSON.parse(e)}catch(e){return{status:`json-error`,message:e instanceof Error?e.message:String(e)}}let n=bl.safeParse(t);if(!n.success){let e=n.error.issues.map(e=>({text:`${e.path.length?e.path.join(`.`):`(root)`}: ${e.message}`,path:e.path.filter(e=>typeof e!=`symbol`)}));return{status:`schema-error`,issues:e.map(e=>e.text),details:e}}let r=n.data,i=new Map(vh),a=eg();for(let[e,t]of a.contracts)i.has(e)||i.set(e,t);i.set(r.id,r);for(let[e,t]of ly()?.stubs??[])i.has(e)||i.set(e,t);for(let[e,t]of a.stubs)i.has(e)||i.set(e,t);let o=[];return ad(r,i,o,Sh),cd(r,yg().inventory,o),o.length>0?{status:`violations`,contract:r,contracts:i,issues:o,details:o.map(e=>({text:e}))}:{status:`valid`,contract:r,contracts:i}}var fy=2400,py=3e3;function my(e,t){return new Promise((n,r)=>{let i=document.createElement(`iframe`);i.setAttribute(`sandbox`,`allow-same-origin`),i.setAttribute(`aria-hidden`,`true`),i.tabIndex=-1,i.style.cssText=[`position: fixed`,`left: -10000px`,`top: 0`,`width: ${fy}px`,`height: 1200px`,`visibility: hidden`,`pointer-events: none`,`border: 0`].join(`; `);let a=!1,o=e=>{a||(a=!0,e(),i.remove())},s=window.setTimeout(()=>o(()=>r(Error(`measurement frame timed out`))),py);i.onload=()=>{window.clearTimeout(s);try{let e=i.contentWindow,r=e?.document?.body;if(!e||!r)throw Error(`measurement frame has no readable document`);let a=t(r,e);o(()=>n(a))}catch(e){o(()=>
3308r(e instanceof Error?e:Error(String(e))))}},i.srcdoc=e,document.body.appendChild(i)})}var hy=new Map;async function gy(e){let t=hy.get(e);if(t)return t;try{let t=await my(e,(e,t)=>{let n=t.getComputedStyle(e),r=0,i=0;for(let t of e.querySelectorAll(`*`)){let e=t.getBoundingClientRect();e.width===0&&e.height===0||(r=Math.max(r,e.right),i=Math.max(i,e.bottom))}if(r===0&&i===0)throw Error(`empty document â nothing to measure`);return{width:Math.ceil(r+(parseFloat(n.paddingRight)||0)),height:Math.ceil(i+(parseFloat(n.paddingBottom)||0))}});return by(hy),hy.set(e,t),t}catch{return null}}var _y=`color.backgroundColor.backgroundImage.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.borderTopColor.borderTopStyle.borderTopLeftRadius.borderTopRightRadius.borderBottomLeftRadius.borderBottomRightRadius.fontSize.fontWeight.fontFamily.fontStyle.lineHeight.letterSpacing.textDecorationLine.textTransform.opacity.boxShadow.outlineWidth.outlineColor.transform.visibility`.split(`.`),vy=new Map;async function yy(e){let t=vy.get(e);if(t!==void 0)return t;try{let t=await my(e,(e,t)=>{let n=[],r=e=>{let i=t.getComputedStyle(e);if(i.display===`none`)return;let a=e.getBoundingClientRect(),o=e=>Math.round(e*2)/2;n.push([e.tagName,o(a.x),o(a.y),o(a.width),o(a.height),..._y.map(e=>i[e])].join(`|`));for(let t of e.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.textContent?.trim();e&&n.push(`#${e}`)}for(let t of e.children)r(t)};return r(e),n.join(` 3309`)});return by(vy),vy.set(e,t),t}catch{return null}}function by(e){for(;e.size>=24;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}var xy=`ds-playground.remembered-figma-token`,Sy=`ds-playground.remembered-anthropic-key`;function Cy(e){try{let t=window.localStorage.getItem(e);return t&&t.trim()?t:null}catch{return null}}function wy(e,t){try{t.trim()&&window.localStorage.setItem(e,t)}catch{}}function Ty(e){try{window.localStorage.removeItem(e)}catch{}}var Ey=`/assets/badge.figma-render-DNzYNAak.png`,Dy=`demo-fixture-token`,Oy=null;function ky(e){let t=e.trim();t&&(t===`demo-fixture-token`&&Oy&&Oy!==`demo-fixture-token`||(Oy=t))}function Ay(){return Oy&&Oy!==`demo-fixture-token`?Oy:Cy(`ds-playground.remembered-figma-token`)??Oy}var jy=new Map;async function My(e,t,n){if(n===`demo-fixture-token`)return e===`8nim1d0IPnehMxA7B7SYxC`?{ok:!0,url:Ey,note:`recorded fixture â a real images-API render of the fixture fileâs Badge set, captured and committed; with a session token this panel fetches live.`}:{ok:!1,error:`demo-session-only: the fixture transport has no recorded render for this file â import with a real token to fetch live ground truth.`};let r=`${e}::${t}`,i=jy.get(r);if(i)return{ok:!0,...i};let a=`/v1/images/${e}?ids=${encodeURIComponent(t)}&format=png&scale=2`,o;try{o=await fetch(`${__}${a}`,{headers:{"X-Figma-Token":n}})}catch(e){return{ok:!1,error:`figma-images-unreachable: ${e instanceof Error?e.message:String(e)}`}}if(o.status===429)return{ok:!1,error:`figma-images-rate-limited: HTTP 429 â the images API is rate-limited per token; wait a minute and retry.`};if(!o.ok){let e=await o.text().catch(()=>``);return{ok:!1,error:`Figma API ${o.status} on ${a.split(`?`)[0]}${e?` â ${e.slice(0,200)}`:``}`}}let s=await o.json().catch(()=>null);if(!s||s.err)return{ok:!1,error:`figma-images-error: ${s?.err??`unreadable response body`}`};let c=s.images?.[t];if(!c)return{ok:!1,error:`figma-images-empty: the API answered but rendered nothing for node ${t} â the node may have been deleted or moved since import (the anchor is import-time state). Re-import from the current file to refresh it.`};let l={url:c,note:null};return jy.set(r,l),{ok:!0,...l}}var Ny=e=>`var(--${e.split(`/`).join(`-`)})`,Py=(e,t)=>`var(--${e.split(`/`).join(`-`)}, ${t}px)`,Fy=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`),Iy={Thin:100,"Extra Light":200,Light:300,Regular:400,Medium:500,"Semi Bold":600,Bold:700,"Extra Bold":800,Black:900},Ly={paddingLeft:`padding-left`,paddingRight:`padding-right`,paddingTop:`padding-top`,paddingBottom:`padding-bottom`,itemSpacing:`gap`,topLeftRadius:`border-top-left-radius`,topRightRadius:`border-top-right-radius`,bottomLeftRadius:`border-bottom-left-radius`,bottomRightRadius:`border-bottom-right-radius`,strokeWeight:`border-width`,strokeTopWeight:`border-top-width`,strokeRightWeight:`border-right-width`,strokeBottomWeight:`border-bottom-width`,strokeLeftWeight:`border-left-width`,minWidth:`min-width`,minHeight:`min-height`,opacity:`opacity`},Ry=e=>e.bindings?.strokeWeight!==void 0||e.bindings?.strokeTopWeight!==void 0||e.bindings?.strokeRightWeight!==void 0||e.bindings?.strokeBottomWeight!==void 0||e.bindings?.strokeLeftWeight!==void 0||e.lits?.strokeWeight!==void 0||e.lits?.strokeSides!==void 0;function zy(e){let t=[];return e.stroke&&(e.strokeOutside?(t.push(`outline-color: ${Ny(e.stroke)}`,`outline-style: solid`),Ry(e)||t.push(`outline-width: 1px`)):(t.push(`border-color: ${Ny(e.stroke)}`,`border-style: solid`),Ry(e)||t.push(`border-width: 1px`))),t}function By(e){let t=[];for(let[n,r]of Object.entries(e.bindings??{})){if(n===`strokeWeight`&&e.strokeOutside){t.push(`outline-width: ${Ny(r)}`);continue}let i=Ly[n];
3309i&&t.push(`${i}: ${Ny(r)}`)}return t}function Vy(e,t){let n=[];if(e.effectStack&&e.effectStack.length>0){t.used.add(`shadow`);let r=e.effectStack.map(e=>{let t=e.color,n=t.a===void 0?1:t.a,r=`rgba(${Math.round(t.r*255)}, ${Math.round(t.g*255)}, ${Math.round(t.b*255)}, ${n})`;return`${e.inner?`inset `:``}${e.x}px ${e.y}px ${e.radius}px${e.spread?` ${e.spread}px`:``} ${r}`}).join(`, `);n.push(`box-shadow: ${r}`)}if(e.dropShadow){let r=e.dropShadow;t.used.add(`shadow`),n.push(`box-shadow: ${r.x}px ${r.y}px ${r.radius}px${r.spread?` ${r.spread}px`:``} ${r.color}`)}return n}var Hy={MIN:`flex-start`,CENTER:`center`,MAX:`flex-end`,SPACE_BETWEEN:`space-between`},Uy={MIN:`flex-start`,CENTER:`center`,MAX:`flex-end`,BASELINE:`baseline`},Wy={top:`bottom: 100%; left: 0;`,bottom:`top: 100%; left: 0;`,start:`right: 100%; top: 0;`,end:`left: 100%; top: 0;`};function Gy(e,t){let n=[];if(e.layout&&(n.push(`display: flex`),n.push(`flex-direction: ${e.layout.mode===`VERTICAL`?`column`:`row`}`),n.push(`justify-content: ${Hy[e.layout.primary]}`),n.push(`align-items: ${e.layout.stretchChildren?`stretch`:Uy[e.layout.counter]}`),e.layout.wrap&&n.push(`flex-wrap: wrap`)),e.fill&&n.push(`background-color: ${Ny(e.fill)}`),n.push(...Vy(e,t)),n.push(...zy(e)),n.push(...By(e)),e.fixedWidth&&n.push(`width: ${Py(e.fixedWidth.varName,e.fixedWidth.px)}`),e.fixedHeight&&n.push(`height: ${e.fixedHeight.varName?Py(e.fixedHeight.varName,e.fixedHeight.px):`${e.fixedHeight.px}px`}`),e.grow&&n.push(`flex: 1 1 auto`,`min-width: 0`),e.pct!==void 0&&(t.used.add(`meter`),n.push(`width: ${Math.round(e.pct*1e3)/10}%`,`align-self: stretch`)),e.overlay&&(t.used.add(`overlay`),n.push(`position: absolute`,Wy[e.overlay.placement].replace(/;$/,``))),e.insetOverlay){t.used.add(`overlay`);let r=e.insetOffsets??{top:0,right:0,bottom:0,left:0};n.push(`position: absolute`,`top: ${r.top}px`,`right: ${r.right}px`,`bottom: ${r.bottom}px`,`left: ${r.left}px`)}
3309return typeof e.opacity==`number`&&n.push(`opacity: ${e.opacity}`),e.imgPlaceholder&&t.used.add(`img`),n.push(...Ky(e,t)),e.blockRoot&&n.push(`width: 100%`),n.push(...qy(e)),n.join(`; `)}function Ky(e,t){let n=e.margins;if(!n)return[];t.used.add(`margin`);let r=[];return n.top!==void 0&&r.push(`margin-top: ${n.top}px`),n.right!==void 0&&r.push(`margin-right: ${n.right}px`),n.bottom!==void 0&&r.push(`margin-bottom: ${n.bottom}px`),n.left!==void 0&&r.push(`margin-left: ${n.left}px`),r}function qy(e){let t=e.lits;if(!t)return[];let n=[];if(t.fillClear)n.push(`background-color: transparent`);else if(t.fillColor){let e=t.fillColor;n.push(`background-color: rgba(${Math.round(e.r*255)}, ${Math.round(e.g*255)}, ${Math.round(e.b*255)}, ${e.a??1})`)}if(t.width!==void 0&&n.push(`width: ${t.width}px`),t.height!==void 0&&n.push(`height: ${t.height}px`),t.minWidth!==void 0&&n.push(`min-width: ${t.minWidth}px`),t.minHeight!==void 0&&n.push(`min-height: ${t.minHeight}px`),t.paddingTop!==void 0&&n.push(`padding-top: ${t.paddingTop}px`),t.paddingBottom!==void 0&&n.push(`padding-bottom: ${t.paddingBottom}px`),t.paddingLeft!==void 0&&n.push(`padding-left: ${t.paddingLeft}px`),t.paddingRight!==void 0&&n.push(`padding-right: ${t.paddingRight}px`),t.itemSpacing!==void 0&&n.push(`gap: ${t.itemSpacing}px`),t.radius!==void 0&&n.push(`border-radius: ${t.radius}px`),t.strokeWeight!==void 0&&n.push(`border-width: ${t.strokeWeight}px`,`border-style: solid`),t.radiusCorners){let e=t.radiusCorners;e.tl!==void 0&&n.push(`border-top-left-radius: ${e.tl}px`),e.tr!==void 0&&n.push(`border-top-right-radius: ${e.tr}px`),e.bl!==void 0&&n.push(`border-bottom-left-radius: ${e.bl}px`),e.br!==void 0&&n.push(`border-bottom-right-radius: ${e.br}px`)}if(t.strokeSides){let e=t.strokeSides;n.push(`border-style: solid`),e.top!==void 0&&n.push(`border-top-width: ${e.top}px`),e.right!==void 0&&n.push(`border-right-width: ${e.right}px`),e.bottom!==void 0&&n.push(`border-bottom-width: ${e.bottom}px`),e.left!==void 0&&n.push(`border-left-width: ${e.left}px`)}return n}function Jy(e,t){if(!e.visibleProp)return!0;let n=t.bools[e.visibleProp];return n===void 0?e.visibleDefault===!0:n}var Yy=e=>{let t={};for(let n of e.split(`,`)){let e=n.indexOf(`=`);e>0&&(t[n.slice(0,e).trim()]=n.slice(e+1).trim())}return t};function Xy(e,t){let n=Object.entries(t).filter(e=>typeof e[1]==`string`);return e.variants.find(e=>{let t=Yy(e.name);return n.every(([e,n])=>t[e]===void 0||t[e]===n)})??e.variants[0]}function Zy(e,t,n,r=``){let i=n.dataFor(e);if(!i||i.variants.length===0)return`<div class="cv-missing">instance of ${Fy(e)} â contract not found</div>`;n.used.add(`instance`);let a=Xy(i,t),o={bools:{},texts:{}};for(let[e,n]of Object.entries(t))typeof n==`boolean`?o.bools[e]=n:o.texts[e]=n;return $y(a.spec,n,o,r)}function Qy(e,t){let n=e.shape;t.used.add(`shape`);let r=[`width: ${n.width}px`,`height: ${n.height}px`,`flex-shrink: 0`];n.kind===`polygon`&&r.push(`clip-path: ${rl(n.sides??3)}`),n.kind===`ellipse`&&r.push(`border-radius: 50%`),e.fill&&r.push(`background-color: ${Ny(e.fill)}`),r.push(...zy(e)),r.push(...Vy(e,t)),r.push(...By(e)),r.push(...Ky(e,t)),r.push(...qy(e));let i=[],a=e.absolute;return a&&(r.push(`position: absolute`),a.h===`CENTER`?(r.push(`left: 50%`),i.push(`translateX(-50%)`)):a.h===`MAX`&&a.right!==void 0?r.push(`right: ${a.right}px`):a.left!==void 0&&r.push(`left: ${a.left}px`),a.v===`CENTER`?(r.push(`top: 50%`),i.push(`translateY(-50%)`)):a.v===`MAX`&&a.bottom!==void 0?r.push(`bottom: ${a.bottom}px`):a.top!==void 0&&r.push(`top: ${a.top}px`)),n.rotation&&i.push(`rotate(${n.rotation}deg)`),i.length>0&&r.push(`transform: ${i.join(` `)}`),r.join(`; `)}function $y(e,t,n,r=``){if(!Jy(e,n))return``;if(e.type===`shape`)return`<div style="${[Qy(e,t),r].filter(Boolean).join(`; `)}"></div>`;if(e.type===`svg`){t.used.add(`svg`);let n=e.iconSize;return`<span style="${[`display: inline-flex`,`flex-shrink: 0`,...n?[`width: ${n}px`,`height: ${n}px`]:[],r].filter(Boolean).join(`; `)}">${n?String(e.svg??``).replace(/^<svg /,`<svg width="${n}" height="${n}" `):e.svg??``}</span>`}if(e.type===`text`){let i=[`font-size: ${e.fontSize??14}px`,`font-weight: ${Iy[e.fontStyle??`Medium`]??500}`,`font-family: Inter, system-ui, sans-serif`,`line-height: ${typeof e.lineHeight==`number`?`${e.lineHeight}px`:`1.2`}`,`white-space: pre-wrap`];t.used.add(`font`),e.textFill&&i.push(`color: ${Ny(e.textFill)}`);let a=e.contentProp&&n.texts[e.contentProp]!==void 0?n.texts[e.contentProp]:e.characters??``;return e.fill||e.fixedWidth||e.fixedHeight||e.bindings?`<div style="${[`display: inline-flex`,`align-items: center`,`justify-content: center`,`flex-shrink: 0`,Gy(e,t),r].filter(
3309Boolean).join(`; `)}">${a===``?``:`<span style="${i.join(`; `)}">${Fy(a)}</span>`}</div>`:`<span style="${[i.join(`; `),r].filter(Boolean).join(`; `)}">${Fy(a)}</span>`}if(e.type===`instance`)return Zy(e.dep??``,e.depProps??{},t,r);if(e.type===`slot`){t.used.add(`slot`);let n=[Gy(e,t),r].filter(Boolean).join(`; `),i=e.slotDefault??[];return`<div class="cv-slot" style="${n}">${i.length>0?i.map(e=>Zy(e.dep,e.props??{},t)).join(``):`<span class="cv-slot__ph">â ${Fy(e.slotProperty??e.name)} slot</span>`}</div>`}let i=(e.children??[]).some(e=>e.overlay||e.absolute||e.insetOverlay),a=e.insetOverlay===!0||e.overlay!==void 0||e.absolute!==void 0;return`<div style="${[Gy(e,t),i&&!a?`position: relative`:``,r].filter(Boolean).join(`; `)}">${(e.children??[]).map(e=>$y(e,t,n)).join(``)}</div>`}var eb=`Default`;function tb(e){let t=e.stateVariants??[];return t.length===0?e.variants:[...e.variants.map(e=>{let t=e.name.includes(`=`)?`${e.name}, State=${eb}`:`State=${eb}`;return{...e,name:t,spec:{...e.spec,name:t}}}),...t]}function nb(e,t,n){let r=[];return n.has(`font`)&&r.push(`font-family â text renders in Inter/system: font stacks are not canvas-representable (fontFamily is not variable-bindable); size and weight are the compiled values.`),n.has(`svg`)&&r.push(`icon color â SVG paint is not variable-bindable on import, so glyph color is baked to the variantâs resolved foreground literal; single-paint glyphs are re-bound to their contract variable by the sync runtime (round 5d).`),(t.stateVariants??[]).length>0&&r.push(`State axis â canvas-only interaction previews; the focus outline renders as an OUTSIDE-aligned bound stroke (round 5d â a CSS outline paints outside the border box, over children; outline-offset is not carried).`),(e.events??[]).length>0&&r.push(`events â code-only by declared fidelity limit; the canvas cannot run behavior.`),n.has(`slot`)&&r.push(`slots â design-time default content (or the â placeholder); instance-swap and multi-child slot behavior are canvas interactions HTML does not run.`),n.has(`meter`)&&r.push(`meter fill â rendered at the contract defaultsâ fraction, as the sync script lays it out.`),n.has(`shape`)&&r.push(`shape decor â parametric vectors (polygon/ellipse) render as CSS clip-path boxes with the compiled rotation and exact captured placement; the sync script constructs REAL polygon/ellipse nodes.`),n.has(`overlay`)&&r.push(`overlay parts â absolute placement mirrors the runtimeâs constraints, not canvas pixel positions.`),n.has(`margin`)&&r.push(`margin channels â drawn as CSS margins here; the sync runtime applies the same geometry natively (round 5d: uniform sibling gaps lower to itemSpacing at compile, residual margins become the childâs margin-box wrapper frame).`),n.has(`img`)&&r.push(`image parts â raster content is runtime data; the canvas draws the standard image-placeholder wash (#D9D9D9).`),r.push(`grid â variant cells sit in the same row/column grid the sync script lays out; auto-layout renders as CSS flexbox, not canvas geometry.`),r}var rb=` 3310 /* Figma boxes are border-box: a FIXED height/width includes padding and 3311 stroke. Without this, a bound height (48px) plus padding-block (8px) 3312 drew a 64px content-box cell â visibly taller than the captured Figma 3313 variant box (extract/figma/canvas-box-check.ts pins the parity). */ 3314 *, *::before, *::after { box-sizing: border-box; } 3315 html { color-scheme: light; } 3316 body { 3317 margin: 0; 3318 padding: 20px; 3319 background: #ffffff; 3320 color: #1e1e1e; 3321 font-family: Inter, system-ui, sans-serif; 3322 } 3323 .cv-set { 3324 display: inline-block; 3325 min-width: min-content; 3326 border: 1px dashed #9747ff; 3327 border-radius: 5px; 3328 padding: 28px 20px 20px; 3329 position: relative; 3330 margin-top: 18px; 3331 } 3332 .cv-set__label { 3333 position: absolute; 3334 top: -18px; 3335 left: 0; 3336 color: #9747ff; 3337 font-size: 12px; 3338 display: inline-flex; 3339 align-items: center; 3340 gap: 5px; 3341 } 3342 .cv-set__label svg { flex-shrink: 0; } 3343 .cv-grid { 3344 display: grid; 3345 gap: 28px 40px; 3346 justify-items: start;
3347 align-items: start; 3348 } 3349 .cv-cell { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; } 3350 .cv-name { 3351 font-size: 10.5px; 3352 color: #7b7b7b; 3353 font-family: ui-monospace, Menlo, monospace; 3354 max-width: 320px; 3355 } 3356 .cv-slot { min-width: 24px; min-height: 24px; } 3357 .cv-slot__ph { 3358 border: 1px dashed #b3b3b3; 3359 color: #7b7b7b; 3360 font-size: 11px; 3361 padding: 6px 10px; 3362 white-space: nowrap; 3363 } 3364 .cv-missing { 3365 border: 1px dashed #d33; 3366 color: #d33; 3367 font-size: 11px; 3368 padding: 6px 10px; 3369 } 3370`,ib=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true"><path d="M3 1 1 3l2 2 2-2-2-2Zm6 0L7 3l2 2 2-2-2-2ZM3 7 1 9l2 2 2-2-2-2Zm6 0L7 9l2 2 2-2-2-2Z" fill="#9747ff"/></svg>`;function ab(e,t){let n=yg();try{let r=new Map(t);r.set(e.id,e);let i=iy(e,r,eg().layersByContractId,n.inventory),a=ay(n.tree,i),o=Object.keys(a.brands).length>0?a.brands:{default:{}},s=af({tokens:{...a,brands:o},icons:Sh}),c=new Map([...r.values()].map(e=>[e.name,e])),l=new Map,u={dataFor(e){if(!l.has(e)){let t=c.get(e);l.set(e,t?s.compileComponentData(t,r):null)}return l.get(e)},used:new Set},d=s.compileComponentData(e,r),f=tb(d),p={bools:{},texts:{}},m=f.map(e=>{let t=$y(e.spec,u,p);return[`<div class="cv-cell" style="grid-row: ${e.row+1}; grid-column: ${e.col+1};">`,t,`<div class="cv-name">${Fy(e.name)}</div>`,`</div>`].join(``)}).join(` 3371`),h=[...i.receipts,...nb(e,d,u.used)],g=n.stylesheets;return{ok:!0,notes:h,doc:[`<!doctype html>`,`<html>`,`<head><meta charset="utf-8">`,`<style>${Fg()}</style>`,`<style>${g.base}\n${g.brands}</style>`,`<style>${rb}</style>`,`</head><body>`,`<div class="cv-set" role="figure" aria-label="${Fy(d.setName)} component set">`,`<div class="cv-set__label">${ib}${Fy(d.setName)}</div>`,`<div class="cv-grid">${m}</div>`,`</div>`,`</body></html>`].join(` 3372`)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}var ob=(0,f.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,f.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`}),(0,f.jsx)(`path`,{d:`M8 7v4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,f.jsx)(`circle`,{cx:`8`,cy:`4.75`,r:`0.9`,fill:`currentColor`})]});function sb({title:e,align:t=`end`,children:n}){let r=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=e=>{let t=r.current;t?.open&&e.target instanceof Node&&!t.contains(e.target)&&(t.open=!1)},t=e=>{let t=r.current;e.key===`Escape`&&t?.open&&(t.open=!1,t.querySelector(`summary`)?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[]),(0,f.jsxs)(`details`,{className:`ipop ipop--${t}`,ref:r,children:[(0,f.jsx)(`summary`,{className:`ipop__btn`,title:e,"aria-label":e,children:ob}),(0,f.jsx)(`div`,{className:`ipop__panel`,children:n})]})}var cb=.45;function lb({contract:e,contracts:t,title:n,cap:r=`Canvas â figma engine`}){let i=(0,l.useMemo)(()=>ab(e,t),[e,t,Dg()]),a=i.ok?i.doc:null,o=(0,l.useRef)(null),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(c(null),!a)return;let e=!1;return gy(a).then(t=>{e||c(t)}),()=>{e=!0}},[a]),(0,l.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>d(e.clientWidth));return t.observe(e),d(e.clientWidth),()=>t.disconnect()},[i.ok]),!i.ok)return(0,f.jsxs)(`div`,{className:`output__error`,children:[`Canvas preview refused â `,i.error]});let p=s&&u&&s.width>u?Math.max(cb,u/s.width):1,m=s!==null&&p<1;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`preview__cap`,children:[(0,f.jsx)(`span`,{children:r}),m?(0,f.jsxs)(`span`,{className:`preview__cap-zoom`,title:`Scaled down so the whole variant grid fits the pane â the document itself is unchanged.`,children:[`fit `,Math.round(p*100),`%`]}):null,(0,f.jsxs)(sb,{title:`Fidelity notes â what this HTML render of the canvas can and cannot mimic`,children:[(0,f.jsxs)(`p`,{children:[(0,f.jsx)(`strong`,{children:`Deterministic â both sides compiled from the same contract; no AI.`}
3372),` `,`This is the sync scriptâs node spec rendered as HTML. Fidelity notes:`]}),(0,f.jsx)(`ul`,{children:i.notes.map(e=>(0,f.jsx)(`li`,{children:e},e))})]})]}),(0,f.jsx)(`div`,{className:`canvas-fit`,ref:o,children:m&&s?(0,f.jsx)(`div`,{className:`canvas-fit__scroll`,children:(0,f.jsx)(`div`,{className:`canvas-fit__box`,style:{width:Math.ceil(s.width*p),height:Math.ceil(s.height*p)},children:(0,f.jsx)(`iframe`,{sandbox:``,srcDoc:i.doc,title:n,style:{width:s.width,height:s.height,transform:`scale(${p})`,transformOrigin:`0 0`,border:0}})})}):(0,f.jsx)(`iframe`,{sandbox:``,srcDoc:i.doc,title:n})})]})}var ub=2e5,db=null,fb=null,pb=()=>db;function mb(){if(!fb){let e=window;e.Prism={...e.Prism,manual:!0,disableWorkerMessageHandler:!0},fb=k_(()=>import(`./prism-bundle-dpy2kVV0.js`).then(e=>(db=e.default,e.default),e=>{throw ee(e),fb=null,e}),__vite__mapDeps([0,1]))}return fb}function hb(e){switch(e.slice(e.lastIndexOf(`.`)+1).toLowerCase()){case`tsx`:return`tsx`;case`ts`:return`typescript`;case`jsx`:return`jsx`;case`js`:case`mjs`:case`cjs`:return`javascript`;case`css`:return`css`;case`html`:return`markup`;case`json`:return`json`;default:return null}}function gb(e,t,n){let r=e.languages[n];if(!r)return null;try{return e.highlight(t,r,n)}catch{return null}}var _b=(0,l.forwardRef)(function({text:e,onChange:t,highlights:n,placeholder:r},i){let a=(0,l.useRef)(null),o=(0,l.useRef)(null),s=()=>{let e=a.current,t=o.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};(0,l.useEffect)(s),(0,l.useImperativeHandle)(i,()=>({scrollToLine(t){let n=a.current;if(!n)return;let r=parseFloat(getComputedStyle(n).lineHeight)||18.6;n.scrollTop=Math.max(0,t*r-n.clientHeight/3);let i=e.split(` 3373`).slice(0,t).reduce((e,t)=>e+t.length+1,0);n.setSelectionRange(i,i),n.focus({preventScroll:!0}),s()}}));let[c,u]=(0,l.useState)(pb);(0,l.useEffect)(()=>{if(c)return;let e=!0;return mb().then(t=>{e&&u(t)}).catch(()=>{}),()=>{e=!1}},[c]);let d=(0,l.useMemo)(()=>e.split(` 3374`),[e]),p=(0,l.useMemo)(()=>{if(!c||e.length===0||e.length>=2e5)return null;let t=c.languages.json;if(!t)return null;try{return d.map(e=>e.length>0?c.highlight(e,t,`json`):` `)}catch{return null}},[c,e.length,d]),m=p!==null||n.size>0;return(0,f.jsxs)(`div`,{className:`editor__wrap${p?` editor__wrap--hl`:``}`,children:[(0,f.jsx)(`div`,{className:`editor__backdrop`,ref:o,"aria-hidden":!0,children:m?(0,f.jsx)(`pre`,{className:`editor__backdrop-pre${p?` code-hl`:``}`,children:d.map((e,t)=>{let r=n.has(t)?`editor__line editor__line--refused`:`editor__line`;return p?(0,f.jsx)(`div`,{className:r,dangerouslySetInnerHTML:{__html:p[t]}},t):(0,f.jsx)(`div`,{className:r,children:e.length>0?e:` `},t)})}):null}),(0,f.jsx)(`textarea`,{ref:a,className:`editor__textarea`,value:e,onChange:e=>t(e.target.value),onScroll:s,wrap:`off`,spellCheck:!1,"aria-label":`Contract JSON editor`,placeholder:r})]})});function vb({text:e,className:t}){let[n,r]=(0,l.useState)(!1),i=(0,l.useRef)(void 0);return(0,l.useEffect)(()=>()=>window.clearTimeout(i.current),[]),(0,f.jsx)(`button`,{type:`button`,className:`btn--small ${t??``}`,onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),window.clearTimeout(i.current),i.current=window.setTimeout(()=>r(!1),1500)}catch{}},children:n?`Copied`:`Copy`})}function yb({contract:e}){let t=e.anchors?.figma,n=t?.fileKey??null,r=t?.nodeId??null,i=Ay(),a=!!(n&&r&&i),[o,s]=(0,l.useState)({kind:`idle`}),[c,u]=(0,l.useState)(0);return(0,l.useEffect)(()=>{if(!n||!r||!i){s({kind:`idle`});return}let e=!1;return s({kind:`busy`}),My(n,r,i).then(t=>{e||s(t.ok?{kind:`ok`,url:t.url,note:t.note}:{kind:`error`,error:t.error})}),()=>{e=!0}},[n,r,i,c]),(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`preview__cap`,children:[(0,f.jsx)(`span`,{children:`Figmaâs own render`}),(0,f.jsxs)(sb,{title:`About this panel â the Figma images API`,children:[(0,f.jsxs)(`p`,{children:[(0,f.jsx)(`strong`,{children:`Ground truth, not a compile.`}),` The canvas beside this is compiled from the contract; this panel is the PNG Figma itself draws for the imported node â GET /v1/images/:fileKey (PNG, @2x), using the contractâs own anchor (anchors.figma.fileKey · nodeId) and the session token the import used.`]}),(0,f.jsx)(`p`,{children:`The token is session-only by default â sent to api.figma.com and n
3374owhere else, gone on reload â unless you opted into âRemember on this deviceâ in the Figma tab (this browserâs localStorage only, cleared from the same field). The API answers with a short-lived S3 URL; the image loads as a plain <img>. Rate limits are named (HTTP 429 â wait a minute and retry).`})]})]}),(0,f.jsx)(`div`,{className:`gt__body`,children:!n||!r?(0,f.jsx)(`p`,{className:`gt__msg`,children:`No Figma source on this contract â it was not imported from a Figma node (anchors.figma is empty), so there is no ground truth to fetch. Generate one via the validation loop: paste the Figma script tabâs output into a file, then import that node back here.`}):i?o.kind===`busy`?(0,f.jsx)(`p`,{className:`gt__msg`,children:`Asking Figma for the node render (images API, PNG @2x)â¦`}):o.kind===`error`?(0,f.jsxs)(`div`,{className:`gt__msg gt__msg--error`,children:[o.error,(0,f.jsx)(`div`,{style:{marginTop:8},children:(0,f.jsx)(`button`,{type:`button`,onClick:()=>u(e=>e+1),children:`Retry`})})]}):o.kind===`ok`?(0,f.jsxs)(`figure`,{className:`gt__figure`,children:[(0,f.jsx)(`img`,{src:o.url,alt:`Figma's own render of ${e.name} (node ${r})`}),o.note?(0,f.jsx)(`figcaption`,{className:`gt__note`,children:o.note}):null]}):a?null:(0,f.jsx)(`p`,{className:`gt__msg`,children:`Nothing to fetch yet.`}):(0,f.jsxs)(`p`,{className:`gt__msg`,children:[`This contract knows its Figma source (`,n,` · `,r,`), but no token is at hand â tokens are session-only unless remembered on this device (Figma tab). Re-import to fetch ground truth.`]})})]})}var bb=e=>e.trim().replace(/^\{/,``).replace(/\}$/,``);function xb(e){let t=new Map;for(let n of e.matchAll(/\{(imported\.[a-z0-9-]+(?:\.[a-z0-9-]+)*)\.\{([a-zA-Z][a-zA-Z0-9]*)\}\}/g))t.set(n[1],n[2]);return t}function Sb(e,t,n){let r=xb(t);return e.map(e=>{let i=bb(e.from),a=bb(e.to),o={from:i,to:a,rationale:e.rationale??``,kind:`direct`};if(!n.has(i))return{...o,refused:`"${i}" is not a minted leaf in the active layer â nothing to rename`};if(i===a)return{...o,refused:`the proposal keeps the same path â nothing to apply`};if(t.includes(`{${i}}`))return o;for(let[e,t]of r)if(i.startsWith(`${e}.`)&&!i.slice(e.length+1).includes(`.`))return{...o,kind:`grouped`,groupBase:e,groupAxis:t};return{...o,refused:`the contract text references neither {${i}} nor a substitution group containing it â nothing to rewrite`}})}function Cb(e,t,n,r){let i=e=>({ok:!1,text:n,appliedFrom:[],notes:[],error:e});if(e.refused)return i(e.refused);if(e.kind===`direct`){let t=Tg(e.from,e.to);return t.ok?{ok:!0,text:n.split(`{${e.from}}`).join(`{${e.to}}`),appliedFrom:[e.from],notes:t.deduped?[`{${e.to}} already exists in the active token source â deduplicated, the minted leaf retired`]:[]}:i(t.error)}let a=e.groupBase,o=e.groupAxis,s=t.filter(e=>e.kind===`grouped`&&e.groupBase===a&&!e.refused),c=new Set(s.map(e=>e.from)),l=[...r].filter(e=>e.startsWith(`${a}.`)&&!e.slice(a.length+1).includes(`.`)),u=l.filter(e=>!c.has(e));if(u.length>0)return i(`{${a}.{${o}}} binds ${l.length} leaves but the proposal covers ${s.length} â missing: ${u.join(`, `)}. Grouped leaves rename together or not at all.`);let d=s.map(e=>({axisValue:e.from.slice(a.length+1),segs:e.to.split(`.`)})),f=d[0].segs.length;if(!d.every(e=>e.segs.length===f))return i(`the proposed group names have different depths â no consistent template; grouped leaves rename together or not at all`);let p=null;for(let e=0;e<f;e++)if(d.every(t=>t.segs[e]===t.axisValue)&&d.every(t=>t.segs.every((t,n)=>n===e||t===d[0].segs[n]))){p=d[0].segs.map((t,n)=>n===e?`{${o}}`:t);break}if(!p)return i(`the proposed names do not agree on a template (the ${o} value in one position, everything else identical) â grouped leaves rename together or not at all`);let m=[`group apply: {${a}.{${o}}} covers ${s.length} leaves â all applied together`];for(let e of s){let t=Tg(e.from,e.to);if(!t.ok)return i(`${e.from}: ${t.error}`);t.deduped&&m.push(`{${e.to}} already exists in the active token source â deduplicated, the minted leaf retired`)}return{ok:!0,text:n.split(`{${a}.{${o}}}`).join(`{${p.join(`.`)}}`),appliedFrom:s.map(e=>e.from),notes:m}}function wb({minted:e,component:t,text:n,onApplyText:r,fetchImpl:i}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(null),p=(0,l.useRef)(new Set),m=async()=>{o(!0),c(null),d(null);try{let r=await U_({component:t,entries:e.entries.map(e=>({ref:e.ref,value:e.value,usageSites:e.usageSites})),existingTokenPaths:[...Sg().inventory].sort().slice(0,3e3)},i);if(!r.ok){c(r.message);return}
3374p.current=new Set(e.entries.map(e=>e.ref.replace(/^\{/,``).replace(/\}$/,``)));let a=Sb(r.data.renames,n,p.current);if(a.length===0){c(`assist returned no renames â nothing to propose`);return}d(a.map(e=>({plan:e,applied:!1,error:null,notes:[]})))}finally{o(!1)}},h=(e,t,n)=>{let r=e[t];if(r.applied)return{next:e,text:null};let i=Cb(r.plan,e.map(e=>e.plan),n,p.current);if(!i.ok)return{next:e.map((e,n)=>n===t?{...e,error:i.error??`refused`}:e),text:null};for(let e of i.appliedFrom)p.current.delete(e);let a=new Set(i.appliedFrom);return{next:e.map(e=>a.has(e.plan.from)?{...e,applied:!0,error:null,notes:i.notes}:e),text:i.text}},g=e=>{if(!u)return;let{next:t,text:i}=h(u,e,n);d(t),i!==null&&r(i)},_=()=>{if(!u)return;let e=u,t=n;for(let n=0;n<e.length;n++){if(e[n].applied||e[n].plan.refused)continue;let{next:r,text:i}=h(e,n,t);e=r,i!==null&&(t=i)}d(e),t!==n&&r(t)},v=u?.filter(e=>!e.applied&&!e.plan.refused&&!e.error)??[];return(0,f.jsxs)(`div`,{className:`mint-assist`,children:[(0,f.jsxs)(`div`,{className:`mint-assist__bar`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn--small`,disabled:a,onClick:()=>void m(),children:a?`Asking the assist Workerâ¦`:`Suggest semantic names (AI)`}),u&&v.length>0?(0,f.jsxs)(`button`,{type:`button`,className:`btn--small`,onClick:_,children:[`Apply all (`,v.length,`)`]}):null]}),(0,f.jsx)(`p`,{className:`hint mint-assist__hint`,children:`Shared assist Worker (server-held key, daily caps) â every suggestion is ai-proposed; applying one rewrites the ref and moves the value, and the editor referees the result.`}),s?(0,f.jsx)(`div`,{className:`notice notice--error mint-assist__error`,children:s}):null,u?u.map((e,t)=>(0,f.jsxs)(`div`,{className:`mint-assist__row`,children:[(0,f.jsxs)(`div`,{className:`mint-assist__line`,children:[(0,f.jsx)(`span`,{className:`mint-assist__tag`,"aria-label":`AI-proposed suggestion`,children:`ai-proposed`}),(0,f.jsx)(`code`,{className:`mint-assist__from`,children:`{${e.plan.from}}`}),(0,f.jsx)(`span`,{"aria-hidden":!0,children:` â `}),(0,f.jsx)(`code`,{className:`mint-assist__to`,children:`{${e.plan.to}}`}),e.applied?(0,f.jsx)(`span`,{className:`mint-assist__applied`,children:`applied â`}):e.plan.refused?null:(0,f.jsxs)(`button`,{type:`button`,className:`btn--small`,onClick:()=>g(t),children:[`Apply`,e.plan.kind===`grouped`?` (group)`:``]})]}),(0,f.jsx)(`div`,{className:`mint-assist__rationale`,children:e.plan.rationale}),e.plan.refused?(0,f.jsxs)(`div`,{className:`mint-assist__refusal`,children:[`refused â `,e.plan.refused]}):null,e.error?(0,f.jsxs)(`div`,{className:`mint-assist__refusal`,children:[`refused â `,e.error]}):null,e.notes.map((e,t)=>(0,f.jsx)(`div`,{className:`mint-assist__note`,children:e},t))]},e.plan.from)):null]})}function Tb({path:e,code:t}){let n=hb(e),r=t.length>=ub,[i,a]=(0,l.useState)(pb);(0,l.useEffect)(()=>{if(i||!n||r)return;let e=!0;return mb().then(t=>{e&&a(t)}).catch(()=>{}),()=>{e=!1}},[i,n,r]);let o=(0,l.useMemo)(()=>i&&n&&!r?gb(i,t,n):null,[i,n,r,t]);return o===null?(0,f.jsxs)(f.Fragment,{children:[r&&n?(0,f.jsx)(`div`,{className:`output__hlnote`,children:`Syntax colors skipped â this file is over 200 KB.`}):null,(0,f.jsx)(`pre`,{className:`output__code`,children:t})]}):(0,f.jsx)(`pre`,{className:`output__code code-hl`,children:(0,f.jsx)(`code`,{dangerouslySetInnerHTML:{__html:o}})})}var Eb=e=>e.groups.reduce((e,t)=>e+(t.uncounted?0:t.entries.length),0);function Db(e){let t=new Map,n=[];for(let r of e){let e=[r.code??``,r.message,(r.suggestions??[]).join(`\0`),r.detail??``].join(`�`),i=t.get(e);if(i)i.count+=1,i.labels.push(r.label??``);else{let i={entry:r,labels:[r.label??``],count:1};t.set(e,i),n.push(i)}}return n}function Ob(e){let t=e.labels.map(e=>{let t=e.indexOf(` · `);return t>0?{node:e.slice(0,t),field:e.slice(t+3)}:null}).filter(e=>e!==null);if(t.length===e.labels.length){let n=new Set(t.map(e=>e.node)).size,r=new Set(t.map(e=>e.field)).size;return`Ã${e.count} uses (${r} propert${r===1?`y`:`ies`} across ${n} variant${n===1?``:`s`})`}return`Ã${e.count} uses`}function kb({group:e,mintedExtras:t}){let n=Db(e.entries);return(0,f.jsxs)(`div`,{className:`receipts__group`,children:[(0,f.jsxs)(`div`,{className:`receipts__group-title`,children:[e.title,` (`,e.entries.length,`)`]}),n.map((t,n)=>{let{entry:r}=t,i=t.count>1;return(0,f.jsxs)(`div`,{className:`receipts__entry receipts__entry--${e.kind}`,children:[r.code?(0,f.jsxs)(`span`,{className:`receipts__code`,children:[`[`,r.code,`] `]}):null,!i&&r.label?(0,f.jsxs)(`span`,{className:`receipts__label`,children:[r.label,` â `]}):null,r.message,i?(0,f.jsxs)(`div`,{className:`receipts__cluster`,children:[(0,f.jsx)(`span`,{className:`receipts__cluster-count`,children:Ob(t)}),(0,f.jsxs)(`details`,{children:[(0,f.jsx)(`summary`,{children:`every use, named`}),(0,f.jsx)(`ul`,{children:t.labels.map((e,t)=>(0,f.jsx)(`li`,{children:e||`(unlabeled)`},t))})]})]}):null,r.suggestions&&r.suggestions.length>0?(0,f.jsxs)(`div`,{className:`receipts__suggestions`,children:[`nearest tokens: `,r.suggestions.join(`, `)]}):null,r.detail?(0,f.jsxs)(`details`,{className:`receipts__detail`,children:[(0,f.jsx)(`summary`,{children:`technical detail`}),(0,f.jsx)(`pre`,{children:r.detail})]}):null]},n)}),e.kind===`minted`?t:null]})}function Ab({receipts:e,mintedExtras:t,embedded:n=!1}
3374){return(0,f.jsxs)(`section`,{className:`receipts`,"aria-label":`Receipts`,children:[n?e?(0,f.jsx)(`div`,{className:`receipts__head`,children:(0,f.jsx)(`span`,{className:`receipts__source`,children:e.source})}):null:(0,f.jsxs)(`div`,{className:`receipts__head`,children:[(0,f.jsx)(`span`,{className:`pane__title`,children:`Receipts`}),e?(0,f.jsxs)(`span`,{className:`receipts__source`,children:[e.source,` â `,Eb(e),` entr`,Eb(e)===1?`y`:`ies`]}):null]}),e?(0,f.jsx)(`p`,{className:`receipts__sub`,children:`What the engine reported instead of guessing â every gap, note, and raw value from this import, verbatim.`}):null,e?e.groups.length===0?(0,f.jsx)(`p`,{className:`receipts__empty`,children:`Clean pass â no degradations, no unbound values.`}):e.groups.map(e=>(0,f.jsx)(kb,{group:e,mintedExtras:t},e.title)):(0,f.jsx)(`p`,{className:`receipts__empty`,children:`Import from Figma or propose from code and every degradation, note, and unbound value lands here, named.`})]})}var jb=`ds-playground.drawer-collapsed`,Mb=e=>(0,f.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:e?`M3 10l5-5 5 5`:`M3 6l5 5 5-5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})});function Nb({controls:e,receipts:t,mintedExtras:n,footNote:r}){let[i,a]=(0,l.useState)(`controls`),[o,s]=(0,l.useState)(()=>{try{return window.localStorage.getItem(jb)===`1`}catch{return!1}}),c=()=>{s(e=>{try{window.localStorage.setItem(jb,e?`0`:`1`)}catch{}return!e})},u=(0,l.useRef)(t);(0,l.useEffect)(()=>{t&&t!==u.current&&a(`receipts`),u.current=t},[t]);let d=t?Eb(t):0,p=(e,t)=>(0,f.jsx)(`button`,{type:`button`,role:`tab`,id:`dock-tab-${e}`,"aria-selected":i===e,"aria-controls":`dock-panel`,className:`dock__tab${i===e?` is-active`:``}`,onClick:()=>{a(e),o&&c()},children:t});return(0,f.jsxs)(`section`,{className:`dock${o?` dock--collapsed`:``}`,"aria-label":`Controls and receipts`,children:[(0,f.jsxs)(`div`,{className:`dock__bar`,children:[(0,f.jsxs)(`div`,{role:`tablist`,"aria-label":`Drawer panel`,className:`dock__tabs`,children:[p(`controls`,`Controls`),p(`receipts`,(0,f.jsxs)(f.Fragment,{children:[`Receipts`,(0,f.jsx)(`span`,{className:`dock__badge`,"aria-label":`${d} receipt entries`,children:d})]}))]}),r,(0,f.jsx)(`button`,{type:`button`,className:`dock__toggle`,"aria-expanded":!o,"aria-label":o?`Expand the controls and receipts drawer`:`Collapse the controls and receipts drawer`,onClick:c,children:Mb(o)})]}),o?null:(0,f.jsx)(`div`,{className:`dock__body`,role:`tabpanel`,id:`dock-panel`,"aria-labelledby":`dock-tab-${i}`,children:i===`controls`?e:(0,f.jsx)(Ab,{receipts:t,mintedExtras:n,embedded:!0})})]})}var Pb=`ds-playground.pane-widths`,Fb=5,Ib=Fb*2,Lb=16,Rb={rail:280,center:320,output:360},zb=420,Bb=()=>{try{let e=window.sessionStorage.getItem(Pb);if(!e)return{rail:null,output:null};let t=JSON.parse(e);return{rail:typeof t.rail==`number`?t.rail:null,output:typeof t.output==`number`?t.output:null}}catch{return{rail:null,output:null}}};function Vb(e,t,n){let[r,i]=(0,l.useState)(Bb);(0,l.useEffect)(()=>{try{r.rail===null&&r.output===null?window.sessionStorage.removeItem(Pb):window.sessionStorage.setItem(Pb,JSON.stringify(r))}catch{}},[r]);let a=r.rail===null&&r.output===null?null:`${r.rail??zb}px ${Fb}px minmax(${Rb.center}px, 1fr) ${Fb}px ${r.output===null?`minmax(${Rb.output}px, 1.1fr)`:`${r.output}px`}`,o=(0,l.useRef)(null),s=t=>{let n=e.current?.clientWidth??0,i=t===`rail`?r.output??Rb.output:r.rail??zb;return n-Ib-Rb.center-i},c=(e,t,n)=>Math.round(Math.min(Math.max(t,Rb[e]),Math.max(Rb[e],n))),u=e=>(e===`rail`?t.current:n.current)?.getBoundingClientRect().width??(e===`rail`?zb:Rb.output);return{cols:a,gutterProps:e=>({onPointerDown:t=>{t.button===0&&(o.current={side:e,startX:t.clientX,start:u(e),max:s(e)},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault())},onPointerMove:t=>{let n=o.current;if(!n||n.side!==e)return;let r=t.clientX-n.startX,a=c(e,e===`rail`?n.start+r:n.start-r,n.max);i(t=>t[e]===a?t:{...t,[e]:a})},onPointerUp:()=>{o.current=null},onPointerCancel:()=>{o.current=null},onDoubleClick:()=>i(t=>({...t,[e]:null})),onKeyDown:t=>{if(t.key!==`ArrowLeft`&&t.key!==`ArrowRight`)return;t.preventDefault();let n=t.key===`ArrowRight`?Lb:-16,r=c(e,u(e)+(e===`rail`?n:-n),s(e));i(t=>t[e]===r?t:{...t,[e]:r})}})}}function Hb(e){return e.props.map(t=>typeof t.type==`object`&&`enum`in t.type?{kind:`enum`,name:t.name,description:t.description,values:t.type.enum,fallback:String(t.default??t.type.enum[0])}:t.type===`boolean`?{kind:`boolean`,name:t.name,description:t.description,fallback:t.default===!0}
3374:t.type===`text`?{kind:`text`,name:t.name,description:t.description,fallback:typeof t.default==`string`?t.default:e.name}:t.type===`number`?{kind:`number`,name:t.name,description:t.description,fallback:typeof t.default==`number`?t.default:0}:{kind:`code-only`,name:t.name,description:t.description,fallback:``})}function Ub(e,t){let n={};for(let r of Hb(e)){let e=t[r.name];e!==void 0&&(r.kind===`enum`&&typeof e==`string`&&r.values.includes(e)||r.kind===`boolean`&&typeof e==`boolean`||r.kind===`text`&&typeof e==`string`||r.kind===`number`&&typeof e==`number`)&&(n[r.name]=e)}return n}function Wb({id:e,kind:t,value:n,onCommit:r}){let[i,a]=(0,l.useState)(String(n));return(0,l.useEffect)(()=>{a(String(n))},[n]),(0,l.useEffect)(()=>{if(i===String(n))return;let e=window.setTimeout(()=>{r(t===`number`?Number(i)||0:i)},150);return()=>window.clearTimeout(e)},[i]),(0,f.jsx)(`input`,{id:e,type:t===`number`?`number`:`text`,value:i,onChange:e=>a(e.target.value),spellCheck:!1})}var Gb=`No visible change â by design: this prop has no effect in the static HTML preview (it manifests in code or on the canvas).`;function Kb(e,t){let n=e.filter(e=>e!==t).sort((e,t)=>e.localeCompare(t));return e.includes(t)?[t,...n]:n}function qb({contract:e,overrides:t,onChange:n,notedProp:r}){let i=Hb(e);return i.length===0&&!e.events?.length?null:(0,f.jsxs)(`div`,{className:`pv-controls`,role:`group`,"aria-label":`Preview prop controls`,children:[i.map(e=>{let i=`pv-${e.name}`,a=t[e.name]??e.fallback;return(0,f.jsxs)(`div`,{className:`pv-control`,title:e.description,children:[e.kind===`code-only`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`pv-control__label`,children:e.name}),(0,f.jsx)(`span`,{className:`pv-tag`,title:`This prop is a list â it renders in code only; the canvas and this static preview have no control for it.`,children:`code-only`})]}):e.kind===`boolean`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`pv-control__label`,children:e.name}),(0,f.jsxs)(`label`,{className:`pv-control__check`,htmlFor:i,children:[(0,f.jsx)(`input`,{id:i,type:`checkbox`,checked:a===!0,onChange:t=>n(e.name,t.target.checked)}),a===!0?`on`:`off`]})]}):e.kind===`enum`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`label`,{className:`pv-control__label`,htmlFor:i,children:e.name}),(0,f.jsx)(`select`,{id:i,value:String(a),onChange:t=>n(e.name,t.target.value),children:Kb(e.values,String(e.fallback)).map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`label`,{className:`pv-control__label`,htmlFor:i,children:e.name}),(0,f.jsx)(Wb,{id:i,kind:e.kind,value:a,onCommit:t=>n(e.name,t)})]}),r===e.name?(0,f.jsx)(`span`,{className:`pv-note`,children:Gb}):null]},e.name)}),e.events&&e.events.length>0?(0,f.jsxs)(`div`,{className:`pv-control pv-control--events`,children:[(0,f.jsx)(`span`,{className:`pv-control__label`,children:`events`}),(0,f.jsxs)(`span`,{className:`pv-events`,children:[e.events.map(e=>e.bindings.code.prop).join(`, `),` `,(0,f.jsx)(`span`,{className:`pv-tag`,title:`Declared callbacks run in the generated code â this static preview cannot fire them.`,children:`code-only`})]})]}):null]})}var Jb=e=>typeof e.type==`object`&&`enum`in e.type,Yb=e=>typeof e.type==`object`&&`arrayOf`in e.type,Xb=e=>Jb(e)?`enum`:Yb(e)?`list`:e.type,Zb=e=>e.type===`boolean`?e.default===!0?`on`:`off`:e.default===void 0?`â`:e.type===`text`?`â${String(e.default)}â`:String(e.default),Qb=({values:e,mono:t=!1})=>(0,f.jsx)(`span`,{className:`spec__chips`,children:e.map(e=>(0,f.jsx)(`span`,{className:`spec__chip${t?` spec__chip--mono`:``}`,children:e},e))});function $b(e){let t=new Map,n=e=>{let n=e.slice(1).split(`.`)[0].replace(/\}.*$/,``);t.has(n)||t.set(n,new Set),t.get(n).add(e)};for(let{part:t}of U(e)){for(let e of Object.values(t.tokens??{}))n(e);for(let e of Object.values(t.states??{}))for(let t of Object.values(e))n(t)}return[...t.entries()].map(([e,t])=>[e,[...t]])}function ex(e){let t=[];for(let{name:n,part:r}of U(e)){let e=r.layoutByProp;if(e)for(let[r,i]of Object.entries(e.map)){let a=Object.entries(i).map(([e,t])=>`${e}: ${t}`).join(`, `);t.push(`${n} â when ${e.prop} is â${r}â: ${a}`)}}return t}function tx(e){let t=e.semantics,n=`<${t.element}>`;t.elementByProp&&(n+=` (element follows ${t.elementByProp.prop})`),t.role&&t.role!==t.element&&(n+=` role="${t.role}"`),t.roleByProp&&(n+=` (role follows ${t.roleByProp.prop})`);let r=e.anatomy.root?.attrs?.role;r&&(n+=` role="${r}"`);let i=[];t.roleException&&i.push(`root: ${t.roleException}`);for(let{name:t,part:n,path:r}of U(e))r[0]===`root`&&r.length===1||n.roleException&&i.push(`${t}: ${n.roleException}`);return{summary:n,exceptions:i}}function nx(e){let t=e.a11y;if(!t)return null;let n=[];return t.focusVisible&&n.push(`visible focus ring required`),t.minHitArea&&n.push(`hit area at least ${t.minHitArea}Ã${t.minHitArea}px`),t.contrast&&n.push(`contrast ${t.contrast}`),n.length>0?n.join(` · `):null}function rx({contract:e,contracts:t,onEditJson:n}){let r=e.props.filter(Jb),i=r.reduce((e,t)=>
3374e*t.type.enum.length,1),a=Dl(e),o=$b(e),s=ex(e),c=nx(e),l=tx(e),u=e=>t.get(e)?.name??e;return(0,f.jsxs)(`div`,{className:`spec`,"aria-label":`${e.name} spec sheet`,children:[(0,f.jsxs)(`div`,{className:`spec__header`,children:[(0,f.jsxs)(`div`,{className:`spec__title-row`,children:[(0,f.jsx)(`span`,{className:`spec__name`,children:e.name}),(0,f.jsxs)(`span`,{className:`spec__meta`,children:[`v`,e.version,` · `,e.status]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--small spec__edit`,onClick:n,title:`The spec is read-only â every edit happens in the JSON, refereed by the schema.`,children:`Edit JSON`})]}),(0,f.jsx)(`p`,{className:`spec__desc`,children:e.description})]}),(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Props`}),e.props.length===0?(0,f.jsx)(`p`,{className:`spec__none`,children:`No props â this component renders one way.`}):(0,f.jsx)(`div`,{className:`spec__table-wrap`,children:(0,f.jsxs)(`table`,{className:`spec__table`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{children:`Prop`}),(0,f.jsx)(`th`,{children:`Type`}),(0,f.jsx)(`th`,{children:`Options`}),(0,f.jsx)(`th`,{children:`Default`}),(0,f.jsx)(`th`,{children:`Notes`})]})}),(0,f.jsx)(`tbody`,{children:e.props.map(e=>(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{className:`spec__mono`,children:e.name}),(0,f.jsx)(`td`,{children:Xb(e)}),(0,f.jsx)(`td`,{children:Jb(e)?(0,f.jsx)(Qb,{values:e.type.enum}):Yb(e)?(0,f.jsx)(Qb,{values:Object.entries(e.type.arrayOf).map(([e,t])=>`${e}: ${t}`),mono:!0}):e.type===`boolean`?`on / off`:`â`}),(0,f.jsx)(`td`,{children:Zb(e)}),(0,f.jsxs)(`td`,{className:`spec__notes`,children:[e.description??``,e.required?(0,f.jsx)(`span`,{className:`spec__tag`,children:`required`}):null,e.bindings.figma.kind===`NONE`?(0,f.jsx)(`span`,{className:`spec__tag`,title:`Declared fidelity limit: this prop has no canvas manifestation â it exists in code only.`,children:`code-only`}):null]})]},e.name))})]})})]}),(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Variants`}),r.length===0?(0,f.jsx)(`p`,{className:`spec__none`,children:`No variant axes.`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`ul`,{className:`spec__list`,children:r.map(e=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`span`,{className:`spec__mono`,children:e.name}),` à `,e.type.enum.length,` `,(0,f.jsx)(Qb,{values:e.type.enum})]},e.name))}),(0,f.jsxs)(`p`,{className:`spec__line`,children:[i,` combination`,i===1?``:`s`,` (`,r.map(e=>e.name).join(` à `),`)`]}),e.figmaStatePreviews?(0,f.jsxs)(`p`,{className:`spec__line`,children:[`State previews (canvas): a State axis renders`,` `,[`Default`,...e.states.map(jl)].join(`, `),` as extra Figma variants â code keeps these as live CSS states.`]}):null]}),s.length>0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{className:`spec__line spec__line--label`,children:`Layout varies by variant:`}),(0,f.jsx)(`ul`,{className:`spec__list`,children:s.map(e=>(0,f.jsx)(`li`,{className:`spec__mono`,children:e},e))})]}):null]}),a.length>0?(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Slots`}),(0,f.jsx)(`ul`,{className:`spec__list`,children:a.map(({slot:e,part:t})=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`span`,{className:`spec__mono`,children:e.name}),` â accepts `,e.accepts&&e.accepts.length>0?(0,f.jsx)(Qb,{values:e.accepts.map(u)}):`anything (unconstrained)`,t.optional?(0,f.jsx)(`span`,{className:`spec__tag`,children:`optional`}):null,e.min!==void 0||e.max!==void 0?(0,f.jsxs)(`span`,{className:`spec__faint`,children:[` `,`(`,e.min===void 0?``:`min ${e.min}`,e.min!==void 0&&e.max!==void 0?`, `:``,e.max===void 0?``:`max ${e.max}`,`)`]}):null]},e.name))})]}):null,e.events&&e.events.length>0?(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Events`}),(0,f.jsx)(`ul`,{className:`spec__list`,children:e.events.map(e=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`span`,{className:`spec__mono`,children:e.bindings.code.prop}),(0,f.jsx)(`span`,{className:`spec__tag`,title:`Events are declared, not implemented on the canvas â the callback exists in generated code only.`,children:`code-only`}),e.description?(0,f.jsxs)(`span`,{className:`spec__notes`,children:[` `,e.description]}):null]},e.name))})]}):null,o.length>0?(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Tokens used`}),o.map(([e,t])=>(0,f.jsxs)(`div`,{className:`spec__token-group`,children:[(0,f.jsx)(`span`,{className:`spec__token-cat`,children:e}),(0,f.jsx)(Qb,{values:t,mono:!0})]},e))]}):null,(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`States`}),(0,f.jsx)(`p`,{className:`spec__line`,children:e.states.length>0?e.states.join(` · `):`none declared`})]}),(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Semantics`}),(0,f.jsx)(`p`,{className:`spec__line spec__mono`,children:l.summary}),l.exceptions.map(e=>(0,f.jsxs)(`p`,{className:`spec__line`,children:[`Declared exception â `,e]},e))]}),c?(0,f.jsxs)(`section`,{className:`spec__section`,children:[(0,f.jsx)(`h3`,{className:`spec__section-title`,children:`Accessibility`}),(0,f.jsx)(`p`,{className:`spec__line`,children:c})]}):null]})}var ix={react:`React`,html:`HTML + CSS`,"react-inline":`React inline`,"figma-script":`Figma script`},ax={react:`The component code the shipping generator produces â TSX, scoped CSS, and stories.`,html:`Plain HTML + CSS you can paste anywhere â no build step needed.`,"react-inline":`React with the token values written in as plain numbers and colors â for codebase
3374s without a token pipeline.`,"figma-script":`The script that builds or updates this component in Figma. Paste it back into the source file: it builds the contractâs version beside your original for A/B.`},ox={figma:`FIGMA`,code:`CODE`,prompt:`AI`,json:`JSON`},sx=[`figma`,`code`,`prompt`,`json`],cx=e=>{let t=e.receipts?.source??``;return/plugin/i.test(t)?`plugin`:/REST/i.test(t)?`REST`:/pasted/i.test(t)?`pasted`:/demo/i.test(t)?`demo`:null},lx=e=>new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),ux={figma:`From Figma`,code:`From code`,prompt:`Generated`,json:`Pasted JSON`},dx={figma:`Imported from design â the React / HTML tabs are its code side.`,code:`Imported from code â the Figma script tab is its design side.`,prompt:`Generated â both sides below.`,json:`Imported from JSON â both sides below.`},fx=`ds-playground.switch-strip-dismissed`,px=`ds-playground.preview-surface`,mx=[[`light`,`Light surface`],[`dark`,`Dark surface`],[`checker`,`Checker surface`]],hx={light:(0,f.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,f.jsx)(`circle`,{cx:`8`,cy:`8`,r:`3.2`,stroke:`currentColor`,strokeWidth:`1.3`}),(0,f.jsx)(`path`,{d:`M8 1.2v2M8 12.8v2M1.2 8h2M12.8 8h2M3.2 3.2l1.4 1.4M11.4 11.4l1.4 1.4M12.8 3.2l-1.4 1.4M4.6 11.4l-1.4 1.4`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`})]}),dark:(0,f.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M13.2 9.6A6 6 0 1 1 6.4 2.8a4.8 4.8 0 0 0 6.8 6.8Z`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinejoin:`round`})}),checker:(0,f.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M2 2h4v4H2zM10 2h4v4h-4zM6 6h4v4H6zM2 10h4v4H2zM10 10h4v4h-4z`,fill:`currentColor`})})},gx=`ds-playground.preview-view`,_x=[[`code`,`Code`,`The code side â the HTML emitter rendered live.`],[`canvas`,`Canvas`,`The design side â the figma engineâs compiled variant grid, Figma-canvas-styled.`],[`split`,`Split`,`Both sides of the same contract, side by side.`]],vx=e=>JSON.stringify(e,null,2),yx=e=>{let t=e?.id;return typeof t==`string`?t:``},bx=`ds-playground.onboarded`;function xx(e){let t=[];return e.degradations.length>0&&t.push({title:`Import report â degradations`,kind:`degradation`,entries:e.degradations.map(e=>({code:e.code,label:e.field?`${e.nodePath} · ${e.field}`:e.nodePath,message:e.message}))}),e.notes.length>0&&t.push({title:`Import report â notes`,kind:`note`,entries:e.notes.map(e=>({message:e}))}),t}function Sx(e){let t=[],n=e.notes.filter(e=>!e.startsWith(`MINTED `));n.length>0&&t.push({title:`Proposal notes â ${e.setName}`,kind:`note`,entries:n.map(e=>({message:e}))});let r=e.mintedTokens;return r&&r.count>0&&t.push({title:`Minted provisional tokens`,kind:`minted`,entries:r.entries.map(e=>({message:`${e.ref} = ${e.value} â machine-named from a resolved value â rename against your real tokens (provisional); bound at: ${e.usageSites.join(`, `)}`}))}),e.unbound.length>0&&t.push({title:`Unbound values â ${e.setName}`,kind:`unbound`,entries:e.unbound.map(e=>({label:`${e.nodePath} · ${e.property}`,message:String(e.value),suggestions:e.suggestions}))}),t}function Cx(e){let t=[];return e.skipped.length>0&&t.push({title:`Sets that could not be proposed`,kind:`skipped`,entries:e.skipped.map(e=>({message:e.reason,...e.detail?{detail:e.detail}:{}}))}),e.notes.length>0&&t.push({title:`Import notes â contract ids`,kind:`note`,entries:e.notes.map(e=>({message:e}))}),t}function wx({error:e}){return e?(0,f.jsxs)(`div`,{className:`notice notice--error`,children:[e.headline,e.detail?(0,f.jsxs)(`details`,{className:`notice__detail`,children:[(0,f.jsx)(`summary`,{children:`technical detail`}),(0,f.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,margin:`6px 0 0`},children:e.detail})]}):null]}):null}var Tx=e=>({headline:e});function Ex(){let{params:e}=g(),{theme:t,set:n}=x(),r=Dg(),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(``);(0,l.useEffect)(()=>{let e=window.setTimeout(()=>p(i),250);return()=>window.clearTimeout(e)},[i]);let m=(0,l.useMemo)(()=>dy(d),[d,r]),h=(0,l.useRef)(null);m.status===`valid`&&(h.current={contract:m.contract,contracts:m.contracts});let[_,v]=(0,l.useState)(`json`),y=(0,l.useRef)(null);(m.status===`valid`||m.status===`violations`)&&(y.current={contract:m.contract,contracts:m.contracts});let b=m.status===`valid`||m.status===`violations`,S=(0,l.useRef)(null),C=(0,l.useMemo)(()=>i===d?m.status===`json-error`?[L_(m.message)]:m.status===`schema-error`||m.status===`violations`?R_(d,m.details):null:null,[m,d,i]),w=(0,l.useMemo)(()=>{let e=new Set;for(let t of C??[])t!==null&&e.add(t);return e},[C]),T=e=>{_===`json`?S.current?.scrollToLine(e):(v(`json`),window.setTimeout(()=>S.current?.scrollToLine(e),0))},E=e=>(0,f.jsx)(`ul`,{className:`validation__list`,children:e.map((e,t)=>{let n=C?.[t]??null;return(0,f.jsx)(`li`,{children:n===null?e:(0,f.jsxs)(`button`,{type:`button`,className:`validation__jump`,onClick:()=>T(n),children:[e,(0,f.jsxs)(`span`,{className:`validation__jump-line`,children:[` â line `,n+1]})]})},t)})}),[te,ne]=(0,l.useState)(null),D=Cg(),[O,re]=(0,l.useState)(!1),[ie,ae]=(0,l.useState)(null),[oe,k]=(0,l.useState)(0),[A,se]=(0,l.useState)(null),[j,ce]=(0,l.useState)(null);(0,l.useEffect)(()=>{k(0),se(null),ae(null),ce(null)},[c]);let M=(e,t)=>{ne(n=>{if(!n)return{source:`assist Worker â fix-contract (ai-proposed)`,groups:[{title:e,kind:`note`,entries:t}]};let r=n.groups.findIndex(t=>t.title===e);if(r>=0){let e=n.groups.map((e,n)=>n===r?{...e,entries:[...e.entries,...t]}:e);return{...n,groups:e}}return{...n,groups:[...n.groups,{title:e,kind:`note`,entries:t}]}})},N=async()=>
3374{if(m.status!==`violations`||i!==d)return;let e=d;if(new TextEncoder().encode(e).length>65536){ae(`fix-contract-too-large: the candidate exceeds the Worker's ${W_/1024} KB contract limit â trim it or edit by hand.`);return}let t=m.issues.slice(0,50);re(!0),ae(null);try{let n=await K_({contract:JSON.parse(e),refusals:t,tokenPaths:[...r.inventory].sort().slice(0,G_)});if(!n.ok){ae(n.message),M(`AI fix â refused by the assist Worker`,[{message:n.status>0?`assist answered ${n.status}: ${n.message}`:n.message}]);return}let i=n.data.model??`unknown model`,c=n.data.usage??{},l=vx(n.data.contract),u=oe+1,d=dy(l),f=d.status===`violations`||d.status===`schema-error`?d.issues:d.status===`json-error`?[d.message]:[],p=t.filter(e=>!f.includes(e)),m=kv(JSON.parse(e),n.data.contract),h=n.data.removals??[],g=m.lost.filter(e=>!h.some(t=>e.includes(`"${t.path.split(`/`).pop()??t.path}"`)));ce({diff:m,declared:h,undeclared:g}),se({text:e,provenance:o}),k(u),a(l),s(`ai fix â ${i} (ai-proposed, round ${u} of 2)`),_e(null),M(`AI fix â ${i} (ai-proposed)`,[{message:`round ${u} of 2 â the returned contract loaded as a proposal and was immediately re-refereed`},{message:c.input_tokens!=null||c.output_tokens!=null?`tokens: ${c.input_tokens??`?`} in / ${c.output_tokens??`?`} out`:`tokens: not reported by the response`},{message:`diff vs the pre-fix contract: ${m.summary}`},...h.map(e=>({message:`the model DECLARED a removal: ${e.kind} ${e.path}${e.reason?` â ${e.reason}`:``}`})),...g.length>0?[{message:`UNDECLARED loss: ${g.join(`, `)} â removed by the round without a removals entry; review before trusting (Undo restores the pre-fix contract)`}]:[],...p.length>0?p.map(e=>({message:`addressed: ${e}`})):[{message:`addressed: none of the sent refusals cleared`}],{message:f.length>0?`still refused (${f.length}) â shown under the editor; nothing applied silently`:`clean â the re-referee found no remaining refusals`}])}finally{re(!1)}},P=()=>{A&&(a(A.text),s(A.provenance),se(null),ce(null))},le=(0,l.useRef)(null),ue=(0,l.useRef)(null),de=(0,l.useRef)(null),{cols:fe,gutterProps:pe}=Vb(le,ue,de),[me,he]=(0,l.useState)(`examples`),[ge,_e]=(0,l.useState)(null),[ve,ye]=(0,l.useState)(null),be=Kh(),[xe,Se]=(0,l.useState)(null),[Ce,we]=(0,l.useState)(()=>{try{return window.sessionStorage.getItem(fx)===`1`}catch{return!1}}),Te=()=>{we(!0);try{window.sessionStorage.setItem(fx,`1`)}catch{}},Ee=e=>{let t=e.receipts?.source??`${e.source} import`,n=`workspace â ${e.name} (${t}, imported ${lx(e.importedAt)})`;a(e.contractText),s(n),u({text:e.contractText,provenance:n}),wg(e.mintedTokens??null),xg(e.capturedTokens??null);let r=uy(e.childStubs??null),i={title:`Restored workspace entry`,kind:`note`,uncounted:!0,entries:[{message:`Imported ${lx(e.importedAt)} via ${t}. The groups marked "(as recorded at import)" are that import's record, verbatim â the engine may have moved since. The contract itself is re-refereed live in the editor, and child stubs were re-registered against the current engine just now.`}]},o=r.registered.length>0||r.refused.length>0?[{title:`Child stub contracts â re-refereed on restore`,kind:`note`,uncounted:!0,entries:[...r.registered.map(e=>({message:`${e.id} re-registered PROVISIONALLY against the current engine â composition refs keep resolving. Import the real child set to replace it.`})),...r.refused.map(e=>({message:e}))]}]:[];ne(e.receipts?{source:n,groups:[i,...o,...e.receipts.groups.map(e=>({...e,title:`${e.title} (as recorded at import)`}))]}:{source:n,groups:[i,...o]}),_e(null),ye(null),Se(e)},De=(e,t,n)=>{let r=yh.get(e);r&&(a(vx(r)),ne(null),wg(null),xg(null),uy(null),s(t),u({text:vx(r),provenance:t}),_e(n??e),ye(n&&Fh.get(n)?.expectedRefusal||null),Se(null))},[Oe,ke]=(0,l.useState)(`paste`),[Ae,je]=(0,l.useState)(``),[Me,Ne]=(0,l.useState)(``),[Pe,Fe]=(0,l.useState)(``),[Ie,Le]=(0,l.useState)(null),[Re,ze]=(0,l.useState)(null),[Be,Ve]=(0,l.useState)(null),[He,Ue]=(0,l.useState)([]),[We,Ge]=(0,l.useState)([]),[Ke,qe]=(0,l.useState)(null),Je=(e,t,n)=>{let r=[...n];e.proposals.forEach(({name:e,proposal:t},n)=>{let i=n===0,a=i?t.notes.filter(e=>!e.startsWith(`MINTED `)):t.notes;a.length>0&&r.push({title:`Proposal notes â ${e}`,kind:`note`,entries:a.map(e=>({message:e}))}),i&&t.mintedTokens&&t.mintedTokens.count>0&&r.push({title:`Minted provisional tokens`,kind:`minted`,entries:t.mintedTokens.entries.map(e=>({message:`${e.ref} = ${e.value} â machine-named from a resolved value â rename against your real tokens (provisional); bound at: ${e.usageSites.join(`, `)}`}))})}),e.skipped.length>0&&r.push({title:`Skipped components (visible but not readable)`,kind:`skipped`,entries:e.ski
3374pped.map(e=>({label:`${e.name} (${e.source})`,message:e.reason}))});let i={source:t,groups:r},o=e.proposals[0];if(o){let e=vx(o.proposal.contract),t=o.proposal.mintedTokens&&o.proposal.mintedTokens.count>0?o.proposal.mintedTokens:null;wg(t),xg(null),uy(null);let n=Jh({name:o.name,contractId:yx(o.proposal.contract),source:`code`,contractText:e,receipts:i,...t?{mintedTokens:t}:{}});ne(n.receipts),a(e),s(`proposed from code â ${o.name}`),u({text:e,provenance:`proposed from code â ${o.name}`}),Se(null)}else ne(i),e.skipped.length===0&&ze(`No component found in the source.`);return _e(null),e.skipped.map(e=>`component ${e.name} skipped: ${e.reason}`)},Ye=async(e,t,n,r={})=>{if(ze(null),Ve(null),Ue([]),Ge([]),!r.forceStub){let{detectStyling:r}=await k_(async()=>{let{detectStyling:e}=await import(`./styling-detect-sVv5ztJV.js`);return{detectStyling:e}},[]),i=r(e,t);if(i.needsComputedCapture){qe({kind:i.kind,lines:i.costLines,cta:i.cta,pending:{tsx:e,css:t,origin:n}}),Le(null);return}}qe(null),Le(`Loading the TypeScript compiler (lazy chunk, ~5 MB â first run only)â¦`);try{let{proposeFromCodeText:r}=await k_(async()=>{let{proposeFromCodeText:e}=await import(`./code-import-BZtLbbsz.js`);return{proposeFromCodeText:e}},__vite__mapDeps([2,1]));Le(`Proposingâ¦`),Je(r(e,t,`playground/Pasted.tsx`),n,[])}catch(e){ee(e)||ze(e instanceof Error?e.message:String(e))}finally{Le(null)}},Xe=(e,t)=>{he(`code`),ke(`paste`),Ne(e.tsx),Fe(e.css),_e(e.slug),ye(e.expectedRefusal??null),t&&Ye(e.tsx,e.css,`code proposal â ${e.sourcePath}`)},Ze=(e,t=[])=>[{title:`GitHub import â trace`,kind:`note`,entries:e.notes.map(e=>({message:e}))},...e.gaps.length>0?[{title:`Trace gaps (what import-following could not close)`,kind:`degradation`,entries:e.gaps.map(e=>({message:e}))}]:[],...t],Qe=async()=>{Le(`Tracing from GitHub (browser-direct, unauthenticated)â¦`),ze(null),Ve(null),Ue([]);try{let e=await yv(Ae);Ne(e.files[0].source),Fe(e.files[0].css??``),Le(`Searching the repo for token stylesheets (undeclared custom properties)â¦`);let t=await Sv(e),n=t.notes.length>0||t.gaps.length>0?[{title:`Token-stylesheet discovery (:root custom properties)`,kind:`note`,entries:[...t.notes.map(e=>({message:e})),...t.gaps.map(e=>({message:`gap: ${e}`}))]}]:[];Le(`Loading the TypeScript compiler (lazy chunk, ~5 MB â first run only)â¦`);let{proposeFromCodeFiles:r}=await k_(async()=>{let{proposeFromCodeFiles:e}=await import(`./code-import-BZtLbbsz.js`);return{proposeFromCodeFiles:e}},__vite__mapDeps([2,1]));Le(`Proposing over ${e.files.length} traced file${e.files.length===1?``:`s`}â¦`);let i=Je(r(e.files,t.extraCss),`code proposal â ${e.sourcePath} (+ ${e.files.length-1} traced files)`,Ze(e,n));Ve(e),Ge(t.extraCss),Ue([...e.gaps,...t.gaps,...i])}catch(e){ee(e)||ze(e instanceof Error?e.message:String(e))}finally{Le(null)}},$e=async()=>{let e=Be;if(e){ze(null);try{Le(`Listing the repo tree (git trees API)â¦`);let{listing:t,truncated:n}=await Cv(e.parsed,e.entryPath),r=`https://github.com/${e.parsed.owner}/${e.parsed.repo}`;Le(`Profiling the repo (assist â cached per repo@ref)â¦`);let i=[];try{i.push({path:`package.json`,content:await wv(e.parsed,`package.json`)})}catch{}i.push({path:e.entryPath,content:e.files[0].source.slice(0,4e4)});let a=await Y_({repoUrl:r,ref:e.parsed.ref,tree:t,samples:i});if(!a.ok){ze(a.message);return}Le(`Planning fetches (assist)â¦`);let o=await q_({entryUrl:Ae,listing:t,alreadyFetched:e.alreadyFetched,gaps:He,profile:a.data.profile});if(!o.ok){ze(o.message);return}let s=[{message:`assist plan: styleSystem = ${o.data.styleSystem}; repo profile ${a.data.cached?`cache hit`:`fresh`}${n?`; tree listing truncated at 2000 entries`:``}`},...o.data.notes.map(e=>({message:`assist note: ${e}`}))],c=e.files.map(e=>({...e})),l=[...e.alreadyFetched];Le(`Fetching the ${o.data.fetch.length} assist-proposed file${o.data.fetch.length===1?``:`s`}â¦`);for(let t of o.data.fetch){if(l.includes(t.path)){s.push({message:`ai-proposed fetch: ${t.path} â ${t.reason} (already fetched, skipped)`});continue}try{let n=await wv(e.parsed,t.path);if(l.push(t.path),s.push({message:`ai-proposed fetch: ${t.path} â ${t.reason}`}),/\.(css|scss)$/.test(t.path)){let e=c[0],r=`/* --- ${t.path} (ai-proposed fetch) --- */\n${n}`;e.css=e.css?`${e.css}\n\n${r}`:r}else/\.(tsx|ts|jsx|js)$/.test(t.path)?c.push({sourcePath:`${e.parsed.owner}/${e.parsed.repo}/${t.path}`,source:n}):s.push({message:`${t.path} fetched but not a TSX/CSS source â the proposer reads component code and stylesheets only; inspect it manually`})}catch(e){s.push({message:`ai-proposed fetch: ${t.path} â ${t.reason} â FAILED: ${e instanceof Error?e.message:String(e)}`})}}Le(`Re-proposing over ${c.length} filesâ¦`);let{proposeFromCodeFiles:u}=await k_(async()=>{let{proposeFromCodeFiles:e}=await import(`./code-import-BZtLbbsz.js`);return{proposeFromCodeFiles:e}}
3374,__vite__mapDeps([2,1])),d=Je(u(c,We),`code proposal â ${e.sourcePath} (+ ${c.length-1} files, assist-planned)`,Ze(e,[{title:`Assist fetch plan (ai-proposed)`,kind:`note`,entries:s}]));Ve({...e,files:c,alreadyFetched:l}),Ue([...e.gaps,...d]),Ne(c[0].source),Fe(c[0].css??``)}catch(e){ee(e)||ze(e instanceof Error?e.message:String(e))}finally{Le(null)}}},[et,tt]=(0,l.useState)(``),[nt,rt]=(0,l.useState)(()=>Cy(`ds-playground.remembered-figma-token`)??``),[it,at]=(0,l.useState)(()=>Cy(xy)!==null),ot=it&&nt.trim()!==``&&Cy(`ds-playground.remembered-figma-token`)===nt;(0,l.useEffect)(()=>{it?wy(xy,nt):Ty(xy)},[it,nt]);let st=()=>{Ty(xy),at(!1),rt(``)},[ct,lt]=(0,l.useState)(!1),[ut,dt]=(0,l.useState)(!1),[ft,pt]=(0,l.useState)(null),[mt,ht]=(0,l.useState)(null),gt=(0,l.useRef)([]),_t=(0,l.useRef)({origin:`Figma REST import`,ws:`figma`}),vt=(0,l.useRef)(null),F=e=>{if(!e||e.count===0)return[];let t=new Set(bg()),n=e.entries.filter(e=>!t.has(e.name));return[{title:`Captured tokens (from your Figma variables) â ${n.length} registered`,kind:`note`,entries:[{message:`The plugin captured each bound variable's RESOLVED value (dump v1.4), so the contract binds your real token names AND the referee + preview resolve them â nothing minted for these. Session-only, like the workspace.`},...n.map(e=>({message:`{${e.path}} = ${e.value} â from your Figma variable "${e.name}"`})),...[...t].map(e=>({message:`"${e}" shadows a token the active token source already defines â the existing value wins (repo/user tokens outrank captured ones); NOT registered, review`})),...e.skipped.map(e=>({message:`"${e.name}" NOT registered â ${e.reason}`}))]}]}
3374,yt=(e,t,n)=>{let r=vx(e.contract),i=`proposed from ${t} â ${e.setName}`,o=e.mintedTokens&&e.mintedTokens.count>0?e.mintedTokens:null;wg(o);let c=vt.current;xg(c);let l=F(c),d=uy(e.childStubs??null),f=d.registered.length>0||d.refused.length>0?[{title:`Child stub contracts (provisional)`,kind:`note`,entries:[...d.registered.map(e=>({message:`${e.id} registered PROVISIONALLY for this session â auto-proposed from the nested "${e.name}" instances (observed applied values only; anatomy not captured). Import the real child set to replace it.`})),...d.refused.map(e=>({message:e}))]}]:[],p=Jh({name:e.setName,contractId:yx(e.contract),source:n,contractText:r,receipts:{source:t,groups:[...gt.current,...l,...Sx(e),...f]},...o?{mintedTokens:o}:{},...c&&c.count>0?{capturedTokens:c}:{},...e.childStubs&&e.childStubs.length>0?{childStubs:e.childStubs}:{}});a(r),s(i),u({text:r,provenance:i}),ne(p.receipts),_e(null),ye(null),Se(null)},bt=(e,t)=>{let n=N_(e.dump),r=e.dump._provenance?.dumpVersion,i=[...r?[{title:`Import route`,kind:`note`,entries:[{message:`REST-mapped dump v${r} â a partial capture; the plugin dump (v1.13) is the full one. Every channel this route cannot read is named per set in the proposal notes ("this dump's reader could not see: â¦").`}]}]:[],...xx(e.report),...Cx(n)];if(n.proposals.length===0){pt(n.skipped.length>0?Tx(`None of the ${n.skipped.length} component set(s) could be proposed â each skip is named in the receipts below.`):Tx(`The import returned no component set to propose from.`)),i.length>0&&ne({source:t,groups:i});return}gt.current=i,_t.current={origin:t,ws:`figma`},vt.current=cu(e.dump),ht(n.proposals),yt(n.proposals[0],t,`figma`)},[xt,St]=(0,l.useState)(null),[Ct,wt]=(0,l.useState)(0),[Tt,Et]=(0,l.useState)(!1),[Dt,Ot]=(0,l.useState)(null),[kt,I]=(0,l.useState)(null),At=(0,l.useRef)(null),jt=(0,l.useRef)(!1),Mt=()=>{At.current!==null&&(window.clearInterval(At.current),At.current=null),jt.current=!1,St(null),I(null)};(0,l.useEffect)(()=>()=>{At.current!==null&&window.clearInterval(At.current)},[]);let Nt=(e,t)=>{try{let n=[{title:`Plugin bridge`,kind:`note`,entries:[{message:`received over pairing code ${t} â the plugin ran the repo's dump script in the open Figma file, so bound variable NAMES arrive resolved on any plan; the bridge deleted its copy on delivery.`}]}],r=e?._degradations;Array.isArray(r)&&r.length>0&&n.push({title:`Capture receipts â dump script degradations`,kind:`degradation`,entries:r.map(e=>{let t=e;return{...typeof t.code==`string`?{code:t.code}:{},...typeof t.nodePath==`string`?{label:t.nodePath}:{},message:typeof t.message==`string`?t.message:String(e)}})});let i=N_(e);return n.push(...Cx(i)),i.proposals.length===0?(Ot(i.skipped.length>0?Tx(`None of the ${i.skipped.length} component set(s) the plugin sent could be proposed â each skip is named in the receipts below.`):Tx(`The plugin sent a dump with no component set to propose from.`)),n.length>0&&ne({source:`Figma plugin import`,groups:n}),[]):(gt.current=n,_t.current={origin:`Figma plugin import`,ws:`figma`},vt.current=cu(e),ht(i.proposals),yt(i.proposals[0],`Figma plugin import`,`figma`),i.proposals.map(e=>e.contract.name??`a component set`))}catch(e){return Ot(z_(e)),null}},Pt=async(e,t,n)=>{let r=Math.max(0,Math.round((n-Date.now())/1e3));if(wt(r),r<=0){Mt(),Ot(Tx(`The code expired before anything arrived â press âReceive from pluginâ for a fresh one.`));return}if(!jt.current){jt.current=!0;try{let n=await iv(e,t);if(n.status===`delivered`){Mt();let t=Nt(n.dump,e);await Ft(t??[])}else n.status===`error`&&n.fatal&&(Mt(),Ot(Tx(n.message)))}finally{jt.current=!1}}},Ft=async e=>{e===void 0&&Ot(null),Et(!0);let t=await rv();if(Et(!1),!t.ok){Ot(Tx(t.message));return}let n=Date.now()+t.session.ttlSeconds*1e3;St({code:t.session.code,readCapability:t.session.readCapability,expiresAt:n}),I(e===void 0?null:`Delivered ${e.length>0?e.join(`, `):`the pluginâs dump`} â ready for your next send with code ${t.session.code}.`),wt(t.session.ttlSeconds),At.current=window.setInterval(()=>void Pt(t.session.code,t.session.readCapability,n),Z_)},It=async()=>{dt(!0),pt(null);try{let e=await j_(et.trim(),nt.trim());ky(nt.trim()),bt(e,`Figma REST import`)}catch(e){pt(z_(e))}finally{dt(!1)}},Lt=async e=>{dt(!0),pt(null);try{let t=await M_({degraded:e});
3374ky(Dy),bt(t,e?`Figma REST import (demo fixture, variables 403)`:`Figma REST import (demo fixture)`)}catch(e){pt(z_(e))}finally{dt(!1)}},[Rt,zt]=(0,l.useState)(``),[Bt,Vt]=(0,l.useState)(null),L=()=>{Vt(null),ye(null);let e;try{e=JSON.parse(Rt)}catch(e){Vt(z_(e));return}if(typeof e==`object`&&e&&Object.entries(e).some(([e,t])=>e!==`_provenance`&&typeof t==`object`&&!!t&&`variants`in t)){try{let t=N_(e),n=Cx(t);if(t.proposals.length===0){Vt(t.skipped.length>0?Tx(`None of the ${t.skipped.length} component set(s) in the pasted dump could be proposed â each skip is named in the receipts below.`):Tx(`No component set found in the pasted dump.`)),n.length>0&&ne({source:`pasted Figma dump`,groups:n});return}gt.current=n,_t.current={origin:`pasted Figma dump`,ws:`json`},vt.current=cu(e),ht(t.proposals),yt(t.proposals[0],`pasted Figma dump`,`json`)}catch(e){Vt(z_(e))}return}let t=vx(e),n=e,r=Jh({name:typeof n.name==`string`?n.name:typeof n.id==`string`?n.id:`Pasted contract`,contractId:yx(e),source:`json`,contractText:t,receipts:null});a(t),ne(r.receipts),wg(null),xg(null),uy(null),s(`pasted contract JSON`),u({text:t,provenance:`pasted contract JSON`}),_e(null),Se(null)},[Ht,Ut]=(0,l.useState)(``),[Wt,Gt]=(0,l.useState)(()=>Cy(`ds-playground.remembered-anthropic-key`)??``),[Kt,qt]=(0,l.useState)(()=>Cy(Sy)!==null),Jt=Kt&&Wt.trim()!==``&&Cy(`ds-playground.remembered-anthropic-key`)===Wt;(0,l.useEffect)(()=>{Kt?wy(Sy,Wt):Ty(Sy)},[Kt,Wt]);let Yt=()=>{Ty(Sy),qt(!1),Gt(``)},[Xt,Zt]=(0,l.useState)(jv),[Qt,$t]=(0,l.useState)(null),[en,tn]=(0,l.useState)(null),[nn,rn]=(0,l.useState)(null),[an,on]=(0,l.useState)(0),sn=(0,l.useRef)(null),cn=(0,l.useRef)(null),ln=(e,t)=>{sn.current=e.session,on(e.session.rounds);let n=vx(e.contract);a(n),wg(null),xg(null),uy(null),s(t),u({text:n,provenance:t}),_e(null),ye(null);let r=dy(n),i=r.status===`schema-error`||r.status===`violations`?r.issues:r.status===`json-error`?[r.message]:null;rn(i);let{usage:o,rounds:c}=e.session,l={source:t,groups:[{title:`Prompt generation`,kind:`note`,entries:[{message:`model: ${cn.current?`demo fixture`:Xt}`},{message:o.inputTokens!==null||o.outputTokens!==null?`tokens: ${o.inputTokens??`?`} in / ${o.outputTokens??`?`} out (cumulative)`:`tokens: not reported by the response`},{message:`fix rounds used: ${c} of 2`},...i?[{message:`the proposal is REFUSED by name (${i.length} violation${i.length===1?``:`s`}, shown under the editor) â nothing is auto-retried; the fix round is yours to trigger`}]:[]]}]},d=e.contract,f=Jh({name:typeof d?.name==`string`?d.name:`Generated component`,contractId:yx(e.contract),source:`prompt`,contractText:n,receipts:l});ne(f.receipts),Se(null)},un=async e=>{let t=Ht.trim();tn(null),rn(null),$t(e?`Generating over the recorded fixture (identical code path, fixture transport)â¦`:`Asking ${Xt} (browser-direct)â¦`);try{let n;if(e){let{createDemoTransport:e,DEMO_PROMPT:r}=await k_(async()=>{let{createDemoTransport:e,DEMO_PROMPT:t}=await import(`./prompt-demo-Dsfg8b41.js`);return{createDemoTransport:e,DEMO_PROMPT:t}},[]);cn.current=e(),n=cn.current,t||(t=r,Ut(r))}else cn.current=null;let r=await Wv(t,e?`demo-fixture-key`:Wt.trim(),{fetchImpl:n,model:Xt});ln(r,e?`prompt generation (demo fixture)`:`prompt generation â ${Xt}`)}catch(e){ee(e)||tn(e instanceof Error?e.message:String(e))}finally{$t(null)}},dn=async()=>{let e=sn.current;if(!(!e||!nn)){tn(null),$t(`Sending the named refusals back (round ${e.rounds+1} of 2)â¦`);try{let t=cn.current!==null,n=await Gv(e,nn,t?`demo-fixture-key`:Wt.trim(),{fetchImpl:cn.current??void 0,model:Xt});ln(n,t?`prompt generation (demo fixture) â fix round ${n.session.rounds}`:`prompt generation â ${Xt}, fix round ${n.session.rounds}`)}catch(e){tn(e instanceof Error?e.message:String(e))}finally{$t(null)}}},[fn,pn]=(0,l.useState)(()=>Ag()),[mn,hn]=(0,l.useState)(null),[gn,_n]=(0,l.useState)(null),[vn,yn]=(0,l.useState)(null),bn=(e=fn)=>{let t=Og(e);yn(null),t.ok?(hn(null),_n(`Applied â ${t.source.inventory.size} token paths from ${t.source.docCount} document${t.source.docCount===1?``:`s`}. Everything now binds against your tree.`)):(_n(null),hn(t.errors),t.plainWrap&&yn(t.plainWrap))},xn=()=>{vn&&(pn(vn.text),bn(vn.text))},Sn=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=e.toString();if(Sn.current===t)return;Sn.current=t;
3374let n=e.get(`example`),r=e.get(`source`);if(n){let e=Fh.get(n);e?.kind===`contract`?De(e.contractId,`loaded from examples â ${e.contractId}`,e.slug):e?.kind===`code`&&Xe(e,!0);return}(r===`figma`||r===`code`||r===`json`)&&he(r),!i&&!$v()&&De(`ds.badge`,`loaded from examples â ds.badge`,`badge`)},[e]);let[Cn,wn]=(0,l.useState)(`preview`),[Tn,En]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=$v();if(!e)return;let t=!1;return(async()=>{try{let r=await Qv(e);if(t)return;a(r.contract),wg(null),xg(null),uy(null),s(`loaded from share link`),u({text:r.contract,provenance:`loaded from share link`}),_e(null),ye(null),wn(r.output===`preview`||sf.some(e=>e.name===r.output)?r.output:`preview`),n(r.theme)}catch(e){t||En(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[]);let[Dn,On]=(0,l.useState)(()=>{try{return window.localStorage.getItem(bx)===`1`}catch{return!0}}),[kn,An]=(0,l.useState)([!1,!1,!1,!1]),jn=e=>An(t=>t.map((t,n)=>n===e?!0:t)),Mn=()=>{On(!0);try{window.localStorage.setItem(bx,`1`)}catch{}},Nn=[{label:`Pick an example`,run:()=>{he(`examples`),wn(`preview`),De(`ds.badge`,`loaded from examples â ds.badge`,`badge`)}},{label:`Break the contract â watch a named refusal`,run:()=>{let e=yh.get(`ds.badge`);e&&(a(vx(e).replace(`{radius.badge}`,`{radius.bogus}`)),s(`onboarding â one token ref broken on purpose`),_e(null))}},{label:`Check the React output`,run:()=>wn(`react`)},{label:`Reset the example`,run:()=>{wn(`preview`),De(`ds.badge`,`loaded from examples â ds.badge`,`badge`)}}],Pn=async()=>{try{let e=await Zv({contract:i,output:Cn,theme:t});if(e.length>8192){En(`share-link-too-long: ${(e.length/1024).toFixed(1)} KB exceeds the ${Kv/1024} KB URL guard â share the contract JSON itself instead.`);return}let n=`${window.location.origin}/playground#s=${e}`;window.history.replaceState(null,``,`/playground#s=${e}`),await navigator.clipboard.writeText(n),En(`copied â ${(e.length/1024).toFixed(1)} KB link`),window.setTimeout(()=>En(null),4e3)}catch(e){En(`share-link-failed: ${e instanceof Error?e.message:String(e)}`)}},[Fn,In]=(0,l.useState)(!1),[Ln,Rn]=(0,l.useState)(!1),[zn,Bn]=(0,l.useState)(null),Vn=m.status===`valid`||m.status===`violations`?m:null,Hn=(0,l.useMemo)(()=>{if(Cn===`preview`||!Vn)return null;let e=sf.find(e=>e.name===Cn);if(!e)return null;try{let n=iy(Vn.contract,Vn.contracts,eg().layersByContractId,r.inventory);return{files:e.emit(Vn.contract,{tokens:ay(r.tree,n),icons:Sh,contracts:Vn.contracts,mode:t,mintedTokens:n.mintedTrees.length>0?ry([...n.mintedTrees,D?.tree??{}]):D?.tree}),error:null}}catch(e){return{files:null,error:e instanceof Error?e.message:String(e)}}},[Cn,Vn,t,r,D]);(0,l.useEffect)(()=>{if(Bn(null),!Fn||!Hn?.files)return;let e=!1;return Rn(!0),(async()=>{let{formatTsx:t,formatCss:n}=await k_(async()=>{let{formatTsx:e,formatCss:t}=await import(`./format-lazy-CtLJTtqw.js`);return{formatTsx:e,formatCss:t}},__vite__mapDeps([3,1])),r=await Promise.all(Hn.files.map(async e=>{try{if(/\.(tsx|ts|jsx|js)$/.test(e.path))return{...e,contents:await t(e.contents)};if(e.path.endsWith(`.css`))return{...e,contents:await n(e.contents)}}catch{}return e}));e||Bn(r)})().catch(e=>{ee(e)}).finally(()=>{e||Rn(!1)}),()=>{e=!0}},[Fn,Hn]);let Un=m.status===`valid`?m:null,Wn=m.status===`valid`||m.status===`violations`?m.contract.id:m.status===`empty`?null:d.match(/"id"\s*:\s*"([^"]+)"/)?.[1]??null,Gn=Wn!==null&&Wn===(h.current?.contract.id??null),Kn=!Un&&Gn?h.current:null,qn=!Un&&Kn,Jn=!Un&&!Kn&&m.status!==`empty`,Yn=o.startsWith(`prompt generation (demo fixture)`)&&nn&&nn.length>0?` (deliberate demo refusal â trigger the fix round)`:``,[Xn,Zn]=(0,l.useState)(`single`),[Qn,$n]=(0,l.useState)(()=>{try{let e=window.localStorage.getItem(px);return e===`dark`||e===`checker`?e:`light`}catch{return`light`}}),er=e=>{$n(e);try{window.localStorage.setItem(px,e)}catch{}},[tr,nr]=(0,l.useState)(()=>{try{let e=window.localStorage.getItem(gx);return e===`canvas`||e===`split`?e:`code`}catch{return`code`}}),rr=e=>{nr(e);try{window.localStorage.setItem(gx,e)}catch{}},[ir,ar]=(0,l.useState)(!1),[or,sr]=(0,l.useState)({}),[cr,lr]=(0,l.useState)(null),ur=(0,l.useRef)(null),dr=(0,l.useRef)(null),fr=Un??Kn;(0,l.useEffect)(()=>{sr({}),lr(null),ur.current=null,dr.current=null},[fr?.contract.id??null]);let pr=(0,l.useMemo)(()=>fr?Ub(fr.contract,or):{},[fr?.contract,or]),mr=(0,l.useMemo)(()=>!fr||Cn!==`preview`||tr===`canvas`||Xn!==`single`?null:Vg(fr.contract,fr.contracts,Qn,pr),[fr?.contract,fr?.contracts,Qn,pr,r,Cn,Xn,tr]);(0,l.useEffect)(()=>
3374{if(!mr?.ok)return;let e=JSON.stringify(pr),t=dr.current;if(dr.current={stateKey:e,sig:mr.instanceHtml,doc:mr.doc},!t||t.stateKey===e||!ur.current)return;let n=ur.current;if(t.sig!==null&&mr.instanceHtml!==null&&t.sig===mr.instanceHtml){lr(n);return}let r=!1;return Promise.all([yy(t.doc),yy(mr.doc)]).then(([e,t])=>{r||lr(e!==null&&e===t?n:null)}),()=>{r=!0}},[mr,pr]);let hr=(e,t)=>{ur.current=e,sr(n=>({...n,[e]:t}))},gr=e=>(0,f.jsxs)(`div`,{className:`ws__row`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`rail__item ws__load${xe?.id===e.id?` is-active`:``}`,onClick:()=>Ee(e),title:`${e.contractId?`${e.contractId} â `:``}${e.receipts?.source??`${e.source} import`}, imported ${lx(e.importedAt)}`,children:[(0,f.jsxs)(`span`,{className:`ws__tag`,"aria-hidden":!0,children:[ox[e.source],cx(e)?` · ${cx(e)}`:``]}),(0,f.jsx)(`span`,{className:`ws__name`,children:e.name}),(0,f.jsx)(`span`,{className:`ws__time`,children:lx(e.importedAt)})]}),(0,f.jsx)(`button`,{type:`button`,className:`ws__remove`,"aria-label":`Remove ${e.name} from the workspace`,onClick:()=>Yh(e.id),children:`Ã`})]},e.id),_r=e=>{let t=be.filter(t=>t.source===e);return t.length===0?null:(0,f.jsxs)(`div`,{className:`rail__group ws__mini`,children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:`Imported this session`}),t.map(gr)]})};return(0,f.jsxs)(f.Fragment,{children:[!Dn&&(0,f.jsxs)(`div`,{className:`onboard`,role:`note`,"aria-label":`Getting started`,children:[(0,f.jsxs)(`span`,{className:`onboard__title`,children:[`New here? Walk the whole loop â `,Nn.length,` clicks, in order:`]}),Nn.map((e,t)=>(0,f.jsxs)(`button`,{type:`button`,className:`onboard__step${kn[t]?` is-done`:``}`,onClick:()=>{e.run(),jn(t)},children:[(0,f.jsx)(`span`,{className:`onboard__num`,"aria-hidden":!0,children:kn[t]?`â`:t+1}),e.label]},e.label)),(0,f.jsx)(`button`,{type:`button`,className:`btn--ghost onboard__dismiss`,onClick:Mn,children:`Dismiss`})]}),(0,f.jsxs)(`div`,{className:`pg`,ref:le,style:fe?{"--pg-cols":fe}:void 0,children:[(0,f.jsxs)(`aside`,{className:`pg__rail`,ref:ue,children:[(0,f.jsx)(`div`,{className:`tabs`,role:`tablist`,"aria-label":`Input source`,children:[...be.length>0||me===`workspace`?[[`workspace`,`Workspace`]]:[],[`examples`,`Examples`],[`describe`,`Describe`],[`figma`,`Figma`],[`code`,`Code`],[`json`,`JSON`],[`tokens`,`Tokens`]].map(([e,t])=>(0,f.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":me===e,className:`tabs__tab${me===e?` is-active`:``}`,onClick:()=>he(e),children:[t,e===`tokens`&&r.kind===`user`?(0,f.jsx)(`span`,{className:`tabs__dot`,"aria-label":`user tokens active`}):null]},e))}),me===`workspace`&&(0,f.jsx)(`div`,{className:`rail__section`,children:be.length===0?(0,f.jsx)(`p`,{className:`hint`,children:`Nothing imported yet â Figma, Code, and Describe imports collect here for the session.`}):(0,f.jsxs)(f.Fragment,{children:[sx.filter(e=>be.some(t=>t.source===e)).map(e=>(0,f.jsxs)(`div`,{className:`rail__group`,children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:ux[e]}),be.filter(t=>t.source===e).map(gr)]},e)),(0,f.jsxs)(`p`,{className:`hint`,children:[`Session-only (this tabâs sessionStorage, gone on close). Click an entry to restore its contract and receipts; the newest `,30,` are kept.`]}),(0,f.jsx)(`button`,{type:`button`,style:{marginTop:8},onClick:Xh,children:`Clear all`})]})}),me===`examples`&&(0,f.jsxs)(`div`,{className:`rail__section`,children:[[`Atom`,`Molecule`,`Composition`,`Foreign code`].map(e=>(0,f.jsxs)(`div`,{className:`rail__group`,children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:e}),Ph.filter(t=>t.category===e).map(e=>(0,f.jsx)(`button`,{type:`button`,className:`rail__item${ge===e.slug?` is-active`:``}`,onClick:()=>e.kind===`contract`?De(e.contractId,`loaded from examples â ${e.contractId}`,e.slug):Xe(e,!0),children:e.name},e.slug))]},e)),(0,f.jsxs)(`div`,{className:`rail__group`,children:[(0,f.jsxs)(`div`,{className:`rail__group-title`,children:[`All `,vh.size,` contracts`]}),(0,f.jsxs)(`select`,{"aria-label":`Load any contract`,value:ge&&vh.has(ge)?ge:``,onChange:e=>{e.target.value&&De(e.target.value,`loaded from contracts/ â ${e.target.value}`)},children:[(0,f.jsx)(`option`,{value:``,children:`Pick a contractâ¦`}),[...vh.keys()].sort().map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))]})]})]}),me===`describe`&&(0,f.jsxs)(`div`,{className:`rail__section rail__form`,children:[(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`desc-prompt`,children:`Describe a component`}),(0,f.jsx)(`textarea`,{id:`desc-prompt`,rows:5,value:Ht,onChange:e=>Ut(e.target.value),placeholder:`A small pill-shaped tag that labels content with a feedback tone: info, success, warning, or danger.`})]}),(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`desc-key`,children:`Anthropic API key`}),(0,f.jsx)(`input`,{id:`desc-key`,type:`password`,value:Wt,onCh
3374ange:e=>Gt(e.target.value),autoComplete:`off`,placeholder:`sk-ant-â¦`}),Jt?(0,f.jsxs)(`p`,{className:`hint`,children:[`using remembered key â`,` `,(0,f.jsx)(`button`,{type:`button`,className:`btn--link`,onClick:Yt,children:`Clear`})]}):null,(0,f.jsxs)(`div`,{className:`checkline`,children:[(0,f.jsx)(`input`,{id:`desc-remember`,type:`checkbox`,checked:Kt,onChange:e=>qt(e.target.checked)}),(0,f.jsx)(`label`,{htmlFor:`desc-remember`,style:{margin:0},children:`Remember on this device (localStorage, until you clear it)`})]}),(0,f.jsx)(`p`,{className:`hint`,children:`Session-only by default, like the Figma token â sent browser-direct to api.anthropic.com and nowhere else, gone on reload. Opting into âRemember on this deviceâ keeps it in this browserâs localStorage only.`})]}),(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`desc-model`,children:`Model`}),(0,f.jsx)(`select`,{id:`desc-model`,value:Xt,onChange:e=>Zt(e.target.value),children:Av.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:!!Qt||!Ht.trim()||!Wt.trim(),onClick:()=>void un(!1),children:Qt?`Workingâ¦`:`Generate contract`}),(0,f.jsxs)(`p`,{className:`hint`,children:[`Model: `,jv,`. A forced tool call constrains the output to the contract shape â never freeform code â and the same governed editor referees it, refusals by name.`]}),(0,f.jsxs)(`details`,{className:`rail__details`,children:[(0,f.jsx)(`summary`,{children:`No key handy? Demo generate instead`}),(0,f.jsx)(`p`,{className:`hint`,children:`The identical code path over a recorded-shape response â fixture transport, same governance. Round 1 deliberately references a token that does not exist, so the named refusal and the fix round both demo.`}),(0,f.jsx)(`button`,{type:`button`,disabled:!!Qt,onClick:()=>void un(!0),children:Qt?`Workingâ¦`:`Demo generate (recorded fixture)`})]}),Qt?(0,f.jsx)(`p`,{className:`hint`,children:Qt}):null,en?(0,f.jsx)(`div`,{className:`notice notice--error`,children:en}):null,nn&&sn.current?(0,f.jsxs)(`div`,{className:`notice`,children:[`The proposal was refused by name (`,nn.length,` violation`,nn.length===1?``:`s`,` under the editor). Nothing retries silently â send the refusal text back yourself:`,(0,f.jsx)(`div`,{style:{marginTop:8},children:an<2?(0,f.jsxs)(`button`,{type:`button`,disabled:!!Qt,onClick:()=>void dn(),children:[`Ask the model to fix (round `,an+1,` of `,2,`)`]}):(0,f.jsxs)(`span`,{className:`hint`,children:[`Fix round limit reached (`,2,`) â edit the contract by hand; the editor referees every keystroke.`]})})]}):null]}),me===`figma`&&(0,f.jsxs)(`div`,{className:`rail__section`,children:[(0,f.jsxs)(`div`,{className:`rail__group`,children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:`Bring a component in from Figma`}),(0,f.jsxs)(`p`,{className:`hint`,children:[`Two ways in, and a third that is currently switched off. `,(0,f.jsx)(`strong`,{children:`Start with the URL route below`}),` â paste a component URL and a token and you get a proposed contract. Know the ladder: this route is a `,(0,f.jsx)(`em`,{children:`partial`}),` capture (REST, dump v1.5) â the plugin dump (v1.13, via the `,(0,f.jsx)(`strong`,{children:`JSON`}),` tab) is the full one. What the REST reader cannot see (image fills, flex wrap, strokeAlign, instance text overrides, multi-mode variable values, fixed sizes, absolute placement, constraints) is NAMED in the proposal notes rather than guessed; token `,(0,f.jsx)(`em`,{children:`names`}),` additionally degrade outside Enterprise plans, each one receipted. For full capture on any plan, paste a`,` `,(0,f.jsx)(`code`,{children:`extract/figma/dump.plugin.js`}),` dump into the `,(0,f.jsx)(`strong`,{children:`JSON`}),` `,`tab instead.`]})]}),(0,f.jsxs)(`div`,{className:`rail__group`,style:{marginTop:16},children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:`From a figma.com URL + token â quick`}),(0,f.jsxs)(`p`,{className:`hint`,children:[`No install, partial capture. The style facts this route CAN read come through exactly; the channels it cannot read at all (the proposal notes name them: âthis dumpâs reader could not see: â¦â) are absent as a read limit of the route, not evidence about the design. Variable (token)`,` `,(0,f.jsx)(`em`,{children:`names`}),` additionally degrade outside Enterprise plans â receipted, never invented. For the full capture (dump v1.13) and true-to-form token names, use the JSON dump route named above.`]})]}),(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`figma-url`,children:`figma.com component URL`}),(0,f.jsx)(`input`,{id:`figma-url`,type:`text`,value:et,onChange:e=>tt(e.target.value),placeholder:`https://www.figma.com/design/â¦?node-id=1-23`,spellCheck:!1})]}),(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`figma-token`,children:`Personal access token`}),(0,f.jsx)(`input`,{id:`figma-token`,type:`password`,value:nt,onChange:e=>rt(e.target.value),autoComplete:`off`,placeholder:`figd_â¦`}),ot?(0,f.jsxs)(`p`,{className:`hint`,children:[`using remembered token â`,` `,(0,f.jsx)(`button`,{type:`button`,className:`btn--link`,onClick:st,children:`Clear`})]}):null,(0,f.jsxs)(`div`,{className:`checkline`,children:[(0,f.jsx)(`input`,{id:`figma-remember`,type:`checkbox`,checked:it,onChange:e=>at(e.target.checked)}),(0,f.jsx)(`label`,{htmlFor:`figma-remember`,style:{margin:0},children:`Remember on this device (localStorage, until you clear it)`})]}),(0,f.jsx)(`p`,{className:`hint`,children:`Session-only by default â sent to api.figma.com and n
3374owhere else, gone on reload. Opting into âRemember on this deviceâ keeps it in this browserâs localStorage only, never anywhere else.`})]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:ut||!et.trim()||!nt.trim(),onClick:()=>void It(),children:ut?`Importingâ¦`:`Import`}),(0,f.jsx)(`p`,{className:`hint`,style:{marginTop:16},children:`No token handy? Run the same import over the repoâs committed REST fixture â identical code path, fixture transport.`}),(0,f.jsxs)(`div`,{className:`checkline`,children:[(0,f.jsx)(`input`,{id:`figma-degraded`,type:`checkbox`,checked:ct,onChange:e=>lt(e.target.checked)}),(0,f.jsx)(`label`,{htmlFor:`figma-degraded`,style:{margin:0},children:`Simulate a non-Enterprise plan (variables endpoint 403s)`})]}),(0,f.jsx)(`button`,{type:`button`,disabled:ut,onClick:()=>void Lt(ct),children:ut?`Importingâ¦`:`Demo import (Badge fixture)`}),(0,f.jsxs)(`p`,{className:`hint`,children:[`Fixture URL: `,`figma.com/design/8nim1d0IPnehMxA7B7SYxC/DS-Contracts-POC?node-id=101-1`]}),(0,f.jsx)(wx,{error:ft}),mt&&mt.length>1?(0,f.jsxs)(`div`,{className:`rail__group`,style:{marginTop:12},children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:`Proposed sets`}),mt.map(e=>(0,f.jsx)(`button`,{type:`button`,className:`rail__item`,onClick:()=>yt(e,_t.current.origin,_t.current.ws),children:e.setName},e.setName))]}):null,_r(`figma`),(0,f.jsxs)(`div`,{className:`rail__group`,style:{marginTop:24},children:[(0,f.jsx)(`div`,{className:`rail__group-title`,children:`From the Figma plugin â currently unavailable`}),(0,f.jsxs)(`p`,{className:`hint`,children:[`This route used to deliver full token names `,(0,f.jsx)(`em`,{children:`and`}),` values on any Figma plan, by reading your component sets straight out of the open file. The pluginâs `,(0,f.jsx)(`strong`,{children:`Send to Playground`}),` tab was removed on 2026-07-26 when its seven tabs were re-housed into Build / Changes / Send, so nothing can answer a pairing code today. Named, not hidden: the button below stays disabled until the plugin ships a sender again. Use the URL route above, or paste a dump into the `,(0,f.jsx)(`strong`,{children:`JSON`}),` tab.`]}),xt===null?(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:!0,title:`The plugin's Send to Playground tab was removed on 2026-07-26; no sender exists to answer a pairing code.`,onClick:()=>void Ft(),children:`Receive from plugin â unavailable`}):(0,f.jsxs)(`div`,{className:`notice`,"aria-live":`polite`,children:[kt?(0,f.jsx)(`div`,{style:{fontWeight:600,marginBottom:6},children:kt}):null,(0,f.jsx)(`div`,{style:{fontFamily:`var(--pg-mono)`,fontSize:22,letterSpacing:6,fontWeight:600,margin:`4px 0 8px`},children:xt.code}),`Waiting for the plugin⦠In Figma desktop, run`,` `,(0,f.jsx)(`strong`,{children:`Plugins â Development â DS Contracts Sync Runner`}),` and enter this code in whichever panel offers to send to the playground. It expires in`,` `,Math.floor(Ct/60),`:`,String(Ct%60).padStart(2,`0`),`.`,(0,f.jsx)(`div`,{style:{marginTop:8},children:(0,f.jsx)(`button`,{type:`button`,onClick:Mt,children:`Cancel`})})]}),(0,f.jsx)(wx,{error:Dt}),(0,f.jsxs)(`details`,{className:`rail__details`,children:[(0,f.jsx)(`summary`,{children:`Install the plugin anyway (about a minute)`}),(0,f.jsxs)(`p`,{className:`hint`,style:{margin:`6px 0`},children:[`The plugin is the other half of the loop â it just doesnât send`,(0,f.jsx)(`em`,{children:` here`}),` any more. It is what actually builds your components onto a canvas: paste a contracts bundle and it builds the sets (Build), it watches your teamâs CI channel and your canvas for drift (Changes), and it opens a canvas edit as a pull request (Send). This zip is rebuilt from the repo every time the playground is built, so it is never older than the engine it ships.`]}),(0,f.jsxs)(`ol`,{className:`hint`,style:{paddingLeft:18,margin:`6px 0`},children:[(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`a`,{href:`/ds-contracts-sync-runner-plugin.zip`,download:!0,children:`Download the plugin zip`}),` `,`and unzip it.`]}),(0,f.jsxs)(`li`,{children:[`Open your file in the `,(0,f.jsx)(`strong`,{children:`Figma desktop app`}),` â development plugins only load there, not on figma.com. Any plan works; no admin approval needed.`]}),(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`strong`,{children:`Plugins â Development â Import plugin from manifestâ¦`}),` and pick `,(0,f.jsx)(`code`,{children:`manifest.json`}),` from the unzipped folder.`]}),(0,f.jsxs)(`li`,{children:[`Run `,(0,f.jsx)(`strong`,{children:`DS Contracts Sync Runner`}),`. It opens on`,` `,(0,f.jsx)(`strong`,{children:`Build`}),` (or `,(0,f.jsx)(`strong`,{children:`Changes`}),` if the file already has contract-backed sets).`]})]}),(0,f.jsx)(`p`,{className:`hint`,children:`The plugin never writes to your repo, and an Apply never overwrites a canvas edit silently â edits are detected as drift and the affected rows start unchecked.`})]})]})]}),me===`code`&&(0,f.jsxs)(`div`,{className:`rail__section`,children:[(0,f.jsx)(`div`,{className:`tabs tabs--sub`,role:`tablist`,"aria-label":`Code input mode`,children:[`paste`,`url`].map(e=>(0,f.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":Oe===e,className:`tabs__tab${Oe===e?` is-active`:``}`,onClick:()=>ke(e),children:e===`paste`?`Paste`:`GitHub URL`},e))}),Oe===`url`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`code-url`,children:`Public GitHub file or directory URL`}),(0,f.jsx)(`input`,{id:`code-url`,type:`text`,value:Ae,onChange:e=>je(e.target.value),placeholder:`https://github.com/owner/repo/blob/main/src/Button.tsx`,spellCheck:!1}),(0,f.jsxs)(`p`,{className:`hint`,children:[`blob, raw, or directory (tree) URLs â public repos only, fetched browser-direct with no token. The tracer follows the entryâs relative imports (up to`,` `,8,` files: .tsx/.ts/.css/.scss), every fetch receipted; what it canât close is a named gap.`]})]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:!!Ie||!Ae.trim(),onClick:()=>{ye(null),Qe()},children:Ie?`Workingâ¦`:`Fetch & propose`}),Ie?(0,f.jsx)(`p`,{className:`hint`,children:Ie}):null,Re?(0,f.jsx)(`div`,{className:`notice notice--error`,children:Re}):null,!Ie&&Be&&He.length>0?(0,f.jsxs)(`div`,{className:`notice`,children:[`The deterministic trace left `,He.length,` named gap`,He.length===1?``:`s`,` (listed in the receipts). The next rung is AI: an assist plan proposes which repo files close them â every fetch labeled ai-proposed, then the same proposer re-runs.`,(0,f.jsx)(`div`,{style:{marginTop:8},children:(0,f.jsx)(`button`,{type:`button`,disabled:!!Ie,onClick:()=>void $e(),children:`Plan fetches with AI`})})]}):null,!Ie&&!Re&&Me?(0,f.jsx)(`p`,{className:`hint`,children:`Fetched source is loaded into the Paste fields â switch modes to inspect or edit it.`}):null]}),Oe===`paste`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`code-tsx`,children:`Component source (TSX)`}),(0,f.jsx)(`textarea`,{id:`code-tsx`,rows:10,value:Me,onChange:e=>Ne(e.target.value),placeholder:`export function Badge({ variant = 'info' }: ⦠) { ⦠}`,spellCheck:!1})]}),(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`code-css`,children:`CSS Module (optional â unlocks anatomy)`}),(0,f.jsx)(`textarea`,{id:`code-css`,rows:7,value:Pe,onChange:e=>Fe(e.target.value),placeholder:`.root { ⦠}`,spellCheck:!1})]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:!!Ie||!Me.trim(),onClick:()=>{ye(null),Ye(Me,Pe,`code proposal â pasted source`)},children:Ie?`Workingâ¦`:`Propose contract`}),Ie?(0,f.jsx)(`p`,{className:`hint`,children:Ie}):null,Re?(0,f.jsx)(`div`,{className:`notice notice--error`,children:Re}):null,Ke?(0,f.jsxs)(`div`,{className:`notice`,role:`status`,children:[(0,f.jsxs)(`strong`,{children:[`Computed capture needed (`,Ke.kind,`)`]}),(0,f.jsx)(`ul`,{style:{margin:`8px 0 0`,paddingLeft:18},children:Ke.lines.map(e=>(0,f.jsx)(`li`,{children:e},e.slice(0,48)))}),(0,f.jsxs)(`div`,{style:{marginTop:8,display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,f.jsx)(`button`,{type:`button`,className:`btn--ghost`,onClick:()=>qe(null),children:`Cancel`}),(0,f.jsx)(`button`,{type:`button`,disabled:!!Ie,onClick:()=>{let{tsx:e,css:t,origin:n}=Ke.pending;Ye(e,t,n,{forceStub:!0})},children:Ke.cta})]})]}):null]}),_r(`code`)]}),me===`json`&&(0,f.jsxs)(`div`,{className:`rail__section`,children:[(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`json-paste`,children:`Contract JSON or Figma dump (v1)`}),(0,f.jsx)(`textarea`,{id:`json-paste`,rows:14,value:Rt,onChange:e=>zt(e.target.value),placeholder:`{ "id": "ds.badge", ⦠} â or a plugin/REST dump`,spellCheck:!1}),(0,f.jsx)(`p`,{className:`hint`,children:`The power-user path: a pasted contract goes straight to the editor; a pasted dump (the JSON a Figma plugin or REST export produces) runs the same proposer the Figma import runs.`})]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:!Rt.trim(),onClick:L,children:`Load`}),(0,f.jsx)(wx,{error:Bt})]}),me===`tokens`&&(0,f.jsxs)(`div`,{className:`rail__section rail__form`,children:[(0,f.jsxs)(`div`,{className:`token-status`,children:[(0,f.jsx)(`span`,{className:`token-status__k`,children:`active token source`}),r.label,` â `,r.inventory.size,` token paths. Proposals, suggestions, the inline emitterâs literals, and the preview stylesheet all bind against this tree.`,r.kind===`user`?(0,f.jsx)(`button`,{type:`button`,onClick:()=>{kg(),_n(null),hn(null),yn(null)},children:`Back to repo tokens`}):null]}),(0,f.jsxs)(`div`,{className:`field`,children:[(0,f.jsx)(`label`,{htmlFor:`tokens-paste`,children:`Your DTCG token JSON (a single tree or an array of trees)`}),(0,f.jsx)(`textarea`,{id:`tokens-paste`,rows:14,value:fn,onChange:e=>pn(e.target.value),placeholder:`{ "color": { "feedback": { "info": { "background": { "$value": "#dbeafe", "$type": "color" } } } } }`,spellCheck:!1}),(0,f.jsx)(`p`,{className:`hint`,children:`Session-only: kept in this tabâs sessionStorage, sent nowhere, gone when the tab closes. Multiple documents merge into one modeless tree â light and dark resolve identically.`})]}),(0,f.jsxs)(`div`,{className:`btn-row`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn--primary`,disabled:!fn.trim(),onClick:()=>bn(),children:`Apply tokens`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>pn(jg),children:`Load starter tree`})]}),(0,f.jsx)(`p`,{className:`hint`,children:`The starter tree covers exactly what ds.badge needs, with values the repo never shipped. Load any other contract against it and the generator refuses by name â honest degradation, nothing invented.`}),gn?(0,f.jsx)(`div`,{className:`notice`,children:gn}):null,mn?(0,f.jsxs)(`div`,{className:`notice notice--error`,children:[`Refused â `,mn.length,` issue`,mn.length===1?``:`s`,(0,f.jsx)(`ul`,{className:`validation__list`,children:mn.map((e,t)=>(0,f.jsx)(`li`,{children:e},t))})]}):null,vn?(0,f.jsxs)(`div`,{className:`notice`,children:[`This looks like a plain token map (name â value / `,`{ value }`,` entries), not DTCG. A mechanical `,(0,f.jsx)(`code`,{children:`$value`}),` wrap converts it â values verbatim, types inferred from value shape, nothing invented: `,vn.count,` token`,vn.count===1?``:`s`,`, `,vn.skipped.length,` skipped by name.`,(0,f.jsx)(`div`,{className:`btn-row`,children:(0,f.jsxs)(`button`,{type:`button`,className:`btn--primary`,onClick:xn,children:[`Convert to DTCG & apply (`,vn.count,` tokens`,vn.skipped.length>0?`, ${vn.skipped.length} skipped`:``,`)`]})}),vn.skipped.length>0?(0,f.jsxs)(`ul`,{className:`validation__list`,children:[vn.skipped.slice(0,8).map((e,t)=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`code`,{children:e.path}),` â `,e.reason]},t)),vn.skipped.length>8?(0,f.jsxs)(`li`,{children:[`⦠and `,vn.skipped.length-8,` more (all named in the converted paste)`]}):null]}):null]}):null]})]}),(0,f.jsx)(`div`,{className:`pg__gutter`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the input rail â drag, or nudge with the arrow keys; double-click resets`,tabIndex:0,...pe(`rail`)}),(0,f.jsxs)(`section`,{className:`pg__center`,children:[(0,f.jsxs)(`div`,{className:`pane__head`,children:[(0,f.jsx)(`span`,{className:`pane__title`,children:`Contract`}),(0,f.jsxs)(`div`,{className:`seg`,role:`group`,"aria-label":`Contract view`,children:[(0,f.jsx)(`button`,{type:`button`,className:`seg__btn${_===`json`?` is-active`:``}`,"aria-pressed":_===`json`,onClick:()=>v(`json`),children:`JSON`}),(0,f.jsx)(`button`,{type:`button`,className:`seg__btn${_===`spec`?` is-active`:``}`,"aria-pressed":_===`spec`,onClick:()=>v(`spec`),title:`The same contract as a readable spec sheet â props, variants, slots, tokens. Read-only; editing stays in JSON.`,children:`Spec`})]}),(0,f.jsx)(`span`,{className:`editor__meta`,title:o,children:o}),c!==null&&i!==c.text?(0,f.jsx)(`button`,{type:`button`,className:`btn--small share__btn`,onClick:()=>{a(c.text),s(c.provenance)},title:`Restore the pristine original of what was loaded â your edits are discarded.`,children:`Reset`}):null,(0,f.jsx)(`button`,{type:`button`,className:`btn--small share__btn`,disabled:!i.trim(),onClick:()=>void Pn(),title:`Copy a link carrying this contract, the active output tab, and the theme â never your tokens or keys.`,children:`Share`})]}),Tn?(0,f.jsx)(`div`,{className:`share__note${Tn.startsWith(`copied`)?``:` share__note--warn`}
3374`,children:Tn}):null,(0,f.jsxs)(`div`,{className:`editor`,children:[_===`spec`?y.current?(0,f.jsxs)(f.Fragment,{children:[b?null:(0,f.jsx)(`div`,{className:`preview__stale`,children:`Contract not schema-valid â showing the spec of the last valid parse. The refusals below name what to fix.`}),(0,f.jsx)(rx,{contract:y.current.contract,contracts:y.current.contracts,onEditJson:()=>v(`json`)})]}):(0,f.jsx)(`div`,{className:`pane__body hint`,children:`No spec to show yet â load or paste a contract, then flip back here.`}):(0,f.jsx)(_b,{ref:S,text:i,onChange:a,highlights:w,placeholder:`The contract â pick an example, import from Figma, or paste code.`}),(0,f.jsxs)(`div`,{className:`validation ${m.status===`valid`?`validation--valid`:m.status===`empty`?``:`validation--invalid`}`,role:`status`,children:[m.status===`empty`&&`No contract yet.`,m.status===`valid`&&`Schema-valid: ${m.contract.id} v${m.contract.version}`,m.status===`json-error`&&(0,f.jsxs)(f.Fragment,{children:[`Not JSON`,E([m.message])]}),m.status===`schema-error`&&(0,f.jsxs)(f.Fragment,{children:[`Refused by ContractSchema â `,m.issues.length,` issue`,m.issues.length===1?``:`s`,E(m.issues)]}),m.status===`violations`&&(0,f.jsxs)(f.Fragment,{children:[`Schema-valid, but the generator refuses â `,m.issues.length,` named violation`,m.issues.length===1?``:`s`,E(m.issues),(0,f.jsxs)(`div`,{className:`validation__fix`,children:[oe<2?(0,f.jsx)(`button`,{type:`button`,className:`btn--small`,disabled:O||i!==d,onClick:()=>void N(),children:O?`Asking the assist Workerâ¦`:`Fix with AI (round ${oe+1} of 2)`}):(0,f.jsxs)(`span`,{className:`hint`,children:[`AI fix round limit reached (`,2,`) â edit the contract by hand; the editor referees every keystroke.`]}),(0,f.jsx)(`span`,{className:`validation__fix-hint`,children:`Shared assist Worker (server-held key, daily caps) â the returned contract loads as an ai-proposed round and is re-refereed here; nothing applies silently.`})]}),ie?(0,f.jsx)(`div`,{className:`notice notice--error validation__fix-error`,children:ie}):null]}),ve&&(m.status===`violations`||m.status===`schema-error`)?(0,f.jsxs)(`div`,{className:`validation__expected`,role:`note`,children:[(0,f.jsx)(`span`,{className:`validation__expected-tag`,children:`refuses on purpose`}),ve]}):null]}),A?(0,f.jsxs)(`div`,{className:`ai-fix-strip`,role:`note`,children:[(0,f.jsx)(`span`,{className:`mint-assist__tag`,"aria-label":`AI-proposed fix`,children:`ai-proposed`}),(0,f.jsxs)(`span`,{className:`ai-fix-strip__text`,children:[`fix round `,oe,` of `,2,` loaded and re-refereed above â nothing applied silently.`,j?(0,f.jsxs)(f.Fragment,{children:[` Diff vs your pre-fix contract: `,j.diff.summary,`.`]}):null]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--small`,onClick:P,children:`Undo`})]}):null,A&&j&&j.diff.lost.length>0?(0,f.jsxs)(`div`,{className:`notice notice--error ai-fix-strip__loss`,role:`alert`,children:[`The AI round `,(0,f.jsxs)(`strong`,{children:[`REMOVED `,j.diff.lost.length]}),`:`,` `,j.diff.lost.join(`, `),` â review before trusting.`,j.undeclared.length>0?(0,f.jsxs)(f.Fragment,{children:[` `,j.undeclared.length,` of these the model did not even declare in its removals list.`]}):null,` `,`Undo restores the pre-fix contract.`]}):null]})]}),(0,f.jsx)(`div`,{className:`pg__gutter`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the output pane â drag, or nudge with the arrow keys; double-click resets`,tabIndex:0,...pe(`output`)}),(0,f.jsxs)(`section`,{className:`pg__output`,ref:de,children:[xe&&!Ce?(0,f.jsxs)(`div`,{className:`switch-strip`,role:`note`,children:[(0,f.jsx)(`span`,{children:dx[xe.source]}),(0,f.jsx)(`button`,{type:`button`,className:`btn--ghost switch-strip__dismiss`,onClick:Te,"aria-label":`Dismiss for this session`,children:`Dismiss`})]}):null,(0,f.jsxs)(`div`,{className:`output__bar`,children:[(0,f.jsxs)(`div`,{className:`tabs output__tabs`,role:`tablist`,"aria-label":`Output target`,children:[(0,f.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":Cn===`preview`,className:`tabs__tab${Cn===`preview`?` is-active`:``}`,onClick:()=>wn(`preview`),children:`Preview`}),sf.map(e=>(0,f.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":Cn===e.name,title:ax[e.name]??e.label,className:`tabs__tab${Cn===e.name?` is-active`:``}`,onClick:()=>wn(e.name),children:ix[e.name]??e.name},e.name))]}),(0,f.jsx)(`div`,{className:`output__bar-right`,children:Cn===`preview`&&fr?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Preview side`,children:_x.map(([e,t,n])=>(0,f.jsx)(`button`,{type:`button`,className:`seg__btn${tr===e?` is-active`:``}`,"aria-pressed":tr===e,title:n,onClick:()=>rr(e),children:t},e))}),tr===`canvas`?null:(0,f.jsxs)(`div`,{className:`seg`,role:`group`,"aria-label":`Preview mode`,children:[(0,f.jsx)(`button`,{type:`button`,className:`seg__btn${Xn===`single`?` is-active`:``}`,"aria-pressed":Xn===`single`,title:`One instance at the props you pick (drawer controls) â rendered live by the same HTML emitter.`,onClick:()=>Zn(`single`),children:`Single`}),(0,f.jsx)(`button`,{type:`button`,className:`seg__btn${Xn===`all`?` is-active`:``}`,"aria-pressed":Xn===`all`,title:`Every variant value and boolean, one row each.`,onClick:()=>
3374Zn(`all`),children:`All`})]}),tr===`canvas`?null:(0,f.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Preview canvas surface`,title:`The backdrop behind the component â independent of the app theme, like Figma's canvas. Dark also switches the token mode. (The Canvas side is always light, like Figma.)`,children:mx.map(([e,t])=>(0,f.jsx)(`button`,{type:`button`,className:`seg__btn seg__btn--icon${Qn===e?` is-active`:``}`,"aria-pressed":Qn===e,"aria-label":t,title:t,onClick:()=>er(e),children:hx[e]},e))}),tr===`code`?null:(0,f.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Ground truth`,children:(0,f.jsx)(`button`,{type:`button`,className:`seg__btn${ir?` is-active`:``}`,"aria-pressed":ir,title:`Figma's own render of the imported node (images API), beside the canvas compiled from the contract. For contracts without a Figma source, the panel says so.`,onClick:()=>ar(e=>!e),children:`Figma render`})})]}):Cn===`preview`?null:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`label`,{className:`output__format`,title:`prettier over the emitted files â lazy chunk (~1.4 MB), first run only`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:Fn,onChange:e=>In(e.target.checked)}),`Format`,Ln?`â¦`:``]}),Cn===`react-inline`?(0,f.jsx)(sb,{title:`How these token literals resolve`,children:(0,f.jsxs)(`p`,{children:[`Tokens resolved for `,(0,f.jsx)(`strong`,{children:t}),` mode`,r.kind===`user`?` â from your pasted tree`:``,`. Flip the app theme to re-resolve.`]})}):null,Cn===`figma-script`?(0,f.jsx)(sb,{title:`What to do with this script`,children:(0,f.jsxs)(`p`,{children:[D&&D.count>0?`Includes ${D.count} provisional variable${D.count===1?``:`s`} (imported.*) the script creates first â rename against your real tokens. `:``,`Run it in the source Figma file through the Sync Runner pluginâs`,` `,(0,f.jsx)(`b`,{children:`Advanced â Paste a script`}),` drawer (a developer surface â it runs raw scripts with full plugin permissions): builds the contractâs version beside your original for A/B â or takes you to the existing one. The pluginâs everyday door is `,(0,f.jsx)(`b`,{children:`Build`}),`, which takes a contracts file rather than a script.`]})}):null]})})]}),(0,f.jsx)(`div`,{className:`output__body`,children:Cn===`preview`?(0,f.jsxs)(`div`,{className:`preview`,children:[qn?(0,f.jsx)(`div`,{className:`preview__stale`,children:`Contract invalid â showing the last valid render. Fix the named refusals to update.`}):null,fr?(()=>{let e=Xn===`single`?mr?.ok?(0,f.jsx)(`iframe`,{sandbox:``,srcDoc:mr.doc,title:Un?`Contract preview â chosen state`:`Contract preview â chosen state (last valid)`}):mr?(0,f.jsx)(`div`,{className:`output__error`,children:mr.error}):null:(0,f.jsx)(Hg,{contract:fr.contract,contracts:fr.contracts,surface:Qn,title:Un?`Contract preview`:`Contract preview (last valid)`}),t=(0,f.jsx)(lb,{contract:fr.contract,contracts:fr.contracts,title:Un?`Canvas preview`:`Canvas preview (last valid)`,cap:ir?`Canvas â compiled from the contract`:`Canvas â figma engine`}),n=ir?(0,f.jsx)(`div`,{className:`preview__split-col preview__split-col--gt`,children:(0,f.jsx)(yb,{contract:fr.contract})}):null;return tr===`code`?e:tr===`canvas`?ir?(0,f.jsxs)(`div`,{className:`preview__split`,children:[(0,f.jsx)(`div`,{className:`preview__split-col`,children:t}),n]}):t:(0,f.jsxs)(`div`,{className:`preview__split${ir?` preview__split--3`:``}`,children:[(0,f.jsxs)(`div`,{className:`preview__split-col`,children:[(0,f.jsx)(`div`,{className:`preview__cap`,children:(0,f.jsx)(`span`,{children:`Code â HTML emitter`})}),e]}),(0,f.jsx)(`div`,{className:`preview__split-col`,children:t}),n]})})():Jn?(0,f.jsxs)(`div`,{className:`pane__body hint preview__neutral`,children:[`No valid render yet`,Wn?` for ${Wn}`:``,` â fix the refusals to see it`,Yn,ve?(0,f.jsxs)(`div`,{className:`preview__expected`,role:`note`,children:[(0,f.jsx)(`span`,{className:`validation__expected-tag`,children:`refuses on purpose`}),ve]}):null]}):(0,f.jsx)(`div`,{className:`pane__body hint`,children:`Nothing to render yet.`})]}):(0,f.jsx)(`div`,{className:`output__files`,children:Vn?Hn?.error?(0,f.jsx)(`div`,{className:`output__error`,children:Hn.error}):(zn??Hn?.files??[]).map(e=>(0,f.jsxs)(`div`,{className:`output__file`,children:[(0,f.jsxs)(`div`,{className:`output__filehead`,children:[(0,f.jsx)(`span`,{className:`output__filename`,children:e.path}),(0,f.jsx)(vb,{text:e.contents,className:`output__copy`})]}),(0,f.jsx)(Tb,{path:e.path,code:e.contents})]},e.path)):(0,f.jsx)(`div`,{className:`pane__body hint`,children:`A schema-valid contract flows here.`})})}),(0,f.jsx)(Nb,{receipts:te,mintedExtras:D?(0,f.jsx)(wb,{minted:D,component:y.current?.contract.name??`Component`,text:i,onApplyText:a},o):void 0,controls:fr?Hb(fr.contract).length>0||(fr.contract.events?.length??0)>0?(0,f.jsxs)(f.Fragment,{children:[Cn!==`preview`||tr===`canvas`||Xn!==`single`?(0,f.jsx)(`p`,{className:`dock__hint`,children:`Controls drive the Preview tabâs Single view â values persist and apply there.`}):null,(0,f.jsx)(qb,{contract:fr.contract,overrides:pr,onChange:hr,notedProp:cr})]}):(0,f.jsx)(`p`,{className:`dock__hint`,children:`This contract declares no props â nothing to control.`}):(0,f.jsx)(`p`,{className:`dock__hint`,children:`Load a contract and its prop controls appear here.`}),footNote:(0,f.jsx)(sb,{title:`How this output is generated`,children:(0,f.jsxs)(`p`,{children:[`Generated in your browser by the same core that ships the repoâs`,` `,vh.size,` components â core/index.ts, `,(0,f.jsx)(`strong`,{children:`golden-guarded`}),`: the CLIâs output from this same core is byte-compared against committed reference files on every eval run, so the playground cannot drift from the shipping generator.`]})})})]})]})]})}var Dx=`https://github.com/southleft/ds-contracts-poc`;function Ox(){let{pathname:e}=g(),{theme:t,toggle:n}=x(),[r,i]=(0,l.useState)(!1),a=t=>`topbar__link${e===t?` is-active`:``}`;return(0,f.jsxs)(`header`,{className:`topbar`,children:[(0,f.jsxs)(_,{to:`/`,className:`topbar__brand`,children:[(0,f.jsxs)(`svg`,{viewB
3374ox:`0 0 437.1666 264.4827`,className:`topbar__glyph`,"aria-hidden":!0,children:[(0,f.jsx)(`path`,{d:`M212.9201,240.6041l-102.7592-102.6577c-3.1659-3.1628-3.1666-8.2939-.0014-11.4574L212.8578,23.842c3.1626-3.1611,8.2887-3.1608,11.451.0007l102.6993,102.6716c3.1635,3.1626,3.1638,8.2911.0006,11.4541l-102.6384,102.6331c-3.1616,3.1615-8.2871,3.1627-11.4502.0027Z`,fill:`#5aa1f2`}),(0,f.jsx)(`path`,{d:`M282.2417,234.7913l97.5292-97.6266c2.7326-2.7353,2.7331-7.1671.001-9.9031l-97.3973-97.5358c-2.7227-2.7266-2.7329-7.1399-.0228-9.879l17.5796-17.7681c2.7318-2.7611,7.1883-2.7731,9.935-.0269l125.2475,125.226c2.7365,2.736,2.7369,7.1723.001,9.9089l-125.1874,125.2174c-2.7326,2.7332-7.1622,2.7377-9.9003.0099l-17.7737-17.7067c-2.7442-2.7338-2.7495-7.1756-.0118-9.9159Z`,fill:`currentColor`}),(0,f.jsx)(`path`,{d:`M57.4354,137.1591l97.5065,97.6701c2.7355,2.7401,2.7301,7.1796-.0122,9.9129l-17.7541,17.6964c-2.7377,2.7288-7.1681,2.7251-9.9012-.0083L2.052,137.1944c-2.7364-2.7367-2.7359-7.1735.001-9.9096L127.2578,2.1195c2.7309-2.73,7.1558-2.736,9.894-.0134l17.7701,17.6684c2.7491,2.7334,2.7562,7.1796.0158,9.9217L57.438,127.2557c-2.7333,2.7349-2.7344,7.167-.0026,9.9034Z`,fill:`currentColor`})]}),(0,f.jsx)(`span`,{className:`topbar__brand-name`,children:`Contract Playground`})]}),(0,f.jsxs)(`nav`,{className:`topbar__nav`,children:[(0,f.jsx)(_,{to:`/playground`,className:a(`/playground`),children:`Playground`}),(0,f.jsx)(_,{to:`/examples`,className:a(`/examples`),children:`Examples`}),(0,f.jsx)(`a`,{href:Dx,className:`topbar__link`,target:`_blank`,rel:`noreferrer`,children:`GitHub`}),(0,f.jsx)(`button`,{type:`button`,className:`topbar__link topbar__help`,onClick:()=>i(!0),children:`How do I use this?`})]}),(0,f.jsx)(ne,{open:r,onClose:()=>i(!1)}),(0,f.jsx)(`button`,{type:`button`,className:`topbar__theme`,onClick:n,"aria-label":`Switch to ${t===`light`?`dark`:`light`} theme`,children:t===`light`?`Dark`:`Light`})]})}function kx(){let{pathname:e}=g();return e===`/playground`?(0,f.jsx)(Ex,{}):e===`/examples`?(0,f.jsx)(Wg,{}):(0,f.jsx)(Ch,{})}function Ax(){return te()?(0,f.jsxs)(`div`,{className:`chunk-banner`,role:`alert`,children:[(0,f.jsx)(`span`,{children:`The playground was updated since this tab loaded â reload to continue.`}),(0,f.jsx)(`button`,{type:`button`,className:`btn--small`,onClick:()=>window.location.reload(),children:`Reload`})]}):null}function jx(){return(0,f.jsx)(b,{children:(0,f.jsxs)(`div`,{className:`app`,children:[(0,f.jsx)(Ox,{}),(0,f.jsx)(Ax,{}),(0,f.jsx)(`main`,{className:`app__main`,children:(0,f.jsx)(kx,{})})]})})}var Mx=document.getElementById(`root`);if(!Mx)throw Error(`Contract Playground: #root element not found`);(0,u.createRoot)(Mx).render((0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(h,{children:(0,f.jsx)(jx,{})})}));export{uu as a,hc as c,xd as i,yd as n,xu as o,bd as r,bl as s,yg as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.