Files
ONE-OS/axhub-make/admin/assets/chunks/index4.js
王冕 a27e3b8e43 feat: sync full workspace including web modules, docs, and configurations to Gitea
Optimized the root .gitignore to exclude virtual environments, node modules,
and temp folders to ensure clean and lightweight version tracking.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 18:12:25 +08:00

19 lines
50 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunks/vendor-common.js","assets/chunks/vendor-react.js","assets/chunks/_commonjsHelpers.js","assets/chunks/preload-helper.js","assets/chunks/_commonjs-dynamic-modules.js"])))=>i.map(i=>d[i]);
import{g as O,p as bt,a as st,b as Lt,c as Tt,d as P,e as Y,f as k,n as Ct,h as It}from"./fills-generator.js?v=1775123024591";import{_ as Rt}from"./preload-helper.js?v=1775123024591";const yt=t=>{for(const n of Array.from(t.querySelectorAll("use")))try{const e=n.href.baseVal,i=document.querySelector(e);i&&(n.outerHTML=i.innerHTML)}catch(e){console.warn("Error querying <use> tag href",e)}},At=["display","visibility","opacity","fill","fillOpacity","fillRule","stroke","strokeWidth","strokeLinecap","strokeLinejoin","strokeOpacity","strokeDasharray","strokeDashoffset","fontFamily","fontSize","fontWeight","fontStyle","textAnchor","dominantBaseline","transform","filter","mixBlendMode","color"];function _t(t){const n=t.style,e=[];for(const o of At){const s=n[o];if(s&&s.trim()!==""){const a=o.replace(/([A-Z])/g,"-$1").toLowerCase();o==="fill"&&(s==="rgb(0, 0, 0)"||s==="black")||o==="stroke"&&s==="none"||o==="strokeWidth"&&s==="1px"||o==="opacity"&&s==="1"||o==="display"&&s==="block"||o==="visibility"&&s==="visible"||e.push(`${a}:${s}`)}}return e.join(";")}function Mt(t){const n=t.outerHTML.length;function e(o){const s=_t(o);o.removeAttribute("style"),s&&o.setAttribute("style",s);for(const a of o.children)e(a)}return e(t),(t.outerHTML.length/n*100).toFixed(1),t.outerHTML}async function Nt(t){try{const n=t.cloneNode(!0);return Mt(n)}catch(n){return console.warn("⚠️ [SVG压缩] 样式清理失败使用原始SVG:",n),t.outerHTML}}function Ft(t){if(!(t instanceof SVGSVGElement))throw new Error("需要传入一个 <svg> 元素");const n=t.getBoundingClientRect();return{x:n.left,y:n.top,width:n.width,height:n.height}}const St=async t=>{const n=Ft(t);return{type:"SVG",svg:await Nt(t),x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)}};function Ht(t){const n=t.getBoundingClientRect();return{...n,documentX:n.left+window.scrollX,documentY:n.top+window.scrollY,left:n.left,top:n.top,right:n.right,bottom:n.bottom,width:n.width,height:n.height,x:n.x,y:n.y}}const at=({computedStyle:t,element:n=null})=>{let e=0,i=0;if(n){const d=n.getBoundingClientRect();e=d.width,i=d.height}const o=P(t.borderTopLeftRadius,e,i),s=P(t.borderTopRightRadius,e,i),a=P(t.borderBottomRightRadius,e,i),r=P(t.borderBottomLeftRadius,e,i);return Object.assign(Object.assign(Object.assign(Object.assign({},o?{topLeftRadius:o.value}:{}),s?{topRightRadius:s.value}:{}),a?{bottomRightRadius:a.value}:{}),r?{bottomLeftRadius:r.value}:{})},Ot=t=>{if(!t)return!1;const n=O(t);return n?(typeof n.a=="number"?n.a:1)>0:!1},Dt=({borderWidth:t,borderType:n,borderColor:e})=>t&&t!=="0"&&n!=="none"&&Ot(e);function Gt(t){const n={top:t.borderTop,right:t.borderRight,bottom:t.borderBottom,left:t.borderLeft};if(!Object.values(n).some(a=>a&&a!=="none"))return{consistent:!1,borderInfo:null};const i={};for(const[a,r]of Object.entries(n))if(r&&r!=="none"){const l=r.match(/^([\d\.]+)px\s*(\w+)\s*(.*)$/);if(l){const[d,f,u,p]=l;i[a]={borderWidth:f,borderType:u,borderColor:p}}}else i[a]={borderWidth:"0",borderType:"none",borderColor:"transparent"};const o=Object.values(i).find(a=>a.borderWidth!=="0");return o?{consistent:Object.values(i).every(a=>a.borderWidth===o.borderWidth&&a.borderType===o.borderType&&a.borderColor===o.borderColor),borderInfo:o}:{consistent:!1,borderInfo:null}}const Bt=({computedStyle:t})=>{if(t.border&&t.border!=="none"){const i=t.border.match(/^([\d\.]+)px\s*(\w+)\s*(.*)$/);if(i){const[o,s,a,r]=i;if(Dt({borderWidth:s,borderType:a,borderColor:r})){const l=O(r);if(l)return{strokes:[{type:"SOLID",color:{r:l.r,b:l.b,g:l.g},opacity:typeof l.a=="number"?l.a:1}],strokeWeight:Math.round(parseFloat(s))}}}}const{consistent:n,borderInfo:e}=Gt(t);if(n&&e){const i=O(e.borderColor);if(i)return{strokes:[{type:"SOLID",color:{r:i.r,b:i.b,g:i.g},opacity:typeof i.a=="number"?i.a:1}],strokeWeight:Math.round(parseFloat(e.borderWidth))}}return null},Z=t=>t?{r:t.r,g:t.g,b:t.b,a:t.a!==void 0?t.a:1}:null,J=t=>{const n=t.mixBlendMode;return{normal:"NORMAL",multiply:"MULTIPLY",screen:"SCREEN",overlay:"OVERLAY",darken:"DARKEN",lighten:"LIGHTEN","color-dodge":"COLOR_DODGE","color-burn":"COLOR_BURN","hard-light":"HARD_LIGHT","soft-light":"SOFT_LIGHT",difference:"DIFFERENCE",exclusion:"EXCLUSION",hue:"HUE",saturation:"SATURATION",color:"COLOR",luminosity:"LUMINOSITY"}[n]||"NORMAL"},vt=({computedStyle:t})=>{const n=[];return t.boxShadow&&t.boxShadow!=="none"&&bt(t.boxShadow).forEach(i=>{const o=O(i.color);if(o){const s=Z(o),a=J(t);i.inset?n.push({type:"INNER_SHADOW",color:s,offset:{x:i.offsetX,y:i.offsetY},radius:i.blurRadius,spread:i.spreadRadius||0,visible:!0,blendMode:a}):n.push({type:"DROP_SHADOW",color:s,offset:{x:i.offsetX,y:i.offsetY},radius:i.blurRadius,spread:i.spreadRadius||0,visible:!0,blendMode:a})}}),t.textShadow&&t.textShadow!=="none"&&st(t.textShadow).forEach(i=>{const o=O(i.color);if(o){const s=Z(o),a=J(t);n.push({type:"DROP_SHADOW",color:s,offset:{x:i.offsetX,y:i.offsetY},radius:i.blurRadius,spread:0,visible:!0,blendMode:a})}}),t.filter&&t.filter!=="none"&&Lt(t.filter).forEach(i=>{i.type==="LAYER_BLUR"&&n.push({type:"LAYER_BLUR",radius:i.radius,visible:!0})}),t.backdropFilter&&t.backdropFilter!=="none"&&Tt(t.backdropFilter).forEach(i=>{i.type==="BACKGROUND_BLUR"&&n.push({type:"BACKGROUND_BLUR",radius:i.radius,visible:!0})}),n.length>0?n:void 0};function kt(t){const n=t.zIndex;return n==="auto"||n===""||isNaN(parseInt(n))?0:parseInt(n)}function Wt(t){return t.parentElement?Array.from(t.parentElement.children).indexOf(t):0}function z(t,n,e,i){if(!n||!e||!i)return;const o=kt(e),s=Wt(n),a=n.parentElement;t._sortingCache={zIndex:o,elementIndex:s,parentElement:a,originalElement:n}}function Pt(t,n){const e=t._sortingCache,i=n._sortingCache;return!e||!i?(console.warn("⚠️ [compareLayers] 图层缺少排序缓存,跳过排序"),0):e.parentElement===i.parentElement&&e.zIndex!==i.zIndex?e.zIndex-i.zIndex:0}function Ut(t){if(!t||t.length<=1)return t;const n=t.map((e,i)=>({layer:e,originalIndex:i}));return n.sort((e,i)=>{const o=e.layer._sortingCache,s=i.layer._sortingCache;if(!o||!s)return e.originalIndex-i.originalIndex;const a=Pt(e.layer,i.layer);return a!==0?a:e.originalIndex-i.originalIndex}),n.map(e=>e.layer)}function Vt(t){if(!t||!Array.isArray(t))return console.warn("⚠️ [cleanLayersSortingCache] layers 不是数组"),t;const n=e=>(!e||typeof e!="object"||(e._sortingCache&&delete e._sortingCache,e.children&&Array.isArray(e.children)&&e.children.forEach(i=>n(i))),e);return t.forEach(e=>n(e)),t}function zt(t){if(!t||!Array.isArray(t))return console.warn("⚠️ [cleanLayersDebugProperties] layers 不是数组"),t;const n=e=>(!e||typeof e!="object"||(e._sortingCache&&delete e._sortingCache,e._debug&&delete e._debug,e._tempRef&&delete e._tempRef,e.children&&Array.isArray(e.children)&&e.children.forEach(i=>n(i))),e);return t.forEach(e=>n(e)),t}function ct(t){return!t||!Array.isArray(t)?t:Ut(t).map(i=>i&&typeof i=="object"&&i.children&&Array.isArray(i.children)?{...i,children:ct(i.children)}:i)}function $(t){const n=ct(t);return Vt(n)}const Xt=t=>typeof t=="symbol"?null:JSON.parse(JSON.stringify(t));function jt(t,n,e){const i=e.parentElement;if(!i)return;const o=window.getComputedStyle(i),s=o.display;if(!(s==="flex"||s==="inline-flex"||s==="grid"||s==="inline-grid"))return;if((parseFloat(n.flexGrow)||0)>0){t.layoutGrow=1;const f=o.flexDirection||"row";(s==="flex"||s==="inline-flex")&&(f==="row"||f==="row-reverse"?(t.layoutSizingHorizontal="FILL",t.layoutSizingVertical="HUG"):(t.layoutSizingHorizontal="HUG",t.layoutSizingVertical="FILL"))}const l=n.alignSelf||"auto";l==="stretch"?t.layoutAlign="STRETCH":l!=="auto"&&(t.layoutAlign="INHERIT");const d=n.position;(d==="absolute"||d==="fixed")&&(t.layoutPositioning="ABSOLUTE")}const lt=t=>{if(typeof t!="string")return"";const n=t.split(",").map(o=>o.trim().replace(/^['"]+|['"]+$/g,"").trim()).filter(Boolean);if(n.length===0)return"";const e=[],i=new Set;for(const o of n){const s=o.toLowerCase();i.has(s)||(i.add(s),e.push(o))}return e.join(", ")},Yt=t=>{if(!Array.isArray(t)||t.length===0)return 0;const n=t.filter(o=>o&&o.width>0&&o.height>0).sort((o,s)=>o.top-s.top);if(n.length===0)return 0;const e=[],i=1;for(const o of n)e.some(s=>Math.abs(s-o.top)<=i)||e.push(o.top);return e.length},$t=(t,n)=>{const e=/[\r\n]/.test(t||"");return n>1&&!e?"HEIGHT":"WIDTH_AND_HEIGHT"},qt=async({node:t})=>{const e=(t.textContent||"").replace(/\s+/g," "),i=e.trim();if(!Jt(i))return;if(t.parentElement){const s=t.nodeType===Node.TEXT_NODE?t.parentElement:t;if(!s||s.nodeType!==Node.ELEMENT_NODE||tn(s))return;const a=document.createRange();a.selectNode(t);const r=Array.from(a.getClientRects()),l=Xt(a.getBoundingClientRect());if(a.detach(),!Qt(l))return;const d=Yt(r),f=$t(i,d),u={x:Math.round(l.left),y:Math.round(l.top),type:"TEXT",characters:e,width:Math.max(1,Math.round(l.width)),height:Math.round(l.height),textAutoResize:f},p=window.getComputedStyle(s);let g;if(p.length>0)g=await Kt(u,p,s);else{const c=getComputedStyle(s);g=await Zt(u,c,s)}if(g){const c=getComputedStyle(s);z(g,t,c,l),jt(g,c,s)}return g}};async function Kt(t,n,e){const i={...t};if(dt(n)){const r=await Y(n,e,{includeImageFills:!1,includeBackgroundColor:!0,includeComplexBackgrounds:!0});r.length>0&&(i.fills=r)}else if(n.color){const r=O(n.color);r&&(i.fills=[{type:"SOLID",color:{r:r.r,g:r.g,b:r.b},opacity:r.a||1}])}if((!i.fills||i.fills.length===0)&&(i.fills=[{type:"SOLID",color:{r:0,g:0,b:0},opacity:1}]),n.opacity&&(i.opacity=parseFloat(n.opacity)),n.fontFamily){const r=lt(n.fontFamily);r&&(i.fontFamily=r)}if(n.fontSize){const r=parseFloat(n.fontSize);isNaN(r)||(i.fontSize=Math.round(r))}if(n.fontWeight&&(i.fontWeight=Math.round(n.fontWeight)),n.textAlign){const r=n.textAlign;["left","center","right","justified"].includes(r)&&(i.textAlignHorizontal=r.toUpperCase())}if(["left","center","right","justified"].includes(n.textAlign)&&(i.textAlignHorizontal=n.textAlign.toUpperCase()),n.textDecoration){const r=n.textDecoration;r.includes("underline")?i.textDecoration="UNDERLINE":r.includes("line-through")&&(i.textDecoration="STRIKETHROUGH")}if(ut(e,n)&&n.lineHeight&&n.lineHeight!=="normal"){const r=parseFloat(n.fontSize),l=n.lineHeight==="normal"?r*1.2:parseFloat(n.lineHeight);if(!gt({fontSize:r,lineHeightPx:l,measuredHeight:t.height,text:i.characters||e.textContent||"",tagName:e.tagName,whiteSpace:n.whiteSpace||"normal"})){const f=k(n.lineHeight);f&&(i.lineHeight=f)}}if(n.letterSpacing&&n.letterSpacing!=="normal"){const r=k(n.letterSpacing);r&&(i.letterSpacing=r)}const a=ft(n);return a.length>0&&(i.effects=a),i}function dt(t){const n=t.background&&(t.background.includes("linear-gradient")||t.background.includes("radial-gradient")||t.background.includes("conic-gradient")),e=t.backgroundClip==="text"||t.webkitBackgroundClip==="text",i=t.backgroundImage&&(t.backgroundImage.includes("linear-gradient")||t.backgroundImage.includes("radial-gradient")||t.backgroundImage.includes("conic-gradient"));return n&&e||i&&e}function ft(t){const n=[];return t.textShadow&&t.textShadow!=="none"&&st(t.textShadow).forEach(i=>{const o=O(i.color);if(o){const s={r:o.r,g:o.g,b:o.b,a:o.a||1};n.push({type:"DROP_SHADOW",color:s,offset:{x:i.offsetX,y:i.offsetY},radius:i.blurRadius,spread:0,visible:!0,blendMode:"NORMAL"})}}),n}async function Zt(t,n,e){if(dt(n)){const c=await Y(n,e,{includeImageFills:!1,includeBackgroundColor:!0,includeComplexBackgrounds:!0});c.length>0&&(t.fills=c)}else if(n.color){const c=O(n.color);c&&(t.fills=[{type:"SOLID",color:{r:c.r,g:c.g,b:c.b},opacity:c.a||1}])}(!t.fills||t.fills.length===0)&&(t.fills=[{type:"SOLID",color:{r:0,g:0,b:0,a:1},opacity:1}]);const o=k(n.letterSpacing);o&&(t.letterSpacing=o);const s=ut(e,n),a=parseFloat(n.fontSize),r=n.lineHeight==="normal"?a*1.2:parseFloat(n.lineHeight),l=gt({fontSize:a,lineHeightPx:r,measuredHeight:t.height,text:t.characters||e.textContent||"",tagName:e.tagName,whiteSpace:n.whiteSpace||"normal"}),d=s&&!l?k(n.lineHeight):null;d&&(t.lineHeight=d);const{textTransform:f}=n;switch(f){case"uppercase":{t.textCase="UPPER";break}case"lowercase":{t.textCase="LOWER";break}case"capitalize":{t.textCase="TITLE";break}}const u=k(n.fontSize);if(u&&(t.fontSize=Math.round(u.value)),n.fontFamily){const c=lt(n.fontFamily);c&&(t.fontFamily=c)}["underline","strikethrough"].includes(n.textDecoration)&&(t.textDecoration=n.textDecoration.toUpperCase()),["left","center","right","justified"].includes(n.textAlign)&&(t.textAlignHorizontal=n.textAlign.toUpperCase());const p=ft(n);p.length>0&&(t.effects=p);const g=at({computedStyle:n,element:e});return Object.assign(t,g),t}function Jt(t){return!(!t||t.length===0||/^\s+$/.test(t))}function Qt(t){return!(t.width<=0||t.height<=0||t.height<3||t.width<.5||t.width>1e4||t.height>1e4)}function tn(t){if(["SCRIPT","STYLE","NOSCRIPT","META","LINK","TITLE","HEAD","HTML","BODY","FRAMESET","FRAME","IFRAME"].includes(t.tagName))return!0;const e=window.getComputedStyle(t);return e.display==="none"||e.visibility==="hidden"||t.children.length===0&&(!t.textContent||t.textContent.trim().length===0)}function ut(t,n){const e=t.tagName.toUpperCase(),i=n||getComputedStyle(t);if(e==="BUTTON"||e==="INPUT"||e==="SELECT"||e==="TEXTAREA")return!1;const o=t.textContent;if(!o||o.trim().length===0||!o.includes(`
`)&&i.whiteSpace!=="normal"&&i.whiteSpace!=="pre-wrap"||i.display==="inline-flex"||i.display==="flex")return!1;const a=parseFloat(i.fontSize);if(Number.isNaN(a))return!1;const r=i.lineHeight==="normal"?a*1.2:parseFloat(i.lineHeight);return!(Number.isNaN(r)||Math.abs(r-a)<1)}function gt(t){const{fontSize:n,lineHeightPx:e,measuredHeight:i,text:o,tagName:s,whiteSpace:a}=t,r=(s||"").toUpperCase();if(r==="BUTTON"||r==="INPUT"||r==="SELECT"||r==="TEXTAREA")return!0;if(!n||!e||!i)return!1;const l=!o.includes(`
`)&&a!=="pre-wrap",d=e/n,f=i/e;return!!(l&&(d>2.5&&f<.7||d>2&&f<.9))}function ht(t){if(!t||!(t instanceof Element))return"";if(typeof t.getAttribute=="function"){const e=t.getAttribute("class");if(typeof e=="string")return e.trim()}const n=t.className;return typeof n=="string"?n.trim():n&&typeof n.baseVal=="string"?n.baseVal.trim():n&&typeof n.animVal=="string"?n.animVal.trim():""}function Q(t,n){if(!t||!(t instanceof Element))return;const e=typeof n=="string"?n.trim():"";if(e){t.setAttribute("class",e);return}t.removeAttribute("class")}function nn(t){if(!t)return!1;const n=t.overflow,e=t.overflowX,i=t.overflowY;return n==="hidden"||n==="clip"||e==="hidden"||e==="clip"||i==="hidden"||i==="clip"}function tt(t,n,e,i=!1){var I;if(!t||t.length===0)return null;if(t.length===1)return t[0];const o=t.find(w=>w&&w.type==="RECTANGLE"&&w._sortingCache&&w._sortingCache.originalElement===e)||null,s=t.some(w=>w&&w._sortingCache&&w._sortingCache.originalElement),a=$(t);let r=1/0,l=1/0,d=-1/0,f=-1/0;if(a.forEach(w=>{w.x!==void 0&&w.y!==void 0&&(r=Math.min(r,w.x),l=Math.min(l,w.y),d=Math.max(d,w.x+(w.width||0)),f=Math.max(f,w.y+(w.height||0)))}),r===1/0||l===1/0)return a[0];const u=i?"FRAME":"GROUP";let p=!1;if(i&&e)try{const w=window.getComputedStyle(e),x=w.overflowX,m=w.overflowY,b=w.overflow;p=x==="hidden"||m==="hidden"||b==="hidden"||x==="clip"||m==="clip"||b==="clip"}catch{p=!1}const g={type:u,name:n||u,x:r,y:l,width:d-r,height:f-l,children:[],clipsContent:p};let c=-1;const h=o||(s?null:a[0]);if(h&&h.type==="RECTANGLE"&&i){const w=h.width||0,x=h.height||0,m=g.width,b=g.height,C=((I=e==null?void 0:e.getBoundingClientRect)==null?void 0:I.call(e))||null,R=!!C&&Math.abs(h.width-C.width)<=2&&Math.abs(h.height-C.height)<=2&&Math.abs(h.x-C.x)<=2&&Math.abs(h.y-C.y)<=2,L=!!o&&h===o;Math.abs(h.x-r)<1&&Math.abs(h.y-l)<1&&Math.abs(w-m)<1&&Math.abs(x-b)<1&&(L||R)&&(c=0,h.fills&&(g.fills=h.fills),h.strokes&&(g.strokes=h.strokes),h.strokeWeight&&(g.strokeWeight=h.strokeWeight),h.strokeAlign&&(g.strokeAlign=h.strokeAlign),h.effects&&(g.effects=h.effects),h.opacity!==void 0&&(g.opacity=h.opacity),h.blendMode&&(g.blendMode=h.blendMode),h.cornerRadius!==void 0&&(g.cornerRadius=h.cornerRadius),h.topLeftRadius!==void 0&&(g.topLeftRadius=h.topLeftRadius),h.topRightRadius!==void 0&&(g.topRightRadius=h.topRightRadius),h.bottomLeftRadius!==void 0&&(g.bottomLeftRadius=h.bottomLeftRadius),h.bottomRightRadius!==void 0&&(g.bottomRightRadius=h.bottomRightRadius))}if(g.children=a.filter((w,x)=>x!==c).map(w=>w.x!==void 0&&w.y!==void 0?{...w,x:w.x-r,y:w.y-l}:w),e){const w=e.getBoundingClientRect();z(g,e,e.style,w)}return g}async function nt(t){const n=[],e=o=>(o||"").replace(/\s+/g," ").trim(),i=new Set;for(let o=0;o<t.childNodes.length;o++){const s=t.childNodes[o];if(s.nodeType===Node.TEXT_NODE){const a=s.textContent||"";if(!a||a.trim().length===0)continue;const r=await qt({node:s});if(r){const d=[e(r.characters||a),typeof r.x=="number"?Math.round(r.x):0,typeof r.y=="number"?Math.round(r.y):0,typeof r.width=="number"?Math.round(r.width):0,typeof r.height=="number"?Math.round(r.height):0].join("|");if(i.has(d))continue;i.add(d),n.push(r)}}}return n}function en(t,n){const e=s=>s.display==="none"||s.visibility==="hidden"||s.opacity==="0",i=s=>{if(!s||typeof s!="object")return!1;if(typeof s.hasAttribute=="function"){if(s.hasAttribute("hidden"))return!0;const a=s.getAttribute("aria-hidden");if(typeof a=="string"&&a.toLowerCase()==="true")return!0}return!!(s.classList&&(s.classList.contains("is-hidden")||s.classList.contains("hidden")||s.classList.contains("ant-table-measure-row")))};if(e(t)||i(n))return!0;let o=n==null?void 0:n.parentElement;for(;o;){const s=getComputedStyle(o);if(e(s)||i(o)||s.overflow!=="visible"&&o.getBoundingClientRect().height<1)return!0;o=o.parentElement}return!1}function pt(t,n){if(n.backgroundClip==="text"||n.webkitBackgroundClip==="text")return!1;const e=n.backgroundColor!=="rgba(0, 0, 0, 0)"&&n.backgroundColor!=="transparent"||n.borderWidth!=="0px"&&n.borderWidth!==""||n.boxShadow!=="none"&&n.boxShadow!==""||n.borderRadius!=="0px"&&n.borderRadius!==""||n.opacity!=="1"&&n.opacity!==""||n.transform!=="none"&&n.transform!==""&&n.transform!=="matrix(1, 0, 0, 1, 0, 0)"||n.filter!=="none"&&n.filter!==""||n.backdropFilter!=="none"&&n.backdropFilter!=="",i=n.padding!=="0px"&&n.padding!==""||n.margin!=="0px"&&n.margin!==""||n.width!=="auto"&&n.width!==""||n.height!=="auto"&&n.height!=="",o=n.backgroundImage!=="none"&&n.backgroundImage!=="";return e||i||o}function on(t){function n(e){if(e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.TEXT_NODE)return null;const i=e.shadowRoot?Array.from(e.shadowRoot.childNodes):[],s=[...Array.from(e.childNodes),...i];return{type:e.nodeType===Node.ELEMENT_NODE?"element":"text",el:e,children:s.map(a=>n(a)).filter(Boolean)}}return n(t)}function v(t,n=!1){const e=t.tagName.toLowerCase();if(n&&t.hasAttribute("data-label")){const s=t.getAttribute("data-label");if(s&&s.trim())return`${e}.${s.trim()}`}if(t.id&&t.id.trim())return`${e}.${t.id.trim()}`;const i=ht(t),o=i?i.split(/\s+/)[0]:null;return o?`${e}.${o}`:e}async function rn(t,n=!1,e=!1){const i=[];if(t instanceof SVGSVGElement){if(t.id!=="snapdom-injected-svg"){const f=await St(t);i.push(f)}return i}else if(t instanceof SVGElement)return i;if(t.parentElement instanceof HTMLPictureElement&&t instanceof HTMLSourceElement||t instanceof HTMLPictureElement)return i;const o=window.getComputedStyle(t),s=["absolute","fixed"].includes(o.position),a=e&&nn(o);if(en(o,t))return i;let r=!1;if(pt(t,o)?r=!0:r=(t instanceof HTMLImageElement||t instanceof HTMLVideoElement)&&o.display!=="none",r){const f=Ht(t);if(f.width>=1&&f.height>=1){const u=await Y(o,t),p=o.borderWidth!=="0px"&&o.borderWidth!=="",g=o.boxShadow!=="none"&&o.boxShadow!=="",c=o.borderRadius!=="0px"&&o.borderRadius!=="",h=o.opacity!=="1"&&o.opacity!=="",I=o.transform!=="none"&&o.transform!=="",w=(parseFloat(o.paddingTop)||0)>0||(parseFloat(o.paddingRight)||0)>0||(parseFloat(o.paddingBottom)||0)>0||(parseFloat(o.paddingLeft)||0)>0||(parseFloat(o.paddingInlineStart)||0)>0||(parseFloat(o.paddingInlineEnd)||0)>0||(parseFloat(o.paddingBlockStart)||0)>0||(parseFloat(o.paddingBlockEnd)||0)>0;if(u.length===0&&!p&&!g&&!c&&!h&&!I&&!w){const R=await nt(t);return i.push(...R),i.length>1?[tt(i,v(t,n),t,e)]:i}const x={type:"RECTANGLE",name:v(t,n),x:Math.round(f.left),y:Math.round(f.top),width:Math.round(f.width),height:Math.round(f.height),fills:u};if(s&&(x.layoutPositioning="ABSOLUTE"),z(x,t,o,f),!Ct(o)){const R=Bt({computedStyle:o});R&&Object.assign(x,R)}(t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof SVGSVGElement)&&(x.name=v(t,n));const b=vt({computedStyle:o});b&&(x.effects=b);const C=at({computedStyle:o,element:t});Object.assign(x,C),i.push(x)}}const d=await nt(t);if(i.push(...d),i.length>1){const f=tt(i,v(t,n),t,e);if(s&&f&&(f.layoutPositioning="ABSOLUTE"),(parseFloat(o.flexGrow)||0)>0&&!a){f.layoutGrow=1;const p=t.parentElement?window.getComputedStyle(t.parentElement).display:"",g=t.parentElement?window.getComputedStyle(t.parentElement).flexDirection:"";(p==="flex"||p==="inline-flex")&&(g==="row"||g==="row-reverse"?(f.layoutSizingHorizontal="FILL",f.layoutSizingVertical="HUG"):(f.layoutSizingHorizontal="HUG",f.layoutSizingVertical="FILL"))}return[f]}if(i.length===1&&(s&&(i[0].layoutPositioning="ABSOLUTE"),(parseFloat(o.flexGrow)||0)>0&&!a)){i[0].layoutGrow=1;const u=t.parentElement?window.getComputedStyle(t.parentElement).display:"",p=t.parentElement?window.getComputedStyle(t.parentElement).flexDirection:"";(u==="flex"||u==="inline-flex")&&(p==="row"||p==="row-reverse"?(i[0].layoutSizingHorizontal="FILL",i[0].layoutSizingVertical="HUG"):(i[0].layoutSizingHorizontal="HUG",i[0].layoutSizingVertical="FILL"))}return i}const M=!1;function sn(t){try{if(t&&t!==document.body&&t!==document.documentElement){const w=t.getBoundingClientRect(),x=t.scrollWidth,m=t.scrollHeight,b=t.clientWidth,C=t.clientHeight,R=Math.max(w.width,x,b),L=Math.max(w.height,m,C);if(R>0&&L>0)return{width:R,height:L}}const n=document.documentElement.scrollWidth,e=document.documentElement.scrollHeight,i=document.body.scrollWidth,o=document.body.scrollHeight,s=t?t.querySelectorAll("*"):document.querySelectorAll("body *");let a=0,r=0,l=1/0,d=1/0;s.forEach(w=>{if(w.offsetParent===null)return;const x=w.getBoundingClientRect();if(x.width===0&&x.height===0)return;const m=x.left+window.scrollX,b=x.top+window.scrollY,C=x.right+window.scrollX,R=x.bottom+window.scrollY;C>0&&R>0&&(a=Math.max(a,C),r=Math.max(r,R),l=Math.min(l,m),d=Math.min(d,b))});const f=document.body.getBoundingClientRect(),u=f.width,p=f.height,g=a-(l===1/0?0:l),c=r-(d===1/0?0:d),h=Math.max(n,i,g,u),I=Math.max(e,o,c,p);if(h<=0||I<=0)throw new Error("主要方法计算出无效尺寸");return{width:h,height:I}}catch{const e=window.innerWidth,i=window.innerHeight,o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,a=document.body.clientWidth,r=document.body.clientHeight,l=Math.max(e,o,a),d=Math.max(i,s,r);return{width:l,height:d}}}async function an(t={}){const{targetElement:n,filter:e}=t;try{const i=n||document.body,o=sn(i),s=o.width,a=o.height,{snapdom:r}=await Rt(async()=>{const{snapdom:b}=await import("./vendor-common.js?v=1775123024591").then(C=>C.dj);return{snapdom:b}},__vite__mapDeps([0,1,2,3,4])),l=i.querySelectorAll("img"),d=Array.from(l).filter(b=>b.src.startsWith("data:")),f=Date.now(),u=await r.toBlob(i,{fast:!0,embedFonts:!0,scale:1,dpr:1,format:"svg",filter:typeof e=="function"?e:void 0}),p=Date.now()-f,g=await u.text(),h=new DOMParser().parseFromString(g,"image/svg+xml"),I=h.documentElement;if(I.tagName.toLowerCase()!=="svg")throw console.error("❌ [generatePageSvg] 解析的不是有效的 SVG:",I.tagName),new Error("解析的SVG无效");const w=I.getAttribute("width"),x=I.getAttribute("height"),m=I.getAttribute("viewBox");return{svgBlob:u,svgText:g,svgDoc:h,svgRoot:I,pageWidth:s,pageHeight:a}}catch(i){throw console.error("❌ [generatePageSvg] SVG生成失败:",i),console.error("❌ [generatePageSvg] 错误堆栈:",i.stack),i}}function cn(t){try{const n=t.svgRoot.cloneNode(!0);n.style.cssText=`
position: absolute;
left: 0;
top: 0;
z-index: 999999;
pointer-events: none;
`,n.id="snapdom-injected-svg";let e=document.getElementById("snapdom-shadow-host");return e||(e=document.createElement("div"),e.id="snapdom-shadow-host",e.style.cssText=`
position: fixed;
left: 0;
top: 0;
width: 0;
height: 0;
z-index: 999999;
pointer-events: none;
`,e.attachShadow({mode:"open"}),document.body.appendChild(e)),(e.shadowRoot||e.attachShadow({mode:"open"})).appendChild(n),n}catch(n){throw console.error("❌ [SnapDOM] SVG注入失败:",n),n}}function et(){try{const t=document.getElementById("snapdom-shadow-host");if(t){t.remove();return}}catch(t){console.warn("⚠️ [SnapDOM] SVG清理失败:",t)}}function V(){var t;try{return!!globalThis.__AXHUB_AUTO_LAYOUT_DEBUG__||((t=globalThis.localStorage)==null?void 0:t.getItem("__AXHUB_AUTO_LAYOUT_DEBUG__"))==="1"}catch{return!!globalThis.__AXHUB_AUTO_LAYOUT_DEBUG__}}function S(t,n,e,i){if(!V())return;const o=e[0],s=o?window.getComputedStyle(o):null;console.group(`🚫 [AutoLayout DENIED] ${i}`),console.log("Container:",{tagName:t.tagName,className:t.className,id:t.id}),console.log("Container CSS:",{display:n.display,flexDirection:n.flexDirection,flexWrap:n.flexWrap,gap:n.gap,rowGap:n.rowGap,columnGap:n.columnGap,gridTemplateColumns:n.gridTemplateColumns,gridTemplateRows:n.gridTemplateRows,position:n.position}),console.log("Children count:",e.length),o&&(console.log("First child:",{tagName:o.tagName,className:o.className}),console.log("First child CSS:",{display:s.display,position:s.position,marginTop:s.marginTop,marginRight:s.marginRight,marginBottom:s.marginBottom,marginLeft:s.marginLeft,paddingTop:s.paddingTop,paddingRight:s.paddingRight,paddingBottom:s.paddingBottom,paddingLeft:s.paddingLeft})),console.log("DOM structure:",t.outerHTML.substring(0,200)+"..."),console.groupEnd()}const A={LESS_THAN_TWO_VISIBLE_CHILDREN:"LESS_THAN_TWO_VISIBLE_CHILDREN",OUT_OF_FLOW_CHILD:"OUT_OF_FLOW_CHILD",CHILDREN_OVERLAP:"CHILDREN_OVERLAP",GRID_TEMPLATE_AREAS:"GRID_TEMPLATE_AREAS",EXPLICIT_GRID_PLACEMENT:"EXPLICIT_GRID_PLACEMENT",IMPLICIT_GRID_FIXED_DIMS:"IMPLICIT_GRID_FIXED_DIMS",FLEX_WRAP_WITH_CHILD_MARGINS:"FLEX_WRAP_WITH_CHILD_MARGINS",VISUAL_ORDER_MISMATCH:"VISUAL_ORDER_MISMATCH",NEGATIVE_MARGIN_USED:"NEGATIVE_MARGIN_USED",MARGIN_VARIANCE_HIGH:"MARGIN_VARIANCE_HIGH",TRANSFORM_LAYOUT_HACK:"TRANSFORM_LAYOUT_HACK"};function ln(t,n,e){const i=[],o=[],s=[];for(const m of e){const b=m.getBoundingClientRect(),C=window.getComputedStyle(m);C.display!=="none"&&C.visibility!=="hidden"&&b.width>0&&b.height>0&&s.push({element:m,rect:b,style:C})}const a=n.display;if((a==="flex"||a==="inline-flex"||a==="grid"||a==="inline-grid")&&V()&&console.log("🔍 [AutoLayout] Checking container:",{tagName:t.tagName,className:t.className,display:a,flexWrap:n.flexWrap,gap:n.gap,childrenCount:s.length}),s.length<2){if(s.length===0)return S(t,n,s.map(b=>b.element),A.LESS_THAN_TWO_VISIBLE_CHILDREN),i.push(A.LESS_THAN_TWO_VISIBLE_CHILDREN),{deny:!0,reasons:i,warnings:o};const m=it(n,a,s);if(!m.hasValue)return S(t,n,s.map(b=>b.element),A.LESS_THAN_TWO_VISIBLE_CHILDREN),i.push(A.LESS_THAN_TWO_VISIBLE_CHILDREN),{deny:!0,reasons:i,warnings:o};V()&&console.log("✅ [AutoLayout] Single child with valuable layout properties allowed:",{tagName:t.tagName,className:t.className,display:a,reasons:m.reasons})}if(s.length===2&&!it(n,a,s).hasValue)return S(t,n,s.map(b=>b.element),"TWO_CHILDREN_NO_LAYOUT_VALUE"),i.push("TWO_CHILDREN_NO_LAYOUT_VALUE"),{deny:!0,reasons:i,warnings:o};let r=!1,l=!1,d=!1,f=!1;const u=n.flexWrap||"nowrap",p=(a==="flex"||a==="inline-flex")&&(u==="wrap"||u==="wrap-reverse"),g=n.gap||"0px",c=parseFloat(n.rowGap)||0,h=parseFloat(n.columnGap)||0,I=g!=="0px"&&g!=="normal"||c>0||h>0,w=p&&!I;for(const{style:m}of s){if(!r&&(m.position==="absolute"||m.position==="fixed")&&(r=!0),!l&&gn(m)&&(l=!0),!d){const b=m.transform;b&&b!=="none"&&b.includes("translate")&&(d=!0)}if(w&&!f){const b=parseFloat(m.marginBottom)||0,C=parseFloat(m.marginTop)||0,R=parseFloat(m.marginLeft)||0,L=parseFloat(m.marginRight)||0,T=parseFloat(m.marginInlineStart)||0,_=parseFloat(m.marginInlineEnd)||0,E=parseFloat(m.marginBlockStart)||0,y=parseFloat(m.marginBlockEnd)||0;(b>1||C>1||R>1||L>1||T>1||_>1||E>1||y>1)&&(f=!0)}if(r&&l&&d&&(!w||f))break}if(r)return S(t,n,s.map(m=>m.element),A.OUT_OF_FLOW_CHILD),i.push(A.OUT_OF_FLOW_CHILD),{deny:!0,reasons:i,warnings:o};if(dn(s))return S(t,n,s.map(m=>m.element),A.CHILDREN_OVERLAP),i.push(A.CHILDREN_OVERLAP),{deny:!0,reasons:i,warnings:o};if(f)return S(t,n,s.map(m=>m.element),A.FLEX_WRAP_WITH_CHILD_MARGINS),i.push(A.FLEX_WRAP_WITH_CHILD_MARGINS),{deny:!0,reasons:i,warnings:o};if(a==="grid"||a==="inline-grid"){const m=n.gridTemplateAreas;if(m&&m!=="none")return S(t,n,s.map(_=>_.element),A.GRID_TEMPLATE_AREAS),i.push(A.GRID_TEMPLATE_AREAS),{deny:!0,reasons:i,warnings:o};if(s.some(({style:_})=>{const E=_.gridRowStart,y=_.gridColumnStart;return E&&E!=="auto"||y&&y!=="auto"}))return S(t,n,s.map(_=>_.element),A.EXPLICIT_GRID_PLACEMENT),i.push(A.EXPLICIT_GRID_PLACEMENT),{deny:!0,reasons:i,warnings:o};const C=n.gridTemplateColumns,R=n.gridTemplateRows,L=C&&C!=="none"?C.split(" ").filter(_=>_.trim()).length:0,T=R&&R!=="none"?R.split(" ").filter(_=>_.trim()).length:0;(L>1||T>1)&&s.length>=6&&o.push(`${A.IMPLICIT_GRID_FIXED_DIMS}: container appears to be an implicit grid with cols=${L}, rows=${T}`)}if(!un(s))return S(t,n,s.map(m=>m.element),A.VISUAL_ORDER_MISMATCH),i.push(A.VISUAL_ORDER_MISMATCH),{deny:!0,reasons:i,warnings:o};if(l)return S(t,n,s.map(m=>m.element),A.NEGATIVE_MARGIN_USED),i.push(A.NEGATIVE_MARGIN_USED),{deny:!0,reasons:i,warnings:o};const x=hn(s);return x.relativeStdDev>1.2&&x.mean>0&&o.push(`${A.MARGIN_VARIANCE_HIGH}: mean=${x.mean.toFixed(2)}, relStdDev=${x.relativeStdDev.toFixed(2)}`),d?(S(t,n,s.map(m=>m.element),A.TRANSFORM_LAYOUT_HACK),i.push(A.TRANSFORM_LAYOUT_HACK),{deny:!0,reasons:i,warnings:o}):((a==="flex"||a==="inline-flex"||a==="grid"||a==="inline-grid")&&V()&&console.log("✅ [AutoLayout] ALLOWED:",t.className||t.tagName),{deny:!1,reasons:i,warnings:o})}function it(t,n,e){const i=[],o=n==="flex"||n==="inline-flex",s=n==="grid"||n==="inline-grid";if(o){const c=t.justifyContent||"normal",h=t.alignItems||"normal";c!=="normal"&&c!=="flex-start"&&c!=="start"&&i.push(`justify-content: ${c}`),h!=="normal"&&h!=="stretch"&&i.push(`align-items: ${h}`)}if(s){const c=t.justifyItems||"normal",h=t.alignItems||"normal",I=t.justifyContent||"normal";c!=="normal"&&c!=="stretch"&&c!=="legacy"&&i.push(`justify-items: ${c}`),h!=="normal"&&h!=="stretch"&&i.push(`align-items: ${h}`),I!=="normal"&&I!=="start"&&i.push(`justify-content: ${I}`)}const a=t.gap||"0px",r=parseFloat(t.rowGap)||0,l=parseFloat(t.columnGap)||0;a!=="0px"&&a!=="normal"?i.push(`gap: ${a}`):(r>0||l>0)&&i.push(`row-gap: ${r}px, column-gap: ${l}px`);const d=parseFloat(t.paddingTop)||0,f=parseFloat(t.paddingRight)||0,u=parseFloat(t.paddingBottom)||0,p=parseFloat(t.paddingLeft)||0;if(d+f+u+p>8&&i.push(`padding: ${d}/${f}/${u}/${p}`),o){const c=t.flexDirection||"row";(c==="column"||c==="column-reverse")&&i.push(`flex-direction: ${c}`)}if(o){const c=t.flexWrap||"nowrap";(c==="wrap"||c==="wrap-reverse")&&i.push(`flex-wrap: ${c}`)}if(s){const c=t.gridTemplateColumns||"none",h=t.gridTemplateRows||"none";c!=="none"&&i.push(`grid-template-columns: ${c}`),h!=="none"&&i.push(`grid-template-rows: ${h}`)}return o&&e.length>0&&e.some(({style:h})=>(parseFloat(h.flexGrow)||0)>0)&&i.push("child has flex-grow"),e.length>0&&e.some(({style:h})=>(h.alignSelf||"auto")!=="auto")&&i.push("child has align-self"),{hasValue:i.length>0,reasons:i}}function dn(t,n=1){const e=t.map(i=>i.rect);for(let i=0;i<e.length;i++)for(let o=i+1;o<e.length;o++)if(fn(e[i],e[o],n))return!0;return!1}function fn(t,n,e=1){return!(t.x+t.width<=n.x+e||n.x+n.width<=t.x+e||t.y+t.height<=n.y+e||n.y+n.height<=t.y+e)}function un(t){if(t.length<2)return!0;const n=t.map(r=>r.rect),e=Math.max(...n.map(r=>r.x+r.width))-Math.min(...n.map(r=>r.x)),i=Math.max(...n.map(r=>r.y+r.height))-Math.min(...n.map(r=>r.y)),o=e>=i,a=t.map((r,l)=>({idx:l,rect:r.rect})).slice().sort((r,l)=>Math.abs(r.rect.y-l.rect.y)>4?r.rect.y-l.rect.y:r.rect.x-l.rect.x);for(let r=0;r<a.length;r++)if(a[r].idx!==r)return!1;return!0}function gn(t){const n=parseFloat(t.marginTop)<0||parseFloat(t.marginRight)<0||parseFloat(t.marginBottom)<0||parseFloat(t.marginLeft)<0,e=parseFloat(t.marginInlineStart)<0||parseFloat(t.marginInlineEnd)<0||parseFloat(t.marginBlockStart)<0||parseFloat(t.marginBlockEnd)<0;return n||e}function hn(t){if(t.length<2)return{mean:0,stdDev:0,relativeStdDev:0};const n=t.map(u=>u.rect),e=Math.max(...n.map(u=>u.x+u.width))-Math.min(...n.map(u=>u.x)),i=Math.max(...n.map(u=>u.y+u.height))-Math.min(...n.map(u=>u.y)),o=e>=i,a=t.map((u,p)=>({idx:p,rect:u.rect})).sort((u,p)=>Math.abs(u.rect.y-p.rect.y)>4?u.rect.y-p.rect.y:u.rect.x-p.rect.x),r=[];for(let u=0;u<a.length-1;u++){const p=a[u].rect,g=a[u+1].rect,c=o?g.x-(p.x+p.width):g.y-(p.y+p.height);r.push(c)}if(r.length===0)return{mean:0,stdDev:0,relativeStdDev:0};const l=r.reduce((u,p)=>u+p,0)/r.length,d=Math.sqrt(r.reduce((u,p)=>u+Math.pow(p-l,2),0)/r.length),f=l===0?d>0?1/0:0:d/Math.abs(l);return{mean:l,stdDev:d,relativeStdDev:f}}function pn(){var t;try{return!!globalThis.__AXHUB_AUTO_LAYOUT_DEBUG__||((t=globalThis.localStorage)==null?void 0:t.getItem("__AXHUB_AUTO_LAYOUT_DEBUG__"))==="1"}catch{return!!globalThis.__AXHUB_AUTO_LAYOUT_DEBUG__}}function G(t,n){pn()&&console.debug(`[AutoLayout] ${t}`,n)}function W(t){return{tagName:t==null?void 0:t.tagName,id:t==null?void 0:t.id,className:t==null?void 0:t.className}}function mt(t,n){return n}function mn(t,n){if(!t||!n)return!1;const i=mt(t,n).display;return i==="flex"||i==="inline-flex"||i==="grid"||i==="inline-grid"}function wn(t){switch(t.flexDirection||"row"){case"column":case"column-reverse":return"VERTICAL";case"row":case"row-reverse":default:return"HORIZONTAL"}}function En(t){if(typeof t!="string")return[];const n=[];let e="",i=0,o=0;for(const a of t){if(a==="("){i+=1,e+=a;continue}if(a===")"){i=Math.max(0,i-1),e+=a;continue}if(a==="["){o+=1,e+=a;continue}if(a==="]"){o=Math.max(0,o-1),e+=a;continue}if(/\s/.test(a)&&i===0&&o===0){const r=e.trim();r&&n.push(r),e="";continue}e+=a}const s=e.trim();return s&&n.push(s),n}function xn(t){if(typeof t!="string")return-1;let n=0,e=0;for(let i=0;i<t.length;i+=1){const o=t[i];if(o==="("){n+=1;continue}if(o===")"){n=Math.max(0,n-1);continue}if(o==="["){e+=1;continue}if(o==="]"){e=Math.max(0,e-1);continue}if(o===","&&n===0&&e===0)return i}return-1}function bn(t){return typeof t=="string"&&t.startsWith("[")&&t.endsWith("]")}function X(t){const n=typeof t=="string"?t.trim():"";if(!n||n==="none")return 0;if(n==="subgrid"||n==="masonry")return null;const e=En(n);if(e.length===0)return 0;let i=0;for(const o of e)if(!bn(o)){if(/^repeat\(/i.test(o)){if(!o.endsWith(")"))return null;const s=o.slice(o.indexOf("(")+1,-1),a=xn(s);if(a<0)return null;const r=s.slice(0,a).trim().toLowerCase(),l=s.slice(a+1).trim();if(!/^\d+$/.test(r))return null;const d=Number.parseInt(r,10);if(!Number.isFinite(d)||d<=0)return null;const f=X(l);if(!Number.isFinite(f))return null;i+=d*f;continue}i+=1}return i}function ot(t,n=2){const e=t.map(o=>Number(o)).filter(o=>Number.isFinite(o)).sort((o,s)=>o-s);if(e.length===0)return[];const i=[e[0]];for(let o=1;o<e.length;o+=1){const s=e[o],a=i[i.length-1];Math.abs(s-a)>n&&i.push(s)}return i}function Ln(t){var l;if(!t||!t.children||t.children.length===0)return null;const n=[],e=[],i=Array.from(t.children).filter(d=>d instanceof HTMLElement);for(const d of i)try{const f=window.getComputedStyle(d);if(f.display==="none"||f.visibility==="hidden"||f.position==="absolute"||f.position==="fixed")continue;const u=d.getBoundingClientRect();if(u.width<=.5||u.height<=.5)continue;n.push(u),e.length<12&&e.push({tagName:d.tagName,id:d.id,className:d.className,left:u.left,top:u.top,width:u.width,height:u.height})}catch{}if(n.length===0)return null;const o=ot(n.map(d=>d.left)),s=ot(n.map(d=>d.top)),a=o.length,r=s.length;return G("grid-infer-from-children",{element:W(t),childCount:((l=t==null?void 0:t.children)==null?void 0:l.length)||0,inFlowRenderableChildCount:n.length,leftClusters:o,topClusters:s,inferredColumns:a,inferredRows:r,sampledChildren:e}),a<=0&&r<=0?null:{gridColumns:Math.max(1,a||1),gridRows:Math.max(1,r||1),inFlowChildCount:n.length}}function Tn(t,n){const e=n.gridTemplateRows||"none",i=n.gridTemplateColumns||"none",o=(n.gridAutoFlow||"row").toLowerCase(),s=X(e),a=X(i),r=Ln(t);G("grid-explicit-vs-inferred",{element:W(t),templateRows:e,templateColumns:i,gridAutoFlow:o,explicitRowCount:s,explicitColumnCount:a,inferredGrid:r});const l=!Number.isFinite(a);if(o.includes("column")||o.includes("dense")||l&&(!r||r.gridColumns<=1))return G("grid-fallback-linear",{element:W(t),reason:l?"UNRESOLVED_COLUMN_TRACKS":"UNSUPPORTED_AUTO_FLOW",gridAutoFlow:o,templateRows:e,templateColumns:i,rowCount:s,columnCount:a,inferredGrid:r}),{layoutMode:"VERTICAL"};const f=Number.isFinite(a)?Number(a):0,u=Number.isFinite(s)?Number(s):0;let p=f>0?f:0,g=u>0?u:0;if(r&&(p<=0&&(p=r.gridColumns),g<=0&&p>0)){const c=Number(r.inFlowChildCount),h=Number.isFinite(c)&&c>0?Math.ceil(c/p):0;h>0?g=h:r.gridRows>0&&f<=0&&(g=r.gridRows)}if(p>1){const c=g>0?g:void 0;return G("grid-final-resolved",{element:W(t),explicitColumns:f,explicitRows:u,inferredGrid:r,resolvedColumns:p,resolvedRows:g}),{layoutMode:"GRID",gridColumns:p,gridRows:c}}return{layoutMode:"VERTICAL"}}function Cn(t){switch(t){case"flex-start":case"start":return{align:"MIN",needsEdgePadding:!1,edgePaddingRatio:0};case"center":return{align:"CENTER",needsEdgePadding:!1,edgePaddingRatio:0};case"flex-end":case"end":return{align:"MAX",needsEdgePadding:!1,edgePaddingRatio:0};case"space-between":return{align:"SPACE_BETWEEN",needsEdgePadding:!1,edgePaddingRatio:0};case"space-around":return{align:"SPACE_BETWEEN",needsEdgePadding:!0,edgePaddingRatio:.5};case"space-evenly":return{align:"SPACE_BETWEEN",needsEdgePadding:!0,edgePaddingRatio:1};default:return{align:"MIN",needsEdgePadding:!1,edgePaddingRatio:0}}}function In(t){switch(t){case"flex-start":case"start":return"MIN";case"center":return"CENTER";case"flex-end":case"end":return"MAX";case"baseline":return"BASELINE";case"stretch":return"MIN";default:return"MIN"}}function Rn(t){switch(t){case"start":case"flex-start":case"self-start":return"MIN";case"center":return"CENTER";case"end":case"flex-end":case"self-end":return"MAX";case"left":return"MIN";case"right":return"MAX";case"stretch":return"MIN";default:return"MIN"}}function U(...t){for(const n of t){const e=parseFloat(n);if(Number.isFinite(e))return e}return 0}function yn(t,n){if(!t||!t.children||t.children.length<2)return 0;const e=Array.from(t.children).filter(r=>r instanceof HTMLElement);if(e.length<2)return 0;const i=e.filter(r=>{try{const l=window.getComputedStyle(r);return l.display!=="none"&&l.position!=="absolute"&&l.position!=="fixed"}catch{return!1}});if(i.length<2)return 0;const o=[];for(let r=0;r<i.length-1;r+=1){const l=window.getComputedStyle(i[r]),d=window.getComputedStyle(i[r+1]),f=n==="HORIZONTAL"?U(l.marginInlineEnd,l.marginRight):U(l.marginBlockEnd,l.marginBottom),u=n==="HORIZONTAL"?U(d.marginInlineStart,d.marginLeft):U(d.marginBlockStart,d.marginTop),p=f+u;p>.5&&o.push(p)}if(o.length===0)return 0;const s=o[0];return o.every(r=>Math.abs(r-s)<=.5)?s:Math.max(...o)}function An(t,n,e){const i=n.gap;if(i&&i!=="normal"&&i!=="0px"){const o=i.split(" ");return o.length===2?parseFloat(e==="HORIZONTAL"?o[1]:o[0])||0:parseFloat(i)||0}if(e==="HORIZONTAL"){const o=n.columnGap||n.gridColumnGap,s=parseFloat(o)||0;if(s>0)return s}else{const o=n.rowGap||n.gridRowGap,s=parseFloat(o)||0;if(s>0)return s}return yn(t,e)}function _n(t,n){const e=t.gap;if(e&&e!=="normal"&&e!=="0px"){const i=e.split(" ");return i.length===2?parseFloat(n==="HORIZONTAL"?i[0]:i[1])||0:parseFloat(e)||0}if(n==="HORIZONTAL"){const i=t.rowGap||t.gridRowGap;return parseFloat(i)||0}else{const i=t.columnGap||t.gridColumnGap;return parseFloat(i)||0}}function Mn(t){const n=parseFloat(t.paddingTop)||parseFloat(t.paddingBlockStart)||0,e=parseFloat(t.paddingRight)||parseFloat(t.paddingInlineEnd)||0,i=parseFloat(t.paddingBottom)||parseFloat(t.paddingBlockEnd)||0,o=parseFloat(t.paddingLeft)||parseFloat(t.paddingInlineStart)||0;return{paddingTop:n,paddingRight:e,paddingBottom:i,paddingLeft:o}}function Nn(t){const n=t.flexWrap||"nowrap";return n==="wrap"||n==="wrap-reverse"?"WRAP":"NO_WRAP"}function Fn(t,n){const e=mt(t,n);if(!mn(t,n))return null;const i=Array.from(t.children).filter(L=>L instanceof HTMLElement),o=ln(t,e,i);if(o.deny)return G("denied",{element:{tagName:t==null?void 0:t.tagName,id:t==null?void 0:t.id,className:t==null?void 0:t.className},reasons:o.reasons,warnings:o.warnings,display:e.display,justifyContent:e.justifyContent,alignItems:e.alignItems,gap:e.gap}),null;const s=e.display,a=s==="grid"||s==="inline-grid";let r,l,d;if(a){const L=Tn(t,e);r=L.layoutMode,l=L.gridColumns,d=L.gridRows,G("grid-config-selected",{element:W(t),gridConfig:L,templateRows:e.gridTemplateRows,templateColumns:e.gridTemplateColumns,gridAutoFlow:e.gridAutoFlow})}else r=wn(e);const f=An(t,e,r),u=_n(e,r),p=Mn(e),g=e.justifyContent||"flex-start",c=e.alignItems||"stretch",h=e.justifyItems||"",I=Cn(g),w=I.align;let x=In(c);if(h&&h!=="legacy"&&h!=="normal"&&(x=Rn(h)),I.needsEdgePadding&&f>0){const L=f*I.edgePaddingRatio;r==="HORIZONTAL"?(p.paddingLeft+=L,p.paddingRight+=L):r==="VERTICAL"&&(p.paddingTop+=L,p.paddingBottom+=L)}const m=r==="GRID"?void 0:a?"WRAP":Nn(e);let b="AUTO",C="AUTO";if(r==="HORIZONTAL"){const L=e.width;L&&L!=="auto"&&(L.includes("%")&&parseFloat(L)===100||L.includes("px"))&&(b="FIXED");const T=e.height;T&&T!=="auto"&&T.includes("px")&&(C="FIXED")}else if(r==="VERTICAL"){const L=e.height;L&&L!=="auto"&&(L.includes("%")&&parseFloat(L)===100||L.includes("px"))&&(b="FIXED");const T=e.width;T&&T!=="auto"&&T.includes("px")&&(C="FIXED")}const R={layoutMode:r,primaryAxisSizingMode:b,counterAxisSizingMode:C,primaryAxisAlignItems:w,counterAxisAlignItems:x,itemSpacing:f,...p,layoutPositioning:"AUTO"};if(m!==void 0&&(R.layoutWrap=m,m==="WRAP"&&(R.counterAxisSpacing=u||0)),r==="GRID"&&l){R.gridColumnCount=l,Number.isFinite(d)&&d>0&&(R.gridRowCount=d);const L=parseFloat(e.rowGap||e.gridRowGap)||0,T=parseFloat(e.columnGap||e.gridColumnGap)||0;R.gridColumnGap=T,R.gridRowGap=L}return G("mapped",{element:{tagName:t==null?void 0:t.tagName,id:t==null?void 0:t.id,className:t==null?void 0:t.className},display:e.display,result:R}),R}const rt="export-overlay-root";function Sn(t){return t instanceof Element?!!(t.id===rt||typeof t.closest=="function"&&t.closest(`#${rt}`)):!1}function wt(t){if(!(t instanceof Element))return!1;try{const n=window.getComputedStyle(t),e=n.overflowX,i=n.overflowY,o=n.overflow;return e==="hidden"||i==="hidden"||o==="hidden"||e==="clip"||i==="clip"||o==="clip"}catch{return!1}}function Hn(t){if(!(t instanceof Element))return!1;const n=t.tagName;return n==="BODY"||n==="HTML"}function On(t,n){if(!t||!n||!(n instanceof Element))return;const e=r=>typeof r=="string"&&r.trim()==="auto",i=r=>{switch(r.toLowerCase()){case"stretch":return"STRETCH";case"center":return"CENTER";case"flex-end":case"end":case"self-end":return"MAX";case"flex-start":case"start":case"self-start":return"MIN";default:return null}},o=r=>{const l=parseFloat(r);return Number.isFinite(l)?l:null},s=(r,l,d=1.5)=>Math.abs(r-l)<=d,a=(r,l,d,f)=>{if(!r||!l||!d||!f)return null;const u=l.display;if(u!=="flex"&&u!=="inline-flex")return null;const p=l.flexDirection||"row",g=p==="row"||p==="row-reverse",c=g?r.marginBlockStart||r.marginTop:r.marginInlineStart||r.marginLeft,h=g?r.marginBlockEnd||r.marginBottom:r.marginInlineEnd||r.marginRight,I=e(c),w=e(h);if(I&&w)return"CENTER";if(I)return"MAX";if(w)return"MIN";const x=o(c),m=o(h);if(x===null||m===null||x<.5&&m<.5)return null;const b=f.getBoundingClientRect(),C=d.getBoundingClientRect(),R=g?C.height:C.width,L=g?b.height:b.width,T=o(g?l.paddingTop:l.paddingLeft)||0,_=o(g?l.paddingBottom:l.paddingRight)||0,E=o(g?l.borderTopWidth:l.borderLeftWidth)||0,y=o(g?l.borderBottomWidth:l.borderRightWidth)||0,N=L-T-_-E-y;if(!Number.isFinite(N)||N<=1)return null;const H=R+x+m;return s(N,H,2.5)?x>.5&&m>.5&&s(x,m,1.5)?"CENTER":x>.5&&m<=1.5?"MAX":m>.5&&x<=1.5?"MIN":null:null};try{const r=window.getComputedStyle(n),l=n.parentElement,d=l?window.getComputedStyle(l):null;if((parseFloat(r.flexGrow)||0)>0&&(t.layoutGrow=1,d)){const g=d.display,c=d.flexDirection||"row";(g==="flex"||g==="inline-flex")&&(c==="row"||c==="row-reverse"?(t.layoutSizingHorizontal="FILL",t.layoutSizingVertical=t.layoutSizingVertical||"HUG"):(t.layoutSizingHorizontal=t.layoutSizingHorizontal||"HUG",t.layoutSizingVertical="FILL"))}const u=r.alignSelf||"auto",p=i(u);if(p)t.layoutAlign=p;else{const g=a(r,d,n,l);g&&(t.layoutAlign=g)}}catch{}}function Dn(t,n,e,i=null,o=!1,s=!1){var _;if(!t||t.length===0)return null;const r=typeof window<"u"&&(window.__AXHUB_HTML_TO_FIGMA_DEBUG__||window.__AXHUB_FRAME_DEBUG__)?(...E)=>{console.log("[frame-build]",...E)}:()=>{};if(r("start createFrameFromLayers",{elementName:n,layerCount:t.length,hasAutoLayoutProps:!!i,forceCreateFrame:s,firstLayer:t[0]?{type:t[0].type,name:t[0].name,width:t[0].width,height:t[0].height}:null,sortedAlready:!1}),t.length===1&&!i&&!s)return t[0];const l=t.find(E=>E&&E.type==="RECTANGLE"&&E._sortingCache&&E._sortingCache.originalElement===e)||null,d=t.some(E=>E&&E._sortingCache&&E._sortingCache.originalElement),f=$(t),u=f.filter(E=>E.layoutPositioning!=="ABSOLUTE"&&E.layoutPositioning!=="FIXED"),p=u.length>0?u:f,g=E=>{let y=Number.POSITIVE_INFINITY,N=Number.POSITIVE_INFINITY,H=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY,B=0;for(const F of E)typeof F.x=="number"&&typeof F.y=="number"&&typeof F.width=="number"&&typeof F.height=="number"&&(y=Math.min(y,F.x),N=Math.min(N,F.y),H=Math.max(H,F.x+F.width),D=Math.max(D,F.y+F.height),B+=1);return B===0?null:{x:y,y:N,width:H-y,height:D-N}};let c=null;const h=[];if(l)c=l;else if(!d){for(const E of f)if(E.type==="RECTANGLE"&&!c){c=E;break}}const I=!!c&&!!l&&c===l;let w,x,m,b;if(c&&!I){const E=g(p),y=(_=e==null?void 0:e.getBoundingClientRect)==null?void 0:_.call(e);if(E){const N=c.width>=E.width*.9,H=c.height>=E.height*.9,D=c.x<=E.x+1,B=c.y<=E.y+1,F=c.x+c.width>=E.x+E.width-1,Et=c.y+c.height>=E.y+E.height-1,xt=c.width*c.height>=E.width*E.height*.8,q=!!y&&Math.abs(c.width-y.width)<=2&&Math.abs(c.height-y.height)<=2&&Math.abs(c.x-y.x)<=2&&Math.abs(c.y-y.y)<=2,K=N&&H&&D&&B&&F&&Et&&xt;r("background coverage check",{elementName:n,bgName:c.name,bgSize:{w:c.width,h:c.height},bounds:E,isCovering:K,matchesElementRect:q}),!q&&!(!y&&K)&&(r("background rejected, fallback to element bounding rect",{elementName:n,bgName:c.name}),c=null)}}if(c){w=c.x,x=c.y,m=c.width,b=c.height,r("use backgroundLayer as frame basis",{elementName:n,frameX:w,frameY:x,frameWidth:m,frameHeight:b,bgName:c.name,bgType:c.type});for(const E of f)E!==c&&h.push(E)}else{const E=e.getBoundingClientRect();if(w=E.x,x=E.y,m=E.width,b=E.height,Hn(e)){const y=g(p);if(y){const N=Math.min(w,y.x),H=Math.min(x,y.y),D=Math.max(w+m,y.x+y.width),B=Math.max(x+b,y.y+y.height);w=N,x=H,m=D-N,b=B-H}}r("use element bounding rect as frame basis",{elementName:n,frameX:w,frameY:x,frameWidth:m,frameHeight:b}),h.push(...f)}let C=h.map(E=>E.x!==void 0&&E.y!==void 0?{...E,x:E.x-w,y:E.y-x}:E);const R=wt(e),L=o?"FRAME":"GROUP",T={type:L,name:n||L,x:w,y:x,width:m,height:b,clipsContent:R,children:[]};if(r("frameLayer created",{name:T.name,x:T.x,y:T.y,width:T.width,height:T.height,childCount:C.length,hasBackground:!!c}),c){const E=c.fills&&c.fills.some(y=>y.type==="IMAGE");r("background layer detected",{elementName:n,hasImageFill:E,backgroundFillTypes:Array.isArray(c.fills)?c.fills.map(y=>y.type):[],enableAutoLayout:o}),!o&&E?(r("GROUP mode with image fill, keeping background as separate layer",{elementName:n,bgName:c.name}),C.unshift({...c,x:0,y:0})):(c.fills&&c.fills.length>0&&(T.fills=c.fills),c.strokes&&(T.strokes=c.strokes),c.strokeWeight!==void 0&&(T.strokeWeight=c.strokeWeight),c.strokeAlign!==void 0&&(T.strokeAlign=c.strokeAlign),c.cornerRadius!==void 0&&(T.cornerRadius=c.cornerRadius),c.topLeftRadius!==void 0&&(T.topLeftRadius=c.topLeftRadius,T.topRightRadius=c.topRightRadius,T.bottomLeftRadius=c.bottomLeftRadius,T.bottomRightRadius=c.bottomRightRadius),c.effects&&c.effects.length>0&&(T.effects=c.effects),c.opacity!==void 0&&c.opacity!==1&&(T.opacity=c.opacity))}else o&&(T.fills=[{type:"SOLID",color:{r:1,g:1,b:1},opacity:0}]);if(T.children=C,i&&Object.assign(T,i),On(T,e),e){const E=e.getBoundingClientRect();z(T,e,e.style,E)}return T}const Gn=async(t,n)=>{const{useFrames:e,rootName:i,isAxure:o,widgetId:s,enableAutoLayout:a=!0}=n,r=ht(t),l="figma-target-element";try{await It(t),t.classList.add(l);const d=await an({targetElement:t,filter:g=>!Sn(g)}),f=cn(d);let u=f.querySelector(`.${l}`);u||(u=f.querySelector("body")),u||(u=f);const p=await Bn(u,{useFrames:e,rootName:i,isAxure:o,widgetId:s,size:{width:d.pageWidth,height:d.pageHeight},isSnapdomProcessing:!0,enableAutoLayout:a});return et(),Q(t,r),p}catch(d){console.error("❌ [processWithSnapDOM] SnapDOM 方案失败:",d),Q(t,r);try{et()}catch{}return null}};async function j(t,n=!1,e=!1,i=!0){const o=[];if(!t)return o;if(t.type==="element"){const s=await rn(t.el,e,i);if(t.el instanceof SVGSVGElement&&t.el.id!=="snapdom-injected-svg")return s;const a=wt(t.el);let r=!1,l=null,d=null,f=!1;try{if(d=window.getComputedStyle(t.el),i){const c=Fn(t.el,d);c!==null&&(l=c,r=!0)}const g=d.display;t.children&&t.children.length>2&&g&&!["inline","inline-block","inline-flex","inline-grid"].includes(g)&&(f=!0)}catch{}let u=!1;if(t.children&&t.children.length>0){const g=d||(()=>{try{return window.getComputedStyle(t.el)}catch{return t.el.style}})();try{u=pt(t.el,g)}catch{}}if(!d&&t.children&&t.children.length>0&&(f=!0),(n||a||r||u||f)&&i){const g=[];for(const h of t.children){const I=await j(h,n||r,e,i);g.push(...I)}const c=[...s,...g];if(c.length>0){const h=Dn(c,v(t.el,e),t.el,l,i,a);h&&o.push(h)}return o}else o.push(...s)}if(!n)for(const s of t.children){const a=await j(s,n,e,i);o.push(...a)}return o}const Bn=async(t,n)=>{const{useFrames:e,rootName:i,size:o,isAxure:s=!1,widgetId:a,enableAutoLayout:r=!0}=n;yt(t);const l=on(t),d=await j(l,e,s,r),f=$(d),u={type:"FRAME",name:i||"FRAME",widgetId:a||null,width:o.width||Math.round(t.scrollWidth),height:o.height||Math.round(t.scrollHeight),x:0,y:0,children:f};return zt([u])};async function Un(t="body",n){const{useFrames:e,useFrame:i,rootName:o,isAxure:s=!1,widgetId:a,enableAutoLayout:r=!0}=n||{},l=typeof e=="boolean"?e:!!i,d=t instanceof HTMLElement?t:document.querySelector(t||"body");return d?Gn(d,{useFrames:l,rootName:o,isAxure:s,widgetId:a,enableAutoLayout:r}):[]}export{Un as htmlToFigma,Bn as processWithOriginalLogic,Gn as processWithSnapDOMImplementation};