UNPKG

17.6 kBJavaScriptView Raw
1/* Sutton SignWriting TrueType Font Module v1.4.3 (https://github.com/sutton-signwriting/font-ttf), author: Steve Slevinski (https://SteveSlevinski.me), license: MIT */
2!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ssw=t.ssw||{},t.ssw.ttf=t.ssw.ttf||{},t.ssw.ttf.fsw={}))}(this,(function(t){"use strict";const e=t=>1+96*(parseInt(t.slice(1,4),16)-256)+16*parseInt(t.slice(4,5),16)+parseInt(t.slice(5,6),16);let o={};const i=152;let l;const s=function(t){return function(t){if(t in o)return[...o[t]];if(!l){const t=document.createElement("canvas");t.width=i,t.height=i,l=t.getContext("2d")}l.clearRect(0,0,i,i),l.font="60px 'SuttonSignWritingLine'",l.fillText(String.fromCodePoint(t+983040),0,0);const e=l.getImageData(0,0,i,i).data;let s,n,a,r;t:for(s=151;s>=0;s--)for(n=0;n<i;n+=1)for(r=0;r<4;r+=1)if(a=4*s+4*n*i+r,e[a])break t;var d=s;t:for(n=151;n>=0;n--)for(s=0;s<d;s+=1)for(r=0;r<4;r+=1)if(a=4*s+4*n*i+r,e[a])break t;var c=n+1;if(d=Math.ceil(d/2),c=Math.ceil(c/2),14394==t&&(d=19),[10468,10480,10496,10512,10500,10532,10548,10862,10878,10894,11058,11074,11476,11488,11492,11504,11508,11520,10516,10910,10926,11042,11082,10942].includes(t)&&(d=20),31921==t&&(d=22),38460==t&&(d=23),[20164,20212].includes(t)&&(d=25),31894==t&&(d=28),46698==t&&(d=29),29606==t&&(d=30),44855==t&&(d=40),32667==t&&(d=50),[11088,11474,11490,11506].includes(t)&&(c=20),6285==t&&(c=21),40804==t&&(c=31),41475==t&&(c=36),0==d&&0==c){const e={9:[15,30],10:[21,30],11:[30,15],12:[30,21],13:[15,30],14:[21,30]};t in e&&(d=e[t][0],c=e[t][1])}return 0!=d||0!=c?(o[t]=[d,c],[d,c]):void 0}(e(t))},n=function(t){return String.fromCodePoint(t+983040)},a=function(t){return String.fromCodePoint(t+1048576)},r=function(t){return n(e(t))},d=function(t){return a(e(t))},c=function(t){return o=e(t),` <text class="sym-fill" fill="white" style="pointer-events:none;font-family:'SuttonSignWritingFill';font-size:30px;">${a(o)}</text>\n <text class="sym-line" fill="black" style="pointer-events:none;font-family:'SuttonSignWritingLine';font-size:30px;">${n(o)}</text>`;var o};let m={colorize:"C",colorhex:"(?:[0-9a-fA-F]{3}){1,2}",colorname:"[a-zA-Z]+",padding:"P[0-9]{2}",zoom:"Z(?:[0-9]+(?:\\.[0-9]+)?|x)",classbase:"-?[_a-zA-Z][_a-zA-Z0-9-]{0,100}",id:"[a-zA-Z][_a-zA-Z0-9-]{0,100}"};m.colorbase=`(?:${m.colorhex}|${m.colorname})`,m.color=`_${m.colorbase}_`,m.colors=`_${m.colorbase}(?:,${m.colorbase})?_`,m.background=`G${m.color}`,m.detail=`D${m.colors}`,m.detailsym=`D[0-9]{2}${m.colors}`,m.classes=`${m.classbase}(?: ${m.classbase})*`,m.full=`-(${m.colorize})?(${m.padding})?(${m.background})?(${m.detail})?(${m.zoom})?(?:-((?:${m.detailsym})*))?(?:-(${m.classes})?!(?:(${m.id})!)?)?`;const p=t=>(new RegExp(`^${m.colorhex}$`).test(t)?"#":"")+t,g=t=>{const e=`^${m.full}`,o=("string"==typeof t?t.match(new RegExp(e)):[])||[];return i={colorize:o[1]?!!o[1]:void 0,padding:o[2]?parseInt(o[2].slice(1)):void 0,background:o[3]?p(o[3].slice(2,-1)):void 0,detail:o[4]?o[4].slice(2,-1).split(",").map(p):void 0,zoom:o[5]?"Zx"===o[5]?"x":parseFloat(o[5].slice(1)):void 0,detailsym:o[6]?o[6].match(new RegExp(m.detailsym,"g")).map((t=>{const e=t.split("_"),o=e[1].split(",").map(p);return{index:parseInt(e[0].slice(1)),detail:o}})):void 0,classes:o[7]?o[7]:void 0,id:o[8]?o[8]:void 0},Object.fromEntries(Object.entries(i).filter((([t,e])=>void 0!==e)));var i},f=t=>{if("object"!=typeof t||null===t)return;let e="-";e+=t.colorize?"C":"";const o=parseInt(t.padding);e+=!o||o<=0||o>99?"":"P"+(o>9?o:"0"+o);const i=t.background&&"string"==typeof t.background?t.background.match(m.colorbase)[0]:void 0;e+=i?"G_"+i+"_":"";const l=t.detail&&t.detail[0]&&"string"==typeof t.detail[0]?t.detail[0].match(m.colorbase)[0]:void 0,s=t.detail&&t.detail[1]&&"string"==typeof t.detail[1]?t.detail[1].match(m.colorbase)[0]:void 0;l&&(e+="D_"+l,s&&(e+=","+s),e+="_");const n="x"===t.zoom?"x":parseFloat(t.zoom);e+=!n||n<=0?"":"Z"+n;let a="";const r=t.detailsym&&Array.isArray(t.detailsym)?t.detailsym.map((t=>{const e=parseInt(t.index);if(!e||e<=0||e>99)return"";let o="D"+(e>9?e:"0"+e);const i=t.detail&&t.detail[0]?t.detail[0].match(m.colorbase)[0]:void 0,l=t.detail&&t.detail[1]?t.detail[1].match(m.colorbase)[0]:void 0;return i&&(o+="_"+i,l&&(o+=","+l),o+="_"),o})):[];a+=r.join("");let d="";const c=t.classes&&"string"==typeof t.classes?t.classes.match(m.classes)[0]:void 0;d+=c||"";const p=t.id&&"string"==typeof t.id?t.id.match(m.id)[0]:void 0;return d+=c||p?"!":"",d+=p?p+"!":"",e+(a||d?"-"+a:"")+(d?"-"+d:"")};let y={symbol:"S[123][0-9a-f]{2}[0-5][0-9a-f]",coord:"[0-9]{3}x[0-9]{3}",sort:"A",box:"[BLMR]"};y.prefix=`(?:${y.sort}(?:${y.symbol})+)`,y.spatial=`${y.symbol}${y.coord}`,y.signbox=`${y.box}${y.coord}(?:${y.spatial})*`,y.sign=`${y.prefix}?${y.signbox}`,y.sortable=`${y.prefix}${y.signbox}`;let u={colorize:"C",colorhex:"(?:[0-9a-fA-F]{3}){1,2}",colorname:"[a-zA-Z]+",padding:"P[0-9]{2}",zoom:"Z(?:[0-9]+(?:\\.[0-9]+)?|x)",classbase:"-?[_a-zA-Z][_a-zA-Z0-9-]{0,100}",id:"[a-zA-Z][_a-zA-Z0-9-]{0,100}"};u.colorbase=`(?:${u.colorhex}|${u.colorname})`,u.color=`_${u.colorbase}_`,u.colors=`_${u.colorbase}(?:,${u.colorbase})?_`,u.background=`G${u.color}`,u.detail=`D${u.colors}`,u.detailsym=`D[0-9]{2}${u.colors}`,u.classes=`${u.classbase}(?: ${u.classbase})*`,u.full=`-(${u.colorize})?(${u.padding})?(${u.background})?(${u.detail})?(${u.zoom})?(?:-((?:${u.detailsym})*))?(?:-(${u.classes})?!(?:(${u.id})!)?)?`;const h=t=>(new RegExp(`^${u.colorhex}$`).test(t)?"#":"")+t,x=t=>{const e=`^${u.full}`,o=("string"==typeof t?t.match(new RegExp(e)):[])||[];return i={colorize:o[1]?!!o[1]:void 0,padding:o[2]?parseInt(o[2].slice(1)):void 0,background:o[3]?h(o[3].slice(2,-1)):void 0,detail:o[4]?o[4].slice(2,-1).split(",").map(h):void 0,zoom:o[5]?"Zx"===o[5]?"x":parseFloat(o[5].slice(1)):void 0,detailsym:o[6]?o[6].match(new RegExp(u.detailsym,"g")).map((t=>{const e=t.split("_"),o=e[1].split(",").map(h);return{index:parseInt(e[0].slice(1)),detail:o}})):void 0,classes:o[7]?o[7]:void 0,id:o[8]?o[8]:void 0},Object.fromEntries(Object.entries(i).filter((([t,e])=>void 0!==e)));var i},b=t=>t.split("x").map((t=>parseInt(t))),$=t=>{const e=`^(${y.symbol})(${y.coord})?(${u.full})?`,o="string"==typeof t?t.match(new RegExp(e)):void 0;return{symbol:o?o[1]:void 0,coord:o&&o[2]?b(o[2]):void 0,style:o?o[3]:void 0}},v=t=>{const e=`^(${y.prefix})?(${y.signbox})(${u.full})?`,o="string"==typeof t?t.match(new RegExp(e)):void 0;return o?{sequence:o[1]?o[1].slice(1).match(/.{6}/g):void 0,box:o[2][0],max:b(o[2].slice(1,8)),spatials:o[2].length<9?void 0:o[2].slice(8).match(/(.{13})/g).map((t=>({symbol:t.slice(0,6),coord:[parseInt(t.slice(6,9)),parseInt(t.slice(10,13))]}))),style:o[3]}:{}},z=t=>{if("string"!=typeof t)return[];const e=`(${y.sign}(${u.full})?|${y.spatial}(${u.full})?)`,o=t.match(new RegExp(e,"g"));return o?[...o]:[]},w=t=>{let e,o,i,l,s,n,a,r,d=v(t);d.spatials?(l=Math.min(...d.spatials.map((t=>t.coord[0]))),s=d.max[0],e=s-l,n=Math.min(...d.spatials.map((t=>t.coord[1]))),a=d.max[1],o=a-n,i="sign",r=d.box):(d=$(t),r="M",d.coord?(l=d.coord[0],e=2*(500-l),n=d.coord[1],o=2*(500-n),i="symbol"):(l=490,e=20,n=490,o=20,i="none"));let c=x(d.style),m=c.zoom||1,p=c.padding||0;return{minX:l,minY:n,width:e,height:o,segment:i,lane:{B:0,L:-1,M:0,R:1}[r],padding:p,zoom:m}},S={height:500,width:150,offset:50,pad:20,margin:5,dynamic:!1,background:void 0,punctuation:{spacing:!0,pad:30,pull:!0},style:{detail:["black","white"],zoom:1}},k=(t,e)=>{if("string"!=typeof t)return{};const o=(t=>("object"!=typeof t&&(t={}),{...S,...t,punctuation:{...S.punctuation,...t.punctuation},style:{...S.style,...t.style}}))(e);let i=z(t),l=0,s=[],n=[],a=0,r=parseInt(o.width/2),d=o.height-o.margin,c=!0,m=!1;for(let t of i){let e=w(t);l+=a,o.punctuation.spacing?l+="sign"==e.segment?o.pad:0:l+=o.pad,m=l+e.height>d,m&&"symbol"==e.segment&&o.punctuation.pull&&c&&(m=!1,c=!1),0==n.length&&(m=!1),m&&(l=o.pad,s.push(n),n=[],c=!0),n.push(Object.assign(e,{x:r+o.offset*e.lane-(500-e.minX)*e.zoom*o.style.zoom,y:l,text:t})),l+=e.height*e.zoom*o.style.zoom,a=o.punctuation.spacing?"sign"==e.segment?o.pad:o.punctuation.pad:o.pad}if(n.length&&s.push(n),o.punctuation.pull)for(let t of s){let e=t[t.length-1],i=e.y+e.height-(o.height-o.margin);if(i>0){let e=parseInt(i/t.length)+1;for(let o in t)t[o].y-=e*o+e}}let p=[];for(let t of s){let e=[r-o.offset-o.pad],i=[r+o.offset+o.pad];for(let l of t)e.push(l.x-o.pad),i.push(l.x+l.width+o.pad);e=Math.min(...e),i=Math.max(...i);let l=o.width,s=0;o.dynamic?(l=i-e,s=-e):s=r-parseInt((e+i)/2);for(let e of t)e.x+=s;p.push(l)}return{options:o,widths:p,columns:s}},I=[256,517,759,767,877,895,903],_=[767,876],j=[767,885],E=["#0000CC","#CC0000","#FF0099","#006600","#000000","#884411","#FF9900"],M=t=>{const e=$(t);let o="#000000";if(e.symbol){const t=parseInt(e.symbol.slice(1,4),16),i=I.findIndex((e=>e>t));o=E[i<0?6:i-1]}return o},A=t=>{const e=$(t);if(!e.symbol)return"";let o,i,l,n,a=g(e.style);if(e.coord)o=e.coord[0],i=e.coord[1],l=500-o+500,n=500-i+500;else{let t=s(e.symbol);if(!t)return"";o=500-parseInt((t[0]+1)/2),i=500-parseInt((t[1]+1)/2),l=500-o+500,n=500-i+500}let r,d=c(e.symbol);d=` <g transform="translate(${o},${i})">\n${d}\n </g>`,a.colorize?r=M(e.symbol):a.detail&&(r=a.detail[0]),r&&(d=d.replace(/class="sym-line" fill="black"/,`class="sym-line" fill="${r}"`));let m=a.detail&&a.detail[1];m&&(d=d.replace(/class="sym-fill" fill="white"/,`class="sym-fill" fill="${m}"`));let p="";return a.padding&&(o-=a.padding,i-=a.padding,l+=a.padding,n+=a.padding),a.background&&(p=`\n <rect x="${o}" y="${i}" width="${l-o}" height="${n-i}" style="fill:${a.background};" />`),` <text font-size="0">${t}</text>${p}\n${d}`},R=t=>{let e=v(t);if(e.spatials){let o=g(e.style);o.detailsym&&o.detailsym.forEach((t=>{e.spatials[t.index-1]&&(e.spatials[t.index-1].detail=t.detail)}));let i=Math.min(...e.spatials.map((t=>t.coord[0]))),l=Math.min(...e.spatials.map((t=>t.coord[1]))),s=e.max[0],n=e.max[1],a="";o.padding&&(i-=o.padding,l-=o.padding,s+=o.padding,n+=o.padding),o.background&&(a=`\n <rect x="${i}" y="${l}" width="${s-i}" height="${n-l}" style="fill:${o.background};" />`);let r=` <text font-size="0">${t}</text>${a}`;const d=o.detail&&o.detail[0],m=o.detail&&o.detail[1];return r+="\n"+e.spatials.map((t=>{let e=c(t.symbol),i=d;t.detail?i=t.detail[0]:o.colorize&&(i=M(t.symbol)),i&&(e=e.replace(/class="sym-line" fill="black"/,`class="sym-line" fill="${i}"`));let l=m;return t.detail&&t.detail[1]&&(l=t.detail[1]),l&&(e=e.replace(/class="sym-fill" fill="white"/,`class="sym-fill" fill="${l}"`)),` <g transform="translate(${t.coord[0]},${t.coord[1]})">\n${e}\n </g>`})).join("\n"),r}return""},Z=(t,e)=>{"object"!=typeof e&&(e={});const o=Object.assign(S,e);let i=o.width,l=o.height,s="";o.background&&(s=`\n <rect x="0" y="0" width="${i-0}" height="${l-0}" style="fill:${o.background};" />`);let n=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"${` width="${o.width}" height="${o.height}"`} viewBox="0 0 ${i-0} ${l-0}">\n ${s}`;return n+=t.map((t=>{const e=t.text.indexOf("-");if(e>0){const i=t.text.substring(e),l={...o.style,...g(i)};t.text=t.text.replace(i,f(l))}else t.text+=f(o.style);return t.zoom=t.zoom*o.style.zoom,'<g transform="translate('+t.x+","+t.y+") scale("+t.zoom+") translate("+-t.minX+","+-t.minY+') ">'+("sign"==t.segment?R(t.text):A(t.text))+"</g>"})).join("\n"),n+="\n</svg>",n},C=(t,e)=>{const o=function(t,e){"object"!=typeof e&&(e={});const o=Object.assign(S,e),i=document.createElement("canvas");i.width=o.width,i.height=o.height;const l=i.getContext("2d");return o.background&&(l.rect(0,0,o.width,o.height),l.fillStyle=o.background,l.fill()),t.map((t=>{const e=t.text.indexOf("-");if(e>0){const i=t.text.substring(e),l={...o.style,...g(i)};t.text=t.text.replace(i,f(l))}else t.text+=f(o.style);t.zoom=t.zoom*o.style.zoom;let i={};if("sign"==t.segment)i=v(t.text);else{let e=$(t.text);i.style=e.style,i.spatials=[e]}let s=g(i.style);s.background&&(l.fillStyle=s.background,l.fillRect(t.x-s.padding*t.zoom,t.y-s.padding*t.zoom,(t.width+2*s.padding)*t.zoom,(t.height+2*s.padding)*t.zoom)),s.detailsym&&s.detailsym.forEach((t=>{i.spatials[t.index-1]&&(i.spatials[t.index-1].detail=t.detail)}));const n=s.detail&&s.detail[0]||"black",a=s.detail&&s.detail[1]||"white";i.spatials.forEach((e=>{let o=n;e.detail?o=e.detail[0]:s.colorize&&(o=M(e.symbol));let i=a;e.detail&&e.detail[1]&&(i=e.detail[1]),l.font=30*t.zoom+"px 'SuttonSignWritingFill'",l.fillStyle=i,l.fillText(d(e.symbol),t.x+(e.coord[0]-t.minX)*t.zoom,t.y+(e.coord[1]-t.minY)*t.zoom),l.font=30*t.zoom+"px 'SuttonSignWritingLine'",l.fillStyle=o,l.fillText(r(e.symbol),t.x+(e.coord[0]-t.minX)*t.zoom,t.y+(e.coord[1]-t.minY)*t.zoom)}))})),i}(t,e),i=o.toDataURL("image/png");return o.remove(),i};t.columnPng=C,t.columnSvg=Z,t.columnsPng=function(t,e){"object"!=typeof e&&(e={});let o=k(t,e);return o.columns.map(((t,e)=>C(t,{...o.options,width:o.widths[e]})))},t.columnsSvg=function(t,e){"object"!=typeof e&&(e={});let o=k(t,e);return o.columns.map(((t,e)=>Z(t,{...o.options,width:o.widths[e]})))},t.signNormalize=t=>{const e=v(t);if(e.spatials){const t=e.spatials.reduce(((t,e)=>{const o=s(e.symbol);return t[e.symbol]={width:o[0],height:o[1]},t}),{}),o=e=>({x1:Math.min(...e.map((t=>t.coord[0]))),y1:Math.min(...e.map((t=>t.coord[1]))),x2:Math.max(...e.map((e=>e.coord[0]+parseInt(t[e.symbol].width)))),y2:Math.max(...e.map((e=>e.coord[1]+parseInt(t[e.symbol].height))))}),i=_,l=e.spatials.filter((t=>{const e=parseInt(t.symbol.slice(1,4),16);return i[0]<=e&&i[1]>=e})),n=j,a=e.spatials.filter((t=>{const e=parseInt(t.symbol.slice(1,4),16);return n[0]<=e&&n[1]>=e}));let r=o(e.spatials),d=[r.x2,r.y2];if(l.length){const t=o(l);r.x1=t.x1,r.x2=t.x2}if(a.length){const t=o(a);r.y1=t.y1,r.y2=t.y2}const c=[parseInt((r.x2+r.x1)/2)-500,parseInt((r.y2+r.y1)/2)-500];return(e.sequence?"A"+e.sequence.join(""):"")+e.box+(d[0]-c[0])+"x"+(d[1]-c[1])+e.spatials.map((t=>t.symbol+(t.coord[0]-c[0])+"x"+(t.coord[1]-c[1]))).join("")+(e.style||"")}},t.signPng=t=>{const e=function(t){const e=v(t);if(e.spatials){const t=document.createElement("canvas"),o=t.getContext("2d");let i=g(e.style);i.detailsym&&i.detailsym.forEach((t=>{e.spatials[t.index-1]&&(e.spatials[t.index-1].detail=t.detail)}));let l=Math.min(...e.spatials.map((t=>t.coord[0]))),s=Math.min(...e.spatials.map((t=>t.coord[1]))),n=e.max[0],a=e.max[1];i.padding&&(l-=i.padding,s-=i.padding,n+=i.padding,a+=i.padding);let c=1;"x"!=i.zoom&&(c=i.zoom);let m=(n-l)*c,p=(a-s)*c;t.width=m||1,t.height=p||1,i.background&&(o.rect(0,0,m,p),o.fillStyle=i.background,o.fill());const f=i.detail&&i.detail[0]||"black",y=i.detail&&i.detail[1]||"white";return e.spatials.forEach((t=>{let e=f;t.detail?e=t.detail[0]:i.colorize&&(e=M(t.symbol));let n=y;t.detail&&t.detail[1]&&(n=t.detail[1]),o.font=30*c+"px 'SuttonSignWritingFill'",o.fillStyle=n,o.fillText(d(t.symbol),(t.coord[0]-l)*c,(t.coord[1]-s)*c),o.font=30*c+"px 'SuttonSignWritingLine'",o.fillStyle=e,o.fillText(r(t.symbol),(t.coord[0]-l)*c,(t.coord[1]-s)*c)})),t}}(t),o=e.toDataURL("image/png");return e.remove(),o},t.signSvg=t=>{let e=v(t);if(e.spatials){let o=g(e.style),i=Math.min(...e.spatials.map((t=>t.coord[0]))),l=Math.min(...e.spatials.map((t=>t.coord[1]))),s=e.max[0],n=e.max[1],a="";o.classes&&(a=` class="${o.classes}"`);let r="";o.id&&(r=` id="${o.id}"`),o.padding&&(i-=o.padding,l-=o.padding,s+=o.padding,n+=o.padding);let d="";"x"!=o.zoom&&(d=` width="${(s-i)*(o.zoom?o.zoom:1)}" height="${(n-l)*(o.zoom?o.zoom:1)}"`);let c=`<svg${a}${r} version="1.1" xmlns="http://www.w3.org/2000/svg"${d} viewBox="${i} ${l} ${s-i} ${n-l}">\n`;return c+=R(t),c+="\n</svg>",c}return'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>'},t.signSvgBody=R,t.symbolFill=d,t.symbolLine=r,t.symbolNormalize=t=>{const e=$(t);if(!e.symbol)return null;{let t=s(e.symbol);if(t)return`${e.symbol}${500-parseInt((t[0]+1)/2)}x${500-parseInt((t[1]+1)/2)}${e.style||""}`}},t.symbolPng=t=>{const e=function(t){const e=$(t);if(e.symbol){let t=s(e.symbol);if(t){const o=document.createElement("canvas"),i=o.getContext("2d");let l=g(e.style),s="black";l.colorize?s=M(e.symbol):l.detail&&(s=l.detail[0]);let n=l.detail&&l.detail[1]||"white",a=500,c=a+t[0],m=500,p=m+t[1];l.padding&&(a-=l.padding,m-=l.padding,c+=l.padding,p+=l.padding);let f=1;"x"!=l.zoom&&(f=l.zoom);let y=(c-a)*f,u=(p-m)*f;return o.width=y||1,o.height=u||1,l.background&&(i.rect(0,0,y,u),i.fillStyle=l.background,i.fill()),i.font=30*f+"px 'SuttonSignWritingFill'",i.fillStyle=n,i.fillText(d(e.symbol),(500-a)*f,(500-m)*f),i.font=30*f+"px 'SuttonSignWritingLine'",i.fillStyle=s,i.fillText(r(e.symbol),(500-a)*f,(500-m)*f),o}}}(t),o=e.toDataURL("image/png");return e.remove(),o},t.symbolSize=s,t.symbolSvg=t=>{const e=$(t),o='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>';if(!e.symbol)return o;let i,l,n,a,r=g(e.style);if(e.coord)i=e.coord[0],l=e.coord[1],n=500-i+500,a=500-l+500;else{let t=s(e.symbol);if(!t)return o;i=parseInt(500-t[0]/2),l=parseInt(500-t[1]/2),n=i+t[0],a=l+t[1]}let d="";r.classes&&(d=` class="${r.classes}"`);let c="";r.id&&(c=` id="${r.id}"`),r.padding&&(i-=r.padding,l-=r.padding,n+=r.padding,a+=r.padding);let m="";return"x"!=r.zoom&&(m=` width="${(n-i)*(r.zoom?r.zoom:1)}" height="${(a-l)*(r.zoom?r.zoom:1)}"`),`<svg${d}${c} version="1.1" xmlns="http://www.w3.org/2000/svg"${m} viewBox="${i} ${l} ${n-i} ${a-l}">\n${A(t)}\n</svg>`},t.symbolSvgBody=A,t.symbolText=c,Object.defineProperty(t,"__esModule",{value:!0})}));