mmjs-core
Version:
mmjs-core hooks component vue
2 lines (1 loc) • 797 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(n=""){let i=1/0,a=1/0,t=-1/0,e=-1/0;const r=n.match(/[a-df-z][^a-df-z]*/gi);return r==null||r.forEach(u=>{const o=u.slice(1).trim().split(/[\s,]+/).map(Number);for(let c=0;c<o.length;c+=2){const l=o[c],s=o[c+1];isNaN(l)||(i=Math.min(i,l)),isNaN(s)||(a=Math.min(a,s)),isNaN(l)||(t=Math.max(t,l)),isNaN(s)||(e=Math.max(e,s))}}),`${i} ${a} ${t-i+2} ${e-a+2}`}function h(n){const i=[],a=/\{([^}|]+)\|([^}]+)\}/g;let t,e=0;for(;(t=a.exec(n))!==null;)t.index>e&&i.push({type:"text",content:n.substring(e,t.index)}),i.push({type:"rich",name:t[1],content:t[2]??""}),e=t.index+t[0].length;return e<n.length&&i.push({type:"text",content:n.substring(e)}),i}exports.calculateViewBox=f;exports.parseRichFormatString=h;