@feimacode/open-design-agent-kit-mcp 0.4.0-beta.1 → 0.4.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,11 @@
1
- "use strict";(()=>{function j(t,e){function c(n){return/^data:/i.test(n)}function m(n){let o=parseFloat(n);return Number.isFinite(o)?o:0}function y(n){if(!n)return null;let o=/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,/\s]+([\d.]+))?\s*\)/i.exec(n);if(!o)return null;let l=o[4]===void 0?1:Number(o[4]);return{r:Math.min(1,Number(o[1])/255),g:Math.min(1,Number(o[2])/255),b:Math.min(1,Number(o[3])/255),a:Number.isFinite(l)?l:1}}function f(n){return!n||n.a===0?null:{type:"SOLID",color:{r:n.r,g:n.g,b:n.b},opacity:n.a}}function I(n){let o=n.replace("#","");if(![3,4,6,8].includes(o.length))return null;let l=o.length<=4?o.split("").map(x=>x+x).join(""):o,d=parseInt(l.slice(0,2),16)/255,u=parseInt(l.slice(2,4),16)/255,E=parseInt(l.slice(4,6),16)/255,T=l.length===8?parseInt(l.slice(6,8),16)/255:1;return{r:d,g:u,b:E,a:T}}function b(n){if(!n||!/gradient\(/i.test(n))return null;let o=/rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}/.exec(n);return o?o[0].startsWith("#")?I(o[0]):y(o[0]):null}function M(n){let o=m(n.borderTopLeftRadius),l=m(n.borderTopRightRadius),d=m(n.borderBottomRightRadius),u=m(n.borderBottomLeftRadius);return o===l&&l===d&&d===u?o:{topLeft:o,topRight:l,bottomRight:d,bottomLeft:u}}function $(n){let o=m(n.borderTopWidth);if(!o||n.borderTopStyle==="none"||n.borderTopStyle==="hidden")return null;let l=f(y(n.borderTopColor));return!l||!(n.borderTopWidth===n.borderRightWidth&&n.borderRightWidth===n.borderBottomWidth&&n.borderBottomWidth===n.borderLeftWidth)?null:{stroke:l,weight:o}}function W(n){if(!n||n==="none")return null;let o=n.split(/,(?![^(]*\))/)[0].trim();if(/\binset\b/.test(o))return null;let l=/rgba?\([^)]+\)|#[0-9a-f]{3,8}/i.exec(o),d=y(l?l[0]:""),u=(o.replace(/rgba?\([^)]+\)|#[0-9a-f]{3,8}/i,"").match(/-?[\d.]+px/g)||[]).map(m);return!d||u.length<2?null:{type:"DROP_SHADOW",color:{r:d.r,g:d.g,b:d.b,a:d.a},offset:{x:u[0]||0,y:u[1]||0},radius:u[2]||0,spread:u[3]||0}}function D(n,o){let l=Number(n)||400,d=l<=100?"Thin":l<=200?"ExtraLight":l<=300?"Light":l<=400?"Regular":l<=500?"Medium":l<=600?"SemiBold":l<=700?"Bold":l<=800?"ExtraBold":"Black";return o?d==="Regular"?"Italic":`${d} Italic`:d}function P(n){return(n||"Inter").split(",")[0].replace(/["']/g,"").trim()||"Inter"}function G(n){return!(n.display==="none"||n.visibility==="hidden"||n.visibility==="collapse"||Number(n.opacity)===0)}function i(n,o){try{let l=o.createRange();return l.selectNodeContents(n),l.getBoundingClientRect()}catch{return null}}let s=t.defaultView,p=s?.scrollX||0,w=s?.scrollY||0,v=new Map,g=0,C=!1;function ut(n,o){v.has(n)||v.set(n,new Set),v.get(n).add(o)}function mt(n){return c(n)?{dataUri:n}:{url:n}}function X(n){if(g>=6e3)return C=!0,null;let o=getComputedStyle(n);if(!G(o))return null;let l=n.getBoundingClientRect();if(l.width<=0||l.height<=0)return null;g+=1;let d={type:"FRAME",name:n.tagName.toLowerCase()+(n.id?`#${n.id}`:""),x:l.left+p,y:l.top+w,width:l.width,height:l.height},u=[],E=null,T=o.backgroundImage;if(T&&T!=="none"){let h=/url\(\s*['"]?([^'")]+)['"]?\s*\)/i.exec(T);h&&(E=h[1])}if(n.tagName==="IMG"){let h=n.currentSrc||n.src;h&&(E=h)}if(E)u.push({type:"IMAGE",scaleMode:"FILL",...mt(E)});else{let h=f(y(o.backgroundColor))??f(b(T));h&&u.push(h)}u.length&&(d.fills=u);let x=$(o);x&&(d.strokes=[x.stroke],d.strokeWeight=x.weight);let A=M(o);typeof A=="number"?A>0&&(d.cornerRadius=A):d.rectangleCornerRadii=A;let F=W(o.boxShadow);F&&(d.effects=[F]);let N=Number(o.opacity);Number.isFinite(N)&&N<1&&(d.opacity=N),(o.overflow==="hidden"||o.overflowX==="hidden"||o.overflowY==="hidden")&&(d.clipsContent=!0);let B=[];for(let h of Array.from(n.childNodes))if(h.nodeType===1){let R=h;if(["SCRIPT","STYLE","NOSCRIPT","LINK","META","HEAD","TITLE","BR","SVG"].includes(R.tagName))continue;let S=X(R);S&&B.push(S)}else if(h.nodeType===3){let R=h.nodeValue;if(!R||!R.trim())continue;let S=gt(h,R,o);S&&B.push(S)}return B.length&&(d.children=B),d}function gt(n,o,l){if(g>=6e3)return C=!0,null;let d=i(n,t);if(!d||d.width<=0||d.height<=0)return null;g+=1;let u=l,E=P(u.fontFamily),T=u.fontStyle==="italic"||u.fontStyle==="oblique",x=D(u.fontWeight,T);ut(E,x);let A=u.lineHeight==="normal"?void 0:m(u.lineHeight),F=m(u.letterSpacing),N=u.textAlign==="center"?"CENTER":u.textAlign==="right"||u.textAlign==="end"?"RIGHT":u.textAlign==="justify"?"JUSTIFIED":"LEFT",B=u.getPropertyValue("-webkit-background-clip")||u.backgroundClip,h=u.getPropertyValue("-webkit-text-fill-color"),S=B==="text"&&(h==="transparent"||y(h)?.a===0)?b(u.backgroundImage):null,O=S??y(u.color)??{r:0,g:0,b:0,a:1},H=u.textTransform,Y=H==="uppercase"?o.toUpperCase():H==="lowercase"?o.toLowerCase():H==="capitalize"?o.replace(/\b\w/g,ft=>ft.toUpperCase()):o,z={type:"TEXT",name:Y.trim().slice(0,40),x:d.left+p,y:d.top+w,width:Math.ceil(d.width)+1,height:Math.ceil(d.height),characters:Y.replace(/\s+/g," ").trim(),fontFamily:E,fontStyle:x,fontSize:m(u.fontSize)||16,textAlign:N,color:{r:O.r,g:O.g,b:O.b},opacity:S?1:O.a};return A&&(z.lineHeight=A),F&&(z.letterSpacing=F),z}let pt=X(t.body)??{type:"FRAME",name:"body",x:0,y:0,width:t.documentElement.scrollWidth,height:t.documentElement.scrollHeight};return{capture:{version:1,source:{url:t.URL,title:e.title,capturedAt:Date.now(),viewport:{width:s?.innerWidth??0,height:s?.innerHeight??0},dpr:s?.devicePixelRatio||1},fonts:Array.from(v.entries()).map(([n,o])=>({family:n,styles:Array.from(o)})),root:pt},nodeCount:g,truncated:C}}function J(t,e){return t.querySelector(`[data-od-id="${q(e)}"]`)}var L="auto-";function Q(t){let e=t.getAttribute("data-od-id");return e&&!e.startsWith(L)?e:void 0}function Z(t){let e=t.getAttribute("data-od-id");return e||(e=`${L}${Math.random().toString(36).slice(2,10)}`,t.setAttribute("data-od-id",e)),e}function ht(t){let e=[],r=t;for(;r&&r.nodeName.toLowerCase()!=="html";){let a=r.nodeName.toLowerCase();if(r.id){e.unshift(`${a}#${r.id}`);break}let c=r.parentElement;if(c){let y=Array.from(c.children).filter(f=>f.nodeName===r.nodeName).indexOf(r)+1;a+=`:nth-of-type(${y})`}e.unshift(a),r=c}return e.join(" > ")}var yt=["data-od-id","data-testid","data-od-node","data-od-slide","name","aria-label"],bt=/^-?(p[xytrbl]?|m[xytrbl]?|w|h|size|min-w|min-h|max-w|max-h|gap|space-[xy]|text|bg|from|to|via|flex|grid|col|row|items|justify|self|place|content|rounded|font|leading|tracking|border|divide|outline|ring|shadow|opacity|z|top|left|right|bottom|inset|order|basis|grow|shrink|overflow|cursor|transition|duration|ease|delay|animate|translate|scale|rotate|skew|origin|fill|stroke|object|aspect|line-clamp|decoration|underline-offset|blur|backdrop|drop-shadow)(-|$)/,wt=new Set(["flex","grid","block","inline","inline-block","inline-flex","hidden","contents","relative","absolute","fixed","sticky","static","container","italic","uppercase","lowercase","capitalize","underline","truncate","grow","shrink","sr-only","antialiased","active","selected","open","show","visible","hover","focus","disabled","is-active","is-open"]);function Ct(t){return/[:[\]/!.%#@]/.test(t)||bt.test(t)||wt.has(t)||/^\d/.test(t)}function Et(t){return/^[a-z][\w-]{0,63}$/i.test(t)&&!/\d{4,}/.test(t)&&!t.startsWith(L)&&!/^(radix|headlessui|react|ember|mui|chakra)[-:]/i.test(t)}function _(t,e,r){try{let a=t.querySelectorAll(e);return a.length===1&&a[0]===r}catch{return!1}}function xt(t,e){return`[${t}="${e.replace(/["\\]/g,"\\$&")}"]`}function K(t,e){let r=e.nodeName.toLowerCase();if(e.id&&Et(e.id)){let a=`${r}#${q(e.id)}`;if(_(t,a,e))return a}for(let a of yt){let c=e.getAttribute(a);if(!c||c.length>80||a==="data-od-id"&&c.startsWith(L))continue;let m=`${r}${xt(a,c)}`;if(_(t,m,e))return m}}function Tt(t){let e=Array.from(t.classList).filter(r=>!Ct(r)).slice(0,3);return e.length?`${t.nodeName.toLowerCase()}${e.map(r=>`.${q(r)}`).join("")}`:void 0}function St(t){let e=t.nodeName.toLowerCase(),r=t.parentElement;if(!r)return e;let a=Array.from(r.children).filter(c=>c.nodeName===t.nodeName);return a.length>1?`${e}:nth-of-type(${a.indexOf(t)+1})`:e}function tt(t){let e=t.ownerDocument,r=K(e,t);if(r)return r;let a=t.parentElement,c;for(;a&&a.nodeName.toLowerCase()!=="html"&&(c=K(e,a),!c);)a=a.parentElement;c||(a=null);let m=Tt(t);if(m){if(_(e,m,t))return m;if(c&&_(e,`${c} ${m}`,t))return`${c} ${m}`}let y=[],f=t;for(;f&&f!==a&&f.nodeName.toLowerCase()!=="html";)y.unshift(St(f)),f=f.parentElement;let I=(c?`${c} > `:"")+y.join(" > ");return _(e,I,t)?I:ht(t)}function et(t,e){try{return t.querySelector(e)}catch{return null}}function q(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):t.replace(/["\\]/g,"\\$&")}function nt(t){let r=t.cloneNode(!1).outerHTML.split(">")[0]+">";return r.length>200?`${r.slice(0,200)}\u2026`:r}function At(t){return/^<([a-z][a-z0-9-]*)/i.exec(t??"")?.[1]?.toLowerCase()}function rt(t){return(t??"").replace(/\s+/g," ").trim()}function ot(t,e){if(e.elementId){let c=J(t,e.elementId);if(c)return c}if(e.selector){let c=et(t,e.selector);if(c)return c}let r=At(e.htmlHint),a=rt(e.text).replace(/…$/,"");if(r&&a.length>=3){let c=Array.from(t.getElementsByTagName(r)).filter(m=>rt(m.textContent).startsWith(a));if(c.length===1)return c[0]}return null}function it(t){let e=(t??"").replace(/\s+/g," ").trim();return e.length>120?`${e.slice(0,119)}\u2026`:e}function at(t,e){let r=t.querySelector(`[data-od-id="${e.elementId}"]`);if(!r)return!1;switch(e.kind){case"set-text":return r.textContent=e.value,!0;case"set-link":return r.textContent=e.text,r.setAttribute("href",e.href),!0;case"set-image":return r.removeAttribute(k),r.setAttribute("src",e.src),r.setAttribute("alt",e.alt),!0;case"set-outer-html":return r.outerHTML=e.html,!0;case"set-style":for(let[a,c]of Object.entries(e.styles))c!==void 0&&(r.style[a]=c);return!0;case"remove-element":return r.remove(),!0;default:return!1}}var U="data-od-preview-only",st="data-od-preview-srcdoc",k="data-od-preview-src";function lt(t){let e=t.doctype?`<!DOCTYPE ${t.doctype.name}>
1
+ "use strict";(()=>{function Q(t,e){function a(n){return/^data:/i.test(n)}function p(n){let o=parseFloat(n);return Number.isFinite(o)?o:0}function g(n){if(!n)return null;let o=/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,/\s]+([\d.]+))?\s*\)/i.exec(n);if(!o)try{let u=t.createElement("canvas");u.width=1,u.height=1;let l=u.getContext("2d");if(!l||(l.fillStyle="#010203",l.fillStyle=n,String(l.fillStyle)==="#010203"))return null;l.fillRect(0,0,1,1);let E=l.getImageData(0,0,1,1).data;return{r:E[0]/255,g:E[1]/255,b:E[2]/255,a:E[3]/255}}catch{return null}let c=o[4]===void 0?1:Number(o[4]);return{r:Math.min(1,Number(o[1])/255),g:Math.min(1,Number(o[2])/255),b:Math.min(1,Number(o[3])/255),a:Number.isFinite(c)?c:1}}function h(n){return!n||n.a===0?null:{type:"SOLID",color:{r:n.r,g:n.g,b:n.b},opacity:n.a}}function m(n){let o=n.replace("#","");if(![3,4,6,8].includes(o.length))return null;let c=o.length<=4?o.split("").map(C=>C+C).join(""):o,u=parseInt(c.slice(0,2),16)/255,l=parseInt(c.slice(2,4),16)/255,E=parseInt(c.slice(4,6),16)/255,S=c.length===8?parseInt(c.slice(6,8),16)/255:1;return{r:u,g:l,b:E,a:S}}function w(n){if(!n||!/gradient\(/i.test(n))return null;let o=/(?:rgba?|oklch|oklab|lab|lch|hwb|color)\([^()]+\)|#[0-9a-fA-F]{3,8}/.exec(n);return o?o[0].startsWith("#")?m(o[0]):g(o[0]):null}function x(n){let o=p(n.borderTopLeftRadius),c=p(n.borderTopRightRadius),u=p(n.borderBottomRightRadius),l=p(n.borderBottomLeftRadius);return o===c&&c===u&&u===l?o:{topLeft:o,topRight:c,bottomRight:u,bottomLeft:l}}function O(n){let o=p(n.borderTopWidth);if(!o||n.borderTopStyle==="none"||n.borderTopStyle==="hidden")return null;let c=h(g(n.borderTopColor));return!c||!(n.borderTopWidth===n.borderRightWidth&&n.borderRightWidth===n.borderBottomWidth&&n.borderBottomWidth===n.borderLeftWidth)?null:{stroke:c,weight:o}}function z(n){if(!n||n==="none")return null;let o=n.split(/,(?![^(]*\))/)[0].trim();if(/\binset\b/.test(o))return null;let c=/(?:rgba?|oklch|oklab|lab|lch|hwb|color)\([^()]+\)|#[0-9a-f]{3,8}/i.exec(o),u=g(c?c[0]:""),l=(o.replace(/(?:rgba?|oklch|oklab|lab|lch|hwb|color)\([^()]+\)|#[0-9a-f]{3,8}/i,"").match(/-?[\d.]+px/g)||[]).map(p);return!u||l.length<2?null:{type:"DROP_SHADOW",color:{r:u.r,g:u.g,b:u.b,a:u.a},offset:{x:l[0]||0,y:l[1]||0},radius:l[2]||0,spread:l[3]||0}}function V(n,o){let c=Number(n)||400,u=c<=100?"Thin":c<=200?"ExtraLight":c<=300?"Light":c<=400?"Regular":c<=500?"Medium":c<=600?"SemiBold":c<=700?"Bold":c<=800?"ExtraBold":"Black";return o?u==="Regular"?"Italic":`${u} Italic`:u}function N(n){return(n||"Inter").split(",")[0].replace(/["']/g,"").trim()||"Inter"}function G(n){return!(n.display==="none"||n.visibility==="hidden"||n.visibility==="collapse"||Number(n.opacity)===0)}function H(n,o){try{let c=o.createRange();return c.selectNodeContents(n),c.getBoundingClientRect()}catch{return null}}let s=t.defaultView,d=s?.scrollX||0,b=s?.scrollY||0,v=new Map,T=0,f=!1;function R(n,o){v.has(n)||v.set(n,new Set),v.get(n).add(o)}function wt(n){return a(n)?{dataUri:n}:{url:n}}function K(n){if(T>=6e3)return f=!0,null;let o=getComputedStyle(n);if(!G(o))return null;let c=n.getBoundingClientRect();if(c.width<=0||c.height<=0)return null;T+=1;let u={type:"FRAME",name:n.tagName.toLowerCase()+(n.id?`#${n.id}`:""),x:c.left+d,y:c.top+b,width:c.width,height:c.height},l=[],E=null,S=o.backgroundImage;if(S&&S!=="none"){let y=/url\(\s*['"]?([^'")]+)['"]?\s*\)/i.exec(S);y&&(E=y[1])}if(n.tagName==="IMG"){let y=n.currentSrc||n.src;y&&(E=y)}if(E)l.push({type:"IMAGE",scaleMode:"FILL",...wt(E)});else{let y=h(g(o.backgroundColor))??h(w(S));y&&l.push(y)}l.length&&(u.fills=l);let C=O(o);C&&(u.strokes=[C.stroke],u.strokeWeight=C.weight);let k=x(o);typeof k=="number"?k>0&&(u.cornerRadius=k):u.rectangleCornerRadii=k;let F=z(o.boxShadow);F&&(u.effects=[F]);let _=Number(o.opacity);Number.isFinite(_)&&_<1&&(u.opacity=_),(o.overflow==="hidden"||o.overflowX==="hidden"||o.overflowY==="hidden")&&(u.clipsContent=!0);let D=[];for(let y of Array.from(n.childNodes))if(y.nodeType===1){let I=y;if(["SCRIPT","STYLE","NOSCRIPT","LINK","META","HEAD","TITLE","BR","SVG"].includes(I.tagName))continue;let A=K(I);A&&D.push(A)}else if(y.nodeType===3){let I=y.nodeValue;if(!I||!I.trim())continue;let A=vt(y,I,o);A&&D.push(A)}return D.length&&(u.children=D),u}function vt(n,o,c){if(T>=6e3)return f=!0,null;let u=H(n,t);if(!u||u.width<=0||u.height<=0)return null;T+=1;let l=c,E=N(l.fontFamily),S=l.fontStyle==="italic"||l.fontStyle==="oblique",C=V(l.fontWeight,S);R(E,C);let k=l.lineHeight==="normal"?void 0:p(l.lineHeight),F=p(l.letterSpacing),_=l.textAlign==="center"?"CENTER":l.textAlign==="right"||l.textAlign==="end"?"RIGHT":l.textAlign==="justify"?"JUSTIFIED":"LEFT",D=l.getPropertyValue("-webkit-background-clip")||l.backgroundClip,y=l.getPropertyValue("-webkit-text-fill-color"),A=D==="text"&&(y==="transparent"||g(y)?.a===0)?w(l.backgroundImage):null,W=A??g(l.color)??{r:0,g:0,b:0,a:1},q=l.textTransform,J=q==="uppercase"?o.toUpperCase():q==="lowercase"?o.toLowerCase():q==="capitalize"?o.replace(/\b\w/g,Ct=>Ct.toUpperCase()):o,U={type:"TEXT",name:J.trim().slice(0,40),x:u.left+d,y:u.top+b,width:Math.ceil(u.width)+1,height:Math.ceil(u.height),characters:J.replace(/\s+/g," ").trim(),fontFamily:E,fontStyle:C,fontSize:p(l.fontSize)||16,textAlign:_,color:{r:W.r,g:W.g,b:W.b},opacity:A?1:W.a};return k&&(U.lineHeight=k),F&&(U.letterSpacing=F),U}let Et=K(t.body)??{type:"FRAME",name:"body",x:0,y:0,width:t.documentElement.scrollWidth,height:t.documentElement.scrollHeight};return{capture:{version:1,source:{url:t.URL,title:e.title,capturedAt:Date.now(),viewport:{width:s?.innerWidth??0,height:s?.innerHeight??0},dpr:s?.devicePixelRatio||1},fonts:Array.from(v.entries()).map(([n,o])=>({family:n,styles:Array.from(o)})),root:Et},nodeCount:T,truncated:f}}function et(t,e){return t.querySelector(`[data-od-id="${j(e)}"]`)}var L="auto-";function nt(t){let e=t.getAttribute("data-od-id");return e&&!e.startsWith(L)?e:void 0}function rt(t){let e=t.getAttribute("data-od-id");return e||(e=`${L}${Math.random().toString(36).slice(2,10)}`,t.setAttribute("data-od-id",e)),e}function St(t){let e=[],r=t;for(;r&&r.nodeName.toLowerCase()!=="html";){let i=r.nodeName.toLowerCase();if(r.id){e.unshift(`${i}#${r.id}`);break}let a=r.parentElement;if(a){let g=Array.from(a.children).filter(h=>h.nodeName===r.nodeName).indexOf(r)+1;i+=`:nth-of-type(${g})`}e.unshift(i),r=a}return e.join(" > ")}var At=["data-od-id","data-testid","data-od-node","data-od-slide","name","aria-label"],Tt=/^-?(p[xytrbl]?|m[xytrbl]?|w|h|size|min-w|min-h|max-w|max-h|gap|space-[xy]|text|bg|from|to|via|flex|grid|col|row|items|justify|self|place|content|rounded|font|leading|tracking|border|divide|outline|ring|shadow|opacity|z|top|left|right|bottom|inset|order|basis|grow|shrink|overflow|cursor|transition|duration|ease|delay|animate|translate|scale|rotate|skew|origin|fill|stroke|object|aspect|line-clamp|decoration|underline-offset|blur|backdrop|drop-shadow)(-|$)/,Rt=new Set(["flex","grid","block","inline","inline-block","inline-flex","hidden","contents","relative","absolute","fixed","sticky","static","container","italic","uppercase","lowercase","capitalize","underline","truncate","grow","shrink","sr-only","antialiased","active","selected","open","show","visible","hover","focus","disabled","is-active","is-open"]);function kt(t){return/[:[\]/!.%#@]/.test(t)||Tt.test(t)||Rt.has(t)||/^\d/.test(t)}function It(t){return/^[a-z][\w-]{0,63}$/i.test(t)&&!/\d{4,}/.test(t)&&!t.startsWith(L)&&!/^(radix|headlessui|react|ember|mui|chakra)[-:]/i.test(t)}function M(t,e,r){try{let i=t.querySelectorAll(e);return i.length===1&&i[0]===r}catch{return!1}}function Dt(t,e){return`[${t}="${e.replace(/["\\]/g,"\\$&")}"]`}function tt(t,e){let r=e.nodeName.toLowerCase();if(e.id&&It(e.id)){let i=`${r}#${j(e.id)}`;if(M(t,i,e))return i}for(let i of At){let a=e.getAttribute(i);if(!a||a.length>80||i==="data-od-id"&&a.startsWith(L))continue;let p=`${r}${Dt(i,a)}`;if(M(t,p,e))return p}}function Lt(t){let e=Array.from(t.classList).filter(r=>!kt(r)).slice(0,3);return e.length?`${t.nodeName.toLowerCase()}${e.map(r=>`.${j(r)}`).join("")}`:void 0}function Bt(t){let e=t.nodeName.toLowerCase(),r=t.parentElement;if(!r)return e;let i=Array.from(r.children).filter(a=>a.nodeName===t.nodeName);return i.length>1?`${e}:nth-of-type(${i.indexOf(t)+1})`:e}function it(t){let e=t.ownerDocument,r=tt(e,t);if(r)return r;let i=t.parentElement,a;for(;i&&i.nodeName.toLowerCase()!=="html"&&(a=tt(e,i),!a);)i=i.parentElement;a||(i=null);let p=Lt(t);if(p){if(M(e,p,t))return p;if(a&&M(e,`${a} ${p}`,t))return`${a} ${p}`}let g=[],h=t;for(;h&&h!==i&&h.nodeName.toLowerCase()!=="html";)g.unshift(Bt(h)),h=h.parentElement;let m=(a?`${a} > `:"")+g.join(" > ");return M(e,m,t)?m:St(t)}function ot(t,e){try{return t.querySelector(e)}catch{return null}}function j(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):t.replace(/["\\]/g,"\\$&")}function st(t){let r=t.cloneNode(!1).outerHTML.split(">")[0]+">";return r.length>200?`${r.slice(0,200)}\u2026`:r}function $t(t){return/^<([a-z][a-z0-9-]*)/i.exec(t??"")?.[1]?.toLowerCase()}function at(t){return(t??"").replace(/\s+/g," ").trim()}function dt(t,e){if(e.elementId){let a=et(t,e.elementId);if(a)return a}if(e.selector){let a=ot(t,e.selector);if(a)return a}let r=$t(e.htmlHint),i=at(e.text).replace(/…$/,"");if(r&&i.length>=3){let a=Array.from(t.getElementsByTagName(r)).filter(p=>at(p.textContent).startsWith(i));if(a.length===1)return a[0]}return null}function lt(t){let e=(t??"").replace(/\s+/g," ").trim();return e.length>120?`${e.slice(0,119)}\u2026`:e}function ut(t,e){let r=t.querySelector(`[data-od-id="${e.elementId}"]`);if(!r)return!1;switch(e.kind){case"set-text":return r.textContent=e.value,!0;case"set-link":return r.textContent=e.text,r.setAttribute("href",e.href),!0;case"set-image":return r.removeAttribute(B),r.setAttribute("src",e.src),r.setAttribute("alt",e.alt),!0;case"set-outer-html":return r.outerHTML=e.html,!0;case"set-style":for(let[i,a]of Object.entries(e.styles))a!==void 0&&(r.style[i]=a);return!0;case"remove-element":return r.remove(),!0;default:return!1}}var Y="data-od-preview-only",ct="data-od-preview-srcdoc",B="data-od-preview-src";function pt(t){let e=t.doctype?`<!DOCTYPE ${t.doctype.name}>
2
2
  `:`<!doctype html>
3
- `,r=t.documentElement.cloneNode(!0);return r.querySelectorAll(`[${U}]`).forEach(a=>a.remove()),r.querySelectorAll(`[data-od-id^="${L}"]`).forEach(a=>a.removeAttribute("data-od-id")),r.querySelectorAll(`[${st}]`).forEach(a=>{a.removeAttribute("srcdoc"),a.removeAttribute(st)}),r.querySelectorAll(`[${k}]`).forEach(a=>{a.setAttribute("src",a.getAttribute(k)),a.removeAttribute(k)}),e+r.outerHTML}var V="bridge";function ct(t){return typeof t=="object"&&t!==null&&t.od===V&&typeof t.type=="string"}var dt="od-bridge-pick";function Rt(){if(window.__odPreviewBridge||window.parent===window)return;window.__odPreviewBridge=!0;let t="view",e=null,r=null,a=[],c=0,m=i=>{window.parent.postMessage({od:V,...i},"*")},y=i=>{let s=i.getBoundingClientRect();return{left:s.left,top:s.top,width:s.width,height:s.height}},f=i=>{if(!i||!i.isConnected)return!1;let s=i.tagName.toLowerCase();if(s==="html"||s==="body")return!1;let p=i.getBoundingClientRect();return p.width>0&&p.height>0},I=()=>{c=0,t!=="view"&&m({type:"rects",hover:f(e)&&e!==r?y(e):null,selection:f(r)?y(r):null,pins:t==="comment"?a.filter(i=>i.status!=="resolved").map(i=>{let s=ot(document,i);return{commentId:i.id,rect:s?y(s):null}}):[]})},b=()=>{c||(c=requestAnimationFrame(I))},M=()=>{let i=document.getElementById(dt);if(t==="view"){i?.remove();return}if(i||!document.head)return;let s=document.createElement("style");s.id=dt,s.setAttribute(U,""),s.textContent="* { pointer-events: auto !important; } body { cursor: pointer !important; }",document.head.appendChild(s)},$=i=>{let s=Q(i),p=tt(i),w=nt(i),v=Z(i),g=getComputedStyle(i),C=y(i);return{elementId:v,sourceElementId:s,selector:p,textExcerpt:it(i.textContent),docRect:{left:C.left+window.scrollX,top:C.top+window.scrollY,width:C.width,height:C.height},viewport:{width:window.innerWidth,height:window.innerHeight},htmlHint:w,tag:i.tagName,childCount:i.children.length,text:i.textContent??"",outerHTML:i.outerHTML,attrs:{src:i.getAttribute(k)??i.getAttribute("src"),alt:i.getAttribute("alt"),href:i.getAttribute("href")},rect:C,styles:{color:g.color,backgroundColor:g.backgroundColor,fontSize:g.fontSize,fontWeight:g.fontWeight,lineHeight:g.lineHeight,letterSpacing:g.letterSpacing,textAlign:g.textAlign,borderTopLeftRadius:g.borderTopLeftRadius,opacity:g.opacity,borderColor:g.borderColor,borderTopWidth:g.borderTopWidth,borderTopStyle:g.borderTopStyle,paddingTop:g.paddingTop,paddingRight:g.paddingRight,paddingBottom:g.paddingBottom,paddingLeft:g.paddingLeft,marginTop:g.marginTop,marginRight:g.marginRight,marginBottom:g.marginBottom,marginLeft:g.marginLeft}}},W=i=>{let s=i.target?.closest?.("a[href]");if(!s)return;let p=(s.getAttribute("href")??"").trim();if(p.startsWith("#")){if(location.href!=="about:srcdoc")return;i.preventDefault();let w=decodeURIComponent(p.slice(1));w?(document.getElementById(w)??document.getElementsByName(w)[0])?.scrollIntoView():window.scrollTo({top:0});return}!p||p.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(p)||(i.preventDefault(),m({type:"open-local-link",href:p}))};window.addEventListener("click",i=>{if(t==="view"){W(i);return}i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();let s=i.target;f(s)&&(r=s,e=null,m({type:"select",element:$(s)}),b())},!0),window.addEventListener("mouseover",i=>{if(t==="view")return;let s=i.target;e=f(s)?s:null,b()},!0),document.addEventListener("mouseleave",()=>{e=null,b()}),window.addEventListener("scroll",b,!0);let D=0;window.addEventListener("scroll",()=>{D||(D=window.setTimeout(()=>{D=0,m({type:"scroll",x:window.scrollX,y:window.scrollY})},100))}),window.addEventListener("resize",b);let P=()=>{new MutationObserver(b).observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),new ResizeObserver(b).observe(document.documentElement)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",P):P(),window.addEventListener("message",i=>{if(i.source!==window.parent||!ct(i.data))return;let s=i.data;switch(s.type){case"hello":m({type:"ready",title:document.title});break;case"set-mode":t=s.mode,t==="view"&&(e=null,r=null),M(),b();break;case"clear-selection":r=null,b();break;case"set-comments":a=Array.isArray(s.comments)?s.comments:[],b();break;case"apply-patches":{let p=!1;try{for(let w of s.patches)p=at(document,w)||p}catch{}r&&!r.isConnected&&(r=null),m({type:"patched",requestId:s.requestId,ok:p,newSource:p?lt(document):void 0}),b();break}case"scroll-to":Number.isFinite(s.x)&&Number.isFinite(s.y)&&window.scrollTo(s.x,s.y);break;case"capture-figma":{let{capture:p,truncated:w}=j(document,{title:document.title||"Artifact"});m({type:"figma-capture",requestId:s.requestId,capture:p,truncated:w});break}}});let G=()=>{M(),m({type:"ready",title:document.title})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",G):G()}Rt();})();
3
+ `,r=t.documentElement.cloneNode(!0);return r.querySelectorAll(`[${Y}]`).forEach(i=>i.remove()),r.querySelectorAll(`[data-od-id^="${L}"]`).forEach(i=>i.removeAttribute("data-od-id")),r.querySelectorAll(`[${ct}]`).forEach(i=>{i.removeAttribute("srcdoc"),i.removeAttribute(ct)}),r.querySelectorAll(`[${B}]`).forEach(i=>{i.setAttribute("src",i.getAttribute(B)),i.removeAttribute(B)}),e+r.outerHTML}var $="od-state-switcher",P="data-od-states-board",gt="data-od-preview-only";function mt(t){return Array.from(t.querySelectorAll("[data-od-state]")).filter(e=>!e.parentElement?.closest("[data-od-state]"))}function X(t){return(t.getAttribute("data-od-state")??"").trim()||"default"}function Nt(t,e){let r=mt(t);t.documentElement.toggleAttribute(P,e==="all");for(let i of r)i.hidden=e==="all"?!1:X(i)!==e}var Ft=`
4
+ #${$}{position:fixed;z-index:2147483646;right:12px;bottom:12px;display:flex;flex-wrap:wrap;gap:4px;max-width:calc(100vw - 24px);padding:4px;border-radius:10px;background:rgba(24,24,27,.92);font:600 12px/1 system-ui,sans-serif;box-shadow:0 4px 16px rgba(0,0,0,.25)}
5
+ #${$} button{all:unset;cursor:pointer;padding:7px 10px;border-radius:7px;color:#e4e4e7}
6
+ #${$} button[aria-pressed="true"]{background:#fafafa;color:#18181b}
7
+ #${$} button:focus-visible{outline:2px solid #60a5fa;outline-offset:1px}
8
+ html[${P}] :has(> [data-od-state]){display:grid !important;grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr));gap:24px;align-items:start}
9
+ html[${P}] [data-od-state]{display:block !important;position:relative;outline:1px dashed rgba(127,127,127,.6);outline-offset:6px;padding-top:28px}
10
+ html[${P}] [data-od-state]::before{content:attr(data-od-state);position:absolute;top:0;left:0;padding:3px 8px;border-radius:5px;background:rgba(24,24,27,.85);color:#fafafa;font:600 12px/1.2 system-ui,sans-serif}
11
+ `;function ft(t){let e=mt(t);if(e.length<2||t.getElementById($))return;let r=e.map(m=>m.hidden),i=X(e.find(m=>!m.hidden)??e[0]),a=t.createElement("style");a.setAttribute(gt,""),a.textContent=Ft,t.head.appendChild(a);let p=t.createElement("div");p.id=$,p.setAttribute(gt,""),p.setAttribute("role","toolbar"),p.setAttribute("aria-label","Design states (preview only)");let h=[...e.map(X),"all"].map(m=>{let w=t.createElement("button");return w.type="button",w.textContent=m==="all"?"All states":m,w.dataset.state=m,w.setAttribute("aria-pressed",String(m===i)),w.addEventListener("click",()=>{Nt(t,m);for(let x of h)x.setAttribute("aria-pressed",String(x===w))}),w});return p.append(...h),t.body.appendChild(p),()=>{t.documentElement.removeAttribute(P),e.forEach((m,w)=>m.hidden=r[w]);for(let m of h)m.setAttribute("aria-pressed",String(m.dataset.state===i))}}var _t=["iphone","android","tablet","desktop-app"];function ht(t){let e=t("data-od-device")?.trim().toLowerCase();if(!e||!_t.includes(e))return;let r={device:e};e==="tablet"&&(r.orientation=t("data-od-orientation")?.toLowerCase()==="portrait"?"portrait":"landscape"),e==="desktop-app"&&(r.window=t("data-od-window")?.toLowerCase()==="windows"?"windows":"mac");let i=t("data-od-theme")?.toLowerCase();return(i==="light"||i==="dark")&&(r.theme=i),r}var Z="bridge";function bt(t){return typeof t=="object"&&t!==null&&t.od===Z&&typeof t.type=="string"}var yt="od-bridge-pick";function Mt(){if(window.__odPreviewBridge||window.parent===window)return;window.__odPreviewBridge=!0;let t="view",e=null,r=null,i=[],a=0,p,g=s=>{window.parent.postMessage({od:Z,...s},"*")},h=s=>{let d=s.getBoundingClientRect();return{left:d.left,top:d.top,width:d.width,height:d.height}},m=s=>{if(!s||!s.isConnected)return!1;let d=s.tagName.toLowerCase();if(d==="html"||d==="body")return!1;let b=s.getBoundingClientRect();return b.width>0&&b.height>0},w=()=>{a=0,t!=="view"&&g({type:"rects",hover:m(e)&&e!==r?h(e):null,selection:m(r)?h(r):null,pins:t==="comment"?i.filter(s=>s.status!=="resolved").map(s=>{let d=dt(document,s);return{commentId:s.id,rect:d?h(d):null}}):[]})},x=()=>{a||(a=requestAnimationFrame(w))},O=()=>{let s=document.getElementById(yt);if(t==="view"){s?.remove();return}if(s||!document.head)return;let d=document.createElement("style");d.id=yt,d.setAttribute(Y,""),d.textContent="* { pointer-events: auto !important; } body { cursor: pointer !important; }",document.head.appendChild(d)},z=s=>{let d=nt(s),b=it(s),v=st(s),T=rt(s),f=getComputedStyle(s),R=h(s);return{elementId:T,sourceElementId:d,selector:b,textExcerpt:lt(s.textContent),docRect:{left:R.left+window.scrollX,top:R.top+window.scrollY,width:R.width,height:R.height},viewport:{width:window.innerWidth,height:window.innerHeight},htmlHint:v,tag:s.tagName,childCount:s.children.length,text:s.textContent??"",outerHTML:s.outerHTML,attrs:{src:s.getAttribute(B)??s.getAttribute("src"),alt:s.getAttribute("alt"),href:s.getAttribute("href")},rect:R,styles:{color:f.color,backgroundColor:f.backgroundColor,fontSize:f.fontSize,fontWeight:f.fontWeight,lineHeight:f.lineHeight,letterSpacing:f.letterSpacing,textAlign:f.textAlign,borderTopLeftRadius:f.borderTopLeftRadius,opacity:f.opacity,borderColor:f.borderColor,borderTopWidth:f.borderTopWidth,borderTopStyle:f.borderTopStyle,paddingTop:f.paddingTop,paddingRight:f.paddingRight,paddingBottom:f.paddingBottom,paddingLeft:f.paddingLeft,marginTop:f.marginTop,marginRight:f.marginRight,marginBottom:f.marginBottom,marginLeft:f.marginLeft}}},V=s=>{let d=s.target?.closest?.("a[href]");if(!d)return;let b=(d.getAttribute("href")??"").trim();if(b.startsWith("#")){if(location.href!=="about:srcdoc")return;s.preventDefault();let v=decodeURIComponent(b.slice(1));v?(document.getElementById(v)??document.getElementsByName(v)[0])?.scrollIntoView():window.scrollTo({top:0});return}!b||b.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(b)||(s.preventDefault(),g({type:"open-local-link",href:b}))};window.addEventListener("click",s=>{if(t==="view"){V(s);return}s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation();let d=s.target;m(d)&&(r=d,e=null,g({type:"select",element:z(d)}),x())},!0),window.addEventListener("mouseover",s=>{if(t==="view")return;let d=s.target;e=m(d)?d:null,x()},!0),document.addEventListener("mouseleave",()=>{e=null,x()}),window.addEventListener("scroll",x,!0);let N=0;window.addEventListener("scroll",()=>{N||(N=window.setTimeout(()=>{N=0,g({type:"scroll",x:window.scrollX,y:window.scrollY})},100))}),window.addEventListener("resize",x);let G=()=>{new MutationObserver(x).observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),new ResizeObserver(x).observe(document.documentElement)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",G):G(),window.addEventListener("message",s=>{if(s.source!==window.parent||!bt(s.data))return;let d=s.data;switch(d.type){case"hello":g({type:"ready",title:document.title,device:xt()});break;case"set-mode":t=d.mode,t==="view"&&(e=null,r=null),O(),x();break;case"clear-selection":r=null,x();break;case"set-comments":i=Array.isArray(d.comments)?d.comments:[],x();break;case"apply-patches":{let b=!1;try{for(let v of d.patches)b=ut(document,v)||b}catch{}r&&!r.isConnected&&(r=null),p?.(),g({type:"patched",requestId:d.requestId,ok:b,newSource:b?pt(document):void 0}),x();break}case"scroll-to":Number.isFinite(d.x)&&Number.isFinite(d.y)&&window.scrollTo(d.x,d.y);break;case"capture-figma":{let{capture:b,truncated:v}=Q(document,{title:document.title||"Artifact"});g({type:"figma-capture",requestId:d.requestId,capture:b,truncated:v});break}}});let H=()=>{O(),p??(p=ft(document)),g({type:"ready",title:document.title,device:xt()})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H):H()}function xt(){let t=document.body;if(!t)return;let e=ht(g=>t.getAttribute(g));if(!e)return;let r=g=>!g||g==="transparent"||/^rgba\(0, 0, 0, 0\)$/.test(g),i=getComputedStyle(t).backgroundColor,a=getComputedStyle(document.documentElement).backgroundColor,p=r(i)?r(a)?void 0:a:i;return p?{...e,background:p}:e}Mt();})();