@jigowatts/jigowatts-ui 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +1,40 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { r, s as e, f as t } from "../../react.esm-BBESb8eI.js";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { r, s as e, f as n } from "../../react.esm-BBESb8eI.js";
3
3
  import { SubMenu as k } from "./index.es.js";
4
4
  describe("SubMenu component", () => {
5
5
  test("renders SubMenu component with given menu items and button element", () => {
6
6
  const o = jest.fn(), u = jest.fn(), l = jest.fn();
7
- r(/* @__PURE__ */ n(k, { menuItems: [
7
+ r(/* @__PURE__ */ t(k, { menuItems: [
8
8
  {
9
- icon: /* @__PURE__ */ n("span", { children: "Icon 1" }),
9
+ icon: /* @__PURE__ */ t("span", { children: "Icon 1" }),
10
10
  title: "Menu 1",
11
11
  onClick: o,
12
12
  closeWhenClick: !0
13
13
  },
14
14
  {
15
- icon: /* @__PURE__ */ n("span", { children: "Icon 2" }),
15
+ icon: /* @__PURE__ */ t("span", { children: "Icon 2" }),
16
16
  title: "Menu 2",
17
17
  onClick: u
18
18
  },
19
19
  {
20
- icon: /* @__PURE__ */ n("span", { children: "Icon 3" }),
20
+ icon: /* @__PURE__ */ t("span", { children: "Icon 3" }),
21
21
  title: "Menu 3",
22
22
  onClick: l,
23
23
  closeWhenClick: !1
24
24
  }
25
- ], buttonElement: /* @__PURE__ */ n("button", { children: "Menu Button" }) }));
25
+ ], buttonElement: /* @__PURE__ */ t("span", { children: "Menu Button" }) }));
26
26
  const c = e.getByText("Menu Button");
27
- t.click(c);
27
+ n.click(c);
28
28
  const i = e.getByText("Menu 1");
29
- t.click(i), expect(o).toHaveBeenCalled(), setTimeout(() => {
29
+ n.click(i), expect(o).toHaveBeenCalled(), setTimeout(() => {
30
30
  expect(e.queryByText("Menu 1")).toBeNull();
31
- }, 0), t.click(c);
31
+ }, 0), n.click(c);
32
32
  const s = e.getByText("Menu 2");
33
- t.click(s), expect(u).toHaveBeenCalled(), setTimeout(() => {
33
+ n.click(s), expect(u).toHaveBeenCalled(), setTimeout(() => {
34
34
  expect(e.queryByText("Menu 2")).toBeNull();
35
- }, 0), t.click(c);
35
+ }, 0), n.click(c);
36
36
  const m = e.getByText("Menu 3");
37
- t.click(m), expect(l).toHaveBeenCalled(), setTimeout(() => {
37
+ n.click(m), expect(l).toHaveBeenCalled(), setTimeout(() => {
38
38
  expect(e.queryByText("Menu 3")).not.toBeNull();
39
39
  }, 0);
40
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.es.js","sources":["../../../src/components/SubMenu/index.test.tsx"],"sourcesContent":["import { fireEvent, render, screen } from \"@testing-library/react\";\n\nimport { SubMenu } from \".\";\n\ndescribe(\"SubMenu component\", () => {\n test(\"renders SubMenu component with given menu items and button element\", () => {\n const mockOnClickMenu1 = jest.fn();\n const mockOnClickMenu2 = jest.fn();\n const mockOnClickMenu3 = jest.fn();\n\n const menuItems = [\n {\n icon: <span>Icon 1</span>,\n title: \"Menu 1\",\n onClick: mockOnClickMenu1,\n closeWhenClick: true,\n },\n {\n icon: <span>Icon 2</span>,\n title: \"Menu 2\",\n onClick: mockOnClickMenu2,\n },\n {\n icon: <span>Icon 3</span>,\n title: \"Menu 3\",\n onClick: mockOnClickMenu3,\n closeWhenClick: false,\n },\n ];\n\n const buttonElement = <button>Menu Button</button>;\n\n render(<SubMenu menuItems={menuItems} buttonElement={buttonElement} />);\n\n // Menu 1のテスト menuクリック時消えていること\n const button = screen.getByText(\"Menu Button\");\n fireEvent.click(button);\n const menuItem1 = screen.getByText(\"Menu 1\");\n fireEvent.click(menuItem1);\n expect(mockOnClickMenu1).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 1\")).toBeNull();\n }, 0);\n\n // Menu 2のテスト menuクリック時消えていること\n fireEvent.click(button);\n const menuItem2 = screen.getByText(\"Menu 2\");\n fireEvent.click(menuItem2);\n expect(mockOnClickMenu2).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 2\")).toBeNull();\n }, 0);\n\n // Menu 3のテスト menuクリック時消えていないこと\n fireEvent.click(button);\n const menuItem3 = screen.getByText(\"Menu 3\");\n fireEvent.click(menuItem3);\n expect(mockOnClickMenu3).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 3\")).not.toBeNull();\n }, 0);\n });\n});\n"],"names":["mockOnClickMenu1","mockOnClickMenu2","mockOnClickMenu3","render","jsx","SubMenu","button","screen","fireEvent","menuItem1","menuItem2","menuItem3"],"mappings":";;;AAIA,SAAS,qBAAqB,MAAM;AAClC,OAAK,sEAAsE,MAAM;AAC/E,UAAMA,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA;AAwB9B,IAAAC,EAAO,gBAAAC,EAACC,GAAA,EAAQ,WAtBE;AAAA,MAChB;AAAA,QACE,MAAM,gBAAAD,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASJ;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,MAElB;AAAA,QACE,MAAM,gBAAAI,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASH;AAAA,MAAA;AAAA,MAEX;AAAA,QACE,MAAM,gBAAAG,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASF;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,IAClB,GAKoC,eAFhB,gBAAAE,EAAC,UAAA,EAAO,UAAA,cAAA,CAAW,EAEH,CAA8B,CAAE;AAGtE,UAAME,IAASC,EAAO,UAAU,aAAa;AAC7C,IAAAC,EAAU,MAAMF,CAAM;AACtB,UAAMG,IAAYF,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMC,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOO,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMI,IAAYH,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAME,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOM,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMK,IAAYJ,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMG,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOK,EAAO,YAAY,QAAQ,CAAC,EAAE,IAAI,SAAA;AAAA,IAC3C,GAAG,CAAC;AAAA,EACN,CAAC;AACH,CAAC;"}
1
+ {"version":3,"file":"index.test.es.js","sources":["../../../src/components/SubMenu/index.test.tsx"],"sourcesContent":["import { fireEvent, render, screen } from \"@testing-library/react\";\n\nimport { SubMenu } from \".\";\n\ndescribe(\"SubMenu component\", () => {\n test(\"renders SubMenu component with given menu items and button element\", () => {\n const mockOnClickMenu1 = jest.fn();\n const mockOnClickMenu2 = jest.fn();\n const mockOnClickMenu3 = jest.fn();\n\n const menuItems = [\n {\n icon: <span>Icon 1</span>,\n title: \"Menu 1\",\n onClick: mockOnClickMenu1,\n closeWhenClick: true,\n },\n {\n icon: <span>Icon 2</span>,\n title: \"Menu 2\",\n onClick: mockOnClickMenu2,\n },\n {\n icon: <span>Icon 3</span>,\n title: \"Menu 3\",\n onClick: mockOnClickMenu3,\n closeWhenClick: false,\n },\n ];\n\n const buttonElement = <span>Menu Button</span>;\n\n render(<SubMenu menuItems={menuItems} buttonElement={buttonElement} />);\n\n // Menu 1のテスト menuクリック時消えていること\n const button = screen.getByText(\"Menu Button\");\n fireEvent.click(button);\n const menuItem1 = screen.getByText(\"Menu 1\");\n fireEvent.click(menuItem1);\n expect(mockOnClickMenu1).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 1\")).toBeNull();\n }, 0);\n\n // Menu 2のテスト menuクリック時消えていること\n fireEvent.click(button);\n const menuItem2 = screen.getByText(\"Menu 2\");\n fireEvent.click(menuItem2);\n expect(mockOnClickMenu2).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 2\")).toBeNull();\n }, 0);\n\n // Menu 3のテスト menuクリック時消えていないこと\n fireEvent.click(button);\n const menuItem3 = screen.getByText(\"Menu 3\");\n fireEvent.click(menuItem3);\n expect(mockOnClickMenu3).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 3\")).not.toBeNull();\n }, 0);\n });\n});\n"],"names":["mockOnClickMenu1","mockOnClickMenu2","mockOnClickMenu3","render","jsx","SubMenu","button","screen","fireEvent","menuItem1","menuItem2","menuItem3"],"mappings":";;;AAIA,SAAS,qBAAqB,MAAM;AAClC,OAAK,sEAAsE,MAAM;AAC/E,UAAMA,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA;AAwB9B,IAAAC,EAAO,gBAAAC,EAACC,GAAA,EAAQ,WAtBE;AAAA,MAChB;AAAA,QACE,MAAM,gBAAAD,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASJ;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,MAElB;AAAA,QACE,MAAM,gBAAAI,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASH;AAAA,MAAA;AAAA,MAEX;AAAA,QACE,MAAM,gBAAAG,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASF;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,IAClB,GAKoC,eAFhB,gBAAAE,EAAC,QAAA,EAAK,UAAA,cAAA,CAAW,EAED,CAA8B,CAAE;AAGtE,UAAME,IAASC,EAAO,UAAU,aAAa;AAC7C,IAAAC,EAAU,MAAMF,CAAM;AACtB,UAAMG,IAAYF,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMC,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOO,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMI,IAAYH,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAME,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOM,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMK,IAAYJ,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMG,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOK,EAAO,YAAY,QAAQ,CAAC,EAAE,IAAI,SAAA;AAAA,IAC3C,GAAG,CAAC;AAAA,EACN,CAAC;AACH,CAAC;"}
@@ -2,11 +2,11 @@
2
2
  * @license QR Code generator library (TypeScript)
3
3
  * Copyright (c) Project Nayuki.
4
4
  * SPDX-License-Identifier: MIT
5
- */var O;(u=>{const l=class m{constructor(e,o,t,n){if(this.version=e,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let r=[];for(let s=0;s<this.size;s++)r.push(!1);for(let s=0;s<this.size;s++)this.modules.push(r.slice()),this.isFunction.push(r.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(t);if(this.drawCodewords(a),n==-1){let s=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const h=this.getPenaltyScore();h<s&&(n=p,s=h),this.applyMask(p)}}g(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,o){const t=u.QrSegment.makeSegments(e);return m.encodeSegments(t,o)}static encodeBinary(e,o){const t=u.QrSegment.makeBytes(e);return m.encodeSegments([t],o)}static encodeSegments(e,o,t=1,n=40,r=-1,a=!0){if(!(m.MIN_VERSION<=t&&t<=n&&n<=m.MAX_VERSION)||r<-1||r>7)throw new RangeError("Invalid value");let s,p;for(s=t;;s++){const f=m.getNumDataCodewords(s,o)*8,M=w.getTotalBits(e,s);if(M<=f){p=M;break}if(s>=n)throw new RangeError("Data too long")}for(const f of[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH])a&&p<=m.getNumDataCodewords(s,f)*8&&(o=f);let h=[];for(const f of e){i(f.mode.modeBits,4,h),i(f.numChars,f.mode.numCharCountBits(s),h);for(const M of f.getData())h.push(M)}g(h.length==p);const x=m.getNumDataCodewords(s,o)*8;g(h.length<=x),i(0,Math.min(4,x-h.length),h),i(0,(8-h.length%8)%8,h),g(h.length%8==0);for(let f=236;h.length<x;f^=253)i(f,8,h);let v=[];for(;v.length*8<h.length;)v.push(0);return h.forEach((f,M)=>v[M>>>3]|=f<<7-(M&7)),new m(s,o,v,r)}getModule(e,o){return 0<=e&&e<this.size&&0<=o&&o<this.size&&this.modules[o][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),o=e.length;for(let t=0;t<o;t++)for(let n=0;n<o;n++)t==0&&n==0||t==0&&n==o-1||t==o-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const o=this.errorCorrectionLevel.formatBits<<3|e;let t=o;for(let r=0;r<10;r++)t=t<<1^(t>>>9)*1335;const n=(o<<10|t)^21522;g(n>>>15==0);for(let r=0;r<=5;r++)this.setFunctionModule(8,r,c(n,r));this.setFunctionModule(8,7,c(n,6)),this.setFunctionModule(8,8,c(n,7)),this.setFunctionModule(7,8,c(n,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,c(n,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,c(n,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,c(n,r));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;const o=this.version<<12|e;g(o>>>18==0);for(let t=0;t<18;t++){const n=c(o,t),r=this.size-11+t%3,a=Math.floor(t/3);this.setFunctionModule(r,a,n),this.setFunctionModule(a,r,n)}}drawFinderPattern(e,o){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const r=Math.max(Math.abs(n),Math.abs(t)),a=e+n,s=o+t;0<=a&&a<this.size&&0<=s&&s<this.size&&this.setFunctionModule(a,s,r!=2&&r!=4)}}drawAlignmentPattern(e,o){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,o+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,o,t){this.modules[o][e]=t,this.isFunction[o][e]=!0}addEccAndInterleave(e){const o=this.version,t=this.errorCorrectionLevel;if(e.length!=m.getNumDataCodewords(o,t))throw new RangeError("Invalid argument");const n=m.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o],r=m.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o],a=Math.floor(m.getNumRawDataModules(o)/8),s=n-a%n,p=Math.floor(a/n);let h=[];const x=m.reedSolomonComputeDivisor(r);for(let f=0,M=0;f<n;f++){let P=e.slice(M,M+p-r+(f<s?0:1));M+=P.length;const _=m.reedSolomonComputeRemainder(P,x);f<s&&P.push(0),h.push(P.concat(_))}let v=[];for(let f=0;f<h[0].length;f++)h.forEach((M,P)=>{(f!=p-r||P>=s)&&v.push(M[f])});return g(v.length==a),v}drawCodewords(e){if(e.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let r=0;r<2;r++){const a=t-r,p=(t+1&2)==0?this.size-1-n:n;!this.isFunction[p][a]&&o<e.length*8&&(this.modules[p][a]=c(e[o>>>3],7-(o&7)),o++)}}g(o==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+o)%2==0;break;case 1:n=o%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+o)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(o/2))%2==0;break;case 5:n=t*o%2+t*o%3==0;break;case 6:n=(t*o%2+t*o%3)%2==0;break;case 7:n=((t+o)%2+t*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][t]&&n&&(this.modules[o][t]=!this.modules[o][t])}}getPenaltyScore(){let e=0;for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[r][h]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[r][h],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][r]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[h][r],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size-1;r++)for(let a=0;a<this.size-1;a++){const s=this.modules[r][a];s==this.modules[r][a+1]&&s==this.modules[r+1][a]&&s==this.modules[r+1][a+1]&&(e+=m.PENALTY_N2)}let o=0;for(const r of this.modules)o=r.reduce((a,s)=>a+(s?1:0),o);const t=this.size*this.size,n=Math.ceil(Math.abs(o*20-t*10)/t)-1;return g(0<=n&&n<=9),e+=n*m.PENALTY_N4,g(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let n=this.size-7;t.length<e;n-=o)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;o-=(25*t-10)*t-55,e>=7&&(o-=36)}return g(208<=o&&o<=29648),o}static getNumDataCodewords(e,o){return Math.floor(m.getNumRawDataModules(e)/8)-m.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e]*m.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let o=[];for(let n=0;n<e-1;n++)o.push(0);o.push(1);let t=1;for(let n=0;n<e;n++){for(let r=0;r<o.length;r++)o[r]=m.reedSolomonMultiply(o[r],t),r+1<o.length&&(o[r]^=o[r+1]);t=m.reedSolomonMultiply(t,2)}return o}static reedSolomonComputeRemainder(e,o){let t=o.map(n=>0);for(const n of e){const r=n^t.shift();t.push(0),o.forEach((a,s)=>t[s]^=m.reedSolomonMultiply(a,r))}return t}static reedSolomonMultiply(e,o){if(e>>>8||o>>>8)throw new RangeError("Byte out of range");let t=0;for(let n=7;n>=0;n--)t=t<<1^(t>>>7)*285,t^=(o>>>n&1)*e;return g(t>>>8==0),t}finderPenaltyCountPatterns(e){const o=e[1];g(o<=this.size*3);const t=o>0&&e[2]==o&&e[3]==o*3&&e[4]==o&&e[5]==o;return(t&&e[0]>=o*4&&e[6]>=o?1:0)+(t&&e[6]>=o*4&&e[0]>=o?1:0)}finderPenaltyTerminateAndCount(e,o,t){return e&&(this.finderPenaltyAddHistory(o,t),o=0),o+=this.size,this.finderPenaltyAddHistory(o,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,o){o[0]==0&&(e+=this.size),o.pop(),o.unshift(e)}};l.MIN_VERSION=1,l.MAX_VERSION=40,l.PENALTY_N1=3,l.PENALTY_N2=3,l.PENALTY_N3=40,l.PENALTY_N4=10,l.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]],l.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=l;function i(C,e,o){if(e<0||e>31||C>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)o.push(C>>>t&1)}function c(C,e){return(C>>>e&1)!=0}function g(C){if(!C)throw new Error("Assertion error")}const d=class R{constructor(e,o,t){if(this.mode=e,this.numChars=o,this.bitData=t,o<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let o=[];for(const t of e)i(t,8,o);return new R(R.Mode.BYTE,e.length,o)}static makeNumeric(e){if(!R.isNumeric(e))throw new RangeError("String contains non-numeric characters");let o=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);i(parseInt(e.substring(t,t+n),10),n*3+1,o),t+=n}return new R(R.Mode.NUMERIC,e.length,o)}static makeAlphanumeric(e){if(!R.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],t;for(t=0;t+2<=e.length;t+=2){let n=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),i(n,11,o)}return t<e.length&&i(R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,o),new R(R.Mode.ALPHANUMERIC,e.length,o)}static makeSegments(e){return e==""?[]:R.isNumeric(e)?[R.makeNumeric(e)]:R.isAlphanumeric(e)?[R.makeAlphanumeric(e)]:[R.makeBytes(R.toUtf8ByteArray(e))]}static makeEci(e){let o=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)i(e,8,o);else if(e<16384)i(2,2,o),i(e,14,o);else if(e<1e6)i(6,3,o),i(e,21,o);else throw new RangeError("ECI assignment value out of range");return new R(R.Mode.ECI,0,o)}static isNumeric(e){return R.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return R.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,o){let t=0;for(const n of e){const r=n.mode.numCharCountBits(o);if(n.numChars>=1<<r)return 1/0;t+=4+r+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let o=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?o.push(e.charCodeAt(t)):(o.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return o}};d.NUMERIC_REGEX=/^[0-9]*$/,d.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,d.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let w=d;u.QrSegment=d})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.ordinal=g,this.formatBits=d}};i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),l.Ecc=i})(u.QrCode||(u.QrCode={}))})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.modeBits=g,this.numBitsCharCount=d}numCharCountBits(g){return this.numBitsCharCount[Math.floor((g+7)/17)]}};i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),l.Mode=i})(u.QrSegment||(u.QrSegment={}))})(O||(O={}));var L=O;/**
5
+ */var O;(u=>{const l=class m{constructor(e,o,t,n){if(this.version=e,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let r=[];for(let s=0;s<this.size;s++)r.push(!1);for(let s=0;s<this.size;s++)this.modules.push(r.slice()),this.isFunction.push(r.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(t);if(this.drawCodewords(a),n==-1){let s=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const h=this.getPenaltyScore();h<s&&(n=p,s=h),this.applyMask(p)}}g(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,o){const t=u.QrSegment.makeSegments(e);return m.encodeSegments(t,o)}static encodeBinary(e,o){const t=u.QrSegment.makeBytes(e);return m.encodeSegments([t],o)}static encodeSegments(e,o,t=1,n=40,r=-1,a=!0){if(!(m.MIN_VERSION<=t&&t<=n&&n<=m.MAX_VERSION)||r<-1||r>7)throw new RangeError("Invalid value");let s,p;for(s=t;;s++){const f=m.getNumDataCodewords(s,o)*8,M=w.getTotalBits(e,s);if(M<=f){p=M;break}if(s>=n)throw new RangeError("Data too long")}for(const f of[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH])a&&p<=m.getNumDataCodewords(s,f)*8&&(o=f);let h=[];for(const f of e){i(f.mode.modeBits,4,h),i(f.numChars,f.mode.numCharCountBits(s),h);for(const M of f.getData())h.push(M)}g(h.length==p);const x=m.getNumDataCodewords(s,o)*8;g(h.length<=x),i(0,Math.min(4,x-h.length),h),i(0,(8-h.length%8)%8,h),g(h.length%8==0);for(let f=236;h.length<x;f^=253)i(f,8,h);let v=[];for(;v.length*8<h.length;)v.push(0);return h.forEach((f,M)=>v[M>>>3]|=f<<7-(M&7)),new m(s,o,v,r)}getModule(e,o){return 0<=e&&e<this.size&&0<=o&&o<this.size&&this.modules[o][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),o=e.length;for(let t=0;t<o;t++)for(let n=0;n<o;n++)t==0&&n==0||t==0&&n==o-1||t==o-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const o=this.errorCorrectionLevel.formatBits<<3|e;let t=o;for(let r=0;r<10;r++)t=t<<1^(t>>>9)*1335;const n=(o<<10|t)^21522;g(n>>>15==0);for(let r=0;r<=5;r++)this.setFunctionModule(8,r,c(n,r));this.setFunctionModule(8,7,c(n,6)),this.setFunctionModule(8,8,c(n,7)),this.setFunctionModule(7,8,c(n,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,c(n,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,c(n,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,c(n,r));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;const o=this.version<<12|e;g(o>>>18==0);for(let t=0;t<18;t++){const n=c(o,t),r=this.size-11+t%3,a=Math.floor(t/3);this.setFunctionModule(r,a,n),this.setFunctionModule(a,r,n)}}drawFinderPattern(e,o){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const r=Math.max(Math.abs(n),Math.abs(t)),a=e+n,s=o+t;0<=a&&a<this.size&&0<=s&&s<this.size&&this.setFunctionModule(a,s,r!=2&&r!=4)}}drawAlignmentPattern(e,o){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,o+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,o,t){this.modules[o][e]=t,this.isFunction[o][e]=!0}addEccAndInterleave(e){const o=this.version,t=this.errorCorrectionLevel;if(e.length!=m.getNumDataCodewords(o,t))throw new RangeError("Invalid argument");const n=m.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o],r=m.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o],a=Math.floor(m.getNumRawDataModules(o)/8),s=n-a%n,p=Math.floor(a/n);let h=[];const x=m.reedSolomonComputeDivisor(r);for(let f=0,M=0;f<n;f++){let P=e.slice(M,M+p-r+(f<s?0:1));M+=P.length;const _=m.reedSolomonComputeRemainder(P,x);f<s&&P.push(0),h.push(P.concat(_))}let v=[];for(let f=0;f<h[0].length;f++)h.forEach((M,P)=>{(f!=p-r||P>=s)&&v.push(M[f])});return g(v.length==a),v}drawCodewords(e){if(e.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let r=0;r<2;r++){const a=t-r,p=(t+1&2)==0?this.size-1-n:n;!this.isFunction[p][a]&&o<e.length*8&&(this.modules[p][a]=c(e[o>>>3],7-(o&7)),o++)}}g(o==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+o)%2==0;break;case 1:n=o%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+o)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(o/2))%2==0;break;case 5:n=t*o%2+t*o%3==0;break;case 6:n=(t*o%2+t*o%3)%2==0;break;case 7:n=((t+o)%2+t*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][t]&&n&&(this.modules[o][t]=!this.modules[o][t])}}getPenaltyScore(){let e=0;for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[r][h]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[r][h],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][r]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[h][r],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size-1;r++)for(let a=0;a<this.size-1;a++){const s=this.modules[r][a];s==this.modules[r][a+1]&&s==this.modules[r+1][a]&&s==this.modules[r+1][a+1]&&(e+=m.PENALTY_N2)}let o=0;for(const r of this.modules)o=r.reduce((a,s)=>a+(s?1:0),o);const t=this.size*this.size,n=Math.ceil(Math.abs(o*20-t*10)/t)-1;return g(0<=n&&n<=9),e+=n*m.PENALTY_N4,g(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let n=this.size-7;t.length<e;n-=o)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;o-=(25*t-10)*t-55,e>=7&&(o-=36)}return g(208<=o&&o<=29648),o}static getNumDataCodewords(e,o){return Math.floor(m.getNumRawDataModules(e)/8)-m.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e]*m.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let o=[];for(let n=0;n<e-1;n++)o.push(0);o.push(1);let t=1;for(let n=0;n<e;n++){for(let r=0;r<o.length;r++)o[r]=m.reedSolomonMultiply(o[r],t),r+1<o.length&&(o[r]^=o[r+1]);t=m.reedSolomonMultiply(t,2)}return o}static reedSolomonComputeRemainder(e,o){let t=o.map(n=>0);for(const n of e){const r=n^t.shift();t.push(0),o.forEach((a,s)=>t[s]^=m.reedSolomonMultiply(a,r))}return t}static reedSolomonMultiply(e,o){if(e>>>8||o>>>8)throw new RangeError("Byte out of range");let t=0;for(let n=7;n>=0;n--)t=t<<1^(t>>>7)*285,t^=(o>>>n&1)*e;return g(t>>>8==0),t}finderPenaltyCountPatterns(e){const o=e[1];g(o<=this.size*3);const t=o>0&&e[2]==o&&e[3]==o*3&&e[4]==o&&e[5]==o;return(t&&e[0]>=o*4&&e[6]>=o?1:0)+(t&&e[6]>=o*4&&e[0]>=o?1:0)}finderPenaltyTerminateAndCount(e,o,t){return e&&(this.finderPenaltyAddHistory(o,t),o=0),o+=this.size,this.finderPenaltyAddHistory(o,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,o){o[0]==0&&(e+=this.size),o.pop(),o.unshift(e)}};l.MIN_VERSION=1,l.MAX_VERSION=40,l.PENALTY_N1=3,l.PENALTY_N2=3,l.PENALTY_N3=40,l.PENALTY_N4=10,l.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]],l.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=l;function i(C,e,o){if(e<0||e>31||C>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)o.push(C>>>t&1)}function c(C,e){return(C>>>e&1)!=0}function g(C){if(!C)throw new Error("Assertion error")}const d=class R{constructor(e,o,t){if(this.mode=e,this.numChars=o,this.bitData=t,o<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let o=[];for(const t of e)i(t,8,o);return new R(R.Mode.BYTE,e.length,o)}static makeNumeric(e){if(!R.isNumeric(e))throw new RangeError("String contains non-numeric characters");let o=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);i(parseInt(e.substring(t,t+n),10),n*3+1,o),t+=n}return new R(R.Mode.NUMERIC,e.length,o)}static makeAlphanumeric(e){if(!R.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],t;for(t=0;t+2<=e.length;t+=2){let n=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),i(n,11,o)}return t<e.length&&i(R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,o),new R(R.Mode.ALPHANUMERIC,e.length,o)}static makeSegments(e){return e==""?[]:R.isNumeric(e)?[R.makeNumeric(e)]:R.isAlphanumeric(e)?[R.makeAlphanumeric(e)]:[R.makeBytes(R.toUtf8ByteArray(e))]}static makeEci(e){let o=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)i(e,8,o);else if(e<16384)i(2,2,o),i(e,14,o);else if(e<1e6)i(6,3,o),i(e,21,o);else throw new RangeError("ECI assignment value out of range");return new R(R.Mode.ECI,0,o)}static isNumeric(e){return R.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return R.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,o){let t=0;for(const n of e){const r=n.mode.numCharCountBits(o);if(n.numChars>=1<<r)return 1/0;t+=4+r+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let o=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?o.push(e.charCodeAt(t)):(o.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return o}};d.NUMERIC_REGEX=/^[0-9]*$/,d.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,d.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let w=d;u.QrSegment=d})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.ordinal=g,this.formatBits=d}};i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),l.Ecc=i})(u.QrCode||(u.QrCode={}))})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.modeBits=g,this.numBitsCharCount=d}numCharCountBits(g){return this.numBitsCharCount[Math.floor((g+7)/17)]}};i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),l.Mode=i})(u.QrSegment||(u.QrSegment={}))})(O||(O={}));var B=O;/**
6
6
  * @license qrcode.react
7
7
  * Copyright (c) Paul O'Shannessy
8
8
  * SPDX-License-Identifier: ISC
9
- */var Ee={L:L.QrCode.Ecc.LOW,M:L.QrCode.Ecc.MEDIUM,Q:L.QrCode.Ecc.QUARTILE,H:L.QrCode.Ecc.HIGH},J=128,ee="L",te="#FFFFFF",oe="#000000",ne=!1,re=1,Ce=4,ye=0,we=.1;function ie(u,l=0){const i=[];return u.forEach(function(c,g){let d=null;c.forEach(function(w,C){if(!w&&d!==null){i.push(`M${d+l} ${g+l}h${C-d}v1H${d+l}z`),d=null;return}if(C===c.length-1){if(!w)return;d===null?i.push(`M${C+l},${g+l} h1v1H${C+l}z`):i.push(`M${d+l},${g+l} h${C+1-d}v1H${d+l}z`);return}w&&d===null&&(d=C)})}),i.join("")}function se(u,l){return u.slice().map((i,c)=>c<l.y||c>=l.y+l.h?i:i.map((g,d)=>d<l.x||d>=l.x+l.w?g:!1))}function Me(u,l,i,c){if(c==null)return null;const g=u.length+i*2,d=Math.floor(l*we),w=g/l,C=(c.width||d)*w,e=(c.height||d)*w,o=c.x==null?u.length/2-C/2:c.x*w,t=c.y==null?u.length/2-e/2:c.y*w,n=c.opacity==null?1:c.opacity;let r=null;if(c.excavate){let s=Math.floor(o),p=Math.floor(t),h=Math.ceil(C+o-s),x=Math.ceil(e+t-p);r={x:s,y:p,w:h,h:x}}const a=c.crossOrigin;return{x:o,y:t,h:e,w:C,excavation:r,opacity:n,crossOrigin:a}}function be(u,l){return l!=null?Math.max(Math.floor(l),0):u?Ce:ye}function le({value:u,level:l,minVersion:i,includeMargin:c,marginSize:g,imageSettings:d,size:w,boostLevel:C}){let e=y.useMemo(()=>{const s=(Array.isArray(u)?u:[u]).reduce((p,h)=>(p.push(...L.QrSegment.makeSegments(h)),p),[]);return L.QrCode.encodeSegments(s,Ee[l],i,void 0,void 0,C)},[u,l,i,C]);const{cells:o,margin:t,numCells:n,calculatedImageSettings:r}=y.useMemo(()=>{let a=e.getModules();const s=be(c,g),p=a.length+s*2,h=Me(a,w,s,d);return{cells:a,margin:s,numCells:p,calculatedImageSettings:h}},[e,w,d,c,g]);return{qrcode:e,margin:t,cells:o,numCells:n,calculatedImageSettings:r}}var Re=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ve=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,marginSize:r,imageSettings:a}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:h}=p,x=H(p,["style"]),v=a==null?void 0:a.src,f=y.useRef(null),M=y.useRef(null),P=y.useCallback(A=>{f.current=A,typeof i=="function"?i(A):i&&(i.current=A)},[i]),[_,k]=y.useState(!1),{margin:N,cells:B,numCells:D,calculatedImageSettings:S}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:r,imageSettings:a,size:d});y.useEffect(()=>{if(f.current!=null){const A=f.current,I=A.getContext("2d");if(!I)return;let $=B;const F=M.current,G=S!=null&&F!==null&&F.complete&&F.naturalHeight!==0&&F.naturalWidth!==0;G&&S.excavation!=null&&($=se(B,S.excavation));const V=window.devicePixelRatio||1;A.height=A.width=d*V;const Y=d/D*V;I.scale(Y,Y),I.fillStyle=C,I.fillRect(0,0,D,D),I.fillStyle=e,Re?I.fill(new Path2D(ie($,N))):B.forEach(function(ce,ue){ce.forEach(function(he,de){he&&I.fillRect(de+N,ue+N,1,1)})}),S&&(I.globalAlpha=S.opacity),G&&I.drawImage(F,S.x+N,S.y+N,S.w,S.h)}}),y.useEffect(()=>{k(!1)},[v]);const z=Q({height:d,width:d},h);let T=null;return v!=null&&(T=y.createElement("img",{src:v,key:v,style:{display:"none"},onLoad:()=>{k(!0)},ref:M,crossOrigin:S==null?void 0:S.crossOrigin})),y.createElement(y.Fragment,null,y.createElement("canvas",Q({style:z,height:d,width:d,ref:P,role:"img"},x)),T)});ve.displayName="QRCodeCanvas";var ae=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,title:r,marginSize:a,imageSettings:s}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:h,cells:x,numCells:v,calculatedImageSettings:f}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:a,imageSettings:s,size:d});let M=x,P=null;s!=null&&f!=null&&(f.excavation!=null&&(M=se(x,f.excavation)),P=y.createElement("image",{href:s.src,height:f.h,width:f.w,x:f.x+h,y:f.y+h,preserveAspectRatio:"none",opacity:f.opacity,crossOrigin:f.crossOrigin}));const _=ie(M,h);return y.createElement("svg",Q({height:d,width:d,viewBox:`0 0 ${v} ${v}`,ref:i,role:"img"},p),!!r&&y.createElement("title",null,r),y.createElement("path",{fill:C,d:`M0,0 h${v}v${v}H0z`,shapeRendering:"crispEdges"}),y.createElement("path",{fill:e,d:_,shapeRendering:"crispEdges"}),P)});ae.displayName="QRCodeSVG";const Ae={dialog_title:"2要素認証の設定",step1:"手順1",auth_app:"認証アプリ",step1_description:"を携帯電話で開き、QRコードをスキャンします (QRコードの下にあるシークレットキーを認証アプリに手動で入力してもかまいません)。",help_dialog_title:"認証アプリについて",help_dialog_description:`
9
+ */var Ee={L:B.QrCode.Ecc.LOW,M:B.QrCode.Ecc.MEDIUM,Q:B.QrCode.Ecc.QUARTILE,H:B.QrCode.Ecc.HIGH},J=128,ee="L",te="#FFFFFF",oe="#000000",ne=!1,re=1,Ce=4,ye=0,we=.1;function ie(u,l=0){const i=[];return u.forEach(function(c,g){let d=null;c.forEach(function(w,C){if(!w&&d!==null){i.push(`M${d+l} ${g+l}h${C-d}v1H${d+l}z`),d=null;return}if(C===c.length-1){if(!w)return;d===null?i.push(`M${C+l},${g+l} h1v1H${C+l}z`):i.push(`M${d+l},${g+l} h${C+1-d}v1H${d+l}z`);return}w&&d===null&&(d=C)})}),i.join("")}function se(u,l){return u.slice().map((i,c)=>c<l.y||c>=l.y+l.h?i:i.map((g,d)=>d<l.x||d>=l.x+l.w?g:!1))}function Me(u,l,i,c){if(c==null)return null;const g=u.length+i*2,d=Math.floor(l*we),w=g/l,C=(c.width||d)*w,e=(c.height||d)*w,o=c.x==null?u.length/2-C/2:c.x*w,t=c.y==null?u.length/2-e/2:c.y*w,n=c.opacity==null?1:c.opacity;let r=null;if(c.excavate){let s=Math.floor(o),p=Math.floor(t),h=Math.ceil(C+o-s),x=Math.ceil(e+t-p);r={x:s,y:p,w:h,h:x}}const a=c.crossOrigin;return{x:o,y:t,h:e,w:C,excavation:r,opacity:n,crossOrigin:a}}function be(u,l){return l!=null?Math.max(Math.floor(l),0):u?Ce:ye}function le({value:u,level:l,minVersion:i,includeMargin:c,marginSize:g,imageSettings:d,size:w,boostLevel:C}){let e=y.useMemo(()=>{const s=(Array.isArray(u)?u:[u]).reduce((p,h)=>(p.push(...B.QrSegment.makeSegments(h)),p),[]);return B.QrCode.encodeSegments(s,Ee[l],i,void 0,void 0,C)},[u,l,i,C]);const{cells:o,margin:t,numCells:n,calculatedImageSettings:r}=y.useMemo(()=>{let a=e.getModules();const s=be(c,g),p=a.length+s*2,h=Me(a,w,s,d);return{cells:a,margin:s,numCells:p,calculatedImageSettings:h}},[e,w,d,c,g]);return{qrcode:e,margin:t,cells:o,numCells:n,calculatedImageSettings:r}}var Re=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ve=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,marginSize:r,imageSettings:a}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:h}=p,x=H(p,["style"]),v=a==null?void 0:a.src,f=y.useRef(null),M=y.useRef(null),P=y.useCallback(A=>{f.current=A,typeof i=="function"?i(A):i&&(i.current=A)},[i]),[_,k]=y.useState(!1),{margin:N,cells:L,numCells:D,calculatedImageSettings:S}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:r,imageSettings:a,size:d});y.useEffect(()=>{if(f.current!=null){const A=f.current,I=A.getContext("2d");if(!I)return;let $=L;const F=M.current,G=S!=null&&F!==null&&F.complete&&F.naturalHeight!==0&&F.naturalWidth!==0;G&&S.excavation!=null&&($=se(L,S.excavation));const V=window.devicePixelRatio||1;A.height=A.width=d*V;const Y=d/D*V;I.scale(Y,Y),I.fillStyle=C,I.fillRect(0,0,D,D),I.fillStyle=e,Re?I.fill(new Path2D(ie($,N))):L.forEach(function(ce,ue){ce.forEach(function(he,de){he&&I.fillRect(de+N,ue+N,1,1)})}),S&&(I.globalAlpha=S.opacity),G&&I.drawImage(F,S.x+N,S.y+N,S.w,S.h)}}),y.useEffect(()=>{k(!1)},[v]);const z=Q({height:d,width:d},h);let T=null;return v!=null&&(T=y.createElement("img",{src:v,key:v,style:{display:"none"},onLoad:()=>{k(!0)},ref:M,crossOrigin:S==null?void 0:S.crossOrigin})),y.createElement(y.Fragment,null,y.createElement("canvas",Q({style:z,height:d,width:d,ref:P,role:"img"},x)),T)});ve.displayName="QRCodeCanvas";var ae=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,title:r,marginSize:a,imageSettings:s}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:h,cells:x,numCells:v,calculatedImageSettings:f}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:a,imageSettings:s,size:d});let M=x,P=null;s!=null&&f!=null&&(f.excavation!=null&&(M=se(x,f.excavation)),P=y.createElement("image",{href:s.src,height:f.h,width:f.w,x:f.x+h,y:f.y+h,preserveAspectRatio:"none",opacity:f.opacity,crossOrigin:f.crossOrigin}));const _=ie(M,h);return y.createElement("svg",Q({height:d,width:d,viewBox:`0 0 ${v} ${v}`,ref:i,role:"img"},p),!!r&&y.createElement("title",null,r),y.createElement("path",{fill:C,d:`M0,0 h${v}v${v}H0z`,shapeRendering:"crispEdges"}),y.createElement("path",{fill:e,d:_,shapeRendering:"crispEdges"}),P)});ae.displayName="QRCodeSVG";const Ae={dialog_title:"2要素認証の設定",step1:"手順1",auth_app:"認証アプリ",step1_description:"を携帯電話で開き、QRコードをスキャンします (QRコードの下にあるシークレットキーを認証アプリに手動で入力してもかまいません)。",help_dialog_title:"認証アプリについて",help_dialog_description:`
10
10
  お使いの携帯電話を用いて追加の認証を行います。
11
11
  2段階の認証を行うことで、セキュリティを高めることができます。
12
12
 
@@ -15,5 +15,5 @@
15
15
 
16
16
  使えるアプリ: Google Authenticatorや Microsoft Authenticator、Authy 等
17
17
  アプリのインストール方法は、各アプリの公式サイトをご確認ください。`,step2:"手順2",step2_description:"認証アプリに表示されている6桁のコードを入力してください。(30秒ごとに更新されるため、最新のコードをご入力ください)。",skip_note:"※スキップした場合、後から設定より変更可能です。",close:"閉じる",skip:"スキップする",cancel:"戻る",submit:"送信",two_fa_complete:"2要素認証設定の完了",backup_code_info:"バックアップコードについて",backup_code_description:`携帯電話の紛失時や、機種変更時には以下のバックアップコードを使用することでログイン可能です。各コードは1度しか使用することはできませんが。万が一に備えて、これらのコードをすぐに使える安全な場所に保管しておいてください。
18
- (1度しか表示されません)`},xe=u=>{var z;const{open:l,qrUrl:i,secretKey:c,onCloseDialog:g,onSubmit:d,showSkipButton:w=!1,dictionary:C}=u,e={...Ae,...C},{control:o,handleSubmit:t,reset:n,setError:r,watch:a,formState:{errors:s}}=fe.useForm({defaultValues:{code:Array(6).fill("")},mode:"onSubmit"}),[p,h]=y.useState(!1),[x,v]=y.useState(""),[f,M]=y.useState(!1),[P,_]=y.useState(!1),k=T=>{r("root.server",{type:"serverError",message:T})};y.useEffect(()=>{l&&(n({code:Array(6).fill("")}),h(!1),M(!1))},[l,n]);const N=y.useCallback(async()=>{const T=a("code").join("");M(!0);try{const A=await d(T);A!==void 0&&A!==""&&(v(A),h(!0))}catch(A){n({code:Array(6).fill("")}),k(A instanceof Error?A.message:"予期せぬエラーが発生しました")}finally{M(!1)}},[d,n,a]),B=y.useCallback((T,A)=>{(w||f)&&A==="backdropClick"||g("cancel")},[w,f,g]),D=()=>{_(!0)},S=()=>{_(!1)};return E.jsxs(b.Dialog,{open:l,onClose:B,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[E.jsx(b.DialogTitle,{id:"scroll-dialog-title",children:e.dialog_title}),E.jsxs("form",{onSubmit:t(N),children:[E.jsx(b.DialogContent,{dividers:!0,children:p?E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto",textAlign:"center"},children:[E.jsx(W.CheckCircleOutline,{color:"success",sx:{fontSize:100}}),E.jsx(b.Typography,{variant:"h6",children:e.two_fa_complete}),E.jsx(b.Divider,{sx:{margin:"16px 0"}}),E.jsx(b.Typography,{variant:"h6",children:e.backup_code_info}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px",whiteSpace:"pre-line"},children:e.backup_code_description}),E.jsx(X.CopyableBox,{text:x})]}):E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto"},children:[E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step1}),E.jsxs(b.Typography,{"data-testid":"step1-description",variant:"body2",align:"left",sx:{marginTop:"8px"},children:[E.jsx(b.Link,{component:"button",variant:"body2",type:"button",onClick:D,children:e.auth_app}),E.jsx(b.IconButton,{"aria-label":"help",size:"small",type:"button",onClick:D,sx:{padding:0},children:E.jsx(W.HelpOutline,{fontSize:"inherit",color:"action"})}),e.step1_description]}),E.jsxs(b.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",margin:"16px 0",padding:"16px",border:"1px solid rgba(0, 0, 0, 0.12)",borderRadius:"8px",wordBreak:"break-word"},children:[E.jsx(ae,{value:i}),E.jsxs(b.Typography,{variant:"body2",sx:{marginTop:"16px"},children:[c,E.jsx(X.CopyIcon,{text:c})]})]}),E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step2}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px"},children:e.step2_description}),E.jsxs(b.Box,{sx:{padding:"16px 0"},children:[E.jsxs(b.Box,{mb:2,children:[E.jsx(ge.TwoFaInputController,{control:o,name:"code",defaultValue:Array(6).fill(""),onSubmit:t(N),errors:s}),((z=s.root)==null?void 0:z.server)&&E.jsx(b.Typography,{variant:"body2",color:"error",align:"center",marginTop:"5px",children:s.root.server.message})]}),w&&E.jsx(b.Typography,{variant:"caption",align:"center",display:"block",color:"textSecondary",sx:{marginTop:"10px"},children:e.skip_note})]})]})}),E.jsxs(b.DialogActions,{children:[E.jsx(U.Button,{type:"button",color:"normal",disabled:f,onClick:()=>g(p?"cancel":w?"skip":"cancel"),children:p?e.close:w?e.skip:e.cancel}),!p&&E.jsx(U.Button,{type:"submit",variant:"contained",color:"primary",sx:{marginLeft:"8px"},disabled:f,children:e.submit})]})]}),E.jsx(pe.ScrollableDialog,{open:P,onCloseDialog:S,dialogTitle:e.help_dialog_title,dialogContent:E.jsx(b.Typography,{variant:"body1",id:"help-dialog-description",sx:{whiteSpace:"pre-line"},children:e.help_dialog_description}),dialogActions:E.jsx(U.Button,{onClick:S,color:"primary",children:e.close})})]})};exports.TwoFaDialog=xe;
18
+ (1度しか表示されません)`},xe=u=>{var z;const{open:l,qrUrl:i,secretKey:c,onCloseDialog:g,onSubmit:d,showSkipButton:w=!1,dictionary:C}=u,e={...Ae,...C},{control:o,handleSubmit:t,reset:n,setError:r,watch:a,formState:{errors:s}}=fe.useForm({defaultValues:{code:Array(6).fill("")},mode:"onSubmit"}),[p,h]=y.useState(!1),[x,v]=y.useState(""),[f,M]=y.useState(!1),[P,_]=y.useState(!1),k=T=>{r("root.server",{type:"serverError",message:T})};y.useEffect(()=>{l&&(n({code:Array(6).fill("")}),h(!1),M(!1))},[l,n]);const N=y.useCallback(async()=>{const T=a("code").join("");M(!0);try{const A=await d(T);A!==void 0&&A!==""&&(v(A),h(!0))}catch(A){n({code:Array(6).fill("")}),k(A instanceof Error?A.message:"予期せぬエラーが発生しました")}finally{M(!1)}},[d,n,a]),L=y.useCallback((T,A)=>{(w||f)&&A==="backdropClick"||g("cancel")},[w,f,g]),D=()=>{_(!0)},S=()=>{_(!1)};return E.jsxs(b.Dialog,{open:l,onClose:L,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[E.jsx(b.DialogTitle,{id:"scroll-dialog-title",children:e.dialog_title}),E.jsxs("form",{onSubmit:t(N),children:[E.jsx(b.DialogContent,{dividers:!0,children:p?E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto",textAlign:"center"},children:[E.jsx(W.CheckCircleOutline,{color:"success",sx:{fontSize:100}}),E.jsx(b.Typography,{variant:"h6",children:e.two_fa_complete}),E.jsx(b.Divider,{sx:{margin:"16px 0"}}),E.jsx(b.Typography,{variant:"h6",children:e.backup_code_info}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px",whiteSpace:"pre-line"},children:e.backup_code_description}),E.jsx(X.CopyableBox,{text:x})]}):E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto"},children:[E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step1}),E.jsxs(b.Typography,{"data-testid":"step1-description",variant:"body2",align:"left",sx:{marginTop:"8px"},children:[E.jsx(b.Link,{component:"button",variant:"body2",type:"button",onClick:D,children:e.auth_app}),E.jsx(b.IconButton,{"aria-label":"help",size:"small",type:"button",onClick:D,sx:{padding:0},children:E.jsx(W.HelpOutline,{fontSize:"inherit",color:"action"})}),e.step1_description]}),E.jsxs(b.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",margin:"16px 0",padding:"16px",border:"1px solid rgba(0, 0, 0, 0.12)",borderRadius:"8px",wordBreak:"break-word"},children:[E.jsx(ae,{value:i}),E.jsxs(b.Typography,{variant:"body2",sx:{marginTop:"16px"},children:[c,E.jsx(X.CopyIcon,{text:c})]})]}),E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step2}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px"},children:e.step2_description}),E.jsxs(b.Box,{sx:{padding:"16px 0"},children:[E.jsxs(b.Box,{mb:2,children:[E.jsx(ge.TwoFaInputController,{control:o,name:"code",defaultValue:Array(6).fill(""),onSubmit:t(N),errors:s}),((z=s.root)==null?void 0:z.server)&&E.jsx(b.Typography,{variant:"body2",color:"error",align:"center",marginTop:"5px",children:s.root.server.message})]}),w&&E.jsx(b.Typography,{variant:"caption",align:"center",display:"block",color:"textSecondary",sx:{marginTop:"10px"},children:e.skip_note})]})]})}),E.jsxs(b.DialogActions,{children:[E.jsx(U.Button,{type:"button",color:"normal",disabled:f,onClick:()=>g(p?"cancel":w?"skip":"cancel"),children:p?e.close:w?e.skip:e.cancel}),!p&&E.jsx(U.Button,{type:"submit",variant:"contained",color:"primary",sx:{marginLeft:"8px"},disabled:f,children:e.submit})]})]}),E.jsx(pe.ScrollableDialog,{open:P,onCloseDialog:S,dialogTitle:e.help_dialog_title,dialogContent:E.jsx(b.Box,{component:"div",id:"help-dialog-description",sx:{whiteSpace:"pre-line"},children:e.help_dialog_description}),dialogActions:E.jsx(U.Button,{onClick:S,color:"primary",children:e.close})})]})};exports.TwoFaDialog=xe;
19
19
  //# sourceMappingURL=index.cjs.js.map