@arcsin1/html2pptx 0.0.2 → 0.0.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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=require("module"),e=require("url"),r=require("./ooxml-writer.cjs");require("fflate"),require("./animation-writer.cjs");var n="undefined"!=typeof document?document.currentScript:null;const o=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("index.cjs",document.baseURI).href),i=e.pathToFileURL(o.resolve("@chenglou/pretext")).toString(),a=13.333,l=7.5,s=(t,e,r)=>Math.max(e,Math.min(r,t)),c=(t,e="111827")=>{if(!t)return e;const r=t.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(r)?r.split("").map(t=>`${t}${t}`).join(""):/^[0-9A-F]{6}$/.test(r)?r:e},d=t=>{const e=t.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\n")},u=(t,e)=>{const r=(t=>String(t||"").split(",").map(t=>t.trim().replace(/^["']|["']$/g,"")).find(Boolean)||"Aptos")(e);return(t=>/[\u3400-\u9fff\uf900-\ufaff]/.test(t))(t)&&/^(aptos|arial|helvetica|inter|system-ui|-apple-system|sans-serif|serif)$/i.test(r)?"Microsoft YaHei":r},h=t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||""));if(!r)return null;const n=Math.max(1,Number(e.rowspan)||1),o=Math.max(1,Number(e.colspan)||1),i=e.border&&"object"==typeof e.border?e.border:null,h=i?c(String(i.color||""),""):"";return{text:r,rowspan:n,colspan:o,x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.1,.05,a),h:s(Number(e.h)||.05,.03,l),fontSize:e.fontSize?s(Number(e.fontSize),6,144):void 0,fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",valign:"middle"===e.valign||"bottom"===e.valign?e.valign:"top",fill:e.fill?c(String(e.fill),""):void 0,fillTransparency:e.fillTransparency?s(Number(e.fillTransparency),0,100):void 0,border:h?{color:h,widthPt:s(Number(i?.widthPt??.75),.1,20),dash:"dash"===i?.dash?"dash":"solid"}:void 0}},g=t=>{const e=t&&"object"==typeof t?t:{},r=Array.isArray(e.rows)?e.rows:[],n=Array.isArray(e.colWidths)?e.colWidths:[],o=Array.isArray(e.rowHeights)?e.rowHeights:[];if(0===r.length)return null;const i=r.map(t=>(Array.isArray(t)?t:[]).map(h).filter(t=>null!==t)).filter(t=>t.length>0);return 0===i.length?null:{x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.1,.1,a),h:s(Number(e.h)||.1,.1,l),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0,colWidths:n.map(t=>Math.max(.05,Number(t)||.05)),rowHeights:o.map(t=>Math.max(.03,Number(t)||.03)),rows:i}},m=t=>{const e=t&&"object"==typeof t?t:{},r=String(e.text||"").replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ")).join("\n");return r.trim()?{text:r,fontSize:Number(e.fontSize)>0?s(Number(e.fontSize),6,144):void 0,fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike)}:null};exports.buildHtmlToPptxExtractScript=t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5,n=Math.max(1,Math.floor(t.maxTextBoxes??360)),o=Math.max(0,Math.floor(t.maxShapes??400)),a=Math.max(0,Math.floor(t.maxImages??80)),l=Math.max(80,Math.floor(t.maxTextChars??1e3)),s=Math.max(0,Math.floor(t.maxImageBytes??12582912)),c=(t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5;return'(function(){const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,o=t=>{const e=String(t||"").trim();if(!e||"transparent"===e)return"";if(e.startsWith("#")){const t=e.slice(1).toUpperCase();return 3===t.length?t.split("").map(t=>t+t).join(""):t}const o=e.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);return o?(void 0===o[4]?1:String(o[4]).endsWith("%")?Number.parseFloat(o[4])/100:Number(o[4]))<=.02?"":[o[1],o[2],o[3]].map(t=>Math.max(0,Math.min(255,Math.round(Number(t)||0))).toString(16).padStart(2,"0")).join("").toUpperCase():""},r=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const o=String(e[1]);return o.endsWith("%")?Number.parseFloat(o)/100:Number(o)},n=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,i=n.getBoundingClientRect(),l=i.left||0,a=i.top||0,s=i.width||__HTML2PPTX_TEMPLATE_SLOT_2__,d=i.height||__HTML2PPTX_TEMPLATE_SLOT_3__,c=e=>((Number(e)||0)-l)/s*t,u=t=>((Number(t)||0)-a)/d*e,g=e=>(Number(e)||0)/s*t,p=t=>(Number(t)||0)/d*e,m=72*Math.min(t/s,e/d),h=[],f=[],b=n.querySelectorAll("table");for(const t of b){if(t.closest("script, style, noscript, .katex, .katex-mathml"))continue;const e=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===e.display||"hidden"===e.visibility)continue;if(n.width<10||n.height<10)continue;const i=Array.from(t.querySelectorAll("th, td")).some(t=>{const e=window.getComputedStyle(t);return Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest("script, style, noscript, svg, canvas"))return!1;const r=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===r.display||"hidden"===r.visibility)return!1;if(n.width<1||n.height<1)return!1;const i=Boolean(o(r.backgroundColor))||["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(r["border"+t+"Width"]||"0")||0)>0),l=r.fontSize!==e.fontSize||r.fontWeight!==e.fontWeight||r.color!==e.color||r.fontStyle!==e.fontStyle||r.textDecorationLine!==e.textDecorationLine,a=["DIV","SECTION","ARTICLE","ASIDE","P","UL","OL"].includes(t.tagName);return i||l||a})}),l=Array.from(t.querySelectorAll("tr")).some(t=>{const e=window.getComputedStyle(t),r=Boolean(o(e.backgroundColor)),n=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0);return r||n});if(i||l){t.setAttribute("data-pptx-dom-table","1");continue}const a=t.querySelectorAll("tr");if(!a.length)continue;let s=0;for(const t of a){let e=0;for(const o of t.children)"TD"!==o.tagName&&"TH"!==o.tagName||(e+=Number(o.getAttribute("colspan")||1));s=Math.max(s,e)}if(0===s)continue;const d=new Array(s).fill(0),b=[],S=new Array(a.length).fill(null).map(()=>new Array(s).fill(!1));for(let t=0;t<a.length;t++){const e=a[t],o=e.getBoundingClientRect();b.push(o.height);let r=0;for(const o of e.children){if("TD"!==o.tagName&&"TH"!==o.tagName)continue;const e=Number(o.getAttribute("colspan")||1),n=Number(o.getAttribute("rowspan")||1);for(;r<s&&S[t][r];)r++;if(r>=s)break;const i=o.getBoundingClientRect().width/e;for(let t=0;t<e&&r+t<s;t++)d[r+t]=Math.max(d[r+t],i);for(let o=1;o<n&&t+o<a.length;o++)for(let n=0;n<e&&r+n<s;n++)S[t+o][r+n]=!0;r+=e}}const y=[];for(const t of a){const e=[];for(const n of t.children){if("TD"!==n.tagName&&"TH"!==n.tagName)continue;const t=window.getComputedStyle(n),i=n.getBoundingClientRect(),l=Number(n.getAttribute("rowspan")||1),a=Number(n.getAttribute("colspan")||1),s=String(n.textContent||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),d=Number.parseFloat(t.fontSize||"16")||16,h=Number.parseInt(t.fontWeight||"400",10)||400,f=o(t.backgroundColor),b=r(t.backgroundColor),S=o(t.borderColor),y=Number.parseFloat(t.borderWidth||"0")||0,T=y>0&&"none"!==t.borderStyle&&S;let _="top";const w=String(t.verticalAlign||"");"middle"===w?_="middle":"bottom"===w&&(_="bottom");let A="left";const N=String(t.textAlign||"");"center"===N?A="center":"right"===N||"end"===N?A="right":"justify"===N&&(A="justify"),e.push({text:s,rowspan:l,colspan:a,x:c(i.left),y:u(i.top),w:g(i.width),h:p(i.height),fontSize:Math.max(6,Math.min(144,d*m)),fontFace:String(t.fontFamily||"").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",color:o(t.color)||"111827",bold:h>=600,italic:"italic"===t.fontStyle||"oblique"===t.fontStyle,underline:String(t.textDecoration||"").includes("underline"),strike:String(t.textDecoration||"").includes("line-through"),align:A,valign:_,fill:f||void 0,fillTransparency:f?Math.round(100*(1-b)):void 0,border:T?{color:S,widthPt:.75*y,dash:"dashed"===t.borderStyle?"dash":"solid"}:void 0})}y.push(e)}const T="pptx-table-"+h.length;t.setAttribute("data-pptx-consumed-table",T),f.push(T),h.push({x:c(n.left),y:u(n.top),w:g(n.width),h:p(n.height),colWidths:d.map(t=>g(t)),rowHeights:b.map(t=>p(t)),rows:y})}return{tables:h,consumedTableElementIds:f}}())'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(t.pageHeightPx)))})(t);return'(async()=>{const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,r=__HTML2PPTX_TEMPLATE_SLOT_2__,n=__HTML2PPTX_TEMPLATE_SLOT_3__,o=__HTML2PPTX_TEMPLATE_SLOT_4__,i=__HTML2PPTX_TEMPLATE_SLOT_5__,a=__HTML2PPTX_TEMPLATE_SLOT_6__,s=__HTML2PPTX_TEMPLATE_SLOT_7__,l=__HTML2PPTX_TEMPLATE_SLOT_8__,c=__HTML2PPTX_TEMPLATE_SLOT_9__;let d=null;try{d=await import(c)}catch(t){d=null}const u=t=>String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),h=t=>u(t).slice(0,s),g=t=>(t=>{const e=String(t||"").replace(/\\r\\n?/g,"\\n").replace(/[\\u200b-\\u200d\\ufeff]/g,"").split("\\n").map(t=>t.replace(/[^\\S\\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\\n")})(t).slice(0,s);__HTML2PPTX_TEMPLATE_SLOT_10__;const f=__HTML2PPTX_TEMPLATE_SLOT_11__,m=f.tables||[],p=new Set(f.consumedTableElementIds||[]),b=t=>{if(t.getAttribute&&p.has(t.getAttribute("data-pptx-consumed-table")))return!0;const e=t.closest&&t.closest("[data-pptx-consumed-table]");return!!e&&p.has(e.getAttribute("data-pptx-consumed-table"))},x=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,F=x.getBoundingClientRect(),w=F.left||0,E=F.top||0,S=F.width||t,y=F.height||e,M=(x instanceof HTMLElement&&x.offsetWidth&&x.offsetWidth,t=>((Number(t)||0)-w)/S*r),A=t=>((Number(t)||0)-E)/y*n,C=t=>(Number(t)||0)/S*r,T=t=>(Number(t)||0)/y*n,N=72*Math.min(r/S,n/y),B=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const r=String(e[1]),n=r.endsWith("%")?Number.parseFloat(r)/100:Number(r);return Math.max(0,Math.min(1,Number.isFinite(n)?n:1))},D=(t,e)=>{const r=B(t)*Math.max(0,Math.min(1,Number(e||1)));return Math.round(100*(1-r))},_=t=>{const e=t.webkitTextFillColor||t.getPropertyValue?.("-webkit-text-fill-color")||"",r=rgbToHex(e)?e:t.color;return{color:rgbToHex(r)||rgbToHex(t.color)||"111827",opacity:B(r)*Math.max(0,Math.min(1,Number(t.opacity||1)))}},v=t=>{if(!t.transform||"none"===t.transform)return;const e=t.transform.match(/matrix\\(([^)]+)\\)/)?.[1]?.split(",").map(t=>Number(t.trim()));return!e||e.length<4?void 0:Math.round(180*Math.atan2(e[1],e[0])/Math.PI)||void 0},k=(()=>{const t=rgbToHex(window.getComputedStyle(x).backgroundColor);if(t)return t;const e=rgbToHex(window.getComputedStyle(document.documentElement).backgroundColor);if(e)return e;const r=S*y,n=x.querySelectorAll(":scope > div, :scope > section, :scope > main");for(const t of n){const e=window.getComputedStyle(t),n=rgbToHex(e.backgroundColor);if(!n)continue;const o=t.getBoundingClientRect();if(o.width*o.height>=.5*r)return n}return"FFFFFF"})(),L=(r,n,o)=>{if(!n||"none"===n.display||"hidden"===n.visibility)return!1;if(Number(n.opacity||"1")<.04)return!1;const i=["Top","Right","Bottom","Left"].some(t=>{const e=Number.parseFloat(n["border"+t+"Width"]||"0")||0,r=n["border"+t+"Style"];return e>0&&"none"!==r});return!((o.width<2||o.height<2)&&!i||o.width<2&&o.height<2||o.bottom<0||o.right<0||o.left>t||o.top>e||r.closest("script, style, noscript, .katex, .katex-mathml, [data-pptx-formula-block]"))},P=t=>{const e=t.getBoundingClientRect();return{rect:e,x:M(e.left),y:A(e.top),w:C(e.width),h:T(e.height)}},I=new WeakMap;Array.from(x.querySelectorAll("*")).forEach((t,e)=>{I.set(t,e+1)});const R=t=>I.get(t)||0,H=t=>{const e=String(t?.zIndex||"").trim();if(!e||"auto"===e)return;const r=Number.parseInt(e,10);return Number.isFinite(r)?Math.max(-1e5,Math.min(1e5,r)):void 0},W=(t,e)=>!(!t||t===x||!(void 0!==H(e)&&("static"!==e.position||(t=>{const e=t?.parentElement;return!!e&&/(?:^|\\s)(?:inline-)?(?:flex|grid)(?:\\s|$)/.test(window.getComputedStyle(e).display||"")})(t))||Number(e.opacity||"1")<1||e.transform&&"none"!==e.transform||e.filter&&"none"!==e.filter||e.backdropFilter&&"none"!==e.backdropFilter||e.perspective&&"none"!==e.perspective||e.mixBlendMode&&"normal"!==e.mixBlendMode||"isolate"===e.isolation||/(?:layout|paint|strict|content)/.test(e.contain||"")||/(?:transform|opacity|filter|perspective|contents)/.test(e.willChange||""))),O=t=>{const e=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE&&(e.push(r),r!==x);)r=r.parentElement;e.reverse();const n=[{z:0,order:0}];for(const t of e){if(!t||t===x)continue;const e=window.getComputedStyle(t);W(t,e)&&n.push({z:H(e)??0,order:R(t)})}const o=R(t);return n.some(t=>t.order===o)||n.push({z:0,order:o}),{key:n,order:o}},j=t=>{let e=1,r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const t=Number(window.getComputedStyle(r).opacity||"1");if(Number.isFinite(t)&&(e*=Math.max(0,Math.min(1,t))),r===x)break;r=r.parentElement}return Math.max(0,Math.min(1,e))},z=new Map;let U=0;const q=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE)return"";let e=t.getAttribute("data-pptx-paint-id");return e||(U+=1,e="pptx-paint-"+String(U),t.setAttribute("data-pptx-paint-id",e)),z.set(e,t),e},$=new Map([["ring",3],["ring-0",0],["ring-1",1],["ring-2",2],["ring-4",4],["ring-8",8]]),X=new Map([["border",1],["border-0",0],["border-2",2],["border-4",4],["border-8",8]]),V=new Map([["rounded-none",0],["rounded-sm",2],["rounded",4],["rounded-md",6],["rounded-lg",8],["rounded-xl",12],["rounded-2xl",16],["rounded-3xl",24]]),G=new Map([["font-thin",100],["font-extralight",200],["font-light",300],["font-normal",400],["font-medium",500],["font-semibold",600],["font-bold",700],["font-extrabold",800],["font-black",900]]),K=new Map([["black","#000000"],["white","#FFFFFF"],["transparent","rgba(0, 0, 0, 0)"]]),Q=["50","100","200","300","400","500","600","700","800","900","950"],Y=new Map(Object.entries({slate:["#F8FAFC","#F1F5F9","#E2E8F0","#CBD5E1","#94A3B8","#64748B","#475569","#334155","#1E293B","#0F172A","#020617"],gray:["#F9FAFB","#F3F4F6","#E5E7EB","#D1D5DB","#9CA3AF","#6B7280","#4B5563","#374151","#1F2937","#111827","#030712"],zinc:["#FAFAFA","#F4F4F5","#E4E4E7","#D4D4D8","#A1A1AA","#71717A","#52525B","#3F3F46","#27272A","#18181B","#09090B"],neutral:["#FAFAFA","#F5F5F5","#E5E5E5","#D4D4D4","#A3A3A3","#737373","#525252","#404040","#262626","#171717","#0A0A0A"],stone:["#FAFAF9","#F5F5F4","#E7E5E4","#D6D3D1","#A8A29E","#78716C","#57534E","#44403C","#292524","#1C1917","#0C0A09"],red:["#FEF2F2","#FEE2E2","#FECACA","#FCA5A5","#F87171","#EF4444","#DC2626","#B91C1C","#991B1B","#7F1D1D","#450A0A"],orange:["#FFF7ED","#FFEDD5","#FED7AA","#FDBA74","#FB923C","#F97316","#EA580C","#C2410C","#9A3412","#7C2D12","#431407"],amber:["#FFFBEB","#FEF3C7","#FDE68A","#FCD34D","#FBBF24","#F59E0B","#D97706","#B45309","#92400E","#78350F","#451A03"],yellow:["#FEFCE8","#FEF9C3","#FEF08A","#FDE047","#FACC15","#EAB308","#CA8A04","#A16207","#854D0E","#713F12","#422006"],lime:["#F7FEE7","#ECFCCB","#D9F99D","#BEF264","#A3E635","#84CC16","#65A30D","#4D7C0F","#3F6212","#365314","#1A2E05"],green:["#F0FDF4","#DCFCE7","#BBF7D0","#86EFAC","#4ADE80","#22C55E","#16A34A","#15803D","#166534","#14532D","#052E16"],emerald:["#ECFDF5","#D1FAE5","#A7F3D0","#6EE7B7","#34D399","#10B981","#059669","#047857","#065F46","#064E3B","#022C22"],teal:["#F0FDFA","#CCFBF1","#99F6E4","#5EEAD4","#2DD4BF","#14B8A6","#0D9488","#0F766E","#115E59","#134E4A","#042F2E"],cyan:["#ECFEFF","#CFFAFE","#A5F3FC","#67E8F9","#22D3EE","#06B6D4","#0891B2","#0E7490","#155E75","#164E63","#083344"],sky:["#F0F9FF","#E0F2FE","#BAE6FD","#7DD3FC","#38BDF8","#0EA5E9","#0284C7","#0369A1","#075985","#0C4A6E","#082F49"],blue:["#EFF6FF","#DBEAFE","#BFDBFE","#93C5FD","#60A5FA","#3B82F6","#2563EB","#1D4ED8","#1E40AF","#1E3A8A","#172554"],indigo:["#EEF2FF","#E0E7FF","#C7D2FE","#A5B4FC","#818CF8","#6366F1","#4F46E5","#4338CA","#3730A3","#312E81","#1E1B4B"],violet:["#F5F3FF","#EDE9FE","#DDD6FE","#C4B5FD","#A78BFA","#8B5CF6","#7C3AED","#6D28D9","#5B21B6","#4C1D95","#2E1065"],purple:["#FAF5FF","#F3E8FF","#E9D5FF","#D8B4FE","#C084FC","#A855F7","#9333EA","#7E22CE","#6B21A8","#581C87","#3B0764"],fuchsia:["#FDF4FF","#FAE8FF","#F5D0FE","#F0ABFC","#E879F9","#D946EF","#C026D3","#A21CAF","#86198F","#701A75","#4A044E"],pink:["#FDF2F8","#FCE7F3","#FBCFE8","#F9A8D4","#F472B6","#EC4899","#DB2777","#BE185D","#9D174D","#831843","#500724"],rose:["#FFF1F2","#FFE4E6","#FECDD3","#FDA4AF","#FB7185","#F43F5E","#E11D48","#BE123C","#9F1239","#881337","#4C0519"]})),J=t=>{const e=String(t||"").trim();if(!e)return"";const r=e.split(":");return r[r.length-1]||e},Z=(t,e)=>{let r="",n="";const o=e+"-[";if(t.startsWith(o)){const e=t.indexOf("]");if(e<0)return null;r=t.slice(o.length,e),n=t.slice(e+1).startsWith("/")?t.slice(e+2):""}else if(t.startsWith(e+"-")){const o=t.slice(e.length+1),i=o.indexOf("/");r=(t=>{if(K.has(t))return K.get(t);const e=String(t||"").match(/^([a-z]+)-(50|100|200|300|400|500|600|700|800|900|950)$/);if(!e)return"";const r=Y.get(e[1]),n=Q.indexOf(e[2]);return r&&n>=0?r[n]:""})(i>=0?o.slice(0,i):o),n=i>=0?o.slice(i+1):""}if(!r||/^-?\\d/.test(r)||/px\\]?$/.test(r))return null;const i=(t=>{const e=String(t||"").replace(/^\\[|\\]$/g,"").trim();if(!e)return;const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r>1?r/100:r)):void 0})(n);return void 0!==i&&r.startsWith("#")?((t,e)=>{const r=String(t||"").trim().replace(/^#/,""),n=3===r.length?r.split("").map(t=>t+t).join(""):r.slice(0,6);return/^[0-9a-f]{6}$/i.test(n)?"rgba("+Number.parseInt(n.slice(0,2),16)+", "+Number.parseInt(n.slice(2,4),16)+", "+Number.parseInt(n.slice(4,6),16)+", "+e+")":t})(r,i):r},tt=t=>Z(t,"ring"),et=t=>Z(t,"border"),rt=t=>Z(t,"bg"),nt=t=>{if($.has(t))return $.get(t);const e=t.match(/^ring-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},ot=t=>{if(X.has(t))return X.get(t);const e=t.match(/^border-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},it=t=>{const e=String(t||"").match(/^border-([trblxy])(?:-(0|2|4|8|\\[(-?\\d*\\.?\\d+)px\\]))?$/);if(!e)return null;const r=e[1],n=e[2],o=e[3],i=void 0!==o?Number.parseFloat(o):n?Number.parseFloat(n):1;return!Number.isFinite(i)||i<0?null:{sides:"x"===r?["left","right"]:"y"===r?["top","bottom"]:"t"===r?["top"]:"r"===r?["right"]:"b"===r?["bottom"]:["left"],width:i}},at=t=>{const e=String(t||"").match(/^border-([trblxy])-(.+)$/);if(!e)return null;const r=e[2];if(/^(?:0|2|4|8|\\[-?\\d*\\.?\\d+px\\])$/.test(r))return null;const n=et("border-"+r);if(!n)return null;const o=e[1];return{sides:"x"===o?["left","right"]:"y"===o?["top","bottom"]:"t"===o?["top"]:"r"===o?["right"]:"b"===o?["bottom"]:["left"],colorSource:n}},st=t=>{if("rounded-full"===t)return{full:!0};if(V.has(t))return{px:V.get(t)};const e=t.match(/^rounded-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return null;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?{px:Math.max(0,r)}:null},lt=t=>{if(G.has(t))return G.get(t);const e=t.match(/^font-\\[([1-9]\\d{0,2})\\]$/);if(!e)return;const r=Number.parseInt(e[1],10);return Number.isFinite(r)?Math.max(1,Math.min(1e3,r)):void 0},ct=t=>{const e=String(t?.className||"").split(/\\s+/).filter(Boolean);let r;for(const t of e){const e=lt(J(t));void 0!==e&&(r=e)}return r},dt=t=>{const e=String(t.fontWeight||"").trim().toLowerCase();if(!e)return;if("normal"===e)return 400;if("bold"===e)return 700;const r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:void 0},ut=t=>{const e=t?.style?.fontWeight;if(e)return dt({fontWeight:e})},ht=(t,e,r)=>{const n=String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"");if(!n)return null;const o=Number.parseFloat(e.fontSize||"16")||16,i=ut(r),a=ct(r),s=dt(e),l=i||a||s||400,c=String(e.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",d=_(e);return{text:n,fontSize:Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_12__,o*N)),fontFace:c,color:d.color,bold:l>=600||/^H[1-6]$/i.test(r?.tagName||""),italic:"italic"===e.fontStyle||"oblique"===e.fontStyle,underline:String(e.textDecoration||"").includes("underline"),strike:String(e.textDecoration||"").includes("line-through")}},gt=t=>{for(;t.length>0&&(t[0].text=String(t[0].text||"").trimStart(),!t[0].text);)t.shift();for(;t.length>0;){const e=t[t.length-1];if(e.text=String(e.text||"").trimEnd(),e.text)break;t.pop()}return t.filter(t=>t.text)},ft=(t,e)=>t&&e&&t.fontSize===e.fontSize&&t.fontFace===e.fontFace&&t.color===e.color&&Boolean(t.bold)===Boolean(e.bold)&&Boolean(t.italic)===Boolean(e.italic)&&Boolean(t.underline)===Boolean(e.underline)&&Boolean(t.strike)===Boolean(e.strike),mt=(t,e)=>{if(!t||Lt(e))return;const r=[],n=(t,e,o)=>{if(t.nodeType===Node.TEXT_NODE){const n=ht(t.textContent,o,e);return void(n&&r.push(n))}if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t;if(i.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const a=window.getComputedStyle(i);i.childNodes.forEach(t=>n(t,i,a))};if(t.childNodes.forEach(r=>n(r,t,e)),gt(r),0===r.length)return;const o=u(r.map(t=>t.text).join("")),i=u(t.innerText||t.textContent);if(!o||o!==i)return;const a=ht(i,e,t);return r.some(t=>!ft(t,a))?r:void 0},pt=(t,e)=>{if(!e||!e.text)return;const r=t[t.length-1];ft(r,e)?r.text+=e.text:t.push({...e})},bt=(t,e)=>{if(!t||Lt(e))return[];const r=u(t.innerText||t.textContent);if(!r||r.length>Ct)return[];const n=[];let o=null;const i=(t,e,r)=>{if(t.nodeType===Node.TEXT_NODE){const i=String(t.textContent||"");for(let a=0;a<i.length;a+=1){const s=i[a];if(!s)continue;const l=document.createRange();l.setStart(t,a),l.setEnd(t,a+1);const c=l.getBoundingClientRect();if(l.detach(),c.width<.5||c.height<.5){o&&/\\s/.test(s)&&(pt(o.runs,ht(s,r,e)),o.text+=s);continue}let d=n.find(t=>Math.abs(t.top-c.top)<Math.max(3,.3*c.height));d||(d={top:c.top,left:c.left,right:c.right,bottom:c.bottom,text:"",runs:[]},n.push(d)),pt(d.runs,ht(s,r,e)),d.text+=s,d.left=Math.min(d.left,c.left),d.right=Math.max(d.right,c.right),d.bottom=Math.max(d.bottom,c.bottom),o=d}return}if(t.nodeType!==Node.ELEMENT_NODE)return;const a=t;if(a.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const s=window.getComputedStyle(a);a.childNodes.forEach(t=>i(t,a,s))};t.childNodes.forEach(r=>i(r,t,e));const a=n.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>{gt(t.runs);const e=u(t.runs.map(t=>t.text).join(""));return e?{text:e,rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top},runs:t.runs}:null}).filter(Boolean);return u(a.map(t=>t.text).join(""))===r?a:[]},xt=t=>{const e={ringWidthPx:void 0,ringColorSource:"",ringInset:!1,borderWidthPx:void 0,borderSideWidthPx:{left:void 0,top:void 0,right:void 0,bottom:void 0},borderSideColorSource:{left:"",top:"",right:"",bottom:""},borderColorSource:"",borderDash:void 0,backgroundColorSource:"",radiusPx:void 0,radiusFull:!1},r=String(t?.className||"").split(/\\s+/).filter(Boolean);for(const t of r){const r=J(t);if("ring-inset"===r){e.ringInset=!0;continue}"border-dashed"===r||"border-dotted"===r?e.borderDash="dash":"border-solid"===r&&(e.borderDash="solid");const n=nt(r);void 0!==n&&(e.ringWidthPx=n);const o=tt(r);o&&(e.ringColorSource=o);const i=ot(r);void 0!==i&&(e.borderWidthPx=i);const a=it(r);a&&a.sides.forEach(t=>{e.borderSideWidthPx[t]=a.width});const s=at(r);s&&s.sides.forEach(t=>{e.borderSideColorSource[t]=s.colorSource});const l=et(r);l&&(e.borderColorSource=l);const c=rt(r);c&&(e.backgroundColorSource=c);const d=st(r);d?.full?e.radiusFull=!0:void 0!==d?.px&&(e.radiusPx=d.px)}return e},Ft=(t,e,r)=>{let n=null;if(t.boxShadow&&"none"!==t.boxShadow)for(const r of(t=>{const e=[];let r="",n=0;for(const o of String(t||""))"("===o?n+=1:")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(r.trim()&&e.push(r.trim()),r=""):r+=o;return r.trim()&&e.push(r.trim()),e})(t.boxShadow)){if(/\\binset\\b/i.test(r))continue;const t=r.match(/rgba?\\([^)]*\\)|#[0-9a-fa-f]{3,8}/i);if(!t)continue;const o=t[0],i=rgbToHex(o);if(!i||B(o)*e<.04)continue;const a=r.replace(o," ").match(/-?\\d*\\.?\\d+(?:px)?/g)?.map(t=>Number.parseFloat(t))||[];if(a.length<4)continue;const[s,l,c,d]=a;Math.abs(s)>.5||Math.abs(l)>.5||Math.abs(c)>.5||!Number.isFinite(d)||d<=.5||(!n||d>n.w)&&(n={w:d,c:i,colorSource:o})}if(r?.ringInset)return n;if(r?.ringWidthPx>0){const t=r.ringColorSource||n?.colorSource||"rgba(59, 130, 246, 0.5)",o=rgbToHex(t);if(o&&B(t)*e>=.04){const e={w:r.ringWidthPx,c:o,colorSource:t};if(!n||e.w>n.w)return e}}return n},wt=Array.from(x.querySelectorAll("section,main,article,header,footer,aside,div,figure,figcaption,table,thead,tbody,tfoot,tr,td,th,span")),Et=[],St=S*y*.005;for(const t of wt){if(Et.length>=i)continue;if(b(t))continue;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:a,h:s}=P(t);if(!L(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;const l=(e.backgroundImage||"").trim();if(l&&"none"!==l)continue;if(e.clipPath&&"none"!==e.clipPath||e.maskImage&&"none"!==e.maskImage||e.webkitMaskImage&&"none"!==e.webkitMaskImage||e.mixBlendMode&&"normal"!==e.mixBlendMode||e.backgroundBlendMode&&"normal"!==e.backgroundBlendMode||e.backdropFilter&&"none"!==e.backdropFilter)continue;const c=Number(e.opacity||"1");if(c<.15)continue;const d=xt(t),h=rgbToHex(e.backgroundColor)?e.backgroundColor:d.backgroundColorSource,g=rgbToHex(h),f=()=>{const t=[{side:"left",w:e.borderLeftWidth,c:e.borderLeftColor,s:e.borderLeftStyle},{side:"top",w:e.borderTopWidth,c:e.borderTopColor,s:e.borderTopStyle},{side:"right",w:e.borderRightWidth,c:e.borderRightColor,s:e.borderRightStyle},{side:"bottom",w:e.borderBottomWidth,c:e.borderBottomColor,s:e.borderBottomStyle}],r=[],n=(t,e=!1)=>{const n=r.findIndex(e=>e.side===t.side);n>=0?e&&(r[n]=t):r.push(t)},o=t=>{const e=r.findIndex(e=>e.side===t);e>=0&&r.splice(e,1)};for(const e of t){const t=Number.parseFloat(e.w||"0")||0;if(t<=0||"none"===e.s)continue;const r=rgbToHex(e.c);r&&n({side:e.side,w:t,c:r,colorSource:e.c,dash:"dashed"===e.s||"dotted"===e.s?"dash":"solid"})}if(d.borderWidthPx>0){const t=d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",r=rgbToHex(t);if(r&&B(t)*c>=.04)for(const e of["left","top","right","bottom"])n({side:e,w:d.borderWidthPx,c:r,colorSource:t,dash:d.borderDash||"solid"},!0)}for(const t of["left","top","right","bottom"]){const i=d.borderSideWidthPx?.[t],a=d.borderSideColorSource?.[t];if(void 0===i&&!a)continue;if(void 0!==i&&i<=0){o(t);continue}const s=r.find(e=>e.side===t),l=i>0?i:s?.w;if(!(l>0))continue;const u=a||s?.colorSource||d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",h=rgbToHex(u);!h||B(u)*c<.04||n({side:t,w:l,c:h,colorSource:u,dash:s?.dash||d.borderDash||"solid"},!0)}return r},m=f(),p=(()=>{let t=null;for(const e of m)(!t||e.w>t.w)&&(t=e);if(d.borderWidthPx>0){const r=d.borderColorSource||t?.colorSource||e.borderColor||"rgba(229, 231, 235, 1)",n=rgbToHex(r);if(n&&B(r)*c>=.04){const e={w:d.borderWidthPx,c:n,colorSource:r,dash:d.borderDash||"solid"};(!t||e.w>t.w)&&(t=e)}}const r=Ft(e,c,d);return r&&(!t||r.w>t.w)?{...r,dash:"solid"}:t})(),x=(t,e)=>t&&e&&t.c===e.c&&t.dash===e.dash&&Math.abs(t.w-e.w)<.1&&Math.abs(D(t.colorSource,c)-D(e.colorSource,c))<=1,F=4===m.length&&m.every(t=>x(t,m[0])),w=m.length>0&&!F&&!d.ringWidthPx,E=w?null:p,S=E?E.c:"",y=E?E.w:0,N=Boolean(p),_=Boolean(E),I=Math.min(r.width,r.height),H=Number.parseFloat(e.borderTopLeftRadius||e.borderRadius||"0")||(d.radiusFull?I/2:d.radiusPx||0),W=Boolean(e.boxShadow&&"none"!==e.boxShadow),O=i=>{if(!i)return null;const l=.001;let d=n,u=o,h=a,g=l;return"bottom"===i.side?u=A(r.bottom-i.w/2):"top"===i.side?u=A(r.top+i.w/2):"right"===i.side?(d=M(r.right-i.w/2),h=l,g=s):(d=M(r.left+i.w/2),h=l,g=s),{x:d,y:u,w:Math.max(l,h),h:Math.max(l,g),order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",rotate:v(e),border:{color:i.c,widthPt:.75*i.w,transparency:D(i.colorSource,c),dash:i.dash||"solid"}}},j=!g&&!H&&!W,z=(t,e)=>m.map(t=>t.side).sort().join("|")===[t,e].sort().join("|"),U=j&&2===m.length&&void 0!==v(e)&&r.width<=42&&r.height<=42&&(z("top","right")||z("right","bottom")||z("bottom","left")||z("left","top")),$=(()=>{if(!U)return[];const e=m[0];if(!e)return[];const n=r.left+.18*r.width,o=r.top+.18*r.height,i=.58*r.width,a=.32*r.height,s={order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",border:{color:e.c,widthPt:.75*e.w,transparency:D(e.colorSource,c),dash:e.dash||"solid"}};return[{...s,x:M(n),y:A(o),w:Math.max(.001,C(i)),h:Math.max(.001,T(a))},{...s,x:M(n),y:A(o+.32*r.height),w:Math.max(.001,C(i)),h:Math.max(.001,T(a)),flipV:!0}]})();if($.length>0){if(Et.length+$.length>i)continue;$.forEach(t=>Et.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}const X=w?m.map(t=>O(t)).filter(Boolean):[];if(X.length>0&&j){if(Et.length+X.length>i)continue;X.forEach(t=>Et.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}if(!(g&&(g!==k||H||W)||N))continue;const V=Boolean(u(t.innerText||t.textContent)),G=g&&g!==k&&(H>0||W||V&&r.width>=12&&r.height>=12),K=t.parentElement?String(window.getComputedStyle(t.parentElement).display||""):"",Q=g&&g!==k&&!N&&!H&&!W&&/grid/i.test(K)&&!u(t.innerText||t.textContent)&&r.width>=8&&r.height>=8,Y=g&&g!==k&&!H&&!W&&!u(t.innerText||t.textContent)&&(r.width>=24&&r.height>=2&&r.height<12||r.height>=24&&r.width>=2&&r.width<12);if(!N&&!G&&!Q&&r.width*r.height<St)continue;if((r.width<12||r.height<12)&&!Y)continue;if(Et.length+1+X.length>i)continue;const J=Math.max(0,Math.min(H,I/2)),Z=J>0&&I>0?Math.max(0,Math.min(5e4,Math.round(J/I*1e5))):0,tt=J>0&&Math.abs(r.width-r.height)<1.5&&J>=I/2-.5?"ellipse":J>0?"roundRect":"rect";Et.push({x:n,y:o,w:a,h:s,order:R(t),paintId:q(t),fill:g,transparency:g?D(h,c):100,radius:H,radiusAdj:Z,shapeType:tt,rotate:v(e),border:_?{color:S,widthPt:.75*y,transparency:D(E.colorSource||e.borderColor,c),dash:E.dash||"solid"}:void 0}),X.length>0&&X.forEach(t=>Et.push(t)),t.setAttribute("data-pptx-extracted-shape","1")}const yt=[],Mt=new Set,At=new Set,Ct=180,Tt=t=>{for(const e of At)if(e.contains(t))return!0;return!1},Nt=(t,e,n,o,i=!1)=>{if(i)return Math.max(.12,Math.min(r-t,1.1*e));const a=/[\\u3400-\\u9fff\\uf900-\\ufaff]/.test(o)?1.15:1.08,s=Math.max(.08,Math.min(.3,n/72*.2));return Math.max(.12,Math.min(r-t,e*a+s))},Bt=(t,e)=>{const r=Math.max(.02,Math.min(.1,e/72*.08));return Math.max(.06,1.08*t+r)},Dt=t=>{if(!t.letterSpacing||"normal"===t.letterSpacing)return 0;const e=Number.parseFloat(t.letterSpacing);return Number.isFinite(e)?e:0},_t=(t,e)=>{const r=Number.parseFloat(t[e]||"0")||0;return Math.max(0,Math.min(72,r*N))},vt=t=>{const e=Number.parseFloat(String(t||"0"));return Number.isFinite(e)?Math.max(0,e):0},kt=t=>{if(!t||"LI"!==String(t.tagName||"").toUpperCase())return;const e=t.parentElement?.closest?.("ol,ul");if(!e)return;if("none"===String(window.getComputedStyle(t).listStyleType||""))return;let r=0,n=t.parentElement;for(;n&&n!==x;)"OL"!==n.tagName&&"UL"!==n.tagName||(r+=1),n=n.parentElement;const o=Math.max(0,r-1);if("OL"===String(e.tagName||"").toUpperCase()){const r=Number.parseInt(t.getAttribute("value")||"",10);if(Number.isFinite(r)&&r>0)return{type:"number",level:o,startAt:r};const n=Number.parseInt(e.getAttribute("start")||"1",10)||1,i=Array.from(e.children||[]).filter(t=>"LI"===t.tagName).indexOf(t);return{type:"number",level:o,startAt:Math.max(1,n+Math.max(0,i))}}return{type:"bullet",level:o}},Lt=t=>/vertical/i.test(String(t.writingMode||"")),Pt=t=>{const e=_(t);return[e.color,Math.round(100*e.opacity),String(t.fontSize||""),String(t.fontWeight||""),String(t.fontStyle||""),String(t.textDecorationLine||t.textDecoration||"")].join("|")},It=(t,e)=>{const r=Pt(e),n=Array.from(t.children||[]);for(const t of n){if(!u(t.innerText||t.textContent)||t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;const n=window.getComputedStyle(t),o=t.getBoundingClientRect();if(L(t,n,o)){if(Pt(n)!==r)return!0;if(It(t,e))return!0}}return!1},Rt=(t,e,n,i,a=!1,s={})=>{if(yt.length>=o)return;if(!(t=a?g(t):h(t)))return;if(!L(i,n,e))return;if(e.width<2||e.height<2)return;const l=Lt(n);if(l){if(!(t=(t=>{const e=u(t).replace(/\\s+/g,"");return e?Array.from(e).join("\\n"):""})(t)))return;a=!1}const c=kt(i),f=s.useElementInsets&&!l?((t,e)=>{const r=vt(t.paddingLeft)+vt(t.borderLeftWidth),n=vt(t.paddingRight)+vt(t.borderRightWidth),o=vt(t.paddingTop)+vt(t.borderTopWidth),i=vt(t.paddingBottom)+vt(t.borderBottomWidth),a=Math.max(0,.45*e.width),s=Math.max(0,.45*e.height);return{paddingLeft:C(Math.min(r,a)),paddingRight:C(Math.min(n,a)),paddingTop:T(Math.min(o,s)),paddingBottom:T(Math.min(i,s))}})(n,e):void 0,m=Boolean(f&&(f.paddingLeft||f.paddingRight||f.paddingTop||f.paddingBottom)),p=Array.isArray(s.runs)?s.runs.filter(t=>t&&u(t.text)):void 0;if(a&&!l&&!c&&!m&&!p?.length){const r=((t,e,r)=>{if(!d||!t||e.width<4||e.height<4)return null;if(v(r))return null;const n=Number.parseFloat(r.fontSize||"16")||16,o=((t,e)=>{const r=Number.parseFloat(t.lineHeight||"");return Number.isFinite(r)&&r>0?r:1.18*e})(r,n);try{const i=d.prepareWithSegments(t,((t,e)=>{const r=Number.parseInt(t.fontWeight||"400",10)||400,n="italic"===t.fontStyle||"oblique"===t.fontStyle?"italic":"",o=String(t.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",i=/^[a-z0-9 -]+$/i.test(o)?o:\'"\'+o.replace(/"/g,"")+\'"\';return[n,String(r),e.toFixed(2)+"px",i].filter(Boolean).join(" ")})(r,n),{whiteSpace:"pre-wrap",letterSpacing:Dt(r)}),a=d.layoutWithLines(i,Math.max(1,e.width),o);return a?.lines?.length?{lineHeightPx:o,lines:a.lines.map((t,n)=>{const i=u(String(t.text||""));if(!i)return null;const a=Math.max(1,Math.min(e.width,Number(t.width)||e.width));let s=e.left;return"center"===r.textAlign?s+=Math.max(0,(e.width-a)/2):"right"!==r.textAlign&&"end"!==r.textAlign||(s+=Math.max(0,e.width-a)),{text:i,rect:{left:s,top:e.top+n*o,right:s+a,bottom:e.top+(n+1)*o,width:a,height:o}}}).filter(Boolean)}:null}catch(t){return null}})(t,e,n);if(r&&r.lines.length>0)return void r.lines.forEach(t=>Rt(t.text,t.rect,n,i,!1))}const b=((t,e)=>[t.toLowerCase(),Math.round(e.left),Math.round(e.top),Math.round(e.width),Math.round(e.height)].join("|"))(t,e);if(Mt.has(b))return;Mt.add(b);const x=Number.parseFloat(n.fontSize||"16")||16,F=Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_13__,x*N)),w=ut(i),E=ct(i),S=dt(n),y=w||E||S||400,B=String(n.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",D=M(e.left),k=_(n),P=((t,e,r)=>{if(e)return"center";const n=String(t.textAlign||"");if("center"===n)return"center";if("right"===n||"end"===n)return"right";if(r&&"justify"===n)return"justify";const o=String(t.display||"");if(o.includes("flex")||o.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/row-reverse/i.test(e),o=String(r?t.alignItems||"":t.justifyContent||"");if("center"===o)return"center";if(!r&&("start"===o||"flex-start"===o))return n?"right":"left";if("end"===o||"flex-end"===o||"right"===o)return n?"left":"right"}return"left"})(n,l,a),I=(t=>{const e=String(t.verticalAlign||"");if("middle"===e)return"middle";if("bottom"===e||"text-bottom"===e)return"bottom";const r=String(t.display||"");if(r.includes("flex")||r.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/column-reverse/i.test(e),o=/column/i.test(e)?String(t.justifyContent||""):String(t.alignItems||"");if("center"===o)return"middle";if(r&&("start"===o||"flex-start"===o))return n?"bottom":"top";if("end"===o||"flex-end"===o)return n?"top":"bottom"}return"top"})(n);yt.push({text:t,x:D,y:A(e.top),w:l?Math.max(.12,C(e.width)+Math.max(.02,F/72*.08)):m||"left"!==P?Math.max(.12,Math.min(r-D,C(e.width))):Nt(D,C(e.width),F,t,a),h:l?Math.max(.12,T(e.height)):m?Math.max(.08,T(e.height)):a?Math.max(.12,T(e.height)+Math.max(.02,F/72*.08)):"top"!==I?Math.max(.08,T(e.height)):Bt(T(e.height),F),fontSize:F,fontFace:B,color:k.color,bold:y>=600||/^H[1-6]$/i.test(i.tagName),italic:"italic"===n.fontStyle||"oblique"===n.fontStyle,underline:String(n.textDecoration||"").includes("underline"),strike:String(n.textDecoration||"").includes("line-through"),align:P,opacity:k.opacity,rotate:v(n),order:R(i),paintId:q(i),paragraphSpacingBefore:_t(n,"marginTop"),paragraphSpacingAfter:_t(n,"marginBottom"),verticalAlign:I,...m?f:{},bullet:c,lineSpacing:n.lineHeight&&"normal"!==n.lineHeight?Math.max(1.08*F,(Number.parseFloat(n.lineHeight)||0)*N):l?1.02*F:t.includes("\\n")?1.18*F:void 0,charSpacing:n.letterSpacing&&"normal"!==n.letterSpacing?(Number.parseFloat(n.letterSpacing)||0)*N:void 0,...p?.length?{runs:p}:{},wrap:a})},Ht=(t,e,r)=>{if(!r)return!1;if(t.querySelector?.(".katex"))return!1;if(t.closest?.("[data-pptx-formula-block]"))return!1;if((t=>Boolean(t.querySelector(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,div,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,.katex\')))(t))return!1;if(["SCRIPT","STYLE","NOSCRIPT","SVG","CANVAS","VIDEO","IFRAME","MATH"].includes(t.tagName))return!1;if((t=>!!t.closest?.(\'[data-pptx-dom-table="1"]\')&&Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();if(!L(t,e,r))return!1;const n=Boolean(rgbToHex(e.backgroundColor)),o=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0&&"none"!==e["border"+t+"Style"]);return n||o}))(t))return!1;if(((t,e)=>!!/grid/i.test(String(e.display||""))&&Array.from(t.children||[]).filter(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();return L(t,e,r)}).length>=2)(t,e))return!1;const n=t.tagName;if(/^H[1-6]$/.test(n)||["P","LI","BLOCKQUOTE","TD","TH","FIGCAPTION"].includes(n))return!0;if(It(t,e))return!1;if(t.matches(\'[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title\'))return!0;if(!["block","flex","grid","table-cell","list-item"].includes(e.display)&&!["absolute","fixed"].includes(e.position)||r.length<6||r.length>180)return!1;const o=Array.from(t.children);if(o.length>=2){let t=0,e=0;for(const r of o){if(r.closest("script, style, noscript"))continue;const n=window.getComputedStyle(r);if("none"===n.display||"hidden"===n.visibility||Number(n.opacity||"1")<.04)continue;e++;const o=rgbToHex(n.backgroundColor);o&&o!==k&&t++}if(e>=2&&t===e)return!1}return!0},Wt=(t,e,r)=>{if(yt.length>=o)return;if(t.nodeType===Node.TEXT_NODE)return void((t,e,r)=>{if(yt.length>=o)return;if(r&&Tt(r))return;if(r&&r.closest?.(".katex, .katex-mathml, [data-pptx-formula-block]"))return;if(r&&b(r))return;const n=h(t.textContent);if(!n)return;const i=document.createRange();i.selectNode(t);const a=i.getBoundingClientRect(),s=Array.from(i.getClientRects());i.detach();const l=Number.parseFloat(e.fontSize||"16")||16;if(s.length>1||a.height>1.7*l){const o=(t=>{const e=String(t.textContent||"");if(e.length>Ct)return[];const r=[];let n=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(!i)continue;const a=document.createRange();a.setStart(t,o),a.setEnd(t,o+1);const s=a.getBoundingClientRect();if(a.detach(),s.width<.5||s.height<.5){n&&/\\s/.test(i)&&(n.text+=i);continue}let l=r.find(t=>Math.abs(t.top-s.top)<Math.max(3,.3*s.height));l||(l={top:s.top,text:"",left:s.left,right:s.right,bottom:s.bottom},r.push(l)),l.text+=i,l.left=Math.min(l.left,s.left),l.right=Math.max(l.right,s.right),l.bottom=Math.max(l.bottom,s.bottom),n=l}return r.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>({text:u(t.text),rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top}})).filter(t=>t.text)})(t);return o.length>1?void o.forEach(t=>Rt(t.text,t.rect,e,r,!1)):void Rt(n,a,e,r,!0)}Rt(n,a,e,r,!1)})(t,e,r);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(At.has(n))return;if(n.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;if(b(n))return;const i=window.getComputedStyle(n),a=n.getBoundingClientRect();if(!L(n,i,a))return;const s=!["block","flex","grid","table","list-item"].includes(i.display)&&!["absolute","fixed","sticky"].includes(i.position)||(t=>["SPAN","B","STRONG","I","EM","U","FONT","SUB","SUP","A","SMALL","BIG","MARK"].includes(t.tagName))(n)?i||e:i;n.childNodes.forEach(t=>Wt(t,s,n))};(()=>{const t=Array.from(x.querySelectorAll(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,div\'));for(const e of t){if(yt.length>=o)break;if(e.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;if(b(e))continue;if(Tt(e))continue;const t=window.getComputedStyle(e),r=e.getBoundingClientRect(),n=g(e.innerText||e.textContent);if(!L(e,t,r))continue;if(!Ht(e,t,n))continue;const i=Number.parseFloat(t.fontSize||"16")||16,a=r.height<=1.55*i,s=i>=28||/^H[1-6]$/.test(e.tagName),l=mt(e,t),c=l?.length?bt(e,t):[];c.length>1&&!kt(e)?(c.forEach(r=>{Rt(r.text,r.rect,t,e,!1,{runs:r.runs})}),At.add(e),e.setAttribute("data-pptx-extracted-text","1")):(Rt(n,r,t,e,!(a&&s),{useElementInsets:!0,runs:l}),At.add(e),e.setAttribute("data-pptx-extracted-text","1"))}})(),x.childNodes.forEach(t=>{const e=window.getComputedStyle(x);Wt(t,e,x)});const Ot=t=>/^data:image\\/(?:png|jpeg|jpg|gif);base64,/i.test(String(t||"")),jt=async(t,e,r)=>t?await new Promise(n=>{const o=t instanceof HTMLImageElement?t:new Image;let i="";const a=()=>{i&&URL.revokeObjectURL(i)},s=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,s=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=document.createElement("canvas");l.width=Math.max(1,Math.min(4096,Math.round(t*s))),l.height=Math.max(1,Math.min(4096,Math.round(i*s)));const c=l.getContext("2d");if(!c)return a(),void n("");c.clearRect(0,0,l.width,l.height),c.drawImage(o,0,0,l.width,l.height),a(),n(l.toDataURL("image/png"))}catch(t){a(),n("")}};if(t instanceof HTMLImageElement)return t.complete&&(t.naturalWidth||t.width)?void s():(t.addEventListener("load",s,{once:!0}),void t.addEventListener("error",()=>n(""),{once:!0}));o.onload=s,o.onerror=()=>{a(),n("")},t instanceof Blob?(i=URL.createObjectURL(t),o.src=i):(o.crossOrigin="anonymous",o.src=String(t))}):"",zt=async(t,e,r)=>{const n=String(t||"").trim();if(!n)return"";if(Ot(n))return n;if(/^data:image\\//i.test(n))return await jt(n,e,r);try{return await(async(t,e,r)=>{try{const n=await fetch(t);if(!n.ok)return"";const o=await n.blob(),i=String(o.type||"").toLowerCase();return/^image\\/(?:png|jpeg|jpg|gif)$/.test(i)?await(async t=>await new Promise(e=>{const r=new FileReader;r.onloadend=()=>e(String(r.result||"")),r.onerror=()=>e(""),r.readAsDataURL(t)}))(o):await jt(o,e,r)}catch{return""}})(new URL(n,document.baseURI).toString(),e,r)}catch{return""}},Ut=t=>{try{return t.width&&t.height?t.toDataURL("image/png"):""}catch{return""}},qt=async(t,e,r)=>{if(!t.currentSrc&&!t.src)return"";try{const n=t.currentSrc||t.src;return Ot(n)?n:await jt(t,e,r)||await zt(n,e,r)}catch{return await zt(t.currentSrc||t.src,e,r)}},$t=async(t,e,r)=>t?await new Promise(n=>{const o=new Image;o.onload=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,a=Math.max(1,Math.min(2,window.devicePixelRatio||1)),s=document.createElement("canvas");s.width=Math.max(1,Math.min(4096,Math.round(t*a))),s.height=Math.max(1,Math.min(4096,Math.round(i*a)));const l=s.getContext("2d");if(!l)return void n("");l.clearRect(0,0,s.width,s.height),l.drawImage(o,0,0,s.width,s.height),n(s.toDataURL("image/png"))}catch(t){n("")}},o.onerror=()=>n(""),o.src=t}):"",Xt=async(t,e,r)=>Ot(t)?l<=128||t.length<=l?t:await new Promise(n=>{const o=new Image;o.onload=()=>{try{const i=o.naturalWidth||o.width||Number(e)||1,a=o.naturalHeight||o.height||Number(r)||1,s=Math.min(1,.9*Math.sqrt(l/t.length)),c=[s,.72*s,.5*s].filter((t,e,r)=>t>.08&&r.indexOf(t)===e);for(const t of c){const e=document.createElement("canvas");e.width=Math.max(1,Math.min(4096,Math.round(i*t))),e.height=Math.max(1,Math.min(4096,Math.round(a*t)));const r=e.getContext("2d");if(!r)continue;r.clearRect(0,0,e.width,e.height),r.drawImage(o,0,0,e.width,e.height);const s=e.toDataURL("image/png");if(s.length<=l)return void n(s);const c=e.toDataURL("image/jpeg",.9);if(c.length<=l)return void n(c)}}catch(t){}n("")},o.onerror=()=>n(""),o.src=t}):"",Vt=async(t,e,r)=>{try{const n=t.cloneNode(!0),o=(t,e)=>{if(!t||!e||t.nodeType!==Node.ELEMENT_NODE||e.nodeType!==Node.ELEMENT_NODE)return;const r=window.getComputedStyle(t),n=r.color||"";!n||e.getAttribute("color")&&"currentColor"!==e.getAttribute("color")||e.setAttribute("color",n),["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","letter-spacing","text-anchor","dominant-baseline","visibility","display"].forEach(t=>{const o=e.getAttribute(t),i=r.getPropertyValue(t)||r[t]||"";o&&"currentColor"!==o||!i||"none"===i?"currentColor"===o&&n&&e.setAttribute(t,n):e.setAttribute(t,i)});const i=Array.from(t.children||[]);Array.from(e.children||[]).forEach((t,e)=>o(i[e],t))};if(o(t,n),n.getAttribute("xmlns")||n.setAttribute("xmlns","http://www.w3.org/2000/svg"),!n.getAttribute("viewBox")&&t.getBBox)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&n.setAttribute("viewBox",[e.x,e.y,e.width,e.height].join(" "))}catch(t){}const i=(new XMLSerializer).serializeToString(n),a=btoa(unescape(encodeURIComponent(i)));return await $t("data:image/svg+xml;base64,"+a,e,r)}catch{return""}};await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));const Gt=[],Kt=Array.from(x.querySelectorAll("img,canvas,svg"));for(const t of Kt){if(Gt.length>=a)break;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!L(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;if(Number(e.opacity||"1")<.15)continue;const l=String(t.tagName||"").toUpperCase(),c="CANVAS"===l?Ut(t):"SVG"===l?await Vt(t,r.width,r.height):await qt(t,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:t.getAttribute("alt")||"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1"))}const Qt=new Set(Gt.map(t=>t.dataUri)),Yt=t=>{const e=String(t||"");if(!e||"none"===e)return[];const r=[],n=/url\\((?:["\']?)(.*?)(?:["\']?)\\)/gi;let o;for(;o=n.exec(e);){const t=String(o[1]||"").trim();t&&!t.startsWith("data:font/")&&r.push(t)}return r},Jt=[];for(const t of x.querySelectorAll("*")){if(Jt.length>=a)break;const e=window.getComputedStyle(t),r=e.backgroundImage||"";0!==Yt(r).length&&1===Yt(r).length&&!/gradient\\(|image-set\\(|cross-fade\\(/i.test(r)&&["auto","auto auto","100% 100%"].includes(String(e.backgroundSize||"").trim())&&/^(?:0(?:px|%)?\\s+)?0(?:px|%)?$/i.test(String(e.backgroundPosition||"").trim())&&"no-repeat"===String(e.backgroundRepeat||"").trim()&&Jt.push({el:t,style:e})}for(const{el:t,style:e}of Jt){if(Gt.length>=a)break;const{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!L(t,e,r))continue;const l=Yt(e.backgroundImage||"")[0];if(!l)continue;const c=/^data:image\\/svg\\+xml;base64,/i.test(l)?await $t(l,r.width,r.height):await zt(l,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Qt.has(d)||(Qt.add(d),Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")))}return(t=>{const e=(()=>{const t=Array.from(z.entries()).filter(([,t])=>t&&t.isConnected);if(0===t.length)return new Map;const e=t.map(([t])=>t),r=new Map(t.map(([t,e])=>[t,O(e)])),n=(t,e)=>((t,e)=>{const r=t?.key||[],n=e?.key||[],o=Math.max(r.length,n.length);for(let t=0;t<o;t+=1){const e=r[t]||{z:0,order:0},o=n[t]||{z:0,order:0};if(e.z!==o.z)return e.z-o.z;if(e.order!==o.order)return e.order-o.order}return(t?.order||0)-(e?.order||0)})(r.get(t),r.get(e));if(!document.elementsFromPoint)return(()=>{const t=new Map;let r=1;return e.slice().sort(n).forEach(e=>{t.set(e,r),r+=1}),t})();const o=new Map(e.map(t=>[t,new Set])),i=new Map(e.map(t=>[t,0])),a=(t,e)=>{if(!(t&&e&&t!==e&&o.has(t)&&i.has(e)))return;const r=o.get(t);r.has(e)||(r.add(e),i.set(e,(i.get(e)||0)+1))},s=t=>{let e=t;for(;e&&e!==document&&e!==document.documentElement;){const t=e.getAttribute?.("data-pptx-paint-id")||"";if(t&&z.has(t))return t;e=e.parentElement}return""},l=(t,e)=>{const r=new Set,n=[];for(const o of document.elementsFromPoint(t,e)){const t=s(o);t&&!r.has(t)&&(r.add(t),n.push(t))}return n},c=t=>{const e=Math.max(0,t.left),r=Math.max(0,t.top),n=Math.min(window.innerWidth,t.right),o=Math.min(window.innerHeight,t.bottom);if(n<=e||o<=r)return[];const i=e+.25*(n-e),a=e+.5*(n-e),s=e+.75*(n-e),l=r+.25*(o-r),c=r+.5*(o-r),d=r+.75*(o-r);return[[a,c],[i,l],[s,l],[i,d],[s,d],[a,l],[a,d],[i,c],[s,c]]},d=document.createElement("style");d.id="ohmyppt-paint-order-pointer-events",d.textContent="[data-pptx-paint-id] { pointer-events: auto !important; }",document.head.appendChild(d);try{for(const[,e]of t){const t=e.getBoundingClientRect();for(const[e,r]of c(t)){const t=l(e,r);for(let e=0;e<t.length;e+=1)for(let r=e+1;r<t.length;r+=1)a(t[r],t[e])}}}finally{d.remove()}const u=e.filter(t=>0===(i.get(t)||0)).sort(n),h=new Map;let g=1;for(;u.length>0;){const t=u.shift();if(t&&!h.has(t)){h.set(t,g),g+=1;for(const e of o.get(t)||[])i.set(e,Math.max(0,(i.get(e)||0)-1)),0===(i.get(e)||0)&&(u.push(e),u.sort(n))}}return e.filter(t=>!h.has(t)).sort(n).forEach(t=>{h.set(t,g),g+=1}),h})();t.forEach(t=>{t&&t.paintId&&(e.has(t.paintId)&&(t.order=e.get(t.paintId)),delete t.paintId)})})([...Et,...yt,...Gt]),{backgroundColor:k,shapes:Et,texts:yt,images:Gt,tables:m}})()'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(t.pageHeightPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_4__",String(JSON.stringify(n))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_5__",String(JSON.stringify(o))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_6__",String(JSON.stringify(a))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_7__",String(JSON.stringify(l))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_8__",String(JSON.stringify(Math.ceil(4*s/3)+128))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_9__",String(JSON.stringify(i))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_10__",String("\nconst rgbToHex = (value) => {\n const source = String(value || '').trim();\n if (!source || source === 'transparent') return '';\n if (source.startsWith('#')) {\n const raw = source.slice(1).toUpperCase();\n return raw.length === 3 ? raw.split('').map((part) => part + part).join('') : raw;\n }\n const match = source.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);\n if (!match) return '';\n const alpha = match[4] === undefined\n ? 1\n : String(match[4]).endsWith('%')\n ? Number.parseFloat(match[4]) / 100\n : Number(match[4]);\n if (alpha <= 0.02) return '';\n return [match[1], match[2], match[3]]\n .map((part) => Math.max(0, Math.min(255, Math.round(Number(part) || 0))).toString(16).padStart(2, '0'))\n .join('')\n .toUpperCase();\n};\n")).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_11__",String(c)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_12__",String(144)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_13__",String(144))},exports.generatePptx=t=>r.buildPptxDocument(t),exports.normalizeExtractedHtmlToPptxSlide=(t,e)=>{const r=t&&"object"==typeof t?t:{},n=Array.isArray(r.texts)?r.texts:[],o=Array.isArray(r.shapes)?r.shapes:[],i=Array.isArray(r.images)?r.images:[],h=Array.isArray(r.tables)?r.tables:[],p=n.map(t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||"")).slice(0,1e3);if(!r)return null;const n=Array.isArray(e.runs)?e.runs.map(m).filter(t=>null!==t):[],o=e.bullet&&"object"==typeof e.bullet?e.bullet:null,i="bullet"===o?.type||"number"===o?.type?o.type:void 0,h=i&&o?{type:i,level:Number.isFinite(Number(o.level))?s(Number(o.level),0,8):void 0,startAt:Number.isFinite(Number(o.startAt))?s(Number(o.startAt),1,32767):void 0}:void 0;return{text:r,x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.4,.1,a),h:s(Number(e.h)||.2,.08,l),fontSize:s(Number(e.fontSize)||12,6,144),fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",opacity:s(Number(e.opacity??1),0,1),rotate:s(Number(e.rotate??0),-360,360),lineSpacing:Number(e.lineSpacing)>0?s(Number(e.lineSpacing),1,200):void 0,charSpacing:Number.isFinite(Number(e.charSpacing))?s(Number(e.charSpacing),-20,200):void 0,paragraphSpacingBefore:Number(e.paragraphSpacingBefore)>0?s(Number(e.paragraphSpacingBefore),0,72):void 0,paragraphSpacingAfter:Number(e.paragraphSpacingAfter)>0?s(Number(e.paragraphSpacingAfter),0,72):void 0,verticalAlign:"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:"top",paddingLeft:Number(e.paddingLeft)>0?s(Number(e.paddingLeft),0,2):void 0,paddingRight:Number(e.paddingRight)>0?s(Number(e.paddingRight),0,2):void 0,paddingTop:Number(e.paddingTop)>0?s(Number(e.paddingTop),0,1):void 0,paddingBottom:Number(e.paddingBottom)>0?s(Number(e.paddingBottom),0,1):void 0,bullet:h,runs:n.length>0?n:void 0,wrap:Boolean(e.wrap),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),f=o.map(t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.fill||""),""),n=e.border&&"object"==typeof e.border?e.border:null,o=c(String(n?.color||""),"");if(!r&&!o)return null;const i="ellipse"===e.shapeType||"roundRect"===e.shapeType||"line"===e.shapeType?e.shapeType:"rect",d="line"===i?.001:.05,u="line"===i?.001:.05;return{x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||d,d,a),h:s(Number(e.h)||u,u,l),fill:r,transparency:s(Number(e.transparency??0),0,100),radius:s(Number(e.radius??0),0,100),radiusAdj:s(Number(e.radiusAdj??0),0,5e4),border:o?{color:o,widthPt:s(Number(n?.widthPt??.75),.1,20),transparency:s(Number(n?.transparency??0),0,100),dash:"dash"===n?.dash?"dash":"solid"}:void 0,shapeType:i,rotate:s(Number(e.rotate??0),-360,360),flipV:Boolean(e.flipV),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),b=i.map(t=>{const e=t&&"object"==typeof t?t:{},r=String(e.dataUri||""),n=(t=>{const e=t.match(/^data:(image\/(?:png|jpeg|jpg|gif));base64,/i);return e?"image/jpg"===e[1].toLowerCase()?"image/jpeg":e[1].toLowerCase():""})(r);return!n||(t=>{const e=t.indexOf(",");if(e<0)return 0;const r=t.slice(e+1).replace(/\s/g,"");if(!r)return 0;const n=r.endsWith("==")?2:r.endsWith("=")?1:0;return Math.max(0,Math.floor(3*r.length/4)-n)})(r)>12582912?null:{dataUri:r,mimeType:n,x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.1,.05,a),h:s(Number(e.h)||.1,.05,l),alt:(o=String(e.alt||""),o.replace(/\s+/g," ").replace(/[\u200b-\u200d\ufeff]/g,"").trim()),rotate:s(Number(e.rotate??0),-360,360),opacity:s(Number(e.opacity??1),0,1),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0};var o}).filter(t=>Boolean(t)),x=h.map(g).filter(t=>null!==t);return{title:e,backgroundColor:c(String(r.backgroundColor||""),"FFFFFF"),backgroundImage:void 0,texts:p,shapes:f,images:b,tables:x.length>0?x:void 0,overlayImages:void 0}};
|
|
1
|
+
var t=require("module"),e=require("url"),r=require("./ooxml-writer.cjs");require("fflate"),require("./animation-writer.cjs");var n="undefined"!=typeof document?document.currentScript:null;const o=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("index.cjs",document.baseURI).href),i=e.pathToFileURL(o.resolve("@chenglou/pretext")).toString(),a=13.333,l=7.5,s=(t,e,r)=>Math.max(e,Math.min(r,t)),c=(t,e="111827")=>{if(!t)return e;const r=t.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(r)?r.split("").map(t=>`${t}${t}`).join(""):/^[0-9A-F]{6}$/.test(r)?r:e},d=t=>{const e=t.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\n")},u=(t,e)=>{const r=(t=>String(t||"").split(",").map(t=>t.trim().replace(/^["']|["']$/g,"")).find(Boolean)||"Aptos")(e);return(t=>/[\u3400-\u9fff\uf900-\ufaff]/.test(t))(t)&&/^(aptos|arial|helvetica|inter|system-ui|-apple-system|sans-serif|serif)$/i.test(r)?"Microsoft YaHei":r},h=t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||""));if(!r)return null;const n=Math.max(1,Number(e.rowspan)||1),o=Math.max(1,Number(e.colspan)||1),i=e.border&&"object"==typeof e.border?e.border:null,h=i?c(String(i.color||""),""):"";return{text:r,rowspan:n,colspan:o,x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.1,.05,a),h:s(Number(e.h)||.05,.03,l),fontSize:e.fontSize?s(Number(e.fontSize),6,144):void 0,fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",valign:"middle"===e.valign||"bottom"===e.valign?e.valign:"top",fill:e.fill?c(String(e.fill),""):void 0,fillTransparency:e.fillTransparency?s(Number(e.fillTransparency),0,100):void 0,border:h?{color:h,widthPt:s(Number(i?.widthPt??.75),.1,20),dash:"dash"===i?.dash?"dash":"solid"}:void 0}},g=t=>{const e=t&&"object"==typeof t?t:{},r=Array.isArray(e.rows)?e.rows:[],n=Array.isArray(e.colWidths)?e.colWidths:[],o=Array.isArray(e.rowHeights)?e.rowHeights:[];if(0===r.length)return null;const i=r.map(t=>(Array.isArray(t)?t:[]).map(h).filter(t=>null!==t)).filter(t=>t.length>0);return 0===i.length?null:{x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.1,.1,a),h:s(Number(e.h)||.1,.1,l),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0,colWidths:n.map(t=>Math.max(.05,Number(t)||.05)),rowHeights:o.map(t=>Math.max(.03,Number(t)||.03)),rows:i}},m=t=>{const e=t&&"object"==typeof t?t:{},r=String(e.text||"").replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ")).join("\n");return r.trim()?{text:r,fontSize:Number(e.fontSize)>0?s(Number(e.fontSize),6,144):void 0,fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike)}:null};exports.buildHtmlToPptxExtractScript=t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5,n=Math.max(1,Math.floor(t.maxTextBoxes??360)),o=Math.max(0,Math.floor(t.maxShapes??400)),a=Math.max(0,Math.floor(t.maxImages??80)),l=Math.max(80,Math.floor(t.maxTextChars??1e3)),s=Math.max(0,Math.floor(t.maxImageBytes??12582912)),c=(t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5;return'(function(){const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,o=t=>{const e=String(t||"").trim();if(!e||"transparent"===e)return"";if(e.startsWith("#")){const t=e.slice(1).toUpperCase();return 3===t.length?t.split("").map(t=>t+t).join(""):t}const o=e.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);return o?(void 0===o[4]?1:String(o[4]).endsWith("%")?Number.parseFloat(o[4])/100:Number(o[4]))<=.02?"":[o[1],o[2],o[3]].map(t=>Math.max(0,Math.min(255,Math.round(Number(t)||0))).toString(16).padStart(2,"0")).join("").toUpperCase():""},r=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const o=String(e[1]);return o.endsWith("%")?Number.parseFloat(o)/100:Number(o)},n=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,i=n.getBoundingClientRect(),l=i.left||0,a=i.top||0,s=i.width||__HTML2PPTX_TEMPLATE_SLOT_2__,d=i.height||__HTML2PPTX_TEMPLATE_SLOT_3__,c=e=>((Number(e)||0)-l)/s*t,u=t=>((Number(t)||0)-a)/d*e,g=e=>(Number(e)||0)/s*t,p=t=>(Number(t)||0)/d*e,m=72*Math.min(t/s,e/d),h=[],f=[],b=n.querySelectorAll("table");for(const t of b){if(t.closest("script, style, noscript, .katex, .katex-mathml"))continue;const e=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===e.display||"hidden"===e.visibility)continue;if(n.width<10||n.height<10)continue;const i=Array.from(t.querySelectorAll("th, td")).some(t=>{const e=window.getComputedStyle(t);return Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest("script, style, noscript, svg, canvas"))return!1;const r=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===r.display||"hidden"===r.visibility)return!1;if(n.width<1||n.height<1)return!1;const i=Boolean(o(r.backgroundColor))||["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(r["border"+t+"Width"]||"0")||0)>0),l=r.fontSize!==e.fontSize||r.fontWeight!==e.fontWeight||r.color!==e.color||r.fontStyle!==e.fontStyle||r.textDecorationLine!==e.textDecorationLine,a=["DIV","SECTION","ARTICLE","ASIDE","P","UL","OL"].includes(t.tagName);return i||l||a})}),l=Array.from(t.querySelectorAll("tr")).some(t=>{const e=window.getComputedStyle(t),r=Boolean(o(e.backgroundColor)),n=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0);return r||n});if(i||l){t.setAttribute("data-pptx-dom-table","1");continue}const a=t.querySelectorAll("tr");if(!a.length)continue;let s=0;for(const t of a){let e=0;for(const o of t.children)"TD"!==o.tagName&&"TH"!==o.tagName||(e+=Number(o.getAttribute("colspan")||1));s=Math.max(s,e)}if(0===s)continue;const d=new Array(s).fill(0),b=[],S=new Array(a.length).fill(null).map(()=>new Array(s).fill(!1));for(let t=0;t<a.length;t++){const e=a[t],o=e.getBoundingClientRect();b.push(o.height);let r=0;for(const o of e.children){if("TD"!==o.tagName&&"TH"!==o.tagName)continue;const e=Number(o.getAttribute("colspan")||1),n=Number(o.getAttribute("rowspan")||1);for(;r<s&&S[t][r];)r++;if(r>=s)break;const i=o.getBoundingClientRect().width/e;for(let t=0;t<e&&r+t<s;t++)d[r+t]=Math.max(d[r+t],i);for(let o=1;o<n&&t+o<a.length;o++)for(let n=0;n<e&&r+n<s;n++)S[t+o][r+n]=!0;r+=e}}const y=[];for(const t of a){const e=[];for(const n of t.children){if("TD"!==n.tagName&&"TH"!==n.tagName)continue;const t=window.getComputedStyle(n),i=n.getBoundingClientRect(),l=Number(n.getAttribute("rowspan")||1),a=Number(n.getAttribute("colspan")||1),s=String(n.textContent||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),d=Number.parseFloat(t.fontSize||"16")||16,h=Number.parseInt(t.fontWeight||"400",10)||400,f=o(t.backgroundColor),b=r(t.backgroundColor),S=o(t.borderColor),y=Number.parseFloat(t.borderWidth||"0")||0,T=y>0&&"none"!==t.borderStyle&&S;let _="top";const w=String(t.verticalAlign||"");"middle"===w?_="middle":"bottom"===w&&(_="bottom");let A="left";const N=String(t.textAlign||"");"center"===N?A="center":"right"===N||"end"===N?A="right":"justify"===N&&(A="justify"),e.push({text:s,rowspan:l,colspan:a,x:c(i.left),y:u(i.top),w:g(i.width),h:p(i.height),fontSize:Math.max(6,Math.min(144,d*m)),fontFace:String(t.fontFamily||"").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",color:o(t.color)||"111827",bold:h>=600,italic:"italic"===t.fontStyle||"oblique"===t.fontStyle,underline:String(t.textDecoration||"").includes("underline"),strike:String(t.textDecoration||"").includes("line-through"),align:A,valign:_,fill:f||void 0,fillTransparency:f?Math.round(100*(1-b)):void 0,border:T?{color:S,widthPt:.75*y,dash:"dashed"===t.borderStyle?"dash":"solid"}:void 0})}y.push(e)}const T="pptx-table-"+h.length;t.setAttribute("data-pptx-consumed-table",T),f.push(T),h.push({x:c(n.left),y:u(n.top),w:g(n.width),h:p(n.height),colWidths:d.map(t=>g(t)),rowHeights:b.map(t=>p(t)),rows:y})}return{tables:h,consumedTableElementIds:f}}())'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(t.pageHeightPx)))})(t);return'(async()=>{const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,r=__HTML2PPTX_TEMPLATE_SLOT_2__,n=__HTML2PPTX_TEMPLATE_SLOT_3__,o=__HTML2PPTX_TEMPLATE_SLOT_4__,i=__HTML2PPTX_TEMPLATE_SLOT_5__,a=__HTML2PPTX_TEMPLATE_SLOT_6__,s=__HTML2PPTX_TEMPLATE_SLOT_7__,l=__HTML2PPTX_TEMPLATE_SLOT_8__,c=__HTML2PPTX_TEMPLATE_SLOT_9__;let d=null;try{d=await import(c)}catch(t){d=null}const u=t=>String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),h=t=>u(t).slice(0,s),g=t=>(t=>{const e=String(t||"").replace(/\\r\\n?/g,"\\n").replace(/[\\u200b-\\u200d\\ufeff]/g,"").split("\\n").map(t=>t.replace(/[^\\S\\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\\n")})(t).slice(0,s);__HTML2PPTX_TEMPLATE_SLOT_10__;const m=__HTML2PPTX_TEMPLATE_SLOT_11__,f=m.tables||[],p=new Set(m.consumedTableElementIds||[]),b=t=>{if(t.getAttribute&&p.has(t.getAttribute("data-pptx-consumed-table")))return!0;const e=t.closest&&t.closest("[data-pptx-consumed-table]");return!!e&&p.has(e.getAttribute("data-pptx-consumed-table"))},x=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,F=x.getBoundingClientRect(),w=F.left||0,E=F.top||0,S=F.width||t,y=F.height||e,M=(x instanceof HTMLElement&&x.offsetWidth&&x.offsetWidth,t=>((Number(t)||0)-w)/S*r),A=t=>((Number(t)||0)-E)/y*n,C=t=>(Number(t)||0)/S*r,T=t=>(Number(t)||0)/y*n,N=72*Math.min(r/S,n/y),B=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const r=String(e[1]),n=r.endsWith("%")?Number.parseFloat(r)/100:Number(r);return Math.max(0,Math.min(1,Number.isFinite(n)?n:1))},D=(t,e)=>{const r=B(t)*Math.max(0,Math.min(1,Number(e||1)));return Math.round(100*(1-r))},_=t=>{const e=t.webkitTextFillColor||t.getPropertyValue?.("-webkit-text-fill-color")||"",r=rgbToHex(e)?e:t.color;return{color:rgbToHex(r)||rgbToHex(t.color)||"111827",opacity:B(r)*Math.max(0,Math.min(1,Number(t.opacity||1)))}},v=t=>{if(!t.transform||"none"===t.transform)return;const e=t.transform.match(/matrix\\(([^)]+)\\)/)?.[1]?.split(",").map(t=>Number(t.trim()));return!e||e.length<4?void 0:Math.round(180*Math.atan2(e[1],e[0])/Math.PI)||void 0},L={textLimitReached:!1,shapeLimitReached:!1,imageLimitReached:!1,unsupportedTransformCount:0,imageRasterFallbackCount:0},k=new Set,P=t=>{const e=String(t||"").trim();if(!e||"none"===e)return!0;const r=e.match(/^matrix\\(([^)]+)\\)$/)?.[1]?.split(",").map(t=>Number(t.trim()));return!(!r||6!==r.length||!r.every(Number.isFinite))&&Math.abs(r[1])<1e-4&&Math.abs(r[2])<1e-4},R=t=>{let e=t;for(;e&&e.nodeType===Node.ELEMENT_NODE;){if(!P(window.getComputedStyle(e).transform))return k.add(e),!0;if(e===x)break;e=e.parentElement}return!1},I=(()=>{const t=rgbToHex(window.getComputedStyle(x).backgroundColor);if(t)return t;const e=rgbToHex(window.getComputedStyle(document.documentElement).backgroundColor);if(e)return e;const r=S*y,n=x.querySelectorAll(":scope > div, :scope > section, :scope > main");for(const t of n){const e=window.getComputedStyle(t),n=rgbToHex(e.backgroundColor);if(!n)continue;const o=t.getBoundingClientRect();if(o.width*o.height>=.5*r)return n}return"FFFFFF"})(),H=(r,n,o)=>{if(!n||"none"===n.display||"hidden"===n.visibility)return!1;if(Number(n.opacity||"1")<.04)return!1;const i=["Top","Right","Bottom","Left"].some(t=>{const e=Number.parseFloat(n["border"+t+"Width"]||"0")||0,r=n["border"+t+"Style"];return e>0&&"none"!==r});return!((o.width<2||o.height<2)&&!i||o.width<2&&o.height<2||o.bottom<0||o.right<0||o.left>t||o.top>e||r.closest("script, style, noscript, .katex, .katex-mathml, [data-pptx-formula-block]"))},W=t=>{const e=t.getBoundingClientRect();return{rect:e,x:M(e.left),y:A(e.top),w:C(e.width),h:T(e.height)}},O=new WeakMap;Array.from(x.querySelectorAll("*")).forEach((t,e)=>{O.set(t,e+1)});const j=t=>O.get(t)||0,z=t=>{const e=String(t?.zIndex||"").trim();if(!e||"auto"===e)return;const r=Number.parseInt(e,10);return Number.isFinite(r)?Math.max(-1e5,Math.min(1e5,r)):void 0},U=(t,e)=>!(!t||t===x||!(void 0!==z(e)&&("static"!==e.position||(t=>{const e=t?.parentElement;return!!e&&/(?:^|\\s)(?:inline-)?(?:flex|grid)(?:\\s|$)/.test(window.getComputedStyle(e).display||"")})(t))||Number(e.opacity||"1")<1||e.transform&&"none"!==e.transform||e.filter&&"none"!==e.filter||e.backdropFilter&&"none"!==e.backdropFilter||e.perspective&&"none"!==e.perspective||e.mixBlendMode&&"normal"!==e.mixBlendMode||"isolate"===e.isolation||/(?:layout|paint|strict|content)/.test(e.contain||"")||/(?:transform|opacity|filter|perspective|contents)/.test(e.willChange||""))),q=t=>{const e=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE&&(e.push(r),r!==x);)r=r.parentElement;e.reverse();const n=[{z:0,order:0}];for(const t of e){if(!t||t===x)continue;const e=window.getComputedStyle(t);U(t,e)&&n.push({z:z(e)??0,order:j(t)})}const o=j(t);return n.some(t=>t.order===o)||n.push({z:0,order:o}),{key:n,order:o}},$=t=>{let e=1,r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const t=Number(window.getComputedStyle(r).opacity||"1");if(Number.isFinite(t)&&(e*=Math.max(0,Math.min(1,t))),r===x)break;r=r.parentElement}return Math.max(0,Math.min(1,e))},X=new Map;let V=0;const G=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE)return"";let e=t.getAttribute("data-pptx-paint-id");return e||(V+=1,e="pptx-paint-"+String(V),t.setAttribute("data-pptx-paint-id",e)),X.set(e,t),e},K=new Map([["ring",3],["ring-0",0],["ring-1",1],["ring-2",2],["ring-4",4],["ring-8",8]]),Q=new Map([["border",1],["border-0",0],["border-2",2],["border-4",4],["border-8",8]]),Y=new Map([["rounded-none",0],["rounded-sm",2],["rounded",4],["rounded-md",6],["rounded-lg",8],["rounded-xl",12],["rounded-2xl",16],["rounded-3xl",24]]),J=new Map([["font-thin",100],["font-extralight",200],["font-light",300],["font-normal",400],["font-medium",500],["font-semibold",600],["font-bold",700],["font-extrabold",800],["font-black",900]]),Z=new Map([["black","#000000"],["white","#FFFFFF"],["transparent","rgba(0, 0, 0, 0)"]]),tt=["50","100","200","300","400","500","600","700","800","900","950"],et=new Map(Object.entries({slate:["#F8FAFC","#F1F5F9","#E2E8F0","#CBD5E1","#94A3B8","#64748B","#475569","#334155","#1E293B","#0F172A","#020617"],gray:["#F9FAFB","#F3F4F6","#E5E7EB","#D1D5DB","#9CA3AF","#6B7280","#4B5563","#374151","#1F2937","#111827","#030712"],zinc:["#FAFAFA","#F4F4F5","#E4E4E7","#D4D4D8","#A1A1AA","#71717A","#52525B","#3F3F46","#27272A","#18181B","#09090B"],neutral:["#FAFAFA","#F5F5F5","#E5E5E5","#D4D4D4","#A3A3A3","#737373","#525252","#404040","#262626","#171717","#0A0A0A"],stone:["#FAFAF9","#F5F5F4","#E7E5E4","#D6D3D1","#A8A29E","#78716C","#57534E","#44403C","#292524","#1C1917","#0C0A09"],red:["#FEF2F2","#FEE2E2","#FECACA","#FCA5A5","#F87171","#EF4444","#DC2626","#B91C1C","#991B1B","#7F1D1D","#450A0A"],orange:["#FFF7ED","#FFEDD5","#FED7AA","#FDBA74","#FB923C","#F97316","#EA580C","#C2410C","#9A3412","#7C2D12","#431407"],amber:["#FFFBEB","#FEF3C7","#FDE68A","#FCD34D","#FBBF24","#F59E0B","#D97706","#B45309","#92400E","#78350F","#451A03"],yellow:["#FEFCE8","#FEF9C3","#FEF08A","#FDE047","#FACC15","#EAB308","#CA8A04","#A16207","#854D0E","#713F12","#422006"],lime:["#F7FEE7","#ECFCCB","#D9F99D","#BEF264","#A3E635","#84CC16","#65A30D","#4D7C0F","#3F6212","#365314","#1A2E05"],green:["#F0FDF4","#DCFCE7","#BBF7D0","#86EFAC","#4ADE80","#22C55E","#16A34A","#15803D","#166534","#14532D","#052E16"],emerald:["#ECFDF5","#D1FAE5","#A7F3D0","#6EE7B7","#34D399","#10B981","#059669","#047857","#065F46","#064E3B","#022C22"],teal:["#F0FDFA","#CCFBF1","#99F6E4","#5EEAD4","#2DD4BF","#14B8A6","#0D9488","#0F766E","#115E59","#134E4A","#042F2E"],cyan:["#ECFEFF","#CFFAFE","#A5F3FC","#67E8F9","#22D3EE","#06B6D4","#0891B2","#0E7490","#155E75","#164E63","#083344"],sky:["#F0F9FF","#E0F2FE","#BAE6FD","#7DD3FC","#38BDF8","#0EA5E9","#0284C7","#0369A1","#075985","#0C4A6E","#082F49"],blue:["#EFF6FF","#DBEAFE","#BFDBFE","#93C5FD","#60A5FA","#3B82F6","#2563EB","#1D4ED8","#1E40AF","#1E3A8A","#172554"],indigo:["#EEF2FF","#E0E7FF","#C7D2FE","#A5B4FC","#818CF8","#6366F1","#4F46E5","#4338CA","#3730A3","#312E81","#1E1B4B"],violet:["#F5F3FF","#EDE9FE","#DDD6FE","#C4B5FD","#A78BFA","#8B5CF6","#7C3AED","#6D28D9","#5B21B6","#4C1D95","#2E1065"],purple:["#FAF5FF","#F3E8FF","#E9D5FF","#D8B4FE","#C084FC","#A855F7","#9333EA","#7E22CE","#6B21A8","#581C87","#3B0764"],fuchsia:["#FDF4FF","#FAE8FF","#F5D0FE","#F0ABFC","#E879F9","#D946EF","#C026D3","#A21CAF","#86198F","#701A75","#4A044E"],pink:["#FDF2F8","#FCE7F3","#FBCFE8","#F9A8D4","#F472B6","#EC4899","#DB2777","#BE185D","#9D174D","#831843","#500724"],rose:["#FFF1F2","#FFE4E6","#FECDD3","#FDA4AF","#FB7185","#F43F5E","#E11D48","#BE123C","#9F1239","#881337","#4C0519"]})),rt=t=>{const e=String(t||"").trim();if(!e)return"";const r=e.split(":");return r[r.length-1]||e},nt=(t,e)=>{let r="",n="";const o=e+"-[";if(t.startsWith(o)){const e=t.indexOf("]");if(e<0)return null;r=t.slice(o.length,e),n=t.slice(e+1).startsWith("/")?t.slice(e+2):""}else if(t.startsWith(e+"-")){const o=t.slice(e.length+1),i=o.indexOf("/");r=(t=>{if(Z.has(t))return Z.get(t);const e=String(t||"").match(/^([a-z]+)-(50|100|200|300|400|500|600|700|800|900|950)$/);if(!e)return"";const r=et.get(e[1]),n=tt.indexOf(e[2]);return r&&n>=0?r[n]:""})(i>=0?o.slice(0,i):o),n=i>=0?o.slice(i+1):""}if(!r||/^-?\\d/.test(r)||/px\\]?$/.test(r))return null;const i=(t=>{const e=String(t||"").replace(/^\\[|\\]$/g,"").trim();if(!e)return;const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r>1?r/100:r)):void 0})(n);return void 0!==i&&r.startsWith("#")?((t,e)=>{const r=String(t||"").trim().replace(/^#/,""),n=3===r.length?r.split("").map(t=>t+t).join(""):r.slice(0,6);return/^[0-9a-f]{6}$/i.test(n)?"rgba("+Number.parseInt(n.slice(0,2),16)+", "+Number.parseInt(n.slice(2,4),16)+", "+Number.parseInt(n.slice(4,6),16)+", "+e+")":t})(r,i):r},ot=t=>nt(t,"ring"),it=t=>nt(t,"border"),at=t=>nt(t,"bg"),st=t=>{if(K.has(t))return K.get(t);const e=t.match(/^ring-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},lt=t=>{if(Q.has(t))return Q.get(t);const e=t.match(/^border-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},ct=t=>{const e=String(t||"").match(/^border-([trblxy])(?:-(0|2|4|8|\\[(-?\\d*\\.?\\d+)px\\]))?$/);if(!e)return null;const r=e[1],n=e[2],o=e[3],i=void 0!==o?Number.parseFloat(o):n?Number.parseFloat(n):1;return!Number.isFinite(i)||i<0?null:{sides:"x"===r?["left","right"]:"y"===r?["top","bottom"]:"t"===r?["top"]:"r"===r?["right"]:"b"===r?["bottom"]:["left"],width:i}},dt=t=>{const e=String(t||"").match(/^border-([trblxy])-(.+)$/);if(!e)return null;const r=e[2];if(/^(?:0|2|4|8|\\[-?\\d*\\.?\\d+px\\])$/.test(r))return null;const n=it("border-"+r);if(!n)return null;const o=e[1];return{sides:"x"===o?["left","right"]:"y"===o?["top","bottom"]:"t"===o?["top"]:"r"===o?["right"]:"b"===o?["bottom"]:["left"],colorSource:n}},ut=t=>{if("rounded-full"===t)return{full:!0};if(Y.has(t))return{px:Y.get(t)};const e=t.match(/^rounded-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return null;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?{px:Math.max(0,r)}:null},ht=t=>{if(J.has(t))return J.get(t);const e=t.match(/^font-\\[([1-9]\\d{0,2})\\]$/);if(!e)return;const r=Number.parseInt(e[1],10);return Number.isFinite(r)?Math.max(1,Math.min(1e3,r)):void 0},gt=t=>{const e=String(t?.className||"").split(/\\s+/).filter(Boolean);let r;for(const t of e){const e=ht(rt(t));void 0!==e&&(r=e)}return r},mt=t=>{const e=String(t.fontWeight||"").trim().toLowerCase();if(!e)return;if("normal"===e)return 400;if("bold"===e)return 700;const r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:void 0},ft=t=>{const e=t?.style?.fontWeight;if(e)return mt({fontWeight:e})},pt=(t,e,r)=>{const n=String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"");if(!n)return null;const o=Number.parseFloat(e.fontSize||"16")||16,i=ft(r),a=gt(r),s=mt(e),l=i||a||s||400,c=String(e.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",d=_(e);return{text:n,fontSize:Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_12__,o*N)),fontFace:c,color:d.color,bold:l>=600||/^H[1-6]$/i.test(r?.tagName||""),italic:"italic"===e.fontStyle||"oblique"===e.fontStyle,underline:String(e.textDecoration||"").includes("underline"),strike:String(e.textDecoration||"").includes("line-through")}},bt=t=>{for(;t.length>0&&(t[0].text=String(t[0].text||"").trimStart(),!t[0].text);)t.shift();for(;t.length>0;){const e=t[t.length-1];if(e.text=String(e.text||"").trimEnd(),e.text)break;t.pop()}return t.filter(t=>t.text)},xt=(t,e)=>t&&e&&t.fontSize===e.fontSize&&t.fontFace===e.fontFace&&t.color===e.color&&Boolean(t.bold)===Boolean(e.bold)&&Boolean(t.italic)===Boolean(e.italic)&&Boolean(t.underline)===Boolean(e.underline)&&Boolean(t.strike)===Boolean(e.strike),Ft=(t,e)=>{if(!t||Wt(e))return;const r=[],n=(t,e,o)=>{if(t.nodeType===Node.TEXT_NODE){const n=pt(t.textContent,o,e);return void(n&&r.push(n))}if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t;if(i.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const a=window.getComputedStyle(i);i.childNodes.forEach(t=>n(t,i,a))};if(t.childNodes.forEach(r=>n(r,t,e)),bt(r),0===r.length)return;const o=u(r.map(t=>t.text).join("")),i=u(t.innerText||t.textContent);if(!o||o!==i)return;const a=pt(i,e,t);return r.some(t=>!xt(t,a))?r:void 0},wt=(t,e)=>{if(!e||!e.text)return;const r=t[t.length-1];xt(r,e)?r.text+=e.text:t.push({...e})},Et=(t,e)=>{if(!t||Wt(e))return[];const r=u(t.innerText||t.textContent);if(!r||r.length>_t)return[];const n=[];let o=null;const i=(t,e,r)=>{if(t.nodeType===Node.TEXT_NODE){const i=String(t.textContent||"");for(let a=0;a<i.length;a+=1){const s=i[a];if(!s)continue;const l=document.createRange();l.setStart(t,a),l.setEnd(t,a+1);const c=l.getBoundingClientRect();if(l.detach(),c.width<.5||c.height<.5){o&&/\\s/.test(s)&&(wt(o.runs,pt(s,r,e)),o.text+=s);continue}let d=n.find(t=>Math.abs(t.top-c.top)<Math.max(3,.3*c.height));d||(d={top:c.top,left:c.left,right:c.right,bottom:c.bottom,text:"",runs:[]},n.push(d)),wt(d.runs,pt(s,r,e)),d.text+=s,d.left=Math.min(d.left,c.left),d.right=Math.max(d.right,c.right),d.bottom=Math.max(d.bottom,c.bottom),o=d}return}if(t.nodeType!==Node.ELEMENT_NODE)return;const a=t;if(a.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const s=window.getComputedStyle(a);a.childNodes.forEach(t=>i(t,a,s))};t.childNodes.forEach(r=>i(r,t,e));const a=n.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>{bt(t.runs);const e=u(t.runs.map(t=>t.text).join(""));return e?{text:e,rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top},runs:t.runs}:null}).filter(Boolean);return u(a.map(t=>t.text).join(""))===r?a:[]},St=t=>{const e={ringWidthPx:void 0,ringColorSource:"",ringInset:!1,borderWidthPx:void 0,borderSideWidthPx:{left:void 0,top:void 0,right:void 0,bottom:void 0},borderSideColorSource:{left:"",top:"",right:"",bottom:""},borderColorSource:"",borderDash:void 0,backgroundColorSource:"",radiusPx:void 0,radiusFull:!1},r=String(t?.className||"").split(/\\s+/).filter(Boolean);for(const t of r){const r=rt(t);if("ring-inset"===r){e.ringInset=!0;continue}"border-dashed"===r||"border-dotted"===r?e.borderDash="dash":"border-solid"===r&&(e.borderDash="solid");const n=st(r);void 0!==n&&(e.ringWidthPx=n);const o=ot(r);o&&(e.ringColorSource=o);const i=lt(r);void 0!==i&&(e.borderWidthPx=i);const a=ct(r);a&&a.sides.forEach(t=>{e.borderSideWidthPx[t]=a.width});const s=dt(r);s&&s.sides.forEach(t=>{e.borderSideColorSource[t]=s.colorSource});const l=it(r);l&&(e.borderColorSource=l);const c=at(r);c&&(e.backgroundColorSource=c);const d=ut(r);d?.full?e.radiusFull=!0:void 0!==d?.px&&(e.radiusPx=d.px)}return e},yt=(t,e,r)=>{let n=null;if(t.boxShadow&&"none"!==t.boxShadow)for(const r of(t=>{const e=[];let r="",n=0;for(const o of String(t||""))"("===o?n+=1:")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(r.trim()&&e.push(r.trim()),r=""):r+=o;return r.trim()&&e.push(r.trim()),e})(t.boxShadow)){if(/\\binset\\b/i.test(r))continue;const t=r.match(/rgba?\\([^)]*\\)|#[0-9a-fa-f]{3,8}/i);if(!t)continue;const o=t[0],i=rgbToHex(o);if(!i||B(o)*e<.04)continue;const a=r.replace(o," ").match(/-?\\d*\\.?\\d+(?:px)?/g)?.map(t=>Number.parseFloat(t))||[];if(a.length<4)continue;const[s,l,c,d]=a;Math.abs(s)>.5||Math.abs(l)>.5||Math.abs(c)>.5||!Number.isFinite(d)||d<=.5||(!n||d>n.w)&&(n={w:d,c:i,colorSource:o})}if(r?.ringInset)return n;if(r?.ringWidthPx>0){const t=r.ringColorSource||n?.colorSource||"rgba(59, 130, 246, 0.5)",o=rgbToHex(t);if(o&&B(t)*e>=.04){const e={w:r.ringWidthPx,c:o,colorSource:t};if(!n||e.w>n.w)return e}}return n},Mt=Array.from(x.querySelectorAll("section,main,article,header,footer,aside,div,figure,figcaption,table,thead,tbody,tfoot,tr,td,th,span")),At=[],Ct=S*y*.005;for(const t of Mt){if(At.length>=i){L.shapeLimitReached=!0;continue}if(b(t))continue;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:a,h:s}=W(t);if(!H(t,e,r))continue;if(R(t))continue;if(/blur/i.test(e.filter||""))continue;const l=(e.backgroundImage||"").trim();if(l&&"none"!==l)continue;if(e.clipPath&&"none"!==e.clipPath||e.maskImage&&"none"!==e.maskImage||e.webkitMaskImage&&"none"!==e.webkitMaskImage||e.mixBlendMode&&"normal"!==e.mixBlendMode||e.backgroundBlendMode&&"normal"!==e.backgroundBlendMode||e.backdropFilter&&"none"!==e.backdropFilter)continue;const c=Number(e.opacity||"1");if(c<.15)continue;const d=St(t),h=rgbToHex(e.backgroundColor)?e.backgroundColor:d.backgroundColorSource,g=rgbToHex(h),m=()=>{const t=[{side:"left",w:e.borderLeftWidth,c:e.borderLeftColor,s:e.borderLeftStyle},{side:"top",w:e.borderTopWidth,c:e.borderTopColor,s:e.borderTopStyle},{side:"right",w:e.borderRightWidth,c:e.borderRightColor,s:e.borderRightStyle},{side:"bottom",w:e.borderBottomWidth,c:e.borderBottomColor,s:e.borderBottomStyle}],r=[],n=(t,e=!1)=>{const n=r.findIndex(e=>e.side===t.side);n>=0?e&&(r[n]=t):r.push(t)},o=t=>{const e=r.findIndex(e=>e.side===t);e>=0&&r.splice(e,1)};for(const e of t){const t=Number.parseFloat(e.w||"0")||0;if(t<=0||"none"===e.s)continue;const r=rgbToHex(e.c);r&&n({side:e.side,w:t,c:r,colorSource:e.c,dash:"dashed"===e.s||"dotted"===e.s?"dash":"solid"})}if(d.borderWidthPx>0){const t=d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",r=rgbToHex(t);if(r&&B(t)*c>=.04)for(const e of["left","top","right","bottom"])n({side:e,w:d.borderWidthPx,c:r,colorSource:t,dash:d.borderDash||"solid"},!0)}for(const t of["left","top","right","bottom"]){const i=d.borderSideWidthPx?.[t],a=d.borderSideColorSource?.[t];if(void 0===i&&!a)continue;if(void 0!==i&&i<=0){o(t);continue}const s=r.find(e=>e.side===t),l=i>0?i:s?.w;if(!(l>0))continue;const u=a||s?.colorSource||d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",h=rgbToHex(u);!h||B(u)*c<.04||n({side:t,w:l,c:h,colorSource:u,dash:s?.dash||d.borderDash||"solid"},!0)}return r},f=m(),p=(()=>{let t=null;for(const e of f)(!t||e.w>t.w)&&(t=e);if(d.borderWidthPx>0){const r=d.borderColorSource||t?.colorSource||e.borderColor||"rgba(229, 231, 235, 1)",n=rgbToHex(r);if(n&&B(r)*c>=.04){const e={w:d.borderWidthPx,c:n,colorSource:r,dash:d.borderDash||"solid"};(!t||e.w>t.w)&&(t=e)}}const r=yt(e,c,d);return r&&(!t||r.w>t.w)?{...r,dash:"solid"}:t})(),x=(t,e)=>t&&e&&t.c===e.c&&t.dash===e.dash&&Math.abs(t.w-e.w)<.1&&Math.abs(D(t.colorSource,c)-D(e.colorSource,c))<=1,F=4===f.length&&f.every(t=>x(t,f[0])),w=f.length>0&&!F&&!d.ringWidthPx,E=w?null:p,S=E?E.c:"",y=E?E.w:0,N=Boolean(p),_=Boolean(E),k=Math.min(r.width,r.height),P=Number.parseFloat(e.borderTopLeftRadius||e.borderRadius||"0")||(d.radiusFull?k/2:d.radiusPx||0),O=Boolean(e.boxShadow&&"none"!==e.boxShadow),z=i=>{if(!i)return null;const l=.001;let d=n,u=o,h=a,g=l;return"bottom"===i.side?u=A(r.bottom-i.w/2):"top"===i.side?u=A(r.top+i.w/2):"right"===i.side?(d=M(r.right-i.w/2),h=l,g=s):(d=M(r.left+i.w/2),h=l,g=s),{x:d,y:u,w:Math.max(l,h),h:Math.max(l,g),order:j(t),paintId:G(t),fill:void 0,transparency:100,shapeType:"line",rotate:v(e),border:{color:i.c,widthPt:.75*i.w,transparency:D(i.colorSource,c),dash:i.dash||"solid"}}},U=!g&&!P&&!O,q=(t,e)=>f.map(t=>t.side).sort().join("|")===[t,e].sort().join("|"),$=U&&2===f.length&&void 0!==v(e)&&r.width<=42&&r.height<=42&&(q("top","right")||q("right","bottom")||q("bottom","left")||q("left","top")),X=(()=>{if(!$)return[];const e=f[0];if(!e)return[];const n=r.left+.18*r.width,o=r.top+.18*r.height,i=.58*r.width,a=.32*r.height,s={order:j(t),paintId:G(t),fill:void 0,transparency:100,shapeType:"line",border:{color:e.c,widthPt:.75*e.w,transparency:D(e.colorSource,c),dash:e.dash||"solid"}};return[{...s,x:M(n),y:A(o),w:Math.max(.001,C(i)),h:Math.max(.001,T(a))},{...s,x:M(n),y:A(o+.32*r.height),w:Math.max(.001,C(i)),h:Math.max(.001,T(a)),flipV:!0}]})();if(X.length>0){if(At.length+X.length>i){L.shapeLimitReached=!0;continue}X.forEach(t=>At.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}const V=w?f.map(t=>z(t)).filter(Boolean):[];if(V.length>0&&U){if(At.length+V.length>i){L.shapeLimitReached=!0;continue}V.forEach(t=>At.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}if(!(g&&(g!==I||P||O)||N))continue;const K=Boolean(u(t.innerText||t.textContent)),Q=g&&g!==I&&(P>0||O||K&&r.width>=12&&r.height>=12),Y=t.parentElement?String(window.getComputedStyle(t.parentElement).display||""):"",J=g&&g!==I&&!N&&!P&&!O&&/grid/i.test(Y)&&!u(t.innerText||t.textContent)&&r.width>=8&&r.height>=8,Z=g&&g!==I&&!P&&!O&&!u(t.innerText||t.textContent)&&(r.width>=24&&r.height>=2&&r.height<12||r.height>=24&&r.width>=2&&r.width<12);if(!N&&!Q&&!J&&r.width*r.height<Ct)continue;if((r.width<12||r.height<12)&&!Z)continue;if(At.length+1+V.length>i){L.shapeLimitReached=!0;continue}const tt=Math.max(0,Math.min(P,k/2)),et=tt>0&&k>0?Math.max(0,Math.min(5e4,Math.round(tt/k*1e5))):0,rt=tt>0&&Math.abs(r.width-r.height)<1.5&&tt>=k/2-.5?"ellipse":tt>0?"roundRect":"rect";At.push({x:n,y:o,w:a,h:s,order:j(t),paintId:G(t),fill:g,transparency:g?D(h,c):100,radius:P,radiusAdj:et,shapeType:rt,rotate:v(e),border:_?{color:S,widthPt:.75*y,transparency:D(E.colorSource||e.borderColor,c),dash:E.dash||"solid"}:void 0}),V.length>0&&V.forEach(t=>At.push(t)),t.setAttribute("data-pptx-extracted-shape","1")}const Tt=[],Nt=new Set,Bt=(t,e)=>{Tt.splice(t),Nt.clear(),e.forEach(t=>Nt.add(t))},Dt=new Set,_t=180,vt=t=>{for(const e of Dt)if(e.contains(t))return!0;return!1},Lt=(t,e,n,o,i=!1)=>{if(i)return Math.max(.12,Math.min(r-t,1.1*e));const a=/[\\u3400-\\u9fff\\uf900-\\ufaff]/.test(o)?1.15:1.08,s=Math.max(.08,Math.min(.3,n/72*.2));return Math.max(.12,Math.min(r-t,e*a+s))},kt=(t,e)=>{const r=Math.max(.02,Math.min(.1,e/72*.08));return Math.max(.06,1.08*t+r)},Pt=t=>{if(!t.letterSpacing||"normal"===t.letterSpacing)return 0;const e=Number.parseFloat(t.letterSpacing);return Number.isFinite(e)?e:0},Rt=(t,e)=>{const r=Number.parseFloat(t[e]||"0")||0;return Math.max(0,Math.min(72,r*N))},It=t=>{const e=Number.parseFloat(String(t||"0"));return Number.isFinite(e)?Math.max(0,e):0},Ht=t=>{if(!t||"LI"!==String(t.tagName||"").toUpperCase())return;const e=t.parentElement?.closest?.("ol,ul");if(!e)return;if("none"===String(window.getComputedStyle(t).listStyleType||""))return;let r=0,n=t.parentElement;for(;n&&n!==x;)"OL"!==n.tagName&&"UL"!==n.tagName||(r+=1),n=n.parentElement;const o=Math.max(0,r-1);if("OL"===String(e.tagName||"").toUpperCase()){const r=Number.parseInt(t.getAttribute("value")||"",10);if(Number.isFinite(r)&&r>0)return{type:"number",level:o,startAt:r};const n=Number.parseInt(e.getAttribute("start")||"1",10)||1,i=Array.from(e.children||[]).filter(t=>"LI"===t.tagName).indexOf(t);return{type:"number",level:o,startAt:Math.max(1,n+Math.max(0,i))}}return{type:"bullet",level:o}},Wt=t=>/vertical/i.test(String(t.writingMode||"")),Ot=t=>{const e=_(t);return[e.color,Math.round(100*e.opacity),String(t.fontSize||""),String(t.fontWeight||""),String(t.fontStyle||""),String(t.textDecorationLine||t.textDecoration||"")].join("|")},jt=(t,e)=>{const r=Ot(e),n=Array.from(t.children||[]);for(const t of n){if(!u(t.innerText||t.textContent)||t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;const n=window.getComputedStyle(t),o=t.getBoundingClientRect();if(H(t,n,o)){if(Ot(n)!==r)return!0;if(jt(t,e))return!0}}return!1},zt=(t,e,n,i,a=!1,s={})=>{if(Tt.length>=o)return L.textLimitReached=!0,!1;if(!(t=a?g(t):h(t)))return!1;if(!H(i,n,e))return!1;if(R(i))return!1;if(e.width<2||e.height<2)return!1;const l=Wt(n);if(l){if(!(t=(t=>{const e=u(t).replace(/\\s+/g,"");return e?Array.from(e).join("\\n"):""})(t)))return!1;a=!1}const c=Ht(i),m=s.useElementInsets&&!l?((t,e)=>{const r=It(t.paddingLeft)+It(t.borderLeftWidth),n=It(t.paddingRight)+It(t.borderRightWidth),o=It(t.paddingTop)+It(t.borderTopWidth),i=It(t.paddingBottom)+It(t.borderBottomWidth),a=Math.max(0,.45*e.width),s=Math.max(0,.45*e.height);return{paddingLeft:C(Math.min(r,a)),paddingRight:C(Math.min(n,a)),paddingTop:T(Math.min(o,s)),paddingBottom:T(Math.min(i,s))}})(n,e):void 0,f=Boolean(m&&(m.paddingLeft||m.paddingRight||m.paddingTop||m.paddingBottom)),p=Array.isArray(s.runs)?s.runs.filter(t=>t&&u(t.text)):void 0;if(a&&!l&&!c&&!f&&!p?.length){const r=((t,e,r)=>{if(!d||!t||e.width<4||e.height<4)return null;if(v(r))return null;const n=Number.parseFloat(r.fontSize||"16")||16,o=((t,e)=>{const r=Number.parseFloat(t.lineHeight||"");return Number.isFinite(r)&&r>0?r:1.18*e})(r,n);try{const i=d.prepareWithSegments(t,((t,e)=>{const r=Number.parseInt(t.fontWeight||"400",10)||400,n="italic"===t.fontStyle||"oblique"===t.fontStyle?"italic":"",o=String(t.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",i=/^[a-z0-9 -]+$/i.test(o)?o:\'"\'+o.replace(/"/g,"")+\'"\';return[n,String(r),e.toFixed(2)+"px",i].filter(Boolean).join(" ")})(r,n),{whiteSpace:"pre-wrap",letterSpacing:Pt(r)}),a=d.layoutWithLines(i,Math.max(1,e.width),o);return a?.lines?.length?{lineHeightPx:o,lines:a.lines.map((t,n)=>{const i=u(String(t.text||""));if(!i)return null;const a=Math.max(1,Math.min(e.width,Number(t.width)||e.width));let s=e.left;return"center"===r.textAlign?s+=Math.max(0,(e.width-a)/2):"right"!==r.textAlign&&"end"!==r.textAlign||(s+=Math.max(0,e.width-a)),{text:i,rect:{left:s,top:e.top+n*o,right:s+a,bottom:e.top+(n+1)*o,width:a,height:o}}}).filter(Boolean)}:null}catch(t){return null}})(t,e,n);if(r&&r.lines.length>0){const t=Tt.length,e=new Set(Nt),o=r.lines.every(t=>zt(t.text,t.rect,n,i,!1));return o||Bt(t,e),o}}const b=((t,e)=>[t.toLowerCase(),Math.round(e.left),Math.round(e.top),Math.round(e.width),Math.round(e.height)].join("|"))(t,e);if(Nt.has(b))return!1;Nt.add(b);const x=Number.parseFloat(n.fontSize||"16")||16,F=Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_13__,x*N)),w=ft(i),E=gt(i),S=mt(n),y=w||E||S||400,B=String(n.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",D=M(e.left),k=_(n),P=((t,e,r)=>{if(e)return"center";const n=String(t.textAlign||"");if("center"===n)return"center";if("right"===n||"end"===n)return"right";if(r&&"justify"===n)return"justify";const o=String(t.display||"");if(o.includes("flex")||o.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/row-reverse/i.test(e),o=String(r?t.alignItems||"":t.justifyContent||"");if("center"===o)return"center";if(!r&&("start"===o||"flex-start"===o))return n?"right":"left";if("end"===o||"flex-end"===o||"right"===o)return n?"left":"right"}return"left"})(n,l,a),I=(t=>{const e=String(t.verticalAlign||"");if("middle"===e)return"middle";if("bottom"===e||"text-bottom"===e)return"bottom";const r=String(t.display||"");if(r.includes("flex")||r.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/column-reverse/i.test(e),o=/column/i.test(e)?String(t.justifyContent||""):String(t.alignItems||"");if("center"===o)return"middle";if(r&&("start"===o||"flex-start"===o))return n?"bottom":"top";if("end"===o||"flex-end"===o)return n?"top":"bottom"}return"top"})(n);return Tt.push({text:t,x:D,y:A(e.top),w:l?Math.max(.12,C(e.width)+Math.max(.02,F/72*.08)):f||"left"!==P?Math.max(.12,Math.min(r-D,C(e.width))):Lt(D,C(e.width),F,t,a),h:l?Math.max(.12,T(e.height)):f?Math.max(.08,T(e.height)):a?Math.max(.12,T(e.height)+Math.max(.02,F/72*.08)):"top"!==I?Math.max(.08,T(e.height)):kt(T(e.height),F),fontSize:F,fontFace:B,color:k.color,bold:y>=600||/^H[1-6]$/i.test(i.tagName),italic:"italic"===n.fontStyle||"oblique"===n.fontStyle,underline:String(n.textDecoration||"").includes("underline"),strike:String(n.textDecoration||"").includes("line-through"),align:P,opacity:k.opacity,rotate:v(n),order:j(i),paintId:G(i),paragraphSpacingBefore:Rt(n,"marginTop"),paragraphSpacingAfter:Rt(n,"marginBottom"),verticalAlign:I,...f?m:{},bullet:c,lineSpacing:n.lineHeight&&"normal"!==n.lineHeight?Math.max(1.08*F,(Number.parseFloat(n.lineHeight)||0)*N):l?1.02*F:t.includes("\\n")?1.18*F:void 0,charSpacing:n.letterSpacing&&"normal"!==n.letterSpacing?(Number.parseFloat(n.letterSpacing)||0)*N:void 0,...p?.length?{runs:p}:{},wrap:a}),!0},Ut=(t,e,r)=>{if(!r)return!1;if(t.querySelector?.(".katex"))return!1;if(t.closest?.("[data-pptx-formula-block]"))return!1;if((t=>Boolean(t.querySelector(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,div,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,.katex\')))(t))return!1;if(["SCRIPT","STYLE","NOSCRIPT","SVG","CANVAS","VIDEO","IFRAME","MATH"].includes(t.tagName))return!1;if((t=>!!t.closest?.(\'[data-pptx-dom-table="1"]\')&&Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();if(!H(t,e,r))return!1;const n=Boolean(rgbToHex(e.backgroundColor)),o=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0&&"none"!==e["border"+t+"Style"]);return n||o}))(t))return!1;if(((t,e)=>!!/grid/i.test(String(e.display||""))&&Array.from(t.children||[]).filter(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();return H(t,e,r)}).length>=2)(t,e))return!1;const n=t.tagName;if(/^H[1-6]$/.test(n)||["P","LI","BLOCKQUOTE","TD","TH","FIGCAPTION"].includes(n))return!0;if(jt(t,e))return!1;if(t.matches(\'[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title\'))return!0;if(!["block","flex","grid","table-cell","list-item"].includes(e.display)&&!["absolute","fixed"].includes(e.position)||r.length<6||r.length>180)return!1;const o=Array.from(t.children);if(o.length>=2){let t=0,e=0;for(const r of o){if(r.closest("script, style, noscript"))continue;const n=window.getComputedStyle(r);if("none"===n.display||"hidden"===n.visibility||Number(n.opacity||"1")<.04)continue;e++;const o=rgbToHex(n.backgroundColor);o&&o!==I&&t++}if(e>=2&&t===e)return!1}return!0},qt=(t,e,r)=>{if(Tt.length>=o)return;if(t.nodeType===Node.TEXT_NODE)return void((t,e,r)=>{if(Tt.length>=o)return;if(r&&vt(r))return;if(r&&r.closest?.(".katex, .katex-mathml, [data-pptx-formula-block]"))return;if(r&&b(r))return;const n=h(t.textContent);if(!n)return;const i=document.createRange();i.selectNode(t);const a=i.getBoundingClientRect(),s=Array.from(i.getClientRects());i.detach();const l=Number.parseFloat(e.fontSize||"16")||16;if(s.length>1||a.height>1.7*l){const o=(t=>{const e=String(t.textContent||"");if(e.length>_t)return[];const r=[];let n=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(!i)continue;const a=document.createRange();a.setStart(t,o),a.setEnd(t,o+1);const s=a.getBoundingClientRect();if(a.detach(),s.width<.5||s.height<.5){n&&/\\s/.test(i)&&(n.text+=i);continue}let l=r.find(t=>Math.abs(t.top-s.top)<Math.max(3,.3*s.height));l||(l={top:s.top,text:"",left:s.left,right:s.right,bottom:s.bottom},r.push(l)),l.text+=i,l.left=Math.min(l.left,s.left),l.right=Math.max(l.right,s.right),l.bottom=Math.max(l.bottom,s.bottom),n=l}return r.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>({text:u(t.text),rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top}})).filter(t=>t.text)})(t);return o.length>1?void o.forEach(t=>zt(t.text,t.rect,e,r,!1)):void zt(n,a,e,r,!0)}zt(n,a,e,r,!1)})(t,e,r);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(Dt.has(n))return;if(n.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;if(b(n))return;const i=window.getComputedStyle(n),a=n.getBoundingClientRect();if(!H(n,i,a))return;const s=!["block","flex","grid","table","list-item"].includes(i.display)&&!["absolute","fixed","sticky"].includes(i.position)||(t=>["SPAN","B","STRONG","I","EM","U","FONT","SUB","SUP","A","SMALL","BIG","MARK"].includes(t.tagName))(n)?i||e:i;n.childNodes.forEach(t=>qt(t,s,n))};(()=>{const t=Array.from(x.querySelectorAll(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,div\'));for(const e of t){if(Tt.length>=o){L.textLimitReached=!0;break}if(e.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;if(b(e))continue;if(vt(e))continue;const t=window.getComputedStyle(e),r=e.getBoundingClientRect(),n=g(e.innerText||e.textContent);if(!H(e,t,r))continue;if(!Ut(e,t,n))continue;const i=Number.parseFloat(t.fontSize||"16")||16,a=r.height<=1.55*i,s=i>=28||/^H[1-6]$/.test(e.tagName),l=Ft(e,t),c=l?.length?Et(e,t):[],d=Tt.length,u=new Set(Nt);let h=!1;h=c.length>1&&!Ht(e)?c.every(r=>zt(r.text,r.rect,t,e,!1,{runs:r.runs})):zt(n,r,t,e,!(a&&s),{useElementInsets:!0,runs:l}),h?(Dt.add(e),e.setAttribute("data-pptx-extracted-text","1")):Bt(d,u)}})(),x.childNodes.forEach(t=>{const e=window.getComputedStyle(x);qt(t,e,x)});const $t=t=>/^data:image\\/(?:png|jpeg|jpg|gif);base64,/i.test(String(t||"")),Xt=async(t,e,r)=>t?await new Promise(n=>{const o=t instanceof HTMLImageElement?t:new Image;let i="";const a=()=>{i&&URL.revokeObjectURL(i)},s=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,s=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=document.createElement("canvas");l.width=Math.max(1,Math.min(4096,Math.round(t*s))),l.height=Math.max(1,Math.min(4096,Math.round(i*s)));const c=l.getContext("2d");if(!c)return a(),void n("");c.clearRect(0,0,l.width,l.height),c.drawImage(o,0,0,l.width,l.height),a(),n(l.toDataURL("image/png"))}catch(t){a(),n("")}};if(t instanceof HTMLImageElement)return t.complete&&(t.naturalWidth||t.width)?void s():(t.addEventListener("load",s,{once:!0}),void t.addEventListener("error",()=>n(""),{once:!0}));o.onload=s,o.onerror=()=>{a(),n("")},t instanceof Blob?(i=URL.createObjectURL(t),o.src=i):(o.crossOrigin="anonymous",o.src=String(t))}):"",Vt=async(t,e,r)=>{const n=String(t||"").trim();if(!n)return"";if($t(n))return n;if(/^data:image\\//i.test(n))return await Xt(n,e,r);try{return await(async(t,e,r)=>{try{const n=await fetch(t);if(!n.ok)return"";const o=await n.blob(),i=String(o.type||"").toLowerCase();return/^image\\/(?:png|jpeg|jpg|gif)$/.test(i)?await(async t=>await new Promise(e=>{const r=new FileReader;r.onloadend=()=>e(String(r.result||"")),r.onerror=()=>e(""),r.readAsDataURL(t)}))(o):await Xt(o,e,r)}catch{return""}})(new URL(n,document.baseURI).toString(),e,r)}catch{return""}},Gt=t=>{try{return t.width&&t.height?t.toDataURL("image/png"):""}catch{return""}},Kt=async(t,e,r)=>{if(!t.currentSrc&&!t.src)return"";try{const n=t.currentSrc||t.src;return $t(n)?n:await Xt(t,e,r)||await Vt(n,e,r)}catch{return await Vt(t.currentSrc||t.src,e,r)}},Qt=async(t,e,r)=>t?await new Promise(n=>{const o=new Image;o.onload=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,a=Math.max(1,Math.min(2,window.devicePixelRatio||1)),s=document.createElement("canvas");s.width=Math.max(1,Math.min(4096,Math.round(t*a))),s.height=Math.max(1,Math.min(4096,Math.round(i*a)));const l=s.getContext("2d");if(!l)return void n("");l.clearRect(0,0,s.width,s.height),l.drawImage(o,0,0,s.width,s.height),n(s.toDataURL("image/png"))}catch(t){n("")}},o.onerror=()=>n(""),o.src=t}):"",Yt=async(t,e,r)=>$t(t)?l<=128||t.length<=l?t:await new Promise(n=>{const o=new Image;o.onload=()=>{try{const i=o.naturalWidth||o.width||Number(e)||1,a=o.naturalHeight||o.height||Number(r)||1,s=Math.min(1,.9*Math.sqrt(l/t.length)),c=[s,.72*s,.5*s].filter((t,e,r)=>t>.08&&r.indexOf(t)===e);for(const t of c){const e=document.createElement("canvas");e.width=Math.max(1,Math.min(4096,Math.round(i*t))),e.height=Math.max(1,Math.min(4096,Math.round(a*t)));const r=e.getContext("2d");if(!r)continue;r.clearRect(0,0,e.width,e.height),r.drawImage(o,0,0,e.width,e.height);const s=e.toDataURL("image/png");if(s.length<=l)return void n(s);const c=e.toDataURL("image/jpeg",.9);if(c.length<=l)return void n(c)}}catch(t){}n("")},o.onerror=()=>n(""),o.src=t}):"",Jt=async(t,e,r)=>{try{const n=t.cloneNode(!0),o=(t,e)=>{if(!t||!e||t.nodeType!==Node.ELEMENT_NODE||e.nodeType!==Node.ELEMENT_NODE)return;const r=window.getComputedStyle(t),n=r.color||"";!n||e.getAttribute("color")&&"currentColor"!==e.getAttribute("color")||e.setAttribute("color",n),["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","letter-spacing","text-anchor","dominant-baseline","visibility","display"].forEach(t=>{const o=e.getAttribute(t),i=r.getPropertyValue(t)||r[t]||"";o&&"currentColor"!==o||!i||"none"===i?"currentColor"===o&&n&&e.setAttribute(t,n):e.setAttribute(t,i)});const i=Array.from(t.children||[]);Array.from(e.children||[]).forEach((t,e)=>o(i[e],t))};if(o(t,n),n.getAttribute("xmlns")||n.setAttribute("xmlns","http://www.w3.org/2000/svg"),!n.getAttribute("viewBox")&&t.getBBox)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&n.setAttribute("viewBox",[e.x,e.y,e.width,e.height].join(" "))}catch(t){}const i=(new XMLSerializer).serializeToString(n),a=btoa(unescape(encodeURIComponent(i)));return await Qt("data:image/svg+xml;base64,"+a,e,r)}catch{return""}};await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));const Zt=[],te=Array.from(x.querySelectorAll("img,canvas,svg"));for(const t of te){if(Zt.length>=a){L.imageLimitReached=!0;break}const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:i,h:s}=W(t);if(!H(t,e,r))continue;if(R(t))continue;if(/blur/i.test(e.filter||""))continue;if(Number(e.opacity||"1")<.15)continue;const l=String(t.tagName||"").toUpperCase(),c="CANVAS"===l?Gt(t):"SVG"===l?await Jt(t,r.width,r.height):await Kt(t,r.width,r.height),d=await Yt(c,r.width,r.height);$t(d)?(Zt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:j(t),paintId:G(t),opacity:$(t),alt:t.getAttribute("alt")||"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")):L.imageRasterFallbackCount+=1}const ee=new Set(Zt.map(t=>t.dataUri)),re=t=>{const e=String(t||"");if(!e||"none"===e)return[];const r=[],n=/url\\((?:["\']?)(.*?)(?:["\']?)\\)/gi;let o;for(;o=n.exec(e);){const t=String(o[1]||"").trim();t&&!t.startsWith("data:font/")&&r.push(t)}return r},ne=[];for(const t of x.querySelectorAll("*")){if(ne.length>=a){L.imageLimitReached=!0;break}const e=window.getComputedStyle(t),r=e.backgroundImage||"";0!==re(r).length&&1===re(r).length&&!/gradient\\(|image-set\\(|cross-fade\\(/i.test(r)&&["auto","auto auto","100% 100%"].includes(String(e.backgroundSize||"").trim())&&/^(?:0(?:px|%)?\\s+)?0(?:px|%)?$/i.test(String(e.backgroundPosition||"").trim())&&"no-repeat"===String(e.backgroundRepeat||"").trim()&&ne.push({el:t,style:e})}for(const{el:t,style:e}of ne){if(Zt.length>=a){L.imageLimitReached=!0;break}const{rect:r,x:n,y:o,w:i,h:s}=W(t);if(!H(t,e,r))continue;if(R(t))continue;const l=re(e.backgroundImage||"")[0];if(!l)continue;const c=/^data:image\\/svg\\+xml;base64,/i.test(l)?await Qt(l,r.width,r.height):await Vt(l,r.width,r.height),d=await Yt(c,r.width,r.height);$t(d)?ee.has(d)||(ee.add(d),Zt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:j(t),paintId:G(t),opacity:$(t),alt:"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")):L.imageRasterFallbackCount+=1}return(t=>{const e=(()=>{const t=Array.from(X.entries()).filter(([,t])=>t&&t.isConnected);if(0===t.length)return new Map;const e=t.map(([t])=>t),r=new Map(t.map(([t,e])=>[t,q(e)])),n=(t,e)=>((t,e)=>{const r=t?.key||[],n=e?.key||[],o=Math.max(r.length,n.length);for(let t=0;t<o;t+=1){const e=r[t]||{z:0,order:0},o=n[t]||{z:0,order:0};if(e.z!==o.z)return e.z-o.z;if(e.order!==o.order)return e.order-o.order}return(t?.order||0)-(e?.order||0)})(r.get(t),r.get(e));if(!document.elementsFromPoint)return(()=>{const t=new Map;let r=1;return e.slice().sort(n).forEach(e=>{t.set(e,r),r+=1}),t})();const o=new Map(e.map(t=>[t,new Set])),i=new Map(e.map(t=>[t,0])),a=(t,e)=>{if(!(t&&e&&t!==e&&o.has(t)&&i.has(e)))return;const r=o.get(t);r.has(e)||(r.add(e),i.set(e,(i.get(e)||0)+1))},s=t=>{let e=t;for(;e&&e!==document&&e!==document.documentElement;){const t=e.getAttribute?.("data-pptx-paint-id")||"";if(t&&X.has(t))return t;e=e.parentElement}return""},l=(t,e)=>{const r=new Set,n=[];for(const o of document.elementsFromPoint(t,e)){const t=s(o);t&&!r.has(t)&&(r.add(t),n.push(t))}return n},c=t=>{const e=Math.max(0,t.left),r=Math.max(0,t.top),n=Math.min(window.innerWidth,t.right),o=Math.min(window.innerHeight,t.bottom);if(n<=e||o<=r)return[];const i=e+.25*(n-e),a=e+.5*(n-e),s=e+.75*(n-e),l=r+.25*(o-r),c=r+.5*(o-r),d=r+.75*(o-r);return[[a,c],[i,l],[s,l],[i,d],[s,d],[a,l],[a,d],[i,c],[s,c]]},d=document.createElement("style");d.id="ohmyppt-paint-order-pointer-events",d.textContent="[data-pptx-paint-id] { pointer-events: auto !important; }",document.head.appendChild(d);try{for(const[,e]of t){const t=e.getBoundingClientRect();for(const[e,r]of c(t)){const t=l(e,r);for(let e=0;e<t.length;e+=1)for(let r=e+1;r<t.length;r+=1)a(t[r],t[e])}}}finally{d.remove()}const u=e.filter(t=>0===(i.get(t)||0)).sort(n),h=new Map;let g=1;for(;u.length>0;){const t=u.shift();if(t&&!h.has(t)){h.set(t,g),g+=1;for(const e of o.get(t)||[])i.set(e,Math.max(0,(i.get(e)||0)-1)),0===(i.get(e)||0)&&(u.push(e),u.sort(n))}}return e.filter(t=>!h.has(t)).sort(n).forEach(t=>{h.set(t,g),g+=1}),h})();t.forEach(t=>{t&&t.paintId&&(e.has(t.paintId)&&(t.order=e.get(t.paintId)),delete t.paintId)})})([...At,...Tt,...Zt]),L.unsupportedTransformCount=k.size,{backgroundColor:I,shapes:At,texts:Tt,images:Zt,tables:f,extractionReport:L}})()'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(t.pageHeightPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_4__",String(JSON.stringify(n))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_5__",String(JSON.stringify(o))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_6__",String(JSON.stringify(a))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_7__",String(JSON.stringify(l))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_8__",String(JSON.stringify(Math.ceil(4*s/3)+128))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_9__",String(JSON.stringify(i))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_10__",String("\nconst rgbToHex = (value) => {\n const source = String(value || '').trim();\n if (!source || source === 'transparent') return '';\n if (source.startsWith('#')) {\n const raw = source.slice(1).toUpperCase();\n return raw.length === 3 ? raw.split('').map((part) => part + part).join('') : raw;\n }\n const match = source.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);\n if (!match) return '';\n const alpha = match[4] === undefined\n ? 1\n : String(match[4]).endsWith('%')\n ? Number.parseFloat(match[4]) / 100\n : Number(match[4]);\n if (alpha <= 0.02) return '';\n return [match[1], match[2], match[3]]\n .map((part) => Math.max(0, Math.min(255, Math.round(Number(part) || 0))).toString(16).padStart(2, '0'))\n .join('')\n .toUpperCase();\n};\n")).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_11__",String(c)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_12__",String(144)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_13__",String(144))},exports.generatePptx=t=>r.buildPptxDocument(t),exports.normalizeExtractedHtmlToPptxSlide=(t,e)=>{const r=t&&"object"==typeof t?t:{},n=Array.isArray(r.texts)?r.texts:[],o=Array.isArray(r.shapes)?r.shapes:[],i=Array.isArray(r.images)?r.images:[],h=Array.isArray(r.tables)?r.tables:[],p=(t=>{if(!t||"object"!=typeof t)return;const e=t;return{textLimitReached:Boolean(e.textLimitReached),shapeLimitReached:Boolean(e.shapeLimitReached),imageLimitReached:Boolean(e.imageLimitReached),unsupportedTransformCount:Math.max(0,Math.floor(Number(e.unsupportedTransformCount)||0)),imageRasterFallbackCount:Math.max(0,Math.floor(Number(e.imageRasterFallbackCount)||0))}})(r.extractionReport),f=n.map(t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||"")).slice(0,1e3);if(!r)return null;const n=Array.isArray(e.runs)?e.runs.map(m).filter(t=>null!==t):[],o=e.bullet&&"object"==typeof e.bullet?e.bullet:null,i="bullet"===o?.type||"number"===o?.type?o.type:void 0,h=i&&o?{type:i,level:Number.isFinite(Number(o.level))?s(Number(o.level),0,8):void 0,startAt:Number.isFinite(Number(o.startAt))?s(Number(o.startAt),1,32767):void 0}:void 0;return{text:r,x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.4,.1,a),h:s(Number(e.h)||.2,.08,l),fontSize:s(Number(e.fontSize)||12,6,144),fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",opacity:s(Number(e.opacity??1),0,1),rotate:s(Number(e.rotate??0),-360,360),lineSpacing:Number(e.lineSpacing)>0?s(Number(e.lineSpacing),1,200):void 0,charSpacing:Number.isFinite(Number(e.charSpacing))?s(Number(e.charSpacing),-20,200):void 0,paragraphSpacingBefore:Number(e.paragraphSpacingBefore)>0?s(Number(e.paragraphSpacingBefore),0,72):void 0,paragraphSpacingAfter:Number(e.paragraphSpacingAfter)>0?s(Number(e.paragraphSpacingAfter),0,72):void 0,verticalAlign:"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:"top",paddingLeft:Number(e.paddingLeft)>0?s(Number(e.paddingLeft),0,2):void 0,paddingRight:Number(e.paddingRight)>0?s(Number(e.paddingRight),0,2):void 0,paddingTop:Number(e.paddingTop)>0?s(Number(e.paddingTop),0,1):void 0,paddingBottom:Number(e.paddingBottom)>0?s(Number(e.paddingBottom),0,1):void 0,bullet:h,runs:n.length>0?n:void 0,wrap:Boolean(e.wrap),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),b=o.map(t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.fill||""),""),n=e.border&&"object"==typeof e.border?e.border:null,o=c(String(n?.color||""),"");if(!r&&!o)return null;const i="ellipse"===e.shapeType||"roundRect"===e.shapeType||"line"===e.shapeType?e.shapeType:"rect",d="line"===i?.001:.05,u="line"===i?.001:.05;return{x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||d,d,a),h:s(Number(e.h)||u,u,l),fill:r,transparency:s(Number(e.transparency??0),0,100),radius:s(Number(e.radius??0),0,100),radiusAdj:s(Number(e.radiusAdj??0),0,5e4),border:o?{color:o,widthPt:s(Number(n?.widthPt??.75),.1,20),transparency:s(Number(n?.transparency??0),0,100),dash:"dash"===n?.dash?"dash":"solid"}:void 0,shapeType:i,rotate:s(Number(e.rotate??0),-360,360),flipV:Boolean(e.flipV),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),x=i.map(t=>{const e=t&&"object"==typeof t?t:{},r=String(e.dataUri||""),n=(t=>{const e=t.match(/^data:(image\/(?:png|jpeg|jpg|gif));base64,/i);return e?"image/jpg"===e[1].toLowerCase()?"image/jpeg":e[1].toLowerCase():""})(r);return!n||(t=>{const e=t.indexOf(",");if(e<0)return 0;const r=t.slice(e+1).replace(/\s/g,"");if(!r)return 0;const n=r.endsWith("==")?2:r.endsWith("=")?1:0;return Math.max(0,Math.floor(3*r.length/4)-n)})(r)>12582912?null:{dataUri:r,mimeType:n,x:s(Number(e.x)||0,0,a),y:s(Number(e.y)||0,0,l),w:s(Number(e.w)||.1,.05,a),h:s(Number(e.h)||.1,.05,l),alt:(o=String(e.alt||""),o.replace(/\s+/g," ").replace(/[\u200b-\u200d\ufeff]/g,"").trim()),rotate:s(Number(e.rotate??0),-360,360),opacity:s(Number(e.opacity??1),0,1),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0};var o}).filter(t=>Boolean(t)),S=h.map(g).filter(t=>null!==t);return{title:e,backgroundColor:c(String(r.backgroundColor||""),"FFFFFF"),backgroundImage:void 0,texts:f,shapes:b,images:x,tables:S.length>0?S:void 0,overlayImages:void 0,extractionReport:p}};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as t}from"module";import{pathToFileURL as e}from"url";import{buildPptxDocument as r}from"./ooxml-writer.js";import"fflate";import"./animation-writer.js";const n=e(t(import.meta.url).resolve("@chenglou/pretext")).toString(),o=t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5,o=Math.max(1,Math.floor(t.maxTextBoxes??360)),i=Math.max(0,Math.floor(t.maxShapes??400)),a=Math.max(0,Math.floor(t.maxImages??80)),l=Math.max(80,Math.floor(t.maxTextChars??1e3)),s=Math.max(0,Math.floor(t.maxImageBytes??12582912)),c=(t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5;return'(function(){const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,o=t=>{const e=String(t||"").trim();if(!e||"transparent"===e)return"";if(e.startsWith("#")){const t=e.slice(1).toUpperCase();return 3===t.length?t.split("").map(t=>t+t).join(""):t}const o=e.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);return o?(void 0===o[4]?1:String(o[4]).endsWith("%")?Number.parseFloat(o[4])/100:Number(o[4]))<=.02?"":[o[1],o[2],o[3]].map(t=>Math.max(0,Math.min(255,Math.round(Number(t)||0))).toString(16).padStart(2,"0")).join("").toUpperCase():""},r=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const o=String(e[1]);return o.endsWith("%")?Number.parseFloat(o)/100:Number(o)},n=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,i=n.getBoundingClientRect(),l=i.left||0,a=i.top||0,s=i.width||__HTML2PPTX_TEMPLATE_SLOT_2__,d=i.height||__HTML2PPTX_TEMPLATE_SLOT_3__,c=e=>((Number(e)||0)-l)/s*t,u=t=>((Number(t)||0)-a)/d*e,g=e=>(Number(e)||0)/s*t,p=t=>(Number(t)||0)/d*e,m=72*Math.min(t/s,e/d),h=[],f=[],b=n.querySelectorAll("table");for(const t of b){if(t.closest("script, style, noscript, .katex, .katex-mathml"))continue;const e=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===e.display||"hidden"===e.visibility)continue;if(n.width<10||n.height<10)continue;const i=Array.from(t.querySelectorAll("th, td")).some(t=>{const e=window.getComputedStyle(t);return Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest("script, style, noscript, svg, canvas"))return!1;const r=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===r.display||"hidden"===r.visibility)return!1;if(n.width<1||n.height<1)return!1;const i=Boolean(o(r.backgroundColor))||["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(r["border"+t+"Width"]||"0")||0)>0),l=r.fontSize!==e.fontSize||r.fontWeight!==e.fontWeight||r.color!==e.color||r.fontStyle!==e.fontStyle||r.textDecorationLine!==e.textDecorationLine,a=["DIV","SECTION","ARTICLE","ASIDE","P","UL","OL"].includes(t.tagName);return i||l||a})}),l=Array.from(t.querySelectorAll("tr")).some(t=>{const e=window.getComputedStyle(t),r=Boolean(o(e.backgroundColor)),n=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0);return r||n});if(i||l){t.setAttribute("data-pptx-dom-table","1");continue}const a=t.querySelectorAll("tr");if(!a.length)continue;let s=0;for(const t of a){let e=0;for(const o of t.children)"TD"!==o.tagName&&"TH"!==o.tagName||(e+=Number(o.getAttribute("colspan")||1));s=Math.max(s,e)}if(0===s)continue;const d=new Array(s).fill(0),b=[],S=new Array(a.length).fill(null).map(()=>new Array(s).fill(!1));for(let t=0;t<a.length;t++){const e=a[t],o=e.getBoundingClientRect();b.push(o.height);let r=0;for(const o of e.children){if("TD"!==o.tagName&&"TH"!==o.tagName)continue;const e=Number(o.getAttribute("colspan")||1),n=Number(o.getAttribute("rowspan")||1);for(;r<s&&S[t][r];)r++;if(r>=s)break;const i=o.getBoundingClientRect().width/e;for(let t=0;t<e&&r+t<s;t++)d[r+t]=Math.max(d[r+t],i);for(let o=1;o<n&&t+o<a.length;o++)for(let n=0;n<e&&r+n<s;n++)S[t+o][r+n]=!0;r+=e}}const y=[];for(const t of a){const e=[];for(const n of t.children){if("TD"!==n.tagName&&"TH"!==n.tagName)continue;const t=window.getComputedStyle(n),i=n.getBoundingClientRect(),l=Number(n.getAttribute("rowspan")||1),a=Number(n.getAttribute("colspan")||1),s=String(n.textContent||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),d=Number.parseFloat(t.fontSize||"16")||16,h=Number.parseInt(t.fontWeight||"400",10)||400,f=o(t.backgroundColor),b=r(t.backgroundColor),S=o(t.borderColor),y=Number.parseFloat(t.borderWidth||"0")||0,T=y>0&&"none"!==t.borderStyle&&S;let _="top";const w=String(t.verticalAlign||"");"middle"===w?_="middle":"bottom"===w&&(_="bottom");let A="left";const N=String(t.textAlign||"");"center"===N?A="center":"right"===N||"end"===N?A="right":"justify"===N&&(A="justify"),e.push({text:s,rowspan:l,colspan:a,x:c(i.left),y:u(i.top),w:g(i.width),h:p(i.height),fontSize:Math.max(6,Math.min(144,d*m)),fontFace:String(t.fontFamily||"").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",color:o(t.color)||"111827",bold:h>=600,italic:"italic"===t.fontStyle||"oblique"===t.fontStyle,underline:String(t.textDecoration||"").includes("underline"),strike:String(t.textDecoration||"").includes("line-through"),align:A,valign:_,fill:f||void 0,fillTransparency:f?Math.round(100*(1-b)):void 0,border:T?{color:S,widthPt:.75*y,dash:"dashed"===t.borderStyle?"dash":"solid"}:void 0})}y.push(e)}const T="pptx-table-"+h.length;t.setAttribute("data-pptx-consumed-table",T),f.push(T),h.push({x:c(n.left),y:u(n.top),w:g(n.width),h:p(n.height),colWidths:d.map(t=>g(t)),rowHeights:b.map(t=>p(t)),rows:y})}return{tables:h,consumedTableElementIds:f}}())'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(t.pageHeightPx)))})(t);return'(async()=>{const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,r=__HTML2PPTX_TEMPLATE_SLOT_2__,n=__HTML2PPTX_TEMPLATE_SLOT_3__,o=__HTML2PPTX_TEMPLATE_SLOT_4__,i=__HTML2PPTX_TEMPLATE_SLOT_5__,a=__HTML2PPTX_TEMPLATE_SLOT_6__,s=__HTML2PPTX_TEMPLATE_SLOT_7__,l=__HTML2PPTX_TEMPLATE_SLOT_8__,c=__HTML2PPTX_TEMPLATE_SLOT_9__;let d=null;try{d=await import(c)}catch(t){d=null}const u=t=>String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),h=t=>u(t).slice(0,s),g=t=>(t=>{const e=String(t||"").replace(/\\r\\n?/g,"\\n").replace(/[\\u200b-\\u200d\\ufeff]/g,"").split("\\n").map(t=>t.replace(/[^\\S\\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\\n")})(t).slice(0,s);__HTML2PPTX_TEMPLATE_SLOT_10__;const f=__HTML2PPTX_TEMPLATE_SLOT_11__,m=f.tables||[],p=new Set(f.consumedTableElementIds||[]),b=t=>{if(t.getAttribute&&p.has(t.getAttribute("data-pptx-consumed-table")))return!0;const e=t.closest&&t.closest("[data-pptx-consumed-table]");return!!e&&p.has(e.getAttribute("data-pptx-consumed-table"))},x=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,F=x.getBoundingClientRect(),w=F.left||0,E=F.top||0,S=F.width||t,y=F.height||e,M=(x instanceof HTMLElement&&x.offsetWidth&&x.offsetWidth,t=>((Number(t)||0)-w)/S*r),A=t=>((Number(t)||0)-E)/y*n,C=t=>(Number(t)||0)/S*r,T=t=>(Number(t)||0)/y*n,N=72*Math.min(r/S,n/y),B=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const r=String(e[1]),n=r.endsWith("%")?Number.parseFloat(r)/100:Number(r);return Math.max(0,Math.min(1,Number.isFinite(n)?n:1))},D=(t,e)=>{const r=B(t)*Math.max(0,Math.min(1,Number(e||1)));return Math.round(100*(1-r))},_=t=>{const e=t.webkitTextFillColor||t.getPropertyValue?.("-webkit-text-fill-color")||"",r=rgbToHex(e)?e:t.color;return{color:rgbToHex(r)||rgbToHex(t.color)||"111827",opacity:B(r)*Math.max(0,Math.min(1,Number(t.opacity||1)))}},v=t=>{if(!t.transform||"none"===t.transform)return;const e=t.transform.match(/matrix\\(([^)]+)\\)/)?.[1]?.split(",").map(t=>Number(t.trim()));return!e||e.length<4?void 0:Math.round(180*Math.atan2(e[1],e[0])/Math.PI)||void 0},k=(()=>{const t=rgbToHex(window.getComputedStyle(x).backgroundColor);if(t)return t;const e=rgbToHex(window.getComputedStyle(document.documentElement).backgroundColor);if(e)return e;const r=S*y,n=x.querySelectorAll(":scope > div, :scope > section, :scope > main");for(const t of n){const e=window.getComputedStyle(t),n=rgbToHex(e.backgroundColor);if(!n)continue;const o=t.getBoundingClientRect();if(o.width*o.height>=.5*r)return n}return"FFFFFF"})(),L=(r,n,o)=>{if(!n||"none"===n.display||"hidden"===n.visibility)return!1;if(Number(n.opacity||"1")<.04)return!1;const i=["Top","Right","Bottom","Left"].some(t=>{const e=Number.parseFloat(n["border"+t+"Width"]||"0")||0,r=n["border"+t+"Style"];return e>0&&"none"!==r});return!((o.width<2||o.height<2)&&!i||o.width<2&&o.height<2||o.bottom<0||o.right<0||o.left>t||o.top>e||r.closest("script, style, noscript, .katex, .katex-mathml, [data-pptx-formula-block]"))},P=t=>{const e=t.getBoundingClientRect();return{rect:e,x:M(e.left),y:A(e.top),w:C(e.width),h:T(e.height)}},I=new WeakMap;Array.from(x.querySelectorAll("*")).forEach((t,e)=>{I.set(t,e+1)});const R=t=>I.get(t)||0,H=t=>{const e=String(t?.zIndex||"").trim();if(!e||"auto"===e)return;const r=Number.parseInt(e,10);return Number.isFinite(r)?Math.max(-1e5,Math.min(1e5,r)):void 0},W=(t,e)=>!(!t||t===x||!(void 0!==H(e)&&("static"!==e.position||(t=>{const e=t?.parentElement;return!!e&&/(?:^|\\s)(?:inline-)?(?:flex|grid)(?:\\s|$)/.test(window.getComputedStyle(e).display||"")})(t))||Number(e.opacity||"1")<1||e.transform&&"none"!==e.transform||e.filter&&"none"!==e.filter||e.backdropFilter&&"none"!==e.backdropFilter||e.perspective&&"none"!==e.perspective||e.mixBlendMode&&"normal"!==e.mixBlendMode||"isolate"===e.isolation||/(?:layout|paint|strict|content)/.test(e.contain||"")||/(?:transform|opacity|filter|perspective|contents)/.test(e.willChange||""))),O=t=>{const e=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE&&(e.push(r),r!==x);)r=r.parentElement;e.reverse();const n=[{z:0,order:0}];for(const t of e){if(!t||t===x)continue;const e=window.getComputedStyle(t);W(t,e)&&n.push({z:H(e)??0,order:R(t)})}const o=R(t);return n.some(t=>t.order===o)||n.push({z:0,order:o}),{key:n,order:o}},j=t=>{let e=1,r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const t=Number(window.getComputedStyle(r).opacity||"1");if(Number.isFinite(t)&&(e*=Math.max(0,Math.min(1,t))),r===x)break;r=r.parentElement}return Math.max(0,Math.min(1,e))},z=new Map;let U=0;const q=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE)return"";let e=t.getAttribute("data-pptx-paint-id");return e||(U+=1,e="pptx-paint-"+String(U),t.setAttribute("data-pptx-paint-id",e)),z.set(e,t),e},$=new Map([["ring",3],["ring-0",0],["ring-1",1],["ring-2",2],["ring-4",4],["ring-8",8]]),X=new Map([["border",1],["border-0",0],["border-2",2],["border-4",4],["border-8",8]]),V=new Map([["rounded-none",0],["rounded-sm",2],["rounded",4],["rounded-md",6],["rounded-lg",8],["rounded-xl",12],["rounded-2xl",16],["rounded-3xl",24]]),G=new Map([["font-thin",100],["font-extralight",200],["font-light",300],["font-normal",400],["font-medium",500],["font-semibold",600],["font-bold",700],["font-extrabold",800],["font-black",900]]),K=new Map([["black","#000000"],["white","#FFFFFF"],["transparent","rgba(0, 0, 0, 0)"]]),Q=["50","100","200","300","400","500","600","700","800","900","950"],Y=new Map(Object.entries({slate:["#F8FAFC","#F1F5F9","#E2E8F0","#CBD5E1","#94A3B8","#64748B","#475569","#334155","#1E293B","#0F172A","#020617"],gray:["#F9FAFB","#F3F4F6","#E5E7EB","#D1D5DB","#9CA3AF","#6B7280","#4B5563","#374151","#1F2937","#111827","#030712"],zinc:["#FAFAFA","#F4F4F5","#E4E4E7","#D4D4D8","#A1A1AA","#71717A","#52525B","#3F3F46","#27272A","#18181B","#09090B"],neutral:["#FAFAFA","#F5F5F5","#E5E5E5","#D4D4D4","#A3A3A3","#737373","#525252","#404040","#262626","#171717","#0A0A0A"],stone:["#FAFAF9","#F5F5F4","#E7E5E4","#D6D3D1","#A8A29E","#78716C","#57534E","#44403C","#292524","#1C1917","#0C0A09"],red:["#FEF2F2","#FEE2E2","#FECACA","#FCA5A5","#F87171","#EF4444","#DC2626","#B91C1C","#991B1B","#7F1D1D","#450A0A"],orange:["#FFF7ED","#FFEDD5","#FED7AA","#FDBA74","#FB923C","#F97316","#EA580C","#C2410C","#9A3412","#7C2D12","#431407"],amber:["#FFFBEB","#FEF3C7","#FDE68A","#FCD34D","#FBBF24","#F59E0B","#D97706","#B45309","#92400E","#78350F","#451A03"],yellow:["#FEFCE8","#FEF9C3","#FEF08A","#FDE047","#FACC15","#EAB308","#CA8A04","#A16207","#854D0E","#713F12","#422006"],lime:["#F7FEE7","#ECFCCB","#D9F99D","#BEF264","#A3E635","#84CC16","#65A30D","#4D7C0F","#3F6212","#365314","#1A2E05"],green:["#F0FDF4","#DCFCE7","#BBF7D0","#86EFAC","#4ADE80","#22C55E","#16A34A","#15803D","#166534","#14532D","#052E16"],emerald:["#ECFDF5","#D1FAE5","#A7F3D0","#6EE7B7","#34D399","#10B981","#059669","#047857","#065F46","#064E3B","#022C22"],teal:["#F0FDFA","#CCFBF1","#99F6E4","#5EEAD4","#2DD4BF","#14B8A6","#0D9488","#0F766E","#115E59","#134E4A","#042F2E"],cyan:["#ECFEFF","#CFFAFE","#A5F3FC","#67E8F9","#22D3EE","#06B6D4","#0891B2","#0E7490","#155E75","#164E63","#083344"],sky:["#F0F9FF","#E0F2FE","#BAE6FD","#7DD3FC","#38BDF8","#0EA5E9","#0284C7","#0369A1","#075985","#0C4A6E","#082F49"],blue:["#EFF6FF","#DBEAFE","#BFDBFE","#93C5FD","#60A5FA","#3B82F6","#2563EB","#1D4ED8","#1E40AF","#1E3A8A","#172554"],indigo:["#EEF2FF","#E0E7FF","#C7D2FE","#A5B4FC","#818CF8","#6366F1","#4F46E5","#4338CA","#3730A3","#312E81","#1E1B4B"],violet:["#F5F3FF","#EDE9FE","#DDD6FE","#C4B5FD","#A78BFA","#8B5CF6","#7C3AED","#6D28D9","#5B21B6","#4C1D95","#2E1065"],purple:["#FAF5FF","#F3E8FF","#E9D5FF","#D8B4FE","#C084FC","#A855F7","#9333EA","#7E22CE","#6B21A8","#581C87","#3B0764"],fuchsia:["#FDF4FF","#FAE8FF","#F5D0FE","#F0ABFC","#E879F9","#D946EF","#C026D3","#A21CAF","#86198F","#701A75","#4A044E"],pink:["#FDF2F8","#FCE7F3","#FBCFE8","#F9A8D4","#F472B6","#EC4899","#DB2777","#BE185D","#9D174D","#831843","#500724"],rose:["#FFF1F2","#FFE4E6","#FECDD3","#FDA4AF","#FB7185","#F43F5E","#E11D48","#BE123C","#9F1239","#881337","#4C0519"]})),J=t=>{const e=String(t||"").trim();if(!e)return"";const r=e.split(":");return r[r.length-1]||e},Z=(t,e)=>{let r="",n="";const o=e+"-[";if(t.startsWith(o)){const e=t.indexOf("]");if(e<0)return null;r=t.slice(o.length,e),n=t.slice(e+1).startsWith("/")?t.slice(e+2):""}else if(t.startsWith(e+"-")){const o=t.slice(e.length+1),i=o.indexOf("/");r=(t=>{if(K.has(t))return K.get(t);const e=String(t||"").match(/^([a-z]+)-(50|100|200|300|400|500|600|700|800|900|950)$/);if(!e)return"";const r=Y.get(e[1]),n=Q.indexOf(e[2]);return r&&n>=0?r[n]:""})(i>=0?o.slice(0,i):o),n=i>=0?o.slice(i+1):""}if(!r||/^-?\\d/.test(r)||/px\\]?$/.test(r))return null;const i=(t=>{const e=String(t||"").replace(/^\\[|\\]$/g,"").trim();if(!e)return;const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r>1?r/100:r)):void 0})(n);return void 0!==i&&r.startsWith("#")?((t,e)=>{const r=String(t||"").trim().replace(/^#/,""),n=3===r.length?r.split("").map(t=>t+t).join(""):r.slice(0,6);return/^[0-9a-f]{6}$/i.test(n)?"rgba("+Number.parseInt(n.slice(0,2),16)+", "+Number.parseInt(n.slice(2,4),16)+", "+Number.parseInt(n.slice(4,6),16)+", "+e+")":t})(r,i):r},tt=t=>Z(t,"ring"),et=t=>Z(t,"border"),rt=t=>Z(t,"bg"),nt=t=>{if($.has(t))return $.get(t);const e=t.match(/^ring-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},ot=t=>{if(X.has(t))return X.get(t);const e=t.match(/^border-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},it=t=>{const e=String(t||"").match(/^border-([trblxy])(?:-(0|2|4|8|\\[(-?\\d*\\.?\\d+)px\\]))?$/);if(!e)return null;const r=e[1],n=e[2],o=e[3],i=void 0!==o?Number.parseFloat(o):n?Number.parseFloat(n):1;return!Number.isFinite(i)||i<0?null:{sides:"x"===r?["left","right"]:"y"===r?["top","bottom"]:"t"===r?["top"]:"r"===r?["right"]:"b"===r?["bottom"]:["left"],width:i}},at=t=>{const e=String(t||"").match(/^border-([trblxy])-(.+)$/);if(!e)return null;const r=e[2];if(/^(?:0|2|4|8|\\[-?\\d*\\.?\\d+px\\])$/.test(r))return null;const n=et("border-"+r);if(!n)return null;const o=e[1];return{sides:"x"===o?["left","right"]:"y"===o?["top","bottom"]:"t"===o?["top"]:"r"===o?["right"]:"b"===o?["bottom"]:["left"],colorSource:n}},st=t=>{if("rounded-full"===t)return{full:!0};if(V.has(t))return{px:V.get(t)};const e=t.match(/^rounded-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return null;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?{px:Math.max(0,r)}:null},lt=t=>{if(G.has(t))return G.get(t);const e=t.match(/^font-\\[([1-9]\\d{0,2})\\]$/);if(!e)return;const r=Number.parseInt(e[1],10);return Number.isFinite(r)?Math.max(1,Math.min(1e3,r)):void 0},ct=t=>{const e=String(t?.className||"").split(/\\s+/).filter(Boolean);let r;for(const t of e){const e=lt(J(t));void 0!==e&&(r=e)}return r},dt=t=>{const e=String(t.fontWeight||"").trim().toLowerCase();if(!e)return;if("normal"===e)return 400;if("bold"===e)return 700;const r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:void 0},ut=t=>{const e=t?.style?.fontWeight;if(e)return dt({fontWeight:e})},ht=(t,e,r)=>{const n=String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"");if(!n)return null;const o=Number.parseFloat(e.fontSize||"16")||16,i=ut(r),a=ct(r),s=dt(e),l=i||a||s||400,c=String(e.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",d=_(e);return{text:n,fontSize:Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_12__,o*N)),fontFace:c,color:d.color,bold:l>=600||/^H[1-6]$/i.test(r?.tagName||""),italic:"italic"===e.fontStyle||"oblique"===e.fontStyle,underline:String(e.textDecoration||"").includes("underline"),strike:String(e.textDecoration||"").includes("line-through")}},gt=t=>{for(;t.length>0&&(t[0].text=String(t[0].text||"").trimStart(),!t[0].text);)t.shift();for(;t.length>0;){const e=t[t.length-1];if(e.text=String(e.text||"").trimEnd(),e.text)break;t.pop()}return t.filter(t=>t.text)},ft=(t,e)=>t&&e&&t.fontSize===e.fontSize&&t.fontFace===e.fontFace&&t.color===e.color&&Boolean(t.bold)===Boolean(e.bold)&&Boolean(t.italic)===Boolean(e.italic)&&Boolean(t.underline)===Boolean(e.underline)&&Boolean(t.strike)===Boolean(e.strike),mt=(t,e)=>{if(!t||Lt(e))return;const r=[],n=(t,e,o)=>{if(t.nodeType===Node.TEXT_NODE){const n=ht(t.textContent,o,e);return void(n&&r.push(n))}if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t;if(i.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const a=window.getComputedStyle(i);i.childNodes.forEach(t=>n(t,i,a))};if(t.childNodes.forEach(r=>n(r,t,e)),gt(r),0===r.length)return;const o=u(r.map(t=>t.text).join("")),i=u(t.innerText||t.textContent);if(!o||o!==i)return;const a=ht(i,e,t);return r.some(t=>!ft(t,a))?r:void 0},pt=(t,e)=>{if(!e||!e.text)return;const r=t[t.length-1];ft(r,e)?r.text+=e.text:t.push({...e})},bt=(t,e)=>{if(!t||Lt(e))return[];const r=u(t.innerText||t.textContent);if(!r||r.length>Ct)return[];const n=[];let o=null;const i=(t,e,r)=>{if(t.nodeType===Node.TEXT_NODE){const i=String(t.textContent||"");for(let a=0;a<i.length;a+=1){const s=i[a];if(!s)continue;const l=document.createRange();l.setStart(t,a),l.setEnd(t,a+1);const c=l.getBoundingClientRect();if(l.detach(),c.width<.5||c.height<.5){o&&/\\s/.test(s)&&(pt(o.runs,ht(s,r,e)),o.text+=s);continue}let d=n.find(t=>Math.abs(t.top-c.top)<Math.max(3,.3*c.height));d||(d={top:c.top,left:c.left,right:c.right,bottom:c.bottom,text:"",runs:[]},n.push(d)),pt(d.runs,ht(s,r,e)),d.text+=s,d.left=Math.min(d.left,c.left),d.right=Math.max(d.right,c.right),d.bottom=Math.max(d.bottom,c.bottom),o=d}return}if(t.nodeType!==Node.ELEMENT_NODE)return;const a=t;if(a.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const s=window.getComputedStyle(a);a.childNodes.forEach(t=>i(t,a,s))};t.childNodes.forEach(r=>i(r,t,e));const a=n.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>{gt(t.runs);const e=u(t.runs.map(t=>t.text).join(""));return e?{text:e,rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top},runs:t.runs}:null}).filter(Boolean);return u(a.map(t=>t.text).join(""))===r?a:[]},xt=t=>{const e={ringWidthPx:void 0,ringColorSource:"",ringInset:!1,borderWidthPx:void 0,borderSideWidthPx:{left:void 0,top:void 0,right:void 0,bottom:void 0},borderSideColorSource:{left:"",top:"",right:"",bottom:""},borderColorSource:"",borderDash:void 0,backgroundColorSource:"",radiusPx:void 0,radiusFull:!1},r=String(t?.className||"").split(/\\s+/).filter(Boolean);for(const t of r){const r=J(t);if("ring-inset"===r){e.ringInset=!0;continue}"border-dashed"===r||"border-dotted"===r?e.borderDash="dash":"border-solid"===r&&(e.borderDash="solid");const n=nt(r);void 0!==n&&(e.ringWidthPx=n);const o=tt(r);o&&(e.ringColorSource=o);const i=ot(r);void 0!==i&&(e.borderWidthPx=i);const a=it(r);a&&a.sides.forEach(t=>{e.borderSideWidthPx[t]=a.width});const s=at(r);s&&s.sides.forEach(t=>{e.borderSideColorSource[t]=s.colorSource});const l=et(r);l&&(e.borderColorSource=l);const c=rt(r);c&&(e.backgroundColorSource=c);const d=st(r);d?.full?e.radiusFull=!0:void 0!==d?.px&&(e.radiusPx=d.px)}return e},Ft=(t,e,r)=>{let n=null;if(t.boxShadow&&"none"!==t.boxShadow)for(const r of(t=>{const e=[];let r="",n=0;for(const o of String(t||""))"("===o?n+=1:")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(r.trim()&&e.push(r.trim()),r=""):r+=o;return r.trim()&&e.push(r.trim()),e})(t.boxShadow)){if(/\\binset\\b/i.test(r))continue;const t=r.match(/rgba?\\([^)]*\\)|#[0-9a-fa-f]{3,8}/i);if(!t)continue;const o=t[0],i=rgbToHex(o);if(!i||B(o)*e<.04)continue;const a=r.replace(o," ").match(/-?\\d*\\.?\\d+(?:px)?/g)?.map(t=>Number.parseFloat(t))||[];if(a.length<4)continue;const[s,l,c,d]=a;Math.abs(s)>.5||Math.abs(l)>.5||Math.abs(c)>.5||!Number.isFinite(d)||d<=.5||(!n||d>n.w)&&(n={w:d,c:i,colorSource:o})}if(r?.ringInset)return n;if(r?.ringWidthPx>0){const t=r.ringColorSource||n?.colorSource||"rgba(59, 130, 246, 0.5)",o=rgbToHex(t);if(o&&B(t)*e>=.04){const e={w:r.ringWidthPx,c:o,colorSource:t};if(!n||e.w>n.w)return e}}return n},wt=Array.from(x.querySelectorAll("section,main,article,header,footer,aside,div,figure,figcaption,table,thead,tbody,tfoot,tr,td,th,span")),Et=[],St=S*y*.005;for(const t of wt){if(Et.length>=i)continue;if(b(t))continue;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:a,h:s}=P(t);if(!L(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;const l=(e.backgroundImage||"").trim();if(l&&"none"!==l)continue;if(e.clipPath&&"none"!==e.clipPath||e.maskImage&&"none"!==e.maskImage||e.webkitMaskImage&&"none"!==e.webkitMaskImage||e.mixBlendMode&&"normal"!==e.mixBlendMode||e.backgroundBlendMode&&"normal"!==e.backgroundBlendMode||e.backdropFilter&&"none"!==e.backdropFilter)continue;const c=Number(e.opacity||"1");if(c<.15)continue;const d=xt(t),h=rgbToHex(e.backgroundColor)?e.backgroundColor:d.backgroundColorSource,g=rgbToHex(h),f=()=>{const t=[{side:"left",w:e.borderLeftWidth,c:e.borderLeftColor,s:e.borderLeftStyle},{side:"top",w:e.borderTopWidth,c:e.borderTopColor,s:e.borderTopStyle},{side:"right",w:e.borderRightWidth,c:e.borderRightColor,s:e.borderRightStyle},{side:"bottom",w:e.borderBottomWidth,c:e.borderBottomColor,s:e.borderBottomStyle}],r=[],n=(t,e=!1)=>{const n=r.findIndex(e=>e.side===t.side);n>=0?e&&(r[n]=t):r.push(t)},o=t=>{const e=r.findIndex(e=>e.side===t);e>=0&&r.splice(e,1)};for(const e of t){const t=Number.parseFloat(e.w||"0")||0;if(t<=0||"none"===e.s)continue;const r=rgbToHex(e.c);r&&n({side:e.side,w:t,c:r,colorSource:e.c,dash:"dashed"===e.s||"dotted"===e.s?"dash":"solid"})}if(d.borderWidthPx>0){const t=d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",r=rgbToHex(t);if(r&&B(t)*c>=.04)for(const e of["left","top","right","bottom"])n({side:e,w:d.borderWidthPx,c:r,colorSource:t,dash:d.borderDash||"solid"},!0)}for(const t of["left","top","right","bottom"]){const i=d.borderSideWidthPx?.[t],a=d.borderSideColorSource?.[t];if(void 0===i&&!a)continue;if(void 0!==i&&i<=0){o(t);continue}const s=r.find(e=>e.side===t),l=i>0?i:s?.w;if(!(l>0))continue;const u=a||s?.colorSource||d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",h=rgbToHex(u);!h||B(u)*c<.04||n({side:t,w:l,c:h,colorSource:u,dash:s?.dash||d.borderDash||"solid"},!0)}return r},m=f(),p=(()=>{let t=null;for(const e of m)(!t||e.w>t.w)&&(t=e);if(d.borderWidthPx>0){const r=d.borderColorSource||t?.colorSource||e.borderColor||"rgba(229, 231, 235, 1)",n=rgbToHex(r);if(n&&B(r)*c>=.04){const e={w:d.borderWidthPx,c:n,colorSource:r,dash:d.borderDash||"solid"};(!t||e.w>t.w)&&(t=e)}}const r=Ft(e,c,d);return r&&(!t||r.w>t.w)?{...r,dash:"solid"}:t})(),x=(t,e)=>t&&e&&t.c===e.c&&t.dash===e.dash&&Math.abs(t.w-e.w)<.1&&Math.abs(D(t.colorSource,c)-D(e.colorSource,c))<=1,F=4===m.length&&m.every(t=>x(t,m[0])),w=m.length>0&&!F&&!d.ringWidthPx,E=w?null:p,S=E?E.c:"",y=E?E.w:0,N=Boolean(p),_=Boolean(E),I=Math.min(r.width,r.height),H=Number.parseFloat(e.borderTopLeftRadius||e.borderRadius||"0")||(d.radiusFull?I/2:d.radiusPx||0),W=Boolean(e.boxShadow&&"none"!==e.boxShadow),O=i=>{if(!i)return null;const l=.001;let d=n,u=o,h=a,g=l;return"bottom"===i.side?u=A(r.bottom-i.w/2):"top"===i.side?u=A(r.top+i.w/2):"right"===i.side?(d=M(r.right-i.w/2),h=l,g=s):(d=M(r.left+i.w/2),h=l,g=s),{x:d,y:u,w:Math.max(l,h),h:Math.max(l,g),order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",rotate:v(e),border:{color:i.c,widthPt:.75*i.w,transparency:D(i.colorSource,c),dash:i.dash||"solid"}}},j=!g&&!H&&!W,z=(t,e)=>m.map(t=>t.side).sort().join("|")===[t,e].sort().join("|"),U=j&&2===m.length&&void 0!==v(e)&&r.width<=42&&r.height<=42&&(z("top","right")||z("right","bottom")||z("bottom","left")||z("left","top")),$=(()=>{if(!U)return[];const e=m[0];if(!e)return[];const n=r.left+.18*r.width,o=r.top+.18*r.height,i=.58*r.width,a=.32*r.height,s={order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",border:{color:e.c,widthPt:.75*e.w,transparency:D(e.colorSource,c),dash:e.dash||"solid"}};return[{...s,x:M(n),y:A(o),w:Math.max(.001,C(i)),h:Math.max(.001,T(a))},{...s,x:M(n),y:A(o+.32*r.height),w:Math.max(.001,C(i)),h:Math.max(.001,T(a)),flipV:!0}]})();if($.length>0){if(Et.length+$.length>i)continue;$.forEach(t=>Et.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}const X=w?m.map(t=>O(t)).filter(Boolean):[];if(X.length>0&&j){if(Et.length+X.length>i)continue;X.forEach(t=>Et.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}if(!(g&&(g!==k||H||W)||N))continue;const V=Boolean(u(t.innerText||t.textContent)),G=g&&g!==k&&(H>0||W||V&&r.width>=12&&r.height>=12),K=t.parentElement?String(window.getComputedStyle(t.parentElement).display||""):"",Q=g&&g!==k&&!N&&!H&&!W&&/grid/i.test(K)&&!u(t.innerText||t.textContent)&&r.width>=8&&r.height>=8,Y=g&&g!==k&&!H&&!W&&!u(t.innerText||t.textContent)&&(r.width>=24&&r.height>=2&&r.height<12||r.height>=24&&r.width>=2&&r.width<12);if(!N&&!G&&!Q&&r.width*r.height<St)continue;if((r.width<12||r.height<12)&&!Y)continue;if(Et.length+1+X.length>i)continue;const J=Math.max(0,Math.min(H,I/2)),Z=J>0&&I>0?Math.max(0,Math.min(5e4,Math.round(J/I*1e5))):0,tt=J>0&&Math.abs(r.width-r.height)<1.5&&J>=I/2-.5?"ellipse":J>0?"roundRect":"rect";Et.push({x:n,y:o,w:a,h:s,order:R(t),paintId:q(t),fill:g,transparency:g?D(h,c):100,radius:H,radiusAdj:Z,shapeType:tt,rotate:v(e),border:_?{color:S,widthPt:.75*y,transparency:D(E.colorSource||e.borderColor,c),dash:E.dash||"solid"}:void 0}),X.length>0&&X.forEach(t=>Et.push(t)),t.setAttribute("data-pptx-extracted-shape","1")}const yt=[],Mt=new Set,At=new Set,Ct=180,Tt=t=>{for(const e of At)if(e.contains(t))return!0;return!1},Nt=(t,e,n,o,i=!1)=>{if(i)return Math.max(.12,Math.min(r-t,1.1*e));const a=/[\\u3400-\\u9fff\\uf900-\\ufaff]/.test(o)?1.15:1.08,s=Math.max(.08,Math.min(.3,n/72*.2));return Math.max(.12,Math.min(r-t,e*a+s))},Bt=(t,e)=>{const r=Math.max(.02,Math.min(.1,e/72*.08));return Math.max(.06,1.08*t+r)},Dt=t=>{if(!t.letterSpacing||"normal"===t.letterSpacing)return 0;const e=Number.parseFloat(t.letterSpacing);return Number.isFinite(e)?e:0},_t=(t,e)=>{const r=Number.parseFloat(t[e]||"0")||0;return Math.max(0,Math.min(72,r*N))},vt=t=>{const e=Number.parseFloat(String(t||"0"));return Number.isFinite(e)?Math.max(0,e):0},kt=t=>{if(!t||"LI"!==String(t.tagName||"").toUpperCase())return;const e=t.parentElement?.closest?.("ol,ul");if(!e)return;if("none"===String(window.getComputedStyle(t).listStyleType||""))return;let r=0,n=t.parentElement;for(;n&&n!==x;)"OL"!==n.tagName&&"UL"!==n.tagName||(r+=1),n=n.parentElement;const o=Math.max(0,r-1);if("OL"===String(e.tagName||"").toUpperCase()){const r=Number.parseInt(t.getAttribute("value")||"",10);if(Number.isFinite(r)&&r>0)return{type:"number",level:o,startAt:r};const n=Number.parseInt(e.getAttribute("start")||"1",10)||1,i=Array.from(e.children||[]).filter(t=>"LI"===t.tagName).indexOf(t);return{type:"number",level:o,startAt:Math.max(1,n+Math.max(0,i))}}return{type:"bullet",level:o}},Lt=t=>/vertical/i.test(String(t.writingMode||"")),Pt=t=>{const e=_(t);return[e.color,Math.round(100*e.opacity),String(t.fontSize||""),String(t.fontWeight||""),String(t.fontStyle||""),String(t.textDecorationLine||t.textDecoration||"")].join("|")},It=(t,e)=>{const r=Pt(e),n=Array.from(t.children||[]);for(const t of n){if(!u(t.innerText||t.textContent)||t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;const n=window.getComputedStyle(t),o=t.getBoundingClientRect();if(L(t,n,o)){if(Pt(n)!==r)return!0;if(It(t,e))return!0}}return!1},Rt=(t,e,n,i,a=!1,s={})=>{if(yt.length>=o)return;if(!(t=a?g(t):h(t)))return;if(!L(i,n,e))return;if(e.width<2||e.height<2)return;const l=Lt(n);if(l){if(!(t=(t=>{const e=u(t).replace(/\\s+/g,"");return e?Array.from(e).join("\\n"):""})(t)))return;a=!1}const c=kt(i),f=s.useElementInsets&&!l?((t,e)=>{const r=vt(t.paddingLeft)+vt(t.borderLeftWidth),n=vt(t.paddingRight)+vt(t.borderRightWidth),o=vt(t.paddingTop)+vt(t.borderTopWidth),i=vt(t.paddingBottom)+vt(t.borderBottomWidth),a=Math.max(0,.45*e.width),s=Math.max(0,.45*e.height);return{paddingLeft:C(Math.min(r,a)),paddingRight:C(Math.min(n,a)),paddingTop:T(Math.min(o,s)),paddingBottom:T(Math.min(i,s))}})(n,e):void 0,m=Boolean(f&&(f.paddingLeft||f.paddingRight||f.paddingTop||f.paddingBottom)),p=Array.isArray(s.runs)?s.runs.filter(t=>t&&u(t.text)):void 0;if(a&&!l&&!c&&!m&&!p?.length){const r=((t,e,r)=>{if(!d||!t||e.width<4||e.height<4)return null;if(v(r))return null;const n=Number.parseFloat(r.fontSize||"16")||16,o=((t,e)=>{const r=Number.parseFloat(t.lineHeight||"");return Number.isFinite(r)&&r>0?r:1.18*e})(r,n);try{const i=d.prepareWithSegments(t,((t,e)=>{const r=Number.parseInt(t.fontWeight||"400",10)||400,n="italic"===t.fontStyle||"oblique"===t.fontStyle?"italic":"",o=String(t.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",i=/^[a-z0-9 -]+$/i.test(o)?o:\'"\'+o.replace(/"/g,"")+\'"\';return[n,String(r),e.toFixed(2)+"px",i].filter(Boolean).join(" ")})(r,n),{whiteSpace:"pre-wrap",letterSpacing:Dt(r)}),a=d.layoutWithLines(i,Math.max(1,e.width),o);return a?.lines?.length?{lineHeightPx:o,lines:a.lines.map((t,n)=>{const i=u(String(t.text||""));if(!i)return null;const a=Math.max(1,Math.min(e.width,Number(t.width)||e.width));let s=e.left;return"center"===r.textAlign?s+=Math.max(0,(e.width-a)/2):"right"!==r.textAlign&&"end"!==r.textAlign||(s+=Math.max(0,e.width-a)),{text:i,rect:{left:s,top:e.top+n*o,right:s+a,bottom:e.top+(n+1)*o,width:a,height:o}}}).filter(Boolean)}:null}catch(t){return null}})(t,e,n);if(r&&r.lines.length>0)return void r.lines.forEach(t=>Rt(t.text,t.rect,n,i,!1))}const b=((t,e)=>[t.toLowerCase(),Math.round(e.left),Math.round(e.top),Math.round(e.width),Math.round(e.height)].join("|"))(t,e);if(Mt.has(b))return;Mt.add(b);const x=Number.parseFloat(n.fontSize||"16")||16,F=Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_13__,x*N)),w=ut(i),E=ct(i),S=dt(n),y=w||E||S||400,B=String(n.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",D=M(e.left),k=_(n),P=((t,e,r)=>{if(e)return"center";const n=String(t.textAlign||"");if("center"===n)return"center";if("right"===n||"end"===n)return"right";if(r&&"justify"===n)return"justify";const o=String(t.display||"");if(o.includes("flex")||o.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/row-reverse/i.test(e),o=String(r?t.alignItems||"":t.justifyContent||"");if("center"===o)return"center";if(!r&&("start"===o||"flex-start"===o))return n?"right":"left";if("end"===o||"flex-end"===o||"right"===o)return n?"left":"right"}return"left"})(n,l,a),I=(t=>{const e=String(t.verticalAlign||"");if("middle"===e)return"middle";if("bottom"===e||"text-bottom"===e)return"bottom";const r=String(t.display||"");if(r.includes("flex")||r.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/column-reverse/i.test(e),o=/column/i.test(e)?String(t.justifyContent||""):String(t.alignItems||"");if("center"===o)return"middle";if(r&&("start"===o||"flex-start"===o))return n?"bottom":"top";if("end"===o||"flex-end"===o)return n?"top":"bottom"}return"top"})(n);yt.push({text:t,x:D,y:A(e.top),w:l?Math.max(.12,C(e.width)+Math.max(.02,F/72*.08)):m||"left"!==P?Math.max(.12,Math.min(r-D,C(e.width))):Nt(D,C(e.width),F,t,a),h:l?Math.max(.12,T(e.height)):m?Math.max(.08,T(e.height)):a?Math.max(.12,T(e.height)+Math.max(.02,F/72*.08)):"top"!==I?Math.max(.08,T(e.height)):Bt(T(e.height),F),fontSize:F,fontFace:B,color:k.color,bold:y>=600||/^H[1-6]$/i.test(i.tagName),italic:"italic"===n.fontStyle||"oblique"===n.fontStyle,underline:String(n.textDecoration||"").includes("underline"),strike:String(n.textDecoration||"").includes("line-through"),align:P,opacity:k.opacity,rotate:v(n),order:R(i),paintId:q(i),paragraphSpacingBefore:_t(n,"marginTop"),paragraphSpacingAfter:_t(n,"marginBottom"),verticalAlign:I,...m?f:{},bullet:c,lineSpacing:n.lineHeight&&"normal"!==n.lineHeight?Math.max(1.08*F,(Number.parseFloat(n.lineHeight)||0)*N):l?1.02*F:t.includes("\\n")?1.18*F:void 0,charSpacing:n.letterSpacing&&"normal"!==n.letterSpacing?(Number.parseFloat(n.letterSpacing)||0)*N:void 0,...p?.length?{runs:p}:{},wrap:a})},Ht=(t,e,r)=>{if(!r)return!1;if(t.querySelector?.(".katex"))return!1;if(t.closest?.("[data-pptx-formula-block]"))return!1;if((t=>Boolean(t.querySelector(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,div,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,.katex\')))(t))return!1;if(["SCRIPT","STYLE","NOSCRIPT","SVG","CANVAS","VIDEO","IFRAME","MATH"].includes(t.tagName))return!1;if((t=>!!t.closest?.(\'[data-pptx-dom-table="1"]\')&&Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();if(!L(t,e,r))return!1;const n=Boolean(rgbToHex(e.backgroundColor)),o=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0&&"none"!==e["border"+t+"Style"]);return n||o}))(t))return!1;if(((t,e)=>!!/grid/i.test(String(e.display||""))&&Array.from(t.children||[]).filter(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();return L(t,e,r)}).length>=2)(t,e))return!1;const n=t.tagName;if(/^H[1-6]$/.test(n)||["P","LI","BLOCKQUOTE","TD","TH","FIGCAPTION"].includes(n))return!0;if(It(t,e))return!1;if(t.matches(\'[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title\'))return!0;if(!["block","flex","grid","table-cell","list-item"].includes(e.display)&&!["absolute","fixed"].includes(e.position)||r.length<6||r.length>180)return!1;const o=Array.from(t.children);if(o.length>=2){let t=0,e=0;for(const r of o){if(r.closest("script, style, noscript"))continue;const n=window.getComputedStyle(r);if("none"===n.display||"hidden"===n.visibility||Number(n.opacity||"1")<.04)continue;e++;const o=rgbToHex(n.backgroundColor);o&&o!==k&&t++}if(e>=2&&t===e)return!1}return!0},Wt=(t,e,r)=>{if(yt.length>=o)return;if(t.nodeType===Node.TEXT_NODE)return void((t,e,r)=>{if(yt.length>=o)return;if(r&&Tt(r))return;if(r&&r.closest?.(".katex, .katex-mathml, [data-pptx-formula-block]"))return;if(r&&b(r))return;const n=h(t.textContent);if(!n)return;const i=document.createRange();i.selectNode(t);const a=i.getBoundingClientRect(),s=Array.from(i.getClientRects());i.detach();const l=Number.parseFloat(e.fontSize||"16")||16;if(s.length>1||a.height>1.7*l){const o=(t=>{const e=String(t.textContent||"");if(e.length>Ct)return[];const r=[];let n=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(!i)continue;const a=document.createRange();a.setStart(t,o),a.setEnd(t,o+1);const s=a.getBoundingClientRect();if(a.detach(),s.width<.5||s.height<.5){n&&/\\s/.test(i)&&(n.text+=i);continue}let l=r.find(t=>Math.abs(t.top-s.top)<Math.max(3,.3*s.height));l||(l={top:s.top,text:"",left:s.left,right:s.right,bottom:s.bottom},r.push(l)),l.text+=i,l.left=Math.min(l.left,s.left),l.right=Math.max(l.right,s.right),l.bottom=Math.max(l.bottom,s.bottom),n=l}return r.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>({text:u(t.text),rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top}})).filter(t=>t.text)})(t);return o.length>1?void o.forEach(t=>Rt(t.text,t.rect,e,r,!1)):void Rt(n,a,e,r,!0)}Rt(n,a,e,r,!1)})(t,e,r);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(At.has(n))return;if(n.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;if(b(n))return;const i=window.getComputedStyle(n),a=n.getBoundingClientRect();if(!L(n,i,a))return;const s=!["block","flex","grid","table","list-item"].includes(i.display)&&!["absolute","fixed","sticky"].includes(i.position)||(t=>["SPAN","B","STRONG","I","EM","U","FONT","SUB","SUP","A","SMALL","BIG","MARK"].includes(t.tagName))(n)?i||e:i;n.childNodes.forEach(t=>Wt(t,s,n))};(()=>{const t=Array.from(x.querySelectorAll(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,div\'));for(const e of t){if(yt.length>=o)break;if(e.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;if(b(e))continue;if(Tt(e))continue;const t=window.getComputedStyle(e),r=e.getBoundingClientRect(),n=g(e.innerText||e.textContent);if(!L(e,t,r))continue;if(!Ht(e,t,n))continue;const i=Number.parseFloat(t.fontSize||"16")||16,a=r.height<=1.55*i,s=i>=28||/^H[1-6]$/.test(e.tagName),l=mt(e,t),c=l?.length?bt(e,t):[];c.length>1&&!kt(e)?(c.forEach(r=>{Rt(r.text,r.rect,t,e,!1,{runs:r.runs})}),At.add(e),e.setAttribute("data-pptx-extracted-text","1")):(Rt(n,r,t,e,!(a&&s),{useElementInsets:!0,runs:l}),At.add(e),e.setAttribute("data-pptx-extracted-text","1"))}})(),x.childNodes.forEach(t=>{const e=window.getComputedStyle(x);Wt(t,e,x)});const Ot=t=>/^data:image\\/(?:png|jpeg|jpg|gif);base64,/i.test(String(t||"")),jt=async(t,e,r)=>t?await new Promise(n=>{const o=t instanceof HTMLImageElement?t:new Image;let i="";const a=()=>{i&&URL.revokeObjectURL(i)},s=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,s=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=document.createElement("canvas");l.width=Math.max(1,Math.min(4096,Math.round(t*s))),l.height=Math.max(1,Math.min(4096,Math.round(i*s)));const c=l.getContext("2d");if(!c)return a(),void n("");c.clearRect(0,0,l.width,l.height),c.drawImage(o,0,0,l.width,l.height),a(),n(l.toDataURL("image/png"))}catch(t){a(),n("")}};if(t instanceof HTMLImageElement)return t.complete&&(t.naturalWidth||t.width)?void s():(t.addEventListener("load",s,{once:!0}),void t.addEventListener("error",()=>n(""),{once:!0}));o.onload=s,o.onerror=()=>{a(),n("")},t instanceof Blob?(i=URL.createObjectURL(t),o.src=i):(o.crossOrigin="anonymous",o.src=String(t))}):"",zt=async(t,e,r)=>{const n=String(t||"").trim();if(!n)return"";if(Ot(n))return n;if(/^data:image\\//i.test(n))return await jt(n,e,r);try{return await(async(t,e,r)=>{try{const n=await fetch(t);if(!n.ok)return"";const o=await n.blob(),i=String(o.type||"").toLowerCase();return/^image\\/(?:png|jpeg|jpg|gif)$/.test(i)?await(async t=>await new Promise(e=>{const r=new FileReader;r.onloadend=()=>e(String(r.result||"")),r.onerror=()=>e(""),r.readAsDataURL(t)}))(o):await jt(o,e,r)}catch{return""}})(new URL(n,document.baseURI).toString(),e,r)}catch{return""}},Ut=t=>{try{return t.width&&t.height?t.toDataURL("image/png"):""}catch{return""}},qt=async(t,e,r)=>{if(!t.currentSrc&&!t.src)return"";try{const n=t.currentSrc||t.src;return Ot(n)?n:await jt(t,e,r)||await zt(n,e,r)}catch{return await zt(t.currentSrc||t.src,e,r)}},$t=async(t,e,r)=>t?await new Promise(n=>{const o=new Image;o.onload=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,a=Math.max(1,Math.min(2,window.devicePixelRatio||1)),s=document.createElement("canvas");s.width=Math.max(1,Math.min(4096,Math.round(t*a))),s.height=Math.max(1,Math.min(4096,Math.round(i*a)));const l=s.getContext("2d");if(!l)return void n("");l.clearRect(0,0,s.width,s.height),l.drawImage(o,0,0,s.width,s.height),n(s.toDataURL("image/png"))}catch(t){n("")}},o.onerror=()=>n(""),o.src=t}):"",Xt=async(t,e,r)=>Ot(t)?l<=128||t.length<=l?t:await new Promise(n=>{const o=new Image;o.onload=()=>{try{const i=o.naturalWidth||o.width||Number(e)||1,a=o.naturalHeight||o.height||Number(r)||1,s=Math.min(1,.9*Math.sqrt(l/t.length)),c=[s,.72*s,.5*s].filter((t,e,r)=>t>.08&&r.indexOf(t)===e);for(const t of c){const e=document.createElement("canvas");e.width=Math.max(1,Math.min(4096,Math.round(i*t))),e.height=Math.max(1,Math.min(4096,Math.round(a*t)));const r=e.getContext("2d");if(!r)continue;r.clearRect(0,0,e.width,e.height),r.drawImage(o,0,0,e.width,e.height);const s=e.toDataURL("image/png");if(s.length<=l)return void n(s);const c=e.toDataURL("image/jpeg",.9);if(c.length<=l)return void n(c)}}catch(t){}n("")},o.onerror=()=>n(""),o.src=t}):"",Vt=async(t,e,r)=>{try{const n=t.cloneNode(!0),o=(t,e)=>{if(!t||!e||t.nodeType!==Node.ELEMENT_NODE||e.nodeType!==Node.ELEMENT_NODE)return;const r=window.getComputedStyle(t),n=r.color||"";!n||e.getAttribute("color")&&"currentColor"!==e.getAttribute("color")||e.setAttribute("color",n),["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","letter-spacing","text-anchor","dominant-baseline","visibility","display"].forEach(t=>{const o=e.getAttribute(t),i=r.getPropertyValue(t)||r[t]||"";o&&"currentColor"!==o||!i||"none"===i?"currentColor"===o&&n&&e.setAttribute(t,n):e.setAttribute(t,i)});const i=Array.from(t.children||[]);Array.from(e.children||[]).forEach((t,e)=>o(i[e],t))};if(o(t,n),n.getAttribute("xmlns")||n.setAttribute("xmlns","http://www.w3.org/2000/svg"),!n.getAttribute("viewBox")&&t.getBBox)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&n.setAttribute("viewBox",[e.x,e.y,e.width,e.height].join(" "))}catch(t){}const i=(new XMLSerializer).serializeToString(n),a=btoa(unescape(encodeURIComponent(i)));return await $t("data:image/svg+xml;base64,"+a,e,r)}catch{return""}};await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));const Gt=[],Kt=Array.from(x.querySelectorAll("img,canvas,svg"));for(const t of Kt){if(Gt.length>=a)break;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!L(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;if(Number(e.opacity||"1")<.15)continue;const l=String(t.tagName||"").toUpperCase(),c="CANVAS"===l?Ut(t):"SVG"===l?await Vt(t,r.width,r.height):await qt(t,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:t.getAttribute("alt")||"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1"))}const Qt=new Set(Gt.map(t=>t.dataUri)),Yt=t=>{const e=String(t||"");if(!e||"none"===e)return[];const r=[],n=/url\\((?:["\']?)(.*?)(?:["\']?)\\)/gi;let o;for(;o=n.exec(e);){const t=String(o[1]||"").trim();t&&!t.startsWith("data:font/")&&r.push(t)}return r},Jt=[];for(const t of x.querySelectorAll("*")){if(Jt.length>=a)break;const e=window.getComputedStyle(t),r=e.backgroundImage||"";0!==Yt(r).length&&1===Yt(r).length&&!/gradient\\(|image-set\\(|cross-fade\\(/i.test(r)&&["auto","auto auto","100% 100%"].includes(String(e.backgroundSize||"").trim())&&/^(?:0(?:px|%)?\\s+)?0(?:px|%)?$/i.test(String(e.backgroundPosition||"").trim())&&"no-repeat"===String(e.backgroundRepeat||"").trim()&&Jt.push({el:t,style:e})}for(const{el:t,style:e}of Jt){if(Gt.length>=a)break;const{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!L(t,e,r))continue;const l=Yt(e.backgroundImage||"")[0];if(!l)continue;const c=/^data:image\\/svg\\+xml;base64,/i.test(l)?await $t(l,r.width,r.height):await zt(l,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Qt.has(d)||(Qt.add(d),Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")))}return(t=>{const e=(()=>{const t=Array.from(z.entries()).filter(([,t])=>t&&t.isConnected);if(0===t.length)return new Map;const e=t.map(([t])=>t),r=new Map(t.map(([t,e])=>[t,O(e)])),n=(t,e)=>((t,e)=>{const r=t?.key||[],n=e?.key||[],o=Math.max(r.length,n.length);for(let t=0;t<o;t+=1){const e=r[t]||{z:0,order:0},o=n[t]||{z:0,order:0};if(e.z!==o.z)return e.z-o.z;if(e.order!==o.order)return e.order-o.order}return(t?.order||0)-(e?.order||0)})(r.get(t),r.get(e));if(!document.elementsFromPoint)return(()=>{const t=new Map;let r=1;return e.slice().sort(n).forEach(e=>{t.set(e,r),r+=1}),t})();const o=new Map(e.map(t=>[t,new Set])),i=new Map(e.map(t=>[t,0])),a=(t,e)=>{if(!(t&&e&&t!==e&&o.has(t)&&i.has(e)))return;const r=o.get(t);r.has(e)||(r.add(e),i.set(e,(i.get(e)||0)+1))},s=t=>{let e=t;for(;e&&e!==document&&e!==document.documentElement;){const t=e.getAttribute?.("data-pptx-paint-id")||"";if(t&&z.has(t))return t;e=e.parentElement}return""},l=(t,e)=>{const r=new Set,n=[];for(const o of document.elementsFromPoint(t,e)){const t=s(o);t&&!r.has(t)&&(r.add(t),n.push(t))}return n},c=t=>{const e=Math.max(0,t.left),r=Math.max(0,t.top),n=Math.min(window.innerWidth,t.right),o=Math.min(window.innerHeight,t.bottom);if(n<=e||o<=r)return[];const i=e+.25*(n-e),a=e+.5*(n-e),s=e+.75*(n-e),l=r+.25*(o-r),c=r+.5*(o-r),d=r+.75*(o-r);return[[a,c],[i,l],[s,l],[i,d],[s,d],[a,l],[a,d],[i,c],[s,c]]},d=document.createElement("style");d.id="ohmyppt-paint-order-pointer-events",d.textContent="[data-pptx-paint-id] { pointer-events: auto !important; }",document.head.appendChild(d);try{for(const[,e]of t){const t=e.getBoundingClientRect();for(const[e,r]of c(t)){const t=l(e,r);for(let e=0;e<t.length;e+=1)for(let r=e+1;r<t.length;r+=1)a(t[r],t[e])}}}finally{d.remove()}const u=e.filter(t=>0===(i.get(t)||0)).sort(n),h=new Map;let g=1;for(;u.length>0;){const t=u.shift();if(t&&!h.has(t)){h.set(t,g),g+=1;for(const e of o.get(t)||[])i.set(e,Math.max(0,(i.get(e)||0)-1)),0===(i.get(e)||0)&&(u.push(e),u.sort(n))}}return e.filter(t=>!h.has(t)).sort(n).forEach(t=>{h.set(t,g),g+=1}),h})();t.forEach(t=>{t&&t.paintId&&(e.has(t.paintId)&&(t.order=e.get(t.paintId)),delete t.paintId)})})([...Et,...yt,...Gt]),{backgroundColor:k,shapes:Et,texts:yt,images:Gt,tables:m}})()'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(t.pageHeightPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_4__",String(JSON.stringify(o))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_5__",String(JSON.stringify(i))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_6__",String(JSON.stringify(a))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_7__",String(JSON.stringify(l))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_8__",String(JSON.stringify(Math.ceil(4*s/3)+128))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_9__",String(JSON.stringify(n))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_10__",String("\nconst rgbToHex = (value) => {\n const source = String(value || '').trim();\n if (!source || source === 'transparent') return '';\n if (source.startsWith('#')) {\n const raw = source.slice(1).toUpperCase();\n return raw.length === 3 ? raw.split('').map((part) => part + part).join('') : raw;\n }\n const match = source.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);\n if (!match) return '';\n const alpha = match[4] === undefined\n ? 1\n : String(match[4]).endsWith('%')\n ? Number.parseFloat(match[4]) / 100\n : Number(match[4]);\n if (alpha <= 0.02) return '';\n return [match[1], match[2], match[3]]\n .map((part) => Math.max(0, Math.min(255, Math.round(Number(part) || 0))).toString(16).padStart(2, '0'))\n .join('')\n .toUpperCase();\n};\n")).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_11__",String(c)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_12__",String(144)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_13__",String(144))},i=13.333,a=7.5,l=(t,e,r)=>Math.max(e,Math.min(r,t)),s=(t,e="111827")=>{if(!t)return e;const r=t.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(r)?r.split("").map(t=>`${t}${t}`).join(""):/^[0-9A-F]{6}$/.test(r)?r:e},c=t=>{const e=t.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\n")},d=(t,e)=>{const r=(t=>String(t||"").split(",").map(t=>t.trim().replace(/^["']|["']$/g,"")).find(Boolean)||"Aptos")(e);return(t=>/[\u3400-\u9fff\uf900-\ufaff]/.test(t))(t)&&/^(aptos|arial|helvetica|inter|system-ui|-apple-system|sans-serif|serif)$/i.test(r)?"Microsoft YaHei":r},u=t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.text||""));if(!r)return null;const n=Math.max(1,Number(e.rowspan)||1),o=Math.max(1,Number(e.colspan)||1),u=e.border&&"object"==typeof e.border?e.border:null,h=u?s(String(u.color||""),""):"";return{text:r,rowspan:n,colspan:o,x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.1,.05,i),h:l(Number(e.h)||.05,.03,a),fontSize:e.fontSize?l(Number(e.fontSize),6,144):void 0,fontFace:d(r,String(e.fontFace||"")),color:s(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",valign:"middle"===e.valign||"bottom"===e.valign?e.valign:"top",fill:e.fill?s(String(e.fill),""):void 0,fillTransparency:e.fillTransparency?l(Number(e.fillTransparency),0,100):void 0,border:h?{color:h,widthPt:l(Number(u?.widthPt??.75),.1,20),dash:"dash"===u?.dash?"dash":"solid"}:void 0}},h=t=>{const e=t&&"object"==typeof t?t:{},r=Array.isArray(e.rows)?e.rows:[],n=Array.isArray(e.colWidths)?e.colWidths:[],o=Array.isArray(e.rowHeights)?e.rowHeights:[];if(0===r.length)return null;const s=r.map(t=>(Array.isArray(t)?t:[]).map(u).filter(t=>null!==t)).filter(t=>t.length>0);return 0===s.length?null:{x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.1,.1,i),h:l(Number(e.h)||.1,.1,a),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0,colWidths:n.map(t=>Math.max(.05,Number(t)||.05)),rowHeights:o.map(t=>Math.max(.03,Number(t)||.03)),rows:s}},g=t=>{const e=t&&"object"==typeof t?t:{},r=String(e.text||"").replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ")).join("\n");return r.trim()?{text:r,fontSize:Number(e.fontSize)>0?l(Number(e.fontSize),6,144):void 0,fontFace:d(r,String(e.fontFace||"")),color:s(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike)}:null},m=(t,e)=>{const r=t&&"object"==typeof t?t:{},n=Array.isArray(r.texts)?r.texts:[],o=Array.isArray(r.shapes)?r.shapes:[],u=Array.isArray(r.images)?r.images:[],m=Array.isArray(r.tables)?r.tables:[],p=n.map(t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.text||"")).slice(0,1e3);if(!r)return null;const n=Array.isArray(e.runs)?e.runs.map(g).filter(t=>null!==t):[],o=e.bullet&&"object"==typeof e.bullet?e.bullet:null,u="bullet"===o?.type||"number"===o?.type?o.type:void 0,h=u&&o?{type:u,level:Number.isFinite(Number(o.level))?l(Number(o.level),0,8):void 0,startAt:Number.isFinite(Number(o.startAt))?l(Number(o.startAt),1,32767):void 0}:void 0;return{text:r,x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.4,.1,i),h:l(Number(e.h)||.2,.08,a),fontSize:l(Number(e.fontSize)||12,6,144),fontFace:d(r,String(e.fontFace||"")),color:s(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",opacity:l(Number(e.opacity??1),0,1),rotate:l(Number(e.rotate??0),-360,360),lineSpacing:Number(e.lineSpacing)>0?l(Number(e.lineSpacing),1,200):void 0,charSpacing:Number.isFinite(Number(e.charSpacing))?l(Number(e.charSpacing),-20,200):void 0,paragraphSpacingBefore:Number(e.paragraphSpacingBefore)>0?l(Number(e.paragraphSpacingBefore),0,72):void 0,paragraphSpacingAfter:Number(e.paragraphSpacingAfter)>0?l(Number(e.paragraphSpacingAfter),0,72):void 0,verticalAlign:"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:"top",paddingLeft:Number(e.paddingLeft)>0?l(Number(e.paddingLeft),0,2):void 0,paddingRight:Number(e.paddingRight)>0?l(Number(e.paddingRight),0,2):void 0,paddingTop:Number(e.paddingTop)>0?l(Number(e.paddingTop),0,1):void 0,paddingBottom:Number(e.paddingBottom)>0?l(Number(e.paddingBottom),0,1):void 0,bullet:h,runs:n.length>0?n:void 0,wrap:Boolean(e.wrap),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),f=o.map(t=>{const e=t&&"object"==typeof t?t:{},r=s(String(e.fill||""),""),n=e.border&&"object"==typeof e.border?e.border:null,o=s(String(n?.color||""),"");if(!r&&!o)return null;const c="ellipse"===e.shapeType||"roundRect"===e.shapeType||"line"===e.shapeType?e.shapeType:"rect",d="line"===c?.001:.05,u="line"===c?.001:.05;return{x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||d,d,i),h:l(Number(e.h)||u,u,a),fill:r,transparency:l(Number(e.transparency??0),0,100),radius:l(Number(e.radius??0),0,100),radiusAdj:l(Number(e.radiusAdj??0),0,5e4),border:o?{color:o,widthPt:l(Number(n?.widthPt??.75),.1,20),transparency:l(Number(n?.transparency??0),0,100),dash:"dash"===n?.dash?"dash":"solid"}:void 0,shapeType:c,rotate:l(Number(e.rotate??0),-360,360),flipV:Boolean(e.flipV),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),b=u.map(t=>{const e=t&&"object"==typeof t?t:{},r=String(e.dataUri||""),n=(t=>{const e=t.match(/^data:(image\/(?:png|jpeg|jpg|gif));base64,/i);return e?"image/jpg"===e[1].toLowerCase()?"image/jpeg":e[1].toLowerCase():""})(r);return!n||(t=>{const e=t.indexOf(",");if(e<0)return 0;const r=t.slice(e+1).replace(/\s/g,"");if(!r)return 0;const n=r.endsWith("==")?2:r.endsWith("=")?1:0;return Math.max(0,Math.floor(3*r.length/4)-n)})(r)>12582912?null:{dataUri:r,mimeType:n,x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.1,.05,i),h:l(Number(e.h)||.1,.05,a),alt:(o=String(e.alt||""),o.replace(/\s+/g," ").replace(/[\u200b-\u200d\ufeff]/g,"").trim()),rotate:l(Number(e.rotate??0),-360,360),opacity:l(Number(e.opacity??1),0,1),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0};var o}).filter(t=>Boolean(t)),x=m.map(h).filter(t=>null!==t);return{title:e,backgroundColor:s(String(r.backgroundColor||""),"FFFFFF"),backgroundImage:void 0,texts:p,shapes:f,images:b,tables:x.length>0?x:void 0,overlayImages:void 0}},p=t=>r(t);export{o as buildHtmlToPptxExtractScript,p as generatePptx,m as normalizeExtractedHtmlToPptxSlide};
|
|
1
|
+
import{createRequire as t}from"module";import{pathToFileURL as e}from"url";import{buildPptxDocument as r}from"./ooxml-writer.js";import"fflate";import"./animation-writer.js";const n=e(t(import.meta.url).resolve("@chenglou/pretext")).toString(),o=t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5,o=Math.max(1,Math.floor(t.maxTextBoxes??360)),i=Math.max(0,Math.floor(t.maxShapes??400)),a=Math.max(0,Math.floor(t.maxImages??80)),l=Math.max(80,Math.floor(t.maxTextChars??1e3)),s=Math.max(0,Math.floor(t.maxImageBytes??12582912)),c=(t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5;return'(function(){const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,o=t=>{const e=String(t||"").trim();if(!e||"transparent"===e)return"";if(e.startsWith("#")){const t=e.slice(1).toUpperCase();return 3===t.length?t.split("").map(t=>t+t).join(""):t}const o=e.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);return o?(void 0===o[4]?1:String(o[4]).endsWith("%")?Number.parseFloat(o[4])/100:Number(o[4]))<=.02?"":[o[1],o[2],o[3]].map(t=>Math.max(0,Math.min(255,Math.round(Number(t)||0))).toString(16).padStart(2,"0")).join("").toUpperCase():""},r=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const o=String(e[1]);return o.endsWith("%")?Number.parseFloat(o)/100:Number(o)},n=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,i=n.getBoundingClientRect(),l=i.left||0,a=i.top||0,s=i.width||__HTML2PPTX_TEMPLATE_SLOT_2__,d=i.height||__HTML2PPTX_TEMPLATE_SLOT_3__,c=e=>((Number(e)||0)-l)/s*t,u=t=>((Number(t)||0)-a)/d*e,g=e=>(Number(e)||0)/s*t,p=t=>(Number(t)||0)/d*e,m=72*Math.min(t/s,e/d),h=[],f=[],b=n.querySelectorAll("table");for(const t of b){if(t.closest("script, style, noscript, .katex, .katex-mathml"))continue;const e=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===e.display||"hidden"===e.visibility)continue;if(n.width<10||n.height<10)continue;const i=Array.from(t.querySelectorAll("th, td")).some(t=>{const e=window.getComputedStyle(t);return Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest("script, style, noscript, svg, canvas"))return!1;const r=window.getComputedStyle(t),n=t.getBoundingClientRect();if("none"===r.display||"hidden"===r.visibility)return!1;if(n.width<1||n.height<1)return!1;const i=Boolean(o(r.backgroundColor))||["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(r["border"+t+"Width"]||"0")||0)>0),l=r.fontSize!==e.fontSize||r.fontWeight!==e.fontWeight||r.color!==e.color||r.fontStyle!==e.fontStyle||r.textDecorationLine!==e.textDecorationLine,a=["DIV","SECTION","ARTICLE","ASIDE","P","UL","OL"].includes(t.tagName);return i||l||a})}),l=Array.from(t.querySelectorAll("tr")).some(t=>{const e=window.getComputedStyle(t),r=Boolean(o(e.backgroundColor)),n=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0);return r||n});if(i||l){t.setAttribute("data-pptx-dom-table","1");continue}const a=t.querySelectorAll("tr");if(!a.length)continue;let s=0;for(const t of a){let e=0;for(const o of t.children)"TD"!==o.tagName&&"TH"!==o.tagName||(e+=Number(o.getAttribute("colspan")||1));s=Math.max(s,e)}if(0===s)continue;const d=new Array(s).fill(0),b=[],S=new Array(a.length).fill(null).map(()=>new Array(s).fill(!1));for(let t=0;t<a.length;t++){const e=a[t],o=e.getBoundingClientRect();b.push(o.height);let r=0;for(const o of e.children){if("TD"!==o.tagName&&"TH"!==o.tagName)continue;const e=Number(o.getAttribute("colspan")||1),n=Number(o.getAttribute("rowspan")||1);for(;r<s&&S[t][r];)r++;if(r>=s)break;const i=o.getBoundingClientRect().width/e;for(let t=0;t<e&&r+t<s;t++)d[r+t]=Math.max(d[r+t],i);for(let o=1;o<n&&t+o<a.length;o++)for(let n=0;n<e&&r+n<s;n++)S[t+o][r+n]=!0;r+=e}}const y=[];for(const t of a){const e=[];for(const n of t.children){if("TD"!==n.tagName&&"TH"!==n.tagName)continue;const t=window.getComputedStyle(n),i=n.getBoundingClientRect(),l=Number(n.getAttribute("rowspan")||1),a=Number(n.getAttribute("colspan")||1),s=String(n.textContent||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),d=Number.parseFloat(t.fontSize||"16")||16,h=Number.parseInt(t.fontWeight||"400",10)||400,f=o(t.backgroundColor),b=r(t.backgroundColor),S=o(t.borderColor),y=Number.parseFloat(t.borderWidth||"0")||0,T=y>0&&"none"!==t.borderStyle&&S;let _="top";const w=String(t.verticalAlign||"");"middle"===w?_="middle":"bottom"===w&&(_="bottom");let A="left";const N=String(t.textAlign||"");"center"===N?A="center":"right"===N||"end"===N?A="right":"justify"===N&&(A="justify"),e.push({text:s,rowspan:l,colspan:a,x:c(i.left),y:u(i.top),w:g(i.width),h:p(i.height),fontSize:Math.max(6,Math.min(144,d*m)),fontFace:String(t.fontFamily||"").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",color:o(t.color)||"111827",bold:h>=600,italic:"italic"===t.fontStyle||"oblique"===t.fontStyle,underline:String(t.textDecoration||"").includes("underline"),strike:String(t.textDecoration||"").includes("line-through"),align:A,valign:_,fill:f||void 0,fillTransparency:f?Math.round(100*(1-b)):void 0,border:T?{color:S,widthPt:.75*y,dash:"dashed"===t.borderStyle?"dash":"solid"}:void 0})}y.push(e)}const T="pptx-table-"+h.length;t.setAttribute("data-pptx-consumed-table",T),f.push(T),h.push({x:c(n.left),y:u(n.top),w:g(n.width),h:p(n.height),colWidths:d.map(t=>g(t)),rowHeights:b.map(t=>p(t)),rows:y})}return{tables:h,consumedTableElementIds:f}}())'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(t.pageHeightPx)))})(t);return'(async()=>{const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,r=__HTML2PPTX_TEMPLATE_SLOT_2__,n=__HTML2PPTX_TEMPLATE_SLOT_3__,o=__HTML2PPTX_TEMPLATE_SLOT_4__,i=__HTML2PPTX_TEMPLATE_SLOT_5__,a=__HTML2PPTX_TEMPLATE_SLOT_6__,s=__HTML2PPTX_TEMPLATE_SLOT_7__,l=__HTML2PPTX_TEMPLATE_SLOT_8__,c=__HTML2PPTX_TEMPLATE_SLOT_9__;let d=null;try{d=await import(c)}catch(t){d=null}const u=t=>String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),h=t=>u(t).slice(0,s),g=t=>(t=>{const e=String(t||"").replace(/\\r\\n?/g,"\\n").replace(/[\\u200b-\\u200d\\ufeff]/g,"").split("\\n").map(t=>t.replace(/[^\\S\\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\\n")})(t).slice(0,s);__HTML2PPTX_TEMPLATE_SLOT_10__;const m=__HTML2PPTX_TEMPLATE_SLOT_11__,f=m.tables||[],p=new Set(m.consumedTableElementIds||[]),b=t=>{if(t.getAttribute&&p.has(t.getAttribute("data-pptx-consumed-table")))return!0;const e=t.closest&&t.closest("[data-pptx-consumed-table]");return!!e&&p.has(e.getAttribute("data-pptx-consumed-table"))},x=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,F=x.getBoundingClientRect(),w=F.left||0,E=F.top||0,S=F.width||t,y=F.height||e,M=(x instanceof HTMLElement&&x.offsetWidth&&x.offsetWidth,t=>((Number(t)||0)-w)/S*r),A=t=>((Number(t)||0)-E)/y*n,C=t=>(Number(t)||0)/S*r,T=t=>(Number(t)||0)/y*n,N=72*Math.min(r/S,n/y),B=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const r=String(e[1]),n=r.endsWith("%")?Number.parseFloat(r)/100:Number(r);return Math.max(0,Math.min(1,Number.isFinite(n)?n:1))},D=(t,e)=>{const r=B(t)*Math.max(0,Math.min(1,Number(e||1)));return Math.round(100*(1-r))},_=t=>{const e=t.webkitTextFillColor||t.getPropertyValue?.("-webkit-text-fill-color")||"",r=rgbToHex(e)?e:t.color;return{color:rgbToHex(r)||rgbToHex(t.color)||"111827",opacity:B(r)*Math.max(0,Math.min(1,Number(t.opacity||1)))}},v=t=>{if(!t.transform||"none"===t.transform)return;const e=t.transform.match(/matrix\\(([^)]+)\\)/)?.[1]?.split(",").map(t=>Number(t.trim()));return!e||e.length<4?void 0:Math.round(180*Math.atan2(e[1],e[0])/Math.PI)||void 0},L={textLimitReached:!1,shapeLimitReached:!1,imageLimitReached:!1,unsupportedTransformCount:0,imageRasterFallbackCount:0},k=new Set,P=t=>{const e=String(t||"").trim();if(!e||"none"===e)return!0;const r=e.match(/^matrix\\(([^)]+)\\)$/)?.[1]?.split(",").map(t=>Number(t.trim()));return!(!r||6!==r.length||!r.every(Number.isFinite))&&Math.abs(r[1])<1e-4&&Math.abs(r[2])<1e-4},R=t=>{let e=t;for(;e&&e.nodeType===Node.ELEMENT_NODE;){if(!P(window.getComputedStyle(e).transform))return k.add(e),!0;if(e===x)break;e=e.parentElement}return!1},I=(()=>{const t=rgbToHex(window.getComputedStyle(x).backgroundColor);if(t)return t;const e=rgbToHex(window.getComputedStyle(document.documentElement).backgroundColor);if(e)return e;const r=S*y,n=x.querySelectorAll(":scope > div, :scope > section, :scope > main");for(const t of n){const e=window.getComputedStyle(t),n=rgbToHex(e.backgroundColor);if(!n)continue;const o=t.getBoundingClientRect();if(o.width*o.height>=.5*r)return n}return"FFFFFF"})(),H=(r,n,o)=>{if(!n||"none"===n.display||"hidden"===n.visibility)return!1;if(Number(n.opacity||"1")<.04)return!1;const i=["Top","Right","Bottom","Left"].some(t=>{const e=Number.parseFloat(n["border"+t+"Width"]||"0")||0,r=n["border"+t+"Style"];return e>0&&"none"!==r});return!((o.width<2||o.height<2)&&!i||o.width<2&&o.height<2||o.bottom<0||o.right<0||o.left>t||o.top>e||r.closest("script, style, noscript, .katex, .katex-mathml, [data-pptx-formula-block]"))},W=t=>{const e=t.getBoundingClientRect();return{rect:e,x:M(e.left),y:A(e.top),w:C(e.width),h:T(e.height)}},O=new WeakMap;Array.from(x.querySelectorAll("*")).forEach((t,e)=>{O.set(t,e+1)});const j=t=>O.get(t)||0,z=t=>{const e=String(t?.zIndex||"").trim();if(!e||"auto"===e)return;const r=Number.parseInt(e,10);return Number.isFinite(r)?Math.max(-1e5,Math.min(1e5,r)):void 0},U=(t,e)=>!(!t||t===x||!(void 0!==z(e)&&("static"!==e.position||(t=>{const e=t?.parentElement;return!!e&&/(?:^|\\s)(?:inline-)?(?:flex|grid)(?:\\s|$)/.test(window.getComputedStyle(e).display||"")})(t))||Number(e.opacity||"1")<1||e.transform&&"none"!==e.transform||e.filter&&"none"!==e.filter||e.backdropFilter&&"none"!==e.backdropFilter||e.perspective&&"none"!==e.perspective||e.mixBlendMode&&"normal"!==e.mixBlendMode||"isolate"===e.isolation||/(?:layout|paint|strict|content)/.test(e.contain||"")||/(?:transform|opacity|filter|perspective|contents)/.test(e.willChange||""))),q=t=>{const e=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE&&(e.push(r),r!==x);)r=r.parentElement;e.reverse();const n=[{z:0,order:0}];for(const t of e){if(!t||t===x)continue;const e=window.getComputedStyle(t);U(t,e)&&n.push({z:z(e)??0,order:j(t)})}const o=j(t);return n.some(t=>t.order===o)||n.push({z:0,order:o}),{key:n,order:o}},$=t=>{let e=1,r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const t=Number(window.getComputedStyle(r).opacity||"1");if(Number.isFinite(t)&&(e*=Math.max(0,Math.min(1,t))),r===x)break;r=r.parentElement}return Math.max(0,Math.min(1,e))},X=new Map;let V=0;const G=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE)return"";let e=t.getAttribute("data-pptx-paint-id");return e||(V+=1,e="pptx-paint-"+String(V),t.setAttribute("data-pptx-paint-id",e)),X.set(e,t),e},K=new Map([["ring",3],["ring-0",0],["ring-1",1],["ring-2",2],["ring-4",4],["ring-8",8]]),Q=new Map([["border",1],["border-0",0],["border-2",2],["border-4",4],["border-8",8]]),Y=new Map([["rounded-none",0],["rounded-sm",2],["rounded",4],["rounded-md",6],["rounded-lg",8],["rounded-xl",12],["rounded-2xl",16],["rounded-3xl",24]]),J=new Map([["font-thin",100],["font-extralight",200],["font-light",300],["font-normal",400],["font-medium",500],["font-semibold",600],["font-bold",700],["font-extrabold",800],["font-black",900]]),Z=new Map([["black","#000000"],["white","#FFFFFF"],["transparent","rgba(0, 0, 0, 0)"]]),tt=["50","100","200","300","400","500","600","700","800","900","950"],et=new Map(Object.entries({slate:["#F8FAFC","#F1F5F9","#E2E8F0","#CBD5E1","#94A3B8","#64748B","#475569","#334155","#1E293B","#0F172A","#020617"],gray:["#F9FAFB","#F3F4F6","#E5E7EB","#D1D5DB","#9CA3AF","#6B7280","#4B5563","#374151","#1F2937","#111827","#030712"],zinc:["#FAFAFA","#F4F4F5","#E4E4E7","#D4D4D8","#A1A1AA","#71717A","#52525B","#3F3F46","#27272A","#18181B","#09090B"],neutral:["#FAFAFA","#F5F5F5","#E5E5E5","#D4D4D4","#A3A3A3","#737373","#525252","#404040","#262626","#171717","#0A0A0A"],stone:["#FAFAF9","#F5F5F4","#E7E5E4","#D6D3D1","#A8A29E","#78716C","#57534E","#44403C","#292524","#1C1917","#0C0A09"],red:["#FEF2F2","#FEE2E2","#FECACA","#FCA5A5","#F87171","#EF4444","#DC2626","#B91C1C","#991B1B","#7F1D1D","#450A0A"],orange:["#FFF7ED","#FFEDD5","#FED7AA","#FDBA74","#FB923C","#F97316","#EA580C","#C2410C","#9A3412","#7C2D12","#431407"],amber:["#FFFBEB","#FEF3C7","#FDE68A","#FCD34D","#FBBF24","#F59E0B","#D97706","#B45309","#92400E","#78350F","#451A03"],yellow:["#FEFCE8","#FEF9C3","#FEF08A","#FDE047","#FACC15","#EAB308","#CA8A04","#A16207","#854D0E","#713F12","#422006"],lime:["#F7FEE7","#ECFCCB","#D9F99D","#BEF264","#A3E635","#84CC16","#65A30D","#4D7C0F","#3F6212","#365314","#1A2E05"],green:["#F0FDF4","#DCFCE7","#BBF7D0","#86EFAC","#4ADE80","#22C55E","#16A34A","#15803D","#166534","#14532D","#052E16"],emerald:["#ECFDF5","#D1FAE5","#A7F3D0","#6EE7B7","#34D399","#10B981","#059669","#047857","#065F46","#064E3B","#022C22"],teal:["#F0FDFA","#CCFBF1","#99F6E4","#5EEAD4","#2DD4BF","#14B8A6","#0D9488","#0F766E","#115E59","#134E4A","#042F2E"],cyan:["#ECFEFF","#CFFAFE","#A5F3FC","#67E8F9","#22D3EE","#06B6D4","#0891B2","#0E7490","#155E75","#164E63","#083344"],sky:["#F0F9FF","#E0F2FE","#BAE6FD","#7DD3FC","#38BDF8","#0EA5E9","#0284C7","#0369A1","#075985","#0C4A6E","#082F49"],blue:["#EFF6FF","#DBEAFE","#BFDBFE","#93C5FD","#60A5FA","#3B82F6","#2563EB","#1D4ED8","#1E40AF","#1E3A8A","#172554"],indigo:["#EEF2FF","#E0E7FF","#C7D2FE","#A5B4FC","#818CF8","#6366F1","#4F46E5","#4338CA","#3730A3","#312E81","#1E1B4B"],violet:["#F5F3FF","#EDE9FE","#DDD6FE","#C4B5FD","#A78BFA","#8B5CF6","#7C3AED","#6D28D9","#5B21B6","#4C1D95","#2E1065"],purple:["#FAF5FF","#F3E8FF","#E9D5FF","#D8B4FE","#C084FC","#A855F7","#9333EA","#7E22CE","#6B21A8","#581C87","#3B0764"],fuchsia:["#FDF4FF","#FAE8FF","#F5D0FE","#F0ABFC","#E879F9","#D946EF","#C026D3","#A21CAF","#86198F","#701A75","#4A044E"],pink:["#FDF2F8","#FCE7F3","#FBCFE8","#F9A8D4","#F472B6","#EC4899","#DB2777","#BE185D","#9D174D","#831843","#500724"],rose:["#FFF1F2","#FFE4E6","#FECDD3","#FDA4AF","#FB7185","#F43F5E","#E11D48","#BE123C","#9F1239","#881337","#4C0519"]})),rt=t=>{const e=String(t||"").trim();if(!e)return"";const r=e.split(":");return r[r.length-1]||e},nt=(t,e)=>{let r="",n="";const o=e+"-[";if(t.startsWith(o)){const e=t.indexOf("]");if(e<0)return null;r=t.slice(o.length,e),n=t.slice(e+1).startsWith("/")?t.slice(e+2):""}else if(t.startsWith(e+"-")){const o=t.slice(e.length+1),i=o.indexOf("/");r=(t=>{if(Z.has(t))return Z.get(t);const e=String(t||"").match(/^([a-z]+)-(50|100|200|300|400|500|600|700|800|900|950)$/);if(!e)return"";const r=et.get(e[1]),n=tt.indexOf(e[2]);return r&&n>=0?r[n]:""})(i>=0?o.slice(0,i):o),n=i>=0?o.slice(i+1):""}if(!r||/^-?\\d/.test(r)||/px\\]?$/.test(r))return null;const i=(t=>{const e=String(t||"").replace(/^\\[|\\]$/g,"").trim();if(!e)return;const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r>1?r/100:r)):void 0})(n);return void 0!==i&&r.startsWith("#")?((t,e)=>{const r=String(t||"").trim().replace(/^#/,""),n=3===r.length?r.split("").map(t=>t+t).join(""):r.slice(0,6);return/^[0-9a-f]{6}$/i.test(n)?"rgba("+Number.parseInt(n.slice(0,2),16)+", "+Number.parseInt(n.slice(2,4),16)+", "+Number.parseInt(n.slice(4,6),16)+", "+e+")":t})(r,i):r},ot=t=>nt(t,"ring"),it=t=>nt(t,"border"),at=t=>nt(t,"bg"),st=t=>{if(K.has(t))return K.get(t);const e=t.match(/^ring-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},lt=t=>{if(Q.has(t))return Q.get(t);const e=t.match(/^border-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},ct=t=>{const e=String(t||"").match(/^border-([trblxy])(?:-(0|2|4|8|\\[(-?\\d*\\.?\\d+)px\\]))?$/);if(!e)return null;const r=e[1],n=e[2],o=e[3],i=void 0!==o?Number.parseFloat(o):n?Number.parseFloat(n):1;return!Number.isFinite(i)||i<0?null:{sides:"x"===r?["left","right"]:"y"===r?["top","bottom"]:"t"===r?["top"]:"r"===r?["right"]:"b"===r?["bottom"]:["left"],width:i}},dt=t=>{const e=String(t||"").match(/^border-([trblxy])-(.+)$/);if(!e)return null;const r=e[2];if(/^(?:0|2|4|8|\\[-?\\d*\\.?\\d+px\\])$/.test(r))return null;const n=it("border-"+r);if(!n)return null;const o=e[1];return{sides:"x"===o?["left","right"]:"y"===o?["top","bottom"]:"t"===o?["top"]:"r"===o?["right"]:"b"===o?["bottom"]:["left"],colorSource:n}},ut=t=>{if("rounded-full"===t)return{full:!0};if(Y.has(t))return{px:Y.get(t)};const e=t.match(/^rounded-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return null;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?{px:Math.max(0,r)}:null},ht=t=>{if(J.has(t))return J.get(t);const e=t.match(/^font-\\[([1-9]\\d{0,2})\\]$/);if(!e)return;const r=Number.parseInt(e[1],10);return Number.isFinite(r)?Math.max(1,Math.min(1e3,r)):void 0},gt=t=>{const e=String(t?.className||"").split(/\\s+/).filter(Boolean);let r;for(const t of e){const e=ht(rt(t));void 0!==e&&(r=e)}return r},mt=t=>{const e=String(t.fontWeight||"").trim().toLowerCase();if(!e)return;if("normal"===e)return 400;if("bold"===e)return 700;const r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:void 0},ft=t=>{const e=t?.style?.fontWeight;if(e)return mt({fontWeight:e})},pt=(t,e,r)=>{const n=String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"");if(!n)return null;const o=Number.parseFloat(e.fontSize||"16")||16,i=ft(r),a=gt(r),s=mt(e),l=i||a||s||400,c=String(e.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",d=_(e);return{text:n,fontSize:Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_12__,o*N)),fontFace:c,color:d.color,bold:l>=600||/^H[1-6]$/i.test(r?.tagName||""),italic:"italic"===e.fontStyle||"oblique"===e.fontStyle,underline:String(e.textDecoration||"").includes("underline"),strike:String(e.textDecoration||"").includes("line-through")}},bt=t=>{for(;t.length>0&&(t[0].text=String(t[0].text||"").trimStart(),!t[0].text);)t.shift();for(;t.length>0;){const e=t[t.length-1];if(e.text=String(e.text||"").trimEnd(),e.text)break;t.pop()}return t.filter(t=>t.text)},xt=(t,e)=>t&&e&&t.fontSize===e.fontSize&&t.fontFace===e.fontFace&&t.color===e.color&&Boolean(t.bold)===Boolean(e.bold)&&Boolean(t.italic)===Boolean(e.italic)&&Boolean(t.underline)===Boolean(e.underline)&&Boolean(t.strike)===Boolean(e.strike),Ft=(t,e)=>{if(!t||Wt(e))return;const r=[],n=(t,e,o)=>{if(t.nodeType===Node.TEXT_NODE){const n=pt(t.textContent,o,e);return void(n&&r.push(n))}if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t;if(i.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const a=window.getComputedStyle(i);i.childNodes.forEach(t=>n(t,i,a))};if(t.childNodes.forEach(r=>n(r,t,e)),bt(r),0===r.length)return;const o=u(r.map(t=>t.text).join("")),i=u(t.innerText||t.textContent);if(!o||o!==i)return;const a=pt(i,e,t);return r.some(t=>!xt(t,a))?r:void 0},wt=(t,e)=>{if(!e||!e.text)return;const r=t[t.length-1];xt(r,e)?r.text+=e.text:t.push({...e})},Et=(t,e)=>{if(!t||Wt(e))return[];const r=u(t.innerText||t.textContent);if(!r||r.length>_t)return[];const n=[];let o=null;const i=(t,e,r)=>{if(t.nodeType===Node.TEXT_NODE){const i=String(t.textContent||"");for(let a=0;a<i.length;a+=1){const s=i[a];if(!s)continue;const l=document.createRange();l.setStart(t,a),l.setEnd(t,a+1);const c=l.getBoundingClientRect();if(l.detach(),c.width<.5||c.height<.5){o&&/\\s/.test(s)&&(wt(o.runs,pt(s,r,e)),o.text+=s);continue}let d=n.find(t=>Math.abs(t.top-c.top)<Math.max(3,.3*c.height));d||(d={top:c.top,left:c.left,right:c.right,bottom:c.bottom,text:"",runs:[]},n.push(d)),wt(d.runs,pt(s,r,e)),d.text+=s,d.left=Math.min(d.left,c.left),d.right=Math.max(d.right,c.right),d.bottom=Math.max(d.bottom,c.bottom),o=d}return}if(t.nodeType!==Node.ELEMENT_NODE)return;const a=t;if(a.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const s=window.getComputedStyle(a);a.childNodes.forEach(t=>i(t,a,s))};t.childNodes.forEach(r=>i(r,t,e));const a=n.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>{bt(t.runs);const e=u(t.runs.map(t=>t.text).join(""));return e?{text:e,rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top},runs:t.runs}:null}).filter(Boolean);return u(a.map(t=>t.text).join(""))===r?a:[]},St=t=>{const e={ringWidthPx:void 0,ringColorSource:"",ringInset:!1,borderWidthPx:void 0,borderSideWidthPx:{left:void 0,top:void 0,right:void 0,bottom:void 0},borderSideColorSource:{left:"",top:"",right:"",bottom:""},borderColorSource:"",borderDash:void 0,backgroundColorSource:"",radiusPx:void 0,radiusFull:!1},r=String(t?.className||"").split(/\\s+/).filter(Boolean);for(const t of r){const r=rt(t);if("ring-inset"===r){e.ringInset=!0;continue}"border-dashed"===r||"border-dotted"===r?e.borderDash="dash":"border-solid"===r&&(e.borderDash="solid");const n=st(r);void 0!==n&&(e.ringWidthPx=n);const o=ot(r);o&&(e.ringColorSource=o);const i=lt(r);void 0!==i&&(e.borderWidthPx=i);const a=ct(r);a&&a.sides.forEach(t=>{e.borderSideWidthPx[t]=a.width});const s=dt(r);s&&s.sides.forEach(t=>{e.borderSideColorSource[t]=s.colorSource});const l=it(r);l&&(e.borderColorSource=l);const c=at(r);c&&(e.backgroundColorSource=c);const d=ut(r);d?.full?e.radiusFull=!0:void 0!==d?.px&&(e.radiusPx=d.px)}return e},yt=(t,e,r)=>{let n=null;if(t.boxShadow&&"none"!==t.boxShadow)for(const r of(t=>{const e=[];let r="",n=0;for(const o of String(t||""))"("===o?n+=1:")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(r.trim()&&e.push(r.trim()),r=""):r+=o;return r.trim()&&e.push(r.trim()),e})(t.boxShadow)){if(/\\binset\\b/i.test(r))continue;const t=r.match(/rgba?\\([^)]*\\)|#[0-9a-fa-f]{3,8}/i);if(!t)continue;const o=t[0],i=rgbToHex(o);if(!i||B(o)*e<.04)continue;const a=r.replace(o," ").match(/-?\\d*\\.?\\d+(?:px)?/g)?.map(t=>Number.parseFloat(t))||[];if(a.length<4)continue;const[s,l,c,d]=a;Math.abs(s)>.5||Math.abs(l)>.5||Math.abs(c)>.5||!Number.isFinite(d)||d<=.5||(!n||d>n.w)&&(n={w:d,c:i,colorSource:o})}if(r?.ringInset)return n;if(r?.ringWidthPx>0){const t=r.ringColorSource||n?.colorSource||"rgba(59, 130, 246, 0.5)",o=rgbToHex(t);if(o&&B(t)*e>=.04){const e={w:r.ringWidthPx,c:o,colorSource:t};if(!n||e.w>n.w)return e}}return n},Mt=Array.from(x.querySelectorAll("section,main,article,header,footer,aside,div,figure,figcaption,table,thead,tbody,tfoot,tr,td,th,span")),At=[],Ct=S*y*.005;for(const t of Mt){if(At.length>=i){L.shapeLimitReached=!0;continue}if(b(t))continue;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:a,h:s}=W(t);if(!H(t,e,r))continue;if(R(t))continue;if(/blur/i.test(e.filter||""))continue;const l=(e.backgroundImage||"").trim();if(l&&"none"!==l)continue;if(e.clipPath&&"none"!==e.clipPath||e.maskImage&&"none"!==e.maskImage||e.webkitMaskImage&&"none"!==e.webkitMaskImage||e.mixBlendMode&&"normal"!==e.mixBlendMode||e.backgroundBlendMode&&"normal"!==e.backgroundBlendMode||e.backdropFilter&&"none"!==e.backdropFilter)continue;const c=Number(e.opacity||"1");if(c<.15)continue;const d=St(t),h=rgbToHex(e.backgroundColor)?e.backgroundColor:d.backgroundColorSource,g=rgbToHex(h),m=()=>{const t=[{side:"left",w:e.borderLeftWidth,c:e.borderLeftColor,s:e.borderLeftStyle},{side:"top",w:e.borderTopWidth,c:e.borderTopColor,s:e.borderTopStyle},{side:"right",w:e.borderRightWidth,c:e.borderRightColor,s:e.borderRightStyle},{side:"bottom",w:e.borderBottomWidth,c:e.borderBottomColor,s:e.borderBottomStyle}],r=[],n=(t,e=!1)=>{const n=r.findIndex(e=>e.side===t.side);n>=0?e&&(r[n]=t):r.push(t)},o=t=>{const e=r.findIndex(e=>e.side===t);e>=0&&r.splice(e,1)};for(const e of t){const t=Number.parseFloat(e.w||"0")||0;if(t<=0||"none"===e.s)continue;const r=rgbToHex(e.c);r&&n({side:e.side,w:t,c:r,colorSource:e.c,dash:"dashed"===e.s||"dotted"===e.s?"dash":"solid"})}if(d.borderWidthPx>0){const t=d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",r=rgbToHex(t);if(r&&B(t)*c>=.04)for(const e of["left","top","right","bottom"])n({side:e,w:d.borderWidthPx,c:r,colorSource:t,dash:d.borderDash||"solid"},!0)}for(const t of["left","top","right","bottom"]){const i=d.borderSideWidthPx?.[t],a=d.borderSideColorSource?.[t];if(void 0===i&&!a)continue;if(void 0!==i&&i<=0){o(t);continue}const s=r.find(e=>e.side===t),l=i>0?i:s?.w;if(!(l>0))continue;const u=a||s?.colorSource||d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",h=rgbToHex(u);!h||B(u)*c<.04||n({side:t,w:l,c:h,colorSource:u,dash:s?.dash||d.borderDash||"solid"},!0)}return r},f=m(),p=(()=>{let t=null;for(const e of f)(!t||e.w>t.w)&&(t=e);if(d.borderWidthPx>0){const r=d.borderColorSource||t?.colorSource||e.borderColor||"rgba(229, 231, 235, 1)",n=rgbToHex(r);if(n&&B(r)*c>=.04){const e={w:d.borderWidthPx,c:n,colorSource:r,dash:d.borderDash||"solid"};(!t||e.w>t.w)&&(t=e)}}const r=yt(e,c,d);return r&&(!t||r.w>t.w)?{...r,dash:"solid"}:t})(),x=(t,e)=>t&&e&&t.c===e.c&&t.dash===e.dash&&Math.abs(t.w-e.w)<.1&&Math.abs(D(t.colorSource,c)-D(e.colorSource,c))<=1,F=4===f.length&&f.every(t=>x(t,f[0])),w=f.length>0&&!F&&!d.ringWidthPx,E=w?null:p,S=E?E.c:"",y=E?E.w:0,N=Boolean(p),_=Boolean(E),k=Math.min(r.width,r.height),P=Number.parseFloat(e.borderTopLeftRadius||e.borderRadius||"0")||(d.radiusFull?k/2:d.radiusPx||0),O=Boolean(e.boxShadow&&"none"!==e.boxShadow),z=i=>{if(!i)return null;const l=.001;let d=n,u=o,h=a,g=l;return"bottom"===i.side?u=A(r.bottom-i.w/2):"top"===i.side?u=A(r.top+i.w/2):"right"===i.side?(d=M(r.right-i.w/2),h=l,g=s):(d=M(r.left+i.w/2),h=l,g=s),{x:d,y:u,w:Math.max(l,h),h:Math.max(l,g),order:j(t),paintId:G(t),fill:void 0,transparency:100,shapeType:"line",rotate:v(e),border:{color:i.c,widthPt:.75*i.w,transparency:D(i.colorSource,c),dash:i.dash||"solid"}}},U=!g&&!P&&!O,q=(t,e)=>f.map(t=>t.side).sort().join("|")===[t,e].sort().join("|"),$=U&&2===f.length&&void 0!==v(e)&&r.width<=42&&r.height<=42&&(q("top","right")||q("right","bottom")||q("bottom","left")||q("left","top")),X=(()=>{if(!$)return[];const e=f[0];if(!e)return[];const n=r.left+.18*r.width,o=r.top+.18*r.height,i=.58*r.width,a=.32*r.height,s={order:j(t),paintId:G(t),fill:void 0,transparency:100,shapeType:"line",border:{color:e.c,widthPt:.75*e.w,transparency:D(e.colorSource,c),dash:e.dash||"solid"}};return[{...s,x:M(n),y:A(o),w:Math.max(.001,C(i)),h:Math.max(.001,T(a))},{...s,x:M(n),y:A(o+.32*r.height),w:Math.max(.001,C(i)),h:Math.max(.001,T(a)),flipV:!0}]})();if(X.length>0){if(At.length+X.length>i){L.shapeLimitReached=!0;continue}X.forEach(t=>At.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}const V=w?f.map(t=>z(t)).filter(Boolean):[];if(V.length>0&&U){if(At.length+V.length>i){L.shapeLimitReached=!0;continue}V.forEach(t=>At.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}if(!(g&&(g!==I||P||O)||N))continue;const K=Boolean(u(t.innerText||t.textContent)),Q=g&&g!==I&&(P>0||O||K&&r.width>=12&&r.height>=12),Y=t.parentElement?String(window.getComputedStyle(t.parentElement).display||""):"",J=g&&g!==I&&!N&&!P&&!O&&/grid/i.test(Y)&&!u(t.innerText||t.textContent)&&r.width>=8&&r.height>=8,Z=g&&g!==I&&!P&&!O&&!u(t.innerText||t.textContent)&&(r.width>=24&&r.height>=2&&r.height<12||r.height>=24&&r.width>=2&&r.width<12);if(!N&&!Q&&!J&&r.width*r.height<Ct)continue;if((r.width<12||r.height<12)&&!Z)continue;if(At.length+1+V.length>i){L.shapeLimitReached=!0;continue}const tt=Math.max(0,Math.min(P,k/2)),et=tt>0&&k>0?Math.max(0,Math.min(5e4,Math.round(tt/k*1e5))):0,rt=tt>0&&Math.abs(r.width-r.height)<1.5&&tt>=k/2-.5?"ellipse":tt>0?"roundRect":"rect";At.push({x:n,y:o,w:a,h:s,order:j(t),paintId:G(t),fill:g,transparency:g?D(h,c):100,radius:P,radiusAdj:et,shapeType:rt,rotate:v(e),border:_?{color:S,widthPt:.75*y,transparency:D(E.colorSource||e.borderColor,c),dash:E.dash||"solid"}:void 0}),V.length>0&&V.forEach(t=>At.push(t)),t.setAttribute("data-pptx-extracted-shape","1")}const Tt=[],Nt=new Set,Bt=(t,e)=>{Tt.splice(t),Nt.clear(),e.forEach(t=>Nt.add(t))},Dt=new Set,_t=180,vt=t=>{for(const e of Dt)if(e.contains(t))return!0;return!1},Lt=(t,e,n,o,i=!1)=>{if(i)return Math.max(.12,Math.min(r-t,1.1*e));const a=/[\\u3400-\\u9fff\\uf900-\\ufaff]/.test(o)?1.15:1.08,s=Math.max(.08,Math.min(.3,n/72*.2));return Math.max(.12,Math.min(r-t,e*a+s))},kt=(t,e)=>{const r=Math.max(.02,Math.min(.1,e/72*.08));return Math.max(.06,1.08*t+r)},Pt=t=>{if(!t.letterSpacing||"normal"===t.letterSpacing)return 0;const e=Number.parseFloat(t.letterSpacing);return Number.isFinite(e)?e:0},Rt=(t,e)=>{const r=Number.parseFloat(t[e]||"0")||0;return Math.max(0,Math.min(72,r*N))},It=t=>{const e=Number.parseFloat(String(t||"0"));return Number.isFinite(e)?Math.max(0,e):0},Ht=t=>{if(!t||"LI"!==String(t.tagName||"").toUpperCase())return;const e=t.parentElement?.closest?.("ol,ul");if(!e)return;if("none"===String(window.getComputedStyle(t).listStyleType||""))return;let r=0,n=t.parentElement;for(;n&&n!==x;)"OL"!==n.tagName&&"UL"!==n.tagName||(r+=1),n=n.parentElement;const o=Math.max(0,r-1);if("OL"===String(e.tagName||"").toUpperCase()){const r=Number.parseInt(t.getAttribute("value")||"",10);if(Number.isFinite(r)&&r>0)return{type:"number",level:o,startAt:r};const n=Number.parseInt(e.getAttribute("start")||"1",10)||1,i=Array.from(e.children||[]).filter(t=>"LI"===t.tagName).indexOf(t);return{type:"number",level:o,startAt:Math.max(1,n+Math.max(0,i))}}return{type:"bullet",level:o}},Wt=t=>/vertical/i.test(String(t.writingMode||"")),Ot=t=>{const e=_(t);return[e.color,Math.round(100*e.opacity),String(t.fontSize||""),String(t.fontWeight||""),String(t.fontStyle||""),String(t.textDecorationLine||t.textDecoration||"")].join("|")},jt=(t,e)=>{const r=Ot(e),n=Array.from(t.children||[]);for(const t of n){if(!u(t.innerText||t.textContent)||t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;const n=window.getComputedStyle(t),o=t.getBoundingClientRect();if(H(t,n,o)){if(Ot(n)!==r)return!0;if(jt(t,e))return!0}}return!1},zt=(t,e,n,i,a=!1,s={})=>{if(Tt.length>=o)return L.textLimitReached=!0,!1;if(!(t=a?g(t):h(t)))return!1;if(!H(i,n,e))return!1;if(R(i))return!1;if(e.width<2||e.height<2)return!1;const l=Wt(n);if(l){if(!(t=(t=>{const e=u(t).replace(/\\s+/g,"");return e?Array.from(e).join("\\n"):""})(t)))return!1;a=!1}const c=Ht(i),m=s.useElementInsets&&!l?((t,e)=>{const r=It(t.paddingLeft)+It(t.borderLeftWidth),n=It(t.paddingRight)+It(t.borderRightWidth),o=It(t.paddingTop)+It(t.borderTopWidth),i=It(t.paddingBottom)+It(t.borderBottomWidth),a=Math.max(0,.45*e.width),s=Math.max(0,.45*e.height);return{paddingLeft:C(Math.min(r,a)),paddingRight:C(Math.min(n,a)),paddingTop:T(Math.min(o,s)),paddingBottom:T(Math.min(i,s))}})(n,e):void 0,f=Boolean(m&&(m.paddingLeft||m.paddingRight||m.paddingTop||m.paddingBottom)),p=Array.isArray(s.runs)?s.runs.filter(t=>t&&u(t.text)):void 0;if(a&&!l&&!c&&!f&&!p?.length){const r=((t,e,r)=>{if(!d||!t||e.width<4||e.height<4)return null;if(v(r))return null;const n=Number.parseFloat(r.fontSize||"16")||16,o=((t,e)=>{const r=Number.parseFloat(t.lineHeight||"");return Number.isFinite(r)&&r>0?r:1.18*e})(r,n);try{const i=d.prepareWithSegments(t,((t,e)=>{const r=Number.parseInt(t.fontWeight||"400",10)||400,n="italic"===t.fontStyle||"oblique"===t.fontStyle?"italic":"",o=String(t.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",i=/^[a-z0-9 -]+$/i.test(o)?o:\'"\'+o.replace(/"/g,"")+\'"\';return[n,String(r),e.toFixed(2)+"px",i].filter(Boolean).join(" ")})(r,n),{whiteSpace:"pre-wrap",letterSpacing:Pt(r)}),a=d.layoutWithLines(i,Math.max(1,e.width),o);return a?.lines?.length?{lineHeightPx:o,lines:a.lines.map((t,n)=>{const i=u(String(t.text||""));if(!i)return null;const a=Math.max(1,Math.min(e.width,Number(t.width)||e.width));let s=e.left;return"center"===r.textAlign?s+=Math.max(0,(e.width-a)/2):"right"!==r.textAlign&&"end"!==r.textAlign||(s+=Math.max(0,e.width-a)),{text:i,rect:{left:s,top:e.top+n*o,right:s+a,bottom:e.top+(n+1)*o,width:a,height:o}}}).filter(Boolean)}:null}catch(t){return null}})(t,e,n);if(r&&r.lines.length>0){const t=Tt.length,e=new Set(Nt),o=r.lines.every(t=>zt(t.text,t.rect,n,i,!1));return o||Bt(t,e),o}}const b=((t,e)=>[t.toLowerCase(),Math.round(e.left),Math.round(e.top),Math.round(e.width),Math.round(e.height)].join("|"))(t,e);if(Nt.has(b))return!1;Nt.add(b);const x=Number.parseFloat(n.fontSize||"16")||16,F=Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_13__,x*N)),w=ft(i),E=gt(i),S=mt(n),y=w||E||S||400,B=String(n.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",D=M(e.left),k=_(n),P=((t,e,r)=>{if(e)return"center";const n=String(t.textAlign||"");if("center"===n)return"center";if("right"===n||"end"===n)return"right";if(r&&"justify"===n)return"justify";const o=String(t.display||"");if(o.includes("flex")||o.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/row-reverse/i.test(e),o=String(r?t.alignItems||"":t.justifyContent||"");if("center"===o)return"center";if(!r&&("start"===o||"flex-start"===o))return n?"right":"left";if("end"===o||"flex-end"===o||"right"===o)return n?"left":"right"}return"left"})(n,l,a),I=(t=>{const e=String(t.verticalAlign||"");if("middle"===e)return"middle";if("bottom"===e||"text-bottom"===e)return"bottom";const r=String(t.display||"");if(r.includes("flex")||r.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/column-reverse/i.test(e),o=/column/i.test(e)?String(t.justifyContent||""):String(t.alignItems||"");if("center"===o)return"middle";if(r&&("start"===o||"flex-start"===o))return n?"bottom":"top";if("end"===o||"flex-end"===o)return n?"top":"bottom"}return"top"})(n);return Tt.push({text:t,x:D,y:A(e.top),w:l?Math.max(.12,C(e.width)+Math.max(.02,F/72*.08)):f||"left"!==P?Math.max(.12,Math.min(r-D,C(e.width))):Lt(D,C(e.width),F,t,a),h:l?Math.max(.12,T(e.height)):f?Math.max(.08,T(e.height)):a?Math.max(.12,T(e.height)+Math.max(.02,F/72*.08)):"top"!==I?Math.max(.08,T(e.height)):kt(T(e.height),F),fontSize:F,fontFace:B,color:k.color,bold:y>=600||/^H[1-6]$/i.test(i.tagName),italic:"italic"===n.fontStyle||"oblique"===n.fontStyle,underline:String(n.textDecoration||"").includes("underline"),strike:String(n.textDecoration||"").includes("line-through"),align:P,opacity:k.opacity,rotate:v(n),order:j(i),paintId:G(i),paragraphSpacingBefore:Rt(n,"marginTop"),paragraphSpacingAfter:Rt(n,"marginBottom"),verticalAlign:I,...f?m:{},bullet:c,lineSpacing:n.lineHeight&&"normal"!==n.lineHeight?Math.max(1.08*F,(Number.parseFloat(n.lineHeight)||0)*N):l?1.02*F:t.includes("\\n")?1.18*F:void 0,charSpacing:n.letterSpacing&&"normal"!==n.letterSpacing?(Number.parseFloat(n.letterSpacing)||0)*N:void 0,...p?.length?{runs:p}:{},wrap:a}),!0},Ut=(t,e,r)=>{if(!r)return!1;if(t.querySelector?.(".katex"))return!1;if(t.closest?.("[data-pptx-formula-block]"))return!1;if((t=>Boolean(t.querySelector(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,div,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,.katex\')))(t))return!1;if(["SCRIPT","STYLE","NOSCRIPT","SVG","CANVAS","VIDEO","IFRAME","MATH"].includes(t.tagName))return!1;if((t=>!!t.closest?.(\'[data-pptx-dom-table="1"]\')&&Array.from(t.querySelectorAll("*")).some(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();if(!H(t,e,r))return!1;const n=Boolean(rgbToHex(e.backgroundColor)),o=["Top","Right","Bottom","Left"].some(t=>(Number.parseFloat(e["border"+t+"Width"]||"0")||0)>0&&"none"!==e["border"+t+"Style"]);return n||o}))(t))return!1;if(((t,e)=>!!/grid/i.test(String(e.display||""))&&Array.from(t.children||[]).filter(t=>{if(t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return!1;if(!u(t.innerText||t.textContent))return!1;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();return H(t,e,r)}).length>=2)(t,e))return!1;const n=t.tagName;if(/^H[1-6]$/.test(n)||["P","LI","BLOCKQUOTE","TD","TH","FIGCAPTION"].includes(n))return!0;if(jt(t,e))return!1;if(t.matches(\'[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title\'))return!0;if(!["block","flex","grid","table-cell","list-item"].includes(e.display)&&!["absolute","fixed"].includes(e.position)||r.length<6||r.length>180)return!1;const o=Array.from(t.children);if(o.length>=2){let t=0,e=0;for(const r of o){if(r.closest("script, style, noscript"))continue;const n=window.getComputedStyle(r);if("none"===n.display||"hidden"===n.visibility||Number(n.opacity||"1")<.04)continue;e++;const o=rgbToHex(n.backgroundColor);o&&o!==I&&t++}if(e>=2&&t===e)return!1}return!0},qt=(t,e,r)=>{if(Tt.length>=o)return;if(t.nodeType===Node.TEXT_NODE)return void((t,e,r)=>{if(Tt.length>=o)return;if(r&&vt(r))return;if(r&&r.closest?.(".katex, .katex-mathml, [data-pptx-formula-block]"))return;if(r&&b(r))return;const n=h(t.textContent);if(!n)return;const i=document.createRange();i.selectNode(t);const a=i.getBoundingClientRect(),s=Array.from(i.getClientRects());i.detach();const l=Number.parseFloat(e.fontSize||"16")||16;if(s.length>1||a.height>1.7*l){const o=(t=>{const e=String(t.textContent||"");if(e.length>_t)return[];const r=[];let n=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(!i)continue;const a=document.createRange();a.setStart(t,o),a.setEnd(t,o+1);const s=a.getBoundingClientRect();if(a.detach(),s.width<.5||s.height<.5){n&&/\\s/.test(i)&&(n.text+=i);continue}let l=r.find(t=>Math.abs(t.top-s.top)<Math.max(3,.3*s.height));l||(l={top:s.top,text:"",left:s.left,right:s.right,bottom:s.bottom},r.push(l)),l.text+=i,l.left=Math.min(l.left,s.left),l.right=Math.max(l.right,s.right),l.bottom=Math.max(l.bottom,s.bottom),n=l}return r.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>({text:u(t.text),rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top}})).filter(t=>t.text)})(t);return o.length>1?void o.forEach(t=>zt(t.text,t.rect,e,r,!1)):void zt(n,a,e,r,!0)}zt(n,a,e,r,!1)})(t,e,r);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(Dt.has(n))return;if(n.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;if(b(n))return;const i=window.getComputedStyle(n),a=n.getBoundingClientRect();if(!H(n,i,a))return;const s=!["block","flex","grid","table","list-item"].includes(i.display)&&!["absolute","fixed","sticky"].includes(i.position)||(t=>["SPAN","B","STRONG","I","EM","U","FONT","SUB","SUP","A","SMALL","BIG","MARK"].includes(t.tagName))(n)?i||e:i;n.childNodes.forEach(t=>qt(t,s,n))};(()=>{const t=Array.from(x.querySelectorAll(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,div\'));for(const e of t){if(Tt.length>=o){L.textLimitReached=!0;break}if(e.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;if(b(e))continue;if(vt(e))continue;const t=window.getComputedStyle(e),r=e.getBoundingClientRect(),n=g(e.innerText||e.textContent);if(!H(e,t,r))continue;if(!Ut(e,t,n))continue;const i=Number.parseFloat(t.fontSize||"16")||16,a=r.height<=1.55*i,s=i>=28||/^H[1-6]$/.test(e.tagName),l=Ft(e,t),c=l?.length?Et(e,t):[],d=Tt.length,u=new Set(Nt);let h=!1;h=c.length>1&&!Ht(e)?c.every(r=>zt(r.text,r.rect,t,e,!1,{runs:r.runs})):zt(n,r,t,e,!(a&&s),{useElementInsets:!0,runs:l}),h?(Dt.add(e),e.setAttribute("data-pptx-extracted-text","1")):Bt(d,u)}})(),x.childNodes.forEach(t=>{const e=window.getComputedStyle(x);qt(t,e,x)});const $t=t=>/^data:image\\/(?:png|jpeg|jpg|gif);base64,/i.test(String(t||"")),Xt=async(t,e,r)=>t?await new Promise(n=>{const o=t instanceof HTMLImageElement?t:new Image;let i="";const a=()=>{i&&URL.revokeObjectURL(i)},s=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,s=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=document.createElement("canvas");l.width=Math.max(1,Math.min(4096,Math.round(t*s))),l.height=Math.max(1,Math.min(4096,Math.round(i*s)));const c=l.getContext("2d");if(!c)return a(),void n("");c.clearRect(0,0,l.width,l.height),c.drawImage(o,0,0,l.width,l.height),a(),n(l.toDataURL("image/png"))}catch(t){a(),n("")}};if(t instanceof HTMLImageElement)return t.complete&&(t.naturalWidth||t.width)?void s():(t.addEventListener("load",s,{once:!0}),void t.addEventListener("error",()=>n(""),{once:!0}));o.onload=s,o.onerror=()=>{a(),n("")},t instanceof Blob?(i=URL.createObjectURL(t),o.src=i):(o.crossOrigin="anonymous",o.src=String(t))}):"",Vt=async(t,e,r)=>{const n=String(t||"").trim();if(!n)return"";if($t(n))return n;if(/^data:image\\//i.test(n))return await Xt(n,e,r);try{return await(async(t,e,r)=>{try{const n=await fetch(t);if(!n.ok)return"";const o=await n.blob(),i=String(o.type||"").toLowerCase();return/^image\\/(?:png|jpeg|jpg|gif)$/.test(i)?await(async t=>await new Promise(e=>{const r=new FileReader;r.onloadend=()=>e(String(r.result||"")),r.onerror=()=>e(""),r.readAsDataURL(t)}))(o):await Xt(o,e,r)}catch{return""}})(new URL(n,document.baseURI).toString(),e,r)}catch{return""}},Gt=t=>{try{return t.width&&t.height?t.toDataURL("image/png"):""}catch{return""}},Kt=async(t,e,r)=>{if(!t.currentSrc&&!t.src)return"";try{const n=t.currentSrc||t.src;return $t(n)?n:await Xt(t,e,r)||await Vt(n,e,r)}catch{return await Vt(t.currentSrc||t.src,e,r)}},Qt=async(t,e,r)=>t?await new Promise(n=>{const o=new Image;o.onload=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,a=Math.max(1,Math.min(2,window.devicePixelRatio||1)),s=document.createElement("canvas");s.width=Math.max(1,Math.min(4096,Math.round(t*a))),s.height=Math.max(1,Math.min(4096,Math.round(i*a)));const l=s.getContext("2d");if(!l)return void n("");l.clearRect(0,0,s.width,s.height),l.drawImage(o,0,0,s.width,s.height),n(s.toDataURL("image/png"))}catch(t){n("")}},o.onerror=()=>n(""),o.src=t}):"",Yt=async(t,e,r)=>$t(t)?l<=128||t.length<=l?t:await new Promise(n=>{const o=new Image;o.onload=()=>{try{const i=o.naturalWidth||o.width||Number(e)||1,a=o.naturalHeight||o.height||Number(r)||1,s=Math.min(1,.9*Math.sqrt(l/t.length)),c=[s,.72*s,.5*s].filter((t,e,r)=>t>.08&&r.indexOf(t)===e);for(const t of c){const e=document.createElement("canvas");e.width=Math.max(1,Math.min(4096,Math.round(i*t))),e.height=Math.max(1,Math.min(4096,Math.round(a*t)));const r=e.getContext("2d");if(!r)continue;r.clearRect(0,0,e.width,e.height),r.drawImage(o,0,0,e.width,e.height);const s=e.toDataURL("image/png");if(s.length<=l)return void n(s);const c=e.toDataURL("image/jpeg",.9);if(c.length<=l)return void n(c)}}catch(t){}n("")},o.onerror=()=>n(""),o.src=t}):"",Jt=async(t,e,r)=>{try{const n=t.cloneNode(!0),o=(t,e)=>{if(!t||!e||t.nodeType!==Node.ELEMENT_NODE||e.nodeType!==Node.ELEMENT_NODE)return;const r=window.getComputedStyle(t),n=r.color||"";!n||e.getAttribute("color")&&"currentColor"!==e.getAttribute("color")||e.setAttribute("color",n),["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","letter-spacing","text-anchor","dominant-baseline","visibility","display"].forEach(t=>{const o=e.getAttribute(t),i=r.getPropertyValue(t)||r[t]||"";o&&"currentColor"!==o||!i||"none"===i?"currentColor"===o&&n&&e.setAttribute(t,n):e.setAttribute(t,i)});const i=Array.from(t.children||[]);Array.from(e.children||[]).forEach((t,e)=>o(i[e],t))};if(o(t,n),n.getAttribute("xmlns")||n.setAttribute("xmlns","http://www.w3.org/2000/svg"),!n.getAttribute("viewBox")&&t.getBBox)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&n.setAttribute("viewBox",[e.x,e.y,e.width,e.height].join(" "))}catch(t){}const i=(new XMLSerializer).serializeToString(n),a=btoa(unescape(encodeURIComponent(i)));return await Qt("data:image/svg+xml;base64,"+a,e,r)}catch{return""}};await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));const Zt=[],te=Array.from(x.querySelectorAll("img,canvas,svg"));for(const t of te){if(Zt.length>=a){L.imageLimitReached=!0;break}const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:i,h:s}=W(t);if(!H(t,e,r))continue;if(R(t))continue;if(/blur/i.test(e.filter||""))continue;if(Number(e.opacity||"1")<.15)continue;const l=String(t.tagName||"").toUpperCase(),c="CANVAS"===l?Gt(t):"SVG"===l?await Jt(t,r.width,r.height):await Kt(t,r.width,r.height),d=await Yt(c,r.width,r.height);$t(d)?(Zt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:j(t),paintId:G(t),opacity:$(t),alt:t.getAttribute("alt")||"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")):L.imageRasterFallbackCount+=1}const ee=new Set(Zt.map(t=>t.dataUri)),re=t=>{const e=String(t||"");if(!e||"none"===e)return[];const r=[],n=/url\\((?:["\']?)(.*?)(?:["\']?)\\)/gi;let o;for(;o=n.exec(e);){const t=String(o[1]||"").trim();t&&!t.startsWith("data:font/")&&r.push(t)}return r},ne=[];for(const t of x.querySelectorAll("*")){if(ne.length>=a){L.imageLimitReached=!0;break}const e=window.getComputedStyle(t),r=e.backgroundImage||"";0!==re(r).length&&1===re(r).length&&!/gradient\\(|image-set\\(|cross-fade\\(/i.test(r)&&["auto","auto auto","100% 100%"].includes(String(e.backgroundSize||"").trim())&&/^(?:0(?:px|%)?\\s+)?0(?:px|%)?$/i.test(String(e.backgroundPosition||"").trim())&&"no-repeat"===String(e.backgroundRepeat||"").trim()&&ne.push({el:t,style:e})}for(const{el:t,style:e}of ne){if(Zt.length>=a){L.imageLimitReached=!0;break}const{rect:r,x:n,y:o,w:i,h:s}=W(t);if(!H(t,e,r))continue;if(R(t))continue;const l=re(e.backgroundImage||"")[0];if(!l)continue;const c=/^data:image\\/svg\\+xml;base64,/i.test(l)?await Qt(l,r.width,r.height):await Vt(l,r.width,r.height),d=await Yt(c,r.width,r.height);$t(d)?ee.has(d)||(ee.add(d),Zt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:j(t),paintId:G(t),opacity:$(t),alt:"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")):L.imageRasterFallbackCount+=1}return(t=>{const e=(()=>{const t=Array.from(X.entries()).filter(([,t])=>t&&t.isConnected);if(0===t.length)return new Map;const e=t.map(([t])=>t),r=new Map(t.map(([t,e])=>[t,q(e)])),n=(t,e)=>((t,e)=>{const r=t?.key||[],n=e?.key||[],o=Math.max(r.length,n.length);for(let t=0;t<o;t+=1){const e=r[t]||{z:0,order:0},o=n[t]||{z:0,order:0};if(e.z!==o.z)return e.z-o.z;if(e.order!==o.order)return e.order-o.order}return(t?.order||0)-(e?.order||0)})(r.get(t),r.get(e));if(!document.elementsFromPoint)return(()=>{const t=new Map;let r=1;return e.slice().sort(n).forEach(e=>{t.set(e,r),r+=1}),t})();const o=new Map(e.map(t=>[t,new Set])),i=new Map(e.map(t=>[t,0])),a=(t,e)=>{if(!(t&&e&&t!==e&&o.has(t)&&i.has(e)))return;const r=o.get(t);r.has(e)||(r.add(e),i.set(e,(i.get(e)||0)+1))},s=t=>{let e=t;for(;e&&e!==document&&e!==document.documentElement;){const t=e.getAttribute?.("data-pptx-paint-id")||"";if(t&&X.has(t))return t;e=e.parentElement}return""},l=(t,e)=>{const r=new Set,n=[];for(const o of document.elementsFromPoint(t,e)){const t=s(o);t&&!r.has(t)&&(r.add(t),n.push(t))}return n},c=t=>{const e=Math.max(0,t.left),r=Math.max(0,t.top),n=Math.min(window.innerWidth,t.right),o=Math.min(window.innerHeight,t.bottom);if(n<=e||o<=r)return[];const i=e+.25*(n-e),a=e+.5*(n-e),s=e+.75*(n-e),l=r+.25*(o-r),c=r+.5*(o-r),d=r+.75*(o-r);return[[a,c],[i,l],[s,l],[i,d],[s,d],[a,l],[a,d],[i,c],[s,c]]},d=document.createElement("style");d.id="ohmyppt-paint-order-pointer-events",d.textContent="[data-pptx-paint-id] { pointer-events: auto !important; }",document.head.appendChild(d);try{for(const[,e]of t){const t=e.getBoundingClientRect();for(const[e,r]of c(t)){const t=l(e,r);for(let e=0;e<t.length;e+=1)for(let r=e+1;r<t.length;r+=1)a(t[r],t[e])}}}finally{d.remove()}const u=e.filter(t=>0===(i.get(t)||0)).sort(n),h=new Map;let g=1;for(;u.length>0;){const t=u.shift();if(t&&!h.has(t)){h.set(t,g),g+=1;for(const e of o.get(t)||[])i.set(e,Math.max(0,(i.get(e)||0)-1)),0===(i.get(e)||0)&&(u.push(e),u.sort(n))}}return e.filter(t=>!h.has(t)).sort(n).forEach(t=>{h.set(t,g),g+=1}),h})();t.forEach(t=>{t&&t.paintId&&(e.has(t.paintId)&&(t.order=e.get(t.paintId)),delete t.paintId)})})([...At,...Tt,...Zt]),L.unsupportedTransformCount=k.size,{backgroundColor:I,shapes:At,texts:Tt,images:Zt,tables:f,extractionReport:L}})()'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(t.pageHeightPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_4__",String(JSON.stringify(o))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_5__",String(JSON.stringify(i))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_6__",String(JSON.stringify(a))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_7__",String(JSON.stringify(l))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_8__",String(JSON.stringify(Math.ceil(4*s/3)+128))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_9__",String(JSON.stringify(n))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_10__",String("\nconst rgbToHex = (value) => {\n const source = String(value || '').trim();\n if (!source || source === 'transparent') return '';\n if (source.startsWith('#')) {\n const raw = source.slice(1).toUpperCase();\n return raw.length === 3 ? raw.split('').map((part) => part + part).join('') : raw;\n }\n const match = source.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);\n if (!match) return '';\n const alpha = match[4] === undefined\n ? 1\n : String(match[4]).endsWith('%')\n ? Number.parseFloat(match[4]) / 100\n : Number(match[4]);\n if (alpha <= 0.02) return '';\n return [match[1], match[2], match[3]]\n .map((part) => Math.max(0, Math.min(255, Math.round(Number(part) || 0))).toString(16).padStart(2, '0'))\n .join('')\n .toUpperCase();\n};\n")).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_11__",String(c)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_12__",String(144)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_13__",String(144))},i=13.333,a=7.5,l=(t,e,r)=>Math.max(e,Math.min(r,t)),s=(t,e="111827")=>{if(!t)return e;const r=t.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(r)?r.split("").map(t=>`${t}${t}`).join(""):/^[0-9A-F]{6}$/.test(r)?r:e},c=t=>{const e=t.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\n")},d=(t,e)=>{const r=(t=>String(t||"").split(",").map(t=>t.trim().replace(/^["']|["']$/g,"")).find(Boolean)||"Aptos")(e);return(t=>/[\u3400-\u9fff\uf900-\ufaff]/.test(t))(t)&&/^(aptos|arial|helvetica|inter|system-ui|-apple-system|sans-serif|serif)$/i.test(r)?"Microsoft YaHei":r},u=t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.text||""));if(!r)return null;const n=Math.max(1,Number(e.rowspan)||1),o=Math.max(1,Number(e.colspan)||1),u=e.border&&"object"==typeof e.border?e.border:null,h=u?s(String(u.color||""),""):"";return{text:r,rowspan:n,colspan:o,x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.1,.05,i),h:l(Number(e.h)||.05,.03,a),fontSize:e.fontSize?l(Number(e.fontSize),6,144):void 0,fontFace:d(r,String(e.fontFace||"")),color:s(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",valign:"middle"===e.valign||"bottom"===e.valign?e.valign:"top",fill:e.fill?s(String(e.fill),""):void 0,fillTransparency:e.fillTransparency?l(Number(e.fillTransparency),0,100):void 0,border:h?{color:h,widthPt:l(Number(u?.widthPt??.75),.1,20),dash:"dash"===u?.dash?"dash":"solid"}:void 0}},h=t=>{const e=t&&"object"==typeof t?t:{},r=Array.isArray(e.rows)?e.rows:[],n=Array.isArray(e.colWidths)?e.colWidths:[],o=Array.isArray(e.rowHeights)?e.rowHeights:[];if(0===r.length)return null;const s=r.map(t=>(Array.isArray(t)?t:[]).map(u).filter(t=>null!==t)).filter(t=>t.length>0);return 0===s.length?null:{x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.1,.1,i),h:l(Number(e.h)||.1,.1,a),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0,colWidths:n.map(t=>Math.max(.05,Number(t)||.05)),rowHeights:o.map(t=>Math.max(.03,Number(t)||.03)),rows:s}},g=t=>{const e=t&&"object"==typeof t?t:{},r=String(e.text||"").replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ")).join("\n");return r.trim()?{text:r,fontSize:Number(e.fontSize)>0?l(Number(e.fontSize),6,144):void 0,fontFace:d(r,String(e.fontFace||"")),color:s(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike)}:null},m=(t,e)=>{const r=t&&"object"==typeof t?t:{},n=Array.isArray(r.texts)?r.texts:[],o=Array.isArray(r.shapes)?r.shapes:[],u=Array.isArray(r.images)?r.images:[],m=Array.isArray(r.tables)?r.tables:[],p=(t=>{if(!t||"object"!=typeof t)return;const e=t;return{textLimitReached:Boolean(e.textLimitReached),shapeLimitReached:Boolean(e.shapeLimitReached),imageLimitReached:Boolean(e.imageLimitReached),unsupportedTransformCount:Math.max(0,Math.floor(Number(e.unsupportedTransformCount)||0)),imageRasterFallbackCount:Math.max(0,Math.floor(Number(e.imageRasterFallbackCount)||0))}})(r.extractionReport),f=n.map(t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.text||"")).slice(0,1e3);if(!r)return null;const n=Array.isArray(e.runs)?e.runs.map(g).filter(t=>null!==t):[],o=e.bullet&&"object"==typeof e.bullet?e.bullet:null,u="bullet"===o?.type||"number"===o?.type?o.type:void 0,h=u&&o?{type:u,level:Number.isFinite(Number(o.level))?l(Number(o.level),0,8):void 0,startAt:Number.isFinite(Number(o.startAt))?l(Number(o.startAt),1,32767):void 0}:void 0;return{text:r,x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.4,.1,i),h:l(Number(e.h)||.2,.08,a),fontSize:l(Number(e.fontSize)||12,6,144),fontFace:d(r,String(e.fontFace||"")),color:s(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",opacity:l(Number(e.opacity??1),0,1),rotate:l(Number(e.rotate??0),-360,360),lineSpacing:Number(e.lineSpacing)>0?l(Number(e.lineSpacing),1,200):void 0,charSpacing:Number.isFinite(Number(e.charSpacing))?l(Number(e.charSpacing),-20,200):void 0,paragraphSpacingBefore:Number(e.paragraphSpacingBefore)>0?l(Number(e.paragraphSpacingBefore),0,72):void 0,paragraphSpacingAfter:Number(e.paragraphSpacingAfter)>0?l(Number(e.paragraphSpacingAfter),0,72):void 0,verticalAlign:"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:"top",paddingLeft:Number(e.paddingLeft)>0?l(Number(e.paddingLeft),0,2):void 0,paddingRight:Number(e.paddingRight)>0?l(Number(e.paddingRight),0,2):void 0,paddingTop:Number(e.paddingTop)>0?l(Number(e.paddingTop),0,1):void 0,paddingBottom:Number(e.paddingBottom)>0?l(Number(e.paddingBottom),0,1):void 0,bullet:h,runs:n.length>0?n:void 0,wrap:Boolean(e.wrap),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),b=o.map(t=>{const e=t&&"object"==typeof t?t:{},r=s(String(e.fill||""),""),n=e.border&&"object"==typeof e.border?e.border:null,o=s(String(n?.color||""),"");if(!r&&!o)return null;const c="ellipse"===e.shapeType||"roundRect"===e.shapeType||"line"===e.shapeType?e.shapeType:"rect",d="line"===c?.001:.05,u="line"===c?.001:.05;return{x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||d,d,i),h:l(Number(e.h)||u,u,a),fill:r,transparency:l(Number(e.transparency??0),0,100),radius:l(Number(e.radius??0),0,100),radiusAdj:l(Number(e.radiusAdj??0),0,5e4),border:o?{color:o,widthPt:l(Number(n?.widthPt??.75),.1,20),transparency:l(Number(n?.transparency??0),0,100),dash:"dash"===n?.dash?"dash":"solid"}:void 0,shapeType:c,rotate:l(Number(e.rotate??0),-360,360),flipV:Boolean(e.flipV),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),x=u.map(t=>{const e=t&&"object"==typeof t?t:{},r=String(e.dataUri||""),n=(t=>{const e=t.match(/^data:(image\/(?:png|jpeg|jpg|gif));base64,/i);return e?"image/jpg"===e[1].toLowerCase()?"image/jpeg":e[1].toLowerCase():""})(r);return!n||(t=>{const e=t.indexOf(",");if(e<0)return 0;const r=t.slice(e+1).replace(/\s/g,"");if(!r)return 0;const n=r.endsWith("==")?2:r.endsWith("=")?1:0;return Math.max(0,Math.floor(3*r.length/4)-n)})(r)>12582912?null:{dataUri:r,mimeType:n,x:l(Number(e.x)||0,0,i),y:l(Number(e.y)||0,0,a),w:l(Number(e.w)||.1,.05,i),h:l(Number(e.h)||.1,.05,a),alt:(o=String(e.alt||""),o.replace(/\s+/g," ").replace(/[\u200b-\u200d\ufeff]/g,"").trim()),rotate:l(Number(e.rotate??0),-360,360),opacity:l(Number(e.opacity??1),0,1),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0};var o}).filter(t=>Boolean(t)),S=m.map(h).filter(t=>null!==t);return{title:e,backgroundColor:s(String(r.backgroundColor||""),"FFFFFF"),backgroundImage:void 0,texts:f,shapes:b,images:x,tables:S.length>0?S:void 0,overlayImages:void 0,extractionReport:p}},p=t=>r(t);export{o as buildHtmlToPptxExtractScript,p as generatePptx,m as normalizeExtractedHtmlToPptxSlide};
|
package/dist/types.d.ts
CHANGED
|
@@ -126,6 +126,17 @@ export interface HtmlToPptxAnimationTrace {
|
|
|
126
126
|
w: number;
|
|
127
127
|
h: number;
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Extraction conditions that preserve the source visual in a caller-provided
|
|
131
|
+
* screenshot fallback instead of producing an unsafe editable approximation.
|
|
132
|
+
*/
|
|
133
|
+
export interface HtmlToPptxExtractionReport {
|
|
134
|
+
textLimitReached: boolean;
|
|
135
|
+
shapeLimitReached: boolean;
|
|
136
|
+
imageLimitReached: boolean;
|
|
137
|
+
unsupportedTransformCount: number;
|
|
138
|
+
imageRasterFallbackCount: number;
|
|
139
|
+
}
|
|
129
140
|
export interface HtmlToPptxSlide {
|
|
130
141
|
title?: string;
|
|
131
142
|
backgroundColor?: string;
|
|
@@ -141,6 +152,8 @@ export interface HtmlToPptxSlide {
|
|
|
141
152
|
/** Native slide transition type, when configured by callers. */
|
|
142
153
|
transitionType?: string;
|
|
143
154
|
transitionDurationMs?: number;
|
|
155
|
+
/** Extraction fallback information for callers that provide a raster base layer. */
|
|
156
|
+
extractionReport?: HtmlToPptxExtractionReport;
|
|
144
157
|
}
|
|
145
158
|
export interface HtmlToPptxEmbeddedFont {
|
|
146
159
|
fontFace: string;
|
|
@@ -171,4 +184,5 @@ export interface HtmlToPptxExtractedSlide {
|
|
|
171
184
|
images: HtmlToPptxImage[];
|
|
172
185
|
tables: HtmlToPptxTable[];
|
|
173
186
|
consumedTableElementIds: string[];
|
|
187
|
+
extractionReport: HtmlToPptxExtractionReport;
|
|
174
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcsin1/html2pptx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Extract editable PowerPoint presentations from HTML pages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -35,6 +35,13 @@
|
|
|
35
35
|
"LICENSE",
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "rollup -c -w",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"build": "rollup -c",
|
|
43
|
+
"prepack": "rollup -c"
|
|
44
|
+
},
|
|
38
45
|
"keywords": [
|
|
39
46
|
"html",
|
|
40
47
|
"pptx",
|
|
@@ -58,11 +65,5 @@
|
|
|
58
65
|
"tslib": "^2.8.1",
|
|
59
66
|
"typescript": "^5.9.3",
|
|
60
67
|
"vitest": "^4.1.6"
|
|
61
|
-
},
|
|
62
|
-
"scripts": {
|
|
63
|
-
"dev": "rollup -c -w",
|
|
64
|
-
"typecheck": "tsc --noEmit",
|
|
65
|
-
"test": "vitest run",
|
|
66
|
-
"build": "rollup -c"
|
|
67
68
|
}
|
|
68
|
-
}
|
|
69
|
+
}
|