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

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/dist/index.js CHANGED
@@ -1 +1,37 @@
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=$;
1
+ "use strict";var H=(r,e,x)=>new Promise((n,s)=>{var _=o=>{try{T(x.next(o))}catch(d){s(d)}},f=o=>{try{T(x.throw(o))}catch(d){s(d)}},T=o=>o.done?n(o.value):Promise.resolve(o.value).then(_,f);T((x=x.apply(r,e)).next())});const z=require("html-to-image");function X(r){if(r&&r.__esModule)return r;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const x in r)if(x!=="default"){const n=Object.getOwnPropertyDescriptor(r,x);Object.defineProperty(e,x,n.get?n:{enumerable:!0,get:()=>r[x]})}}return e.default=r,Object.freeze(e)}const F=X(z);(function(r,e){const x=G,n=r();for(;[];)try{if(-parseInt(x(214))/1+parseInt(x(216))/2*(parseInt(x(156))/3)+-parseInt(x(209))/4+parseInt(x(235))/5*(parseInt(x(141))/6)+parseInt(x(201))/7+parseInt(x(138))/8*(parseInt(x(133))/9)+-parseInt(x(195))/10===e)break;n.push(n.shift())}catch(s){n.push(n.shift())}})(U,530777);function G(r,e){const x=U();return G=function(n,s){return n=n-125,x[n]},G(r,e)}function U(){const r=["panelLayoutOptions","getHtml","log","tagName","split","push","bmp","png","layoutColumnGap",`mm;
2
+ }
3
+ </style>`,"promise","error","svg","pop","isDownload","mm -","clear",'<div class="hiprint-printTemplate"></div>',"remove","gif","5574770ZFkrus","display","start","download.jpg","then","getContext","2980565JyqIBA","paperHeight",".hiprint-printPaper","webp","createElement","devicePixelRatio","printPanels","href","1440824kCvhdt","IMG","body","baseURI","type","256445KocNgi","removeClass","26204gqFAmG","height","url","toImage percent: ","Deferred","http","css","quality","min","paperWidth","jpeg","mm ","clone","position:fixed","add","clearRect","pixelRatio","ceil","end","15PmlZWM",".hiprint-printPanel .hiprint-printPaper","find","getTempContainer","extend","replace",`mm;"></div>
4
+ </div>`,"canvas","download","click","hinnn","createTempContainer","includes","setAttribute","6577731vQhOou","layoutRowGap","src","jpg",'<div class="hiprint-printPanel-small"></div>',"8EJUwVc","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","width","677238fBeALd","indexOf","toBlob","style","layoutType","forEach","toLowerCase",`<style>
5
+ .hiprint-printPanel-small{
6
+ box-sizing: border-box;
7
+ border: 0px;
8
+ }
9
+ .hiprint-printPaper-small{
10
+ position: relative;
11
+ padding: 0;
12
+ }
13
+ .hiprint-printTemplate .hiprint-printPaper{
14
+ margin: -`,"onload","resolve","total","mm;height:","base64","svg2canvas",".hiprint-printPanel","48LVERkP","image/jpeg","append","length","html","floor","row","onProgress","none","run","removeTempContainer","limit","queue","toDataURL","appendChild","blob","drawImage",`mm;
15
+ }
16
+ .hiprint-printTemplate .hiprint-printPanel-small {
17
+ display:inline-block;
18
+ padding: `,"#fff"];return U=function(){return r},U()}const J=function(r,e){return H(this,null,function*(){const x=G;let n=this,s=globalThis.$[x(220)](),_=!![],f=10,T=(o,d)=>{const m=x,$=Math[m(161)](o/d*100);console[m(177)]("cur",o,m(151),d),console.log(m(219),$+"%")};if(this.printPanels.length){let o=globalThis.$[x(239)]({filter:t=>{const a=x;return t[a(178)]!=a(210)||t[a(178)]==a(210)&&([a(136),a(226),a(182),a(194),a(181),a(204),a(187)][a(131)](t[a(135)][a(179)](".")[a(188)]()[a(147)]())||t[a(135)]!=t[a(212)]||t[a(135)][a(142)](a(221))>-1&&t[a(135)]!=t[a(212)]||t[a(135)][a(142)](a(153))>-1)},backgroundColor:x(174)},e||{}),d=yield this[x(176)](r,e);e&&e[x(189)]!=null&&(_=e[x(189)]),e&&e[x(163)]!=null&&(T=e[x(163)]),e&&e[x(167)]!=null&&(f=e[x(167)]),globalThis.$(d)[x(222)]("width","").css("height",""),this[x(130)]();let m=this[x(238)](),$=this[x(207)][0][x(140)],Z=this[x(207)][0].height;const c=this[x(207)][0][x(175)];if(c&&(c[x(134)]>0||c[x(183)]>0)&&e[x(225)]&&e[x(202)]){let t=Math.floor(e[x(225)]/($+c.layoutRowGap/2)),a=Math[x(161)](e[x(202)]/(Z+c[x(183)]/2));const C=t*a,E=d[x(237)](x(236)),b=E.length,q=Math[x(233)](b/C);let I=globalThis.$(x(192));c[x(145)]==x(162)?I[x(158)](x(148)+(Number(c[x(134)])||0)/2+x(190)+(Number(c[x(183)])||0)/2+`mm;
19
+ }
20
+ .hiprint-printTemplate .hiprint-printPanel-small {
21
+ display:inline-block;
22
+ padding: `+(Number(c[x(134)])||0)/2+"mm "+(Number(c.layoutColumnGap)||0)/2+x(184)):I[x(158)](`<style>
23
+ .hiprint-printPanel-small{
24
+ box-sizing: border-box;
25
+ border: 0px;
26
+ }
27
+ .hiprint-printPaper-small{
28
+ position: relative;
29
+ padding: 0;
30
+ }
31
+ .hiprint-printTemplate .hiprint-printPaper{
32
+ display: flex;
33
+ flex-wrap: wrap;
34
+ flex-direction: column;
35
+ align-content: flex-start;
36
+ margin: -`+(Number(c.layoutRowGap)||0)/2+"mm -"+(Number(c[x(183)])||0)/2+x(173)+(Number(c[x(134)])||0)/2+x(227)+(Number(c.layoutColumnGap)||0)/2+x(184));for(let P=0;P<q;P++){const g=globalThis.$(`<div class="hiprint-printPanel">
37
+ <div class="hiprint-printPaper" style="width:`+e[x(225)]+x(152)+e.paperHeight+x(125)),k=P*C,M=Math[x(224)]((P+1)*C,b);for(let v=k;v<M;v++){const u=E.eq(v)[x(228)]();u[x(215)]("hiprint-printPaper"),u.addClass("hiprint-printPaper-small start-"+v);const l=globalThis.$(x(137));l.append(u),g[x(237)](x(203))[x(158)](l)}I.append(g)}this[x(154)](I,o),m[x(160)](I[0])}else this.svg2canvas(d,o),m[x(160)](d[0]);let B=m[x(237)](x(236))[x(159)];globalThis.$(d)[x(222)](x(229)),this.loadAllImages(d,function(){const t=x;try{let a=[],C=Math[t(233)](B/f),E=B%f||1;const b=document[t(205)](t(126)),q=b[t(200)]("2d"),I=m[t(237)](t(155)).eq(0).width(),P=I*(o[t(232)]||globalThis[t(206)]);for(let g=0;g<C;g++){q[t(231)](0,0,b[t(140)],b[t(217)]);const k=g==C-1;let M=0,v=k?E:f;for(let u=0;u<v;u++){q[t(231)](0,0,b.width,b[t(217)]);const l=g*f+u,j=m[t(237)](".hiprint-printPanel .hiprint-printPaper")[l];globalThis[t(129)].queue.add(function(R){const N=t;F.toCanvas(j,o)[N(199)](function(w){const p=N;let y=w.getContext("2d");y.imageSmoothingEnabled=![];let A=w.toDataURL(p(157),o[p(223)]||.92),i=new Image;i[p(135)]=A,i[p(149)]=function(){const h=p;u===0&&(b[h(140)]=P,b[h(217)]=i[h(217)]*v),M+=i[h(217)],q[h(172)](i,0,M-i[h(217)],P,i.height),T(l+1,B),R()}})})}globalThis[t(129)][t(168)][t(230)](function(u){const l=t;let j=o[l(213)]||l(157),R=o.toType||"url",N=o.quality||.8;if(_){let w=b[l(169)](j,N),p=new Image;p[l(135)]=w,p[l(149)]=function(){const y=l;a.push({url:w,start:g*f+1,end:g*f+v}),k&&(globalThis[y(129)][y(168)][y(191)](),n[y(166)](),a[y(146)](A=>{const i=y;let h=document.createElement("a"),O=e.name||i(198);O[i(142)](".")==-1&&(O+=".jpg");let L=O[i(179)](".").pop(),S=O[i(240)]("."+L,"")+"_"+A[i(197)]+"-"+A[i(234)]+"."+L;h[i(144)][i(196)]=i(164),h[i(132)](i(127),S),h[i(132)](i(208),A[i(218)]),document[i(211)][i(170)](h),h[i(128)](),h[i(193)]()})),u()};return}if(R==l(218)){a[l(180)](b[l(169)](j,N)),k&&(globalThis.hinnn.queue.clear(),n[l(166)](),s.resolve(a)),u();return}R==l(171)&&b[l(143)](function(w){const p=l;a[p(180)](w),k&&(globalThis[p(129)][p(168)][p(191)](),n[p(166)](),s[p(150)](a)),u()},j,N)})}globalThis[t(129)].queue[t(165)]()}catch(a){console[t(186)](t(139)),console[t(177)](a)}})}return s[x(185)]()})};function V(r,e){var x=D();return V=function(n,s){n=n-439;var _=x[n];return _},V(r,e)}(function(r,e){for(var x=V,n=r();[];)try{var s=-parseInt(x(449))/1+-parseInt(x(450))/2+-parseInt(x(441))/3*(-parseInt(x(451))/4)+-parseInt(x(440))/5+-parseInt(x(448))/6+-parseInt(x(445))/7*(parseInt(x(444))/8)+parseInt(x(452))/9;if(s===e)break;n.push(n.shift())}catch(_){n.push(n.shift())}})(D,672242);function D(){var r=["toImage","newPrintTemplate","5735748wEEXNA","866176wrVrBA","2662854EUUogl","124DeyVZy","40837464ixUXSs","defineProperty","add toImage Api to PrintTemplate","478835hEHDBX","53187kqUhVY","0.3.0","add toImage Api","40AVZCZk","1631735VNBrko"];return D=function(){return r},D()}function W(r){var e=V;return{name:e(443),description:e(443),hooks:[{hook:e(447),name:e(439),description:e(439),priority:1,run:({template:x,options:n})=>{var s=e;Object[s(453)](x,s(446),{value:J,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(442)}}module.exports=W;
package/dist/index.mjs CHANGED
@@ -1,153 +1,207 @@
1
- var Q = (s, n, x) => new Promise((a, l) => {
2
- var u = (i) => {
1
+ var Z = (l, a, x) => new Promise((i, p) => {
2
+ var _ = (r) => {
3
3
  try {
4
- v(x.next(i));
4
+ T(x.next(r));
5
5
  } catch (d) {
6
- l(d);
6
+ p(d);
7
7
  }
8
- }, f = (i) => {
8
+ }, f = (r) => {
9
9
  try {
10
- v(x.throw(i));
10
+ T(x.throw(r));
11
11
  } catch (d) {
12
- l(d);
12
+ p(d);
13
13
  }
14
- }, v = (i) => i.done ? a(i.value) : Promise.resolve(i.value).then(u, f);
15
- v((x = x.apply(s, n)).next());
14
+ }, T = (r) => r.done ? i(r.value) : Promise.resolve(r.value).then(_, f);
15
+ T((x = x.apply(l, a)).next());
16
16
  });
17
- import * as $ from "html-to-image";
18
- (function(s, n) {
19
- const x = R, a = s();
17
+ import * as z from "html-to-image";
18
+ (function(l, a) {
19
+ const x = V, i = l();
20
20
  for (; []; )
21
21
  try {
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)
22
+ if (-parseInt(x(214)) / 1 + parseInt(x(216)) / 2 * (parseInt(x(156)) / 3) + -parseInt(x(209)) / 4 + parseInt(x(235)) / 5 * (parseInt(x(141)) / 6) + parseInt(x(201)) / 7 + parseInt(x(138)) / 8 * (parseInt(x(133)) / 9) + -parseInt(x(195)) / 10 === a)
23
23
  break;
24
- a.push(a.shift());
25
- } catch (l) {
26
- a.push(a.shift());
24
+ i.push(i.shift());
25
+ } catch (p) {
26
+ i.push(i.shift());
27
27
  }
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);
28
+ })($, 530777);
29
+ function V(l, a) {
30
+ const x = $();
31
+ return V = function(i, p) {
32
+ return i = i - 125, x[i];
33
+ }, V(l, a);
34
34
  }
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();
35
+ function $() {
36
+ const l = ["panelLayoutOptions", "getHtml", "log", "tagName", "split", "push", "bmp", "png", "layoutColumnGap", `mm;
37
+ }
38
+ </style>`, "promise", "error", "svg", "pop", "isDownload", "mm -", "clear", '<div class="hiprint-printTemplate"></div>', "remove", "gif", "5574770ZFkrus", "display", "start", "download.jpg", "then", "getContext", "2980565JyqIBA", "paperHeight", ".hiprint-printPaper", "webp", "createElement", "devicePixelRatio", "printPanels", "href", "1440824kCvhdt", "IMG", "body", "baseURI", "type", "256445KocNgi", "removeClass", "26204gqFAmG", "height", "url", "toImage percent: ", "Deferred", "http", "css", "quality", "min", "paperWidth", "jpeg", "mm ", "clone", "position:fixed", "add", "clearRect", "pixelRatio", "ceil", "end", "15PmlZWM", ".hiprint-printPanel .hiprint-printPaper", "find", "getTempContainer", "extend", "replace", `mm;"></div>
39
+ </div>`, "canvas", "download", "click", "hinnn", "createTempContainer", "includes", "setAttribute", "6577731vQhOou", "layoutRowGap", "src", "jpg", '<div class="hiprint-printPanel-small"></div>', "8EJUwVc", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "width", "677238fBeALd", "indexOf", "toBlob", "style", "layoutType", "forEach", "toLowerCase", `<style>
40
+ .hiprint-printPanel-small{
41
+ box-sizing: border-box;
42
+ border: 0px;
43
+ }
44
+ .hiprint-printPaper-small{
45
+ position: relative;
46
+ padding: 0;
47
+ }
48
+ .hiprint-printTemplate .hiprint-printPaper{
49
+ margin: -`, "onload", "resolve", "total", "mm;height:", "base64", "svg2canvas", ".hiprint-printPanel", "48LVERkP", "image/jpeg", "append", "length", "html", "floor", "row", "onProgress", "none", "run", "removeTempContainer", "limit", "queue", "toDataURL", "appendChild", "blob", "drawImage", `mm;
50
+ }
51
+ .hiprint-printTemplate .hiprint-printPanel-small {
52
+ display:inline-block;
53
+ padding: `, "#fff"];
54
+ return $ = function() {
55
+ return l;
56
+ }, $();
40
57
  }
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 + "%");
58
+ const F = function(l, a) {
59
+ return Z(this, null, function* () {
60
+ const x = V;
61
+ let i = this, p = globalThis.$[x(220)](), _ = !![], f = 10, T = (r, d) => {
62
+ const u = x, D = Math[u(161)](r / d * 100);
63
+ console[u(177)]("cur", r, u(151), d), console.log(u(219), D + "%");
47
64
  };
48
- if (this[x(172)][x(178)]) {
49
- let i = globalThis.$.extend({ filter: (e) => {
65
+ if (this.printPanels.length) {
66
+ let r = globalThis.$[x(239)]({ filter: (e) => {
50
67
  const t = x;
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() {
68
+ return e[t(178)] != t(210) || e[t(178)] == t(210) && ([t(136), t(226), t(182), t(194), t(181), t(204), t(187)][t(131)](e[t(135)][t(179)](".")[t(188)]()[t(147)]()) || e[t(135)] != e[t(212)] || e[t(135)][t(142)](t(221)) > -1 && e[t(135)] != e[t(212)] || e[t(135)][t(142)](t(153)) > -1);
69
+ }, backgroundColor: x(174) }, a || {}), d = yield this[x(176)](l, a);
70
+ a && a[x(189)] != null && (_ = a[x(189)]), a && a[x(163)] != null && (T = a[x(163)]), a && a[x(167)] != null && (f = a[x(167)]), globalThis.$(d)[x(222)]("width", "").css("height", ""), this[x(130)]();
71
+ let u = this[x(238)](), D = this[x(207)][0][x(140)], O = this[x(207)][0].height;
72
+ const c = this[x(207)][0][x(175)];
73
+ if (c && (c[x(134)] > 0 || c[x(183)] > 0) && a[x(225)] && a[x(202)]) {
74
+ let e = Math.floor(a[x(225)] / (D + c.layoutRowGap / 2)), t = Math[x(161)](a[x(202)] / (O + c[x(183)] / 2));
75
+ const C = e * t, R = d[x(237)](x(236)), b = R.length, q = Math[x(233)](b / C);
76
+ let I = globalThis.$(x(192));
77
+ c[x(145)] == x(162) ? I[x(158)](x(148) + (Number(c[x(134)]) || 0) / 2 + x(190) + (Number(c[x(183)]) || 0) / 2 + `mm;
78
+ }
79
+ .hiprint-printTemplate .hiprint-printPanel-small {
80
+ display:inline-block;
81
+ padding: ` + (Number(c[x(134)]) || 0) / 2 + "mm " + (Number(c.layoutColumnGap) || 0) / 2 + x(184)) : I[x(158)](`<style>
82
+ .hiprint-printPanel-small{
83
+ box-sizing: border-box;
84
+ border: 0px;
85
+ }
86
+ .hiprint-printPaper-small{
87
+ position: relative;
88
+ padding: 0;
89
+ }
90
+ .hiprint-printTemplate .hiprint-printPaper{
91
+ display: flex;
92
+ flex-wrap: wrap;
93
+ flex-direction: column;
94
+ align-content: flex-start;
95
+ margin: -` + (Number(c.layoutRowGap) || 0) / 2 + "mm -" + (Number(c[x(183)]) || 0) / 2 + x(173) + (Number(c[x(134)]) || 0) / 2 + x(227) + (Number(c.layoutColumnGap) || 0) / 2 + x(184));
96
+ for (let P = 0; P < q; P++) {
97
+ const g = globalThis.$(`<div class="hiprint-printPanel">
98
+ <div class="hiprint-printPaper" style="width:` + a[x(225)] + x(152) + a.paperHeight + x(125)), k = P * C, G = Math[x(224)]((P + 1) * C, b);
99
+ for (let v = k; v < G; v++) {
100
+ const m = R.eq(v)[x(228)]();
101
+ m[x(215)]("hiprint-printPaper"), m.addClass("hiprint-printPaper-small start-" + v);
102
+ const o = globalThis.$(x(137));
103
+ o.append(m), g[x(237)](x(203))[x(158)](o);
104
+ }
105
+ I.append(g);
106
+ }
107
+ this[x(154)](I, r), u[x(160)](I[0]);
108
+ } else
109
+ this.svg2canvas(d, r), u[x(160)](d[0]);
110
+ let L = u[x(237)](x(236))[x(159)];
111
+ globalThis.$(d)[x(222)](x(229)), this.loadAllImages(d, function() {
58
112
  const e = x;
59
113
  try {
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
- const _ = e;
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();
114
+ let t = [], C = Math[e(233)](L / f), R = L % f || 1;
115
+ const b = document[e(205)](e(126)), q = b[e(200)]("2d"), I = u[e(237)](e(155)).eq(0).width(), P = I * (r[e(232)] || globalThis[e(206)]);
116
+ for (let g = 0; g < C; g++) {
117
+ q[e(231)](0, 0, b[e(140)], b[e(217)]);
118
+ const k = g == C - 1;
119
+ let G = 0, v = k ? R : f;
120
+ for (let m = 0; m < v; m++) {
121
+ q[e(231)](0, 0, b.width, b[e(217)]);
122
+ const o = g * f + m, A = u[e(237)](".hiprint-printPanel .hiprint-printPaper")[o];
123
+ globalThis[e(129)].queue.add(function(M) {
124
+ const N = e;
125
+ z.toCanvas(A, r)[N(199)](function(w) {
126
+ const s = N;
127
+ let y = w.getContext("2d");
128
+ y.imageSmoothingEnabled = ![];
129
+ let E = w.toDataURL(s(157), r[s(223)] || 0.92), n = new Image();
130
+ n[s(135)] = E, n[s(149)] = function() {
131
+ const h = s;
132
+ m === 0 && (b[h(140)] = P, b[h(217)] = n[h(217)] * v), G += n[h(217)], q[h(172)](n, 0, G - n[h(217)], P, n.height), T(o + 1, L), M();
79
133
  };
80
134
  });
81
135
  });
82
136
  }
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
- const o = I;
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
- })), g();
137
+ globalThis[e(129)][e(168)][e(230)](function(m) {
138
+ const o = e;
139
+ let A = r[o(213)] || o(157), M = r.toType || "url", N = r.quality || 0.8;
140
+ if (_) {
141
+ let w = b[o(169)](A, N), s = new Image();
142
+ s[o(135)] = w, s[o(149)] = function() {
143
+ const y = o;
144
+ t.push({ url: w, start: g * f + 1, end: g * f + v }), k && (globalThis[y(129)][y(168)][y(191)](), i[y(166)](), t[y(146)]((E) => {
145
+ const n = y;
146
+ let h = document.createElement("a"), U = a.name || n(198);
147
+ U[n(142)](".") == -1 && (U += ".jpg");
148
+ let H = U[n(179)](".").pop(), X = U[n(240)]("." + H, "") + "_" + E[n(197)] + "-" + E[n(234)] + "." + H;
149
+ h[n(144)][n(196)] = n(164), h[n(132)](n(127), X), h[n(132)](n(208), E[n(218)]), document[n(211)][n(170)](h), h[n(128)](), h[n(193)]();
150
+ })), m();
97
151
  };
98
152
  return;
99
153
  }
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();
154
+ if (M == o(218)) {
155
+ t[o(180)](b[o(169)](A, N)), k && (globalThis.hinnn.queue.clear(), i[o(166)](), p.resolve(t)), m();
102
156
  return;
103
157
  }
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, _);
158
+ M == o(171) && b[o(143)](function(w) {
159
+ const s = o;
160
+ t[s(180)](w), k && (globalThis[s(129)][s(168)][s(191)](), i[s(166)](), p[s(150)](t)), m();
161
+ }, A, N);
108
162
  });
109
163
  }
110
- globalThis.hinnn[e(128)][e(144)]();
164
+ globalThis[e(129)].queue[e(165)]();
111
165
  } catch (t) {
112
- console.error(e(156)), console[e(195)](t);
166
+ console[e(186)](e(139)), console[e(177)](t);
113
167
  }
114
168
  });
115
169
  }
116
- return l.promise();
170
+ return p[x(185)]();
117
171
  });
118
172
  };
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();
173
+ function j(l, a) {
174
+ var x = B();
175
+ return j = function(i, p) {
176
+ i = i - 439;
177
+ var _ = x[i];
178
+ return _;
179
+ }, j(l, a);
124
180
  }
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(); []; )
181
+ (function(l, a) {
182
+ for (var x = j, i = l(); []; )
135
183
  try {
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)
184
+ var p = -parseInt(x(449)) / 1 + -parseInt(x(450)) / 2 + -parseInt(x(441)) / 3 * (-parseInt(x(451)) / 4) + -parseInt(x(440)) / 5 + -parseInt(x(448)) / 6 + -parseInt(x(445)) / 7 * (parseInt(x(444)) / 8) + parseInt(x(452)) / 9;
185
+ if (p === a)
138
186
  break;
139
- a.push(a.shift());
140
- } catch (u) {
141
- a.push(a.shift());
187
+ i.push(i.shift());
188
+ } catch (_) {
189
+ i.push(i.shift());
142
190
  }
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) };
191
+ })(B, 672242);
192
+ function B() {
193
+ var l = ["toImage", "newPrintTemplate", "5735748wEEXNA", "866176wrVrBA", "2662854EUUogl", "124DeyVZy", "40837464ixUXSs", "defineProperty", "add toImage Api to PrintTemplate", "478835hEHDBX", "53187kqUhVY", "0.3.0", "add toImage Api", "40AVZCZk", "1631735VNBrko"];
194
+ return B = function() {
195
+ return l;
196
+ }, B();
197
+ }
198
+ function W(l) {
199
+ var a = j;
200
+ return { name: a(443), description: a(443), hooks: [{ hook: a(447), name: a(439), description: a(439), priority: 1, run: ({ template: x, options: i }) => {
201
+ var p = a;
202
+ Object[p(453)](x, p(446), { value: F, enumerable: ![], writable: !![], configurable: !![] });
203
+ } }], leastHiprintVersion: a(442) };
150
204
  }
151
205
  export {
152
- O as default
206
+ W as default
153
207
  };
package/dist/index.umd.js CHANGED
@@ -1 +1,37 @@
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});
1
+ (function(_,P){typeof exports=="object"&&typeof module!="undefined"?module.exports=P(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],P):(_=typeof globalThis!="undefined"?globalThis:_||self,_.pluginApiImage=P(_.htmlToImage))})(this,function(_){"use strict";var F=(_,P,q)=>new Promise((j,T)=>{var H=m=>{try{v(q.next(m))}catch(a){T(a)}},A=m=>{try{v(q.throw(m))}catch(a){T(a)}},v=m=>m.done?j(m.value):Promise.resolve(m.value).then(H,A);v((q=q.apply(_,P)).next())});function P(a){if(a&&a.__esModule)return a;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const x in a)if(x!=="default"){const r=Object.getOwnPropertyDescriptor(a,x);Object.defineProperty(e,x,r.get?r:{enumerable:!0,get:()=>a[x]})}}return e.default=a,Object.freeze(e)}const q=P(_);(function(a,e){const x=j,r=a();for(;[];)try{if(-parseInt(x(214))/1+parseInt(x(216))/2*(parseInt(x(156))/3)+-parseInt(x(209))/4+parseInt(x(235))/5*(parseInt(x(141))/6)+parseInt(x(201))/7+parseInt(x(138))/8*(parseInt(x(133))/9)+-parseInt(x(195))/10===e)break;r.push(r.shift())}catch(d){r.push(r.shift())}})(T,530777);function j(a,e){const x=T();return j=function(r,d){return r=r-125,x[r]},j(a,e)}function T(){const a=["panelLayoutOptions","getHtml","log","tagName","split","push","bmp","png","layoutColumnGap",`mm;
2
+ }
3
+ </style>`,"promise","error","svg","pop","isDownload","mm -","clear",'<div class="hiprint-printTemplate"></div>',"remove","gif","5574770ZFkrus","display","start","download.jpg","then","getContext","2980565JyqIBA","paperHeight",".hiprint-printPaper","webp","createElement","devicePixelRatio","printPanels","href","1440824kCvhdt","IMG","body","baseURI","type","256445KocNgi","removeClass","26204gqFAmG","height","url","toImage percent: ","Deferred","http","css","quality","min","paperWidth","jpeg","mm ","clone","position:fixed","add","clearRect","pixelRatio","ceil","end","15PmlZWM",".hiprint-printPanel .hiprint-printPaper","find","getTempContainer","extend","replace",`mm;"></div>
4
+ </div>`,"canvas","download","click","hinnn","createTempContainer","includes","setAttribute","6577731vQhOou","layoutRowGap","src","jpg",'<div class="hiprint-printPanel-small"></div>',"8EJUwVc","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","width","677238fBeALd","indexOf","toBlob","style","layoutType","forEach","toLowerCase",`<style>
5
+ .hiprint-printPanel-small{
6
+ box-sizing: border-box;
7
+ border: 0px;
8
+ }
9
+ .hiprint-printPaper-small{
10
+ position: relative;
11
+ padding: 0;
12
+ }
13
+ .hiprint-printTemplate .hiprint-printPaper{
14
+ margin: -`,"onload","resolve","total","mm;height:","base64","svg2canvas",".hiprint-printPanel","48LVERkP","image/jpeg","append","length","html","floor","row","onProgress","none","run","removeTempContainer","limit","queue","toDataURL","appendChild","blob","drawImage",`mm;
15
+ }
16
+ .hiprint-printTemplate .hiprint-printPanel-small {
17
+ display:inline-block;
18
+ padding: `,"#fff"];return T=function(){return a},T()}const H=function(a,e){return F(this,null,function*(){const x=j;let r=this,d=globalThis.$[x(220)](),E=!![],w=10,z=(h,f)=>{const u=x,Z=Math[u(161)](h/f*100);console[u(177)]("cur",h,u(151),f),console.log(u(219),Z+"%")};if(this.printPanels.length){let h=globalThis.$[x(239)]({filter:t=>{const n=x;return t[n(178)]!=n(210)||t[n(178)]==n(210)&&([n(136),n(226),n(182),n(194),n(181),n(204),n(187)][n(131)](t[n(135)][n(179)](".")[n(188)]()[n(147)]())||t[n(135)]!=t[n(212)]||t[n(135)][n(142)](n(221))>-1&&t[n(135)]!=t[n(212)]||t[n(135)][n(142)](n(153))>-1)},backgroundColor:x(174)},e||{}),f=yield this[x(176)](a,e);e&&e[x(189)]!=null&&(E=e[x(189)]),e&&e[x(163)]!=null&&(z=e[x(163)]),e&&e[x(167)]!=null&&(w=e[x(167)]),globalThis.$(f)[x(222)]("width","").css("height",""),this[x(130)]();let u=this[x(238)](),Z=this[x(207)][0][x(140)],J=this[x(207)][0].height;const p=this[x(207)][0][x(175)];if(p&&(p[x(134)]>0||p[x(183)]>0)&&e[x(225)]&&e[x(202)]){let t=Math.floor(e[x(225)]/(Z+p.layoutRowGap/2)),n=Math[x(161)](e[x(202)]/(J+p[x(183)]/2));const M=t*n,D=f[x(237)](x(236)),s=D.length,G=Math[x(233)](s/M);let C=globalThis.$(x(192));p[x(145)]==x(162)?C[x(158)](x(148)+(Number(p[x(134)])||0)/2+x(190)+(Number(p[x(183)])||0)/2+`mm;
19
+ }
20
+ .hiprint-printTemplate .hiprint-printPanel-small {
21
+ display:inline-block;
22
+ padding: `+(Number(p[x(134)])||0)/2+"mm "+(Number(p.layoutColumnGap)||0)/2+x(184)):C[x(158)](`<style>
23
+ .hiprint-printPanel-small{
24
+ box-sizing: border-box;
25
+ border: 0px;
26
+ }
27
+ .hiprint-printPaper-small{
28
+ position: relative;
29
+ padding: 0;
30
+ }
31
+ .hiprint-printTemplate .hiprint-printPaper{
32
+ display: flex;
33
+ flex-wrap: wrap;
34
+ flex-direction: column;
35
+ align-content: flex-start;
36
+ margin: -`+(Number(p.layoutRowGap)||0)/2+"mm -"+(Number(p[x(183)])||0)/2+x(173)+(Number(p[x(134)])||0)/2+x(227)+(Number(p.layoutColumnGap)||0)/2+x(184));for(let k=0;k<G;k++){const g=globalThis.$(`<div class="hiprint-printPanel">
37
+ <div class="hiprint-printPaper" style="width:`+e[x(225)]+x(152)+e.paperHeight+x(125)),R=k*M,$=Math[x(224)]((k+1)*M,s);for(let y=R;y<$;y++){const b=D.eq(y)[x(228)]();b[x(215)]("hiprint-printPaper"),b.addClass("hiprint-printPaper-small start-"+y);const o=globalThis.$(x(137));o.append(b),g[x(237)](x(203))[x(158)](o)}C.append(g)}this[x(154)](C,h),u[x(160)](C[0])}else this.svg2canvas(f,h),u[x(160)](f[0]);let S=u[x(237)](x(236))[x(159)];globalThis.$(f)[x(222)](x(229)),this.loadAllImages(f,function(){const t=x;try{let n=[],M=Math[t(233)](S/w),D=S%w||1;const s=document[t(205)](t(126)),G=s[t(200)]("2d"),C=u[t(237)](t(155)).eq(0).width(),k=C*(h[t(232)]||globalThis[t(206)]);for(let g=0;g<M;g++){G[t(231)](0,0,s[t(140)],s[t(217)]);const R=g==M-1;let $=0,y=R?D:w;for(let b=0;b<y;b++){G[t(231)](0,0,s.width,s[t(217)]);const o=g*w+b,U=u[t(237)](".hiprint-printPanel .hiprint-printPaper")[o];globalThis[t(129)].queue.add(function(B){const O=t;q.toCanvas(U,h)[O(199)](function(N){const l=O;let I=N.getContext("2d");I.imageSmoothingEnabled=![];let V=N.toDataURL(l(157),h[l(223)]||.92),i=new Image;i[l(135)]=V,i[l(149)]=function(){const c=l;b===0&&(s[c(140)]=k,s[c(217)]=i[c(217)]*y),$+=i[c(217)],G[c(172)](i,0,$-i[c(217)],k,i.height),z(o+1,S),B()}})})}globalThis[t(129)][t(168)][t(230)](function(b){const o=t;let U=h[o(213)]||o(157),B=h.toType||"url",O=h.quality||.8;if(E){let N=s[o(169)](U,O),l=new Image;l[o(135)]=N,l[o(149)]=function(){const I=o;n.push({url:N,start:g*w+1,end:g*w+y}),R&&(globalThis[I(129)][I(168)][I(191)](),r[I(166)](),n[I(146)](V=>{const i=I;let c=document.createElement("a"),L=e.name||i(198);L[i(142)](".")==-1&&(L+=".jpg");let X=L[i(179)](".").pop(),W=L[i(240)]("."+X,"")+"_"+V[i(197)]+"-"+V[i(234)]+"."+X;c[i(144)][i(196)]=i(164),c[i(132)](i(127),W),c[i(132)](i(208),V[i(218)]),document[i(211)][i(170)](c),c[i(128)](),c[i(193)]()})),b()};return}if(B==o(218)){n[o(180)](s[o(169)](U,O)),R&&(globalThis.hinnn.queue.clear(),r[o(166)](),d.resolve(n)),b();return}B==o(171)&&s[o(143)](function(N){const l=o;n[l(180)](N),R&&(globalThis[l(129)][l(168)][l(191)](),r[l(166)](),d[l(150)](n)),b()},U,O)})}globalThis[t(129)].queue[t(165)]()}catch(n){console[t(186)](t(139)),console[t(177)](n)}})}return d[x(185)]()})};function A(a,e){var x=v();return A=function(r,d){r=r-439;var E=x[r];return E},A(a,e)}(function(a,e){for(var x=A,r=a();[];)try{var d=-parseInt(x(449))/1+-parseInt(x(450))/2+-parseInt(x(441))/3*(-parseInt(x(451))/4)+-parseInt(x(440))/5+-parseInt(x(448))/6+-parseInt(x(445))/7*(parseInt(x(444))/8)+parseInt(x(452))/9;if(d===e)break;r.push(r.shift())}catch(E){r.push(r.shift())}})(v,672242);function v(){var a=["toImage","newPrintTemplate","5735748wEEXNA","866176wrVrBA","2662854EUUogl","124DeyVZy","40837464ixUXSs","defineProperty","add toImage Api to PrintTemplate","478835hEHDBX","53187kqUhVY","0.3.0","add toImage Api","40AVZCZk","1631735VNBrko"];return v=function(){return a},v()}function m(a){var e=A;return{name:e(443),description:e(443),hooks:[{hook:e(447),name:e(439),description:e(439),priority:1,run:({template:x,options:r})=>{var d=e;Object[d(453)](x,d(446),{value:H,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(442)}}return m});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-image",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "add image api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",