/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/mjml-column@4.18.0/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_callSuper2=_interopRequireDefault(require("@babel/runtime/helpers/callSuper")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_mjmlCore=require("mjml-core"),_widthParser=_interopRequireDefault(require("mjml-core/lib/helpers/widthParser"));let MjColumn=exports.default=function(t){function e(){return(0,_classCallCheck2.default)(this,e),(0,_callSuper2.default)(this,e,arguments)}return(0,_inherits2.default)(e,t),(0,_createClass2.default)(e,[{key:"getChildContext",value:function(){const{containerWidth:t}=this.context,{nonRawSiblings:e}=this.props,{borders:r,paddings:i}=this.getBoxWidths(),n=i+r+(this.getShorthandBorderValue("left","inner-border")+this.getShorthandBorderValue("right","inner-border"));let o=this.getAttribute("width")||parseFloat(t)/e+"px";const{unit:d,parsedWidth:s}=(0,_widthParser.default)(o,{parseFloatToInt:!1});return o="%"===d?parseFloat(t)*s/100-n+"px":s-n+"px",{...this.context,containerWidth:o}}},{key:"getStyles",value:function(){const t=this.hasBorderRadius(),e=this.hasInnerBorderRadius(),r={"background-color":this.getAttribute("background-color"),border:this.getAttribute("border"),"border-bottom":this.getAttribute("border-bottom"),"border-left":this.getAttribute("border-left"),"border-radius":this.getAttribute("border-radius"),"border-right":this.getAttribute("border-right"),"border-top":this.getAttribute("border-top"),"vertical-align":this.getAttribute("vertical-align"),...t&&{"border-collapse":"separate"}};return{div:{"font-size":"0px","text-align":"left",direction:this.getAttribute("direction"),display:"inline-block","vertical-align":this.getAttribute("vertical-align"),width:this.getMobileWidth()},table:{...this.hasGutter()?{"background-color":this.getAttribute("inner-background-color"),border:this.getAttribute("inner-border"),"border-bottom":this.getAttribute("inner-border-bottom"),"border-left":this.getAttribute("inner-border-left"),"border-radius":this.getAttribute("inner-border-radius"),"border-right":this.getAttribute("inner-border-right"),"border-top":this.getAttribute("inner-border-top")}:r,...e&&{"border-collapse":"separate"}},tdOutlook:{"vertical-align":this.getAttribute("vertical-align"),width:this.getWidthAsPixel()},gutter:{...r,padding:this.getAttribute("padding"),"padding-top":this.getAttribute("padding-top"),"padding-right":this.getAttribute("padding-right"),"padding-bottom":this.getAttribute("padding-bottom"),"padding-left":this.getAttribute("padding-left")}}}},{key:"getMobileWidth",value:function(){const{containerWidth:t}=this.context,{nonRawSiblings:e}=this.props,r=this.getAttribute("width");if("mobileWidth"!==this.getAttribute("mobileWidth"))return"100%";if(void 0===r)return`${parseInt(100/e,10)}%`;const{unit:i,parsedWidth:n}=(0,_widthParser.default)(r,{parseFloatToInt:!1});return"%"===i?r:n/parseInt(t,10)*100+"%"}},{key:"getWidthAsPixel",value:function(){const{containerWidth:t}=this.context,{unit:e,parsedWidth:r}=(0,_widthParser.default)(this.getParsedWidth(!0),{parseFloatToInt:!1});return"%"===e?parseFloat(t)*r/100+"px":`${r}px`}},{key:"getParsedWidth",value:function(t){const{nonRawSiblings:e}=this.props,r=this.getAttribute("width")||100/e+"%",{unit:i,parsedWidth:n}=(0,_widthParser.default)(r,{parseFloatToInt:!1});return t?`${n}${i}`:{unit:i,parsedWidth:n}}},{key:"getColumnClass",value:function(){const{addMediaQuery:t}=this.context;let e="";const{parsedWidth:r,unit:i}=this.getParsedWidth(),n=r.toString().replace(".","-");if("%"===i)e=`mj-column-per-${n}`;else e=`mj-column-px-${n}`;return t(e,{parsedWidth:r,unit:i}),e}},{key:"hasBorderRadius",value:function(){const t=this.getAttribute("border-radius");return""!==t&&void 0!==t}},{key:"hasInnerBorderRadius",value:function(){const t=this.getAttribute("inner-border-radius");return""!==t&&void 0!==t}},{key:"hasGutter",value:function(){return["padding","padding-bottom","padding-left","padding-right","padding-top"].some((t=>null!=this.getAttribute(t)))}},{key:"renderGutter",value:function(){const t=this.hasBorderRadius();return`\n      <table\n        ${this.htmlAttributes({border:"0",cellpadding:"0",cellspacing:"0",role:"presentation",width:"100%",...t&&{style:{"border-collapse":"separate"}}})}\n      >\n        <tbody>\n          <tr>\n            <td ${this.htmlAttributes({style:"gutter"})}>\n              ${this.renderColumn()}\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    `}},{key:"renderColumn",value:function(){const{children:t}=this.props;return`\n      <table\n        ${this.htmlAttributes({border:"0",cellpadding:"0",cellspacing:"0",role:"presentation",style:"table",width:"100%"})}\n      >\n        <tbody>\n          ${this.renderChildren(t,{renderer:t=>t.constructor.isRawElement()?t.render():`\n              <tr>\n                <td\n                  ${t.htmlAttributes({align:t.getAttribute("align"),class:t.getAttribute("css-class"),style:{background:t.getAttribute("container-background-color"),"font-size":"0px",padding:t.getAttribute("padding"),"padding-top":t.getAttribute("padding-top"),"padding-right":t.getAttribute("padding-right"),"padding-bottom":t.getAttribute("padding-bottom"),"padding-left":t.getAttribute("padding-left"),"word-break":"break-word"}})}\n                >\n                  ${t.render()}\n                </td>\n              </tr>\n            `})}\n        </tbody>\n      </table>\n    `}},{key:"render",value:function(){let t=`${this.getColumnClass()} mj-outlook-group-fix`;return this.getAttribute("css-class")&&(t+=` ${this.getAttribute("css-class")}`),`\n      <div\n        ${this.htmlAttributes({class:t,style:"div"})}\n      >\n        ${this.hasGutter()?this.renderGutter():this.renderColumn()}\n      </div>\n    `}}])}(_mjmlCore.BodyComponent);(0,_defineProperty2.default)(MjColumn,"componentName","mj-column"),(0,_defineProperty2.default)(MjColumn,"allowedAttributes",{"background-color":"color",border:"string","border-bottom":"string","border-left":"string","border-radius":"unit(px,%){1,4}","border-right":"string","border-top":"string",direction:"enum(ltr,rtl)","inner-background-color":"color","padding-bottom":"unit(px,%)","padding-left":"unit(px,%)","padding-right":"unit(px,%)","padding-top":"unit(px,%)","inner-border":"string","inner-border-bottom":"string","inner-border-left":"string","inner-border-radius":"unit(px,%){1,4}","inner-border-right":"string","inner-border-top":"string",padding:"unit(px,%){1,4}","vertical-align":"enum(top,bottom,middle)",width:"unit(px,%)"}),(0,_defineProperty2.default)(MjColumn,"defaultAttributes",{direction:"ltr","vertical-align":"top"}),module.exports=exports.default;
//# sourceMappingURL=/sm/ee5c352eedce875c07ac9b9e7faa1f44ee606d9cc577e58b7224ac0a03b36a58.map