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