diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin.rs b/src/crates/contracts/product-domains/src/miniapp/builtin.rs index d8e779ba5f..c7a93f0269 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin.rs +++ b/src/crates/contracts/product-domains/src/miniapp/builtin.rs @@ -161,7 +161,7 @@ pub const BUILTIN_APPS: &[BuiltinMiniAppBundle] = &[ }, BuiltinMiniAppBundle { id: "builtin-ppt-live", - version: 193, + version: 194, meta_json: include_str!("builtin/assets/ppt-live/meta.json"), html: include_str!("builtin/assets/ppt-live/index.html"), css: include_str!("builtin/assets/ppt-live/style.css"), diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json index eef9a224e7..30827cf066 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json @@ -1,5 +1,5 @@ { "schemaVersion": 1, "id": "builtin-ppt-live", - "version": 193 + "version": 194 } diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js index acd5b8267f..0c593f7f92 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js @@ -123,7 +123,7 @@ ${n.documentElement.outerHTML}`;return e._pptLiveSourceHtml=a,a}function Nr(e){l box-shadow: none !important; } `,(E.head||E.documentElement).appendChild(T)}s(),u(t),d(t),A(t),g(t),y(t),r?(p(t),v(t),P(t),R(t),P(t),F(t),t.querySelectorAll("[class]").forEach(E=>E.removeAttribute("class")),x(t),b(t),v(t),P(t),R(t)):F(t)}function _c(e=document){let r=e.defaultView||window,t=e.body,n=r.getComputedStyle(t),i={width:parseFloat(n.width),height:parseFloat(n.height),scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight},a=[],o=Math.max(0,i.scrollWidth-i.width-1),l=Math.max(0,i.scrollHeight-i.height-1),c=o*.75,s=l*.75;if(c>0||s>0){let u=[];c>0&&u.push(`${c.toFixed(1)}pt horizontally`),s>0&&u.push(`${s.toFixed(1)}pt vertically`);let d=s>0?' (Remember: leave 0.5" margin at bottom of slide)':"";a.push(`HTML content overflows body by ${u.join(" and ")}${d}`)}return{...i,errors:a}}function Uc(e=document){let r=e,t=r.defaultView||window,n=.75,i=96,a=["impact"],o=h=>{if(!h)return!1;let U=h.toLowerCase().replace(/['"]/g,"").split(",")[0].trim();return a.includes(U)},l=h=>h/i,c=h=>parseFloat(h)*n,s=h=>{if(h==="rgba(0, 0, 0, 0)"||h==="transparent")return"FFFFFF";let U=h.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return U?U.slice(1).map(z=>parseInt(z).toString(16).padStart(2,"0")).join(""):"FFFFFF"},u=h=>{let U=h.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(!U||!U[4])return null;let z=parseFloat(U[4]);return Math.round((1-z)*100)},d=h=>{let U=String(h||"").match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);return U?{r:parseInt(U[1],10),g:parseInt(U[2],10),b:parseInt(U[3],10),a:U[4]!=null?parseFloat(U[4]):1}:null},A=h=>{let U=String(h||"0E0E12").replace("#","");return{r:parseInt(U.slice(0,2),16),g:parseInt(U.slice(2,4),16),b:parseInt(U.slice(4,6),16)}},f=(h,U="0E0E12")=>{let z=d(h);if(!z)return{fill:s(h),transparency:u(h)};if(z.a>=.98)return{fill:s(h),transparency:null};let k=A(U),w=Math.round(k.r*(1-z.a)+z.r*z.a),D=Math.round(k.g*(1-z.a)+z.g*z.a),K=Math.round(k.b*(1-z.a)+z.b*z.a);return{fill:[w,D,K].map(Y=>Y.toString(16).padStart(2,"0")).join("").toUpperCase(),transparency:null}},p=(h,U)=>U==="uppercase"?h.toUpperCase():U==="lowercase"?h.toLowerCase():U==="capitalize"?h.replace(/\b\w/g,z=>z.toUpperCase()):h,g=h=>h==="vertical-rl"||h==="vertical-lr"?"eaVert":null,y=h=>{let U=0;if(h&&h!=="none"){let z=h.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/);if(z)U+=parseFloat(z[1]);else{let k=h.match(/matrix\(([^)]+)\)/);if(k){let w=k[1].split(",").map(parseFloat),D=Math.atan2(w[1],w[0])*(180/Math.PI);U+=Math.round(D)}}}return U=U%360,U<0&&(U+=360),U===0?null:U},v=(h,U,z)=>{if(z===null)return{x:U.left,y:U.top,w:U.width,h:U.height};if(z===90||z===270){let K=U.left+U.width/2,Y=U.top+U.height/2;return{x:K-U.height/2,y:Y-U.width/2,w:U.height,h:U.width}}let w=U.left+U.width/2,D=U.top+U.height/2;return{x:w-h.offsetWidth/2,y:D-h.offsetHeight/2,w:h.offsetWidth,h:h.offsetHeight}},b=h=>{if(!h||h==="none"||h.match(/inset/))return null;let z=h.match(/rgba?\([^)]+\)/),k=h.match(/([-\d.]+)(px|pt)/g);if(!k||k.length<2)return null;let w=parseFloat(k[0]),D=parseFloat(k[1]),K=k.length>2?parseFloat(k[2]):0,Y=0;(w!==0||D!==0)&&(Y=Math.atan2(D,w)*(180/Math.PI),Y<0&&(Y+=360));let M=Math.sqrt(w*w+D*D)*n,J=.5;if(z){let ae=z[0].match(/[\d.]+\)$/);ae&&(J=parseFloat(ae[0].replace(")","")))}return{type:"outer",angle:Math.round(Y),blur:K*.75,color:z?s(z[0]):"000000",offset:M,opacity:J}},x=(h,U={},z=[],k=w=>w)=>{let w=!1;return h.childNodes.forEach(D=>{let K=k,Y=D.nodeType===Node.TEXT_NODE||D.tagName==="BR";if(Y){let M=D.tagName==="BR"?` -`:K(D.textContent.replace(/\s+/g," ")),J=z[z.length-1];w&&J?J.text+=M:z.push({text:M,options:{...U}})}else if(D.nodeType===Node.ELEMENT_NODE&&D.textContent.trim()){let M={...U},J=t.getComputedStyle(D);if(["SPAN","B","STRONG","I","EM","U","SMALL","LABEL","A","CODE","MARK","SUB","SUP"].includes(D.tagName)){if((J.fontWeight==="bold"||parseInt(J.fontWeight)>=600)&&!o(J.fontFamily)&&(M.bold=!0),J.fontStyle==="italic"&&(M.italic=!0),J.textDecoration&&J.textDecoration.includes("underline")&&(M.underline=!0),J.color&&J.color!=="rgb(0, 0, 0)"){M.color=s(J.color);let ee=u(J.color);ee!==null&&(M.transparency=ee)}if(J.fontSize&&(M.fontSize=c(J.fontSize)),J.textTransform&&J.textTransform!=="none"){let ee=J.textTransform;K=pe=>p(pe,ee)}J.marginLeft&&parseFloat(J.marginLeft)>0&&ne.push(`Inline element <${D.tagName.toLowerCase()}> has margin-left which is not supported in PowerPoint. Remove margin from inline elements.`),J.marginRight&&parseFloat(J.marginRight)>0&&ne.push(`Inline element <${D.tagName.toLowerCase()}> has margin-right which is not supported in PowerPoint. Remove margin from inline elements.`),J.marginTop&&parseFloat(J.marginTop)>0&&ne.push(`Inline element <${D.tagName.toLowerCase()}> has margin-top which is not supported in PowerPoint. Remove margin from inline elements.`),J.marginBottom&&parseFloat(J.marginBottom)>0&&ne.push(`Inline element <${D.tagName.toLowerCase()}> has margin-bottom which is not supported in PowerPoint. Remove margin from inline elements.`),x(D,M,z,K)}}w=Y}),z.length>0&&(z[0].text=z[0].text.replace(/^\s+/,""),z[z.length-1].text=z[z.length-1].text.replace(/\s+$/,"")),z.filter(D=>D.text.length>0)},P=h=>!h||h==="transparent"||h==="rgba(0, 0, 0, 0)",F=h=>{let U=[h,r.documentElement,h?.querySelector?.(":scope > section, :scope > div, :scope > main")].filter(Boolean);for(let z of U){let k=t.getComputedStyle(z),w=k.backgroundImage||"";if(w.includes("linear-gradient")||w.includes("radial-gradient"))return{gradient:!0};if(w&&w!=="none"){let K=w.match(/url\(["']?([^"')]+)["']?\)/);if(K)return{type:"image",path:K[1]}}let D=k.backgroundColor;if(!P(D))return{type:"color",value:s(D)}}return{type:"color",value:"FFFFFF"}},R=r.body,E=R.getBoundingClientRect(),B=h=>({left:h.left-E.left,top:h.top-E.top,width:h.width,height:h.height}),T=h=>B(h.getBoundingClientRect()),W=h=>{try{let U=r.createRange();U.selectNodeContents(h);let z=B(U.getBoundingClientRect());if(U.detach?.(),z.width>0&&z.height>0)return z}catch{}return T(h)},H=(h,U)=>{let z=d(h.color);return!z||z.a>=.2||!U.textContent.trim()?s(h.color):"E8E8E8"},C=(h,U,z)=>{let{x:k,y:w,w:D,h:K}=v(h,U,z),Y=E.width,M=E.height,J=Math.max(8,Y-k-4),ae=h.scrollHeight||0,ee=/^H[1-6]$/.test(h.tagName),pe=ee?Math.min(Math.max(8,D*.05),32):Math.min(Math.max(2,D*.02),12);ee?D=Math.max(D+pe,Y*.92-k):D=Math.min(D+pe,J),D=Math.min(D,J);let Ee=Math.max(6,K*(ee?.18:.12)),ve=Math.max(8,M-w-4);return ae>K+2?K=Math.min(ae+Ee,ve):K=Math.min(K+Ee,ve),{x:k,y:w,w:D,h:K}},I=h=>{let U=t.getComputedStyle(h).zIndex;if(!U||U==="auto")return 0;let z=parseInt(U,10);return Number.isFinite(z)?z:0},m=(h,U)=>{U&&(h.zIndex=I(U)),ue.push(h)},N=(h,U,z)=>{let w=t.getComputedStyle(h).listStyleColor;if(w&&w!=="rgba(0, 0, 0, 0)"){let D=s(w);if(D&&D!==z)return D}for(let D of U)try{let K=t.getComputedStyle(D,"::marker");if(K?.color){let Y=s(K.color);if(Y&&Y!==z)return Y}}catch{}return null},ne=[],q=F(R);q.gradient&&ne.push("CSS gradients are not supported. Use Sharp to rasterize gradients as PNG images first, then reference with background-image: url('gradient.png')");let se=q.gradient?{type:"color",value:"FFFFFF"}:{type:q.type,...q.path?{path:q.path}:{value:q.value}},Z=se.value||"0E0E12",ue=[],j=[],_=["P","H1","H2","H3","H4","H5","H6","UL","OL","LI"],fe=new Set(["SPAN","SMALL","LABEL","A","CODE","BUTTON","B","STRONG","I","EM","U","MARK","SUB","SUP"]),ce=new Set(["TD","TH"]),ie=new Set(["DIV","SECTION","ARTICLE","ASIDE",...ce]),be=new Set,Re=h=>{let U=h.parentElement;for(;U&&U!==R;){if(_.includes(U.tagName)||U.dataset?.pptxMerge==="true")return!0;U=U.parentElement}return!1},ke=h=>Array.from(h.childNodes).some(U=>U.nodeType===Node.TEXT_NODE&&U.textContent.replace(/\s+/g," ").trim()),xe=h=>!h.textContent.replace(/\s+/g," ").trim()||Re(h)?!1:fe.has(h.tagName)?!0:!ie.has(h.tagName)||!ke(h)&&!ce.has(h.tagName)||h.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,li")?!1:!Array.from(h.children).some(U=>ie.has(U.tagName)),Oe=h=>{if(h.textAlign&&!["start","auto"].includes(h.textAlign))return h.textAlign==="end"?"right":h.textAlign;if(h.display.includes("flex")){if(h.justifyContent==="center")return"center";if(h.justifyContent==="flex-end"||h.justifyContent==="end")return"right"}if(h.display.includes("grid")){if((h.justifyItems||h.placeItems||"").includes("center"))return"center";if((h.justifyItems||h.placeItems||"").includes("end"))return"right"}return"left"},we=(h,U)=>{if(h.display==="table-cell"){if(h.verticalAlign==="middle")return"mid";if(h.verticalAlign==="bottom")return"bottom"}if(!h.display.includes("flex")&&!h.display.includes("grid"))return parseFloat(h.lineHeight||"0")>=U.height*.75?"mid":"top";let z=h.alignItems||h.placeItems||"";return z.includes("center")?"mid":z.includes("end")?"bottom":"top"},tt=(h,U=h.tagName.toLowerCase(),z=!1,k=null)=>{let w=k||T(h),D=h.textContent.replace(/\s+/g," ").trim();if(w.width===0||w.height===0||!D)return!1;if(U!=="text"&&h.tagName!=="LI"&&/^[•\-\*▪▸○●◆◇■□]\s/.test(D.trimStart()))return ne.push(`Text element <${h.tagName.toLowerCase()}> starts with bullet symbol "${D.substring(0,20)}...". Use
/