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