UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

2 lines (1 loc) 2.13 kB
var b=Object.defineProperty;var c=(i,t)=>b(i,"name",{value:t,configurable:!0});var a=function(i,t,r,n){var e=arguments.length,o=e<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,r,n);else for(var f=i.length-1;f>=0;f--)(u=i[f])&&(o=(e<3?u(o):e>3?u(t,r,o):u(t,r))||o);return e>3&&o&&Object.defineProperty(t,r,o),o};import{autobind as l}from"jodit/esm/core/decorators/autobind/autobind.js";import{isString as O}from"jodit/esm/core/helpers/checker/is-string.js";import{kebabCase as x}from"jodit/esm/core/helpers/string/kebab-case.js";import{trim as m}from"jodit/esm/core/helpers/string/trim.js";import{calcMarginParts as $}from"../helpers/helpers.js";const h=class h{constructor(t){this._data=_(t)}get keys(){return Object.keys(this._data)}forEach(t){this.keys.forEach(r=>t(r))}clear(){this._data={}}set(t,r){this._data[t]=r}get(t){var r;return(r=this._data[t])!==null&&r!==void 0?r:null}has(t){return this._data[t]!==void 0}add(t,r){return this._data=_(this.str()+`;${t}:${r}`),this}str(t=r=>!0){const r=Object.keys(this._data).filter(e=>e&&!/^mso-/.test(e)&&t(e)&&this.get(e)!=null),n=c(e=>O(e)?/^0[a-z]+$/i.test(e)?"0":e:e.toString(),"n");return["padding","margin"].forEach(e=>{if(this._data[e]){const o=r.indexOf(e),u=$(this._data[e]);["top","right","bottom","left"].forEach((f,g)=>{const p=`${e}-${f}`,d=this._data[p];d!=null&&(r.indexOf(p)<o||n(u[g])===n(d))&&r.indexOf(p)!==-1&&r.splice(r.indexOf(p),1)})}}),r.length?r.map(e=>`${x(e)}:${this.get(e)}`).join(";"):""}};c(h,"Style");let s=h;a([l],s.prototype,"forEach",null),a([l],s.prototype,"clear",null),a([l],s.prototype,"set",null),a([l],s.prototype,"get",null),a([l],s.prototype,"has",null),a([l],s.prototype,"add",null),a([l],s.prototype,"str",null);function _(i){return j((i??"").replace(/&quot;/g,'"').split(";").filter(Boolean).map(t=>m(t).split(":").map(m))).reduce((t,[r,n])=>(r&&n&&(t[r]=n),t),{})}c(_,"readStyles");function j(i){const t={},r=[];for(let n=i.length-1;n>=0;n-=1){const e=i[n][0];t[e]||(t[e]=!0,r.unshift(i[n]))}return r}c(j,"uniqueMax");export{s as Style};