UNPKG

17.8 kBJavaScriptView Raw
1/* Sutton SignWriting TrueType Font Module v1.3.2 (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.swu={}))}(this,(function(t){"use strict";const e=t=>t.map((t=>(t=>String.fromCodePoint(120844+parseInt(t)-250))(t))).join(""),o=t=>(t=>parseInt(t.codePointAt(0)))(t)-262144;let i={};const l=152;let s;const n=function(t){return function(t){if(t in i)return[...i[t]];if(!s){const t=document.createElement("canvas");t.width=l,t.height=l,s=t.getContext("2d")}s.clearRect(0,0,l,l),s.font="60px 'SuttonSignWritingLine'",s.fillText(String.fromCodePoint(t+983040),0,0);const e=s.getImageData(0,0,l,l).data;let o,n,a,d;t:for(o=151;o>=0;o--)for(n=0;n<l;n+=1)for(d=0;d<4;d+=1)if(a=4*o+4*n*l+d,e[a])break t;var r=o;t:for(n=151;n>=0;n--)for(o=0;o<r;o+=1)for(d=0;d<4;d+=1)if(a=4*o+4*n*l+d,e[a])break t;var c=n+1;if(r=Math.ceil(r/2),c=Math.ceil(c/2),14394==t&&(r=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)&&(r=20),31921==t&&(r=22),38460==t&&(r=23),[20164,20212].includes(t)&&(r=25),31894==t&&(r=28),46698==t&&(r=29),29606==t&&(r=30),44855==t&&(r=40),32667==t&&(r=50),[11088,11474,11490,11506].includes(t)&&(c=20),6285==t&&(c=21),40804==t&&(c=31),41475==t&&(c=36),0==r&&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&&(r=e[t][0],c=e[t][1])}return 0!=r||0!=c?(i[t]=[r,c],[r,c]):void 0}(o(t))},a=function(t){return String.fromCodePoint(t+983040)},d=function(t){return String.fromCodePoint(t+1048576)},r=function(t){return a(o(t))},c=function(t){return d(o(t))},m=function(t){return e=o(t),` <text class="sym-fill" fill="white" style="pointer-events:none;font-family:'SuttonSignWritingFill';font-size:30px;">${d(e)}</text>\n <text class="sym-line" fill="black" style="pointer-events:none;font-family:'SuttonSignWritingLine';font-size:30px;">${a(e)}</text>`;var e};let p={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}"};p.colorbase=`(?:${p.colorhex}|${p.colorname})`,p.color=`_${p.colorbase}_`,p.colors=`_${p.colorbase}(?:,${p.colorbase})?_`,p.background=`G${p.color}`,p.detail=`D${p.colors}`,p.detailsym=`D[0-9]{2}${p.colors}`,p.classes=`${p.classbase}(?: ${p.classbase})*`,p.full=`-(${p.colorize})?(${p.padding})?(${p.background})?(${p.detail})?(${p.zoom})?(?:-((?:${p.detailsym})*))?(?:-(${p.classes})?!(?:(${p.id})!)?)?`;const g=t=>(new RegExp(`^${p.colorhex}$`).test(t)?"#":"")+t,f=t=>{const e=`^${p.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]?g(o[3].slice(2,-1)):void 0,detail:o[4]?o[4].slice(2,-1).split(",").map(g):void 0,zoom:o[5]?"Zx"===o[5]?"x":parseFloat(o[5].slice(1)):void 0,detailsym:o[6]?o[6].match(new RegExp(p.detailsym,"g")).map((t=>{const e=t.split("_"),o=e[1].split(",").map(g);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},u=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(p.colorbase)[0]:void 0;e+=i?"G_"+i+"_":"";const l=t.detail&&t.detail[0]&&"string"==typeof t.detail[0]?t.detail[0].match(p.colorbase)[0]:void 0,s=t.detail&&t.detail[1]&&"string"==typeof t.detail[1]?t.detail[1].match(p.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 d=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(p.colorbase)[0]:void 0,l=t.detail&&t.detail[1]?t.detail[1].match(p.colorbase)[0]:void 0;return i&&(o+="_"+i,l&&(o+=","+l),o+="_"),o})):[];a+=d.join("");let r="";const c=t.classes&&"string"==typeof t.classes?t.classes.match(p.classes)[0]:void 0;r+=c||"";const m=t.id&&"string"==typeof t.id?t.id.match(p.id)[0]:void 0;return r+=c||m?"!":"",r+=m?m+"!":"",e+(a||r?"-"+a:"")+(r?"-"+r:"")};let y={symbol:"(?:(?:\ud8c0[\udc01-\udfff])|(?:[\ud8c1-\ud8fc][\udc00-\udfff])|(?:\ud8fd[\udc00-\udc80]))",coord:"(?:\ud836[\udc0c-\uddff]){2}",sort:"𝠀",box:"\ud836[\udc01-\udc04]"};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 h={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}"};h.colorbase=`(?:${h.colorhex}|${h.colorname})`,h.color=`_${h.colorbase}_`,h.colors=`_${h.colorbase}(?:,${h.colorbase})?_`,h.background=`G${h.color}`,h.detail=`D${h.colors}`,h.detailsym=`D[0-9]{2}${h.colors}`,h.classes=`${h.classbase}(?: ${h.classbase})*`,h.full=`-(${h.colorize})?(${h.padding})?(${h.background})?(${h.detail})?(${h.zoom})?(?:-((?:${h.detailsym})*))?(?:-(${h.classes})?!(?:(${h.id})!)?)?`;const x=t=>(new RegExp(`^${h.colorhex}$`).test(t)?"#":"")+t,b=t=>{const e=`^${h.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]?x(o[3].slice(2,-1)):void 0,detail:o[4]?o[4].slice(2,-1).split(",").map(x):void 0,zoom:o[5]?"Zx"===o[5]?"x":parseFloat(o[5].slice(1)):void 0,detailsym:o[6]?o[6].match(new RegExp(h.detailsym,"g")).map((t=>{const e=t.split("_"),o=e[1].split(",").map(x);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},$=t=>parseInt(t.codePointAt(0))-120844+250,v=t=>[$(t.slice(0,2)),$(t.slice(2,4))],z=t=>{const e=`^(${y.symbol})(${y.coord})?(${h.full})?`,o="string"==typeof t?t.match(new RegExp(e)):void 0;return{symbol:o?o[1]:void 0,coord:o&&o[2]?v(o[2]):void 0,style:o?o[3]:void 0}},w=t=>{const e=`^(${y.prefix})?(${y.signbox})(${h.full})?`,o="string"==typeof t?t.match(new RegExp(e)):void 0;return o?{sequence:o[1]?o[1].slice(2).match(/.{2}/g):void 0,box:o[2].slice(0,2),max:v(o[2].slice(2,6)),spatials:o[2].length<7?void 0:o[2].slice(6).match(/(.{6})/g).map((t=>({symbol:t.slice(0,2),coord:v(t.slice(2))}))),style:o[3]}:{}},S=t=>{if("string"!=typeof t)return[];const e=`(${y.sign}(${h.full})?|${y.spatial}(${h.full})?)`,o=t.match(new RegExp(e,"g"));return o?[...o]:[]},k=t=>{let e,o,i,l,s,n,a,d,r=w(t);r.spatials?(l=Math.min(...r.spatials.map((t=>t.coord[0]))),s=r.max[0],e=s-l,n=Math.min(...r.spatials.map((t=>t.coord[1]))),a=r.max[1],o=a-n,i="sign",d=r.box):(r=z(t),d="𝠃",r.coord?(l=r.coord[0],e=2*(500-l),n=r.coord[1],o=2*(500-n),i="symbol"):(l=490,e=20,n=490,o=20,i="none"));let c=b(r.style),m=c.zoom||1,p=c.padding||0;return{minX:l,minY:n,width:e,height:o,segment:i,lane:{"𝠁":0,"𝠂":-1,"𝠃":0,"𝠄":1}[d],padding:p,zoom:m}},I={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}},_=(t,e)=>{if("string"!=typeof t)return{};const o=(t=>("object"!=typeof t&&(t={}),{...I,...t,punctuation:{...I.punctuation,...t.punctuation},style:{...I.style,...t.style}}))(e);let i=S(t),l=0,s=[],n=[],a=0,d=parseInt(o.width/2),r=o.height-o.margin,c=!0,m=!1;for(let t of i){let e=k(t);l+=a,o.punctuation.spacing?l+="sign"==e.segment?o.pad:0:l+=o.pad,m=l+e.height>r,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:d+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=[d-o.offset-o.pad],i=[d+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=d-parseInt((e+i)/2);for(let e of t)e.x+=s;p.push(l)}return{options:o,widths:p,columns:s}},j=[262145,287201,310433,311201,321761,323489,324257],E=[311201,321760],A=[311201,322624],M=["#0000CC","#CC0000","#FF0099","#006600","#000000","#884411","#FF9900"],C=t=>{const e=z(t);let o="#000000";if(e.symbol){const t=(t=>parseInt(t.codePointAt(0)))(e.symbol),i=j.findIndex((e=>e>t));o=M[i<0?6:i-1]}return o},P=t=>{const e=z(t);if(!e.symbol)return"";let o,i,l,s,a=f(e.style);if(e.coord)o=e.coord[0],i=e.coord[1],l=500-o+500,s=500-i+500;else{let t=n(e.symbol);if(!t)return"";o=500-parseInt((t[0]+1)/2),i=500-parseInt((t[1]+1)/2),l=500-o+500,s=500-i+500}let d,r=m(e.symbol);r=` <g transform="translate(${o},${i})">\n${r}\n </g>`,a.colorize?d=C(e.symbol):a.detail&&(d=a.detail[0]),d&&(r=r.replace(/class="sym-line" fill="black"/,`class="sym-line" fill="${d}"`));let c=a.detail&&a.detail[1];c&&(r=r.replace(/class="sym-fill" fill="white"/,`class="sym-fill" fill="${c}"`));let p="";return a.padding&&(o-=a.padding,i-=a.padding,l+=a.padding,s+=a.padding),a.background&&(p=`\n <rect x="${o}" y="${i}" width="${l-o}" height="${s-i}" style="fill:${a.background};" />`),` <text font-size="0">${t}</text>${p}\n${r}`},Z=t=>{let e=w(t);if(e.spatials){let o=f(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 d=` <text font-size="0">${t}</text>${a}`;const r=o.detail&&o.detail[0],c=o.detail&&o.detail[1];return d+="\n"+e.spatials.map((t=>{let e=m(t.symbol),i=r;t.detail?i=t.detail[0]:o.colorize&&(i=C(t.symbol)),i&&(e=e.replace(/class="sym-line" fill="black"/,`class="sym-line" fill="${i}"`));let l=c;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"),d}return""},F=(t,e)=>{"object"!=typeof e&&(e={});const o=Object.assign(I,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 <text font-size="0">0</text>${s}`;return n+=t.map((t=>{const e=t.text.indexOf("-");if(e>0){const i=t.text.substring(e),l={...o.style,...f(i)};t.text=t.text.replace(i,u(l))}else t.text+=u(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?Z(t.text):P(t.text))+"</g>"})).join("\n"),n+="\n</svg>",n},R=(t,e)=>{const o=function(t,e){"object"!=typeof e&&(e={});const o=Object.assign(I,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,...f(i)};t.text=t.text.replace(i,u(l))}else t.text+=u(o.style);t.zoom=t.zoom*o.style.zoom;let i={};if("sign"==t.segment)i=w(t.text);else{let e=z(t.text);i.style=e.style,i.spatials=[e]}let s=f(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=C(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(c(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=R,t.columnSvg=F,t.columnsPng=function(t,e){"object"!=typeof e&&(e={});let o=_(t,e);return o.columns.map(((t,e)=>R(t,{...o.options,width:o.widths[e]})))},t.columnsSvg=function(t,e){"object"!=typeof e&&(e={});let o=_(t,e);return o.columns.map(((t,e)=>F(t,{...o.options,width:o.widths[e]})))},t.signNormalize=t=>{const o=w(t);if(o.spatials){const t=o.spatials.reduce(((t,e)=>{const o=n(e.symbol);return t[e.symbol]={width:o[0],height:o[1]},t}),{}),i=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))))}),l=E,s=o.spatials.filter((t=>{const e=parseInt(t.symbol.slice(1,4),16);return l[0]<=e&&l[1]>=e})),a=A,d=o.spatials.filter((t=>{const e=parseInt(t.symbol.slice(1,4),16);return a[0]<=e&&a[1]>=e}));let r=i(o.spatials),c=[r.x2,r.y2];if(s.length){const t=i(s);r.x1=t.x1,r.x2=t.x2}if(d.length){const t=i(d);r.y1=t.y1,r.y2=t.y2}const m=[parseInt((r.x2+r.x1)/2)-500,parseInt((r.y2+r.y1)/2)-500];return(o.sequence?"𝠀"+o.sequence.join(""):"")+o.box+e([c[0]-m[0],c[1]-m[1]])+o.spatials.map((t=>t.symbol+e([t.coord[0]-m[0],t.coord[1]-m[1]]))).join("")+(o.style||"")}},t.signPng=t=>{const e=function(t){const e=w(t);if(e.spatials){const t=document.createElement("canvas"),o=t.getContext("2d");let i=f(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 d=1;"x"!=i.zoom&&(d=i.zoom);let m=(n-l)*d,p=(a-s)*d;t.width=m||1,t.height=p||1,i.background&&(o.rect(0,0,m,p),o.fillStyle=i.background,o.fill());const g=i.detail&&i.detail[0]||"black",u=i.detail&&i.detail[1]||"white";return e.spatials.forEach((t=>{let e=g;t.detail?e=t.detail[0]:i.colorize&&(e=C(t.symbol));let n=u;t.detail&&t.detail[1]&&(n=t.detail[1]),o.font=30*d+"px 'SuttonSignWritingFill'",o.fillStyle=n,o.fillText(c(t.symbol),(t.coord[0]-l)*d,(t.coord[1]-s)*d),o.font=30*d+"px 'SuttonSignWritingLine'",o.fillStyle=e,o.fillText(r(t.symbol),(t.coord[0]-l)*d,(t.coord[1]-s)*d)})),t}}(t),o=e.toDataURL("image/png");return e.remove(),o},t.signSvg=t=>{let e=w(t);if(e.spatials){let o=f(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 d="";o.id&&(d=` id="${o.id}"`),o.padding&&(i-=o.padding,l-=o.padding,s+=o.padding,n+=o.padding);let r="";"x"!=o.zoom&&(r=` width="${(s-i)*(o.zoom?o.zoom:1)}" height="${(n-l)*(o.zoom?o.zoom:1)}"`);let c=`<svg${a}${d} version="1.1" xmlns="http://www.w3.org/2000/svg"${r} viewBox="${i} ${l} ${s-i} ${n-l}">\n`;return c+=Z(t),c+="\n</svg>",c}return'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>'},t.signSvgBody=Z,t.symbolFill=c,t.symbolLine=r,t.symbolNormalize=t=>{const o=z(t);if(!o.symbol)return null;{let t=n(o.symbol);if(t)return`${o.symbol}${e([500-parseInt((t[0]+1)/2),500-parseInt((t[1]+1)/2)])}${o.style||""}`}},t.symbolPng=t=>{const e=function(t){const e=z(t);if(e.symbol){let t=n(e.symbol);if(t){const o=document.createElement("canvas"),i=o.getContext("2d");let l=f(e.style),s="black";l.colorize?s=C(e.symbol):l.detail&&(s=l.detail[0]);let n=l.detail&&l.detail[1]||"white",a=500,d=a+t[0],m=500,p=m+t[1];l.padding&&(a-=l.padding,m-=l.padding,d+=l.padding,p+=l.padding);let g=1;"x"!=l.zoom&&(g=l.zoom);let u=(d-a)*g,y=(p-m)*g;return o.width=u||1,o.height=y||1,l.background&&(i.rect(0,0,u,y),i.fillStyle=l.background,i.fill()),i.font=30*g+"px 'SuttonSignWritingFill'",i.fillStyle=n,i.fillText(c(e.symbol),(500-a)*g,(500-m)*g),i.font=30*g+"px 'SuttonSignWritingLine'",i.fillStyle=s,i.fillText(r(e.symbol),(500-a)*g,(500-m)*g),o}}}(t),o=e.toDataURL("image/png");return e.remove(),o},t.symbolSize=n,t.symbolSvg=t=>{const e=z(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,s,a,d=f(e.style);if(e.coord)i=e.coord[0],l=e.coord[1],s=500-i+500,a=500-l+500;else{let t=n(e.symbol);if(!t)return o;i=parseInt(500-t[0]/2),l=parseInt(500-t[1]/2),s=i+t[0],a=l+t[1]}let r="";d.classes&&(r=` class="${d.classes}"`);let c="";d.id&&(c=` id="${d.id}"`),d.padding&&(i-=d.padding,l-=d.padding,s+=d.padding,a+=d.padding);let m="";return"x"!=d.zoom&&(m=` width="${(s-i)*(d.zoom?d.zoom:1)}" height="${(a-l)*(d.zoom?d.zoom:1)}"`),`<svg${r}${c} version="1.1" xmlns="http://www.w3.org/2000/svg"${m} viewBox="${i} ${l} ${s-i} ${a-l}">\n${P(t)}\n</svg>`},t.symbolSvgBody=P,t.symbolText=m,Object.defineProperty(t,"__esModule",{value:!0})}));