@imgly/plugin-qr-code-web 1.86.0-nightly.20261102 → 1.87.0-nightly.20261104
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.d.ts +9 -5
- package/dist/index.mjs +15 -19
- package/dist/index.mjs.map +1 -7
- package/package.json +7 -8
- package/dist/.tsbuildinfo +0 -1
- package/dist/lib/qrcodegen.d.ts +0 -100
- package/dist/plugin.d.ts +0 -8
- package/dist/qr.d.ts +0 -7
- package/dist/types.d.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@cesdk/cesdk-js";
|
|
2
|
+
interface PluginConfiguration {
|
|
3
|
+
createdBlockType?: 'fill' | 'shape';
|
|
4
|
+
addCheckboxForCreatedBlockType?: boolean;
|
|
5
|
+
}
|
|
2
6
|
declare const Plugin: (pluginConfiguration?: PluginConfiguration) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
initialize: (context: import("@cesdk/cesdk-js").EditorPluginContext) => void | Promise<void>;
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
6
10
|
};
|
|
7
|
-
export default
|
|
11
|
+
export { Plugin as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var Pt=class{constructor(t,n){this.engine=t,this.key=n}hasData(t){return this.engine.block.isValid(t)&&this.engine.block.hasMetadata(t,this.key)}get(t){if(this.hasData(t))return JSON.parse(this.engine.block.getMetadata(t,this.key))}set(t,n){this.engine.block.setMetadata(t,this.key,JSON.stringify(n))}clear(t){this.engine.block.hasMetadata(t,this.key)&&this.engine.block.removeMetadata(t,this.key)}},gt=Pt,Mt=typeof global=="object"&&global&&global.Object===Object&&global,pt=Mt,kt=typeof self=="object"&&self&&self.Object===Object&&self,Nt=pt||kt||Function("return this")(),A=Nt,Ft=A.Symbol,R=Ft,bt=Object.prototype,xt=bt.hasOwnProperty,Ot=bt.toString,O=R?R.toStringTag:void 0;function Bt(t){var n=xt.call(t,O),o=t[O];try{t[O]=void 0;var l=!0}catch{}var c=Ot.call(t);return l&&(n?t[O]=o:delete t[O]),c}var _t=Bt,jt=Object.prototype,Vt=jt.toString;function Dt(t){return Vt.call(t)}var Lt=Dt,Ht="[object Null]",$t="[object Undefined]",tt=R?R.toStringTag:void 0;function Ut(t){return t==null?t===void 0?$t:Ht:tt&&tt in Object(t)?_t(t):Lt(t)}var V=Ut;function zt(t){return t!=null&&typeof t=="object"}var W=zt,Fi=Array.isArray;function Tt(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}var yt=Tt,Gt="[object AsyncFunction]",qt="[object Function]",Zt="[object GeneratorFunction]",Yt="[object Proxy]";function Wt(t){if(!yt(t))return!1;var n=V(t);return n==qt||n==Zt||n==Gt||n==Yt}var Kt=Wt,Xt=A["__core-js_shared__"],U=Xt,et=function(){var t=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Jt(t){return!!et&&et in t}var Qt=Jt,te=Function.prototype,ee=te.toString;function re(t){if(t!=null){try{return ee.call(t)}catch{}try{return t+""}catch{}}return""}var S=re,ie=/[\\^$.*+?()[\]{}|]/g,ne=/^\[object .+?Constructor\]$/,ae=Function.prototype,oe=Object.prototype,se=ae.toString,le=oe.hasOwnProperty,ce=RegExp("^"+se.call(le).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ue(t){if(!yt(t)||Qt(t))return!1;var n=Kt(t)?ce:ne;return n.test(S(t))}var de=ue;function he(t,n){return t?.[n]}var fe=he;function ge(t,n){var o=fe(t,n);return de(o)?o:void 0}var P=ge,pe=P(A,"WeakMap"),T=pe;function be(t,n){return t===n||t!==t&&n!==n}var ye=be,ve=9007199254740991;function me(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ve}var we=me;var xi=Object.prototype;var Ae="[object Arguments]";function Ce(t){return W(t)&&V(t)==Ae}var rt=Ce,vt=Object.prototype,Se=vt.hasOwnProperty,Ee=vt.propertyIsEnumerable,Oi=rt(function(){return arguments}())?rt:function(t){return W(t)&&Se.call(t,"callee")&&!Ee.call(t,"callee")};var mt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,it=mt&&typeof module=="object"&&module&&!module.nodeType&&module,Ie=it&&it.exports===mt,nt=Ie?A.Buffer:void 0,Bi=nt?nt.isBuffer:void 0;var Re="[object Arguments]",Pe="[object Array]",Me="[object Boolean]",ke="[object Date]",Ne="[object Error]",Fe="[object Function]",xe="[object Map]",Oe="[object Number]",Be="[object Object]",_e="[object RegExp]",je="[object Set]",Ve="[object String]",De="[object WeakMap]",Le="[object ArrayBuffer]",He="[object DataView]",$e="[object Float32Array]",Ue="[object Float64Array]",ze="[object Int8Array]",Te="[object Int16Array]",Ge="[object Int32Array]",qe="[object Uint8Array]",Ze="[object Uint8ClampedArray]",Ye="[object Uint16Array]",We="[object Uint32Array]",p={};p[$e]=p[Ue]=p[ze]=p[Te]=p[Ge]=p[qe]=p[Ze]=p[Ye]=p[We]=!0;p[Re]=p[Pe]=p[Le]=p[Me]=p[He]=p[ke]=p[Ne]=p[Fe]=p[xe]=p[Oe]=p[Be]=p[_e]=p[je]=p[Ve]=p[De]=!1;function Ke(t){return W(t)&&we(t.length)&&!!p[V(t)]}var Xe=Ke;function Je(t){return function(n){return t(n)}}var Qe=Je,wt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=wt&&typeof module=="object"&&module&&!module.nodeType&&module,tr=B&&B.exports===wt,z=tr&&pt.process,er=function(){try{var t=B&&B.require&&B.require("util").types;return t||z&&z.binding&&z.binding("util")}catch{}}(),at=er,ot=at&&at.isTypedArray,_i=ot?Qe(ot):Xe;var rr=Object.prototype,ji=rr.hasOwnProperty;function ir(t,n){return function(o){return t(n(o))}}var nr=ir,Vi=nr(Object.keys,Object);var ar=Object.prototype,Di=ar.hasOwnProperty;var or=P(Object,"create"),_=or;function sr(){this.__data__=_?_(null):{},this.size=0}var lr=sr;function cr(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}var ur=cr,dr="__lodash_hash_undefined__",hr=Object.prototype,fr=hr.hasOwnProperty;function gr(t){var n=this.__data__;if(_){var o=n[t];return o===dr?void 0:o}return fr.call(n,t)?n[t]:void 0}var pr=gr,br=Object.prototype,yr=br.hasOwnProperty;function vr(t){var n=this.__data__;return _?n[t]!==void 0:yr.call(n,t)}var mr=vr,wr="__lodash_hash_undefined__";function Ar(t,n){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=_&&n===void 0?wr:n,this}var Cr=Ar;function M(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var l=t[n];this.set(l[0],l[1])}}M.prototype.clear=lr;M.prototype.delete=ur;M.prototype.get=pr;M.prototype.has=mr;M.prototype.set=Cr;var st=M;function Sr(){this.__data__=[],this.size=0}var Er=Sr;function Ir(t,n){for(var o=t.length;o--;)if(ye(t[o][0],n))return o;return-1}var L=Ir,Rr=Array.prototype,Pr=Rr.splice;function Mr(t){var n=this.__data__,o=L(n,t);if(o<0)return!1;var l=n.length-1;return o==l?n.pop():Pr.call(n,o,1),--this.size,!0}var kr=Mr;function Nr(t){var n=this.__data__,o=L(n,t);return o<0?void 0:n[o][1]}var Fr=Nr;function xr(t){return L(this.__data__,t)>-1}var Or=xr;function Br(t,n){var o=this.__data__,l=L(o,t);return l<0?(++this.size,o.push([t,n])):o[l][1]=n,this}var _r=Br;function k(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var l=t[n];this.set(l[0],l[1])}}k.prototype.clear=Er;k.prototype.delete=kr;k.prototype.get=Fr;k.prototype.has=Or;k.prototype.set=_r;var H=k,jr=P(A,"Map"),j=jr;function Vr(){this.size=0,this.__data__={hash:new st,map:new(j||H),string:new st}}var Dr=Vr;function Lr(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}var Hr=Lr;function $r(t,n){var o=t.__data__;return Hr(n)?o[typeof n=="string"?"string":"hash"]:o.map}var $=$r;function Ur(t){var n=$(this,t).delete(t);return this.size-=n?1:0,n}var zr=Ur;function Tr(t){return $(this,t).get(t)}var Gr=Tr;function qr(t){return $(this,t).has(t)}var Zr=qr;function Yr(t,n){var o=$(this,t),l=o.size;return o.set(t,n),this.size+=o.size==l?0:1,this}var Wr=Yr;function N(t){var n=-1,o=t==null?0:t.length;for(this.clear();++n<o;){var l=t[n];this.set(l[0],l[1])}}N.prototype.clear=Dr;N.prototype.delete=zr;N.prototype.get=Gr;N.prototype.has=Zr;N.prototype.set=Wr;var At=N;function Kr(){this.__data__=new H,this.size=0}var Xr=Kr;function Jr(t){var n=this.__data__,o=n.delete(t);return this.size=n.size,o}var Qr=Jr;function ti(t){return this.__data__.get(t)}var ei=ti;function ri(t){return this.__data__.has(t)}var ii=ri,ni=200;function ai(t,n){var o=this.__data__;if(o instanceof H){var l=o.__data__;if(!j||l.length<ni-1)return l.push([t,n]),this.size=++o.size,this;o=this.__data__=new At(l)}return o.set(t,n),this.size=o.size,this}var oi=ai;function D(t){var n=this.__data__=new H(t);this.size=n.size}D.prototype.clear=Xr;D.prototype.delete=Qr;D.prototype.get=ei;D.prototype.has=ii;D.prototype.set=oi;var si=Object.prototype,Li=si.propertyIsEnumerable;var li=P(A,"DataView"),G=li,ci=P(A,"Promise"),q=ci,ui=P(A,"Set"),Z=ui,lt="[object Map]",di="[object Object]",ct="[object Promise]",ut="[object Set]",dt="[object WeakMap]",ht="[object DataView]",hi=S(G),fi=S(j),gi=S(q),pi=S(Z),bi=S(T),I=V;(G&&I(new G(new ArrayBuffer(1)))!=ht||j&&I(new j)!=lt||q&&I(q.resolve())!=ct||Z&&I(new Z)!=ut||T&&I(new T)!=dt)&&(I=function(t){var n=V(t),o=n==di?t.constructor:void 0,l=o?S(o):"";if(l)switch(l){case hi:return ht;case fi:return lt;case gi:return ct;case pi:return ut;case bi:return dt}return n});var Hi=A.Uint8Array;var yi="__lodash_hash_undefined__";function vi(t){return this.__data__.set(t,yi),this}var mi=vi;function wi(t){return this.__data__.has(t)}var Ai=wi;function Y(t){var n=-1,o=t==null?0:t.length;for(this.__data__=new At;++n<o;)this.add(t[n])}Y.prototype.add=Y.prototype.push=mi;Y.prototype.has=Ai;var ft=R?R.prototype:void 0,$i=ft?ft.valueOf:void 0;var Ci=Object.prototype,Ui=Ci.hasOwnProperty;var Si=Object.prototype,zi=Si.hasOwnProperty;var Ti=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Ei=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Ii=new RegExp(/[A-Fa-f0-9]{2}/,"g"),K=(t,n=!1)=>{let{r:o,g:l,b:c,a:u}=t,f=Math.round(255*o),e=Math.round(255*l),i=Math.round(255*c),r=Math.round(255*u),a=s=>s.toString(16).padStart(2,"0");return`#${a(f)}${a(e)}${a(i)}${n?a(r):""}`},Ct=t=>{let n=(o,l,c,u,f)=>({r:parseInt(o,16)/f,g:parseInt(l,16)/f,b:parseInt(c,16)/f,a:u===void 0?1:parseInt(u,16)/f});if(t.startsWith("#")){if(t.length===4||t.length===5){let o=t.match(Ei);if(o){let[l,c,u,f]=o;return n(l,c,u,f,15)}}if(t.length===7||t.length===8){let o=t.match(Ii);if(o){let[l,c,u,f]=o;return n(l,c,u,f,255)}}}throw new Error('Invalid hex string! Allowed RGB formats are "#FFF" and "#FFFFFF". Allowed RGBA formats are "#FFFF" and "#FFFFFFFF')};var F;(u=>{class t{constructor(e,i,r,a){this.version=e;this.errorCorrectionLevel=i;this.modules=[];this.isFunction=[];if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw new RangeError("Version value out of range");if(a<-1||a>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let s=[];for(let d=0;d<this.size;d++)s.push(!1);for(let d=0;d<this.size;d++)this.modules.push(s.slice()),this.isFunction.push(s.slice());this.drawFunctionPatterns();let h=this.addEccAndInterleave(r);if(this.drawCodewords(h),a==-1){let d=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);let g=this.getPenaltyScore();g<d&&(a=b,d=g),this.applyMask(b)}}l(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(e,i){let r=u.QrSegment.makeSegments(e);return t.encodeSegments(r,i)}static encodeBinary(e,i){let r=u.QrSegment.makeBytes(e);return t.encodeSegments([r],i)}static encodeSegments(e,i,r=1,a=40,s=-1,h=!0){if(!(t.MIN_VERSION<=r&&r<=a&&a<=t.MAX_VERSION)||s<-1||s>7)throw new RangeError("Invalid value");let d,b;for(d=r;;d++){let y=t.getNumDataCodewords(d,i)*8,w=c.getTotalBits(e,d);if(w<=y){b=w;break}if(d>=a)throw new RangeError("Data too long")}for(let y of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])h&&b<=t.getNumDataCodewords(d,y)*8&&(i=y);let g=[];for(let y of e){n(y.mode.modeBits,4,g),n(y.numChars,y.mode.numCharCountBits(d),g);for(let w of y.getData())g.push(w)}l(g.length==b);let x=t.getNumDataCodewords(d,i)*8;l(g.length<=x),n(0,Math.min(4,x-g.length),g),n(0,(8-g.length%8)%8,g),l(g.length%8==0);for(let y=236;g.length<x;y^=253)n(y,8,g);let C=[];for(;C.length*8<g.length;)C.push(0);return g.forEach((y,w)=>C[w>>>3]|=y<<7-(w&7)),new t(d,i,C,s)}getModule(e,i){return 0<=e&&e<this.size&&0<=i&&i<this.size&&this.modules[i][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let r=0;r<this.size;r++)this.setFunctionModule(6,r,r%2==0),this.setFunctionModule(r,6,r%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),i=e.length;for(let r=0;r<i;r++)for(let a=0;a<i;a++)r==0&&a==0||r==0&&a==i-1||r==i-1&&a==0||this.drawAlignmentPattern(e[r],e[a]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let i=this.errorCorrectionLevel.formatBits<<3|e,r=i;for(let s=0;s<10;s++)r=r<<1^(r>>>9)*1335;let a=(i<<10|r)^21522;l(a>>>15==0);for(let s=0;s<=5;s++)this.setFunctionModule(8,s,o(a,s));this.setFunctionModule(8,7,o(a,6)),this.setFunctionModule(8,8,o(a,7)),this.setFunctionModule(7,8,o(a,8));for(let s=9;s<15;s++)this.setFunctionModule(14-s,8,o(a,s));for(let s=0;s<8;s++)this.setFunctionModule(this.size-1-s,8,o(a,s));for(let s=8;s<15;s++)this.setFunctionModule(8,this.size-15+s,o(a,s));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let r=0;r<12;r++)e=e<<1^(e>>>11)*7973;let i=this.version<<12|e;l(i>>>18==0);for(let r=0;r<18;r++){let a=o(i,r),s=this.size-11+r%3,h=Math.floor(r/3);this.setFunctionModule(s,h,a),this.setFunctionModule(h,s,a)}}drawFinderPattern(e,i){for(let r=-4;r<=4;r++)for(let a=-4;a<=4;a++){let s=Math.max(Math.abs(a),Math.abs(r)),h=e+a,d=i+r;0<=h&&h<this.size&&0<=d&&d<this.size&&this.setFunctionModule(h,d,s!=2&&s!=4)}}drawAlignmentPattern(e,i){for(let r=-2;r<=2;r++)for(let a=-2;a<=2;a++)this.setFunctionModule(e+a,i+r,Math.max(Math.abs(a),Math.abs(r))!=1)}setFunctionModule(e,i,r){this.modules[i][e]=r,this.isFunction[i][e]=!0}addEccAndInterleave(e){let i=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(i,r))throw new RangeError("Invalid argument");let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][i],s=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][i],h=Math.floor(t.getNumRawDataModules(i)/8),d=a-h%a,b=Math.floor(h/a),g=[],x=t.reedSolomonComputeDivisor(s);for(let y=0,w=0;y<a;y++){let E=e.slice(w,w+b-s+(y<d?0:1));w+=E.length;let Rt=t.reedSolomonComputeRemainder(E,x);y<d&&E.push(0),g.push(E.concat(Rt))}let C=[];for(let y=0;y<g[0].length;y++)g.forEach((w,E)=>{(y!=b-s||E>=d)&&C.push(w[y])});return l(C.length==h),C}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let i=0;for(let r=this.size-1;r>=1;r-=2){r==6&&(r=5);for(let a=0;a<this.size;a++)for(let s=0;s<2;s++){let h=r-s,b=(r+1&2)==0?this.size-1-a:a;!this.isFunction[b][h]&&i<e.length*8&&(this.modules[b][h]=o(e[i>>>3],7-(i&7)),i++)}}l(i==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let i=0;i<this.size;i++)for(let r=0;r<this.size;r++){let a;switch(e){case 0:a=(r+i)%2==0;break;case 1:a=i%2==0;break;case 2:a=r%3==0;break;case 3:a=(r+i)%3==0;break;case 4:a=(Math.floor(r/3)+Math.floor(i/2))%2==0;break;case 5:a=r*i%2+r*i%3==0;break;case 6:a=(r*i%2+r*i%3)%2==0;break;case 7:a=((r+i)%2+r*i%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[i][r]&&a&&(this.modules[i][r]=!this.modules[i][r])}}getPenaltyScore(){let e=0;for(let s=0;s<this.size;s++){let h=!1,d=0,b=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[s][g]==h?(d++,d==5?e+=t.PENALTY_N1:d>5&&e++):(this.finderPenaltyAddHistory(d,b),h||(e+=this.finderPenaltyCountPatterns(b)*t.PENALTY_N3),h=this.modules[s][g],d=1);e+=this.finderPenaltyTerminateAndCount(h,d,b)*t.PENALTY_N3}for(let s=0;s<this.size;s++){let h=!1,d=0,b=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[g][s]==h?(d++,d==5?e+=t.PENALTY_N1:d>5&&e++):(this.finderPenaltyAddHistory(d,b),h||(e+=this.finderPenaltyCountPatterns(b)*t.PENALTY_N3),h=this.modules[g][s],d=1);e+=this.finderPenaltyTerminateAndCount(h,d,b)*t.PENALTY_N3}for(let s=0;s<this.size-1;s++)for(let h=0;h<this.size-1;h++){let d=this.modules[s][h];d==this.modules[s][h+1]&&d==this.modules[s+1][h]&&d==this.modules[s+1][h+1]&&(e+=t.PENALTY_N2)}let i=0;for(let s of this.modules)i=s.reduce((h,d)=>h+(d?1:0),i);let r=this.size*this.size,a=Math.ceil(Math.abs(i*20-r*10)/r)-1;return l(0<=a&&a<=9),e+=a*t.PENALTY_N4,l(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,i=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,r=[6];for(let a=this.size-7;r.length<e;a-=i)r.splice(1,0,a);return r}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw new RangeError("Version number out of range");let i=(16*e+128)*e+64;if(e>=2){let r=Math.floor(e/7)+2;i-=(25*r-10)*r-55,e>=7&&(i-=36)}return l(208<=i&&i<=29648),i}static getNumDataCodewords(e,i){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[i.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let i=[];for(let a=0;a<e-1;a++)i.push(0);i.push(1);let r=1;for(let a=0;a<e;a++){for(let s=0;s<i.length;s++)i[s]=t.reedSolomonMultiply(i[s],r),s+1<i.length&&(i[s]^=i[s+1]);r=t.reedSolomonMultiply(r,2)}return i}static reedSolomonComputeRemainder(e,i){let r=i.map(a=>0);for(let a of e){let s=a^r.shift();r.push(0),i.forEach((h,d)=>r[d]^=t.reedSolomonMultiply(h,s))}return r}static reedSolomonMultiply(e,i){if(e>>>8||i>>>8)throw new RangeError("Byte out of range");let r=0;for(let a=7;a>=0;a--)r=r<<1^(r>>>7)*285,r^=(i>>>a&1)*e;return l(r>>>8==0),r}finderPenaltyCountPatterns(e){let i=e[1];l(i<=this.size*3);let r=i>0&&e[2]==i&&e[3]==i*3&&e[4]==i&&e[5]==i;return(r&&e[0]>=i*4&&e[6]>=i?1:0)+(r&&e[6]>=i*4&&e[0]>=i?1:0)}finderPenaltyTerminateAndCount(e,i,r){return e&&(this.finderPenaltyAddHistory(i,r),i=0),i+=this.size,this.finderPenaltyAddHistory(i,r),this.finderPenaltyCountPatterns(r)}finderPenaltyAddHistory(e,i){i[0]==0&&(e+=this.size),i.pop(),i.unshift(e)}static{this.MIN_VERSION=1}static{this.MAX_VERSION=40}static{this.PENALTY_N1=3}static{this.PENALTY_N2=3}static{this.PENALTY_N3=40}static{this.PENALTY_N4=10}static{this.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]]}static{this.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}}u.QrCode=t;function n(f,e,i){if(e<0||e>31||f>>>e)throw new RangeError("Value out of range");for(let r=e-1;r>=0;r--)i.push(f>>>r&1)}function o(f,e){return(f>>>e&1)!=0}function l(f){if(!f)throw new Error("Assertion error")}class c{constructor(e,i,r){this.mode=e;this.numChars=i;this.bitData=r;if(i<0)throw new RangeError("Invalid argument");this.bitData=r.slice()}static makeBytes(e){let i=[];for(let r of e)n(r,8,i);return new c(c.Mode.BYTE,e.length,i)}static makeNumeric(e){if(!c.isNumeric(e))throw new RangeError("String contains non-numeric characters");let i=[];for(let r=0;r<e.length;){let a=Math.min(e.length-r,3);n(parseInt(e.substring(r,r+a),10),a*3+1,i),r+=a}return new c(c.Mode.NUMERIC,e.length,i)}static makeAlphanumeric(e){if(!c.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let i=[],r;for(r=0;r+2<=e.length;r+=2){let a=c.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r))*45;a+=c.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r+1)),n(a,11,i)}return r<e.length&&n(c.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)),6,i),new c(c.Mode.ALPHANUMERIC,e.length,i)}static makeSegments(e){return e==""?[]:c.isNumeric(e)?[c.makeNumeric(e)]:c.isAlphanumeric(e)?[c.makeAlphanumeric(e)]:[c.makeBytes(c.toUtf8ByteArray(e))]}static makeEci(e){let i=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)n(e,8,i);else if(e<16384)n(2,2,i),n(e,14,i);else if(e<1e6)n(6,3,i),n(e,21,i);else throw new RangeError("ECI assignment value out of range");return new c(c.Mode.ECI,0,i)}static isNumeric(e){return c.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return c.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,i){let r=0;for(let a of e){let s=a.mode.numCharCountBits(i);if(a.numChars>=1<<s)return 1/0;r+=4+s+a.bitData.length}return r}static toUtf8ByteArray(e){e=encodeURI(e);let i=[];for(let r=0;r<e.length;r++)e.charAt(r)!="%"?i.push(e.charCodeAt(r)):(i.push(parseInt(e.substring(r+1,r+3),16)),r+=2);return i}static{this.NUMERIC_REGEX=/^[0-9]*$/}static{this.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/}static{this.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}}u.QrSegment=c})(F||={});(n=>{let t;(l=>{class o{constructor(u,f){this.ordinal=u;this.formatBits=f}static{this.LOW=new o(0,1)}static{this.MEDIUM=new o(1,0)}static{this.QUARTILE=new o(2,3)}static{this.HIGH=new o(3,2)}}l.Ecc=o})(t=n.QrCode||={})})(F||={});(n=>{let t;(l=>{class o{constructor(u,f){this.modeBits=u;this.numBitsCharCount=f}static{this.NUMERIC=new o(1,[10,12,14])}static{this.ALPHANUMERIC=new o(2,[9,11,13])}static{this.BYTE=new o(4,[8,16,16])}static{this.KANJI=new o(8,[8,10,12])}static{this.ECI=new o(7,[0,0,0])}numCharCountBits(u){return this.numBitsCharCount[Math.floor((u+7)/17)]}}l.Mode=o})(t=n.QrSegment||={})})(F||={});var X=F;function J(t,n){let o=X.QrCode.encodeText(t,X.QrCode.Ecc.HIGH),l=Ri(o);return{svg:Pi(l,n,o.size),path:l,size:o.size}}function Ri(t){let n=[];for(let o=0;o<t.size;o++)for(let l=0;l<t.size;l++)t.getModule(l,o)&&n.push(`M${l},${o}h1v1h-1z`);return n.join(" ")}function Pi(t,n,o){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
1
|
+
var e=class{constructor(e,t){this.engine=e,this.key=t}hasData(e){return this.engine.block.isValid(e)&&this.engine.block.hasMetadata(e,this.key)}get(e){if(this.hasData(e))return JSON.parse(this.engine.block.getMetadata(e,this.key))}set(e,t){this.engine.block.setMetadata(e,this.key,JSON.stringify(t))}clear(e){this.engine.block.hasMetadata(e,this.key)&&this.engine.block.removeMetadata(e,this.key)}},t=typeof global==`object`&&global&&global.Object===Object&&global,n=typeof self==`object`&&self&&self.Object===Object&&self,r=t||n||Function(`return this`)(),i=r.Symbol,a=Object.prototype,o=a.hasOwnProperty,s=a.toString,c=i?i.toStringTag:void 0;function l(e){var t=o.call(e,c),n=e[c];try{e[c]=void 0;var r=!0}catch{}var i=s.call(e);return r&&(t?e[c]=n:delete e[c]),i}var u=Object.prototype.toString;function d(e){return u.call(e)}var ee=`[object Null]`,te=`[object Undefined]`,ne=i?i.toStringTag:void 0;function f(e){return e==null?e===void 0?te:ee:ne&&ne in Object(e)?l(e):d(e)}function re(e){return typeof e==`object`&&!!e}Array.isArray;function ie(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var ae=`[object AsyncFunction]`,oe=`[object Function]`,se=`[object GeneratorFunction]`,ce=`[object Proxy]`;function le(e){if(!ie(e))return!1;var t=f(e);return t==oe||t==se||t==ae||t==ce}var p=r[`__core-js_shared__`],m=function(){var e=/[^.]+$/.exec(p&&p.keys&&p.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function ue(e){return!!m&&m in e}var de=Function.prototype.toString;function h(e){if(e!=null){try{return de.call(e)}catch{}try{return e+``}catch{}}return``}var fe=/[\\^$.*+?()[\]{}|]/g,pe=/^\[object .+?Constructor\]$/,me=Function.prototype,he=Object.prototype,ge=me.toString,_e=he.hasOwnProperty,ve=RegExp(`^`+ge.call(_e).replace(fe,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function ye(e){return!ie(e)||ue(e)?!1:(le(e)?ve:pe).test(h(e))}function be(e,t){return e?.[t]}function g(e,t){var n=be(e,t);return ye(n)?n:void 0}var _=g(r,`WeakMap`);function xe(e,t){return e===t||e!==e&&t!==t}var Se=`[object Arguments]`;function Ce(e){return re(e)&&f(e)==Se}var we=Object.prototype;we.hasOwnProperty,we.propertyIsEnumerable,Ce(function(){return arguments}());var Te=typeof exports==`object`&&exports&&!exports.nodeType&&exports,v=Te&&typeof module==`object`&&module&&!module.nodeType&&module,y=v&&v.exports===Te?r.Buffer:void 0;y&&y.isBuffer;var Ee=`[object Arguments]`,De=`[object Array]`,Oe=`[object Boolean]`,ke=`[object Date]`,Ae=`[object Error]`,je=`[object Function]`,Me=`[object Map]`,Ne=`[object Number]`,Pe=`[object Object]`,Fe=`[object RegExp]`,Ie=`[object Set]`,Le=`[object String]`,Re=`[object WeakMap]`,ze=`[object ArrayBuffer]`,Be=`[object DataView]`,Ve=`[object Float32Array]`,He=`[object Float64Array]`,Ue=`[object Int8Array]`,We=`[object Int16Array]`,Ge=`[object Int32Array]`,Ke=`[object Uint8Array]`,qe=`[object Uint8ClampedArray]`,Je=`[object Uint16Array]`,Ye=`[object Uint32Array]`,b={};b[Ve]=b[He]=b[Ue]=b[We]=b[Ge]=b[Ke]=b[qe]=b[Je]=b[Ye]=!0,b[Ee]=b[De]=b[ze]=b[Oe]=b[Be]=b[ke]=b[Ae]=b[je]=b[Me]=b[Ne]=b[Pe]=b[Fe]=b[Ie]=b[Le]=b[Re]=!1;var Xe=typeof exports==`object`&&exports&&!exports.nodeType&&exports,x=Xe&&typeof module==`object`&&module&&!module.nodeType&&module,S=x&&x.exports===Xe&&t.process,Ze=function(){try{return x&&x.require&&x.require(`util`).types||S&&S.binding&&S.binding(`util`)}catch{}}();Ze&&Ze.isTypedArray;var C=g(Object,`create`);function Qe(){this.__data__=C?C(null):{},this.size=0}function $e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var et=`__lodash_hash_undefined__`,tt=Object.prototype.hasOwnProperty;function nt(e){var t=this.__data__;if(C){var n=t[e];return n===et?void 0:n}return tt.call(t,e)?t[e]:void 0}var rt=Object.prototype.hasOwnProperty;function it(e){var t=this.__data__;return C?t[e]!==void 0:rt.call(t,e)}var at=`__lodash_hash_undefined__`;function ot(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=C&&t===void 0?at:t,this}function w(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}w.prototype.clear=Qe,w.prototype.delete=$e,w.prototype.get=nt,w.prototype.has=it,w.prototype.set=ot;function st(){this.__data__=[],this.size=0}function T(e,t){for(var n=e.length;n--;)if(xe(e[n][0],t))return n;return-1}var ct=Array.prototype.splice;function lt(e){var t=this.__data__,n=T(t,e);return n<0?!1:(n==t.length-1?t.pop():ct.call(t,n,1),--this.size,!0)}function ut(e){var t=this.__data__,n=T(t,e);return n<0?void 0:t[n][1]}function dt(e){return T(this.__data__,e)>-1}function ft(e,t){var n=this.__data__,r=T(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function E(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}E.prototype.clear=st,E.prototype.delete=lt,E.prototype.get=ut,E.prototype.has=dt,E.prototype.set=ft;var D=g(r,`Map`);function pt(){this.size=0,this.__data__={hash:new w,map:new(D||E),string:new w}}function mt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function O(e,t){var n=e.__data__;return mt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function ht(e){var t=O(this,e).delete(e);return this.size-=+!!t,t}function gt(e){return O(this,e).get(e)}function _t(e){return O(this,e).has(e)}function vt(e,t){var n=O(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function k(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}k.prototype.clear=pt,k.prototype.delete=ht,k.prototype.get=gt,k.prototype.has=_t,k.prototype.set=vt;function yt(){this.__data__=new E,this.size=0}function bt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function xt(e){return this.__data__.get(e)}function St(e){return this.__data__.has(e)}var Ct=200;function wt(e,t){var n=this.__data__;if(n instanceof E){var r=n.__data__;if(!D||r.length<Ct-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new k(r)}return n.set(e,t),this.size=n.size,this}function A(e){var t=this.__data__=new E(e);this.size=t.size}A.prototype.clear=yt,A.prototype.delete=bt,A.prototype.get=xt,A.prototype.has=St,A.prototype.set=wt;var j=g(r,`DataView`),M=g(r,`Promise`),N=g(r,`Set`),P=`[object Map]`,Tt=`[object Object]`,F=`[object Promise]`,I=`[object Set]`,L=`[object WeakMap]`,R=`[object DataView]`,Et=h(j),Dt=h(D),Ot=h(M),kt=h(N),At=h(_),z=f;(j&&z(new j(/* @__PURE__ */ new ArrayBuffer(1)))!=R||D&&z(new D)!=P||M&&z(M.resolve())!=F||N&&z(new N)!=I||_&&z(new _)!=L)&&(z=function(e){var t=f(e),n=t==Tt?e.constructor:void 0,r=n?h(n):``;if(r)switch(r){case Et:return R;case Dt:return P;case Ot:return F;case kt:return I;case At:return L}return t}),r.Uint8Array;var jt=`__lodash_hash_undefined__`;function Mt(e){return this.__data__.set(e,jt),this}function Nt(e){return this.__data__.has(e)}function B(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new k;++t<n;)this.add(e[t])}B.prototype.add=B.prototype.push=Mt,B.prototype.has=Nt;var V=i?i.prototype:void 0;V&&V.valueOf;const Pt=/* @__PURE__ */ new RegExp(/[A-Fa-f0-9]{1}/,`g`),Ft=/* @__PURE__ */ new RegExp(/[A-Fa-f0-9]{2}/,`g`),H=(e,t=!1)=>{let{r:n,g:r,b:i,a}=e,o=Math.round(255*n),s=Math.round(255*r),c=Math.round(255*i),l=Math.round(255*a),u=e=>e.toString(16).padStart(2,`0`);return`#${u(o)}${u(s)}${u(c)}${t?u(l):``}`},It=e=>{let t=(e,t,n,r,i)=>({r:parseInt(e,16)/i,g:parseInt(t,16)/i,b:parseInt(n,16)/i,a:r===void 0?1:parseInt(r,16)/i});if(e.startsWith(`#`)){if(e.length===4||e.length===5){let n=e.match(Pt);if(n){let[e,r,i,a]=n;return t(e,r,i,a,15)}}if(e.length===7||e.length===8){let n=e.match(Ft);if(n){let[e,r,i,a]=n;return t(e,r,i,a,255)}}}throw Error(`Invalid hex string! Allowed RGB formats are "#FFF" and "#FFFFFF". Allowed RGBA formats are "#FFFF" and "#FFFFFFFF`)};var U,W,G=class e{static encodeText(t,n){let r=Y.makeSegments(t);return e.encodeSegments(r,n)}static encodeBinary(t,n){let r=Y.makeBytes(t);return e.encodeSegments([r],n)}static encodeSegments(t,n,r=1,i=40,a=-1,o=!0){if(!(e.MIN_VERSION<=r&&r<=i&&i<=e.MAX_VERSION)||a<-1||a>7)throw RangeError(`Invalid value`);let s,c;for(s=r;;s++){let r=e.getNumDataCodewords(s,n)*8,a=Y.getTotalBits(t,s);if(a<=r){c=a;break}if(s>=i)throw RangeError(`Data too long`)}for(let t of[X.MEDIUM,X.QUARTILE,X.HIGH])o&&c<=e.getNumDataCodewords(s,t)*8&&(n=t);let l=[];for(let e of t){K(e.mode.modeBits,4,l),K(e.numChars,e.mode.numCharCountBits(s),l);for(let t of e.getData())l.push(t)}J(l.length==c);let u=e.getNumDataCodewords(s,n)*8;J(l.length<=u),K(0,Math.min(4,u-l.length),l),K(0,(8-l.length%8)%8,l),J(l.length%8==0);for(let e=236;l.length<u;e^=253)K(e,8,l);let d=[];for(;d.length*8<l.length;)d.push(0);return l.forEach((e,t)=>d[t>>>3]|=e<<7-(t&7)),new e(s,n,d,a)}constructor(t,n,r,i){if(this.version=t,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],t<e.MIN_VERSION||t>e.MAX_VERSION)throw RangeError(`Version value out of range`);if(i<-1||i>7)throw RangeError(`Mask value out of range`);this.size=t*4+17;let a=[];for(let e=0;e<this.size;e++)a.push(!1);for(let e=0;e<this.size;e++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();let o=this.addEccAndInterleave(r);if(this.drawCodewords(o),i==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(i=t,e=n),this.applyMask(t)}}J(0<=i&&i<=7),this.mask=i,this.applyMask(i),this.drawFormatBits(i),this.isFunction=[]}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;J(!(r>>>15));for(let e=0;e<=5;e++)this.setFunctionModule(8,e,q(r,e));this.setFunctionModule(8,7,q(r,6)),this.setFunctionModule(8,8,q(r,7)),this.setFunctionModule(7,8,q(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,q(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,q(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,q(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;J(!(t>>>18));for(let e=0;e<18;e++){let n=q(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(t){let n=this.version,r=this.errorCorrectionLevel;if(t.length!=e.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let i=e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],a=e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],o=Math.floor(e.getNumRawDataModules(n)/8),s=i-o%i,c=Math.floor(o/i),l=[],u=e.reedSolomonComputeDivisor(a);for(let n=0,r=0;n<i;n++){let i=t.slice(r,r+c-a+(n<s?0:1));r+=i.length;let o=e.reedSolomonComputeRemainder(i,u);n<s&&i.push(0),l.push(i.concat(o))}let d=[];for(let e=0;e<l[0].length;e++)l.forEach((t,n)=>{(e!=c-a||n>=s)&&d.push(t[e])});return J(d.length==o),d}drawCodewords(t){if(t.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let e=this.size-1;e>=1;e-=2){e==6&&(e=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=e-i,o=e+1&2?r:this.size-1-r;!this.isFunction[o][a]&&n<t.length*8&&(this.modules[o][a]=q(t[n>>>3],7-(n&7)),n++)}}J(n==t.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let t=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?t+=e.PENALTY_N1:i>5&&t++):(this.finderPenaltyAddHistory(i,a),r||(t+=this.finderPenaltyCountPatterns(a)*e.PENALTY_N3),r=this.modules[n][o],i=1);t+=this.finderPenaltyTerminateAndCount(r,i,a)*e.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?t+=e.PENALTY_N1:i>5&&t++):(this.finderPenaltyAddHistory(i,a),r||(t+=this.finderPenaltyCountPatterns(a)*e.PENALTY_N3),r=this.modules[o][n],i=1);t+=this.finderPenaltyTerminateAndCount(r,i,a)*e.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(t+=e.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,i=Math.ceil(Math.abs(n*20-r*10)/r)-1;return J(0<=i&&i<=9),t+=i*e.PENALTY_N4,J(0<=t&&t<=2568888),t}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(t){if(t<e.MIN_VERSION||t>e.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*t+128)*t+64;if(t>=2){let e=Math.floor(t/7)+2;n-=(25*e-10)*e-55,t>=7&&(n-=36)}return J(208<=n&&n<=29648),n}static getNumDataCodewords(t,n){return Math.floor(e.getNumRawDataModules(t)/8)-e.ECC_CODEWORDS_PER_BLOCK[n.ordinal][t]*e.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][t]}static reedSolomonComputeDivisor(t){if(t<1||t>255)throw RangeError(`Degree out of range`);let n=[];for(let e=0;e<t-1;e++)n.push(0);n.push(1);let r=1;for(let i=0;i<t;i++){for(let t=0;t<n.length;t++)n[t]=e.reedSolomonMultiply(n[t],r),t+1<n.length&&(n[t]^=n[t+1]);r=e.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(t,n){let r=n.map(e=>0);for(let i of t){let t=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=e.reedSolomonMultiply(n,t))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return J(!(n>>>8)),n}finderPenaltyCountPatterns(e){let t=e[1];J(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};G.MIN_VERSION=1,G.MAX_VERSION=40,G.PENALTY_N1=3,G.PENALTY_N2=3,G.PENALTY_N3=40,G.PENALTY_N4=10,G.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],G.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];function K(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function q(e,t){return!!(e>>>t&1)}function J(e){if(!e)throw Error(`Assertion error`)}var Y=class e{static makeBytes(t){let n=[];for(let e of t)K(e,8,n);return new e(Z.BYTE,t.length,n)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let n=[];for(let e=0;e<t.length;){let r=Math.min(t.length-e,3);K(parseInt(t.substring(e,e+r),10),r*3+1,n),e+=r}return new e(Z.NUMERIC,t.length,n)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let n=[],r=0;for(;r+2<=t.length;r+=2){let i=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r))*45;i+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r+1)),K(i,11,n)}return r<t.length&&K(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r)),6,n),new e(Z.ALPHANUMERIC,t.length,n)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let n=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)K(t,8,n);else if(t<16384)K(2,2,n),K(t,14,n);else if(t<1e6)K(6,3,n),K(t,21,n);else throw RangeError(`ECI assignment value out of range`);return new e(Z.ECI,0,n)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};Y.NUMERIC_REGEX=/^[0-9]*$/,Y.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,Y.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;var X=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};U=X,X.LOW=new U(0,1),X.MEDIUM=new U(1,0),X.QUARTILE=new U(2,3),X.HIGH=new U(3,2);var Z=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};W=Z,Z.NUMERIC=new W(1,[10,12,14]),Z.ALPHANUMERIC=new W(2,[9,11,13]),Z.BYTE=new W(4,[8,16,16]),Z.KANJI=new W(8,[8,10,12]),Z.ECI=new W(7,[0,0,0]);function Lt(e,t){let n=G.encodeText(e,X.HIGH),r=Rt(n);return{svg:zt(r,t,n.size),path:r,size:n.size}}function Rt(e){let t=[];for(let n=0;n<e.size;n++)for(let r=0;r<e.size;r++)e.getModule(r,n)&&t.push(`M${r},${n}h1v1h-1z`);return t.join(` `)}function zt(e,t,n){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 ${
|
|
4
|
-
<path d="${
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 ${n} ${n}" stroke="none">
|
|
4
|
+
<path d="${e}" fill="${t}"/>
|
|
5
5
|
</svg>
|
|
6
|
-
`}
|
|
6
|
+
`}const Bt=`@imgly/plugin-qr-code-web`,Q=`//ly.img.panel/generate-qr`,$=`//ly.img.panel/update-qr`;var Vt=(t={})=>{let{createdBlockType:n=`shape`,addCheckboxForCreatedBlockType:r=!1}=t||{};return{initialize({cesdk:t}){if(t==null)return;let i=new e(t.engine,Bt);t.ui.addIconSet(`@imgly/plugin/qr`,`
|
|
7
7
|
<svg>
|
|
8
8
|
<symbol
|
|
9
9
|
fill="none"
|
|
@@ -17,23 +17,19 @@ var Pt=class{constructor(t,n){this.engine=t,this.key=n}hasData(t){return this.en
|
|
|
17
17
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 13H13V15H15V17H13V21H17V19H19V21H21V19H19V17H21V13H17V15H15V13ZM17 17H15V19H17V17ZM17 17V15H19V17H17Z" fill="currentColor"/>
|
|
18
18
|
</symbol>
|
|
19
19
|
</svg>
|
|
20
|
-
`),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
lodash
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
31
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
32
|
-
*)
|
|
33
|
-
*/
|
|
20
|
+
`),t.setTranslations({en:{"ly.img.generate-qr.dock.label":`QR Code`,[`panel.${Q}`]:`Generate QR Code`,[`panel.${Q}.description`]:`Enter a URL to automatically generate a QR code for you to embed it in your design.`,[`panel.${Q}.submit`]:`Generate QR Code`,[`panel.${Q}.url`]:`URL`,[`panel.${Q}.foregroundColor`]:`Foreground Color`,[`panel.${Q}.error`]:`Failed to create QR code block.`,[`panel.${$}`]:`Update QR Code`,[`panel.${$}.description`]:`Update the URL to automatically refresh the QR code within your design.`,[`panel.${$}.asShape`]:`As Shape?`,[`panel.${$}.onlyOneBlock`]:`Please select only one block to update the QR code.`,[`panel.${$}.noMetadata`]:`Invalid QR code block selected. Missing metadata.`,[`panel.${$}.invalidStateShape`]:`Invalid state with no shape found.`,[`panel.${$}.invalidStateFill`]:`Invalid state with no fill found.`,[`panel.${$}.url`]:`URL`,[`panel.${$}.foregroundColor`]:`Foreground Color`,"ly.img.generate-qr.canvasMenu.edit":`Edit`}}),[`ly.img.replace`,`ly.img.crop`,`ly.img.adjustment`,`ly.img.shape.options`].forEach(e=>{t.feature.enable(e,({isPreviousEnable:e,engine:t})=>{let n=t.block.findAllSelected();return(n.length===0||!n.every(e=>{if(!i.hasData(e))return!1;let t=i.get(e)?.type;return t===`fill`||t===`shape`}))&&e()})}),t.feature.enable(`ly.img.fill`,({isPreviousEnable:e,engine:t})=>{let n=t.block.findAllSelected();return(n.length===0||!n.every(e=>i.hasData(e)?i.get(e)?.type===`fill`:!1))&&e()}),t.ui.registerComponent(`ly.img.generate-qr.dock`,({builder:e})=>{let n=t.ui.isPanelOpen(Q);e.Button(`ly.img.generate-qr.dock`,{label:`ly.img.generate-qr.dock.label`,icon:`@imgly/plugin/qr`,isSelected:n,onClick:()=>{n?t.ui.closePanel(Q):t.ui.openPanel(Q)}})}),t.ui.registerComponent(`ly.img.update-qr.canvasMenu`,({builder:e,engine:n})=>{let r=n.block.findAllSelected();if(r.length!==1)return;let a=r[0];n.block.isAllowedByScope(a,`fill/change`)&&i.hasData(a)&&e.Button(`ly.img.update-qr.dock`,{label:`ly.img.generate-qr.canvasMenu.edit`,icon:`@imgly/plugin/qr`,onClick:()=>{t.ui.openPanel($)}})}),t.ui.setCanvasMenuOrder([`ly.img.update-qr.canvasMenu`,...t.ui.getCanvasMenuOrder()]),t.ui.registerPanel(Q,({builder:e,engine:a,state:o})=>{let s=o(`url`,``),c=o(`color`,{r:0,g:0,b:0,a:1}),l=o(`asShape`,n===`shape`);e.Section(`ly.img.generate-qr.text.section`,{children:()=>{e.Text(`ly.img.generate-qr.text`,{content:`panel.${Q}.description`})}}),e.Section(`ly.img.generate-qr.inputs.section`,{children:()=>{e.TextInput(`ly.img.generate-qr.url`,{inputLabel:`panel.${Q}.url`,...s}),e.ColorInput(`ly.img.generate-qr.foregroundColor`,{label:`panel.${Q}.foregroundColor`,inputLabel:`panel.${Q}.foregroundColor`,...c})}}),e.Section(`ly.img.generate-qr.button.section`,{children:()=>{e.Button(`ly.img.generate-qr.generate`,{label:`panel.${Q}.submit`,isDisabled:s.value===``,color:`accent`,onClick:async()=>{await Ut(t,a,s.value,c.value,i,l.value)!=null&&t.ui.closePanel(Q)}}),r&&e.Checkbox(`ly.img.generate-qr.asShape`,{inputLabel:`panel.${$}.asShape`,...l})}})}),t.engine.block.onSelectionChanged(()=>{let e=t.engine.block.findAllSelected();if(e.length!==1){t.ui.isPanelOpen($)&&t.ui.closePanel($);return}let n=e[0];i.hasData(n)||t.ui.isPanelOpen($)&&t.ui.closePanel($)}),t.ui.registerPanel($,({builder:e,engine:n})=>{let r=n.block.findAllSelected();if(r.length!==1){e.Section(`ly.img.update-qr.only-one-block.section`,{children:()=>{e.Text(`ly.img.update-qr.only-one-block`,{content:`panel.${$}.onlyOneBlock`})}});return}let a=r[0];if(!i.hasData(a)){e.Section(`ly.img.update-qr.no-metadata.section`,{children:()=>{e.Text(`ly.img.update-qr.no-metadata`,{content:`panel.${$}.noMetadata`})}});return}let{url:o,color:s,type:c}=i.get(a);e.Section(`ly.img.update-qr.section`,{children:()=>{e.Text(`ly.img.update-qr.text`,{content:`panel.${$}.description`}),e.TextInput(`ly.img.update-qr.url`,{inputLabel:`panel.${$}.url`,value:o,setValue:e=>{i.set(a,{url:e,color:s,type:c}),Wt(t,n,a,e,s,c)}}),c===`fill`&&e.ColorInput(`ly.img.update-qr.foregroundColor`,{inputLabel:`panel.${$}.foregroundColor`,inputLabelPosition:`top`,value:It(s),setValue:e=>{let r=Ht(n,e);i.set(a,{url:o,color:r,type:c}),Wt(t,n,a,o,r,c)}})}})})}}};function Ht(e,t){let n=typeof t==`string`,r;if(n)r=t;else{let n=e.editor.convertColorToColorSpace(t,`sRGB`);r=H(n)}return r}async function Ut(e,t,n,r,i,a){let o=t.editor.convertColorToColorSpace(r,`sRGB`),s=H(o),{path:c,svg:l,size:u}=Lt(n,s),d;if(a){if(d=await t.asset.defaultApplyAsset({id:`qr-code`,meta:{kind:`shape`,vectorPath:c,height:u,width:u,shapeType:`//ly.img.ubq/shape/vector_path`},payload:{}}),d!=null){if(t.block.supportsFill(d)){let e=t.block.getFill(d);t.block.getType(e)===`//ly.img.ubq/fill/color`&&t.block.setColor(e,`fill/color/value`,o)}Gt(t,d)}}else{let e=`data:text/plain;base64,${btoa(l)}`;d=await t.asset.defaultApplyAsset({id:`qr-code`,meta:{fillType:`//ly.img.ubq/fill/image`,width:u,height:u},payload:{sourceSet:[{uri:e,width:u,height:u}]}})}return d==null?e.ui.showNotification({type:`error`,message:`panel.${Q}.error`}):i.set(d,{url:n,color:s,type:a?`shape`:`fill`}),d}function Wt(e,t,n,r,i,a){let{path:o,svg:s,size:c}=Lt(r,i);if(a===`shape`){if(!t.block.supportsShape(n)){e.ui.showNotification({type:`error`,message:`panel.${$}.invalidStateShape`});return}let r=t.block.getShape(n);t.block.setString(r,`shape/vector_path/path`,o),t.block.setFloat(r,`shape/vector_path/height`,c),t.block.setFloat(r,`shape/vector_path/width`,c),Gt(t,n)}else if(a===`fill`){if(!t.block.supportsFill(n)){e.ui.showNotification({type:`error`,message:`panel.${$}.invalidStateFill`});return}let r=t.block.getFill(n),i=`data:text/plain;base64,${btoa(s)}`;t.block.setSourceSet(r,`fill/image/sourceSet`,[{uri:i,width:c,height:c}])}}function Gt(e,t){let n=e.block.duplicate(t),r=e.block.getParent(t);if(r!=null){let i=e.block.create(`graphic`);e.block.setShape(i,e.block.createShape(`//ly.img.ubq/shape/rect`)),e.block.appendChild(r,i),e.block.setPositionX(i,e.block.getPositionX(t)),e.block.setPositionY(i,e.block.getPositionY(t)),e.block.setWidth(i,e.block.getWidth(t)),e.block.setHeight(i,e.block.getHeight(t));let a=e.block.combine([n,i],`Intersection`);e.block.setShape(t,e.block.getShape(a)),e.block.destroy(a)}return t}const Kt=e=>({name:Bt,version:`1.87.0-nightly.20261104`,...Vt(e)});export{Kt as default};
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
24
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
25
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
26
|
+
* Released under MIT license <https://lodash.com/license>
|
|
27
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
28
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
29
|
+
*/
|
|
34
30
|
/**
|
|
35
31
|
* @license QR Code generator library (TypeScript)
|
|
36
32
|
* Copyright (c) Project Nayuki.
|
|
37
33
|
* SPDX-License-Identifier: MIT
|
|
38
34
|
*/
|
|
39
|
-
//# sourceMappingURL=index.mjs.map
|
|
35
|
+
//# sourceMappingURL=index.mjs.map
|