@sv-print/plugin-api-image 0.1.3 → 0.1.5

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/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @sv-print/plugin-api-image
2
+
3
+ 给 sv-print 提供导出图片的 API 插件。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @sv-print/plugin-api-image
9
+ ```
10
+
11
+ ```js
12
+ import pluginApiImage from "@sv-print/plugin-api-image";
13
+ const plugins = [pluginApiImage({})];
14
+ ```
15
+
16
+ ## 示例
17
+
18
+ ```js
19
+ let hiprintTemplate = new hiprint.PrintTemplate(options);
20
+ // 其中 “text” 是一个元素的 “字段名(field)”
21
+ let printData = { text: "这是打印时显示的文本" };
22
+ // 导出图片, 获取 url/blob 对象
23
+ const res = await hiprintTemplate.toImage(printData, {
24
+ isDownload: false, // 不自动下载
25
+ name: "图片名称",
26
+ limit: 10, // 默认 10 多少页为一个 图片文件, 太多 图片文件就很长
27
+ type: "image/jpeg", // 默认 image/jpeg --> canvas.toDataURL(type, quality)
28
+ pixelRatio: 2, // 图片像素比 2: 提高清晰度 默认 window.devicePixelRatio.
29
+ quality: 0.8, // 默认 0.92 图片质量 0-1
30
+ toType: "url", // 默认 url 支持: url、blob
31
+ onProgress: (cur, total) => {
32
+ const percent = Math.floor((cur / total) * 100);
33
+ console.log("toImage 进度", percent);
34
+ },
35
+ });
36
+ console.log("toImage", res);
37
+ ```
38
+
39
+ ## License
40
+
41
+ LGPL
42
+
43
+ ### 开源使用须知
44
+
45
+ 1.请自觉遵守 LGPL 协议,其他用途可联系作者;
46
+
47
+ 2.允许用于个人学习、毕业设计、教学案例、公益事业、商业使用;
48
+
49
+ 3.如果商用必须保留版权信息,请自觉遵守;
50
+
51
+ 4.禁止将本开源的代码和资源进行任何形式任何名义的出售,否则产生的一切任何后果责任由侵权者自负;
52
+
53
+ 5.商用请仔细审查代码和漏洞,不得用于任一国家许可范围之外的商业应用,产生的一切任何后果责任自负;
54
+
55
+ ```
56
+
57
+ ```
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var E=(c,x,e)=>new Promise((a,s)=>{var h=i=>{try{v(e.next(i))}catch(p){s(p)}},b=i=>{try{v(e.throw(i))}catch(p){s(p)}},v=i=>i.done?a(i.value):Promise.resolve(i.value).then(h,b);v((e=e.apply(c,x)).next())});const J=require("html-to-image");function L(c){if(c&&c.__esModule)return c;const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const e in c)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(c,e);Object.defineProperty(x,e,a.get?a:{enumerable:!0,get:()=>c[e]})}}return x.default=c,Object.freeze(x)}const N=L(J);(function(c,x){const e=P,a=c();for(;[];)try{if(parseInt(e(256))/1*(-parseInt(e(251))/2)+parseInt(e(202))/3+-parseInt(e(240))/4*(-parseInt(e(262))/5)+-parseInt(e(249))/6+-parseInt(e(257))/7*(parseInt(e(265))/8)+parseInt(e(214))/9+parseInt(e(209))/10*(-parseInt(e(266))/11)===x)break;a.push(a.shift())}catch(s){a.push(a.shift())}})(O,895242);function P(c,x){const e=O();return P=function(a,s){return a=a-198,e[a]},P(c,x)}function O(){const c=["devicePixelRatio","pop","none","add","download.jpg","clear","hinnn","loadAllImages","gif","blob","getHtml","bmp","drawImage","getContext","width","png","log","end","toType","2140296JIAPBS","limit","svg","appendChild","start",".jpg","run","80HKLNvz","clearRect","toBlob","floor","toLowerCase","14153616tpUZDS","css","then","base64","isDownload","extend","promise","onProgress","indexOf","createElement",".hiprint-printPanel .hiprint-printPaper","printPanels","resolve","cur","queue","removeTempContainer","length","push","html","height","name","webp","onload","quality","#fff","baseURI","4mSGYjc","IMG","toCanvas","createTempContainer","canvas","svg2canvas","ceil","replace","imageSmoothingEnabled","3318840FwheCH","toDataURL","2enrpHW","display","http","tagName","remove","221627spbDRI","238pIEAXC","jpeg","includes","click","pixelRatio","2667735awVlxc","total","src","199624IHMSBy","414139JwxQRn","type","image/jpeg","url","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "];return O=function(){return c},O()}const Q=function(c,x){return E(this,null,function*(){const e=P;let a=this,s=globalThis.$.Deferred(),h=!![],b=10,v=(i,p)=>{const f=P,T=Math[f(212)](i/p*100);console[f(199)](f(227),i,f(263),p),console[f(199)]("toImage percent: ",T+"%")};if(this[e(225)][e(230)]){let i=globalThis.$[e(219)]({filter:t=>{const n=e;return t[n(254)]!=n(241)||t[n(254)]=="IMG"&&(["jpg",n(258),n(198),n(279),n(282),n(235),n(204)][n(259)](t[n(264)].split(".")[n(272)]()[n(213)]())||t[n(264)]!=t.baseURI||t[n(264)][n(222)](n(253))>-1&&t.src!=t[n(239)]||t[n(264)][n(222)](n(217))>-1)},backgroundColor:e(238)},x||{}),p=yield this[e(281)](c,x);x&&x[e(218)]!=null&&(h=x[e(218)]),x&&x.onProgress!=null&&(v=x[e(221)]),x&&x[e(203)]!=null&&(b=x[e(203)]),globalThis.$(p)[e(215)]("width","")[e(215)](e(233),""),this[e(243)]();let f=this.getTempContainer();this[e(245)](p,i),f[e(232)](p[0]);let T=f.find(e(224))[e(230)];globalThis.$(p)[e(215)]("position:fixed"),this[e(278)](p,function(){const t=e;try{let n=[],H=Math[t(246)](T/b),$=T%b||1;const u=document[t(223)](t(244)),S=u[t(284)]("2d"),U=f.width()*(i[t(261)]||globalThis[t(271)]);for(let w=0;w<H;w++){S[t(210)](0,0,u.width,u.height);const C=w==H-1;let q=0,D=C?$:b;for(let g=0;g<D;g++){S.clearRect(0,0,u[t(285)],u[t(233)]);const r=w*b+g,y=f.find(t(224))[r];globalThis[t(277)][t(228)][t(274)](function(R){const _=t;N[_(242)](y,i)[_(216)](function(m){const l=_;let I=m[l(284)]("2d");I[l(248)]=![];let j=m[l(250)](l(268),i.quality||.92),o=new Image;o[l(264)]=j,o[l(236)]=function(){const d=l;g===0&&(u[d(285)]=U,u[d(233)]=o[d(233)]*D),q+=o.height,S[d(283)](o,0,q-o[d(233)],U,o[d(233)]),v(r+1,T),R()}})})}globalThis.hinnn[t(228)][t(274)](function(g){const r=t;let y=i[r(267)]||r(268),R=i[r(201)]||r(269),_=i[r(237)]||.8;if(h){let m=u[r(250)](y,_),l=new Image;l[r(264)]=m,l[r(236)]=function(){const I=r;n[I(231)]({url:m,start:w*b+1,end:w*b+D}),C&&(globalThis[I(277)][I(228)][I(276)](),a.removeTempContainer(),n.forEach(j=>{const o=I;let d=document[o(223)]("a"),A=x[o(234)]||o(275);A[o(222)](".")==-1&&(A+=o(207));let G=A.split(".").pop(),B=A[o(247)]("."+G,"")+"_"+j[o(206)]+"-"+j[o(200)]+"."+G;d.style[o(252)]=o(273),d.setAttribute("download",B),d.setAttribute("href",j[o(269)]),document.body[o(205)](d),d[o(260)](),d[o(255)]()})),g()};return}if(R=="url"){n.push(u[r(250)](y,_)),C&&(globalThis[r(277)][r(228)].clear(),a[r(229)](),s[r(226)](n)),g();return}R==r(280)&&u[r(211)](function(m){const l=r;n.push(m),C&&(globalThis.hinnn[l(228)].clear(),a[l(229)](),s[l(226)](n)),g()},y,_)})}globalThis[t(277)][t(228)][t(208)]()}catch(n){console.error(t(270)),console[t(199)](n)}})}return s[e(220)]()})};function k(){var c=["defineProperty","154908jgjsRx","27WstqnP","newPrintTemplate","363625tshdTi","add toImage Api","9gphsIY","1161755vwfrIX","1449328biOYGf","2199246sJUgcZ","167046aGRQjC","toImage","add toImage Api to PrintTemplate","45538AUpZQg"];return k=function(){return c},k()}(function(c,x){for(var e=M,a=c();[];)try{var s=-parseInt(e(415))/1+-parseInt(e(410))/2*(parseInt(e(417))/3)+parseInt(e(412))/4+-parseInt(e(404))/5+-parseInt(e(407))/6+parseInt(e(406))/7+-parseInt(e(405))/8*(-parseInt(e(413))/9);if(s===x)break;a.push(a.shift())}catch(h){a.push(a.shift())}})(k,204279);function M(c,x){var e=k();return M=function(a,s){a=a-404;var h=e[a];return h},M(c,x)}function Y(c){var x=M;return{name:"add toImage Api",description:x(416),hooks:[{hook:x(414),name:x(409),description:x(409),priority:1,run:({template:e,options:a})=>{var s=x;Object[s(411)](e,s(408),{value:Q,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}module.exports=Y;
1
+ "use strict";var J=(o,x,e)=>new Promise((a,l)=>{var u=c=>{try{v(e.next(c))}catch(d){l(d)}},f=c=>{try{v(e.throw(c))}catch(d){l(d)}},v=c=>c.done?a(c.value):Promise.resolve(c.value).then(u,f);v((e=e.apply(o,x)).next())});const q=require("html-to-image");function H(o){if(o&&o.__esModule)return o;const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(x,e,a.get?a:{enumerable:!0,get:()=>o[e]})}}return x.default=o,Object.freeze(x)}const N=H(q);(function(o,x){const e=P,a=o();for(;[];)try{if(parseInt(e(121))/1+parseInt(e(129))/2*(parseInt(e(194))/3)+-parseInt(e(170))/4+parseInt(e(189))/5+parseInt(e(180))/6*(parseInt(e(183))/7)+parseInt(e(155))/8*(parseInt(e(181))/9)+parseInt(e(149))/10===x)break;a.push(a.shift())}catch(l){a.push(a.shift())}})(D,991174);function P(o,x){const e=D();return P=function(a,l){return a=a-121,e[a]},P(o,x)}function D(){const o=["width","length","onProgress","786774QlvfCR","2529vzCFjv","jpeg","7QPlNUb","href","createTempContainer","tagName","IMG","start","2539020czDXaj","type","setAttribute","canvas","image/jpeg","49341YZEtsF","log","none","onload","png","display","name","clearRect","toCanvas","853269zbdRQK","removeTempContainer","svg2canvas","toDataURL","position:fixed","src","style","queue","16iZCsdz","webp","then","resolve","add","indexOf","url","gif","toType","getHtml","download","appendChild","replace","baseURI","#fff","run","getContext","height","remove","end","959830dWTsDh","base64","css","bmp","quality","devicePixelRatio","31816vZVFMp","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","http","limit","loadAllImages","hinnn","body","split","createElement",".hiprint-printPanel .hiprint-printPaper","clear","forEach","jpg","includes","isDownload","7384496gCQMez","cur","printPanels","push","svg","imageSmoothingEnabled","drawImage"];return D=function(){return o},D()}const S=function(o,x){return J(this,null,function*(){const e=P;let a=this,l=globalThis.$.Deferred(),u=!![],f=10,v=(c,d)=>{const h=P,w=Math.floor(c/d*100);console[h(195)](h(171),c,"total",d),console[h(195)]("toImage percent: ",w+"%")};if(this[e(172)][e(178)]){let c=globalThis.$.extend({filter:t=>{const n=e;return t[n(186)]!=n(187)||t[n(186)]==n(187)&&([n(167),n(182),n(198),n(136),n(152),n(130),n(174)][n(168)](t.src[n(162)](".").pop().toLowerCase())||t[n(126)]!=t[n(142)]||t[n(126)][n(134)](n(157))>-1&&t[n(126)]!=t.baseURI||t.src[n(134)](n(150))>-1)},backgroundColor:e(143)},x||{}),d=yield this[e(138)](o,x);x&&x[e(169)]!=null&&(u=x.isDownload),x&&x[e(179)]!=null&&(v=x[e(179)]),x&&x[e(158)]!=null&&(f=x[e(158)]),globalThis.$(d)[e(151)](e(177),"")[e(151)](e(146),""),this[e(185)]();let h=this.getTempContainer();this[e(123)](d,c),h.html(d[0]);let w=h.find(e(164)).length;globalThis.$(d)[e(151)](e(125)),this[e(159)](d,function(){const t=e;try{let n=[],L=Math.ceil(w/f),Q=w%f||1;const p=document[t(163)](t(192)),z=p[t(145)]("2d"),U=h[t(177)]()*(c.pixelRatio||globalThis[t(154)]);for(let T=0;T<L;T++){z[t(201)](0,0,p[t(177)],p[t(146)]);const j=T==L-1;let E=0,A=j?Q:f;for(let g=0;g<A;g++){z[t(201)](0,0,p[t(177)],p[t(146)]);const i=T*f+g,y=h.find(t(164))[i];globalThis.hinnn[t(128)].add(function(R){const _=t;N[_(202)](y,c)[_(131)](function(m){const s=_;let I=m[s(145)]("2d");I[s(175)]=![];let C=m.toDataURL(s(193),c[s(153)]||.92),r=new Image;r[s(126)]=C,r.onload=function(){const b=s;g===0&&(p.width=U,p[b(146)]=r[b(146)]*A),E+=r[b(146)],z[b(176)](r,0,E-r.height,U,r[b(146)]),v(i+1,w),R()}})})}globalThis[t(160)][t(128)][t(133)](function(g){const i=t;let y=c[i(190)]||i(193),R=c[i(137)]||i(135),_=c[i(153)]||.8;if(u){let m=p[i(124)](y,_),s=new Image;s[i(126)]=m,s[i(197)]=function(){const I=i;n[I(173)]({url:m,start:T*f+1,end:T*f+A}),j&&(globalThis.hinnn[I(128)][I(165)](),a.removeTempContainer(),n[I(166)](C=>{const r=I;let b=document[r(163)]("a"),k=x[r(200)]||"download.jpg";k.indexOf(".")==-1&&(k+=".jpg");let F=k.split(".").pop(),Z=k[r(141)]("."+F,"")+"_"+C[r(188)]+"-"+C[r(148)]+"."+F;b[r(127)][r(199)]=r(196),b[r(191)](r(139),Z),b.setAttribute(r(184),C[r(135)]),document[r(161)][r(140)](b),b.click(),b[r(147)]()})),g()};return}if(R==i(135)){n[i(173)](p[i(124)](y,_)),j&&(globalThis[i(160)].queue[i(165)](),a[i(122)](),l.resolve(n)),g();return}R=="blob"&&p.toBlob(function(m){const s=i;n[s(173)](m),j&&(globalThis[s(160)][s(128)][s(165)](),a[s(122)](),l[s(132)](n)),g()},y,_)})}globalThis.hinnn[t(128)][t(144)]()}catch(n){console.error(t(156)),console[t(195)](n)}})}return l.promise()})};function M(){var o=["110hNAxTx","defineProperty","add toImage Api","27iJLQtX","907488zaJTgt","203481uJSZxH","10544072CIsEkd","350644RiFwCg","35804LGMroR","0.3.0","42LTpdBP","1195168UxwgXP","newPrintTemplate","30dLHoRe","toImage","59352JFwoZJ","add toImage Api to PrintTemplate"];return M=function(){return o},M()}function O(o,x){var e=M();return O=function(a,l){a=a-159;var u=e[a];return u},O(o,x)}(function(o,x){for(var e=O,a=o();[];)try{var l=-parseInt(e(167))/1*(-parseInt(e(172))/2)+-parseInt(e(169))/3+parseInt(e(162))/4*(parseInt(e(164))/5)+parseInt(e(174))/6*(parseInt(e(171))/7)+-parseInt(e(175))/8+parseInt(e(168))/9*(parseInt(e(160))/10)+-parseInt(e(170))/11;if(l===x)break;a.push(a.shift())}catch(u){a.push(a.shift())}})(M,287155);function $(o){var x=O;return{name:"add toImage Api",description:x(166),hooks:[{hook:x(159),name:x(163),description:x(163),priority:1,run:({template:e,options:a})=>{var l=x;Object[l(165)](e,l(161),{value:S,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:x(173)}}module.exports=$;
package/dist/index.mjs CHANGED
@@ -1,153 +1,153 @@
1
- var $ = (i, n, x) => new Promise((a, s) => {
2
- var b = (r) => {
1
+ var Q = (s, n, x) => new Promise((a, l) => {
2
+ var u = (i) => {
3
3
  try {
4
- v(x.next(r));
5
- } catch (p) {
6
- s(p);
4
+ v(x.next(i));
5
+ } catch (d) {
6
+ l(d);
7
7
  }
8
- }, u = (r) => {
8
+ }, f = (i) => {
9
9
  try {
10
- v(x.throw(r));
11
- } catch (p) {
12
- s(p);
10
+ v(x.throw(i));
11
+ } catch (d) {
12
+ l(d);
13
13
  }
14
- }, v = (r) => r.done ? a(r.value) : Promise.resolve(r.value).then(b, u);
15
- v((x = x.apply(i, n)).next());
14
+ }, v = (i) => i.done ? a(i.value) : Promise.resolve(i.value).then(u, f);
15
+ v((x = x.apply(s, n)).next());
16
16
  });
17
- import * as L from "html-to-image";
18
- (function(i, n) {
19
- const x = P, a = i();
17
+ import * as $ from "html-to-image";
18
+ (function(s, n) {
19
+ const x = R, a = s();
20
20
  for (; []; )
21
21
  try {
22
- if (parseInt(x(256)) / 1 * (-parseInt(x(251)) / 2) + parseInt(x(202)) / 3 + -parseInt(x(240)) / 4 * (-parseInt(x(262)) / 5) + -parseInt(x(249)) / 6 + -parseInt(x(257)) / 7 * (parseInt(x(265)) / 8) + parseInt(x(214)) / 9 + parseInt(x(209)) / 10 * (-parseInt(x(266)) / 11) === n)
22
+ if (parseInt(x(121)) / 1 + parseInt(x(129)) / 2 * (parseInt(x(194)) / 3) + -parseInt(x(170)) / 4 + parseInt(x(189)) / 5 + parseInt(x(180)) / 6 * (parseInt(x(183)) / 7) + parseInt(x(155)) / 8 * (parseInt(x(181)) / 9) + parseInt(x(149)) / 10 === n)
23
23
  break;
24
24
  a.push(a.shift());
25
- } catch (s) {
25
+ } catch (l) {
26
26
  a.push(a.shift());
27
27
  }
28
- })(k, 895242);
29
- function P(i, n) {
30
- const x = k();
31
- return P = function(a, s) {
32
- return a = a - 198, x[a];
33
- }, P(i, n);
28
+ })(A, 991174);
29
+ function R(s, n) {
30
+ const x = A();
31
+ return R = function(a, l) {
32
+ return a = a - 121, x[a];
33
+ }, R(s, n);
34
34
  }
35
- function k() {
36
- const i = ["devicePixelRatio", "pop", "none", "add", "download.jpg", "clear", "hinnn", "loadAllImages", "gif", "blob", "getHtml", "bmp", "drawImage", "getContext", "width", "png", "log", "end", "toType", "2140296JIAPBS", "limit", "svg", "appendChild", "start", ".jpg", "run", "80HKLNvz", "clearRect", "toBlob", "floor", "toLowerCase", "14153616tpUZDS", "css", "then", "base64", "isDownload", "extend", "promise", "onProgress", "indexOf", "createElement", ".hiprint-printPanel .hiprint-printPaper", "printPanels", "resolve", "cur", "queue", "removeTempContainer", "length", "push", "html", "height", "name", "webp", "onload", "quality", "#fff", "baseURI", "4mSGYjc", "IMG", "toCanvas", "createTempContainer", "canvas", "svg2canvas", "ceil", "replace", "imageSmoothingEnabled", "3318840FwheCH", "toDataURL", "2enrpHW", "display", "http", "tagName", "remove", "221627spbDRI", "238pIEAXC", "jpeg", "includes", "click", "pixelRatio", "2667735awVlxc", "total", "src", "199624IHMSBy", "414139JwxQRn", "type", "image/jpeg", "url", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "];
37
- return k = function() {
38
- return i;
39
- }, k();
35
+ function A() {
36
+ const s = ["width", "length", "onProgress", "786774QlvfCR", "2529vzCFjv", "jpeg", "7QPlNUb", "href", "createTempContainer", "tagName", "IMG", "start", "2539020czDXaj", "type", "setAttribute", "canvas", "image/jpeg", "49341YZEtsF", "log", "none", "onload", "png", "display", "name", "clearRect", "toCanvas", "853269zbdRQK", "removeTempContainer", "svg2canvas", "toDataURL", "position:fixed", "src", "style", "queue", "16iZCsdz", "webp", "then", "resolve", "add", "indexOf", "url", "gif", "toType", "getHtml", "download", "appendChild", "replace", "baseURI", "#fff", "run", "getContext", "height", "remove", "end", "959830dWTsDh", "base64", "css", "bmp", "quality", "devicePixelRatio", "31816vZVFMp", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "http", "limit", "loadAllImages", "hinnn", "body", "split", "createElement", ".hiprint-printPanel .hiprint-printPaper", "clear", "forEach", "jpg", "includes", "isDownload", "7384496gCQMez", "cur", "printPanels", "push", "svg", "imageSmoothingEnabled", "drawImage"];
37
+ return A = function() {
38
+ return s;
39
+ }, A();
40
40
  }
41
- const O = function(i, n) {
42
- return $(this, null, function* () {
43
- const x = P;
44
- let a = this, s = globalThis.$.Deferred(), b = !![], u = 10, v = (r, p) => {
45
- const f = P, T = Math[f(212)](r / p * 100);
46
- console[f(199)](f(227), r, f(263), p), console[f(199)]("toImage percent: ", T + "%");
41
+ const q = function(s, n) {
42
+ return Q(this, null, function* () {
43
+ const x = R;
44
+ let a = this, l = globalThis.$.Deferred(), u = !![], f = 10, v = (i, d) => {
45
+ const h = R, w = Math.floor(i / d * 100);
46
+ console[h(195)](h(171), i, "total", d), console[h(195)]("toImage percent: ", w + "%");
47
47
  };
48
- if (this[x(225)][x(230)]) {
49
- let r = globalThis.$[x(219)]({ filter: (e) => {
48
+ if (this[x(172)][x(178)]) {
49
+ let i = globalThis.$.extend({ filter: (e) => {
50
50
  const t = x;
51
- return e[t(254)] != t(241) || e[t(254)] == "IMG" && (["jpg", t(258), t(198), t(279), t(282), t(235), t(204)][t(259)](e[t(264)].split(".")[t(272)]()[t(213)]()) || e[t(264)] != e.baseURI || e[t(264)][t(222)](t(253)) > -1 && e.src != e[t(239)] || e[t(264)][t(222)](t(217)) > -1);
52
- }, backgroundColor: x(238) }, n || {}), p = yield this[x(281)](i, n);
53
- n && n[x(218)] != null && (b = n[x(218)]), n && n.onProgress != null && (v = n[x(221)]), n && n[x(203)] != null && (u = n[x(203)]), globalThis.$(p)[x(215)]("width", "")[x(215)](x(233), ""), this[x(243)]();
54
- let f = this.getTempContainer();
55
- this[x(245)](p, r), f[x(232)](p[0]);
56
- let T = f.find(x(224))[x(230)];
57
- globalThis.$(p)[x(215)]("position:fixed"), this[x(278)](p, function() {
51
+ return e[t(186)] != t(187) || e[t(186)] == t(187) && ([t(167), t(182), t(198), t(136), t(152), t(130), t(174)][t(168)](e.src[t(162)](".").pop().toLowerCase()) || e[t(126)] != e[t(142)] || e[t(126)][t(134)](t(157)) > -1 && e[t(126)] != e.baseURI || e.src[t(134)](t(150)) > -1);
52
+ }, backgroundColor: x(143) }, n || {}), d = yield this[x(138)](s, n);
53
+ n && n[x(169)] != null && (u = n.isDownload), n && n[x(179)] != null && (v = n[x(179)]), n && n[x(158)] != null && (f = n[x(158)]), globalThis.$(d)[x(151)](x(177), "")[x(151)](x(146), ""), this[x(185)]();
54
+ let h = this.getTempContainer();
55
+ this[x(123)](d, i), h.html(d[0]);
56
+ let w = h.find(x(164)).length;
57
+ globalThis.$(d)[x(151)](x(125)), this[x(159)](d, function() {
58
58
  const e = x;
59
59
  try {
60
- let t = [], M = Math[e(246)](T / u), B = T % u || 1;
61
- const h = document[e(223)](e(244)), D = h[e(284)]("2d"), S = f.width() * (r[e(261)] || globalThis[e(271)]);
62
- for (let w = 0; w < M; w++) {
63
- D[e(210)](0, 0, h.width, h.height);
64
- const R = w == M - 1;
65
- let q = 0, G = R ? B : u;
66
- for (let g = 0; g < G; g++) {
67
- D.clearRect(0, 0, h[e(285)], h[e(233)]);
68
- const c = w * u + g, y = f.find(e(224))[c];
69
- globalThis[e(277)][e(228)][e(274)](function(j) {
60
+ let t = [], U = Math.ceil(w / f), Z = w % f || 1;
61
+ const p = document[e(163)](e(192)), z = p[e(145)]("2d"), E = h[e(177)]() * (i.pixelRatio || globalThis[e(154)]);
62
+ for (let T = 0; T < U; T++) {
63
+ z[e(201)](0, 0, p[e(177)], p[e(146)]);
64
+ const P = T == U - 1;
65
+ let F = 0, M = P ? Z : f;
66
+ for (let g = 0; g < M; g++) {
67
+ z[e(201)](0, 0, p[e(177)], p[e(146)]);
68
+ const r = T * f + g, C = h.find(e(164))[r];
69
+ globalThis.hinnn[e(128)].add(function(j) {
70
70
  const _ = e;
71
- L[_(242)](y, r)[_(216)](function(m) {
72
- const d = _;
73
- let I = m[d(284)]("2d");
74
- I[d(248)] = ![];
75
- let C = m[d(250)](d(268), r.quality || 0.92), o = new Image();
76
- o[d(264)] = C, o[d(236)] = function() {
77
- const l = d;
78
- g === 0 && (h[l(285)] = S, h[l(233)] = o[l(233)] * G), q += o.height, D[l(283)](o, 0, q - o[l(233)], S, o[l(233)]), v(c + 1, T), j();
71
+ $[_(202)](C, i)[_(131)](function(m) {
72
+ const c = _;
73
+ let I = m[c(145)]("2d");
74
+ I[c(175)] = ![];
75
+ let y = m.toDataURL(c(193), i[c(153)] || 0.92), o = new Image();
76
+ o[c(126)] = y, o.onload = function() {
77
+ const b = c;
78
+ g === 0 && (p.width = E, p[b(146)] = o[b(146)] * M), F += o[b(146)], z[b(176)](o, 0, F - o.height, E, o[b(146)]), v(r + 1, w), j();
79
79
  };
80
80
  });
81
81
  });
82
82
  }
83
- globalThis.hinnn[e(228)][e(274)](function(g) {
84
- const c = e;
85
- let y = r[c(267)] || c(268), j = r[c(201)] || c(269), _ = r[c(237)] || 0.8;
86
- if (b) {
87
- let m = h[c(250)](y, _), d = new Image();
88
- d[c(264)] = m, d[c(236)] = function() {
89
- const I = c;
90
- t[I(231)]({ url: m, start: w * u + 1, end: w * u + G }), R && (globalThis[I(277)][I(228)][I(276)](), a.removeTempContainer(), t.forEach((C) => {
83
+ globalThis[e(160)][e(128)][e(133)](function(g) {
84
+ const r = e;
85
+ let C = i[r(190)] || r(193), j = i[r(137)] || r(135), _ = i[r(153)] || 0.8;
86
+ if (u) {
87
+ let m = p[r(124)](C, _), c = new Image();
88
+ c[r(126)] = m, c[r(197)] = function() {
89
+ const I = r;
90
+ t[I(173)]({ url: m, start: T * f + 1, end: T * f + M }), P && (globalThis.hinnn[I(128)][I(165)](), a.removeTempContainer(), t[I(166)]((y) => {
91
91
  const o = I;
92
- let l = document[o(223)]("a"), A = n[o(234)] || o(275);
93
- A[o(222)](".") == -1 && (A += o(207));
94
- let E = A.split(".").pop(), J = A[o(247)]("." + E, "") + "_" + C[o(206)] + "-" + C[o(200)] + "." + E;
95
- l.style[o(252)] = o(273), l.setAttribute("download", J), l.setAttribute("href", C[o(269)]), document.body[o(205)](l), l[o(260)](), l[o(255)]();
92
+ let b = document[o(163)]("a"), k = n[o(200)] || "download.jpg";
93
+ k.indexOf(".") == -1 && (k += ".jpg");
94
+ let J = k.split(".").pop(), H = k[o(141)]("." + J, "") + "_" + y[o(188)] + "-" + y[o(148)] + "." + J;
95
+ b[o(127)][o(199)] = o(196), b[o(191)](o(139), H), b.setAttribute(o(184), y[o(135)]), document[o(161)][o(140)](b), b.click(), b[o(147)]();
96
96
  })), g();
97
97
  };
98
98
  return;
99
99
  }
100
- if (j == "url") {
101
- t.push(h[c(250)](y, _)), R && (globalThis[c(277)][c(228)].clear(), a[c(229)](), s[c(226)](t)), g();
100
+ if (j == r(135)) {
101
+ t[r(173)](p[r(124)](C, _)), P && (globalThis[r(160)].queue[r(165)](), a[r(122)](), l.resolve(t)), g();
102
102
  return;
103
103
  }
104
- j == c(280) && h[c(211)](function(m) {
105
- const d = c;
106
- t.push(m), R && (globalThis.hinnn[d(228)].clear(), a[d(229)](), s[d(226)](t)), g();
107
- }, y, _);
104
+ j == "blob" && p.toBlob(function(m) {
105
+ const c = r;
106
+ t[c(173)](m), P && (globalThis[c(160)][c(128)][c(165)](), a[c(122)](), l[c(132)](t)), g();
107
+ }, C, _);
108
108
  });
109
109
  }
110
- globalThis[e(277)][e(228)][e(208)]();
110
+ globalThis.hinnn[e(128)][e(144)]();
111
111
  } catch (t) {
112
- console.error(e(270)), console[e(199)](t);
112
+ console.error(e(156)), console[e(195)](t);
113
113
  }
114
114
  });
115
115
  }
116
- return s[x(220)]();
116
+ return l.promise();
117
117
  });
118
118
  };
119
- function H() {
120
- var i = ["defineProperty", "154908jgjsRx", "27WstqnP", "newPrintTemplate", "363625tshdTi", "add toImage Api", "9gphsIY", "1161755vwfrIX", "1449328biOYGf", "2199246sJUgcZ", "167046aGRQjC", "toImage", "add toImage Api to PrintTemplate", "45538AUpZQg"];
121
- return H = function() {
122
- return i;
123
- }, H();
119
+ function D() {
120
+ var s = ["110hNAxTx", "defineProperty", "add toImage Api", "27iJLQtX", "907488zaJTgt", "203481uJSZxH", "10544072CIsEkd", "350644RiFwCg", "35804LGMroR", "0.3.0", "42LTpdBP", "1195168UxwgXP", "newPrintTemplate", "30dLHoRe", "toImage", "59352JFwoZJ", "add toImage Api to PrintTemplate"];
121
+ return D = function() {
122
+ return s;
123
+ }, D();
124
124
  }
125
- (function(i, n) {
126
- for (var x = U, a = i(); []; )
125
+ function L(s, n) {
126
+ var x = D();
127
+ return L = function(a, l) {
128
+ a = a - 159;
129
+ var u = x[a];
130
+ return u;
131
+ }, L(s, n);
132
+ }
133
+ (function(s, n) {
134
+ for (var x = L, a = s(); []; )
127
135
  try {
128
- var s = -parseInt(x(415)) / 1 + -parseInt(x(410)) / 2 * (parseInt(x(417)) / 3) + parseInt(x(412)) / 4 + -parseInt(x(404)) / 5 + -parseInt(x(407)) / 6 + parseInt(x(406)) / 7 + -parseInt(x(405)) / 8 * (-parseInt(x(413)) / 9);
129
- if (s === n)
136
+ var l = -parseInt(x(167)) / 1 * (-parseInt(x(172)) / 2) + -parseInt(x(169)) / 3 + parseInt(x(162)) / 4 * (parseInt(x(164)) / 5) + parseInt(x(174)) / 6 * (parseInt(x(171)) / 7) + -parseInt(x(175)) / 8 + parseInt(x(168)) / 9 * (parseInt(x(160)) / 10) + -parseInt(x(170)) / 11;
137
+ if (l === n)
130
138
  break;
131
139
  a.push(a.shift());
132
- } catch (b) {
140
+ } catch (u) {
133
141
  a.push(a.shift());
134
142
  }
135
- })(H, 204279);
136
- function U(i, n) {
137
- var x = H();
138
- return U = function(a, s) {
139
- a = a - 404;
140
- var b = x[a];
141
- return b;
142
- }, U(i, n);
143
- }
144
- function Y(i) {
145
- var n = U;
146
- return { name: "add toImage Api", description: n(416), hooks: [{ hook: n(414), name: n(409), description: n(409), priority: 1, run: ({ template: x, options: a }) => {
147
- var s = n;
148
- Object[s(411)](x, s(408), { value: O, enumerable: ![], writable: !![], configurable: !![] });
149
- } }], leastHiprintVersion: "0.3.0" };
143
+ })(D, 287155);
144
+ function O(s) {
145
+ var n = L;
146
+ return { name: "add toImage Api", description: n(166), hooks: [{ hook: n(159), name: n(163), description: n(163), priority: 1, run: ({ template: x, options: a }) => {
147
+ var l = n;
148
+ Object[l(165)](x, l(161), { value: q, enumerable: ![], writable: !![], configurable: !![] });
149
+ } }], leastHiprintVersion: n(173) };
150
150
  }
151
151
  export {
152
- Y as default
152
+ O as default
153
153
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(h,_){typeof exports=="object"&&typeof module!="undefined"?module.exports=_(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],_):(h=typeof globalThis!="undefined"?globalThis:h||self,h.pluginApiImage=_(h.htmlToImage))})(this,function(h){"use strict";var N=(h,_,P)=>new Promise((I,v)=>{var U=u=>{try{b(P.next(u))}catch(a){v(a)}},C=u=>{try{b(P.throw(u))}catch(a){v(a)}},b=u=>u.done?I(u.value):Promise.resolve(u.value).then(U,C);b((P=P.apply(h,_)).next())});function _(a){if(a&&a.__esModule)return a;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const P=_(h);(function(a,t){const e=I,o=a();for(;[];)try{if(parseInt(e(256))/1*(-parseInt(e(251))/2)+parseInt(e(202))/3+-parseInt(e(240))/4*(-parseInt(e(262))/5)+-parseInt(e(249))/6+-parseInt(e(257))/7*(parseInt(e(265))/8)+parseInt(e(214))/9+parseInt(e(209))/10*(-parseInt(e(266))/11)===t)break;o.push(o.shift())}catch(d){o.push(o.shift())}})(v,895242);function I(a,t){const e=v();return I=function(o,d){return o=o-198,e[o]},I(a,t)}function v(){const a=["devicePixelRatio","pop","none","add","download.jpg","clear","hinnn","loadAllImages","gif","blob","getHtml","bmp","drawImage","getContext","width","png","log","end","toType","2140296JIAPBS","limit","svg","appendChild","start",".jpg","run","80HKLNvz","clearRect","toBlob","floor","toLowerCase","14153616tpUZDS","css","then","base64","isDownload","extend","promise","onProgress","indexOf","createElement",".hiprint-printPanel .hiprint-printPaper","printPanels","resolve","cur","queue","removeTempContainer","length","push","html","height","name","webp","onload","quality","#fff","baseURI","4mSGYjc","IMG","toCanvas","createTempContainer","canvas","svg2canvas","ceil","replace","imageSmoothingEnabled","3318840FwheCH","toDataURL","2enrpHW","display","http","tagName","remove","221627spbDRI","238pIEAXC","jpeg","includes","click","pixelRatio","2667735awVlxc","total","src","199624IHMSBy","414139JwxQRn","type","image/jpeg","url","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): "];return v=function(){return a},v()}const U=function(a,t){return N(this,null,function*(){const e=I;let o=this,d=globalThis.$.Deferred(),R=!![],T=10,E=(l,g)=>{const f=I,O=Math[f(212)](l/g*100);console[f(199)](f(227),l,f(263),g),console[f(199)]("toImage percent: ",O+"%")};if(this[e(225)][e(230)]){let l=globalThis.$[e(219)]({filter:x=>{const n=e;return x[n(254)]!=n(241)||x[n(254)]=="IMG"&&(["jpg",n(258),n(198),n(279),n(282),n(235),n(204)][n(259)](x[n(264)].split(".")[n(272)]()[n(213)]())||x[n(264)]!=x.baseURI||x[n(264)][n(222)](n(253))>-1&&x.src!=x[n(239)]||x[n(264)][n(222)](n(217))>-1)},backgroundColor:e(238)},t||{}),g=yield this[e(281)](a,t);t&&t[e(218)]!=null&&(R=t[e(218)]),t&&t.onProgress!=null&&(E=t[e(221)]),t&&t[e(203)]!=null&&(T=t[e(203)]),globalThis.$(g)[e(215)]("width","")[e(215)](e(233),""),this[e(243)]();let f=this.getTempContainer();this[e(245)](g,l),f[e(232)](g[0]);let O=f.find(e(224))[e(230)];globalThis.$(g)[e(215)]("position:fixed"),this[e(278)](g,function(){const x=e;try{let n=[],$=Math[x(246)](O/T),Q=O%T||1;const p=document[x(223)](x(244)),q=p[x(284)]("2d"),B=f.width()*(l[x(261)]||globalThis[x(271)]);for(let A=0;A<$;A++){q[x(210)](0,0,p.width,p.height);const S=A==$-1;let J=0,G=S?Q:T;for(let m=0;m<G;m++){q.clearRect(0,0,p[x(285)],p[x(233)]);const i=A*T+m,k=f.find(x(224))[i];globalThis[x(277)][x(228)][x(274)](function(D){const w=x;P[w(242)](k,l)[w(216)](function(y){const r=w;let j=y[r(284)]("2d");j[r(248)]=![];let M=y[r(250)](r(268),l.quality||.92),c=new Image;c[r(264)]=M,c[r(236)]=function(){const s=r;m===0&&(p[s(285)]=B,p[s(233)]=c[s(233)]*G),J+=c.height,q[s(283)](c,0,J-c[s(233)],B,c[s(233)]),E(i+1,O),D()}})})}globalThis.hinnn[x(228)][x(274)](function(m){const i=x;let k=l[i(267)]||i(268),D=l[i(201)]||i(269),w=l[i(237)]||.8;if(R){let y=p[i(250)](k,w),r=new Image;r[i(264)]=y,r[i(236)]=function(){const j=i;n[j(231)]({url:y,start:A*T+1,end:A*T+G}),S&&(globalThis[j(277)][j(228)][j(276)](),o.removeTempContainer(),n.forEach(M=>{const c=j;let s=document[c(223)]("a"),H=t[c(234)]||c(275);H[c(222)](".")==-1&&(H+=c(207));let L=H.split(".").pop(),Y=H[c(247)]("."+L,"")+"_"+M[c(206)]+"-"+M[c(200)]+"."+L;s.style[c(252)]=c(273),s.setAttribute("download",Y),s.setAttribute("href",M[c(269)]),document.body[c(205)](s),s[c(260)](),s[c(255)]()})),m()};return}if(D=="url"){n.push(p[i(250)](k,w)),S&&(globalThis[i(277)][i(228)].clear(),o[i(229)](),d[i(226)](n)),m();return}D==i(280)&&p[i(211)](function(y){const r=i;n.push(y),S&&(globalThis.hinnn[r(228)].clear(),o[r(229)](),d[r(226)](n)),m()},k,w)})}globalThis[x(277)][x(228)][x(208)]()}catch(n){console.error(x(270)),console[x(199)](n)}})}return d[e(220)]()})};function C(){var a=["defineProperty","154908jgjsRx","27WstqnP","newPrintTemplate","363625tshdTi","add toImage Api","9gphsIY","1161755vwfrIX","1449328biOYGf","2199246sJUgcZ","167046aGRQjC","toImage","add toImage Api to PrintTemplate","45538AUpZQg"];return C=function(){return a},C()}(function(a,t){for(var e=b,o=a();[];)try{var d=-parseInt(e(415))/1+-parseInt(e(410))/2*(parseInt(e(417))/3)+parseInt(e(412))/4+-parseInt(e(404))/5+-parseInt(e(407))/6+parseInt(e(406))/7+-parseInt(e(405))/8*(-parseInt(e(413))/9);if(d===t)break;o.push(o.shift())}catch(R){o.push(o.shift())}})(C,204279);function b(a,t){var e=C();return b=function(o,d){o=o-404;var R=e[o];return R},b(a,t)}function u(a){var t=b;return{name:"add toImage Api",description:t(416),hooks:[{hook:t(414),name:t(409),description:t(409),priority:1,run:({template:e,options:o})=>{var d=t;Object[d(411)](e,d(408),{value:U,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}return u});
1
+ (function(p,_){typeof exports=="object"&&typeof module!="undefined"?module.exports=_(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],_):(p=typeof globalThis!="undefined"?globalThis:p||self,p.pluginApiImage=_(p.htmlToImage))})(this,function(p){"use strict";var N=(p,_,j)=>new Promise((I,v)=>{var U=b=>{try{u(j.next(b))}catch(a){v(a)}},P=b=>{try{u(j.throw(b))}catch(a){v(a)}},u=b=>b.done?I(b.value):Promise.resolve(b.value).then(U,P);u((j=j.apply(p,_)).next())});function _(a){if(a&&a.__esModule)return a;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const j=_(p);(function(a,t){const e=I,o=a();for(;[];)try{if(parseInt(e(121))/1+parseInt(e(129))/2*(parseInt(e(194))/3)+-parseInt(e(170))/4+parseInt(e(189))/5+parseInt(e(180))/6*(parseInt(e(183))/7)+parseInt(e(155))/8*(parseInt(e(181))/9)+parseInt(e(149))/10===t)break;o.push(o.shift())}catch(s){o.push(o.shift())}})(v,991174);function I(a,t){const e=v();return I=function(o,s){return o=o-121,e[o]},I(a,t)}function v(){const a=["width","length","onProgress","786774QlvfCR","2529vzCFjv","jpeg","7QPlNUb","href","createTempContainer","tagName","IMG","start","2539020czDXaj","type","setAttribute","canvas","image/jpeg","49341YZEtsF","log","none","onload","png","display","name","clearRect","toCanvas","853269zbdRQK","removeTempContainer","svg2canvas","toDataURL","position:fixed","src","style","queue","16iZCsdz","webp","then","resolve","add","indexOf","url","gif","toType","getHtml","download","appendChild","replace","baseURI","#fff","run","getContext","height","remove","end","959830dWTsDh","base64","css","bmp","quality","devicePixelRatio","31816vZVFMp","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","http","limit","loadAllImages","hinnn","body","split","createElement",".hiprint-printPanel .hiprint-printPaper","clear","forEach","jpg","includes","isDownload","7384496gCQMez","cur","printPanels","push","svg","imageSmoothingEnabled","drawImage"];return v=function(){return a},v()}const U=function(a,t){return N(this,null,function*(){const e=I;let o=this,s=globalThis.$.Deferred(),R=!![],T=10,J=(d,h)=>{const g=I,A=Math.floor(d/h*100);console[g(195)](g(171),d,"total",h),console[g(195)]("toImage percent: ",A+"%")};if(this[e(172)][e(178)]){let d=globalThis.$.extend({filter:x=>{const n=e;return x[n(186)]!=n(187)||x[n(186)]==n(187)&&([n(167),n(182),n(198),n(136),n(152),n(130),n(174)][n(168)](x.src[n(162)](".").pop().toLowerCase())||x[n(126)]!=x[n(142)]||x[n(126)][n(134)](n(157))>-1&&x[n(126)]!=x.baseURI||x.src[n(134)](n(150))>-1)},backgroundColor:e(143)},t||{}),h=yield this[e(138)](a,t);t&&t[e(169)]!=null&&(R=t.isDownload),t&&t[e(179)]!=null&&(J=t[e(179)]),t&&t[e(158)]!=null&&(T=t[e(158)]),globalThis.$(h)[e(151)](e(177),"")[e(151)](e(146),""),this[e(185)]();let g=this.getTempContainer();this[e(123)](h,d),g.html(h[0]);let A=g.find(e(164)).length;globalThis.$(h)[e(151)](e(125)),this[e(159)](h,function(){const x=e;try{let n=[],Q=Math.ceil(A/T),S=A%T||1;const f=document[x(163)](x(192)),E=f[x(145)]("2d"),Z=g[x(177)]()*(d.pixelRatio||globalThis[x(154)]);for(let k=0;k<Q;k++){E[x(201)](0,0,f[x(177)],f[x(146)]);const O=k==Q-1;let q=0,F=O?S:T;for(let m=0;m<F;m++){E[x(201)](0,0,f[x(177)],f[x(146)]);const r=k*T+m,D=g.find(x(164))[r];globalThis.hinnn[x(128)].add(function(z){const w=x;j[w(202)](D,d)[w(131)](function(y){const c=w;let C=y[c(145)]("2d");C[c(175)]=![];let M=y.toDataURL(c(193),d[c(153)]||.92),i=new Image;i[c(126)]=M,i.onload=function(){const l=c;m===0&&(f.width=Z,f[l(146)]=i[l(146)]*F),q+=i[l(146)],E[l(176)](i,0,q-i.height,Z,i[l(146)]),J(r+1,A),z()}})})}globalThis[x(160)][x(128)][x(133)](function(m){const r=x;let D=d[r(190)]||r(193),z=d[r(137)]||r(135),w=d[r(153)]||.8;if(R){let y=f[r(124)](D,w),c=new Image;c[r(126)]=y,c[r(197)]=function(){const C=r;n[C(173)]({url:y,start:k*T+1,end:k*T+F}),O&&(globalThis.hinnn[C(128)][C(165)](),o.removeTempContainer(),n[C(166)](M=>{const i=C;let l=document[i(163)]("a"),L=t[i(200)]||"download.jpg";L.indexOf(".")==-1&&(L+=".jpg");let H=L.split(".").pop(),$=L[i(141)]("."+H,"")+"_"+M[i(188)]+"-"+M[i(148)]+"."+H;l[i(127)][i(199)]=i(196),l[i(191)](i(139),$),l.setAttribute(i(184),M[i(135)]),document[i(161)][i(140)](l),l.click(),l[i(147)]()})),m()};return}if(z==r(135)){n[r(173)](f[r(124)](D,w)),O&&(globalThis[r(160)].queue[r(165)](),o[r(122)](),s.resolve(n)),m();return}z=="blob"&&f.toBlob(function(y){const c=r;n[c(173)](y),O&&(globalThis[c(160)][c(128)][c(165)](),o[c(122)](),s[c(132)](n)),m()},D,w)})}globalThis.hinnn[x(128)][x(144)]()}catch(n){console.error(x(156)),console[x(195)](n)}})}return s.promise()})};function P(){var a=["110hNAxTx","defineProperty","add toImage Api","27iJLQtX","907488zaJTgt","203481uJSZxH","10544072CIsEkd","350644RiFwCg","35804LGMroR","0.3.0","42LTpdBP","1195168UxwgXP","newPrintTemplate","30dLHoRe","toImage","59352JFwoZJ","add toImage Api to PrintTemplate"];return P=function(){return a},P()}function u(a,t){var e=P();return u=function(o,s){o=o-159;var R=e[o];return R},u(a,t)}(function(a,t){for(var e=u,o=a();[];)try{var s=-parseInt(e(167))/1*(-parseInt(e(172))/2)+-parseInt(e(169))/3+parseInt(e(162))/4*(parseInt(e(164))/5)+parseInt(e(174))/6*(parseInt(e(171))/7)+-parseInt(e(175))/8+parseInt(e(168))/9*(parseInt(e(160))/10)+-parseInt(e(170))/11;if(s===t)break;o.push(o.shift())}catch(R){o.push(o.shift())}})(P,287155);function b(a){var t=u;return{name:"add toImage Api",description:t(166),hooks:[{hook:t(159),name:t(163),description:t(163),priority:1,run:({template:e,options:o})=>{var s=t;Object[s(165)](e,s(161),{value:U,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:t(173)}}return b});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-image",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "add image api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",