UNPKG

pdfmake-rtl

Version:

Enhanced PDFMake with automatic RTL (Arabic/Persian/Urdu) support - Complete standalone package (beta)

2 lines 1.41 MB
/*! pdfmake-rtl v1.3.6, @license MIT, @link https://github.com/aysnet1/pdfmake-rtl#readme */ !function webpackUniversalModuleDefinition(r,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var u=n();for(var p in u)("object"==typeof exports?exports:r)[p]=u[p]}}("undefined"!=typeof self?self:this,function(){return function(){var r={464:function(r,n,u){var p=u(63432),g=u(55480);(r.exports=function(r,n){return g[r]||(g[r]=void 0!==n?n:{})})("versions",[]).push({version:"3.19.0",mode:p?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},520:function(r,n,u){var p=u(38486);r.exports=p("document","documentElement")},664:function(r,n,u){var p=u(40715);r.exports=/web0s(?!.*chrome)/i.test(p)},1083:function(r,n,u){u(71768)},1125:function(r,n,u){"use strict";var p=u(14598).Buffer;u(69330),u(5597),u(11765),u(7585),u(7283),u(58281),Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,u(65292),u(73844),u(39081),u(41584),u(49063),u(58028),u(81755),u(94845),u(80055),u(20731),u(45337),u(8953),u(24863),u(70095),u(10849),u(18756),u(37309),u(14032),u(59883),u(68067),u(61726),u(57114),u(26663),u(65578),u(6422),u(46467),u(7851),u(72095),u(62046),u(47259),u(18425),u(56912),u(73663),u(29883),u(35471),u(21012),u(88997),u(97464),u(2857),u(94715),u(13624),u(91132),u(62514),u(24597),u(88042),u(4660),u(92451),u(44206),u(66288),u(13250),u(3858),u(84538),u(64793),u(74202),u(52529),u(64654),u(42437),u(94712);var g=_interopRequireDefault(u(9760)),y=_interopRequireDefault(u(6729)),w=_interopRequireDefault(u(94119)),_=_interopRequireDefault(u(10740)),x=u(64785),P=_interopRequireDefault(u(5417)),k=_interopRequireDefault(u(38834)),I=_interopRequireDefault(u(84695));function _interopRequireDefault(r){return r&&r.__esModule?r:{default:r}}function _defineProperties(r,n){for(var u=0;u<n.length;u++){var p=n[u];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(r,_toPropertyKey(p.key),p)}}function _toPropertyKey(r){var n=function _toPrimitive(r,n){if("object"!=typeof r||!r)return r;var u=r[Symbol.toPrimitive];if(void 0!==u){var p=u.call(r,n||"default");if("object"!=typeof p)return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(r)}(r,"string");return"symbol"==typeof n?n:n+""}function _inheritsLoose(r,n){r.prototype=Object.create(n.prototype),r.prototype.constructor=r,_setPrototypeOf(r,n)}function _setPrototypeOf(r,n){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},_setPrototypeOf(r,n)}function _createForOfIteratorHelperLoose(r,n){var u="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(u)return(u=u.call(r)).next.bind(u);if(Array.isArray(r)||(u=function _unsupportedIterableToArray(r,n){if(r){if("string"==typeof r)return _arrayLikeToArray(r,n);var u={}.toString.call(r).slice(8,-1);return"Object"===u&&r.constructor&&(u=r.constructor.name),"Map"===u||"Set"===u?Array.from(r):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?_arrayLikeToArray(r,n):void 0}}(r))||n&&r&&"number"==typeof r.length){u&&(r=u);var p=0;return function(){return p>=r.length?{done:!0}:{done:!1,value:r[p++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray(r,n){(null==n||n>r.length)&&(n=r.length);for(var u=0,p=Array(n);u<n;u++)p[u]=r[u];return p}var B=u(48181),O=function(){function PDFAbstractReference(){}return PDFAbstractReference.prototype.toString=function toString(){throw new Error("Must be implemented by subclasses")},PDFAbstractReference}(),R=function(){function PDFTree(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._items={},this.limits="boolean"!=typeof r.limits||r.limits}var r=PDFTree.prototype;return r.add=function add(r,n){return this._items[r]=n},r.get=function get(r){return this._items[r]},r.toString=function toString(){var r=this,n=Object.keys(this._items).sort(function(n,u){return r._compareKeys(n,u)}),u=["<<"];if(this.limits&&n.length>1){var p=n[0],g=n[n.length-1];u.push(" /Limits "+j.convert([this._dataForKey(p),this._dataForKey(g)]))}u.push(" /"+this._keysName()+" [");for(var y,w=_createForOfIteratorHelperLoose(n);!(y=w()).done;){var _=y.value;u.push(" "+j.convert(this._dataForKey(_))+" "+j.convert(this._items[_]))}return u.push("]"),u.push(">>"),u.join("\n")},r._compareKeys=function _compareKeys(){throw new Error("Must be implemented by subclasses")},r._keysName=function _keysName(){throw new Error("Must be implemented by subclasses")},r._dataForKey=function _dataForKey(){throw new Error("Must be implemented by subclasses")},PDFTree}(),D=function(){function SpotColor(r,n,u,p,g,y){this.id="CS"+Object.keys(r.spotColors).length,this.name=n,this.values=[u,p,g,y],this.ref=r.ref(["Separation",this.name,"DeviceCMYK",{Range:[0,1,0,1,0,1,0,1],C0:[0,0,0,0],C1:this.values.map(function(r){return r/100}),FunctionType:2,Domain:[0,1],N:1}]),this.ref.end()}return SpotColor.prototype.toString=function toString(){return this.ref.id+" 0 R"},SpotColor}(),N=function pad(r,n){return(Array(n+1).join("0")+r).slice(-n)},U=/[\n\r\t\b\f()\\]/g,W={"\n":"\\n","\r":"\\r","\t":"\\t","\b":"\\b","\f":"\\f","\\":"\\\\","(":"\\(",")":"\\)"},j=function(){function PDFObject(){}return PDFObject.convert=function convert(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof r)return"/"+r;if(r instanceof String){for(var u,g=r,y=!1,w=0,_=g.length;w<_;w++)if(g.charCodeAt(w)>127){y=!0;break}return u=y?function swapBytes(r){var n=r.length;if(1&n)throw new Error("Buffer length must be even");for(var u=0,p=n-1;u<p;u+=2){var g=r[u];r[u]=r[u+1],r[u+1]=g}return r}(p.from("\ufeff"+g,"utf16le")):p.from(g.valueOf(),"ascii"),"("+(g=(g=n?n(u).toString("binary"):u.toString("binary")).replace(U,function(r){return W[r]}))+")"}if(p.isBuffer(r))return"<"+r.toString("hex")+">";if(r instanceof O||r instanceof R||r instanceof D)return r.toString();if(r instanceof Date){var x="D:"+N(r.getUTCFullYear(),4)+N(r.getUTCMonth()+1,2)+N(r.getUTCDate(),2)+N(r.getUTCHours(),2)+N(r.getUTCMinutes(),2)+N(r.getUTCSeconds(),2)+"Z";return n&&(x=(x=n(p.from(x,"ascii")).toString("binary")).replace(U,function(r){return W[r]})),"("+x+")"}if(Array.isArray(r))return"["+r.map(function(r){return PDFObject.convert(r,n)}).join(" ")+"]";if("[object Object]"==={}.toString.call(r)){var P=["<<"];for(var k in r){var I=r[k];P.push("/"+k+" "+PDFObject.convert(I,n))}return P.push(">>"),P.join("\n")}return"number"==typeof r?PDFObject.number(r):""+r},PDFObject.number=function number(r){if(r>-1e21&&r<1e21)return Math.round(1e6*r)/1e6;throw new Error("unsupported number: "+r)},PDFObject}(),G=function(r){function PDFReference(n,u){var p,g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(p=r.call(this)||this).document=n,p.id=u,p.data=g,p.gen=0,p.compress=p.document.compress&&!p.data.Filter,p.uncompressedLength=0,p.buffer=[],p}_inheritsLoose(PDFReference,r);var n=PDFReference.prototype;return n.write=function write(r){if(p.isBuffer(r)||(r=p.from(r+"\n","binary")),this.uncompressedLength+=r.length,null==this.data.Length&&(this.data.Length=0),this.buffer.push(r),this.data.Length+=r.length,this.compress)return this.data.Filter="FlateDecode"},n.end=function end(r){return r&&this.write(r),this.finalize()},n.finalize=function finalize(){this.offset=this.document._offset;var r=this.document._security?this.document._security.getEncryptFn(this.id,this.gen):null;this.buffer.length&&(this.buffer=p.concat(this.buffer),this.compress&&(this.buffer=y.default.deflateSync(this.buffer)),r&&(this.buffer=r(this.buffer)),this.data.Length=this.buffer.length),this.document._write(this.id+" "+this.gen+" obj"),this.document._write(j.convert(this.data,r)),this.buffer.length&&(this.document._write("stream"),this.document._write(this.buffer),this.buffer=[],this.document._write("\nendstream")),this.document._write("endobj"),this.document._refEnd(this)},n.toString=function toString(){return this.id+" "+this.gen+" R"},PDFReference}(O),X={top:72,left:72,bottom:72,right:72},Y={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],EXECUTIVE:[521.86,756],FOLIO:[612,936],LEGAL:[612,1008],LETTER:[612,792],TABLOID:[792,1224]},K=function(){function PDFPage(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.document=r,this.size=n.size||"letter",this.layout=n.layout||"portrait","number"==typeof n.margin?this.margins={top:n.margin,left:n.margin,bottom:n.margin,right:n.margin}:this.margins=n.margins||X;var u=Array.isArray(this.size)?this.size:Y[this.size.toUpperCase()];this.width=u["portrait"===this.layout?0:1],this.height=u["portrait"===this.layout?1:0],this.content=this.document.ref(),this.resources=this.document.ref({ProcSet:["PDF","Text","ImageB","ImageC","ImageI"]}),this.dictionary=this.document.ref({Type:"Page",Parent:this.document._root.data.Pages,MediaBox:[0,0,this.width,this.height],Contents:this.content,Resources:this.resources}),this.markings=[]}var r=PDFPage.prototype;return r.maxY=function maxY(){return this.height-this.margins.bottom},r.write=function write(r){return this.content.write(r)},r._setTabOrder=function _setTabOrder(){!this.dictionary.Tabs&&this.document.hasMarkInfoDictionary()&&(this.dictionary.data.Tabs="S")},r.end=function end(){this._setTabOrder(),this.dictionary.end(),this.resources.data.ColorSpace=this.resources.data.ColorSpace||{};for(var r=0,n=Object.values(this.document.spotColors);r<n.length;r++){var u=n[r];this.resources.data.ColorSpace[u.id]=u}return this.resources.end(),this.content.end()},function _createClass(r,n,u){return n&&_defineProperties(r.prototype,n),u&&_defineProperties(r,u),Object.defineProperty(r,"prototype",{writable:!1}),r}(PDFPage,[{key:"fonts",get:function get(){var r=this.resources.data;return null!=r.Font?r.Font:r.Font={}}},{key:"xobjects",get:function get(){var r=this.resources.data;return null!=r.XObject?r.XObject:r.XObject={}}},{key:"ext_gstates",get:function get(){var r=this.resources.data;return null!=r.ExtGState?r.ExtGState:r.ExtGState={}}},{key:"patterns",get:function get(){var r=this.resources.data;return null!=r.Pattern?r.Pattern:r.Pattern={}}},{key:"colorSpaces",get:function get(){var r=this.resources.data;return r.ColorSpace||(r.ColorSpace={})}},{key:"annotations",get:function get(){var r=this.dictionary.data;return null!=r.Annots?r.Annots:r.Annots=[]}},{key:"structParentTreeKey",get:function get(){var r=this.dictionary.data;return null!=r.StructParents?r.StructParents:r.StructParents=this.document.createStructParentTreeNextKey()}}])}(),J=function(r){function PDFNameTree(){return r.apply(this,arguments)||this}_inheritsLoose(PDFNameTree,r);var n=PDFNameTree.prototype;return n._compareKeys=function _compareKeys(r,n){return r.localeCompare(n)},n._keysName=function _keysName(){return"Names"},n._dataForKey=function _dataForKey(r){return new String(r)},PDFNameTree}(R);function inRange(r,n){if(r<n[0])return!1;for(var u=0,p=n.length/2;u<=p;){var g=Math.floor((u+p)/2),y=2*g;if(r>=n[y]&&r<=n[y+1])return!0;r>n[y+1]?u=g+1:p=g-1}return!1}var $=[545,545,564,591,686,687,751,767,848,863,880,883,886,889,891,893,895,899,907,907,909,909,930,930,975,975,1015,1023,1159,1159,1231,1231,1270,1271,1274,1279,1296,1328,1367,1368,1376,1376,1416,1416,1419,1424,1442,1442,1466,1466,1477,1487,1515,1519,1525,1547,1549,1562,1564,1566,1568,1568,1595,1599,1622,1631,1774,1775,1791,1791,1806,1806,1837,1839,1867,1919,1970,2304,2308,2308,2362,2363,2382,2383,2389,2391,2417,2432,2436,2436,2445,2446,2449,2450,2473,2473,2481,2481,2483,2485,2490,2491,2493,2493,2501,2502,2505,2506,2510,2518,2520,2523,2526,2526,2532,2533,2555,2561,2563,2564,2571,2574,2577,2578,2601,2601,2609,2609,2612,2612,2615,2615,2618,2619,2621,2621,2627,2630,2633,2634,2638,2648,2653,2653,2655,2661,2677,2688,2692,2692,2700,2700,2702,2702,2706,2706,2729,2729,2737,2737,2740,2740,2746,2747,2758,2758,2762,2762,2766,2767,2769,2783,2785,2789,2800,2816,2820,2820,2829,2830,2833,2834,2857,2857,2865,2865,2868,2869,2874,2875,2884,2886,2889,2890,2894,2901,2904,2907,2910,2910,2914,2917,2929,2945,2948,2948,2955,2957,2961,2961,2966,2968,2971,2971,2973,2973,2976,2978,2981,2983,2987,2989,2998,2998,3002,3005,3011,3013,3017,3017,3022,3030,3032,3046,3059,3072,3076,3076,3085,3085,3089,3089,3113,3113,3124,3124,3130,3133,3141,3141,3145,3145,3150,3156,3159,3167,3170,3173,3184,3201,3204,3204,3213,3213,3217,3217,3241,3241,3252,3252,3258,3261,3269,3269,3273,3273,3278,3284,3287,3293,3295,3295,3298,3301,3312,3329,3332,3332,3341,3341,3345,3345,3369,3369,3386,3389,3396,3397,3401,3401,3406,3414,3416,3423,3426,3429,3440,3457,3460,3460,3479,3481,3506,3506,3516,3516,3518,3519,3527,3529,3531,3534,3541,3541,3543,3543,3552,3569,3573,3584,3643,3646,3676,3712,3715,3715,3717,3718,3721,3721,3723,3724,3726,3731,3736,3736,3744,3744,3748,3748,3750,3750,3752,3753,3756,3756,3770,3770,3774,3775,3781,3781,3783,3783,3790,3791,3802,3803,3806,3839,3912,3912,3947,3952,3980,3983,3992,3992,4029,4029,4045,4046,4048,4095,4130,4130,4136,4136,4139,4139,4147,4149,4154,4159,4186,4255,4294,4303,4345,4346,4348,4351,4442,4446,4515,4519,4602,4607,4615,4615,4679,4679,4681,4681,4686,4687,4695,4695,4697,4697,4702,4703,4743,4743,4745,4745,4750,4751,4783,4783,4785,4785,4790,4791,4799,4799,4801,4801,4806,4807,4815,4815,4823,4823,4847,4847,4879,4879,4881,4881,4886,4887,4895,4895,4935,4935,4955,4960,4989,5023,5109,5120,5751,5759,5789,5791,5873,5887,5901,5901,5909,5919,5943,5951,5972,5983,5997,5997,6001,6001,6004,6015,6109,6111,6122,6143,6159,6159,6170,6175,6264,6271,6314,7679,7836,7839,7930,7935,7958,7959,7966,7967,8006,8007,8014,8015,8024,8024,8026,8026,8028,8028,8030,8030,8062,8063,8117,8117,8133,8133,8148,8149,8156,8156,8176,8177,8181,8181,8191,8191,8275,8278,8280,8286,8292,8297,8306,8307,8335,8351,8370,8399,8427,8447,8507,8508,8524,8530,8580,8591,9167,9215,9255,9279,9291,9311,9471,9471,9748,9749,9752,9752,9854,9855,9866,9984,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10079,10080,10133,10135,10160,10160,10175,10191,10220,10223,11008,11903,11930,11930,12020,12031,12246,12271,12284,12287,12352,12352,12439,12440,12544,12548,12589,12592,12687,12687,12728,12783,12829,12831,12868,12880,12924,12926,13004,13007,13055,13055,13175,13178,13278,13279,13311,13311,19894,19967,40870,40959,42125,42127,42183,44031,55204,55295,64046,64047,64107,64255,64263,64274,64280,64284,64311,64311,64317,64317,64319,64319,64322,64322,64325,64325,64434,64466,64832,64847,64912,64913,64968,64975,65021,65023,65040,65055,65060,65071,65095,65096,65107,65107,65127,65127,65132,65135,65141,65141,65277,65278,65280,65280,65471,65473,65480,65481,65488,65489,65496,65497,65501,65503,65511,65511,65519,65528,65536,66303,66335,66335,66340,66351,66379,66559,66598,66599,66638,118783,119030,119039,119079,119081,119262,119807,119893,119893,119965,119965,119968,119969,119971,119972,119975,119976,119981,119981,119994,119994,119996,119996,120001,120001,120004,120004,120070,120070,120075,120076,120085,120085,120093,120093,120122,120122,120127,120127,120133,120133,120135,120137,120145,120145,120484,120487,120778,120781,120832,131069,173783,194559,195102,196605,196608,262141,262144,327677,327680,393213,393216,458749,458752,524285,524288,589821,589824,655357,655360,720893,720896,786429,786432,851965,851968,917501,917504,917504,917506,917535,917632,983037],ee=function isUnassignedCodePoint(r){return inRange(r,$)},te=[173,173,847,847,6150,6150,6155,6155,6156,6156,6157,6157,8203,8203,8204,8204,8205,8205,8288,8288,65024,65024,65025,65025,65026,65026,65027,65027,65028,65028,65029,65029,65030,65030,65031,65031,65032,65032,65033,65033,65034,65034,65035,65035,65036,65036,65037,65037,65038,65038,65039,65039,65279,65279],re=[160,160,5760,5760,8192,8192,8193,8193,8194,8194,8195,8195,8196,8196,8197,8197,8198,8198,8199,8199,8200,8200,8201,8201,8202,8202,8203,8203,8239,8239,8287,8287,12288,12288],ne=[128,159,1757,1757,1807,1807,6158,6158,8204,8204,8205,8205,8232,8232,8233,8233,8288,8288,8289,8289,8290,8290,8291,8291,8298,8303,65279,65279,65529,65532,119155,119162],ie=[64976,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1114110,1114111],oe=[0,31,127,127,832,832,833,833,8206,8206,8207,8207,8234,8234,8235,8235,8236,8236,8237,8237,8238,8238,8298,8298,8299,8299,8300,8300,8301,8301,8302,8302,8303,8303,12272,12283,55296,57343,57344,63743,65529,65529,65530,65530,65531,65531,65532,65532,65533,65533,917505,917505,917536,917631,983040,1048573,1048576,1114109],ae=function isProhibitedCharacter(r){return inRange(r,re)||inRange(r,oe)||inRange(r,ne)||inRange(r,ie)},se=[1470,1470,1472,1472,1475,1475,1488,1514,1520,1524,1563,1563,1567,1567,1569,1594,1600,1610,1645,1647,1649,1749,1757,1757,1765,1766,1786,1790,1792,1805,1808,1808,1810,1836,1920,1957,1969,1969,8207,8207,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65020,65136,65140,65142,65276],ce=function isBidirectionalRAL(r){return inRange(r,se)},le=[65,90,97,122,170,170,181,181,186,186,192,214,216,246,248,544,546,563,592,685,688,696,699,705,720,721,736,740,750,750,890,890,902,902,904,906,908,908,910,929,931,974,976,1013,1024,1154,1162,1230,1232,1269,1272,1273,1280,1295,1329,1366,1369,1375,1377,1415,1417,1417,2307,2307,2309,2361,2365,2368,2377,2380,2384,2384,2392,2401,2404,2416,2434,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2494,2496,2503,2504,2507,2508,2519,2519,2524,2525,2527,2529,2534,2545,2548,2554,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2622,2624,2649,2652,2654,2654,2662,2671,2674,2676,2691,2691,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2752,2761,2761,2763,2764,2768,2768,2784,2784,2790,2799,2818,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2877,2878,2880,2880,2887,2888,2891,2892,2903,2903,2908,2909,2911,2913,2918,2928,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3006,3007,3009,3010,3014,3016,3018,3020,3031,3031,3047,3058,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3137,3140,3168,3169,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3262,3262,3264,3268,3271,3272,3274,3275,3285,3286,3294,3294,3296,3297,3302,3311,3330,3331,3333,3340,3342,3344,3346,3368,3370,3385,3390,3392,3398,3400,3402,3404,3415,3415,3424,3425,3430,3439,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3535,3537,3544,3551,3570,3572,3585,3632,3634,3635,3648,3654,3663,3675,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3792,3801,3804,3805,3840,3863,3866,3892,3894,3894,3896,3896,3902,3911,3913,3946,3967,3967,3973,3973,3976,3979,4030,4037,4039,4044,4047,4047,4096,4129,4131,4135,4137,4138,4140,4140,4145,4145,4152,4152,4160,4183,4256,4293,4304,4344,4347,4347,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,4961,4988,5024,5108,5121,5750,5761,5786,5792,5872,5888,5900,5902,5905,5920,5937,5941,5942,5952,5969,5984,5996,5998,6e3,6016,6070,6078,6085,6087,6088,6100,6106,6108,6108,6112,6121,6160,6169,6176,6263,6272,6312,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8206,8206,8305,8305,8319,8319,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8509,8511,8517,8521,8544,8579,9014,9082,9109,9109,9372,9449,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12588,12593,12686,12688,12727,12784,12828,12832,12867,12896,12923,12927,12976,12992,13003,13008,13054,13056,13174,13179,13277,13280,13310,13312,19893,19968,40869,40960,42124,44032,55203,55296,64045,64048,64106,64256,64262,64275,64279,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,66304,66334,66336,66339,66352,66378,66560,66597,66600,66637,118784,119029,119040,119078,119082,119142,119146,119154,119171,119172,119180,119209,119214,119261,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,12e4,120002,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120483,120488,120777,131072,173782,194560,195101,983040,1048573,1048576,1114109],ue=function isBidirectionalL(r){return inRange(r,le)},fe=function isNonASCIISpaceCharacter(r){return inRange(r,re)},he=function isCommonlyMappedToNothing(r){return inRange(r,te)},de=function getCodePoint(r){return r.codePointAt(0)};function toCodePoints(r){for(var n=[],u=r.length,p=0;p<u;p+=1){var g=r.charCodeAt(p);if(g>=55296&&g<=56319&&u>p+1){var y=r.charCodeAt(p+1);if(y>=56320&&y<=57343){n.push(1024*(g-55296)+y-56320+65536),p+=1;continue}}n.push(g)}return n}var pe=function(){function PDFSecurity(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n.ownerPassword&&!n.userPassword)throw new Error("None of owner password and user password is defined.");this.document=r,this._setupEncryption(n)}PDFSecurity.generateFileID=function generateFileID(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.CreationDate.getTime()+"\n";for(var u in r)r.hasOwnProperty(u)&&(n+=u+": "+r[u].valueOf()+"\n");return wordArrayToBuffer(w.default.MD5(n))},PDFSecurity.generateRandomWordArray=function generateRandomWordArray(r){return w.default.lib.WordArray.random(r)},PDFSecurity.create=function create(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.ownerPassword||n.userPassword?new PDFSecurity(r,n):null};var r=PDFSecurity.prototype;return r._setupEncryption=function _setupEncryption(r){switch(r.pdfVersion){case"1.4":case"1.5":this.version=2;break;case"1.6":case"1.7":this.version=4;break;case"1.7ext3":this.version=5;break;default:this.version=1}var n={Filter:"Standard"};switch(this.version){case 1:case 2:case 4:this._setupEncryptionV1V2V4(this.version,n,r);break;case 5:this._setupEncryptionV5(n,r)}this.dictionary=this.document.ref(n)},r._setupEncryptionV1V2V4=function _setupEncryptionV1V2V4(r,n,u){var p,g;switch(r){case 1:p=2,this.keyBits=40,g=function getPermissionsR2(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=-64;r.printing&&(n|=4);r.modifying&&(n|=8);r.copying&&(n|=16);r.annotating&&(n|=32);return n}(u.permissions);break;case 2:p=3,this.keyBits=128,g=getPermissionsR3(u.permissions);break;case 4:p=4,this.keyBits=128,g=getPermissionsR3(u.permissions)}var y,_=processPasswordR2R3R4(u.userPassword),x=u.ownerPassword?processPasswordR2R3R4(u.ownerPassword):_,P=function getOwnerPasswordR2R3R4(r,n,u,p){for(var g=p,y=r>=3?51:1,_=0;_<y;_++)g=w.default.MD5(g);var x=g.clone();x.sigBytes=n/8;var P=u;y=r>=3?20:1;for(var k=0;k<y;k++){for(var I=Math.ceil(x.sigBytes/4),B=0;B<I;B++)x.words[B]=g.words[B]^(k|k<<8|k<<16|k<<24);P=w.default.RC4.encrypt(P,x).ciphertext}return P}(p,this.keyBits,_,x);this.encryptionKey=function getEncryptionKeyR2R3R4(r,n,u,p,g,y){for(var _=p.clone().concat(g).concat(w.default.lib.WordArray.create([lsbFirstWord(y)],4)).concat(w.default.lib.WordArray.create(u)),x=r>=3?51:1,P=0;P<x;P++)(_=w.default.MD5(_)).sigBytes=n/8;return _}(p,this.keyBits,this.document._id,_,P,g),y=2===p?function getUserPasswordR2(r){return w.default.RC4.encrypt(processPasswordR2R3R4(),r).ciphertext}(this.encryptionKey):function getUserPasswordR3R4(r,n){for(var u=n.clone(),p=w.default.MD5(processPasswordR2R3R4().concat(w.default.lib.WordArray.create(r))),g=0;g<20;g++){for(var y=Math.ceil(u.sigBytes/4),_=0;_<y;_++)u.words[_]=n.words[_]^(g|g<<8|g<<16|g<<24);p=w.default.RC4.encrypt(p,u).ciphertext}return p.concat(w.default.lib.WordArray.create(null,16))}(this.document._id,this.encryptionKey),n.V=r,r>=2&&(n.Length=this.keyBits),4===r&&(n.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV2",Length:this.keyBits/8}},n.StmF="StdCF",n.StrF="StdCF"),n.R=p,n.O=wordArrayToBuffer(P),n.U=wordArrayToBuffer(y),n.P=g},r._setupEncryptionV5=function _setupEncryptionV5(r,n){this.keyBits=256;var u=getPermissionsR3(n.permissions),p=processPasswordR5(n.userPassword),g=n.ownerPassword?processPasswordR5(n.ownerPassword):p;this.encryptionKey=function getEncryptionKeyR5(r){return r(32)}(PDFSecurity.generateRandomWordArray);var y=function getUserPasswordR5(r,n){var u=n(8),p=n(8);return w.default.SHA256(r.clone().concat(u)).concat(u).concat(p)}(p,PDFSecurity.generateRandomWordArray),_=function getUserEncryptionKeyR5(r,n,u){var p=w.default.SHA256(r.clone().concat(n)),g={mode:w.default.mode.CBC,padding:w.default.pad.NoPadding,iv:w.default.lib.WordArray.create(null,16)};return w.default.AES.encrypt(u,p,g).ciphertext}(p,w.default.lib.WordArray.create(y.words.slice(10,12),8),this.encryptionKey),x=function getOwnerPasswordR5(r,n,u){var p=u(8),g=u(8);return w.default.SHA256(r.clone().concat(p).concat(n)).concat(p).concat(g)}(g,y,PDFSecurity.generateRandomWordArray),P=function getOwnerEncryptionKeyR5(r,n,u,p){var g=w.default.SHA256(r.clone().concat(n).concat(u)),y={mode:w.default.mode.CBC,padding:w.default.pad.NoPadding,iv:w.default.lib.WordArray.create(null,16)};return w.default.AES.encrypt(p,g,y).ciphertext}(g,w.default.lib.WordArray.create(x.words.slice(10,12),8),y,this.encryptionKey),k=function getEncryptedPermissionsR5(r,n,u){var p=w.default.lib.WordArray.create([lsbFirstWord(r),4294967295,1415668834],12).concat(u(4)),g={mode:w.default.mode.ECB,padding:w.default.pad.NoPadding};return w.default.AES.encrypt(p,n,g).ciphertext}(u,this.encryptionKey,PDFSecurity.generateRandomWordArray);r.V=5,r.Length=this.keyBits,r.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV3",Length:this.keyBits/8}},r.StmF="StdCF",r.StrF="StdCF",r.R=5,r.O=wordArrayToBuffer(x),r.OE=wordArrayToBuffer(P),r.U=wordArrayToBuffer(y),r.UE=wordArrayToBuffer(_),r.P=u,r.Perms=wordArrayToBuffer(k)},r.getEncryptFn=function getEncryptFn(r,n){var u,p;if(this.version<5&&(u=this.encryptionKey.clone().concat(w.default.lib.WordArray.create([(255&r)<<24|(65280&r)<<8|r>>8&65280|255&n,(65280&n)<<16],5))),1===this.version||2===this.version){var g=w.default.MD5(u);return g.sigBytes=Math.min(16,this.keyBits/8+5),function(r){return wordArrayToBuffer(w.default.RC4.encrypt(w.default.lib.WordArray.create(r),g).ciphertext)}}p=4===this.version?w.default.MD5(u.concat(w.default.lib.WordArray.create([1933667412],4))):this.encryptionKey;var y=PDFSecurity.generateRandomWordArray(16),_={mode:w.default.mode.CBC,padding:w.default.pad.Pkcs7,iv:y};return function(r){return wordArrayToBuffer(y.clone().concat(w.default.AES.encrypt(w.default.lib.WordArray.create(r),p,_).ciphertext))}},r.end=function end(){this.dictionary.end()},PDFSecurity}();function getPermissionsR3(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=-3904;return"lowResolution"===r.printing&&(n|=4),"highResolution"===r.printing&&(n|=2052),r.modifying&&(n|=8),r.copying&&(n|=16),r.annotating&&(n|=32),r.fillingForms&&(n|=256),r.contentAccessibility&&(n|=512),r.documentAssembly&&(n|=1024),n}function processPasswordR2R3R4(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=p.alloc(32),u=r.length,g=0;g<u&&g<32;){var y=r.charCodeAt(g);if(y>255)throw new Error("Password contains one or more invalid characters.");n[g]=y,g++}for(;g<32;)n[g]=_e[g-u],g++;return w.default.lib.WordArray.create(n)}function processPasswordR5(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";r=unescape(encodeURIComponent(function saslprep(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof r)throw new TypeError("Expected string.");if(0===r.length)return"";var u=toCodePoints(r).map(function(r){return fe(r)?32:r}).filter(function(r){return!he(r)}),p=String.fromCodePoint.apply(null,u).normalize("NFKC"),g=toCodePoints(p);if(g.some(ae))throw new Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(!0!==n.allowUnassigned&&g.some(ee))throw new Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5");var y=g.some(ce),w=g.some(ue);if(y&&w)throw new Error("String must not contain RandALCat and LCat at the same time, see https://tools.ietf.org/html/rfc3454#section-6");var _=ce(de(function first(r){return r[0]}(p))),x=ce(de(function last(r){return r[r.length-1]}(p)));if(y&&(!_||!x))throw new Error("Bidirectional RandALCat character must be the first and the last character of the string, see https://tools.ietf.org/html/rfc3454#section-6");return p}(r)));for(var n=Math.min(127,r.length),u=p.alloc(n),g=0;g<n;g++)u[g]=r.charCodeAt(g);return w.default.lib.WordArray.create(u)}function lsbFirstWord(r){return(255&r)<<24|(65280&r)<<8|r>>8&65280|r>>24&255}function wordArrayToBuffer(r){for(var n=[],u=0;u<r.sigBytes;u++)n.push(r.words[Math.floor(u/4)]>>8*(3-u%4)&255);return p.from(n)}var ge,ye,ve,me,be,we,_e=[40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122],Se=j.number,xe=function(){function PDFGradient(r){this.doc=r,this.stops=[],this.embedded=!1,this.transform=[1,0,0,1,0,0]}var r=PDFGradient.prototype;return r.stop=function stop(r,n,u){if(null==u&&(u=1),n=this.doc._normalizeColor(n),0===this.stops.length)if(3===n.length)this._colorSpace="DeviceRGB";else if(4===n.length)this._colorSpace="DeviceCMYK";else{if(1!==n.length)throw new Error("Unknown color space");this._colorSpace="DeviceGray"}else if("DeviceRGB"===this._colorSpace&&3!==n.length||"DeviceCMYK"===this._colorSpace&&4!==n.length||"DeviceGray"===this._colorSpace&&1!==n.length)throw new Error("All gradient stops must use the same color space");return u=Math.max(0,Math.min(1,u)),this.stops.push([r,n,u]),this},r.setTransform=function setTransform(r,n,u,p,g,y){return this.transform=[r,n,u,p,g,y],this},r.embed=function embed(r){var n,u=this.stops.length;if(0!==u){this.embedded=!0,this.matrix=r;var p=this.stops[u-1];p[0]<1&&this.stops.push([1,p[1],p[2]]);for(var g=[],y=[],w=[],_=0;_<u-1;_++)y.push(0,1),_+2!==u&&g.push(this.stops[_+1][0]),n=this.doc.ref({FunctionType:2,Domain:[0,1],C0:this.stops[_+0][1],C1:this.stops[_+1][1],N:1}),w.push(n),n.end();1===u?n=w[0]:(n=this.doc.ref({FunctionType:3,Domain:[0,1],Functions:w,Bounds:g,Encode:y})).end(),this.id="Sh"+ ++this.doc._gradCount;var x=this.shader(n);x.end();var P=this.doc.ref({Type:"Pattern",PatternType:2,Shading:x,Matrix:this.matrix.map(Se)});if(P.end(),this.stops.some(function(r){return r[2]<1})){var k=this.opacityGradient();k._colorSpace="DeviceGray";for(var I,B=_createForOfIteratorHelperLoose(this.stops);!(I=B()).done;){var O=I.value;k.stop(O[0],[O[2]])}k=k.embed(this.matrix);var R=[0,0,this.doc.page.width,this.doc.page.height],D=this.doc.ref({Type:"XObject",Subtype:"Form",FormType:1,BBox:R,Group:{Type:"Group",S:"Transparency",CS:"DeviceGray"},Resources:{ProcSet:["PDF","Text","ImageB","ImageC","ImageI"],Pattern:{Sh1:k}}});D.write("/Pattern cs /Sh1 scn"),D.end(R.join(" ")+" re f");var N=this.doc.ref({Type:"ExtGState",SMask:{Type:"Mask",S:"Luminosity",G:D}});N.end();var U=this.doc.ref({Type:"Pattern",PatternType:1,PaintType:1,TilingType:2,BBox:R,XStep:R[2],YStep:R[3],Resources:{ProcSet:["PDF","Text","ImageB","ImageC","ImageI"],Pattern:{Sh1:P},ExtGState:{Gs1:N}}});U.write("/Gs1 gs /Pattern cs /Sh1 scn"),U.end(R.join(" ")+" re f"),this.doc.page.patterns[this.id]=U}else this.doc.page.patterns[this.id]=P;return P}},r.apply=function apply(r){var n=this.doc._ctm,u=n[0],p=n[1],g=n[2],y=n[3],w=n[4],_=n[5],x=this.transform,P=x[0],k=x[1],I=x[2],B=x[3],O=x[4],R=x[5],D=[u*P+g*k,p*P+y*k,u*I+g*B,p*I+y*B,u*O+g*R+w,p*O+y*R+_];this.embedded&&D.join(" ")===this.matrix.join(" ")||this.embed(D),this.doc._setColorSpace("Pattern",r);var N=r?"SCN":"scn";return this.doc.addContent("/"+this.id+" "+N)},PDFGradient}(),Ae={PDFGradient:xe,PDFLinearGradient:function(r){function PDFLinearGradient(n,u,p,g,y){var w;return(w=r.call(this,n)||this).x1=u,w.y1=p,w.x2=g,w.y2=y,w}_inheritsLoose(PDFLinearGradient,r);var n=PDFLinearGradient.prototype;return n.shader=function shader(r){return this.doc.ref({ShadingType:2,ColorSpace:this._colorSpace,Coords:[this.x1,this.y1,this.x2,this.y2],Function:r,Extend:[!0,!0]})},n.opacityGradient=function opacityGradient(){return new PDFLinearGradient(this.doc,this.x1,this.y1,this.x2,this.y2)},PDFLinearGradient}(xe),PDFRadialGradient:function(r){function PDFRadialGradient(n,u,p,g,y,w,_){var x;return(x=r.call(this,n)||this).doc=n,x.x1=u,x.y1=p,x.r1=g,x.x2=y,x.y2=w,x.r2=_,x}_inheritsLoose(PDFRadialGradient,r);var n=PDFRadialGradient.prototype;return n.shader=function shader(r){return this.doc.ref({ShadingType:3,ColorSpace:this._colorSpace,Coords:[this.x1,this.y1,this.r1,this.x2,this.y2,this.r2],Function:r,Extend:[!0,!0]})},n.opacityGradient=function opacityGradient(){return new PDFRadialGradient(this.doc,this.x1,this.y1,this.r1,this.x2,this.y2,this.r2)},PDFRadialGradient}(xe)},Ce=["DeviceCMYK","DeviceRGB"],Pe=function(){function PDFTilingPattern(r,n,u,p,g){this.doc=r,this.bBox=n,this.xStep=u,this.yStep=p,this.stream=g}var r=PDFTilingPattern.prototype;return r.createPattern=function createPattern(){var r=this.doc.ref();r.end();var n=this.doc._ctm,u=n[0],p=n[1],g=n[2],y=n[3],w=[1*u+0*g,1*p+0*y,0*u+1*g,0*p+1*y,0*u+0*g+n[4],0*p+0*y+n[5]],_=this.doc.ref({Type:"Pattern",PatternType:1,PaintType:2,TilingType:2,BBox:this.bBox,XStep:this.xStep,YStep:this.yStep,Matrix:w.map(function(r){return+r.toFixed(5)}),Resources:r});return _.end(this.stream),_},r.embedPatternColorSpaces=function embedPatternColorSpaces(){var r=this;Ce.forEach(function(n){var u=r.getPatternColorSpaceId(n);if(!r.doc.page.colorSpaces[u]){var p=r.doc.ref(["Pattern",n]);p.end(),r.doc.page.colorSpaces[u]=p}})},r.getPatternColorSpaceId=function getPatternColorSpaceId(r){return"CsP"+r},r.embed=function embed(){this.id||(this.doc._patternCount=this.doc._patternCount+1,this.id="P"+this.doc._patternCount,this.pattern=this.createPattern()),this.doc.page.patterns[this.id]||(this.doc.page.patterns[this.id]=this.pattern)},r.apply=function apply(r,n){this.embedPatternColorSpaces(),this.embed();var u=this.doc._normalizeColor(n);if(!u)throw Error("invalid pattern color. (value: "+n+")");var p=this.getPatternColorSpaceId(this.doc._getColorSpace(u));this.doc._setColorSpace(p,r);var g=r?"SCN":"scn";return this.doc.addContent(u.join(" ")+" /"+this.id+" "+g)},PDFTilingPattern}(),ke=Ae.PDFGradient,Ee=Ae.PDFLinearGradient,Te=Ae.PDFRadialGradient,Ie={PDFTilingPattern:Pe}.PDFTilingPattern,Be={initColor:function initColor(){return this.spotColors={},this._opacityRegistry={},this._opacityCount=0,this._patternCount=0,this._gradCount=0},_normalizeColor:function _normalizeColor(r){if("string"==typeof r)if("#"===r.charAt(0)){4===r.length&&(r=r.replace(/#([0-9A-F])([0-9A-F])([0-9A-F])/i,"#$1$1$2$2$3$3"));var n=parseInt(r.slice(1),16);r=[n>>16,n>>8&255,255&n]}else if(Oe[r])r=Oe[r];else if(this.spotColors[r])return this.spotColors[r];return Array.isArray(r)?(3===r.length?r=r.map(function(r){return r/255}):4===r.length&&(r=r.map(function(r){return r/100})),r):null},_setColor:function _setColor(r,n){return r instanceof ke?(r.apply(n),!0):Array.isArray(r)&&r[0]instanceof Ie?(r[0].apply(n,r[1]),!0):this._setColorCore(r,n)},_setColorCore:function _setColorCore(r,n){if(!(r=this._normalizeColor(r)))return!1;var u=n?"SCN":"scn",p=this._getColorSpace(r);return this._setColorSpace(p,n),r instanceof D?(this.page.colorSpaces[r.id]=r.ref,this.addContent("1 "+u)):this.addContent(r.join(" ")+" "+u),!0},_setColorSpace:function _setColorSpace(r,n){var u=n?"CS":"cs";return this.addContent("/"+r+" "+u)},_getColorSpace:function _getColorSpace(r){return r instanceof D?r.id:4===r.length?"DeviceCMYK":"DeviceRGB"},fillColor:function fillColor(r,n){return this._setColor(r,!1)&&this.fillOpacity(n),this._fillColor=[r,n],this},strokeColor:function strokeColor(r,n){return this._setColor(r,!0)&&this.strokeOpacity(n),this},opacity:function opacity(r){return this._doOpacity(r,r),this},fillOpacity:function fillOpacity(r){return this._doOpacity(r,null),this},strokeOpacity:function strokeOpacity(r){return this._doOpacity(null,r),this},_doOpacity:function _doOpacity(r,n){var u,p;if(null!=r||null!=n){null!=r&&(r=Math.max(0,Math.min(1,r))),null!=n&&(n=Math.max(0,Math.min(1,n)));var g=r+"_"+n;if(this._opacityRegistry[g]){var y=this._opacityRegistry[g];u=y[0],p=y[1]}else{u={Type:"ExtGState"},null!=r&&(u.ca=r),null!=n&&(u.CA=n),(u=this.ref(u)).end(),p="Gs"+ ++this._opacityCount,this._opacityRegistry[g]=[u,p]}return this.page.ext_gstates[p]=u,this.addContent("/"+p+" gs")}},linearGradient:function linearGradient(r,n,u,p){return new Ee(this,r,n,u,p)},radialGradient:function radialGradient(r,n,u,p,g,y){return new Te(this,r,n,u,p,g,y)},pattern:function pattern(r,n,u,p){return new Ie(this,r,n,u,p)},addSpotColor:function addSpotColor(r,n,u,p,g){var y=new D(this,r,n,u,p,g);return this.spotColors[r]=y,this}},Oe={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],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],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],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]};ge=ye=ve=me=be=we=0;var Le={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0},Fe={M:function M(r,n){return ge=n[0],ye=n[1],ve=me=null,be=ge,we=ye,r.moveTo(ge,ye)},m:function m(r,n){return ge+=n[0],ye+=n[1],ve=me=null,be=ge,we=ye,r.moveTo(ge,ye)},C:function C(r,n){return ge=n[4],ye=n[5],ve=n[2],me=n[3],r.bezierCurveTo.apply(r,n)},c:function c(r,n){return r.bezierCurveTo(n[0]+ge,n[1]+ye,n[2]+ge,n[3]+ye,n[4]+ge,n[5]+ye),ve=ge+n[2],me=ye+n[3],ge+=n[4],ye+=n[5]},S:function S(r,n){return null===ve&&(ve=ge,me=ye),r.bezierCurveTo(ge-(ve-ge),ye-(me-ye),n[0],n[1],n[2],n[3]),ve=n[0],me=n[1],ge=n[2],ye=n[3]},s:function s(r,n){return null===ve&&(ve=ge,me=ye),r.bezierCurveTo(ge-(ve-ge),ye-(me-ye),ge+n[0],ye+n[1],ge+n[2],ye+n[3]),ve=ge+n[0],me=ye+n[1],ge+=n[2],ye+=n[3]},Q:function Q(r,n){return ve=n[0],me=n[1],ge=n[2],ye=n[3],r.quadraticCurveTo(n[0],n[1],ge,ye)},q:function q(r,n){return r.quadraticCurveTo(n[0]+ge,n[1]+ye,n[2]+ge,n[3]+ye),ve=ge+n[0],me=ye+n[1],ge+=n[2],ye+=n[3]},T:function T(r,n){return null===ve?(ve=ge,me=ye):(ve=ge-(ve-ge),me=ye-(me-ye)),r.quadraticCurveTo(ve,me,n[0],n[1]),ve=ge-(ve-ge),me=ye-(me-ye),ge=n[0],ye=n[1]},t:function t(r,n){return null===ve?(ve=ge,me=ye):(ve=ge-(ve-ge),me=ye-(me-ye)),r.quadraticCurveTo(ve,me,ge+n[0],ye+n[1]),ge+=n[0],ye+=n[1]},A:function A(r,n){return Re(r,ge,ye,n),ge=n[5],ye=n[6]},a:function a(r,n){return n[5]+=ge,n[6]+=ye,Re(r,ge,ye,n),ge=n[5],ye=n[6]},L:function L(r,n){return ge=n[0],ye=n[1],ve=me=null,r.lineTo(ge,ye)},l:function l(r,n){return ge+=n[0],ye+=n[1],ve=me=null,r.lineTo(ge,ye)},H:function H(r,n){return ge=n[0],ve=me=null,r.lineTo(ge,ye)},h:function h(r,n){return ge+=n[0],ve=me=null,r.lineTo(ge,ye)},V:function V(r,n){return ye=n[0],ve=me=null,r.lineTo(ge,ye)},v:function v(r,n){return ye+=n[0],ve=me=null,r.lineTo(ge,ye)},Z:function Z(r){return r.closePath(),ge=be,ye=we},z:function z(r){return r.closePath(),ge=be,ye=we}},Re=function solveArc(r,n,u,p){for(var g,y=p[0],w=p[1],_=p[2],x=p[3],P=p[4],k=p[5],I=p[6],B=_createForOfIteratorHelperLoose(De(k,I,y,w,x,P,_,n,u));!(g=B()).done;){var O=g.value,R=Me.apply(void 0,O);r.bezierCurveTo.apply(r,R)}},De=function arcToSegments(r,n,u,p,g,y,w,_,x){var P=w*(Math.PI/180),k=Math.sin(P),I=Math.cos(P);u=Math.abs(u),p=Math.abs(p);var B=(ve=I*(_-r)*.5+k*(x-n)*.5)*ve/(u*u)+(me=I*(x-n)*.5-k*(_-r)*.5)*me/(p*p);B>1&&(u*=B=Math.sqrt(B),p*=B);var O=I/u,R=k/u,D=-k/p,N=I/p,U=O*_+R*x,W=D*_+N*x,j=O*r+R*n,G=D*r+N*n,X=1/((j-U)*(j-U)+(G-W)*(G-W))-.25;X<0&&(X=0);var Y=Math.sqrt(X);y===g&&(Y=-Y);var K=.5*(U+j)-Y*(G-W),J=.5*(W+G)+Y*(j-U),$=Math.atan2(W-J,U-K),ee=Math.atan2(G-J,j-K)-$;ee<0&&1===y?ee+=2*Math.PI:ee>0&&0===y&&(ee-=2*Math.PI);for(var te=Math.ceil(Math.abs(ee/(.5*Math.PI+.001))),re=[],ne=0;ne<te;ne++){var ie=$+ne*ee/te,oe=$+(ne+1)*ee/te;re[ne]=[K,J,ie,oe,u,p,k,I]}return re},Me=function segmentToBezier(r,n,u,p,g,y,w,_){var x=_*g,P=-w*y,k=w*g,I=_*y,B=.5*(p-u),O=8/3*Math.sin(.5*B)*Math.sin(.5*B)/Math.sin(B),R=r+Math.cos(u)-O*Math.sin(u),D=n+Math.sin(u)+O*Math.cos(u),N=r+Math.cos(p),U=n+Math.sin(p),W=N+O*Math.sin(p),j=U-O*Math.cos(p);return[x*R+P*D,k*R+I*D,x*W+P*j,k*W+I*j,x*N+P*U,k*N+I*U]},Ne=function(){function SVGPath(){}return SVGPath.apply=function apply(r,n){var u=function parse(r){for(var n,u,p=[],g=[],y="",w=!1,_=0,x=_createForOfIteratorHelperLoose(r);!(u=x()).done;){var P=u.value;if(null!=Le[P])_=Le[P],n&&(y.length>0&&(g[g.length]=+y),p[p.length]={cmd:n,args:g},g=[],y="",w=!1),n=P;else if([" ",","].includes(P)||"-"===P&&y.length>0&&"e"!==y[y.length-1]||"."===P&&w){if(0===y.length)continue;g.length===_?(p[p.length]={cmd:n,args:g},g=[+y],"M"===n&&(n="L"),"m"===n&&(n="l")):g[g.length]=+y,w="."===P,y=["-","."].includes(P)?P:""}else y+=P,"."===P&&(w=!0)}return y.length>0&&(g.length===_?(p[p.length]={cmd:n,args:g},g=[+y],"M"===n&&(n="L"),"m"===n&&(n="l")):g[g.length]=+y),p[p.length]={cmd:n,args:g},p}(n);!function apply(r,n){ge=ye=ve=me=be=we=0;for(var u=0;u<r.length;u++){var p=r[u];"function"==typeof Fe[p.cmd]&&Fe[p.cmd](n,p.args)}}(u,r)},SVGPath}(),Ue=j.number,We=(Math.sqrt(2)-1)/3*4,ze={initVector:function initVector(){return this._ctm=[1,0,0,1,0,0],this._ctmStack=[]},save:function save(){return this._ctmStack.push(this._ctm.slice()),this.addContent("q")},restore:function restore(){return this._ctm=this._ctmStack.pop()||[1,0,0,1,0,0],this.addContent("Q")},closePath:function closePath(){return this.addContent("h")},lineWidth:function lineWidth(r){return this.addContent(Ue(r)+" w")},_CAP_STYLES:{BUTT:0,ROUND:1,SQUARE:2},lineCap:function lineCap(r){return"string"==typeof r&&(r=this._CAP_STYLES[r.toUpperCase()]),this.addContent(r+" J")},_JOIN_STYLES:{MITER:0,ROUND:1,BEVEL:2},lineJoin:function lineJoin(r){return"string"==typeof r&&(r=this._JOIN_STYLES[r.toUpperCase()]),this.addContent(r+" j")},miterLimit:function miterLimit(r){return this.addContent(Ue(r)+" M")},dash:function dash(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=r;if(Array.isArray(r)||(r=[r,n.space||r]),!r.every(function(r){return Number.isFinite(r)&&r>0}))throw new Error("dash("+JSON.stringify(u)+", "+JSON.stringify(n)+") invalid, lengths must be numeric and greater than zero");return r=r.map(Ue).join(" "),this.addContent("["+r+"] "+Ue(n.phase||0)+" d")},undash:function undash(){return this.addContent("[] 0 d")},moveTo:function moveTo(r,n){return this.addContent(Ue(r)+" "+Ue(n)+" m")},lineTo:function lineTo(r,n){return this.addContent(Ue(r)+" "+Ue(n)+" l")},bezierCurveTo:function bezierCurveTo(r,n,u,p,g,y){return this.addContent(Ue(r)+" "+Ue(n)+" "+Ue(u)+" "+Ue(p)+" "+Ue(g)+" "+Ue(y)+" c")},quadraticCurveTo:function quadraticCurveTo(r,n,u,p){return this.addContent(Ue(r)+" "+Ue(n)+" "+Ue(u)+" "+Ue(p)+" v")},rect:function rect(r,n,u,p){return this.addContent(Ue(r)+" "+Ue(n)+" "+Ue(u)+" "+Ue(p)+" re")},roundedRect:function roundedRect(r,n,u,p,g){null==g&&(g=0);var y=(g=Math.min(g,.5*u,.5*p))*(1-We);return this.moveTo(r+g,n),this.lineTo(r+u-g,n),this.bezierCurveTo(r+u-y,n,r+u,n+y,r+u,n+g),this.lineTo(r+u,n+p-g),this.bezierCurveTo(r+u,n+p-y,r+u-y,n+p,r+u-g,n+p),this.lineTo(r+g,n+p),this.bezierCurveTo(r+y,n+p,r,n+p-y,r,n+p-g),this.lineTo(r,n+g),this.bezierCurveTo(r,n+y,r+y,n,r+g,n),this.closePath()},ellipse:function ellipse(r,n,u,p){null==p&&(p=u);var g=u*We,y=p*We,w=(r-=u)+2*u,_=(n-=p)+2*p,x=r+u,P=n+p;return this.moveTo(r,P),this.bezierCurveTo(r,P-y,x-g,n,x,n),this.bezierCurveTo(x+g,n,w,P-y,w,P),this.bezierCurveTo(w,P+y,x+g,_,x,_),this.bezierCurveTo(x-g,_,r,P+y,r,P),this.closePath()},circle:function circle(r,n,u){return this.ellipse(r,n,u)},arc:function arc(r,n,u,p,g,y){null==y&&(y=!1);var w=2*Math.PI,_=.5*Math.PI,x=g-p;if(Math.abs(x)>w)x=w;else if(0!==x&&y!==x<0){x=(y?-1:1)*w+x}var P=Math.ceil(Math.abs(x)/_),k=x/P,I=k/_*We*u,B=p,O=-Math.sin(B)*I,R=Math.cos(B)*I,D=r+Math.cos(B)*u,N=n+Math.sin(B)*u;this.moveTo(D,N);for(var U=0;U<P;U++){var W=D+O,j=N+R;B+=k,D=r+Math.cos(B)*u,N=n+Math.sin(B)*u;var G=D-(O=-Math.sin(B)*I),X=N-(R=Math.cos(B)*I);this.bezierCurveTo(W,j,G,X,D,N)}return this},polygon:function polygon(){for(var r=arguments.length,n=new Array(r),u=0;u<r;u++)n[u]=arguments[u];this.moveTo.apply(this,n.shift()||[]);for(var p=0,g=n;p<g.length;p++){var y=g[p];this.lineTo.apply(this,y||[])}return this.closePath()},path:function path(r){return Ne.apply(this,r),this},_windingRule:function _windingRule(r){return/even-?odd/.test(r)?"*":""},fill:function fill(r,n){return/(even-?odd)|(non-?zero)/.test(r)&&(n=r,r=null),r&&this.fillColor(r),this.addContent("f"+this._windingRule(n))},stroke:function stroke(r){return r&&this.strokeColor(r),this.addContent("S")},fillAndStroke:function fillAndStroke(r,n,u){null==n&&(n=r);var p=/(even-?odd)|(non-?zero)/;return p.test(r)&&(u=r,r=null),p.test(n)&&(u=n,n=r),r&&(this.fillColor(r),this.strokeColor(n)),this.addContent("B"+this._windingRule(u))},clip:function clip(r){return this.addContent("W"+this._windingRule(r)+" n")},transform:function transform(r,n,u,p,g,y){if(1===r&&0===n&&0===u&&1===p&&0===g&&0===y)return this;var w=this._ctm,_=w[0],x=w[1],P=w[2],k=w[3],I=w[4],B=w[5];w[0]=_*r+P*n,w[1]=x*r+k*n,w[2]=_*u+P*p,w[3]=x*u+k*p,w[4]=_*g+P*y+I,w[5]=x*g+k*y+B;var O=[r,n,u,p,g,y].map(function(r){return Ue(r)}).join(" ");return this.addContent(O+" cm")},translate:function translate(r,n){return this.transform(1,0,0,1,r,n)},rota