tt-pdf-generator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +398 -0
- package/dist/package.json +45 -0
- package/dist/pdf-generator.browser.js +14 -0
- package/dist/pdf-generator.browser.js.map +7 -0
- package/dist/pdf-generator.d.ts +15 -0
- package/dist/pdf-generator.esm.js +14 -0
- package/dist/pdf-generator.esm.js.map +7 -0
- package/package.json +114 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface GeneratePdfOptions {
|
|
2
|
+
template: string;
|
|
3
|
+
data: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export declare function generatePdf(
|
|
7
|
+
template: string,
|
|
8
|
+
data: string,
|
|
9
|
+
): Promise<Buffer>;
|
|
10
|
+
|
|
11
|
+
// For browser usage, you might want to return ArrayBuffer instead
|
|
12
|
+
export declare function generatePdfBrowser(
|
|
13
|
+
template: string,
|
|
14
|
+
data: string,
|
|
15
|
+
): Promise<ArrayBuffer>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var In=Object.create;var vt=Object.defineProperty;var Bn=Object.getOwnPropertyDescriptor;var Pn=Object.getOwnPropertyNames;var Mn=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var kn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pn(e))!Nn.call(t,o)&&o!==r&&vt(t,o,{get:()=>e[o],enumerable:!(n=Bn(e,o))||n.enumerable});return t};var K=(t,e,r)=>(r=t!=null?In(Mn(t)):{},kn(e||!t||!t.__esModule?vt(r,"default",{value:t,enumerable:!0}):r,t));var Nt=p((hi,Mt)=>{function Fn(t){this.value=t,this.match=function(e){return this.value>=e.height}}function Dn(t){this.value=t,this.match=function(e){return this.value<e.height}}function On(t){this.value=t,this.match=function(e){return this.value>=e.width}}function _n(t){this.value=t,this.match=function(e){return this.value<e.width}}function $n(t){this.value=t,this.match=function(e){return this.value===e.orientation}}Mt.exports=function(e,r){switch(e){case"max-height":return new Fn(r);case"min-height":return new Dn(r);case"max-width":return new On(r);case"min-width":return new _n(r);case"orientation":return new $n(r);default:throw new Error(r)}}});var Lt=p((pi,kt)=>{function Un(t,e){this.left=t,this.right=e,this.match=function(r){return t.match(r)&&e.match(r)}}function qn(t,e){this.left=t,this.right=e,this.match=function(r){return t.match(r)||e.match(r)}}kt.exports=function(e,r,n){switch(e){case"and":return new Un(r,n);case",":return new qn(r,n);default:throw new Error(value)}}});var _t=p((gi,Ot)=>{var Vn=Nt(),jn=Lt(),Ft=/[0-9]/,_e=/[a-z|\-]/i,zn=/\s/,Dt=/:/,Hn=/,/,Wn=/and$/,Yn=/@/;function Jn(t){for(var e=0,r=[];e<t.length;){var n=t[e];if(Yn.test(n))for(n=t[++e];_e.test(n)&&n!==void 0;)n=t[++e];if(zn.test(n)||n===")"||n==="("){e++;continue}if(Dt.test(n)||Hn.test(n)){e++,r.push({type:"operator",value:n});continue}if(Ft.test(n)){for(var o="";Ft.test(n);)o+=n,n=t[++e];r.push({type:"number",value:o});continue}if(_e.test(n)){for(var o="";_e.test(n)&&n!==void 0;)o+=n,n=t[++e];Wn.test(o)?r.push({type:"operator",value:o}):r.push({type:"literal",value:o});continue}throw new TypeError("Tokenizer: I dont know what this character is: "+n)}return r}function Kn(t){for(var e=[],r=[];t.length>0;){var n=t.shift();if(n.type==="number"||n.type==="literal"){e.push(n);continue}if(n.type==="operator"){if(Dt.test(n.value)){n={type:"query",key:e.pop(),value:t.shift()},e.push(n);continue}for(;r.length>0;)e.unshift(r.pop());r.push(n)}}for(;r.length>0;)e.unshift(r.pop());function o(){var i=e.shift();if(i.type==="number")return parseInt(i.value);if(i.type==="literal")return i.value;if(i.type==="operator"){var s=o(),a=o();return jn(i.value,s,a)}if(i.type==="query"){var s=i.key.value,a=i.value.value;return Vn(s,a)}}return o()}Ot.exports={parse:function(t){var e=Jn(t),r=Kn(e);return r}}});var Ut=p((mi,$t)=>{var Qn=_t();$t.exports=function(t,e){var r={};return Object.keys(t).forEach(function(n){Qn.parse(n).match(e)&&Object.assign(r,t[n])}),r}});var Vt=p((yi,qt)=>{var Gn=function(t,e,r){if(t==null)return[0,0,0];var n=(1-Math.abs(2*r-1))*e,o=t/60,i=n*(1-Math.abs(o%2-1));o=Math.floor(o);var s,a,l;o===0?(s=n,a=i,l=0):o===1?(s=i,a=n,l=0):o===2?(s=0,a=n,l=i):o===3?(s=0,a=i,l=n):o===4?(s=i,a=0,l=n):o===5&&(s=n,a=0,l=i);var u=r-n/2;return s+=u,a+=u,l+=u,[Math.abs(Math.round(s*255)),Math.abs(Math.round(a*255)),Math.abs(Math.round(l*255))]};qt.exports=Gn});var zt=p((bi,jt)=>{var Xn=Vt();function $e(t,e){return t>e?e:t}function Ue(t,e){return t<e?e:t}function Zn(t){for(t=$e(t,1e7),t=Ue(t,-1e7);t<0;)t+=360;for(;t>359;)t-=360;return t}function eo(t,e,r){t=Zn(t),e=Ue($e(e,100),0),r=Ue($e(r,100),0),e/=100,r/=100;var n=Xn(t,e,r);return"#"+n.map(function(o){return(256+o).toString(16).substr(-2)}).join("")}jt.exports=eo});var Wt=p((wi,Ht)=>{"use strict";Ht.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Jt=p((Ci,Yt)=>{Yt.exports=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}});var Gt=p((Ei,Qt)=>{"use strict";var to=Jt(),ro=Array.prototype.concat,no=Array.prototype.slice,Kt=Qt.exports=function(e){for(var r=[],n=0,o=e.length;n<o;n++){var i=e[n];to(i)?r=ro.call(r,no.call(i)):r.push(i)}return r};Kt.wrap=function(t){return function(){return t(Kt(arguments))}}});var tr=p((Ai,er)=>{var ne=Wt(),oe=Gt(),Xt=Object.hasOwnProperty,Zt=Object.create(null);for(pe in ne)Xt.call(ne,pe)&&(Zt[ne[pe]]=pe);var pe,R=er.exports={to:{},get:{}};R.get=function(t){var e=t.substring(0,3).toLowerCase(),r,n;switch(e){case"hsl":r=R.get.hsl(t),n="hsl";break;case"hwb":r=R.get.hwb(t),n="hwb";break;default:r=R.get.rgb(t),n="rgb";break}return r?{model:n,value:r}:null};R.get.rgb=function(t){if(!t)return null;var e=/^#([a-f0-9]{3,4})$/i,r=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,s=[0,0,0,1],a,l,u;if(a=t.match(r)){for(u=a[2],a=a[1],l=0;l<3;l++){var d=l*2;s[l]=parseInt(a.slice(d,d+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(a=t.match(e)){for(a=a[1],u=a[3],l=0;l<3;l++)s[l]=parseInt(a[l]+a[l],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(a=t.match(n)){for(l=0;l<3;l++)s[l]=parseInt(a[l+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=t.match(o)){for(l=0;l<3;l++)s[l]=Math.round(parseFloat(a[l+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=t.match(i))?a[1]==="transparent"?[0,0,0,0]:Xt.call(ne,a[1])?(s=ne[a[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=F(s[l],0,255);return s[3]=F(s[3],0,1),s};R.get.hsl=function(t){if(!t)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=F(parseFloat(r[2]),0,100),s=F(parseFloat(r[3]),0,100),a=F(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};R.get.hwb=function(t){if(!t)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=F(parseFloat(r[2]),0,100),s=F(parseFloat(r[3]),0,100),a=F(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};R.to.hex=function(){var t=oe(arguments);return"#"+ge(t[0])+ge(t[1])+ge(t[2])+(t[3]<1?ge(Math.round(t[3]*255)):"")};R.to.rgb=function(){var t=oe(arguments);return t.length<4||t[3]===1?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"};R.to.rgb.percent=function(){var t=oe(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||t[3]===1?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"};R.to.hsl=function(){var t=oe(arguments);return t.length<4||t[3]===1?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"};R.to.hwb=function(){var t=oe(arguments),e="";return t.length>=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};R.to.keyword=function(t){return Zt[t.slice(0,3)]};function F(t,e,r){return Math.min(Math.max(e,t),r)}function ge(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}});var nr=p((xi,rr)=>{var qe=40,Ve=41,me=39,je=34,ze=92,Q=47,He=44,We=58,ye=42,oo=117,so=85,io=43,ao=/^[a-f0-9?-]+$/i;rr.exports=function(t){for(var e=[],r=t,n,o,i,s,a,l,u,d,c=0,f=r.charCodeAt(c),m=r.length,y=[{nodes:e}],g=0,h,S="",I="",B="";c<m;)if(f<=32){n=c;do n+=1,f=r.charCodeAt(n);while(f<=32);s=r.slice(c,n),i=e[e.length-1],f===Ve&&g?B=s:i&&i.type==="div"?(i.after=s,i.sourceEndIndex+=s.length):f===He||f===We||f===Q&&r.charCodeAt(n+1)!==ye&&(!h||h&&h.type==="function"&&h.value!=="calc")?I=s:e.push({type:"space",sourceIndex:c,sourceEndIndex:n,value:s}),c=n}else if(f===me||f===je){n=c,o=f===me?"'":'"',s={type:"string",sourceIndex:c,quote:o};do if(a=!1,n=r.indexOf(o,n+1),~n)for(l=n;r.charCodeAt(l-1)===ze;)l-=1,a=!a;else r+=o,n=r.length-1,s.unclosed=!0;while(a);s.value=r.slice(c+1,n),s.sourceEndIndex=s.unclosed?n:n+1,e.push(s),c=n+1,f=r.charCodeAt(c)}else if(f===Q&&r.charCodeAt(c+1)===ye)n=r.indexOf("*/",c),s={type:"comment",sourceIndex:c,sourceEndIndex:n+2},n===-1&&(s.unclosed=!0,n=r.length,s.sourceEndIndex=n),s.value=r.slice(c+2,n),e.push(s),c=n+2,f=r.charCodeAt(c);else if((f===Q||f===ye)&&h&&h.type==="function"&&h.value==="calc")s=r[c],e.push({type:"word",sourceIndex:c-I.length,sourceEndIndex:c+s.length,value:s}),c+=1,f=r.charCodeAt(c);else if(f===Q||f===He||f===We)s=r[c],e.push({type:"div",sourceIndex:c-I.length,sourceEndIndex:c+s.length,value:s,before:I,after:""}),I="",c+=1,f=r.charCodeAt(c);else if(qe===f){n=c;do n+=1,f=r.charCodeAt(n);while(f<=32);if(d=c,s={type:"function",sourceIndex:c-S.length,value:S,before:r.slice(d+1,n)},c=n,S==="url"&&f!==me&&f!==je){n-=1;do if(a=!1,n=r.indexOf(")",n+1),~n)for(l=n;r.charCodeAt(l-1)===ze;)l-=1,a=!a;else r+=")",n=r.length-1,s.unclosed=!0;while(a);u=n;do u-=1,f=r.charCodeAt(u);while(f<=32);d<u?(c!==u+1?s.nodes=[{type:"word",sourceIndex:c,sourceEndIndex:u+1,value:r.slice(c,u+1)}]:s.nodes=[],s.unclosed&&u+1!==n?(s.after="",s.nodes.push({type:"space",sourceIndex:u+1,sourceEndIndex:n,value:r.slice(u+1,n)})):(s.after=r.slice(u+1,n),s.sourceEndIndex=n)):(s.after="",s.nodes=[]),c=n+1,s.sourceEndIndex=s.unclosed?n:c,f=r.charCodeAt(c),e.push(s)}else g+=1,s.after="",s.sourceEndIndex=c+1,e.push(s),y.push(s),e=s.nodes=[],h=s;S=""}else if(Ve===f&&g)c+=1,f=r.charCodeAt(c),h.after=B,h.sourceEndIndex+=B.length,B="",g-=1,y[y.length-1].sourceEndIndex=c,y.pop(),h=y[g],e=h.nodes;else{n=c;do f===ze&&(n+=1),n+=1,f=r.charCodeAt(n);while(n<m&&!(f<=32||f===me||f===je||f===He||f===We||f===Q||f===qe||f===ye&&h&&h.type==="function"&&h.value==="calc"||f===Q&&h.type==="function"&&h.value==="calc"||f===Ve&&g));s=r.slice(c,n),qe===f?S=s:(oo===s.charCodeAt(0)||so===s.charCodeAt(0))&&io===s.charCodeAt(1)&&ao.test(s.slice(2))?e.push({type:"unicode-range",sourceIndex:c,sourceEndIndex:n,value:s}):e.push({type:"word",sourceIndex:c,sourceEndIndex:n,value:s}),c=n}for(c=y.length-1;c;c-=1)y[c].unclosed=!0,y[c].sourceEndIndex=r.length;return y[0].nodes}});var sr=p((Ti,or)=>{var be=45,we=43,Ye=46,lo=101,co=69;function uo(t){var e=t.charCodeAt(0),r;if(e===we||e===be){if(r=t.charCodeAt(1),r>=48&&r<=57)return!0;var n=t.charCodeAt(2);return r===Ye&&n>=48&&n<=57}return e===Ye?(r=t.charCodeAt(1),r>=48&&r<=57):e>=48&&e<=57}or.exports=function(t){var e=0,r=t.length,n,o,i;if(r===0||!uo(t))return!1;for(n=t.charCodeAt(e),(n===we||n===be)&&e++;e<r&&(n=t.charCodeAt(e),!(n<48||n>57));)e+=1;if(n=t.charCodeAt(e),o=t.charCodeAt(e+1),n===Ye&&o>=48&&o<=57)for(e+=2;e<r&&(n=t.charCodeAt(e),!(n<48||n>57));)e+=1;if(n=t.charCodeAt(e),o=t.charCodeAt(e+1),i=t.charCodeAt(e+2),(n===lo||n===co)&&(o>=48&&o<=57||(o===we||o===be)&&i>=48&&i<=57))for(e+=o===we||o===be?3:2;e<r&&(n=t.charCodeAt(e),!(n<48||n>57));)e+=1;return{number:t.slice(0,e),unit:t.slice(e)}}});var wr=p((Ni,br)=>{br.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var _=p(j=>{var tt,ss=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];j.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};j.getSymbolTotalCodewords=function(e){return ss[e]};j.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};j.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');tt=e};j.isKanjiModeEnabled=function(){return typeof tt<"u"};j.toSJIS=function(e){return tt(e)}});var Se=p(v=>{v.L={bit:1};v.M={bit:0};v.Q={bit:3};v.H={bit:2};function is(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return v.L;case"m":case"medium":return v.M;case"q":case"quartile":return v.Q;case"h":case"high":return v.H;default:throw new Error("Unknown EC Level: "+t)}}v.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};v.from=function(e,r){if(v.isValid(e))return e;try{return is(e)}catch{return r}}});var Ar=p((Fi,Er)=>{function Cr(){this.buffer=[],this.length=0}Cr.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Er.exports=Cr});var Tr=p((Di,xr)=>{function se(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}se.prototype.set=function(t,e,r,n){let o=t*this.size+e;this.data[o]=r,n&&(this.reservedBit[o]=!0)};se.prototype.get=function(t,e){return this.data[t*this.size+e]};se.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};se.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};xr.exports=se});var Sr=p(Re=>{var as=_().getSymbolSize;Re.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=as(e),o=n===145?26:Math.ceil((n-13)/(2*r-2))*2,i=[n-7];for(let s=1;s<r-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};Re.getPositions=function(e){let r=[],n=Re.getRowColCoords(e),o=n.length;for(let i=0;i<o;i++)for(let s=0;s<o;s++)i===0&&s===0||i===0&&s===o-1||i===o-1&&s===0||r.push([n[i],n[s]]);return r}});var Ir=p(vr=>{var ls=_().getSymbolSize,Rr=7;vr.getPositions=function(e){let r=ls(e);return[[0,0],[r-Rr,0],[0,r-Rr]]}});var Br=p(C=>{C.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var z={N1:3,N2:3,N3:40,N4:10};C.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};C.from=function(e){return C.isValid(e)?parseInt(e,10):void 0};C.getPenaltyN1=function(e){let r=e.size,n=0,o=0,i=0,s=null,a=null;for(let l=0;l<r;l++){o=i=0,s=a=null;for(let u=0;u<r;u++){let d=e.get(l,u);d===s?o++:(o>=5&&(n+=z.N1+(o-5)),s=d,o=1),d=e.get(u,l),d===a?i++:(i>=5&&(n+=z.N1+(i-5)),a=d,i=1)}o>=5&&(n+=z.N1+(o-5)),i>=5&&(n+=z.N1+(i-5))}return n};C.getPenaltyN2=function(e){let r=e.size,n=0;for(let o=0;o<r-1;o++)for(let i=0;i<r-1;i++){let s=e.get(o,i)+e.get(o,i+1)+e.get(o+1,i)+e.get(o+1,i+1);(s===4||s===0)&&n++}return n*z.N2};C.getPenaltyN3=function(e){let r=e.size,n=0,o=0,i=0;for(let s=0;s<r;s++){o=i=0;for(let a=0;a<r;a++)o=o<<1&2047|e.get(s,a),a>=10&&(o===1488||o===93)&&n++,i=i<<1&2047|e.get(a,s),a>=10&&(i===1488||i===93)&&n++}return n*z.N3};C.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let i=0;i<n;i++)r+=e.data[i];return Math.abs(Math.ceil(r*100/n/5)-10)*z.N4};function cs(t,e,r){switch(t){case C.Patterns.PATTERN000:return(e+r)%2===0;case C.Patterns.PATTERN001:return e%2===0;case C.Patterns.PATTERN010:return r%3===0;case C.Patterns.PATTERN011:return(e+r)%3===0;case C.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case C.Patterns.PATTERN101:return e*r%2+e*r%3===0;case C.Patterns.PATTERN110:return(e*r%2+e*r%3)%2===0;case C.Patterns.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}C.applyMask=function(e,r){let n=r.size;for(let o=0;o<n;o++)for(let i=0;i<n;i++)r.isReserved(i,o)||r.xor(i,o,cs(e,i,o))};C.getBestMask=function(e,r){let n=Object.keys(C.Patterns).length,o=0,i=1/0;for(let s=0;s<n;s++){r(s),C.applyMask(s,e);let a=C.getPenaltyN1(e)+C.getPenaltyN2(e)+C.getPenaltyN3(e)+C.getPenaltyN4(e);C.applyMask(s,e),a<i&&(i=a,o=s)}return o}});var nt=p(rt=>{var $=Se(),ve=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ie=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];rt.getBlocksCount=function(e,r){switch(r){case $.L:return ve[(e-1)*4+0];case $.M:return ve[(e-1)*4+1];case $.Q:return ve[(e-1)*4+2];case $.H:return ve[(e-1)*4+3];default:return}};rt.getTotalCodewordsCount=function(e,r){switch(r){case $.L:return Ie[(e-1)*4+0];case $.M:return Ie[(e-1)*4+1];case $.Q:return Ie[(e-1)*4+2];case $.H:return Ie[(e-1)*4+3];default:return}}});var Pr=p(Pe=>{var ie=new Uint8Array(512),Be=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)ie[r]=e,Be[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)ie[r]=ie[r-255]})();Pe.log=function(e){if(e<1)throw new Error("log("+e+")");return Be[e]};Pe.exp=function(e){return ie[e]};Pe.mul=function(e,r){return e===0||r===0?0:ie[Be[e]+Be[r]]}});var Mr=p(ae=>{var ot=Pr();ae.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<r.length;i++)n[o+i]^=ot.mul(e[o],r[i]);return n};ae.mod=function(e,r){let n=new Uint8Array(e);for(;n.length-r.length>=0;){let o=n[0];for(let s=0;s<r.length;s++)n[s]^=ot.mul(r[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};ae.generateECPolynomial=function(e){let r=new Uint8Array([1]);for(let n=0;n<e;n++)r=ae.mul(r,new Uint8Array([1,ot.exp(n)]));return r}});var Lr=p((ji,kr)=>{var Nr=Mr();function st(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}st.prototype.initialize=function(e){this.degree=e,this.genPoly=Nr.generateECPolynomial(this.degree)};st.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=Nr.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){let i=new Uint8Array(this.degree);return i.set(n,o),i}return n};kr.exports=st});var it=p(Fr=>{Fr.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var at=p(L=>{var Dr="[0-9]+",us="[A-Z $%*+\\-./:]+",le="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";le=le.replace(/u/g,"\\u");var ds="(?:(?![A-Z0-9 $%*+\\-./:]|"+le+`)(?:.|[\r
|
|
2
|
+
]))+`;L.KANJI=new RegExp(le,"g");L.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");L.BYTE=new RegExp(ds,"g");L.NUMERIC=new RegExp(Dr,"g");L.ALPHANUMERIC=new RegExp(us,"g");var fs=new RegExp("^"+le+"$"),hs=new RegExp("^"+Dr+"$"),ps=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");L.testKanji=function(e){return fs.test(e)};L.testNumeric=function(e){return hs.test(e)};L.testAlphanumeric=function(e){return ps.test(e)}});var U=p(A=>{var gs=it(),lt=at();A.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};A.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};A.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};A.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};A.MIXED={bit:-1};A.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!gs.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};A.getBestModeForData=function(e){return lt.testNumeric(e)?A.NUMERIC:lt.testAlphanumeric(e)?A.ALPHANUMERIC:lt.testKanji(e)?A.KANJI:A.BYTE};A.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};A.isValid=function(e){return e&&e.bit&&e.ccBits};function ms(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return A.NUMERIC;case"alphanumeric":return A.ALPHANUMERIC;case"kanji":return A.KANJI;case"byte":return A.BYTE;default:throw new Error("Unknown mode: "+t)}}A.from=function(e,r){if(A.isValid(e))return e;try{return ms(e)}catch{return r}}});var qr=p(H=>{var Me=_(),ys=nt(),Or=Se(),q=U(),ct=it(),$r=7973,_r=Me.getBCHDigit($r);function bs(t,e,r){for(let n=1;n<=40;n++)if(e<=H.getCapacity(n,r,t))return n}function Ur(t,e){return q.getCharCountIndicator(t,e)+4}function ws(t,e){let r=0;return t.forEach(function(n){let o=Ur(n.mode,e);r+=o+n.getBitsLength()}),r}function Cs(t,e){for(let r=1;r<=40;r++)if(ws(t,r)<=H.getCapacity(r,e,q.MIXED))return r}H.from=function(e,r){return ct.isValid(e)?parseInt(e,10):r};H.getCapacity=function(e,r,n){if(!ct.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=q.BYTE);let o=Me.getSymbolTotalCodewords(e),i=ys.getTotalCodewordsCount(e,r),s=(o-i)*8;if(n===q.MIXED)return s;let a=s-Ur(n,e);switch(n){case q.NUMERIC:return Math.floor(a/10*3);case q.ALPHANUMERIC:return Math.floor(a/11*2);case q.KANJI:return Math.floor(a/13);case q.BYTE:default:return Math.floor(a/8)}};H.getBestVersionForData=function(e,r){let n,o=Or.from(r,Or.M);if(Array.isArray(e)){if(e.length>1)return Cs(e,o);if(e.length===0)return 1;n=e[0]}else n=e;return bs(n.mode,n.getLength(),o)};H.getEncodedBits=function(e){if(!ct.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Me.getBCHDigit(r)-_r>=0;)r^=$r<<Me.getBCHDigit(r)-_r;return e<<12|r}});var Hr=p(zr=>{var ut=_(),jr=1335,Es=21522,Vr=ut.getBCHDigit(jr);zr.getEncodedBits=function(e,r){let n=e.bit<<3|r,o=n<<10;for(;ut.getBCHDigit(o)-Vr>=0;)o^=jr<<ut.getBCHDigit(o)-Vr;return(n<<10|o)^Es}});var Yr=p((Ki,Wr)=>{var As=U();function X(t){this.mode=As.NUMERIC,this.data=t.toString()}X.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};X.prototype.getLength=function(){return this.data.length};X.prototype.getBitsLength=function(){return X.getBitsLength(this.data.length)};X.prototype.write=function(e){let r,n,o;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),o=parseInt(n,10),e.put(o,10);let i=this.data.length-r;i>0&&(n=this.data.substr(r),o=parseInt(n,10),e.put(o,i*3+1))};Wr.exports=X});var Kr=p((Qi,Jr)=>{var xs=U(),dt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Z(t){this.mode=xs.ALPHANUMERIC,this.data=t}Z.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Z.prototype.getLength=function(){return this.data.length};Z.prototype.getBitsLength=function(){return Z.getBitsLength(this.data.length)};Z.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=dt.indexOf(this.data[r])*45;n+=dt.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(dt.indexOf(this.data[r]),6)};Jr.exports=Z});var Gr=p((Gi,Qr)=>{var Ts=U();function ee(t){this.mode=Ts.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}ee.getBitsLength=function(e){return e*8};ee.prototype.getLength=function(){return this.data.length};ee.prototype.getBitsLength=function(){return ee.getBitsLength(this.data.length)};ee.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};Qr.exports=ee});var Zr=p((Xi,Xr)=>{var Ss=U(),Rs=_();function te(t){this.mode=Ss.KANJI,this.data=t}te.getBitsLength=function(e){return e*13};te.prototype.getLength=function(){return this.data.length};te.prototype.getBitsLength=function(){return te.getBitsLength(this.data.length)};te.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=Rs.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
|
+
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};Xr.exports=te});var en=p((Zi,ft)=>{"use strict";var ce={single_source_shortest_paths:function(t,e,r){var n={},o={};o[e]=0;var i=ce.PriorityQueue.make();i.push(e,0);for(var s,a,l,u,d,c,f,m,y;!i.empty();){s=i.pop(),a=s.value,u=s.cost,d=t[a]||{};for(l in d)d.hasOwnProperty(l)&&(c=d[l],f=u+c,m=o[l],y=typeof o[l]>"u",(y||m>f)&&(o[l]=f,i.push(l,f),n[l]=a))}if(typeof r<"u"&&typeof o[r]>"u"){var g=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(g)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,o;n;)r.push(n),o=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=ce.single_source_shortest_paths(t,e,r);return ce.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=ce.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof ft<"u"&&(ft.exports=ce)});var cn=p(re=>{var w=U(),nn=Yr(),on=Kr(),sn=Gr(),an=Zr(),ue=at(),Ne=_(),vs=en();function tn(t){return unescape(encodeURIComponent(t)).length}function de(t,e,r){let n=[],o;for(;(o=t.exec(r))!==null;)n.push({data:o[0],index:o.index,mode:e,length:o[0].length});return n}function ln(t){let e=de(ue.NUMERIC,w.NUMERIC,t),r=de(ue.ALPHANUMERIC,w.ALPHANUMERIC,t),n,o;return Ne.isKanjiModeEnabled()?(n=de(ue.BYTE,w.BYTE,t),o=de(ue.KANJI,w.KANJI,t)):(n=de(ue.BYTE_KANJI,w.BYTE,t),o=[]),e.concat(r,n,o).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function ht(t,e){switch(e){case w.NUMERIC:return nn.getBitsLength(t);case w.ALPHANUMERIC:return on.getBitsLength(t);case w.KANJI:return an.getBitsLength(t);case w.BYTE:return sn.getBitsLength(t)}}function Is(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function Bs(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];switch(n.mode){case w.NUMERIC:e.push([n,{data:n.data,mode:w.ALPHANUMERIC,length:n.length},{data:n.data,mode:w.BYTE,length:n.length}]);break;case w.ALPHANUMERIC:e.push([n,{data:n.data,mode:w.BYTE,length:n.length}]);break;case w.KANJI:e.push([n,{data:n.data,mode:w.BYTE,length:tn(n.data)}]);break;case w.BYTE:e.push([{data:n.data,mode:w.BYTE,length:tn(n.data)}])}}return e}function Ps(t,e){let r={},n={start:{}},o=["start"];for(let i=0;i<t.length;i++){let s=t[i],a=[];for(let l=0;l<s.length;l++){let u=s[l],d=""+i+l;a.push(d),r[d]={node:u,lastCount:0},n[d]={};for(let c=0;c<o.length;c++){let f=o[c];r[f]&&r[f].node.mode===u.mode?(n[f][d]=ht(r[f].lastCount+u.length,u.mode)-ht(r[f].lastCount,u.mode),r[f].lastCount+=u.length):(r[f]&&(r[f].lastCount=u.length),n[f][d]=ht(u.length,u.mode)+4+w.getCharCountIndicator(u.mode,e))}}o=a}for(let i=0;i<o.length;i++)n[o[i]].end=0;return{map:n,table:r}}function rn(t,e){let r,n=w.getBestModeForData(t);if(r=w.from(e,n),r!==w.BYTE&&r.bit<n.bit)throw new Error('"'+t+'" cannot be encoded with mode '+w.toString(r)+`.
|
|
4
|
+
Suggested mode is: `+w.toString(n));switch(r===w.KANJI&&!Ne.isKanjiModeEnabled()&&(r=w.BYTE),r){case w.NUMERIC:return new nn(t);case w.ALPHANUMERIC:return new on(t);case w.KANJI:return new an(t);case w.BYTE:return new sn(t)}}re.fromArray=function(e){return e.reduce(function(r,n){return typeof n=="string"?r.push(rn(n,null)):n.data&&r.push(rn(n.data,n.mode)),r},[])};re.fromString=function(e,r){let n=ln(e,Ne.isKanjiModeEnabled()),o=Bs(n),i=Ps(o,r),s=vs.find_path(i.map,"start","end"),a=[];for(let l=1;l<s.length-1;l++)a.push(i.table[s[l]].node);return re.fromArray(Is(a))};re.rawSplit=function(e){return re.fromArray(ln(e,Ne.isKanjiModeEnabled()))}});var dn=p(un=>{var Le=_(),pt=Se(),Ms=Ar(),Ns=Tr(),ks=Sr(),Ls=Ir(),yt=Br(),bt=nt(),Fs=Lr(),ke=qr(),Ds=Hr(),Os=U(),gt=cn();function _s(t,e){let r=t.size,n=Ls.getPositions(e);for(let o=0;o<n.length;o++){let i=n[o][0],s=n[o][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(let l=-1;l<=7;l++)s+l<=-1||r<=s+l||(a>=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?t.set(i+a,s+l,!0,!0):t.set(i+a,s+l,!1,!0))}}function $s(t){let e=t.size;for(let r=8;r<e-8;r++){let n=r%2===0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}function Us(t,e){let r=ks.getPositions(e);for(let n=0;n<r.length;n++){let o=r[n][0],i=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?t.set(o+s,i+a,!0,!0):t.set(o+s,i+a,!1,!0)}}function qs(t,e){let r=t.size,n=ke.getEncodedBits(e),o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+r-8-3,s=(n>>a&1)===1,t.set(o,i,s,!0),t.set(i,o,s,!0)}function mt(t,e,r){let n=t.size,o=Ds.getEncodedBits(e,r),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(n-15+i,8,s,!0),i<8?t.set(8,n-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(n-8,8,1,!0)}function Vs(t,e){let r=t.size,n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!t.isReserved(o,a-l)){let u=!1;s<e.length&&(u=(e[s]>>>i&1)===1),t.set(o,a-l,u),i--,i===-1&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function js(t,e,r){let n=new Ms;r.forEach(function(l){n.put(l.mode.bit,4),n.put(l.getLength(),Os.getCharCountIndicator(l.mode,t)),l.write(n)});let o=Le.getSymbolTotalCodewords(t),i=bt.getTotalCodewordsCount(t,e),s=(o-i)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let l=0;l<a;l++)n.put(l%2?17:236,8);return zs(n,t,e)}function zs(t,e,r){let n=Le.getSymbolTotalCodewords(e),o=bt.getTotalCodewordsCount(e,r),i=n-o,s=bt.getBlocksCount(e,r),a=n%s,l=s-a,u=Math.floor(n/s),d=Math.floor(i/s),c=d+1,f=u-d,m=new Fs(f),y=0,g=new Array(s),h=new Array(s),S=0,I=new Uint8Array(t.buffer);for(let J=0;J<s;J++){let Oe=J<l?d:c;g[J]=I.slice(y,y+Oe),h[J]=m.encode(g[J]),y+=Oe,S=Math.max(S,Oe)}let B=new Uint8Array(n),Rt=0,P,M;for(P=0;P<S;P++)for(M=0;M<s;M++)P<g[M].length&&(B[Rt++]=g[M][P]);for(P=0;P<f;P++)for(M=0;M<s;M++)B[Rt++]=h[M][P];return B}function Hs(t,e,r,n){let o;if(Array.isArray(t))o=gt.fromArray(t);else if(typeof t=="string"){let u=e;if(!u){let d=gt.rawSplit(t);u=ke.getBestVersionForData(d,r)}o=gt.fromString(t,u||40)}else throw new Error("Invalid data");let i=ke.getBestVersionForData(o,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=i;else if(e<i)throw new Error(`
|
|
5
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
+
Minimum version required to store current data is: `+i+`.
|
|
7
|
+
`);let s=js(e,r,o),a=Le.getSymbolSize(e),l=new Ns(a);return _s(l,e),$s(l),Us(l,e),mt(l,r,0),e>=7&&qs(l,e),Vs(l,s),isNaN(n)&&(n=yt.getBestMask(l,mt.bind(null,l,r))),yt.applyMask(n,l),mt(l,r,n),{modules:l,version:e,errorCorrectionLevel:r,maskPattern:n,segments:o}}un.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=pt.M,o,i;return typeof r<"u"&&(n=pt.from(r.errorCorrectionLevel,pt.M),o=ke.from(r.version),i=yt.from(r.maskPattern),r.toSJISFunc&&Le.setToSJISFunction(r.toSJISFunc)),Hs(e,o,n,i)}});var wt=p(W=>{function fn(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}W.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:fn(e.color.dark||"#000000ff"),light:fn(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};W.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};W.getImageWidth=function(e,r){let n=W.getScale(e,r);return Math.floor((e+r.margin*2)*n)};W.qrToImageData=function(e,r,n){let o=r.modules.size,i=r.modules.data,s=W.getScale(o,n),a=Math.floor((o+n.margin*2)*s),l=n.margin*s,u=[n.color.light,n.color.dark];for(let d=0;d<a;d++)for(let c=0;c<a;c++){let f=(d*a+c)*4,m=n.color.light;if(d>=l&&c>=l&&d<a-l&&c<a-l){let y=Math.floor((d-l)/s),g=Math.floor((c-l)/s);m=u[i[y*o+g]?1:0]}e[f++]=m.r,e[f++]=m.g,e[f++]=m.b,e[f]=m.a}}});var hn=p(Fe=>{var Ct=wt();function Ws(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function Ys(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Fe.render=function(e,r,n){let o=n,i=r;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),r||(i=Ys()),o=Ct.getOptions(o);let s=Ct.getImageWidth(e.modules.size,o),a=i.getContext("2d"),l=a.createImageData(s,s);return Ct.qrToImageData(l.data,e,o),Ws(a,i,s),a.putImageData(l,0,0),i};Fe.renderToDataURL=function(e,r,n){let o=n;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),o||(o={});let i=Fe.render(e,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var mn=p(gn=>{var Js=wt();function pn(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Et(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Ks(t,e,r){let n="",o=0,i=!1,s=0;for(let a=0;a<t.length;a++){let l=Math.floor(a%e),u=Math.floor(a/e);!l&&!i&&(i=!0),t[a]?(s++,a>0&&l>0&&t[a-1]||(n+=i?Et("M",l+r,.5+u+r):Et("m",o,0),o=0,i=!1),l+1<e&&t[a+1]||(n+=Et("h",s),s=0)):o++}return n}gn.render=function(e,r,n){let o=Js.getOptions(r),i=e.modules.size,s=e.modules.data,a=i+o.margin*2,l=o.color.light.a?"<path "+pn(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",u="<path "+pn(o.color.dark,"stroke")+' d="'+Ks(s,i,o.margin)+'"/>',d='viewBox="0 0 '+a+" "+a+'"',f='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+d+' shape-rendering="crispEdges">'+l+u+`</svg>
|
|
8
|
+
`;return typeof n=="function"&&n(null,f),f}});var bn=p(fe=>{var Qs=wr(),At=dn(),yn=hn(),Gs=mn();function xt(t,e,r,n,o){let i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!Qs())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=r,r=e,e=n=void 0):s===3&&(e.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=e,e=n=void 0):s===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(l,u){try{let d=At.create(r,n);l(t(d,e,n))}catch(d){u(d)}})}try{let l=At.create(r,n);o(null,t(l,e,n))}catch(l){o(l)}}fe.create=At.create;fe.toCanvas=xt.bind(null,yn.render);fe.toDataURL=xt.bind(null,yn.renderToDataURL);fe.toString=xt.bind(null,function(t,e,r){return Gs.render(t,r)})});import{renderToBuffer as ci}from"@react-pdf/renderer";import ui from"react";import{Document as ii,Font as ai}from"@react-pdf/renderer";import{View as Xe,Text as os}from"@react-pdf/renderer";var It=t=>Array.isArray(t)?t:[t],Bt=(...t)=>(e,...r)=>{let n=e,o=t.slice().reverse();for(let i=0;i<o.length;i+=1){let s=o[i];n=s(n,...r)}return n};var Ln=t=>/((-)?\d+\.?\d*)%/g.exec(`${t}`),Pt=t=>{let e=Ln(t);if(e){let r=parseFloat(e[1]);return{percent:r/100,value:r}}return null};var he=t=>typeof t=="string"?Number.parseFloat(t):t;var fo=K(Ut(),1),ur=K(zt(),1),xe=K(tr(),1),dr=K(nr(),1),fr=K(sr(),1),ho=t=>t.filter(Boolean),po=t=>t.reduce((e,r)=>{let n=Array.isArray(r)?Ge(r):r;return Object.keys(n).forEach(o=>{n[o]!==null&&n[o]!==void 0&&(e[o]=n[o])}),e},{}),Ge=Bt(po,ho,It);var go=t=>/rgba?/g.test(t),mo=t=>/hsla?/g.test(t),yo=t=>{let e=xe.default.get.rgb(t);return xe.default.to.hex(e)},bo=t=>{let e=xe.default.get.hsl(t).map(Math.round);return(0,ur.default)(...e).toUpperCase()},hr=t=>go(t)?yo(t):mo(t)?bo(t):t,wo=t=>{if(typeof t=="number")return{value:t,unit:void 0};let e=/^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw|px|rem)?$/g.exec(t);return e?{value:parseFloat(e[1]),unit:e[2]||"pt"}:{value:t,unit:void 0}},x=(t,e)=>{let r=wo(e),n=72,o=t.dpi||72,i=1/25.4*n,s=1/2.54*n;if(typeof r.value!="number")return r.value;switch(r.unit){case"rem":return r.value*(t.remBase||18);case"in":return r.value*n;case"mm":return r.value*i;case"cm":return r.value*s;case"vh":return r.value*(t.height/100);case"vw":return r.value*(t.width/100);case"px":return Math.round(r.value*(n/o));default:return r.value}},D=(t,e)=>({[t]:he(e)}),E=(t,e,r)=>({[t]:x(r,e)}),k=(t,e)=>({[t]:hr(e)}),b=(t,e)=>({[t]:e}),Co=/(-?\d+(\.\d+)?(in|mm|cm|pt|vw|vh|px|rem)?)\s(\S+)\s(.+)/,Eo=t=>t.match(Co)||[],N=(t,e,r)=>{let n=Eo(`${e}`);if(n){let o=n[1]||e,i=n[4]||e,s=n[5]||e,a=i,l=s?hr(s):void 0,u=o?x(r,o):void 0;if(t.match(/(Top|Right|Bottom|Left)$/))return{[`${t}Color`]:l,[`${t}Style`]:a,[`${t}Width`]:u};if(t.match(/Color$/))return{borderTopColor:l,borderRightColor:l,borderBottomColor:l,borderLeftColor:l};if(t.match(/Style$/)){if(typeof a=="number")throw new Error(`Invalid border style: ${a}`);return{borderTopStyle:a,borderRightStyle:a,borderBottomStyle:a,borderLeftStyle:a}}if(t.match(/Width$/)){if(typeof u!="number")throw new Error(`Invalid border width: ${u}`);return{borderTopWidth:u,borderRightWidth:u,borderBottomWidth:u,borderLeftWidth:u}}if(t.match(/Radius$/)){let d=e?x(r,e):void 0;if(typeof d!="number")throw new Error(`Invalid border radius: ${d}`);return{borderTopLeftRadius:d,borderTopRightRadius:d,borderBottomRightRadius:d,borderBottomLeftRadius:d}}if(typeof u!="number")throw new Error(`Invalid border width: ${u}`);if(typeof a=="number")throw new Error(`Invalid border style: ${a}`);return{borderTopColor:l,borderTopStyle:a,borderTopWidth:u,borderRightColor:l,borderRightStyle:a,borderRightWidth:u,borderBottomColor:l,borderBottomStyle:a,borderBottomWidth:u,borderLeftColor:l,borderLeftStyle:a,borderLeftWidth:u}}return{[t]:e}},Ao={border:N,borderBottom:N,borderBottomColor:k,borderBottomLeftRadius:E,borderBottomRightRadius:E,borderBottomStyle:b,borderBottomWidth:E,borderColor:N,borderLeft:N,borderLeftColor:k,borderLeftStyle:b,borderLeftWidth:E,borderRadius:N,borderRight:N,borderRightColor:k,borderRightStyle:b,borderRightWidth:E,borderStyle:N,borderTop:N,borderTopColor:k,borderTopLeftRadius:E,borderTopRightRadius:E,borderTopStyle:b,borderTopWidth:E,borderWidth:N},xo={backgroundColor:k,color:k,opacity:D},To={height:E,maxHeight:E,maxWidth:E,minHeight:E,minWidth:E,width:E},So=[1,1,0],Ro=[1,1,"auto"],vo=(t,e,r)=>{let n=So,o=[];e==="auto"?n=Ro:o=`${e}`.split(" ");let i=he(o[0]||n[0]),s=he(o[1]||n[1]),a=x(r,o[2]||n[2]);return{flexGrow:i,flexShrink:s,flexBasis:a}},Io={alignContent:b,alignItems:b,alignSelf:b,flex:vo,flexBasis:E,flexDirection:b,flexFlow:b,flexGrow:D,flexShrink:D,flexWrap:b,justifyContent:b,justifySelf:b},Bo=(t,e,r)=>{let n=`${e}`.split(" "),o=x(r,n?.[0]||e),i=x(r,n?.[1]||e);return{rowGap:o,columnGap:i}},Po={gap:Bo,columnGap:E,rowGap:E},Mo={aspectRatio:D,bottom:E,display:b,left:E,position:b,right:E,top:E,overflow:b,zIndex:D},No="px,in,mm,cm,pt,%,vw,vh",Je=(t,e)=>{let r=t.toString();console.error(`
|
|
9
|
+
@react-pdf/stylesheet parsing error:
|
|
10
|
+
${r}: ${e},
|
|
11
|
+
${" ".repeat(r.length+2)}^
|
|
12
|
+
Unsupported ${r} value format
|
|
13
|
+
`)},O=({expandsTo:t,maxValues:e=1,autoSupported:r=!1}={})=>(n,o,i)=>{let s=(0,dr.default)(`${o}`),a=[];for(let u=0;u<s.length;u++){let d=s[u];if(d.type==="function"||d.type==="string"||d.type==="div")return Je(n,o),{};if(d.type==="word")if(d.value==="auto"&&r)a.push(d.value);else{let c=(0,fr.default)(d.value);if(c&&No.includes(c.unit))a.push(d.value);else return Je(n,o),{}}}if(a.length>e)return Je(n,o),{};let l=x(i,a[0]);if(t){let u=x(i,a[1]||a[0]),d=x(i,a[2]||a[0]),c=x(i,a[3]||a[1]||a[0]);return t({first:l,second:u,third:d,fourth:c})}return{[n]:l}},ko=O({expandsTo:({first:t,second:e,third:r,fourth:n})=>({marginTop:t,marginRight:e,marginBottom:r,marginLeft:n}),maxValues:4,autoSupported:!0}),Lo=O({expandsTo:({first:t,second:e})=>({marginTop:t,marginBottom:e}),maxValues:2,autoSupported:!0}),Fo=O({expandsTo:({first:t,second:e})=>({marginRight:t,marginLeft:e}),maxValues:2,autoSupported:!0}),Ce=O({autoSupported:!0}),Do={margin:ko,marginBottom:Ce,marginHorizontal:Fo,marginLeft:Ce,marginRight:Ce,marginTop:Ce,marginVertical:Lo},Oo=O({expandsTo:({first:t,second:e,third:r,fourth:n})=>({paddingTop:t,paddingRight:e,paddingBottom:r,paddingLeft:n}),maxValues:4}),_o=O({expandsTo:({first:t,second:e})=>({paddingTop:t,paddingBottom:e}),maxValues:2}),$o=O({expandsTo:({first:t,second:e})=>({paddingRight:t,paddingLeft:e}),maxValues:2}),Ee=O(),Uo={padding:Oo,paddingBottom:Ee,paddingHorizontal:$o,paddingLeft:Ee,paddingRight:Ee,paddingTop:Ee,paddingVertical:_o},G=t=>{switch(t){case"top":case"left":return"0%";case"right":case"bottom":return"100%";case"center":return"50%";default:return t}},qo=(t,e,r)=>{let n=`${e}`.split(" "),o=G(x(r,n?.[0]||e)),i=G(x(r,n?.[1]||e));return{objectPositionX:o,objectPositionY:i}},ir=(t,e,r)=>({[t]:G(x(r,e))}),Vo={objectPosition:qo,objectPositionX:ir,objectPositionY:ir,objectFit:b},jo=t=>typeof t=="number"?t:parseInt(t,10),Ke={thin:100,hairline:100,ultralight:200,extralight:200,light:300,normal:400,medium:500,semibold:600,demibold:600,bold:700,ultrabold:800,extrabold:800,heavy:900,black:900},zo=t=>{if(!t)return Ke.normal;if(typeof t=="number")return t;let e=t.toLowerCase();return Ke[e]?Ke[e]:jo(t)},Ho=(t,e)=>({[t]:zo(e)}),Wo=(t,e,r)=>{if(t==="")return t;let n=x(r,e.fontSize||18),o=x(r,t),{percent:i}=Pt(o)||{};return i?i*n:isNaN(t)?o:o*n},Yo=(t,e,r,n)=>({[t]:Wo(e,n,r)}),Jo={direction:b,fontFamily:b,fontSize:E,fontStyle:b,fontWeight:Ho,letterSpacing:E,lineHeight:Yo,maxLines:D,textAlign:b,textDecoration:b,textDecorationColor:k,textDecorationStyle:b,textIndent:b,textOverflow:b,textTransform:b,verticalAlign:b},Ko=t=>typeof t=="string"&&/^-?\d*\.?\d*$/.test(t),Qe=t=>typeof t!="string"?t:Ko(t)?parseFloat(t):t,Qo=t=>{let e=t.trim().split(/\)[ ,]|\)/);if(e.length===1)return[[e[0],!0]];let r=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o){let[i,s]=o.split("("),a=s.indexOf(",")>=0?",":" ",l=s.split(a).map(u=>u.trim());r.push({operation:i.trim(),value:l})}}return r},Ae=t=>{let e=/(-?\d*\.?\d*)(\w*)?/i,[,r,n]=e.exec(t),o=Number.parseFloat(r);return n==="rad"?o*180/Math.PI:o},Go=({operation:t,value:e})=>{switch(t){case"scale":{let[r,n=r]=e.map(o=>Number.parseFloat(o));return{operation:"scale",value:[r,n]}}case"scaleX":return{operation:"scale",value:[Number.parseFloat(e),1]};case"scaleY":return{operation:"scale",value:[1,Number.parseFloat(e)]};case"rotate":return{operation:"rotate",value:[Ae(e)]};case"translate":return{operation:"translate",value:e.map(r=>Number.parseFloat(r))};case"translateX":return{operation:"translate",value:[Number.parseFloat(e),0]};case"translateY":return{operation:"translate",value:[0,Number.parseFloat(e)]};case"skew":return{operation:"skew",value:e.map(Ae)};case"skewX":return{operation:"skew",value:[Ae(e),0]};case"skewY":return{operation:"skew",value:[0,Ae(e)]};default:return{operation:t,value:e.map(r=>Number.parseFloat(r))}}},Xo=t=>t.map(e=>Go(e)),ar=(t,e)=>typeof e!="string"?{[t]:e}:{[t]:Xo(Qo(e))},lr={top:!0,bottom:!0},Zo=(t,e)=>lr[t]?1:lr[e]?-1:0,es=t=>!t||t.length===0?["center","center"]:(t.length===1?[t[0],"center"]:t).sort(Zo),ts=(t,e,r)=>{let n=`${e}`.split(" "),o=es(n),i=x(r,o[0]),s=x(r,o[1]);return{transformOriginX:G(i)||Qe(i),transformOriginY:G(s)||Qe(s)}},cr=(t,e,r)=>{let n=x(r,e);return{[t]:G(n)||Qe(n)}},rs={transform:ar,gradientTransform:ar,transformOrigin:ts,transformOriginX:cr,transformOriginY:cr},ns={fill:k,stroke:k,strokeDasharray:b,strokeWidth:E,fillOpacity:D,strokeOpacity:D,fillRule:b,textAnchor:b,strokeLinecap:b,strokeLinejoin:b,visibility:b,clipPath:b,dominantBaseline:b},Ri={...Ao,...xo,...To,...Io,...Po,...Mo,...Do,...Uo,...Vo,...Jo,...rs,...ns};import T,{useMemo as V,useContext as pr}from"react";function Te(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}var Ze=T.createContext({style:{borderWidth:1}});function gr(t){var{children:e,weightings:r,style:n,tdStyle:o,trStyle:i}=t,s=Te(t,["children","weightings","style","tdStyle","trStyle"]);let a=V(()=>{let c=Ge([{borderColor:"#000000",borderWidth:"1px",borderStyle:"solid"},...Array.isArray(n)?n:[n]]);if(typeof c.border=="string"){let[f,m,y]=c.border.split(/\s+/);c.borderWidth=Number.parseFloat(f),c.borderStyle=m,c.borderColor=y}else typeof c.border=="number"&&(c.borderWidth=c.border);return typeof c.borderWidth=="string"&&(c.borderWidth=Number.parseFloat(c.borderWidth)),c},[n]),l=V(()=>{let c=[],f=m=>{T.Children.forEach(m,y=>{T.isValidElement(y)&&(y.type===T.Fragment?f(y.props.children):c.push(y))})};return f(e),c.map((m,y)=>T.cloneElement(m,{key:`table_row_${y}`,_firstRow:y===0,_lastRow:y===c.length-1}))},[e]),u=V(()=>[{width:"100%"},...Array.isArray(n)?n:[n],a.borderStyle==="solid"?{border:"0px"}:void 0].filter(Boolean),[n]),d=V(()=>({style:a,weightings:r,tdStyle:o,trStyle:i}),[a,r,o,i]);return T.createElement(Ze.Provider,{value:d},T.createElement(Xe,Object.assign({},s,{style:u}),l))}function et(t){var{children:e,style:r,_firstRow:n,_lastRow:o}=t,i=Te(t,["children","style","_firstRow","_lastRow"]);let{trStyle:s,weightings:a}=pr(Ze),l=V(()=>{var u,d;let c=[],f=g=>{T.Children.forEach(g,h=>{T.isValidElement(h)&&(h.type===T.Fragment?f(h.props.children):c.push(h))})};f(e);let m=[];for(let[g,h]of c.entries())!((u=h.props)===null||u===void 0)&&u.weighting?m.push((d=h.props)===null||d===void 0?void 0:d.weighting):m.push(a?.[g]);let y=(1-m.reduce((g,h)=>g+(h||0),0))/(c.length-m.filter(g=>typeof g=="number").length);return m=m.map(g=>g===void 0?y:g),c.map((g,h)=>T.cloneElement(g,{weighting:m[h],key:`table_col_${h}_cell`,_firstColumn:h===0,_lastColumn:h===c.length-1,_firstRow:n,_lastRow:o}))},[e,a,n,o]);return T.createElement(Xe,Object.assign({},i,{style:[{display:"flex",flexDirection:"row"},...Array.isArray(s)?s:[s],...Array.isArray(r)?r:[r]]}),l)}function mr(t){var{children:e,style:r}=t,n=Te(t,["children","style"]);return T.createElement(et,Object.assign({},n,{style:[{fontWeight:"bold"},...Array.isArray(r)?r:[r]]}),e)}function yr(t){var{children:e,weighting:r,_firstColumn:n,_lastColumn:o,_firstRow:i,_lastRow:s}=t,a=Te(t,["children","weighting","_firstColumn","_lastColumn","_firstRow","_lastRow"]);let l=V(()=>{let m=[],y=g=>{T.Children.forEach(g,h=>{T.isValidElement(h)&&h?.type===T.Fragment?y(h.props.children):m.push(h)})};return y(e),m.map((g,h)=>{let S=`table_cell_${h}_content`;return typeof g=="string"||typeof g=="number"?T.createElement(os,{key:S},g):g})},[e]),{tdStyle:u,style:d}=pr(Ze),c=-1*(d.borderWidth||0)+"px",f=V(()=>d.borderStyle==="solid"?{borderTop:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderRight:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderBottom:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderLeft:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,margin:`${c} ${o?c:"0"} ${s?c:0} ${c}`}:{borderTop:i?void 0:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderLeft:n?void 0:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`},[d,n,o,i,i]);return T.createElement(Xe,Object.assign({wrap:!0},a,{style:[Object.assign(Object.assign({},f),{flex:r??1,display:"flex",flexDirection:"row",alignItems:"center"}),...Array.isArray(u)?u:[u],...Array.isArray(a.style)?a.style:[a.style]]}),l)}import{Image as ri,Page as ni,Text as oi,View as si}from"@react-pdf/renderer";var Cn=K(bn());import En from"react";var An=async t=>{let e={margin:0,width:300,color:{dark:"#000",light:"#fff"}};return Cn.default.toDataURL(t,e)};function Y(t){let{componentData:e,components:r,data:n,allProps:o={},images:i={}}=t;if(o.key&&delete o.key,o.styles&&delete o.styles,o.index&&delete o.index,o.className&&delete o.className,o.children&&delete o.children,Array.isArray(e)&&e.length>0)return e.map((s,a)=>Y({componentData:{...s,props:{...s.props,index:a}},components:r,data:n,allProps:{},images:i}));if(typeof e=="object"&&e!==null&&"type"in e&&Object.keys(r).includes(e.type)){let{type:s,props:a={},children:l,visible:u="true"}=e,d={...o,...a},c=r[s];if(!c)return console.warn(`Component type "${s}" not found in components object`),null;let f=null;l!==void 0&&(Array.isArray(l)?f=l.map((I,B)=>Y({componentData:I,components:r,data:n,allProps:d,images:i})):typeof l=="object"&&l!==null&&"type"in l?f=Y({componentData:l,components:r,data:n,allProps:d,images:i}):f=l);let m={...d,key:crypto.randomUUID()};s==="Map"&&(m.data=n,m.images=i);let{mappedChild:y,mappedIsVisible:g,...h}=xn({...m,mappedChild:f,mappedIsVisible:u},n,i);return Tn(g)?En.createElement(c,h,y):null}return e}function Tt(t){let{componentData:e,components:r,data:n,allProps:o={},images:i={}}=t;if(o.key&&delete o.key,o.styles&&delete o.styles,o.index&&delete o.index,o.className&&delete o.className,o.children&&delete o.children,Array.isArray(e)&&e.length>0)return e.map((s,a)=>Tt({componentData:{...s,props:{...s.props,index:a}},components:r,data:n,allProps:{},images:i}));if(typeof e=="object"&&e!==null&&"type"in e&&Object.keys(r).includes(e.type)){let{type:s,props:a={},children:l,visible:u="true"}=e,d={...o,...a},c=r[s];if(!c)return console.warn(`Component type "${s}" not found in components object`),null;let f=null;l!==void 0&&(Array.isArray(l)?f=l.map((I,B)=>Tt({componentData:I,components:r,data:n,allProps:d,images:i})):typeof l=="object"&&l!==null&&"type"in l?f=Tt({componentData:l,components:r,data:n,allProps:d,images:i}):f=l);let m={...d,key:crypto.randomUUID()};s==="Map"&&(m.data=n,m.images=i);let{mappedChild:y,mappedIsVisible:g,...h}=xn({...m,mappedChild:f,mappedIsVisible:u},n,i);return Tn(g)?En.createElement(c,h,y):null}return e}var xn=(t,e,r)=>{let n={$data:e,$props:t,$images:r},o=/\{\{([^}]+)\}\}/g,i=s=>{let a=Array.from(s.matchAll(o));if(a.length===0)return s;if(a.length===1&&a[0][0]===s){let l=a[0][1].trim(),u=wn({obj:n,path:l});return u!==void 0?u:s}return a.reduce((l,u)=>{let d=u[1].trim(),c=wn({obj:n,path:d}),f=c!==void 0?String(c):u[0];return l.replace(u[0],f)},s)};return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,typeof a=="string"?i(a):a]))},St=t=>{try{return JSON.parse(t)}catch{return null}};function wn({obj:t,path:e}){let r=e.split(".").filter(o=>o.length>0),n=t;for(let o of r){if(n==null||!(o in n))return;n=n[o]}return typeof n=="object"?JSON.stringify(n):n}function Tn(code){try{let result=eval(code);return typeof result=="boolean"?result:!1}catch(t){return console.error(`Error evaluating code "${code}":`,t),!1}}function la(t){return new Promise((e,r)=>{let n=new FileReader;n.onload=function(o){let i=o.target?.result;typeof i=="string"?e(i):r(new Error("File content is not a string"))},n.onerror=function(o){r(o)},n.readAsDataURL(t)})}var Sn=({items:t,component:e,data:r={},images:n={},itemKeyWord:o="item"})=>{let i=JSON.parse(t);if(!Array.isArray(i))return null;let s=i.map((a,l)=>({...e,props:{...e.props,[o]:a,[`${o}Index`]:l}}));return Y({componentData:s,components:De,data:r,allProps:{},images:n})};import{Image as Xs}from"@react-pdf/renderer";import Zs from"react";import{jsx as ti}from"react/jsx-runtime";var ei=t=>{let{qrCodeText:e,...r}=t,n=Zs.useMemo(async()=>await An(e),[e]);return ti(Xs,{src:n,...r})},Rn=ei;var De={Page:ni,View:si,Text:oi,Image:ri,Table:gr,TH:mr,TR:et,TD:yr,QrCode:Rn,Map:Sn};import{jsx as li}from"react/jsx-runtime";var vn=({data:t,template:e})=>{let r=St(e),n=St(t);(r?.fonts||[]).forEach(l=>{ai.register(l)});let i=r?.components||[],s=r?.images||{},a=Y({componentData:i,components:De,data:n||{},allProps:{},images:s});return li(ii,{children:a})};async function ka(t,e){try{let r=ui.createElement(vn,{data:e,template:t});return await ci(r)}catch(r){let n=r instanceof Error?r.message:"Unknown error";throw new Error(`PDF generation failed: ${n}`)}}export{ka as generatePdf};
|
|
14
|
+
//# sourceMappingURL=pdf-generator.esm.js.map
|