import{SHAPE_ID as t}from"../constants.js";let e=(e,l,i)=>{if(!l||!e)return e?.shapeStyle||{};let s=e.shapeStyle||{};return["desktop","mobile","tablet"].forEach(a=>{let d=l[a]?.placement||"";if(!/\bright\b|\bbottom\b/.test(d))return;let n=`--t${"desktop"===a?"":`-${a}`}`,b="";[t.RIBBON,t.TRIANGLE].includes(e.id)&&!i&&(b=o(d)),r(e.id,d)&&!i&&(b="rotate(180deg)"),s={...s,...b?{[n]:b}:{}}}),s},o=t=>{switch(!0){case"bottom-left"===t:return"rotate(-90deg)";case t.includes("bottom"):return"rotate(180deg)";case t.includes("right"):return"rotate(90deg)";default:return""}},r=(e,o)=>[t.RIBBON_2,t.RIBBON_3].includes(e)&&o.includes("right")||t.RIBBON_3===e&&"bottom"===o,l=(e,o,l)=>{if(!o||!e)return e?.textStyle||{};let s=e.textStyle||{};return["desktop","mobile","tablet"].forEach(a=>{let d=o[a]?.placement||"";if(!/\bright\b|\bbottom\b/.test(d)||l)return;let n="",b=`--t${"desktop"===a?"":`-${a}`}`;e.id!==t.RIBBON||l?e.id!==t.TRIANGLE||l?e.id===t.VERTICAL_RECTANGLE?n=["bottom","bottom-left"].includes(d)?"rotate(-180deg)":"rotate(0)":r(e.id,d)&&!l&&(n="rotate(180deg)"):n=`translate(-20%, -75%) ${i(d)}`:n=`translate(-10%, -30%) ${i(d)}`,s={...s,...n?{[b]:n}:{}}}),s},i=t=>!0===t.includes("bottom")?"rotate(135deg)":"rotate(-45deg)";export{e as composeShapeStyleByPosition,l as composeTextStyleByPosition};
