UNPKG

@digital-blueprint/esign-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/esign-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/esign-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/esign-app/) | [Esign Bundle](https://gitlab.tugraz.

50 lines (49 loc) 7.47 kB
/*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: BSD-3-Clause * @dbp-toolkit/app-shell: LGPL-2.1-or-later * @dbp-toolkit/common: LGPL-2.1-or-later * @dbp-toolkit/language-select: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * path-to-regexp: MIT * universal-router: MIT * generateUrls: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later * @tugraz/web-components: LGPL-2.1-or-later * @digital-blueprint/annotpdf: MIT * lit-html: BSD-3-Clause * pdfjs-dist: Apache-2.0 * @popperjs/core: MIT * tippy.js: MIT * @dbp-toolkit/tooltip: LGPL-2.1-or-later * @dbp-toolkit/file-handling: LGPL-2.1-or-later * @dbp-toolkit/tabulator-table: LGPL-2.1-or-later * webdav: MIT * tabulator-tables: MIT * jose: MIT * file-saver: MIT * jquery: MIT * select2: MIT * @dbp-toolkit/resource-select: LGPL-2.1-or-later * xlsx: Apache-2.0 * @babel/runtime: MIT * fflate: MIT * jspdf: MIT * jspdf-autotable: MIT * i18next: MIT * @lit/reactive-element: BSD-3-Clause * lit-element: BSD-3-Clause * @open-wc/dedupe-mixin: MIT * @open-wc/scoped-elements: MIT * dialog-polyfill: BSD * keycloak-js: Apache-2.0 * fabric: MIT * jszip: (MIT OR GPL-3.0-or-later) * path2d: MIT */ var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},e=/([astvzqmhlc])([^astvzqmhlc]*)/gi,n=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function a(a){const o=[],r=String(a).trim();return"M"!==r[0]&&"m"!==r[0]||r.replace(e,((e,a,r)=>{const s=function(t){const e=t.match(n);return e?e.map(Number):[]}(r);let c=a.toLowerCase(),i=a;if("m"===c&&s.length>2&&(o.push([i,...s.splice(0,2)]),c="l",i="m"===i?"l":"L"),s.length<t[c])return"";for(o.push([i,...s.splice(0,t[c])]);s.length>=t[c]&&s.length&&t[c];)o.push([i,...s.splice(0,t[c])]);return""})),o}function o(t,e){const n=t.x*Math.cos(e)-t.y*Math.sin(e),a=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=n,t.y=a}function r(t,e){t.x*=e,t.y*=e}var s=class t{constructor(e){this.commands=[],e&&e instanceof t?this.commands.push(...e.commands):e&&(this.commands=a(e))}addPath(e){e&&e instanceof t&&this.commands.push(...e.commands)}moveTo(t,e){this.commands.push(["M",t,e])}lineTo(t,e){this.commands.push(["L",t,e])}arc(t,e,n,a,o,r){this.commands.push(["AC",t,e,n,a,o,!!r])}arcTo(t,e,n,a,o){this.commands.push(["AT",t,e,n,a,o])}ellipse(t,e,n,a,o,r,s,c){this.commands.push(["E",t,e,n,a,o,r,s,!!c])}closePath(){this.commands.push(["Z"])}bezierCurveTo(t,e,n,a,o,r){this.commands.push(["C",t,e,n,a,o,r])}quadraticCurveTo(t,e,n,a){this.commands.push(["Q",t,e,n,a])}rect(t,e,n,a){this.commands.push(["R",t,e,n,a])}roundRect(t,e,n,a,o){void 0===o?this.commands.push(["RR",t,e,n,a,0]):this.commands.push(["RR",t,e,n,a,o])}};function c(t,e){let n,a,s,c,i,h,l,u,m,p,d,y,f,T,x,b,v,k,M,g,R,C=0,z=0,q=null,w=null,P=null,A=null,E=null,$=null;t.beginPath();for(let S=0;S<e.length;++S){let F;switch(k=e[S][0],"S"!==k&&"s"!==k&&"C"!==k&&"c"!==k&&(q=null,w=null),"T"!==k&&"t"!==k&&"Q"!==k&&"q"!==k&&(P=null,A=null),k){case"m":case"M":F=e[S],"m"===k?(C+=F[1],z+=F[2]):(C=F[1],z=F[2]),"M"!==k&&E||(E={x:C,y:z}),t.moveTo(C,z);break;case"l":F=e[S],C+=F[1],z+=F[2],t.lineTo(C,z);break;case"L":F=e[S],C=F[1],z=F[2],t.lineTo(C,z);break;case"H":F=e[S],C=F[1],t.lineTo(C,z);break;case"h":F=e[S],C+=F[1],t.lineTo(C,z);break;case"V":F=e[S],z=F[1],t.lineTo(C,z);break;case"v":F=e[S],z+=F[1],t.lineTo(C,z);break;case"a":case"A":if(F=e[S],null===$)throw new Error("This should never happen");"a"===k?(C+=F[6],z+=F[7]):(C=F[6],z=F[7]),T=F[1],x=F[2],l=F[3]*Math.PI/180,s=!!F[4],c=!!F[5],i={x:C,y:z},h={x:($.x-i.x)/2,y:($.y-i.y)/2},o(h,-l),u=h.x*h.x/(T*T)+h.y*h.y/(x*x),u>1&&(u=Math.sqrt(u),T*=u,x*=u),M={x:T*h.y/x,y:-x*h.x/T},m=T*T*x*x,p=T*T*h.y*h.y+x*x*h.x*h.x,r(M,c!==s?Math.sqrt((m-p)/p)||0:-Math.sqrt((m-p)/p)||0),a=Math.atan2((h.y-M.y)/x,(h.x-M.x)/T),n=Math.atan2(-(h.y+M.y)/x,-(h.x+M.x)/T),o(M,l),I=M,L=(i.x+$.x)/2,Q=(i.y+$.y)/2,I.x+=L,I.y+=Q,t.save(),t.translate(M.x,M.y),t.rotate(l),t.scale(T,x),t.arc(0,0,1,a,n,!c),t.restore();break;case"C":F=e[S],q=F[3],w=F[4],C=F[5],z=F[6],t.bezierCurveTo(F[1],F[2],q,w,C,z);break;case"c":F=e[S],t.bezierCurveTo(F[1]+C,F[2]+z,F[3]+C,F[4]+z,F[5]+C,F[6]+z),q=F[3]+C,w=F[4]+z,C+=F[5],z+=F[6];break;case"S":F=e[S],null!==q&&null!==w||(q=C,w=z),t.bezierCurveTo(2*C-q,2*z-w,F[1],F[2],F[3],F[4]),q=F[1],w=F[2],C=F[3],z=F[4];break;case"s":F=e[S],null!==q&&null!==w||(q=C,w=z),t.bezierCurveTo(2*C-q,2*z-w,F[1]+C,F[2]+z,F[3]+C,F[4]+z),q=F[1]+C,w=F[2]+z,C+=F[3],z+=F[4];break;case"Q":F=e[S],P=F[1],A=F[2],C=F[3],z=F[4],t.quadraticCurveTo(P,A,C,z);break;case"q":F=e[S],P=F[1]+C,A=F[2]+z,C+=F[3],z+=F[4],t.quadraticCurveTo(P,A,C,z);break;case"T":F=e[S],null!==P&&null!==A||(P=C,A=z),P=2*C-P,A=2*z-A,C=F[1],z=F[2],t.quadraticCurveTo(P,A,C,z);break;case"t":F=e[S],null!==P&&null!==A||(P=C,A=z),P=2*C-P,A=2*z-A,C+=F[1],z+=F[2],t.quadraticCurveTo(P,A,C,z);break;case"z":case"Z":E&&(C=E.x,z=E.y),E=null,t.closePath();break;case"AC":F=e[S],C=F[1],z=F[2],f=F[3],a=F[4],n=F[5],g=F[6],t.arc(C,z,f,a,n,g);break;case"AT":F=e[S],d=F[1],y=F[2],C=F[3],z=F[4],f=F[5],t.arcTo(d,y,C,z,f);break;case"E":F=e[S],C=F[1],z=F[2],T=F[3],x=F[4],l=F[5],a=F[6],n=F[7],g=F[8],t.save(),t.translate(C,z),t.rotate(l),t.scale(T,x),t.arc(0,0,1,a,n,g),t.restore();break;case"R":F=e[S],C=F[1],z=F[2],b=F[3],v=F[4],E={x:C,y:z},t.rect(C,z,b,v);break;case"RR":F=e[S],C=F[1],z=F[2],b=F[3],v=F[4],R=F[5],E={x:C,y:z},t.roundRect(C,z,b,v,R);break;default:throw new Error(`Invalid path command: ${k}`)}$?($.x=C,$.y=z):$={x:C,y:z}}var I,L,Q}function i(t,e,n,a,o=0){if("number"==typeof o&&(o=[o]),!Array.isArray(o))return;if(0===o.length||o.length>4)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': ${o.length} radii provided. Between one and four radii are necessary.`);if(o.forEach((t=>{if(t<0)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${t} is negative.`)})),1===o.length&&0===o[0])return void this.rect(t,e,n,a);const r=Math.min(n,a)/2,s=Math.min(r,o[0]);let c=s,i=s,h=s;2===o.length&&(c=Math.min(r,o[1]),h=c),3===o.length&&(c=Math.min(r,o[1]),h=c,i=Math.min(r,o[2])),4===o.length&&(c=Math.min(r,o[1]),i=Math.min(r,o[2]),h=Math.min(r,o[3])),this.moveTo(t,e+a-h),this.arcTo(t,e,t+s,e,s),this.arcTo(t+n,e,t+n,e+c,c),this.arcTo(t+n,e+a,t+n-i,e+a,i),this.arcTo(t,e+a,t,e+a-h,h),this.moveTo(t,e)}function h(t){if(!t)return;const e=t.prototype.clip,n=t.prototype.fill,a=t.prototype.stroke,o=t.prototype.isPointInPath;t.prototype.clip=function(...t){if(t[0]instanceof s){const n=t[0],a=t[1]||"nonzero";return c(this,n.commands),e.apply(this,[a])}const n=t[0]||"nonzero";return e.apply(this,[n])},t.prototype.fill=function(...t){if(t[0]instanceof s){const e=t[0],a=t[1]||"nonzero";return c(this,e.commands),n.apply(this,[a])}const e=t[0]||"nonzero";return n.apply(this,[e])},t.prototype.stroke=function(t){t&&c(this,t.commands),a.apply(this)},t.prototype.isPointInPath=function(...t){if(t[0]instanceof s){const e=t[0],n=t[1],a=t[2],r=t[3]||"nonzero";return c(this,e.commands),o.apply(this,[n,a,r])}return o.apply(this,t)}}function l(t){t&&!t.prototype.roundRect&&(t.prototype.roundRect=i)}function u(t){t&&!t.prototype.roundRect&&(t.prototype.roundRect=i)}export{s as Path2D,h as applyPath2DToCanvasRenderingContext,l as applyRoundRectToCanvasRenderingContext2D,u as applyRoundRectToPath2D,c as buildPath,a as parsePath,i as roundRect}; //# sourceMappingURL=index._uCmXYzA.es.js.map