PageSourceSearch

https://zugutfuerdietonne.app/assets/group-fwd.109da231.js

js zugutfuerdietonne.app collected 2026-09-24 10:48:17 UTC 373,748 bytes, 21 lines download raw bytes

1import{y as st,A as Z,B as tt,I as Pt,U as B,_ as K,Q as Ji,E as ne,u as L,F as oe,r as pe,q as xn,f as vn,Y as br,a8 as fi,a9 as di,J as it,O as qr,C as Qr,a0 as Jr,aa as On,ae as Sr,T as $i,af as es,a7 as ts}from"./pages-error.1aae2637.js";import{A as It,r as Jn,_ as Tr,u as gi,a as $n,b as Dn,c as ns,W as rs,D as is,g as ss,d as os}from"./group-base.c3e2796d.js";import{f as Ct,R as xi,r as er,s as as,_ as tn,M as ls,c as Rn,g as cs,k as us,t as hs}from"./group-surveyjs.86bba1b9.js";function fs(x,u){for(var c=0;c<u.length;c++){const A=u[c];if(typeof A!="string"&&!Array.isArray(A)){for(const m in A)if(m!=="default"&&!(m in x)){const f=Object.getOwnPropertyDescriptor(A,m);f&&Object.defineProperty(x,m,f.get?f:{enumerable:!0,get:()=>A[m]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}const ds={class:"c-confirmModal_title"},gs={class:"c-confirmModal_content"},xs={class:"g-buttonGroup"},$r=st({__name:"ModalConfirm",props:{title:{type:String,required:!0},buttonCancel:{type:String,required:!1},showButtonCancel:{type:Boolean,required:!1,default:!0},buttonConfirm:{type:String,required:!1}},emits:["update:modelValue","confirm"],setup(x,{emit:u}){const c=Ct(),A=x,m=u;return(f,I)=>(Z(),tt(L(xi),{class:"c-confirmModal","content-class":"c-confirmModal_wrapper","overlay-transition":"vfm-fade","content-transition":"vfm-fade","lock-scroll":!0,"onUpdate:modelValue":I[2]||(I[2]=v=>m("update:modelValue",v))},{default:Pt(()=>[B("h1",ds,K(x.title),1),B("div",gs,[Ji(f.$slots,"default")]),B("div",xs,[x.showButtonCancel?(Z(),ne("button",{key:0,class:"g-button -secondary -md",onClick:I[0]||(I[0]=v=>m("update:modelValue",!1))},K(A.buttonCancel||L(c).buttonCancel),1)):oe("",!0),B("button",{class:"g-button -primary -md",onClick:I[1]||(I[1]=v=>m("confirm"))},K(x.buttonConfirm||L(c).buttonConfirm),1)])]),_:3}))}});class wi{static async getEntryAddForm(u){return(await It.get(`forms/diary/add-entry/?date=${u}`)).data}static async getEntryEditForm(){return(await It.get("forms/diary/edit-entry/")).data}static async getDisposalAddForm(){return(await It.get("forms/diary/add-disposal/")).data}static async getMOAForm(u){return(await It.get(`forms/moa/${u}/`)).data}static async getMeasureAdditionalMOAForm(u,c){return(await It.get(`forms/measure/${u}/moa/${c}/`)).data}static async getDiarySettingsForm(){return(await It.get("forms/settings/diary/")).data}static async getNotificationSettingsForm(u){return(await It.get(`forms/settings/notifications/?push=${u}`)).data}static async getRegistrationForm(){return(await It.get("forms/onboarding/registration/")).data}static async getDiaryInfoForm(){return(await It.get("forms/onboarding/diary-info/")).data}static async getDiaryTutorialForm(){return(await It.get("forms/onboarding/diary-intro/")).data}static async getMeasureSurveyForm(u){return(await It.get(`forms/measure/${u}/survey/`)).data}}var ws=function(x,u){u=u||{},u.listUnicodeChar=u.hasOwnProperty("listUnicodeChar")?u.listUnicodeChar:!1,u.stripListLeaders=u.hasOwnProperty("stripListLeaders")?u.stripListLeaders:!0,u.gfm=u.hasOwnProperty("gfm")?u.gfm:!0,u.useImgAltText=u.hasOwnProperty("useImgAltText")?u.useImgAltText:!0,u.abbr=u.hasOwnProperty("abbr")?u.abbr:!1,u.replaceLinksWithURL=u.hasOwnProperty("replaceLinksWithURL")?u.replaceLinksWithURL:!1,u.htmlTagsToSkip=u.hasOwnProperty("htmlTagsToSkip")?u.htmlTagsToSkip:[],u.throwError=u.hasOwnProperty("throwError")?u.throwError:!1;var c=x||"";c=c.replace(/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/gm,"");try{u.stripListLeaders&&(u.listUnicodeChar?c=c.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,u.listUnicodeChar+" $1"):c=c.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,"$1")),u.gfm&&(c=c.replace(/\n={2,}/g,`
2`).replace(/~{3}.*\n/g,"").replace(/~~/g,"").replace(/`{3}.*\n/g,"")),u.abbr&&(c=c.replace(/\*\[.*\]:.*\n/,""));let A=/<[^>]*>/g;if(u.htmlTagsToSkip&&u.htmlTagsToSkip.length>0){const m=u.htmlTagsToSkip.join("|");A=new RegExp(`<(?!/?(${m})(?=>|s[^>]*>))[^>]*>`,"g")}c=c.replace(A,"").replace(/^[=\-]{2,}\s*$/g,"").replace(/\[\^.+?\](\: .*?$)?/g,"").replace(/\s{0,2}\[.*?\]: .*?$/g,"").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g,u.useImgAltText?"$1":"").replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g,u.replaceLinksWithURL?"$2":"$1").replace(/^(\n)?\s{0,3}>\s?/gm,"$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g,"").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm,"$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g,"$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g,"$1$3$4$5").replace(/(`{3,})(.*?)\1/gm,"$2").replace(/`(.+?)`/g,"$1").replace(/~(.*?)~/g,"$1")}catch(A){if(u.throwError)throw A;return console.error("remove-markdown encountered error: %s",A),x}return c};const ei=Jn("FileSharer",{web:()=>Tr(()=>import("./web.18394e6b.js"),["assets/web.18394e6b.js","assets/group-base.c3e2796d.js","assets/group-surveyjs.86bba1b9.js","assets/pages-error.1aae2637.js","assets/group-surveyjs.75bf9ea9.css","assets/group-base.2652d482.css"]).then(x=>new x.FileSharerPluginWeb)});const Cs={class:"c-signupEmailModal_header"},As={class:"c-signupEmailModal_title"},ms={class:"c-signupEmailModal_content"},Es={key:0,class:"c-signupEmailModal_text"},ps=st({__name:"SignupEmailModal",props:{modelValue:{type:Boolean,default:!1},initialPassword:{type:String,required:!0}},emits:["update:modelValue"],setup(x,{emit:u}){const c=gi(),A=Ct(),m=pe(void 0),f=u,I=x,v=R=>{R.onComplete.add(async(y,N)=>{const X=y.data;try{await $n.requestAccountDataEmail(X==null?void 0:X.email,I.initialPassword)}catch(W){console.debug(W),y.clear(),y.data=X,y.render();return}f("update:modelValue",!1)});const C=vn(()=>{var X;const y=(X=m.value)==null?void 0:X.cancelText,N=R.createCustomLocalizableObj("cancelText");return typeof y=="object"?N.setJson({default:"Cancel",...y}
2):N.setJson({default:y!=null?y:"Cancel"}),R.getLocalizableString("cancelText")});R.addNavigationItem({visible:!0,visibleIndex:1,id:"sv-nav-cancel",locTitle:C.value,action:()=>{R.clear(),f("update:modelValue",!1)},css:"nav-button",innerCss:"sd-btn sd-navigation__cancel-btn g-button -secondary"})};return xn(()=>{m.value={focusFirstQuestionAutomatic:!0,pages:[{name:"email",elements:[{name:"email",type:"text",title:{de:A.registrationPageAccountCredentialsModalEmailLabel},description:{de:A.registrationPageAccountCredentialsModalEmailHelp},autocomplete:"email",inputType:"email",isRequired:!0,placeholder:{de:A.registrationPageAccountCredentialsModalEmailPlaceholder},requiredErrorText:{de:A.registrationPageAccountCredentialsModalEmailErrorRequired},validators:[{type:"email",text:{de:A.registrationPageAccountCredentialsModalEmailErrorEmail}}]}]}],showCompletedPage:!1,showQuestionNumbers:!1,cancelText:{de:A.registrationPageAccountCredentialsModalEmailButtonClose},completeText:{de:A.registrationPageAccountCredentialsModalEmailButtonSend}}}),(R,C)=>L(c).useEmail?(Z(),tt(L(xi),{key:0,class:"c-signupEmailModal","content-class":"c-signupEmailModal_wrapper","overlay-transition":"vfm-fade","content-transition":"vfm-fade","lock-scroll":!0,modelValue:x.modelValue,"onUpdate:modelValue":C[0]||(C[0]=y=>f("update:modelValue",y))},{default:Pt(()=>[B("div",Cs,[B("h2",As,K(L(A).registrationPageAccountCredentialsModalEmailTitle),1)]),B("div",ms,[L(A).registrationPageAccountCredentialsModalEmailText?(Z(),ne("p",Es,K(L(A).registrationPageAccountCredentialsModalEmailText),1)):oe("",!0),m.value?(Z(),tt(er,{key:1,class:"c-signupEmailModal_form",surveyJson:m.value,questionHeadingLevel:3,onSurveyModelCreated:v},null,8,["surveyJson"])):oe("",!0)])]),_:1},8,["modelValue"])):oe("",!0)}});const Mn=x=>(fi("data-v-17a81e76"),x=x(),di(),x),_s={class:"c-signupAccountCredentials"},bs={class:"c-signupAccountCredentials_heading"},Is={class:"c-signupAccountCredentials_title"},ys={class:"c-signupAccountCredentials_content"},Ss={key:0,class:"c-signupAccountCredentials_text"},Ts={class:"c-signupAccountCredentials_qrCode"},Ns=["innerHTML"],Rs={class:"g-buttonGroup"},Os=Mn(()=>B("span",{class:"icon-download","aria-hidden":"true"},null,-1)),vs={class:"action"},Ds={class:"c-signupAccountCredentials_credentials"},Ms={class:"credentials"},Bs={class:"copy-wrapper"},Ps=["aria-label","title"],Ls=Mn(()=>B("span",{class:"icon-copy","aria-hidden":"true"},null,-1)),Fs={class:"sr-only"},ks={class:"credentials_content"},Us={class:"credentials_status"},Vs=["title"],Gs={class:"sr-only"},Hs={class:"credentials"},Ws={class:"copy-wrapper"},Xs=["aria-label","title"],Ys=Mn(()=>B("span",{class:"icon-copy","aria-hidden":"true"},null,-1)),zs={class:"sr-only"},Zs={class:"credentials_content"},js={class:"credentials_status"},Ks=["title"],qs={class:"sr-only"},Qs={class:"g-buttonGroup c-signupAccountCredentials_actions"},Js=["disabled"],$s=Mn(()=>B("span",{class:"icon-download","aria-hidden":"true"},null,-1)),eo={class:"action"},to=Mn(()=>B("span",{class:"icon-email","aria-hidden":"true"},null,-1)),no={class:"action"},ro={class:"g-buttonGroup c-signupAccountCredentials_navigation"},io=st({__name:"SignupAccountCredentials",props:{qrCode:{type:String,required:!0},qrCodePng:{type:String,required:!1},userId:{type:String,required:!0},password:{type:String,required:!0},pdfData:{type:String,required:!1}},emits:["nextPage"],setup(x,{emit:u}){const c=gi(),A=Ct(),m=pe(!1),f=pe(!1),{text:I,copy:v,copied:R,isSupported:C}=as({legacy:!0}),y=async()=>{try{await ei.share({filename:`zu-gut-fuer-die-tonne-${Ve.userId}.png`,contentType:"image/png",base64Data:Ve.qrCodePng})}catch(we){console.debug(we)}},N=async()=>{await v(Ve.userId),R&&I.value===Ve.userId&&(m.value=!0)},X=async()=>{await v(Ve.password),R&&I.value===Ve.password&&(f.value=!0)},W=async()=>{try{await ei.share({filename:`zu-gut-fuer-die-tonne-${Ve.userId}.pdf`,contentType:"application/pdf",base64Data:Ve.pdfData})}catch(we){console.debug(we)}},re=pe(!1),ie=()=>{re.value=!0},De=u,Ve=x;return(we,Q)=>(Z(),ne("div",_s,[B("div",bs,[B("h1",Is,K(L(A).registrationPageAccountCredentialsHeading),
21)]),B("div",ys,[L(A).registrationPageAccountCredentialsText?(Z(),ne("p",Ss,K(L(A).registrationPageAccountCredentialsText),1)):oe("",!0),B("div",Ts,[B("div",{class:"qrCodeImage",innerHTML:x.qrCode},null,8,Ns),B("div",Rs,[x.qrCodePng?(Z(),ne("button",{key:0,class:"g-button -text -sm -hasIcon",onClick:y},[Os,B("span",vs,K(L(A).registrationPageAccountCredentialsButtonSaveImage),1)])):oe("",!0)])]),B("dl",Ds,[B("div",Ms,[B("dt",null,K(L(A).registrationPageAccountCredentialsUseridLabel),1),B("dd",null,[B("div",Bs,[L(C)?(Z(),ne("button",{key:0,class:"g-button -buttonCopy","aria-label":L(A).registrationPageAccountCredentialsButtonCopy,title:L(A).registrationPageAccountCredentialsButtonCopy,onClick:N},[Ls,B("span",Fs,K(L(A).registrationPageAccountCredentialsButtonCopy),1)],8,Ps)):oe("",!0)]),B("span",ks,K(Ve.userId),1),B("span",Us,[m.value?(Z(),ne(br,{key:0},[B("span",{class:"icon-check","aria-hidden":"true",title:L(A).registrationPageAccountCredentialsUseridCopied},null,8,Vs),B("span",Gs,K(L(A).registrationPageAccountCredentialsUseridCopied),1)],64)):oe("",!0)])])]),B("div",Hs,[B("dt",null,K(L(A).registrationPageAccountCredentialsPasswordLabel),1),B("dd",null,[B("div",Ws,[L(C)?(Z(),ne("button",{key:0,class:"g-button -buttonCopy","aria-label":L(A).registrationPageAccountCredentialsButtonCopy,title:L(A).registrationPageAccountCredentialsButtonCopy,onClick:X},[Ys,B("span",zs,K(L(A).registrationPageAccountCredentialsButtonCopy),1)],8,Xs)):oe("",!0)]),B("span",Zs,K(Ve.password),1),B("span",js,[f.value?(Z(),ne(br,{key:0},[B("span",{class:"icon-check","aria-hidden":"true",title:L(A).registrationPageAccountCredentialsPasswordCopied},null,8,Ks),B("span",qs,K(L(A).registrationPageAccountCredentialsPasswordCopied),1)],64)):oe("",!0)])])])]),B("div",Qs,[B("button",{class:"g-button -text -sm -hasIcon",disabled:!x.pdfData,onClick:W},[$s,B("span",eo,K(L(A).registrationPageAccountCredentialsButtonDownload),1)],8,Js),L(c).useEmail?(Z(),ne("button",{key:0,class:"g-button -text -sm -hasIcon",onClick:ie},[to,B("span",no,K(L(A).registrationPageAccountCredentialsButtonEmail),1)])):oe("",!0)])]),B("div",ro,[B("button",{class:"g-button -primary -md",onClick:Q[0]||(Q[0]=fe=>De("nextPage"))},K(L(A).registrationButtonNext),1)]),L(c).useEmail?(Z(),tt(ps,{key:0,modelValue:re.value,"onUpdate:modelValue":Q[1]||(Q[1]=fe=>re.value=fe),initialPassword:x.password},null,8,["modelValue","initialPassword"])):oe("",!0)]))}}),so=tn(io,[["__scopeId","data-v-17a81e76"]]);const oo={class:"c-signupAccountCreating"},ao=["src"],lo={class:"c-signupAccountCreating_heading"},co={class:"c-signupAccountCreating_title"},uo={key:0,class:"c-signupAccountCreating_text"},ho=st({__name:"SignupAccountCreating",emits:["startRegistration"],setup(x,{emit:u}){const c=Ct();return(A,m)=>(Z(),ne("div",oo,[L(c).registrationPageAccountCreatingImage?(Z(),ne("img",{key:0,class:"c-signupAccountCreating_image",src:L(c).registrationPageAccountCreatingImage,alt:""},null,8,ao)):oe("",!0),B("div",lo,[B("h1",co,K(L(c).registrationPageAccountCreatingHeading),1),it(Dn),L(c).registrationPageAccountCreatingText?(Z(),ne("p",uo,K(L(c).registrationPageAccountCreatingText),1)):oe("",!0)])]))}}),fo=tn(ho,[["__scopeId","data-v-d3bf2600"]]);const go={class:"c-signupForm"},xo=st({__name:"SignupForm",emits:["signupSuccessful","signupCancelled"],setup(x,{emit:u}){const c=Ct(),A=pe(void 0),m=pe(void 0),f=pe(!1),I=pe(!1),v=pe(!1),R=u;xn(async()=>{f.value=!0;try{A.value=await wi.getRegistrationForm()}catch(y){A.value=void 0,v.value=!0,console.debug(y)}finally{f.value=!1}});const C=y=>{m.value=y,y.onComplete.add(async(X,W)=>{I.value=!0;const re=X.data;let ie;const De=X.currentPageNo;try{ie=await $n.signUp(re)}catch(Ve){console.debug(Ve),X.clear(),X.data=re,X.currentPageNo=De,X.render(),I.value=!1;return}R("signupSuccessful",ie),I.value=!1});const N=vn(()=>{var re;const X=(re=A.value)==null?void 0:re.cancelText,W=y.createCustomLocalizableObj("cancelText");return typeof X=="object"?W.setJson({default:"Cancel",...X}):W.setJson({default:X!=null?X:"Cancel"}),y.getLocalizableString("cancelText")});y.addNavigationItem({visible:!0,visibleIndex:1,id:"sv-nav-cancel",locTitle:N.value,action:()=>{y.clear(),R("signupCancelled")},css:"nav-button",innerCss:"sd-btn sd-navigation__cancel-btn g-button -secondary"})};return(y,N)=>(Z(),ne("div",go,[A.value?(Z(),tt(er,{key:0,class:"c-signupForm_form",surveyJson:A.value,questionHeadingLevel:3,onSurveyModelCreated:C},null,8,["surveyJson"])):oe("",!0),f.value?(Z(),tt(Dn,{key:1,loadingText:L(c).registrationFormLoadingMessage},null,8,["loadingText"])):oe("",!0),I.value?(Z(),tt(fo,{key:2})):oe("",!0)]))}});const wo={class:"c-signupInfoForm"},Co=st({__name:"SignupInfoForm",emits:["complete","cancel"],setup(x,{emit:u}){const c=pe(void 0),A=pe(!1),m=pe(!1),f=u;xn(async()=>{A.value=!0;try{c.value=await wi.getDiaryInfoForm()}catch(v){c.value=void 0,m.value=!0,console.debug(v)}finally{A.value=!1}});const I=v=>{v.onComplete.add(async(C,y)=>{f("complete")}
2);const R=vn(()=>{var N;const C=(N=c.value)==null?void 0:N.cancelText,y=v.createCustomLocalizableObj("cancelText");return typeof C=="object"?y.setJson({default:"Cancel",...C}):y.setJson({default:C!=null?C:"Cancel"}),v.getLocalizableString("cancelText")});v.addNavigationItem({visible:!0,visibleIndex:1,id:"sv-nav-cancel",locTitle:R.value,action:()=>{v.clear(),f("cancel")},css:"nav-button",innerCss:"sd-btn sd-navigation__cancel-btn g-button -secondary"})};return(v,R)=>(Z(),ne("div",wo,[c.value?(Z(),tt(er,{key:0,class:"c-signupInfoForm_form",surveyJson:c.value,questionHeadingLevel:3,onSurveyModelCreated:I},null,8,["surveyJson"])):oe("",!0),A.value?(Z(),tt(Dn,{key:1})):oe("",!0)]))}});const Ao={class:"c-signupRegistrationConsent"},mo=["innerHTML"],Eo={id:"sv-icon-holder-global-container",style:{display:"none"}},po=B("symbol",{id:"icon-check-16x16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},[B("path",{d:"M5.003 14.413L0.292999 9.70303L1.703 8.29303L5.003 11.583L14.293 2.29303L15.703 3.70303L5.003 14.413Z"})],-1),_o=[po],bo=["src"],Io={class:"c-signupRegistrationConsent_header"},yo={class:"c-signupRegistrationConsent_title"},So={key:0,class:"c-signupRegistrationConsent_text"},To={class:"c-signupRegistrationConsent_section"},No={class:"c-signupRegistrationConsent_heading"},Ro={key:0,class:"c-signupRegistrationConsent_text"},Oo={class:"g-buttonGroup c-signupRegistrationConsent_actions"},vo={class:"c-signupRegistrationConsent_section"},Do={class:"c-signupRegistrationConsent_heading"},Mo={key:0,class:"c-signupRegistrationConsent_text"},Bo={class:"g-buttonGroup c-signupRegistrationConsent_actions"},Po={class:"sd-row"},Lo={class:"e-form_fieldWrap sd-question"},Fo={class:"sd-element__content sd-question__content"},ko={class:"sd-selectbase",role:"group"},Uo=B("legend",{class:"sv-hidden"},"DS-Erkl\xE4rung",-1),Vo={class:"sd-selectbase__label"},Go=B("span",{class:"sd-item__decorator sd-checkbox__decorator"},[B("svg",{class:"sd-item__svg sd-checkbox__svg"},[B("use",{"xlink:href":"#icon-check-16x16"})])],-1),Ho={class:"sd-item__control-label"},Wo={class:"sd-selectbase__label"},Xo=B("div",{class:"sd-item__decorator sd-checkbox__decorator"},[B("svg",{class:"sd-item__svg sd-checkbox__svg"},[B("use",{"xlink:href":"#icon-check-16x16"})])],-1),Yo={class:"sd-item__control-label"},zo={class:"g-buttonGroup c-signupRegistrationConsent_navigation"},Zo=["disabled"],jo=st({__name:"SignupRegistrationConsent",emits:["nextPage","cancel"],setup(x,{emit:u}){const c=ls({html:!0}),A=vn(()=>{if(m.registrationPageConsentFormConsentTextFull)return c.render(m.registrationPageConsentFormConsentTextFull)}),m=Ct(),f=u,I=pe(!1),v=pe(!1),R=pe([]),C=vn(()=>R.value.includes("consent")&&R.value.includes("privacy")),y=()=>{I.value=!0},N=()=>{v.value=!0};return(X,W)=>(Z(),ne("div",Ao,[it($r,{modelValue:I.value,"onUpdate:modelValue":W[0]||(W[0]=re=>I.value=re),showButtonCancel:!1,title:L(m).registrationPageConsentFormConsentHeading,buttonConfirm:L(m).registrationPageConsentFormModalCloseButton,onConfirm:W[1]||(W[1]=re=>I.value=!1)},{default:Pt(()=>[L(m).registrationPageConsentFormConsentTextFull?(Z(),ne("div",{key:0,class:"modal-text",innerHTML:A.value},null,8,mo)):oe("",!0)]),_:1},8,["modelValue","title","buttonConfirm"]),it($r,{modelValue:v.value,"onUpdate:modelValue":W[2]||(W[2]=re=>v.value=re),showButtonCancel:!1,title:L(m).registrationPageConsentFormConsentHeading,buttonConfirm:L(m).registrationPageConsentFormModalCloseButton,onConfirm:W[3]||(W[3]=re=>v.value=!1)},{default:Pt(()=>[it(ns,{title:"Datenschutz"})]),_:1},8,["modelValue","title","buttonConfirm"]),(Z(),ne("svg",Eo,_o)),L(m).registrationPageConsentFormImage?(Z(),ne("img",{key:0,class:"c-signupRegistrationConsent_image",src:L(m).registrationPageConsentFormImage,alt:""},null,8,bo)):oe("",!0),B("div",Io,[B("h1",yo,K(L(m).registrationPageConsentFormHeading),1),L(m).registrationPageConsentFormText?(Z(),ne("p",So,K(L(m).registrationPageConsentFormText),1)):oe("",!0)]),B("section",To,[B("h2",No,K(L(m).registrationPageConsentFormConsentHeading),1),L(m).registrationPageConsentFormConsentText?(Z(),ne("p",Ro,K(L(m).registrationPageConsentFormConsentText),1)):oe("",!0),B("div",Oo,[B("button",{class:"g-button -secondary",onClick:y},K(L(m).registrationPageConsentFormConsentButton),1)])]),B("section",vo,[B("h2",Do,K(L(m).registrationPageConsentFormPrivacyHeading),
21),L(m).registrationPageConsentFormPrivacyText?(Z(),ne("p",Mo,K(L(m).registrationPageConsentFormPrivacyText),1)):oe("",!0),B("div",Bo,[B("button",{class:"g-button -secondary",onClick:N},K(L(m).registrationPageConsentFormPrivacyButton),1)])]),B("form",null,[B("div",Po,[B("div",Lo,[B("div",Fo,[B("fieldset",ko,[Uo,B("div",{class:qr(["sd-item sd-checkbox sd-selectbase__item",{"sd-item--checked sd-checkbox--checked":R.value.includes("consent")}])},[B("label",Vo,[Qr(B("input",{class:"sd-visuallyhidden sd-item__control sd-checkbox__control",type:"checkbox",name:"consents",value:"consent","onUpdate:modelValue":W[4]||(W[4]=re=>R.value=re)},null,512),[[Jr,R.value]]),Go,B("span",Ho,K(L(m).registrationPageConsentFormConsentLabel),1)])],2),B("div",{class:qr(["sd-item sd-checkbox sd-selectbase__item",{"sd-item--checked sd-checkbox--checked":R.value.includes("privacy")}])},[B("label",Wo,[Qr(B("input",{class:"sd-visuallyhidden sd-item__control sd-checkbox__control",type:"checkbox",name:"consents",value:"privacy","onUpdate:modelValue":W[5]||(W[5]=re=>R.value=re)},null,512),[[Jr,R.value]]),Xo,B("span",Yo,K(L(m).registrationPageConsentFormPrivacyLabel),1)])],2)])])])])]),B("div",zo,[B("button",{class:"g-button -secondary",onClick:W[6]||(W[6]=re=>f("cancel"))},K(L(m).registrationButtonCancel),1),B("button",{class:"g-button -primary",onClick:W[7]||(W[7]=re=>f("nextPage")),disabled:!C.value},K(L(m).registrationButtonNext),9,Zo)])]))}});const Ko={class:"c-signupRegistrationStart"},qo=["src"],Qo={class:"c-signupRegistrationStart_heading"},Jo={class:"c-signupRegistrationStart_title"},$o={key:0,class:"c-signupRegistrationStart_text"},ea={class:"g-buttonGroup c-signupRegistrationStart_navigation"},ta=st({__name:"SignupRegistrationStart",emits:["nextPage","cancel"],setup(x,{emit:u}){const c=Ct(),A=u;return(m,f)=>(Z(),ne("div",Ko,[L(c).registrationPageStartRegistrationImage?(Z(),ne("img",{key:0,class:"c-signupRegistrationStart_image",src:L(c).registrationPageStartRegistrationImage,alt:""},null,8,qo)):oe("",!0),B("div",Qo,[B("h1",Jo,K(L(c).registrationPageStartRegistrationHeading),1),L(c).registrationPageStartRegistrationText?(Z(),ne("p",$o,K(L(c).registrationPageStartRegistrationText),1)):oe("",!0)]),B("div",ea,[B("button",{class:"g-button -secondary",onClick:f[0]||(f[0]=I=>A("cancel"))},K(L(c).registrationButtonCancel),1),B("button",{class:"g-button -primary",onClick:f[1]||(f[1]=I=>A("nextPage"))},K(L(c).registrationButtonNext),1)])]))}});const na={class:"c-signupStart"},ra=["src"],ia={class:"c-signupStart_heading"},sa={class:"c-signupStart_title"},oa={key:0,class:"c-signupStart_text"},aa={class:"g-buttonGroup"},la=st({__name:"SignupStart",emits:["startRegistration","startInfo"],setup(x,{emit:u}){const c=Ct(),A=u;return(m,f)=>{const I=Sr("router-link");return Z(),ne("div",na,[L(c).registrationPageStartImage?(Z(),ne("img",{key:0,class:"c-signupStart_image",src:L(c).registrationPageStartImage,alt:""},null,8,ra)):oe("",!0),B("div",ia,[B("h1",sa,K(L(c).registrationPageStartHeading),1),L(c).registrationPageStartText?(Z(),ne("p",oa,K(L(c).registrationPageStartText),1)):oe("",!0)]),B("div",aa,[B("button",{class:"g-button -secondary -md",onClick:f[0]||(f[0]=v=>A("startInfo"))},K(L(c).registrationPageStartButtonInfo),1),B("button",{class:"g-button -primary -md",onClick:f[1]||(f[1]=v=>A("startRegistration"))},K(L(c).registrationPageStartButtonRegister),1),it(I,{class:"g-button -text -md -buttonRestore",to:{name:"login"}},{default:Pt(()=>[On(K(L(c).registrationPageStartButtonRestore),1)]),_:1})])])}}}),ca=tn(la,[["__scopeId","data-v-2f35e63a"]]);const ua={class:"c-signupSuccess"},ha=["src"],fa={class:"c-signupSuccess_heading"},da={class:"c-signupSuccess_title"},ga={key:0,class:"c-signupSuccess_text"},xa={class:"g-buttonGroup"},wa={key:0},Ca={key:1},Aa={key:2},ma=st({__name:"SignupSuccess",setup(x){const u=Ct();return(c,A)=>{const m=Sr("router-link");return Z(),ne("div",ua,[L(u).registrationPageSuccessImage?(Z(),ne("img",{key:0,class:"c-signupSuccess_image",src:L(u).registrationPageSuccessImage,alt:""},null,8,ha)):oe("",!0),B("div",fa,[B("h1",da,K(L(u).registrationPageSuccessHeading),
21),L(u).registrationPageSuccessText?(Z(),ne("p",ga,K(L(u).registrationPageSuccessText),1)):oe("",!0)]),B("div",xa,[L(u).registrationPageSuccessTextTutorial?(Z(),ne("p",wa,K(L(u).registrationPageSuccessTextTutorial),1)):oe("",!0),it(m,{class:"g-button -primary -md",to:{name:"tutorialDiaryEntry"}},{default:Pt(()=>[On(K(L(u).registrationPageSuccessButtonTutorial),1)]),_:1}),L(u).registrationPageSuccessTextFirstEntry?(Z(),ne("p",Ca,K(L(u).registrationPageSuccessTextFirstEntry),1)):oe("",!0),it(m,{class:"g-button -secondary -md",to:{name:"diaryEntriesAddEntry",params:{date:"0"}}},{default:Pt(()=>[On(K(L(u).registrationPageSuccessButtonFirstEntry),1)]),_:1}),L(u).registrationPageSuccessTextDone?(Z(),ne("p",Aa,K(L(u).registrationPageSuccessTextDone),1)):oe("",!0),it(m,{class:"g-button -secondary -md -buttonDashboard",to:{name:"diaryDashboard"}},{default:Pt(()=>[On(K(L(u).registrationPageSuccessButtonDone),1)]),_:1})])])}}}),Ea=tn(ma,[["__scopeId","data-v-2980c375"]]);const Ci=x=>(fi("data-v-d91f9fe6"),x=x(),di(),x),pa={class:"v-signup"},_a={class:"v-signup_lyt"},ba={key:1},Ia=Ci(()=>B("h1",{class:"sr-only"},"Dein K\xFCchentagebuch",-1)),ya={key:4},Sa=Ci(()=>B("h1",{class:"sr-only"},"Dein K\xFCchentagebuch",-1)),Ta=st({__name:"SignUpView",setup(x){const u=pe("start"),c=pe(),A=pe(),m=pe(),f=pe(),I=pe(),v=R=>{c.value=R==null?void 0:R.id,A.value=R==null?void 0:R.initial_password,m.value=R==null?void 0:R.qr_code,f.value=R==null?void 0:R.qr_code_png,I.value=R==null?void 0:R.pdf_data,u.value="credentials"};return(R,C)=>(Z(),ne("div",pa,[B("div",_a,[it($i,{name:"fade",mode:"out-in"},{default:Pt(()=>[u.value==="start"?(Z(),tt(ca,{key:0,onStartInfo:C[0]||(C[0]=y=>u.value="info_form"),onStartRegistration:C[1]||(C[1]=y=>u.value="registration_start")})):u.value==="info_form"?(Z(),ne("div",ba,[Ia,it(Co,{onCancel:C[2]||(C[2]=y=>u.value="start"),onComplete:C[3]||(C[3]=y=>u.value="registration_start")})])):u.value==="registration_start"?(Z(),tt(ta,{key:2,onCancel:C[4]||(C[4]=y=>u.value="start"),onNextPage:C[5]||(C[5]=y=>u.value="registration_consent")})):u.value==="registration_consent"?(Z(),tt(jo,{key:3,onCancel:C[6]||(C[6]=y=>u.value="start"),onNextPage:C[7]||(C[7]=y=>u.value="registration_form")})):u.value==="registration_form"?(Z(),ne("div",ya,[Sa,it(xo,{onSignupCancelled:C[8]||(C[8]=y=>u.value="start"),onSignupSuccessful:v})])):u.value==="credentials"?(Z(),tt(so,{key:5,userId:c.value,password:A.value,qrCode:m.value,qrCodePng:f.value,pdfData:I.value,onNextPage:C[9]||(C[9]=y=>u.value="success")},null,8,["userId","password","qrCode","qrCodePng","pdfData"])):u.value==="success"?(Z(),tt(Ea,{key:6})):oe("",!0)]),_:1})])]))}}),Na=tn(Ta,[["__scopeId","data-v-d91f9fe6"]]),Z1=Object.freeze(Object.defineProperty({__proto__:null,default:Na},Symbol.toStringTag,{value:"Module"}));const Ra={class:"c-loginForm"},Oa={class:"c-loginForm_title"},va={key:0,class:"c-loginForm_text"},Da=st({__name:"LoginForm",emits:["loginSuccessful"],setup(x,{emit:u}){const c=Ct(),A=es(),m=u,f=pe(!1),I=pe(void 0),v=async(N,X)=>{let W=!1;try{W=await $n.login(X.data.username,X.data.password)}catch{}W?(X.complete(),m("loginSuccessful")):(X.errors.username=c.componentLoginFormErrorLoginData,X.errors.password=c.componentLoginFormErrorLoginData,X.complete())},R=(N,X)=>{N.clear(),N.render()},C=N=>{y.value&&N.mergeData(y.value)},y=pe({username:void 0,password:void 0});return xn(()=>{var W,re;f.value=!0;const N=(W=A.query)==null?void 0:W.username,X=(re=A.query)==null?void 0:re.password;y.value={username:N,password:X},I.value={pages:[{name:"login",elements:[{type:"text",name:"username",title:c.componentLoginFormUsernameLabel,isRequired:!0,autocomplete:"username",requiredErrorText:c.componentLoginFormUsernameRequired},{type:"text",name:"password",title:c.componentLoginFormPasswordLabel,isRequired:!0,inputType:"password",autocomplete:"current-password",requiredErrorText:c.componentLoginFormPasswordRequired}]}],showCompletedPage:!1,showQuestionNumbers:!1,completeText:c.componentLoginFormButtonLogin},f.value=!1}),(N,X)=>(Z(),ne("div",Ra,[B("h2",Oa,K(L(c).componentLoginFormHeading),1),L(c).componentLoginFormText?(Z(),ne("p",va,K(L(c).componentLoginFormText),1)):oe("",!0),I.value?(Z(),tt(er,{key:1,class:"c-loginForm_form",surveyJson:I.value,customValidation:v,onSurveyModelCreated:C,onFormSubmitted:R},null,8,["surveyJson"])):oe("",!0),f.value?(Z(),tt(Dn,{key:2})):oe("",!0)]))}});const Ma={class:"c-registrationLink"},Ba={class:"c-registrationLink_title"},Pa={key:0,class:"c-registrationLink_text"},La={class:"g-buttonGroup"},Fa=st({__name:"RegistrationLink",setup(x){const u=Ct();return(c,A)=>{const m=Sr("router-link");return Z(),ne("div",Ma,[B("h2",Ba,K(L(u).componentRegistrationLinkHeading),
21),L(u).componentRegistrationLinkText?(Z(),ne("p",Pa,K(L(u).componentRegistrationLinkText),1)):oe("",!0),B("div",La,[it(m,{class:"g-button -primary",to:{name:"signup"}},{default:Pt(()=>[On(K(L(u).componentRegistrationLinkButton),1)]),_:1})])])}}});var Y;(function(x){x[x.QR_CODE=0]="QR_CODE",x[x.AZTEC=1]="AZTEC",x[x.CODABAR=2]="CODABAR",x[x.CODE_39=3]="CODE_39",x[x.CODE_93=4]="CODE_93",x[x.CODE_128=5]="CODE_128",x[x.DATA_MATRIX=6]="DATA_MATRIX",x[x.MAXICODE=7]="MAXICODE",x[x.ITF=8]="ITF",x[x.EAN_13=9]="EAN_13",x[x.EAN_8=10]="EAN_8",x[x.PDF_417=11]="PDF_417",x[x.RSS_14=12]="RSS_14",x[x.RSS_EXPANDED=13]="RSS_EXPANDED",x[x.UPC_A=14]="UPC_A",x[x.UPC_E=15]="UPC_E",x[x.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Y||(Y={}));var ti=new Map([[Y.QR_CODE,"QR_CODE"],[Y.AZTEC,"AZTEC"],[Y.CODABAR,"CODABAR"],[Y.CODE_39,"CODE_39"],[Y.CODE_93,"CODE_93"],[Y.CODE_128,"CODE_128"],[Y.DATA_MATRIX,"DATA_MATRIX"],[Y.MAXICODE,"MAXICODE"],[Y.ITF,"ITF"],[Y.EAN_13,"EAN_13"],[Y.EAN_8,"EAN_8"],[Y.PDF_417,"PDF_417"],[Y.RSS_14,"RSS_14"],[Y.RSS_EXPANDED,"RSS_EXPANDED"],[Y.UPC_A,"UPC_A"],[Y.UPC_E,"UPC_E"],[Y.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),ni;(function(x){x[x.UNKNOWN=0]="UNKNOWN",x[x.URL=1]="URL"})(ni||(ni={}));function ka(x){return Object.values(Y).includes(x)}var Zn;(function(x){x[x.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",x[x.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Zn||(Zn={}));var Ua=function(){function x(){}return x.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",x.SCAN_DEFAULT_FPS=2,x.DEFAULT_DISABLE_FLIP=!1,x.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,x.DEFAULT_SUPPORTED_SCAN_TYPE=[Zn.SCAN_TYPE_CAMERA,Zn.SCAN_TYPE_FILE],x}(),Ai=function(){function x(u,c){this.format=u,this.formatName=c}return x.prototype.toString=function(){return this.formatName},x.create=function(u){if(!ti.has(u))throw"".concat(u," not in html5QrcodeSupportedFormatsTextMap");return new x(u,ti.get(u))},x}(),ri=function(){function x(){}return x.createFromText=function(u){var c={text:u};return{decodedText:u,result:c}},x.createFromQrcodeResult=function(u){return{decodedText:u.text,result:u}},x}(),Ir;(function(x){x[x.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",x[x.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",x[x.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Ir||(Ir={}));var Va=function(){function x(){}return x.createFrom=function(u){return{errorMessage:u,type:Ir.UNKWOWN_ERROR}},x}(),Ga=function(){function x(u){this.verbose=u}return x.prototype.log=function(u){this.verbose&&console.log(u)},x.prototype.warn=function(u){this.verbose&&console.warn(u)},x.prototype.logError=function(u,c){(this.verbose||c===!0)&&console.error(u)},x.prototype.logErrors=function(u){if(u.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(u)},x}();function Ft(x){return typeof x>"u"||x===null}var gn=function(){function x(){}return x.codeParseError=function(u){return"QR code parse error, error = ".concat(u)},x.errorGettingUserMedia=function(u){return"Error getting userMedia, error = ".concat(u)},x.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},x.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},x.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},x.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},x.scannerPaused=function(){return"Scanner paused"},x}(),mi=function(){function x(){}return x.isMediaStreamConstraintsValid=function(u,c){if(typeof u!="object"){var A=typeof u;return c.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(A,"."),!0),!1}for(var m=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(m),I=Object.keys(u),v=0,R=I;v<R.length;v++){var C=R[v];if(f.has(C))return c.logError("".concat(C," is not supported videoConstaints."),!0),!1}return!0},x}(),Re={exports:{}};(function(x,u){(function(c,A){A(u)})(Rn,function(c){function A(d){return d==null}var m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)e.hasOwnProperty(t)&&(d[t]=e[t])};function f(d,e){m(d,e);function t(){this.constructor=d}
2d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function I(d,e){var t=Object.setPrototypeOf;t?t(d,e):d.__proto__=e}function v(d,e){e===void 0&&(e=d.constructor);var t=Error.captureStackTrace;t&&t(d,e)}var R=function(d){f(e,d);function e(t){var n=this.constructor,r=d.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),I(r,n.prototype),v(r),r}return e}(Error);class C extends R{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}C.kind="Exception";class y extends C{}y.kind="ArgumentException";class N extends C{}N.kind="IllegalArgumentException";class X{constructor(e){if(this.binarizer=e,e===null)throw new N("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new X(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new X(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new X(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class W extends C{static getChecksumInstance(){return new W}}W.kind="ChecksumException";class re{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class ie{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class De extends C{}De.kind="IndexOutOfBoundsException";class Ve extends De{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}Ve.kind="ArrayIndexOutOfBoundsException";class we{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){we.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new N("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Ve(t);if(n>e)throw new Ve(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return ie.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){n===void 0&&(n=we.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const s=i+r>>1,o=n(t,e[s]);if(o>0)r=s+1;else if(o<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class Q{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16===0&&(t+=16,e<<=16),e>>>24===0&&(t+=8,e<<=8),e>>>28===0&&(t+=4,e<<=4),e>>>30===0&&(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}Q.MIN_VALUE_32_BITS=-2147483648,Q.MAX_VALUE=Number.MAX_SAFE_INTEGER;class fe{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=fe.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}
2ensureCapacity(e){if(e>this.bits.length*32){const t=fe.makeArray(e);ie.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=n[r]}const o=r*32+Q.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=~n[r]}const o=r*32+Q.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new N;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let s=n;s<=r;s++){const o=s>n?0:e&31,l=(2<<(s<r?31:t&31))-(1<<o);i[s]|=l}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new N;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=r;o<=i;o++){const a=o>r?0:e&31,h=(2<<(o<i?31:t&31))-(1<<a)&4294967295;if((s[o]&h)!==(n?h:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new N("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new N("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let s=0;for(let o=0;o<8;o++)this.get(e)&&(s|=1<<7-o),e++;t[n+i]=s}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let s=r[i];s=s>>1&1431655765|(s&1431655765)<<1,s=s>>2&858993459|(s&858993459)<<2,s=s>>4&252645135|(s&252645135)<<4,s=s>>8&16711935|(s&16711935)<<8,s=s>>16&65535|(s&65535)<<16,e[t-i]=s}if(this.size!==n*32){const i=n*32-this.size;let s=e[0]>>>i;for(let o=1;o<n;o++){const a=e[o];s|=a<<32-i,e[o-1]=s,s=a>>>i}e[n-1]=s}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof fe))return!1;const t=e;return this.size===t.size&&we.equals(this.bits,t.bits)}hashCode(){return 31*this.size+we.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new fe(this.size,this.bits.slice())}}var kt;(function(d){d[d.OTHER=0]="OTHER",d[d.PURE_BARCODE=1]="PURE_BARCODE",d[d.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",d[d.TRY_HARDER=3]="TRY_HARDER",d[d.CHARACTER_SET=4]="CHARACTER_SET",d[d.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",d[d.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",d[d.ASSUME_GS1=7]="ASSUME_GS1",d[d.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",d[d.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",d[d.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(kt||(kt={}));var be=kt;class G extends C{static getFormatInstance(){return new G}}G.kind="FormatException";var _e;(function(d){d[d.Cp437=0]="Cp437",d[d.ISO8859_1=1]="ISO8859_1",d[d.ISO8859_2=2]="ISO8859_2",d[d.ISO8859_3=3]="ISO8859_3",d[d.ISO8859_4=4]="ISO8859_4",d[d.ISO8859_5=5]="ISO8859_5",d[d.ISO8859_6=6]="ISO8859_6",d[d.ISO8859_7=7]="ISO8859_7",d[d.ISO8859_8=8]="ISO8859_8",d[d.ISO8859_9=9]="ISO8859_9",d[d.ISO8859_10=10]="ISO8859_10",d[d.ISO8859_11=11]="ISO8859_11",d[d.ISO8859_13=12]="ISO8859_13",d[d.ISO8859_14=13]="ISO8859_14",d[d.ISO8859_15=14]="ISO8859_15",d[d.ISO8859_16=15]="ISO8859_16",d[d.SJIS=16]="SJIS",d[d.Cp1250=17]="Cp1250",d[d.Cp1251=18]="Cp1251",d[d.Cp1252=19]="Cp1252",d[d.Cp1256=20]="Cp1256",d[d.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",d[d.UTF8=22]="UTF8",d[d.ASCII=23]="ASCII",d[d.Big5=24]="Big5",d[d.GB18030=25]="GB18030",d[d.EUC_KR=26]="EUC_KR"})(_e||(_e={}));class V{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,V.VALUE_IDENTIFIER_TO_ECI.set(e,this),V.NAME_TO_ECI.set(n,this);const i=this.values;for(let s=0,o=i.length;s!==o;s++){const a=i[s];V.VALUES_TO_ECI.set(a,this)}for(const s of r)V.NAME_TO_ECI.set(s,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new G("incorect value");const t=V.VALUES_TO_ECI.get(e);if(t===void 0)throw new G("incorect value");return t}static getCharacterSetECIByName(e){const t=V.NAME_TO_ECI.get(e);if(t===void 0)throw new G("incorect value");return t}equals(e){if(!(e instanceof V))return!1;const t=e;return this.getName()===t.getName()}}V.VALUE_IDENTIFIER_TO_ECI=new Map,V.VALUES_TO_ECI=new Map,V.NAME_TO_ECI=new Map,V.Cp437=new V(_e.Cp437,Int32Array.from([0,2]),"Cp437"),V.ISO8859_1=new V(_e.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),V.ISO8859_2=new V(_e.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),V.ISO8859_3=new V(_e.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),V.ISO8859_4
2=new V(_e.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),V.ISO8859_5=new V(_e.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),V.ISO8859_6=new V(_e.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),V.ISO8859_7=new V(_e.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),V.ISO8859_8=new V(_e.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),V.ISO8859_9=new V(_e.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),V.ISO8859_10=new V(_e.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),V.ISO8859_11=new V(_e.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),V.ISO8859_13=new V(_e.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),V.ISO8859_14=new V(_e.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),V.ISO8859_15=new V(_e.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),V.ISO8859_16=new V(_e.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),V.SJIS=new V(_e.SJIS,20,"SJIS","Shift_JIS"),V.Cp1250=new V(_e.Cp1250,21,"Cp1250","windows-1250"),V.Cp1251=new V(_e.Cp1251,22,"Cp1251","windows-1251"),V.Cp1252=new V(_e.Cp1252,23,"Cp1252","windows-1252"),V.Cp1256=new V(_e.Cp1256,24,"Cp1256","windows-1256"),V.UnicodeBigUnmarked=new V(_e.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),V.UTF8=new V(_e.UTF8,26,"UTF8","UTF-8"),V.ASCII=new V(_e.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),V.Big5=new V(_e.Big5,28,"Big5"),V.GB18030=new V(_e.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),V.EUC_KR=new V(_e.EUC_KR,30,"EUC_KR","EUC-KR");class nn extends C{}nn.kind="UnsupportedOperationException";class ut{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!ut.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof V?e:V.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(ut.isDecodeFallbackSupported(n)){let r="";for(let i=0,s=e.length;i<s;i++){let o=e[i].toString(16);o.length<2&&(o="0"+o),r+="%"+o}return decodeURIComponent(r)}if(n.equals(V.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new nn(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(V.UTF8)||e.equals(V.ISO8859_1)||e.equals(V.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let i=0;i<n.length;i++)r.push(n[i].charCodeAt(0));return new Uint8Array(r)}}class se{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return ut.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(be.CHARACTER_SET)!==void 0)return t.get(be.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,s=!0,o=0,a=0,l=0,h=0,g=0,w=0,p=0,_=0,b=0,S=0,D=0;const k=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let U=0;U<n&&(r||i||s);U++){const F=e[U]&255;s&&(o>0?(F&128)===0?s=!1:o--:(F&128)!==0&&((F&64)===0?s=!1:(o++,(F&32)===0?a++:(o++,(F&16)===0?l++:(o++,(F&8)===0?h++:s=!1))))),r&&(F>127&&F<160?r=!1:F>159&&(F<192||F===215||F===247)&&D++),i&&(g>0?F<64||F===127||F>252?i=!1:g--:F===128||F===160||F>239?i=!1:F>160&&F<224?(w++,_=0,p++,p>b&&(b=p)):F>127?(g++,p=0,_++,_>S&&(S=_)):(p=0,_=0))}return s&&o>0&&(s=!1),i&&g>0&&(i=!1),s&&(k||a+l+h>0)?se.UTF8:i&&(se.ASSUME_SHIFT_JIS||b>=3||S>=3)?se.SHIFT_JIS:r&&i?b===2&&w===2||D*10>=n?se.SHIFT_JIS:se.ISO88591:r?se.ISO88591:i?se.SHIFT_JIS:s?se.UTF8:se.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(s,o,a,l,h,g){if(s==="%%")return"%";if(t[++n]===void 0)return;s=l?parseInt(l.substr(1)):void 0;let w=h?parseInt(h.substr(1)):void 0,p;switch(g){case"s":p=t[n];break;case"c":p=t[n][0];break;case"f":p=parseFloat(t[n]).toFixed(s);break;case"p":p=parseFloat(t[n]).toPrecision(s);break;case"e":p=parseFloat(t[n]).toExponential(s);break;case"x":p=parseInt(t[n]).toString(w||16);break;case"d":p=parseFloat(parseInt(t[n],w||10).toPrecision(s)).toFixed(0);break}p=typeof p=="object"?JSON.stringify(p):(+p).toString(w);let _=parseInt(a),b=a&&a[0]+""=="0"?"0":" ";for(;p.length<_;)p=o!==void 0?p+b:b+p;return p}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return ut.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}se.SHIFT_JIS=V.SJIS.getName(),se.GB2312="GB2312",se.ISO88591=V.ISO8859_1.getName(),se.EUC_JP="EUC_JP",se.UTF8=V.UTF8.getName(),se.PLATFORM_DEFAULT_ENCODING=se.UTF8,se.ASSUME_SHIFT_JIS=!1;class Ie{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=se.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}
2appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class ze{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,t==null&&(t=e),this.height=t,e<1||t<1)throw new N("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new ze(n,t);for(let i=0;i<t;i++){const s=e[i];for(let o=0;o<n;o++)s[o]&&r.set(o,i)}return r}static parseFromString(e,t,n){if(e===null)throw new N("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,s=0,o=-1,a=0,l=0;for(;l<e.length;)if(e.charAt(l)===`
3`||e.charAt(l)==="\r"){if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new N("row lengths do not match");s=i,a++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,r[i]=!0,i++;else if(e.substring(l,l+n.length)===n)l+=n.length,r[i]=!1,i++;else throw new N("illegal character encountered: "+e.substring(l));if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new N("row lengths do not match");a++}const h=new ze(o,a);for(let g=0;g<i;g++)r[g]&&h.set(Math.floor(g%o),Math.floor(g/o));return h}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new N("input matrix dimensions do not match");const t=new fe(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,s=this.height;i<s;i++){const o=i*n,a=e.getRow(i,t).getBitArray();for(let l=0;l<n;l++)r[o+l]^=a[l]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,r){if(t<0||e<0)throw new N("Left and top must be nonnegative");if(r<1||n<1)throw new N("Height and width must be at least 1");const i=e+n,s=t+r;if(s>this.height||i>this.width)throw new N("The region must fit inside the matrix");const o=this.rowSize,a=this.bits;for(let l=t;l<s;l++){const h=l*o;for(let g=e;g<i;g++)a[h+Math.floor(g/32)]|=1<<(g&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new fe(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let s=0;s<n;s++)t.setBulk(s*32,r[i+s]);return t}setRow(e,t){ie.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new fe(e),r=new fe(e);for(let i=0,s=Math.floor((t+1)/2);i<s;i++)n=this.getRow(i,n),r=this.getRow(t-1-i,r),n.reverse(),r.reverse(),this.setRow(i,r),this.setRow(t-1-i,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,s=t,o=-1,a=-1;for(let l=0;l<t;l++)for(let h=0;h<n;h++){const g=r[l*n+h];if(g!==0){if(l<s&&(s=l),l>a&&(a=l),h*32<i){let w=0;for(;(g<<31-w&4294967295)===0;)w++;h*32+w<i&&(i=h*32+w)}if(h*32+31>o){let w=31;for(;g>>>w===0;)w--;h*32+w>o&&(o=h*32+w)}}}return o<i||a<s?null:Int32Array.from([i,s,o-i+1,a-s+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;const r=n/e;let i=n%e*32;const s=t[n];let o=0;for(;(s<<31-o&4294967295)===0;)o++;return i+=o,Int32Array.from([i,r])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&t[n]===0;)n--;if(n<0)return null;const r=Math.floor(n/e);let i=Math.floor(n%e)*32;const s=t[n];let o=31;for(;s>>>o===0;)o--;return i+=o,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof ze))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&we.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+we.hashCode(this.bits),e}toString(e="X ",t="  ",n=`
4`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new Ie;for(let i=0,s=this.height;i<s;i++){for(let o=0,a=this.width;o<a;o++)r.append(this.get(o,i)?e:t);r.append(n)}return r.toString()}clone(){return new ze(this.width,this.height,this.rowSize,this.bits.slice())}}class M extends C{static getNotFoundInstance(){return new M}}M.kind="NotFoundException";class Ze extends re{constructor(e){super(e),this.luminances=Ze.EMPTY,this.buckets=new Int32Array(Ze.LUMINANCE_BUCKETS)}
4getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new fe(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),s=this.buckets;for(let a=0;a<r;a++)s[(i[a]&255)>>Ze.LUMINANCE_SHIFT]++;const o=Ze.estimateBlackPoint(s);if(r<3)for(let a=0;a<r;a++)(i[a]&255)<o&&t.set(a);else{let a=i[0]&255,l=i[1]&255;for(let h=1;h<r-1;h++){const g=i[h+1]&255;(l*4-a-g)/2<o&&t.set(h),a=l,l=g}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new ze(t,n);this.initArrays(t);const i=this.buckets;for(let a=1;a<5;a++){const l=Math.floor(n*a/5),h=e.getRow(l,this.luminances),g=Math.floor(t*4/5);for(let w=Math.floor(t/5);w<g;w++){const p=h[w]&255;i[p>>Ze.LUMINANCE_SHIFT]++}}const s=Ze.estimateBlackPoint(i),o=e.getMatrix();for(let a=0;a<n;a++){const l=a*t;for(let h=0;h<t;h++)(o[l+h]&255)<s&&r.set(h,a)}return r}createBinarizer(e){return new Ze(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<Ze.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let h=0;h<t;h++)e[h]>i&&(r=h,i=e[h]),e[h]>n&&(n=e[h]);let s=0,o=0;for(let h=0;h<t;h++){const g=h-r,w=e[h]*g*g;w>o&&(s=h,o=w)}if(r>s){const h=r;r=s,s=h}if(s-r<=t/16)throw new M;let a=s-1,l=-1;for(let h=s-1;h>r;h--){const g=h-r,w=g*g*(s-h)*(n-e[h]);w>l&&(a=h,l=w)}return a<<Ze.LUMINANCE_SHIFT}}Ze.LUMINANCE_BITS=5,Ze.LUMINANCE_SHIFT=8-Ze.LUMINANCE_BITS,Ze.LUMINANCE_BUCKETS=1<<Ze.LUMINANCE_BITS,Ze.EMPTY=Uint8ClampedArray.from([0]);class le extends Ze{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=le.MINIMUM_DIMENSION&&n>=le.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>le.BLOCK_SIZE_POWER;(t&le.BLOCK_SIZE_MASK)!==0&&i++;let s=n>>le.BLOCK_SIZE_POWER;(n&le.BLOCK_SIZE_MASK)!==0&&s++;const o=le.calculateBlackPoints(r,i,s,t,n),a=new ze(t,n);le.calculateThresholdForBlock(r,i,s,t,n,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new le(e)}static calculateThresholdForBlock(e,t,n,r,i,s,o){const a=i-le.BLOCK_SIZE,l=r-le.BLOCK_SIZE;for(let h=0;h<n;h++){let g=h<<le.BLOCK_SIZE_POWER;g>a&&(g=a);const w=le.cap(h,2,n-3);for(let p=0;p<t;p++){let _=p<<le.BLOCK_SIZE_POWER;_>l&&(_=l);const b=le.cap(p,2,t-3);let S=0;for(let k=-2;k<=2;k++){const U=s[w+k];S+=U[b-2]+U[b-1]+U[b]+U[b+1]+U[b+2]}const D=S/25;le.thresholdBlock(e,_,g,D,r,o)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,s){for(let o=0,a=n*i+t;o<le.BLOCK_SIZE;o++,a+=i)for(let l=0;l<le.BLOCK_SIZE;l++)(e[a+l]&255)<=r&&s.set(t+l,n+o)}static calculateBlackPoints(e,t,n,r,i){const s=i-le.BLOCK_SIZE,o=r-le.BLOCK_SIZE,a=new Array(n);for(let l=0;l<n;l++){a[l]=new Int32Array(t);let h=l<<le.BLOCK_SIZE_POWER;h>s&&(h=s);for(let g=0;g<t;g++){let w=g<<le.BLOCK_SIZE_POWER;w>o&&(w=o);let p=0,_=255,b=0;for(let D=0,k=h*r+w;D<le.BLOCK_SIZE;D++,k+=r){for(let U=0;U<le.BLOCK_SIZE;U++){const F=e[k+U]&255;p+=F,F<_&&(_=F),F>b&&(b=F)}if(b-_>le.MIN_DYNAMIC_RANGE)for(D++,k+=r;D<le.BLOCK_SIZE;D++,k+=r)for(let U=0;U<le.BLOCK_SIZE;U++)p+=e[k+U]&255}let S=p>>le.BLOCK_SIZE_POWER*2;if(b-_<=le.MIN_DYNAMIC_RANGE&&(S=_/2,l>0&&g>0)){const D=(a[l-1][g]+2*a[l][g-1]+a[l-1][g-1])/4;_<D&&(S=D)}a[l][g]=S}}return a}}le.BLOCK_SIZE_POWER=3,le.BLOCK_SIZE=1<<le.BLOCK_SIZE_POWER,le.BLOCK_SIZE_MASK=le.BLOCK_SIZE-1,le.MINIMUM_DIMENSION=le.BLOCK_SIZE*5,le.MIN_DYNAMIC_RANGE=24;class wn{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,r){throw new nn("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new nn("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new nn("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new Ie;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let i=0;i<this.width;i++){const s=r[i]&255;let o;s<64?o="#":s<128?o="+":s<192?o=".":o=" ",t.append(o)}t.append(`
5`)}return t.toString()}}class Ut extends wn{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),r=this.getWidth();for(let i=0;i<r;i++)n[i]=255-(n[i]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(e[r]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new Ut(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Ut(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Ut(this.delegate.rotateCounterClockwise45())}}class Vt extends wn{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=Vt.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return Vt.toGrayscaleBuffer(t.data,e.width,e.height)}
5static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let i=0,s=0,o=e.length;i<o;i+=4,s++){let a;if(e[i+3]===0)a=255;else{const h=e[i],g=e[i+1],w=e[i+2];a=306*h+601*g+117*w+512>>10}r[s]=a}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return t===null?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){const t=this.getTempCanvasElement(),n=t.getContext("2d"),r=e*Vt.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*s),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*s);return t.width=o,t.height=a,n.translate(o/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,s/-2),this.buffer=Vt.makeBufferFromCanvasImageData(t),this}invert(){return new Ut(this)}}Vt.DEGREE_TO_RADIANS=Math.PI/180;class Rr{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var ot=(globalThis||Rn||self||window||void 0)&&(globalThis||Rn||self||window||void 0).__awaiter||function(d,e,t,n){function r(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(h){try{l(n.next(h))}catch(g){s(g)}}function a(h){try{l(n.throw(h))}catch(g){s(g)}}function l(h){h.done?i(h.value):r(h.value).then(o,a)}l((n=n.apply(d,e||[])).next())})};class jt{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return ot(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const r=n.kind==="video"?"videoinput":n.kind;if(r!=="videoinput")continue;const i=n.deviceId||n.id,s=n.label||`Video device ${t.length+1}`,o=n.groupId,a={deviceId:i,label:s,kind:r,groupId:o};t.push(a)}return t})}getVideoInputDevices(){return ot(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new Rr(t.deviceId,t.label))})}findDeviceById(e){return ot(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ot(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ot(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return ot(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return ot(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return ot(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return ot(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const i={video:r};return yield this.decodeFromConstraints(i,t,n)})}
5decodeFromConstraints(e,t,n){return ot(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return ot(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return ot(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return ot(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new y(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new y(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new y("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new y("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new y("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new y("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new y("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new y("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new y("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new y("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return ot(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ot(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const r=(i,s)=>{if(this._stopAsyncDecode){s(new M("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const o=this.decode(e);i(o)}catch(o){const a=t&&o instanceof M,h=(o instanceof W||o instanceof G)&&n;if(a||h)return setTimeout(r,this._timeBetweenDecodingAttempts,i,s);s(o)}};return new Promise((i,s)=>r(i,s))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>
5{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(r){t(null,r);const i=r instanceof W||r instanceof G,s=r instanceof M;(i||s)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return e.videoWidth!==0}drawFrameOnCanvas(e,t,n){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,n=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);const t=this.getCaptureCanvas(e),n=new Vt(t),r=new le(n);return new X(r)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const n=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=n}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){const t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,r;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){!this.videoElement||(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){!this.imageElement||(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class at{constructor(e,t,n=t==null?0:8*t.length,r,i,s=ie.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=s,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=i,this.resultMetadata=null,s==null?this.timestamp=ie.currentTimeMillis():this.timestamp=s}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){const n=new Array(t.length+e.length);ie.arraycopy(t,0,n,0,t.length),ie.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var tr;
5(function(d){d[d.AZTEC=0]="AZTEC",d[d.CODABAR=1]="CODABAR",d[d.CODE_39=2]="CODE_39",d[d.CODE_93=3]="CODE_93",d[d.CODE_128=4]="CODE_128",d[d.DATA_MATRIX=5]="DATA_MATRIX",d[d.EAN_8=6]="EAN_8",d[d.EAN_13=7]="EAN_13",d[d.ITF=8]="ITF",d[d.MAXICODE=9]="MAXICODE",d[d.PDF_417=10]="PDF_417",d[d.QR_CODE=11]="QR_CODE",d[d.RSS_14=12]="RSS_14",d[d.RSS_EXPANDED=13]="RSS_EXPANDED",d[d.UPC_A=14]="UPC_A",d[d.UPC_E=15]="UPC_E",d[d.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(tr||(tr={}));var $=tr,nr;(function(d){d[d.OTHER=0]="OTHER",d[d.ORIENTATION=1]="ORIENTATION",d[d.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",d[d.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",d[d.ISSUE_NUMBER=4]="ISSUE_NUMBER",d[d.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",d[d.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",d[d.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",d[d.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",d[d.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",d[d.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(nr||(nr={}));var je=nr;class Cn{constructor(e,t,n,r,i=-1,s=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=s,this.numBits=e==null?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class An{exp(e){return this.expTable[e]}log(e){if(e===0)throw new N;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class ht{constructor(e,t){if(t.length===0)throw new N;this.field=e;const n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-r),ie.arraycopy(t,r,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);const t=this.coefficients;let n;if(e===1){n=0;for(let s=0,o=t.length;s!==o;s++){const a=t[s];n=An.addOrSubtract(n,a)}return n}n=t[0];const r=t.length,i=this.field;for(let s=1;s<r;s++)n=An.addOrSubtract(i.multiply(e,n),t[s]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const s=t;t=n,n=s}let r=new Int32Array(n.length);const i=n.length-t.length;ie.arraycopy(n,0,r,0,i);for(let s=i;s<n.length;s++)r[s]=An.addOrSubtract(t[s-i],n[s]);return new ht(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,s=new Int32Array(n+i-1),o=this.field;for(let a=0;a<n;a++){const l=t[a];for(let h=0;h<i;h++)s[a+h]=An.addOrSubtract(s[a+h],o.multiply(l,r[h]))}return new ht(o,s)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let s=0;s<t;s++)r[s]=n.multiply(i[s],e);return new ht(n,r)}multiplyByMonomial(e,t){if(e<0)throw new N;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,i=new Int32Array(r+e),s=this.field;for(let o=0;o<r;o++)i[o]=s.multiply(n[o],t);return new ht(s,i)}divide(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do n
5ot have same GenericGF field");if(e.isZero())throw new N("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const i=e.getCoefficient(e.getDegree()),s=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const o=r.getDegree()-e.getDegree(),a=t.multiply(r.getCoefficient(r.getDegree()),s),l=e.multiplyByMonomial(o,a),h=t.buildMonomial(o,a);n=n.addOrSubtract(h),r=r.addOrSubtract(l)}return[n,r]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){const r=this.field.log(n);r===0?e+="1":r===1?e+="a":(e+="a^",e+=r)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class Bn extends C{}Bn.kind="ArithmeticException";class Ce extends An{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let i=1;for(let o=0;o<t;o++)r[o]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;const s=new Int32Array(t);for(let o=0;o<t-1;o++)s[r[o]]=o;this.logTable=s,this.zero=new ht(this,Int32Array.from([0])),this.one=new ht(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new ht(this,n)}inverse(e){if(e===0)throw new Bn;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+Q.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Ce.AZTEC_DATA_12=new Ce(4201,4096,1),Ce.AZTEC_DATA_10=new Ce(1033,1024,1),Ce.AZTEC_DATA_6=new Ce(67,64,1),Ce.AZTEC_PARAM=new Ce(19,16,1),Ce.QR_CODE_FIELD_256=new Ce(285,256,0),Ce.DATA_MATRIX_FIELD_256=new Ce(301,256,1),Ce.AZTEC_DATA_8=Ce.DATA_MATRIX_FIELD_256,Ce.MAXICODE_FIELD_64=Ce.AZTEC_DATA_6;class rn extends C{}rn.kind="ReedSolomonException";class Nt extends C{}Nt.kind="IllegalStateException";class mn{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new ht(n,e),i=new Int32Array(t);let s=!0;for(let p=0;p<t;p++){const _=r.evaluateAt(n.exp(p+n.getGeneratorBase()));i[i.length-1-p]=_,_!==0&&(s=!1)}if(s)return;const o=new ht(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),o,t),l=a[0],h=a[1],g=this.findErrorLocations(l),w=this.findErrorMagnitudes(h,g);for(let p=0;p<g.length;p++){const _=e.length-1-n.log(g[p]);if(_<0)throw new rn("Bad error location");e[_]=Ce.addOrSubtract(e[_],w[p])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const p=e;e=t,t=p}const r=this.field;let i=e,s=t,o=r.getZero(),a=r.getOne();for(;s.getDegree()>=(n/2|0);){let p=i,_=o;if(i=s,o=a,i.isZero())throw new rn("r_{i-1} was zero");s=p;let b=r.getZero();const S=i.getCoefficient(i.getDegree()),D=r.inverse(S);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){const k=s.getDegree()-i.getDegree(),U=r.multiply(s.getCoefficient(s.getDegree()),D);b=b.addOrSubtract(r.buildMonomial(k,U)),s=s.addOrSubtract(i.multiplyByMonomial(k,U))}if(a=b.multiply(o).addOrSubtract(_),s.getDegree()>=i.getDegree())throw new Nt("Division algorithm failed to reduce polynomial?")}const l=a.getCoefficient(0);if(l===0)throw new rn("sigmaTilde(0) was zero");const h=r.inverse(l),g=a.multiplyScalar(h),w=s.multiplyScalar(h);return[g,w]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const i=this.field;for(let s=1;s<i.getSize()&&r<t;s++)e.evaluateAt(s)===0&&(n[r]=i.inverse(s),r++);if(r!==t)throw new rn("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),i=this.field;for(let s=0;s<n;s++){const o=i.inverse(t[s]);let a=1;for(let l=0;l<n;l++)if(s!==l){const h=i.multiply(t[l],o),g=(h&1)===0?h|1:h&-2;a=i.multiply(a,g)}r[s]=i.multiply(e.evaluateAt(o),i.inverse(a)),i.getGeneratorBase()!==0&&(r[s]=i.multiply(r[s],o))}return r}}var Qe;(function(d){d[d.UPPER=0]="UPPER",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.DIGIT=3]="DIGIT",d[d.PUNCT=4]="PUNCT",d[d.BINARY=5]="BINARY"})(Qe||(Qe={}));class Oe{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),i=Oe.convertBoolArrayToByteArray(r),s=Oe.getEncodedData(r),o=new Cn(i,s,null,null);return o.setNumBits(r.length),o}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=Qe.UPPER,r=Qe.UPPER,i="",s=0;for(;s<t;)if(r===Qe.BINARY){if(t-s<5)break;let o=Oe.readCode(e,s,5);if(s+=5,o===0){if(t-s<11)break;o=Oe.readCode(e,s,11)+31,s+=11}for(let a=0;a<o;a++){if(t-s<8){s=t;break}const l=Oe.readCode(e,s,8);i+=se.castAsNonUtf8Char(l),s+=8}r=n}else{let o=r===Qe.DIGIT?4:5;if(t-s<o)break;let a=Oe.readCode(e,s,o);s+=o;let l=Oe.getCharacter(r,a);
5l.startsWith("CTRL_")?(n=r,r=Oe.getTable(l.charAt(5)),l.charAt(6)==="L"&&(n=r)):(i+=l,r=n)}return i}static getTable(e){switch(e){case"L":return Qe.LOWER;case"P":return Qe.PUNCT;case"M":return Qe.MIXED;case"D":return Qe.DIGIT;case"B":return Qe.BINARY;case"U":default:return Qe.UPPER}}static getCharacter(e,t){switch(e){case Qe.UPPER:return Oe.UPPER_TABLE[t];case Qe.LOWER:return Oe.LOWER_TABLE[t];case Qe.MIXED:return Oe.MIXED_TABLE[t];case Qe.PUNCT:return Oe.PUNCT_TABLE[t];case Qe.DIGIT:return Oe.DIGIT_TABLE[t];default:throw new Nt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Ce.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Ce.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Ce.AZTEC_DATA_10):(n=12,t=Ce.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),i=e.length/n;if(i<r)throw new G;let s=e.length%n,o=new Int32Array(i);for(let w=0;w<i;w++,s+=n)o[w]=Oe.readCode(e,s,n);try{new mn(t).decode(o,i-r)}catch(w){throw new G(w)}let a=(1<<n)-1,l=0;for(let w=0;w<r;w++){let p=o[w];if(p===0||p===a)throw new G;(p===1||p===a-1)&&l++}let h=new Array(r*n-l),g=0;for(let w=0;w<r;w++){let p=o[w];if(p===1||p===a-1)h.fill(p>1,g,g+n-1),g+=n-1;else for(let _=n-1;_>=0;--_)h[g++]=(p&1<<_)!==0}return h}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,i=new Int32Array(r),s=new Array(this.totalBitsInLayer(n,t));if(t)for(let o=0;o<i.length;o++)i[o]=o;else{let o=r+1+2*Q.truncDivision(Q.truncDivision(r,2)-1,15),a=r/2,l=Q.truncDivision(o,2);for(let h=0;h<a;h++){let g=h+Q.truncDivision(h,15);
vendor: 6,722 bytes, lines 5-7
5i[a-h-1]=l-g-1,i[a+h]=l+g+1}}for(let o=0,a=0;o<n;o++){let l=(n-o)*4+(t?9:12),h=o*2,g=r-1-h;for(let w=0;w<l;w++){let p=w*2;for(let _=0;_<2;_++)s[a+p+_]=e.get(i[h+_],i[h+w]),s[a+2*l+p+_]=e.get(i[h+w],i[g-_]),s[a+4*l+p+_]=e.get(i[g-_],i[g-w]),s[a+6*l+p+_]=e.get(i[g-w],i[h+_])}a+=l*8}return s}static readCode(e,t,n){let r=0;for(let i=t;i<t+n;i++)r<<=1,e[i]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?Oe.readCode(e,t,8):Oe.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=Oe.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Oe.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],Oe.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],Oe.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","	",`
6`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Oe.PUNCT_TABLE=["","\r",`\r
7`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Oe.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ge{constructor(){}static round(e){return e===NaN?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,r){const i=e-n,s=t-r;return Math.sqrt(i*i+s*s)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++){const i=e[n];t+=i}return t}}class Pn{static floatToIntBits(e){return e}}Pn.MAX_VALUE=Number.MAX_SAFE_INTEGER;class j{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof j){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*Pn.floatToIntBits(this.x)+Pn.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),r=this.distance(e[0],e[2]);let i,s,o;if(n>=t&&n>=r?(s=e[0],i=e[1],o=e[2]):r>=n&&r>=t?(s=e[1],i=e[0],o=e[2]):(s=e[2],i=e[0],o=e[1]),this.crossProductZ(i,s,o)<0){const a=i;i=o,o=a}e[0]=i,e[1]=s,e[2]=o}static distance(e,t){return ge.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}class Ln{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Or extends Ln{constructor(e,t,n,r,i){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Lt{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=Lt.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),r==null&&(r=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=n-i,this.rightInit=n+i,this.upInit=r-i,this.downInit=r+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new M}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,i=!1,s=!0,o=!1,a=!1,l=!1,h=!1,g=!1;const w=this.width,p=this.height;for(;s;){s=!1;let _=!0;for(;(_||!a)&&t<w;)_=this.containsBlackPoint(n,r,t,!1),_?(t++,s=!0,a=!0):a||t++;if(t>=w){i=!0;break}let b=!0;for(;(b||!l)&&r<p;)b=this.containsBlackPoint(e,t,r,!0),b?(r++,s=!0,l=!0):l||r++;if(r>=p){i=!0;break}let S=!0;for(;(S||!h)&&e>=0;)S=this.containsBlackPoint(n,r,e,!1),S?(e--,s=!0,h=!0):h||e--;if(e<0){i=!0;break}let D=!0;for(;(D||!g)&&n>=0;)D=this.containsBlackPoint(e,t,n,!0),D?(n--,s=!0,g=!0):g||n--;if(n<0){i=!0;break}s&&(o=!0)}if(!i&&o){const _=t-e;let b=null;for(let U=1;b===null&&U<_;U++)b=this.getBlackPointOnSegment(e,r-U,e+U,r);if(b==null)throw new M;let S=null;for(let U=1;S===null&&U<_;U++)S=this.getBlackPointOnSegment(e,n+U,e+U,n);if(S==null)throw new M;let D=null;for(let U=1;D===null&&U<_;U++)D=this.getBlackPointOnSegment(t,n+U,t-U,n);if(D==null)throw new M;let k=null;for(let U=1;k===null&&U<_;U++)k=this.getBlackPointOnSegment(t,r-U,t-U,r);if(k==null)throw new M;return this.centerEdges(k,b,D,S)}else throw new M}getBlackPointOnSegment(e,t,n,r){const i=ge.round(ge.distance(e,t,n,r)),s=(n-e)/i,o=(r-t)/i,a=this.image;for(let l=0;l<i;l++){const h=ge.round(e+l*s),g=ge.round(t+l*o);if(a.get(h,g))return new j(h,g)}return null}centerEdges(e,t,n,r){const i=e.getX(),s=e.getY(),o=t.getX(),a=t.getY(),l=n.getX(),h=n.getY(),g=r.getX(),w=r.getY(),p=Lt.CORR;return i<this.width/2?[new j(g-p,w+p),new j(o+p,a+p),new j(l-p,h-p),new j(i+p,s-p)]:[new j(g+p,w+p),new j(o+p,a-p),new j(l-p,h+p),new j(i-p,s-p)]}containsBlackPoint(e,t,n,r){const i=this.image;if(r){for(let s=e;s<=t;s++)if(i.get(s,n))return!0}else for(let s=e;s<=t;s++)if(i.get(n,s))return!0;return!1}}Lt.INIT_SIZE=10,Lt.CORR=1;class rr{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let i=!0;for(let s=0;s<t.length&&i;s+=2){const o=Math.floor(t[s]),a=Math.floor(t[s+1]);if(o<-1||o>n||a<-1||a>r)throw new M;i=!1,o===-1?(t[s]=0,i=!0):o===n&&(t[s]=n-1,i=!0),a===-1?(t[s+1]=0,i=!0):a===r&&(t[s+1]=r-1,i=!0)}i=!0;for(let s=t.length-2;s>=0&&i;s-=2){const o=Math.floor(t[s]),a=Math.floor(t[s+1]);if(o<-1||o>n||a<-1||a>r)throw new M;i=!1,o===-1?(t[s]=0,i=!0):o===n&&(t[s]=n-1,i=!0),a===-1?(t[s+1]=0,i=!0):a===r&&(t[s+1]=r-1,i=!0)}}}class yt{constructor(e,t,n,r,i,s,o,a,l){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=i,this.a32=s,this.a13=o,this.a23=a,this.a33=l}static quadrilateralToQuadrilateral(e,t,n,r,i,s,o,a,l,h,g,w,p,_,b,S){const D=yt.quadrilateralToSquare(e,t,n,r,i,s,o,a);return yt.squareToQuadrilateral(l,h,g,w,p,_,b,S).times(D)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,i=this.a13,s=this.a21,o=this.a22,a=this.a23,l=this.a31,h=this.a32,g=this.a33;for(let w=0;w<t;w+=2){const p=e[w],_=e[w+1],b=i*p+a*_+g;e[w]=(n*p+s*_+l)/b,e[w+1]=(r*p+o*_+h)/b}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,i=this.a13,s=this.a21,o=this.a22,a=this.a23,l=this.a31,h=this.a32,g=this.a33,w=e.length;for(let p=0;p<w;p++){const _=e[p],b=t[p],S=i*_+a*b+g;e[p]=(n*_+s*b+l)/S,t[p]=(r*_+o*b+h)/S}}static squareToQuadrilateral(e,t,n,r,i,s,o,a){const l=e-n+i-o,h=t-r+s-a;if(l===0&&h===0)return new yt(n-e,i-n,e,r-t,s-r,t,0,0,1);{const g=n-i,w=o-i,p=r-s,_=a-s,b=g*_-w*p,S=(l*_-w*h)/b,D=(g*h-l*p)/b;return new yt(n-e+S*n,o-e+D*o,e,r-t+S*r,a-t+D*a,t,S,D,1)}}static quadrilateralToSquare(e,t,n,r,i,s,o,a){return yt.squareToQuadrilateral(e,t,n,r,i,s,o,a).buildAdjoint(
7)}buildAdjoint(){return new yt(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new yt(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class vr extends rr{sampleGrid(e,t,n,r,i,s,o,a,l,h,g,w,p,_,b,S,D,k,U){const F=yt.quadrilateralToQuadrilateral(r,i,s,o,a,l,h,g,w,p,_,b,S,D,k,U);return this.sampleGridWithTransform(e,t,n,F)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new M;const i=new ze(t,n),s=new Float32Array(2*t);for(let o=0;o<n;o++){const a=s.length,l=o+.5;for(let h=0;h<a;h+=2)s[h]=h/2+.5,s[h+1]=l;r.transformPoints(s),rr.checkAndNudgePoints(e,s);try{for(let h=0;h<a;h+=2)e.get(Math.floor(s[h]),Math.floor(s[h+1]))&&i.set(h/2,o)}catch{throw new M}}return i}}class Gt{static setGridSampler(e){Gt.gridSampler=e}static getInstance(){return Gt.gridSampler}}Gt.gridSampler=new vr;class lt{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new j(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Dr{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){let s=n[0];n[0]=n[2],n[2]=s}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),i=this.getMatrixCornerPoints(n);return new Or(r,i,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new M;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let r=0;for(let s=0;s<4;s++){let o=n[(this.shift+s)%4];this.compact?(r<<=7,r+=o>>1&127):(r<<=10,r+=(o>>2&31<<5)+(o>>1&31))}let i=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=(i>>6)+1,this.nbDataBlocks=(i&63)+1):(this.nbLayers=(i>>11)+1,this.nbDataBlocks=(i&2047)+1)}getRotation(e,t){let n=0;e.forEach((r,i,s)=>{let o=(r>>t-2<<1)+(r&1);n=(n<<3)+o}),n=((n&1)<<11)+(n>>1);for(let r=0;r<4;r++)if(Q.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new M}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let i=n-r,s=new Int32Array(n);for(let a=n-1;a>=0;--a)s[a]=e&15,e>>=4;try{new mn(Ce.AZTEC_PARAM).decode(s,i)}catch{throw new M}let o=0;for(let a=0;a<r;a++)o=(o<<4)+s[a];return o}getBullsEyeCorners(e){let t=e,n=e,r=e,i=e,s=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let g=this.getFirstDifferent(t,s,1,-1),w=this.getFirstDifferent(n,s,1,1),p=this.getFirstDifferent(r,s,-1,1),_=this.getFirstDifferent(i,s,-1,-1);if(this.nbCenterLayers>2){let b=this.distancePoint(_,g)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(b<.75||b>1.25||!this.isWhiteOrBlackRectangle(g,w,p,_))break}t=g,n=w,r=p,i=_,s=!s}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new M;this.compact=this.nbCenterLayers===5;let o=new j(t.getX()+.5,t.getY()-.5),a=new j(n.getX()+.5,n.getY()+.5),l=new j(r.getX()-.5,r.getY()+.5),h=new j(i.getX()-.5,i.getY()-.5);return this.expandSquare([o,a,l,h],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let o=new Lt(this.image).detect();e=o[0],t=o[1],n=o[2],r=o[3]}catch{let a=this.image.getWidth()/2,l=this.image.getHeight()/2;e=this.getFirstDifferent(new lt(a+7,l-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new lt(a+7,l+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new lt(a-7,l+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new lt(a-7,l-7),!1,-1,-1).toResultPoint()}let i=ge.round((e.getX()+r.getX()+t.getX()+n.getX())/4),s=ge.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let o=new Lt(this.image,15,i,s).detect();e=o[0],t=o[1],n=o[2],r=o[3]}catch{e=this.getFirstDifferent(new lt(i+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new lt(i+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new lt(i-7,s+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new lt(i-7,s-7
7),!1,-1,-1).toResultPoint()}return i=ge.round((e.getX()+r.getX()+t.getX()+n.getX())/4),s=ge.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new lt(i,s)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,i){let s=Gt.getInstance(),o=this.getDimension(),a=o/2-this.nbCenterLayers,l=o/2+this.nbCenterLayers;return s.sampleGrid(e,o,o,a,a,l,a,l,l,a,l,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),i.getX(),i.getY())}sampleLine(e,t,n){let r=0,i=this.distanceResultPoint(e,t),s=i/n,o=e.getX(),a=e.getY(),l=s*(t.getX()-e.getX())/i,h=s*(t.getY()-e.getY())/i;for(let g=0;g<n;g++)this.image.get(ge.round(o+g*l),ge.round(a+g*h))&&(r|=1<<n-g-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let i=3;e=new lt(e.getX()-i,e.getY()+i),t=new lt(t.getX()-i,t.getY()-i),n=new lt(n.getX()+i,n.getY()-i),r=new lt(r.getX()+i,r.getY()+i);let s=this.getColor(r,e);if(s===0)return!1;let o=this.getColor(e,t);return o!==s||(o=this.getColor(t,n),o!==s)?!1:(o=this.getColor(n,r),o===s)}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,i=(t.getY()-e.getY())/n,s=0,o=e.getX(),a=e.getY(),l=this.image.get(e.getX(),e.getY()),h=Math.ceil(n);for(let w=0;w<h;w++)o+=r,a+=i,this.image.get(ge.round(o),ge.round(a))!==l&&s++;let g=s/n;return g>.1&&g<.9?0:g<=.1===l?1:-1}getFirstDifferent(e,t,n,r){let i=e.getX()+n,s=e.getY()+r;for(;this.isValid(i,s)&&this.image.get(i,s)===t;)i+=n,s+=r;for(i-=n,s-=r;this.isValid(i,s)&&this.image.get(i,s)===t;)i+=n;for(i-=n;this.isValid(i,s)&&this.image.get(i,s)===t;)s+=r;return s-=r,new lt(i,s)}expandSquare(e,t,n){let r=n/(2*t),i=e[0].getX()-e[2].getX(),s=e[0].getY()-e[2].getY(),o=(e[0].getX()+e[2].getX())/2,a=(e[0].getY()+e[2].getY())/2,l=new j(o+r*i,a+r*s),h=new j(o-r*i,a-r*s);i=e[1].getX()-e[3].getX(),s=e[1].getY()-e[3].getY(),o=(e[1].getX()+e[3].getX())/2,a=(e[1].getY()+e[3].getY())/2;let g=new j(o+r*i,a+r*s),w=new j(o-r*i,a-r*s);return[l,g,h,w]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ge.round(e.getX()),n=ge.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ge.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ge.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(Q.truncDivision(this.nbLayers-4,8)+1)+15}}class Fn{decode(e,t=null){let n=null,r=new Dr(e.getBlackMatrix()),i=null,s=null;try{let h=r.detectMirror(!1);i=h.getPoints(),this.reportFoundResultPoints(t,i),s=new Oe().decode(h)}catch(h){n=h}if(s==null)try{let h=r.detectMirror(!0);i=h.getPoints(),this.reportFoundResultPoints(t,i),s=new Oe().decode(h)}catch(h){throw n!=null?n:h}let o=new at(s.getText(),s.getRawBytes(),s.getNumBits(),i,$.AZTEC,ie.currentTimeMillis()),a=s.getByteSegments();a!=null&&o.putMetadata(je.BYTE_SEGMENTS,a);let l=s.getECLevel();return l!=null&&o.putMetadata(je.ERROR_CORRECTION_LEVEL,l),o}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(be.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,i,s)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class pi extends jt{constructor(e=500){super(new Fn,e)}}class He{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(be.TRY_HARDER)===!0&&e.isRotateSupported()){const i=e.rotateCounterClockwise(),s=this.doDecode(i,t),o=s.getResultMetadata();let a=270;o!==null&&o.get(je.ORIENTATION)===!0&&(a=a+o.get(je.ORIENTATION)%360),s.putMetadata(je.ORIENTATION,a);const l=s.getResultPoints();if(l!==null){const h=i.getHeight();for(let g=0;g<l.length;g++)l[g]=new j(h-l[g].getY()-1,l[g].getX())}return s}else throw new M}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let i=new fe(n);const s=t&&t.get(be.TRY_HARDER)===!0,o=Math.max(1,r>>(s?8:5));let a;s?a=r:a=15;const l=Math.trunc(r/2);for(let h=0;h<a;h++){const g=Math.trunc((h+1)/2),w=(h&1)===0,p=l+o*(w?g:-g);if(p<0||p>=r)break;try{i=e.getBlackRow(p,i)}catch{continue}for(let _=0;_<2;_++){if(_===1&&(i.reverse(),t&&t.get(be.NEED_RESULT_POINT_CALLBACK)===!0)){const b=new Map;t.forEach((S,D)=>b.set(D,S)),b.delete(be.NEED_RESULT_POINT_CALLBACK),t=b}try{const b=this.decodeRow(p,i,t);
7if(_===1){b.putMetadata(je.ORIENTATION,180);const S=b.getResultPoints();S!==null&&(S[0]=new j(n-S[0].getX()-1,S[0].getY()),S[1]=new j(n-S[1].getX()-1,S[1].getY()))}return b}catch{}}}throw new M}static recordPattern(e,t,n){const r=n.length;for(let l=0;l<r;l++)n[l]=0;const i=e.getSize();if(t>=i)throw new M;let s=!e.get(t),o=0,a=t;for(;a<i;){if(e.get(a)!==s)n[o]++;else{if(++o===r)break;n[o]=1,s=!s}a++}if(!(o===r||o===r-1&&a===i))throw new M}static recordPatternInReverse(e,t,n){let r=n.length,i=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==i&&(r--,i=!i);if(r>=0)throw new M;He.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let i=0,s=0;for(let l=0;l<r;l++)i+=e[l],s+=t[l];if(i<s)return Number.POSITIVE_INFINITY;const o=i/s;n*=o;let a=0;for(let l=0;l<r;l++){const h=e[l],g=t[l]*o,w=h>g?h-g:g-h;if(w>n)return Number.POSITIVE_INFINITY;a+=w}return a/i}}class H extends He{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,i=Int32Array.from([0,0,0,0,0,0]),s=n,o=!1;const a=6;for(let l=n;l<t;l++)if(e.get(l)!==o)i[r]++;else{if(r===a-1){let h=H.MAX_AVG_VARIANCE,g=-1;for(let w=H.CODE_START_A;w<=H.CODE_START_C;w++){const p=He.patternMatchVariance(i,H.CODE_PATTERNS[w],H.MAX_INDIVIDUAL_VARIANCE);p<h&&(h=p,g=w)}if(g>=0&&e.isRange(Math.max(0,s-(l-s)/2),s,!1))return Int32Array.from([s,l,g]);s+=i[0]+i[1],i=i.slice(2,i.length-1),i[r-1]=0,i[r]=0,r--}else r++;i[r]=1,o=!o}throw new M}static decodeCode(e,t,n){He.recordPattern(e,n,t);let r=H.MAX_AVG_VARIANCE,i=-1;for(let s=0;s<H.CODE_PATTERNS.length;s++){const o=H.CODE_PATTERNS[s],a=this.patternMatchVariance(t,o,H.MAX_INDIVIDUAL_VARIANCE);a<r&&(r=a,i=s)}if(i>=0)return i;throw new M}decodeRow(e,t,n){const r=n&&n.get(be.ASSUME_GS1)===!0,i=H.findStartPattern(t),s=i[2];let o=0;const a=new Uint8Array(20);a[o++]=s;let l;switch(s){case H.CODE_START_A:l=H.CODE_CODE_A;break;case H.CODE_START_B:l=H.CODE_CODE_B;break;case H.CODE_START_C:l=H.CODE_CODE_C;break;default:throw new G}let h=!1,g=!1,w="",p=i[0],_=i[1];const b=Int32Array.from([0,0,0,0,0,0]);let S=0,D=0,k=s,U=0,F=!0,he=!1,ae=!1;for(;!h;){const dn=g;switch(g=!1,S=D,D=H.decodeCode(t,b,_),a[o++]=D,D!==H.CODE_STOP&&(F=!0),D!==H.CODE_STOP&&(U++,k+=U*D),p=_,_+=b.reduce((qi,Qi)=>qi+Qi,0),D){case H.CODE_START_A:case H.CODE_START_B:case H.CODE_START_C:throw new G}switch(l){case H.CODE_CODE_A:if(D<64)ae===he?w+=String.fromCharCode(" ".charCodeAt(0)+D):w+=String.fromCharCode(" ".charCodeAt(0)+D+128),ae=!1;else if(D<96)ae===he?w+=String.fromCharCode(D-64):w+=String.fromCharCode(D+64),ae=!1;else switch(D!==H.CODE_STOP&&(F=!1),D){case H.CODE_FNC_1:r&&(w.length===0?w+="]C1":w+=String.fromCharCode(29));break;case H.CODE_FNC_2:case H.CODE_FNC_3:break;case H.CODE_FNC_4_A:!he&&ae?(he=!0,ae=!1):he&&ae?(he=!1,ae=!1):ae=!0;break;case H.CODE_SHIFT:g=!0,l=H.CODE_CODE_B;break;case H.CODE_CODE_B:l=H.CODE_CODE_B;break;case H.CODE_CODE_C:l=H.CODE_CODE_C;break;case H.CODE_STOP:h=!0;break}break;case H.CODE_CODE_B:if(D<96)ae===he?w+=String.fromCharCode(" ".charCodeAt(0)+D):w+=String.fromCharCode(" ".charCodeAt(0)+D+128),ae=!1;else switch(D!==H.CODE_STOP&&(F=!1),D){case H.CODE_FNC_1:r&&(w.length===0?w+="]C1":w+=String.fromCharCode(29));break;case H.CODE_FNC_2:case H.CODE_FNC_3:break;case H.CODE_FNC_4_B:!he&&ae?(he=!0,ae=!1):he&&ae?(he=!1,ae=!1):ae=!0;break;case H.CODE_SHIFT:g=!0,l=H.CODE_CODE_A;break;case H.CODE_CODE_A:l=H.CODE_CODE_A;break;case H.CODE_CODE_C:l=H.CODE_CODE_C;break;case H.CODE_STOP:h=!0;break}break;case H.CODE_CODE_C:if(D<100)D<10&&(w+="0"),w+=D;else switch(D!==H.CODE_STOP&&(F=!1),D){case H.CODE_FNC_1:r&&(w.length===0?w+="]C1":w+=String.fromCharCode(29));break;case H.CODE_CODE_A:l=H.CODE_CODE_A;break;case H.CODE_CODE_B:l=H.CODE_CODE_B;break;case H.CODE_STOP:h=!0;break}break}dn&&(l=l===H.CODE_CODE_A?H.CODE_CODE_B:H.CODE_CODE_A)}const xt=_-p;if(_=t.getNextUnset(_),!t.isRange(_,Math.min(t.getSize(),_+(_-p)/2),!1))throw new M;if(k-=U*S,k%103!==S)throw new W;const Tt=w.length;if(Tt===0)throw new M;Tt>0&&F&&(l===H.CODE_CODE_C?w=w.substring(0,Tt-2):w=w.substring(0,Tt-1));const wt=(i[1]+i[0])/2,Ne=p+xt/2,et=a.length,At=new Uint8Array(et);for(let dn=0;dn<et;dn++)At[dn]=a[dn];const fn=[new j(wt,e),new j(Ne,e)];return new at(w,At,0,fn,$.CODE_128,new Date().getTime())}}H.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],H.MAX_AVG_VARIANCE=.25,H.MAX_INDIVIDUAL_VARIA
7NCE=.7,H.CODE_SHIFT=98,H.CODE_CODE_C=99,H.CODE_CODE_B=100,H.CODE_CODE_A=101,H.CODE_FNC_1=102,H.CODE_FNC_2=97,H.CODE_FNC_3=96,H.CODE_FNC_4_A=101,H.CODE_FNC_4_B=100,H.CODE_START_A=103,H.CODE_START_B=104,H.CODE_START_C=105,H.CODE_STOP=106;class We extends He{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let i=We.findAsteriskPattern(t,r),s=t.getNextSet(i[1]),o=t.getSize(),a,l;do{We.recordPattern(t,s,r);let b=We.toNarrowWidePattern(r);if(b<0)throw new M;a=We.patternToChar(b),this.decodeRowResult+=a,l=s;for(let S of r)s+=S;s=t.getNextSet(s)}while(a!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let h=0;for(let b of r)h+=b;let g=s-l-h;if(s!==o&&g*2<h)throw new M;if(this.usingCheckDigit){let b=this.decodeRowResult.length-1,S=0;for(let D=0;D<b;D++)S+=We.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(D));if(this.decodeRowResult.charAt(b)!==We.ALPHABET_STRING.charAt(S%43))throw new W;this.decodeRowResult=this.decodeRowResult.substring(0,b)}if(this.decodeRowResult.length===0)throw new M;let w;this.extendedMode?w=We.decodeExtended(this.decodeRowResult):w=this.decodeRowResult;let p=(i[1]+i[0])/2,_=l+h/2;return new at(w,null,0,[new j(p,e),new j(_,e)],$.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),i=0,s=r,o=!1,a=t.length;for(let l=r;l<n;l++)if(e.get(l)!==o)t[i]++;else{if(i===a-1){if(this.toNarrowWidePattern(t)===We.ASTERISK_ENCODING&&e.isRange(Math.max(0,s-Math.floor((l-s)/2)),s,!1))return[s,l];s+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,o=!o}throw new M}static toNarrowWidePattern(e){let t=e.length,n=0,r;do{let i=2147483647;for(let a of e)a<i&&a>n&&(i=a);n=i,r=0;let s=0,o=0;for(let a=0;a<t;a++){let l=e[a];l>n&&(o|=1<<t-1-a,r++,s+=l)}if(r===3){for(let a=0;a<t&&r>0;a++){let l=e[a];if(l>n&&(r--,l*2>=s))return-1}return o}}while(r>3);return-1}static patternToChar(e){for(let t=0;t<We.CHARACTER_ENCODINGS.length;t++)if(We.CHARACTER_ENCODINGS[t]===e)return We.ALPHABET_STRING.charAt(t);if(e===We.ASTERISK_ENCODING)return"*";throw new M}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let i=e.charAt(r);if(i==="+"||i==="$"||i==="%"||i==="/"){let s=e.charAt(r+1),o="\0";switch(i){case"+":if(s>="A"&&s<="Z")o=String.fromCharCode(s.charCodeAt(0)+32);else throw new G;break;case"$":if(s>="A"&&s<="Z")o=String.fromCharCode(s.charCodeAt(0)-64);else throw new G;break;case"%":if(s>="A"&&s<="E")o=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")o=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")o=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")o=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")o="\0";else if(s==="V")o="@";else if(s==="W")o="`";else if(s==="X"||s==="Y"||s==="Z")o="\x7F";else throw new G;break;case"/":if(s>="A"&&s<="O")o=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")o=":";else throw new G;break}n+=o,r++}else n+=i}return n}}We.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",We.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],We.ASTERISK_ENCODING=148;class Se extends He{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),i=this.decodeEnd(t),s=new Ie;Se.decodeMiddle(t,r[1],i[0],s);let o=s.toString(),a=null;n!=null&&(a=n.get(be.ALLOWED_LENGTHS)),a==null&&(a=Se.DEFAULT_ALLOWED_LENGTHS);let l=o.length,h=!1,g=0;for(let _ of a){if(l===_){h=!0;break}_>g&&(g=_)}if(!h&&l>g&&(h=!0),!h)throw new G;const w=[new j(r[1],e),new j(i[0],e)];return new at(o,null,0,w,$.ITF,new Date().getTime())}static decodeMiddle(e,t,n,r){let i=new Int32Array(10),s=new Int32Array(5),o=new Int32Array(5);for(i.fill(0),s.fill(0),o.fill(0);t<n;){He.recordPattern(e,t,i);for(let l=0;l<5;l++){let h=2*l;s[l]=i[h],o[l]=i[h+1]}let a=Se.decodeDigit(s);r.append(a.toString()),a=this.decodeDigit(o),r.append(a.toString()),i.forEac
vendor: 11,063 bytes, line 7
7h(function(l){t+=l})}}decodeStart(e){let t=Se.skipWhiteSpace(e),n=Se.findGuardPattern(e,t,Se.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=this.narrowLineWidth*10;n=n<t?n:t;for(let r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(n!==0)throw new M}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new M;return n}decodeEnd(e){e.reverse();try{let t=Se.skipWhiteSpace(e),n;try{n=Se.findGuardPattern(e,t,Se.END_PATTERN_REVERSED[0])}catch(i){i instanceof M&&(n=Se.findGuardPattern(e,t,Se.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let r=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-r,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,i=new Int32Array(r),s=e.getSize(),o=!1,a=0,l=t;i.fill(0);for(let h=t;h<s;h++)if(e.get(h)!==o)i[a]++;else{if(a===r-1){if(He.patternMatchVariance(i,n,Se.MAX_INDIVIDUAL_VARIANCE)<Se.MAX_AVG_VARIANCE)return[l,h];l+=i[0]+i[1],ie.arraycopy(i,2,i,0,a-1),i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,o=!o}throw new M}static decodeDigit(e){let t=Se.MAX_AVG_VARIANCE,n=-1,r=Se.PATTERNS.length;for(let i=0;i<r;i++){let s=Se.PATTERNS[i],o=He.patternMatchVariance(e,s,Se.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,n=i):o===t&&(n=-1)}if(n>=0)return n%10;throw new M}}Se.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Se.MAX_AVG_VARIANCE=.38,Se.MAX_INDIVIDUAL_VARIANCE=.5,Se.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Se.START_PATTERN=Int32Array.from([1,1,1,1]),Se.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Le extends He{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,r=0,i=Int32Array.from([0,0,0]);for(;!t;){i=Int32Array.from([0,0,0]),n=Le.findGuardPattern(e,r,!1,this.START_END_PATTERN,i);let s=n[0];r=n[1];let o=s-(r-s);o>=0&&(t=e.isRange(o,s,!1))}return n}static checkChecksum(e){return Le.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Le.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(i<0||i>9)throw new G;n+=i}n*=3;for(let r=t-2;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(i<0||i>9)throw new G;n+=i}return(1e3-n)%10}static decodeEnd(e,t){return Le.findGuardPattern(e,t,!1,Le.START_END_PATTERN,new Int32Array(Le.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,i){let s=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let o=0,a=t,l=r.length,h=n;for(let g=t;g<s;g++)if(e.get(g)!==h)i[o]++;else{if(o===l-1){if(He.patternMatchVariance(i,r,Le.MAX_INDIVIDUAL_VARIANCE)<Le.MAX_AVG_VARIANCE)return Int32Array.from([a,g]);a+=i[0]+i[1];let w=i.slice(2,i.length-1);for(let p=0;p<o-1;p++)i[p]=w[p];i[o-1]=0,i[o]=0,o--}else o++;i[o]=1,h=!h}throw new M}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let i=this.MAX_AVG_VARIANCE,s=-1,o=r.length;for(let a=0;a<o;a++){let l=r[a],h=He.patternMatchVariance(t,l,Le.MAX_INDIVIDUAL_VARIANCE);h<i&&(i=h,s=a)}if(s>=0)return s;throw new M}}Le.MAX_AVG_VARIANCE=.48,Le.MAX_INDIVIDUAL_VARIANCE=.7,Le.START_END_PATTERN=Int32Array.from([1,1,1]),Le.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Le.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Le.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class En{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),s=r.toString(),o=En.parseExtensionString(s),a=[new j((n[0]+n[1])/2,e),new j(i,e)],l=new at(s,null,0,a,$.UPC_EAN_EXTENSION,new Date().getTime());return o!=null&&l.putAllMetadata(o),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1],o=0;for(let l=0;l<5&&s<i;l++){let h=Le.decodeDigit(e,r,s,Le.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+h%10);for(let g of r)s+=g;h>=10&&(o|=1<<4-l),l!==4&&(s=e.getNextSet(s),s=e.getNextUnset(s))}if(n.length!==5)throw new M;let a=this.determineCheckDigit(o);if(En.extensionChecksum(n.toString())!==a)throw new M;return s}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new M}static parseExtensionString(e){if(e.length!==5)return null;let t=En.parseExtension5String(e);return t==null?null:new Map([[je.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="\xA3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}let n=parseInt(e.substring(1)),r=(n/100).toString(),i=n%100,s=i<10?"0"+i:i.toString();return t+r+"."+s}}class ir{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),s=r.toString(),o=ir.parseExtensionString(s),a=[new j((n[0]+n[1])/2,e),new j(i,e)],l=new at(s,null,0,a,$.UPC_EAN_EXTENSION,new Date().getTime());return o!=null&&l.putAllMetadata(o),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1],o=0;for(let a=0;a<2&&s<i;a++){let l=Le.decodeDigit(e,r,s,Le.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+l%10);for(let h of r)s+=h;l>=10&&(o|=1<<1-a),a!==1&&(s=e.getNextSet(s),s=e.getNextUnset(s))}if(n.length!==2)throw new M;if(parseInt(n.toString())%4!==o)throw new M;return s}static parseExtensionString(e){return e.length!==2?null:new Map([[je.ISSUE_NUMBER,parseInt(e)]])}}class Mr{static decodeRow(e,t,n){let r=Le.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new En().decodeRow(e,t,r)}catch{return new ir().decodeRow(e,t,r)}}}Mr.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ae extends Le{constructor(){super(),this.decodeRowStringBuffer="",Ae.L_AND_G_PATTERNS=Ae.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Ae.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];Ae.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=Ae.findStartGuardPattern(t),i=n==null?null:n.get(be.NEED_RESULT_POINT_CALLBACK);if(i!=null){const F=new j((r[0]+r[1])/2,e);i.foundPossibleResultPoint(F)}let s=this.decodeMiddle(t,r,this.decodeRowStringBuffer),o=s.rowOffset,a=s.resultString;if(i!=null){const F=new j(o,e);i.foundPossibleResultPoint(F)}let l=this.decodeEnd(t,o);if(i!=null){const F=new j((l[0]+l[1])/2,e);i.foundPossibleResultPoint(F)}let h=l[1],g=h+(h-l[0]);if(g>=t.getSize()||!t.isRange(h,g,!1))throw new M;let w=a.toString();if(w.length<8)throw new G;if(!Ae.checkChecksum(w))throw new W;let p=(r[1]+r[0])/2,_=(l[1]+l[0])/2,b=this.getBarcodeFormat(),S=[new j(p,e),new j(_,e)],D=new at(w,null,0,S,b,new Date().getTime()),k=0;try{let F=Mr.decodeRow(e,t,l[1]);D.putMetadata(je.UPC_EAN_EXTENSION,F.getText()),D.putAllMetadata(F.getResultMetadata()),D.addResultPoints(F.getResultPoints()),k=F.getText().length}catch{}let U=n==null?null:n.get(be.ALLOWED_EAN_EXTENSIONS);if(U!=null){let F=!1;for(let he in U)if(k.toString()===he){F=!0;break}if(!F)throw new M}return D}decodeEnd(e,t){return Ae.findGuardPattern(e,t,!1,Ae.START_END_PATTERN,new Int32Array(Ae.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Ae.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ae.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(i<0||i>9)throw new G;n+=i}n*=3;for(let r=t-2;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(i<0||i>9)throw new G;n+=i}return(1e3-n)%10}}class Kt extends Ae{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1],o=0;for(let l=0;l<6&&s<i;l++){let h=Ae.decodeDigit(e,r,s,Ae.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+h%10);for(let g of r)s+=g;h>=10&&(o|=1<<5-l)}n=Kt.determineFirstDigit(n,o),s=Ae.findGuardPattern(e,s,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let l=0;l<6&&s<i;l++){let h=Ae.decodeDigit(e,r,s,Ae.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+h);for(let g of r)s+=g}return{rowOffset:s,resultString:n}}getBarcodeFormat(){return $.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode("0".charCodeAt(0)+n)+e,e;throw new M}}Kt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Br extends Ae{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1];for(let a=0;a<4&&s<i;a++){let l=Ae.decodeDigit(e,r,s,Ae.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+l);for(let h of r)s+=h}s=Ae.findGuardPattern(e,s,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let a=0;a<4&&s<i;a++){let l=Ae.decodeDigit(e,r,s,Ae.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+l);for(let h of r)s+=h}return{rowOffset:s,resultString:n}}getBarcodeFormat(){return $.EAN_8}}class Pr extends Ae{constructor(){super(...arguments),this.ean13Reader=new Kt}getBarcodeFormat(){return $.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,n))}decodeMiddle(e,t,n){return this.ean13Reader.decodeMiddle(e,t,n)}maybeReturnResult(e){let t=e.getText();if(t.charAt(0)==="0"){let n=new at(t.substring(1),null,null,e.getResultPoints(),$.
7UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new M}reset(){this.ean13Reader.reset()}}class St extends Ae{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(l=>l);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const i=e.getSize();let s=t[1],o=0;for(let l=0;l<6&&s<i;l++){const h=St.decodeDigit(e,r,s,St.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+h%10);for(let g of r)s+=g;h>=10&&(o|=1<<5-l)}let a=St.determineNumSysAndCheckDigit(n,o);return{rowOffset:s,resultString:a}}decodeEnd(e,t){return St.findGuardPatternWithoutCounters(e,t,!0,St.MIDDLE_END_PATTERN)}checkChecksum(e){return Ae.checkChecksum(St.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let r=0;r<10;r++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r]){let i=String.fromCharCode("0".charCodeAt(0)+n),s=String.fromCharCode("0".charCodeAt(0)+r);return i+e+s}throw M.getNotFoundInstance()}getBarcodeFormat(){return $.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(i=>i.charCodeAt(0)),n=new Ie;n.append(e.charAt(0));let r=t[5];switch(r){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(r),n.append("0000"),n.appendChars(t,2,3);break;case 3:n.appendChars(t,0,3),n.append("00000"),n.appendChars(t,3,2);break;case 4:n.appendChars(t,0,4),n.append("00000"),n.append(t[4]);break;default:n.appendChars(t,0,5),n.append("0000"),n.append(r);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}St.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),St.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class sr extends He{constructor(e){super();let t=e==null?null:e.get(be.POSSIBLE_FORMATS),n=[];A(t)?(n.push(new Kt),n.push(new Pr),n.push(new Br),n.push(new St)):(t.indexOf($.EAN_13)>-1&&n.push(new Kt),t.indexOf($.UPC_A)>-1&&n.push(new Pr),t.indexOf($.EAN_8)>-1&&n.push(new Br),t.indexOf($.UPC_E)>-1&&n.push(new St)),this.readers=n}decodeRow(e,t,n){for(let r of this.readers)try{const i=r.decodeRow(e,t,n),s=i.getBarcodeFormat()===$.EAN_13&&i.getText().charAt(0)==="0",o=n==null?null:n.get(be.POSSIBLE_FORMATS),a=o==null||o.includes($.UPC_A);if(s&&a){const l=i.getRawBytes(),h=new at(i.getText().substring(1),l,l?l.length:null,i.getResultPoints(),$.UPC_A);return h.putAllMetadata(i.getResultMetadata()),h}return i}catch{}throw new M}reset(){for(let e of this.readers)e.reset()}}class nt extends He{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let n=0;n<t.length;n++)if(He.patternMatchVariance(e,t[n],nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return n;throw new M}static count(e){return ge.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]>r&&(r=t[i],n=i);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]<r&&(r=t[i],n=i);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],r=t/n;if(r>=nt.MIN_FINDER_PATTERN_RATIO&&r<=nt.MAX_FINDER_PATTERN_RATIO){let i=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;for(let o of e)o>s&&(s=o),o<i&&(i=o);return s<10*i}return!1}}nt.MAX_AVG_VARIANCE=.2,nt.MAX_INDIVIDUAL_VARIANCE=.45,nt.MIN_FINDER_PATTERN_RATIO=9.5/12,nt.MAX_FINDER_PATTERN_RATIO=12.5/14;class sn{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){if(!(e instanceof sn))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class kn{constructor(e,t,n,r,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new j(n,i)),this.resultPoints.push(new j(r,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof kn))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Rt{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let a of e)r+=a;let i=0,s=0,o=e.length;for(let a=0;a<o-1;a++){let l;for(l=1,s|=1<<a;l<e[a];l++,s&=~(1<<a)){let h=Rt.combins(r-l-1,o-a-2);if(n&&s===0&&r-l-(o-a-1)>=o-a-1&&(h-=Rt.combins(r-l-(o-a),o-a-2)),o-a-1>1){let g=0;for(let w=r-l-(o-a-2);w>t;w--)g+=Rt.combins(r-l-w-1,o-a-3);h-=g*(o-1-a)}else r-l>t&&h--;i+=h}r-=l}return i}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let i=1,s=1;for(let o=e;o>n;o--)i*=o,s<=r&&(i/=s,s++);for(;s<=r;)i/=s,s++;return i}}class _i{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new fe(n),i=0,o=e[0].getRightChar().getValue();for(let a=11;a>=0;--a)(o&1<<a)!=0&&r.set(i),i++;for(let a=1;a<e.length;++a){let l=e[a],h=l.getLeftChar().getValue();for(let g=11;g>=0;--g)(h&1<<g)!=0&&r.set(i),i++;if(l.getRightChar()!=null){let g=l.getRightChar().getValue();for(let w=11;w>=0;--w)(g&1<<w)!=0&&r.set(i),i++}}return r}}class qt{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class or{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class ft extends or{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===ft.FNC1}}ft.FNC1="$";class Qt extends or{constructor(e,t,n){super(e),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Et extends or{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new G;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Et.FNC1}isSecondDigitFNC1(){return this.secondDigit===Et.FNC1}isAnyFNC1(){return this.firstDigit===Et.FNC1||this.secondDigit===Et.FNC1}}Et.FNC1=10;class z{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new M;let t=e.substring(0,2);for(let i of z.TWO_DIGIT_DATA_LENGTH)if(i[0]===t)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(2,i[2],e):z.process
7FixedAI(2,i[1],e);if(e.length<3)throw new M;let n=e.substring(0,3);for(let i of z.THREE_DIGIT_DATA_LENGTH)if(i[0]===n)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(3,i[2],e):z.processFixedAI(3,i[1],e);for(let i of z.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(i[0]===n)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(4,i[2],e):z.processFixedAI(4,i[1],e);if(e.length<4)throw new M;let r=e.substring(0,4);for(let i of z.FOUR_DIGIT_DATA_LENGTH)if(i[0]===r)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(4,i[2],e):z.processFixedAI(4,i[1],e);throw new M}static processFixedAI(e,t,n){if(n.length<e)throw new M;let r=n.substring(0,e);if(n.length<e+t)throw new M;let i=n.substring(e,e+t),s=n.substring(e+t),o="("+r+")"+i,a=z.parseFieldsInGeneralPurpose(s);return a==null?o:o+a}static processVariableAI(e,t,n){let r=n.substring(0,e),i;n.length<e+t?i=n.length:i=e+t;let s=n.substring(e,i),o=n.substring(i),a="("+r+")"+s,l=z.parseFieldsInGeneralPurpose(o);return l==null?a:a+l}}z.VARIABLE_LENGTH=[],z.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",z.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",z.VARIABLE_LENGTH,20],["22",z.VARIABLE_LENGTH,29],["30",z.VARIABLE_LENGTH,8],["37",z.VARIABLE_LENGTH,8],["90",z.VARIABLE_LENGTH,30],["91",z.VARIABLE_LENGTH,30],["92",z.VARIABLE_LENGTH,30],["93",z.VARIABLE_LENGTH,30],["94",z.VARIABLE_LENGTH,30],["95",z.VARIABLE_LENGTH,30],["96",z.VARIABLE_LENGTH,30],["97",z.VARIABLE_LENGTH,3],["98",z.VARIABLE_LENGTH,30],["99",z.VARIABLE_LENGTH,30]],z.THREE_DIGIT_DATA_LENGTH=[["240",z.VARIABLE_LENGTH,30],["241",z.VARIABLE_LENGTH,30],["242",z.VARIABLE_LENGTH,6],["250",z.VARIABLE_LENGTH,30],["251",z.VARIABLE_LENGTH,30],["253",z.VARIABLE_LENGTH,17],["254",z.VARIABLE_LENGTH,20],["400",z.VARIABLE_LENGTH,30],["401",z.VARIABLE_LENGTH,30],["402",17],["403",z.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",z.VARIABLE_LENGTH,20],["421",z.VARIABLE_LENGTH,15],["422",3],["423",z.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],z.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",z.VARIABLE_LENGTH,15],["391",z.VARIABLE_LENGTH,18],["392",z.VARIABLE_LENGTH,15],["393",z.VARIABLE_LENGTH,18],["703",z.VARIABLE_LENGTH,30]],z.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",z.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",z.VARIABLE_LENGTH,20],["8003",z.VARIABLE_LENGTH,30],["8004",z.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",z.VARIABLE_LENGTH,30],["8008",z.VARIABLE_LENGTH,12],["8018",18],["8020",z.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",z.VARIABLE_LENGTH,70],["8200",z.VARIABLE_LENGTH,70]];class on{constructor(e){this.buffer=new Ie,this.information=e}decodeAllCodes(e,t){let n=t,r=null;do{let i=this.decodeGeneralPurposeField(n,r),s=z.parseFieldsInGeneralPurpose(i.getNewString());if(s!=null&&e.append(s),i.isRemaining()?r=""+i.getRemainingValue():r=null,n===i.getNewPosition())break;n=i.getNewPosition()}while(!0);return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let i=this.extractNumericValueFromBitArray(e,4);return i===0?new Et(this.information.getSize(),Et.FNC1,Et.FNC1):new Et(this.information.getSize(),i-1,Et.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new Et(e+7,n,r)}extractNumericValueFromBitArray(e,t){return on.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let i=0;i<n;++i)e.get(t+i)&&(r|=1<<n-i-1);return r}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return n!=null&&n.isRemaining()?new Qt(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Qt(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();
7if(this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished()),!(n!==this.current.getPosition())&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return e.isSecondDigitFNC1()?t=new Qt(this.current.getPosition(),this.buffer.toString()):t=new Qt(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new qt(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new Qt(this.current.getPosition(),this.buffer.toString());return new qt(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new qt(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new Qt(this.current.getPosition(),this.buffer.toString());return new qt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new qt(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new Qt(this.current.getPosition(),this.buffer.toString());return new qt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new qt(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,8);return r>=232&&r<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new ft(e+5,ft.FNC1);if(t>=5&&t<15)return new ft(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new ft(e+7,""+(n+1));if(n>=90&&n<116)return new ft(e+7,""+(n+7));let r=this.extractNumericValueFromBitArray(e,8),i;switch(r){case 232:i="!";break;case 233:i='"';break;case 234:i="%";break;case 235:i="&";break;case 236:i="'";break;case 237:i="(";break;case 238:i=")";break;case 239:i="*";break;case 240:i="+";break;case 241:i=",";break;case 242:i="-";break;case 243:i=".";break;case 244:i="/";break;case 245:i=":";break;case 246:i=";";break;case 247:i="<";break;case 248:i="=";break;case 249:i=">";break;case 250:i="?";break;case 251:i="_";break;case 252:i=" ";break;default:throw new G}return new ft(e+8,i)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new ft(e+5,ft.FNC1);if(t>=5&&t<15)return new ft(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new ft(e+6,""+(n+33));let r;switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new Nt("Decoding invalid alphanumeric value: "+n)}return new ft(e+6,r)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class ar{constructor(e){this.information=e,this.generalDecoder=new on(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class dt extends ar{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let n=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,n)}encodeCompressedGtinWithoutAI(e,t,n){for(let r=0;r<4;++r){let i=this.getGeneralDecoder().extractNumericValueFromBitArray(t
7+10*r,10);i/100===0&&e.append("0"),i/10===0&&e.append("0"),e.append(i)}dt.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let i=e.charAt(r+t).charCodeAt(0)-"0".charCodeAt(0);n+=(r&1)===0?3*i:i}n=10-n%10,n===10&&(n=0),e.append(n)}}dt.GTIN_SIZE=40;class an extends dt{constructor(e){super(e)}parseInformation(){let e=new Ie;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(an.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,an.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,an.HEADER_SIZE+44)}}an.HEADER_SIZE=1+1+2;class Un extends ar{constructor(e){super(e)}parseInformation(){let e=new Ie;return this.getGeneralDecoder().decodeAllCodes(e,Un.HEADER_SIZE)}}Un.HEADER_SIZE=2+1+2;class Vn extends dt{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let i=this.checkWeight(r),s=1e5;for(let o=0;o<5;++o)i/s===0&&e.append("0"),s/=10;e.append(i)}}class Ot extends Vn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Ot.HEADER_SIZE+Vn.GTIN_SIZE+Ot.WEIGHT_SIZE)throw new M;let e=new Ie;return this.encodeCompressedGtin(e,Ot.HEADER_SIZE),this.encodeCompressedWeight(e,Ot.HEADER_SIZE+Vn.GTIN_SIZE,Ot.WEIGHT_SIZE),e.toString()}}Ot.HEADER_SIZE=4+1,Ot.WEIGHT_SIZE=15;class bi extends Ot{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Ii extends Ot{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class vt extends dt{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<vt.HEADER_SIZE+dt.GTIN_SIZE)throw new M;let e=new Ie;this.encodeCompressedGtin(e,vt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(vt.HEADER_SIZE+dt.GTIN_SIZE,vt.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(vt.HEADER_SIZE+dt.GTIN_SIZE+vt.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}vt.HEADER_SIZE=5+1+2,vt.LAST_DIGIT_SIZE=2;class ct extends dt{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<ct.HEADER_SIZE+dt.GTIN_SIZE)throw new M;let e=new Ie;this.encodeCompressedGtin(e,ct.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(ct.HEADER_SIZE+dt.GTIN_SIZE,ct.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(ct.HEADER_SIZE+dt.GTIN_SIZE+ct.LAST_DIGIT_SIZE,ct.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(ct.HEADER_SIZE+dt.GTIN_SIZE+ct.LAST_DIGIT_SIZE+ct.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}ct.HEADER_SIZE=5+1+2,ct.LAST_DIGIT_SIZE=2,ct.FIRST_THREE_DIGITS_SIZE=10;class Be extends Vn{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=Be.HEADER_SIZE+Be.GTIN_SIZE+Be.WEIGHT_SIZE+Be.DATE_SIZE)throw new M;let e=new Ie;return this.encodeCompressedGtin(e,Be.HEADER_SIZE),this.encodeCompressedWeight(e,Be.HEADER_SIZE+Be.GTIN_SIZE,Be.WEIGHT_SIZE),this.encodeCompressedDate(e,Be.HEADER_SIZE+Be.GTIN_SIZE+Be.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,Be.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let i=n%12+1;n/=12;let s=n;s/10==0&&e.append("0"),e.append(s),i/10==0&&e.append("0"),e.append(i),r/10==0&&e.append("0"),e.append(r)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}Be.HEADER_SIZE=7+1,Be.WEIGHT_SIZE=20,Be.DATE_SIZE=16;function Lr(d){try{if(d.get(1))return new an(d);if(!d.get(2))return new Un(d);switch(on.extractNumericValueFromBitArray(d,1,4)){case 4:return new bi(d);case 5:return new Ii(d)}switch(on.extractNumericValueFromBitArray(d,1,5)){case 12:return new vt(d);case 13:return new ct(d)}switch(on.extractNumericValueFromBitArray(d,1,7)){case 56:return new Be(d,"310","11");case 57:return new Be(d,"320","11");case 58:return new Be(d,"310","13");case 59:return new Be(d,"320","13");case 60:return new Be(d,"310","15");case 61:return new Be(d,"320","15");case 62:return new Be(d,"310","17");case 63:return new Be(d,"320","17")}
7}catch(e){throw console.log(e),new Nt("unknown decoder: "+d)}}class Ht{constructor(e,t,n,r){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=r}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof Ht?Ht.equalsOrNull(e.leftchar,t.leftchar)&&Ht.equalsOrNull(e.rightchar,t.rightchar)&&Ht.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Ht.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class lr{constructor(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof lr?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((r,i)=>{t.forEach(s=>{r.getLeftChar().getValue()===s.getLeftChar().getValue()&&r.getRightChar().getValue()===s.getRightChar().getValue()&&r.getFinderPatter().getValue()===s.getFinderPatter().getValue()&&(n=!0)})}),n}}class P extends nt{constructor(e){super(...arguments),this.pairs=new Array(P.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=e===!0}decodeRow(e,t,n){this.pairs.length=0,this.startFromEven=!1;try{return P.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,P.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(i){if(i instanceof M){if(!this.pairs.length)throw new M;n=!0}}if(this.checkChecksum())return this.pairs;let r;if(this.rows.length?r=!0:r=!1,this.storeRow(e,!1),r){let i=this.checkRowsBoolean(!1);if(i!=null||(i=this.checkRowsBoolean(!0),i!=null))return i}throw new M}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(n){this.verbose&&console.log(n)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let r=this.rows[n];this.pairs.length=0;for(let s of e)this.pairs.push(s.getPairs());if(this.pairs.push(r.getPairs()),!P.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let i=new Array(e);i.push(r);try{return this.checkRows(i,n+1)}catch(s){this.verbose&&console.log(s)}}throw new M}static isValidSequence(e){for(let t of P.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,i=!1;for(;n<this.rows.length;){let s=this.rows[n];if(s.getRowNumber()>e){i=s.isEquivalent(this.pairs);break}r=s.isEquivalent(this.pairs),n++}i||r||P.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new lr(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let n of t)if(n.getPairs().length!==e.length){for(let r of n.getPairs())for(let i of e)if(Ht.equals(r,i))break}}static isPartialRow(e,t){for(let n of t){let r=!0;for(let i of e){let s=!1;for(let o of n.getPairs())if(i.equals(o)){s=!0;break}if(!s){r=!1;break}}if(r)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=_i.buildBitArray(e),r=Lr(t).parseInformation(),i=e[0].getFinderPattern().getResultPoints(),s=e[e.length-1].getFinderPattern().getResultPoints(),o=[i[0],i[1],s[0],s[1]];return new at(r,null,null,o,$.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let r=n.getChecksumPortion(),i=2;
7for(let o=1;o<this.pairs.size();++o){let a=this.pairs.get(o);r+=a.getLeftChar().getChecksumPortion(),i++;let l=a.getRightChar();l!=null&&(r+=l.getChecksumPortion(),i++)}return r%=211,211*(i-4)+r==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let r=t.length%2==0;this.startFromEven&&(r=!r);let i,s=!0,o=-1;do this.findNextPair(e,t,o),i=this.parseFoundFinderPattern(e,n,r),i==null?o=P.getNextSecondBar(e,this.startEnd[0]):s=!1;while(s);let a=this.decodeDataCharacter(e,i,r,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new M;let l;try{l=this.decodeDataCharacter(e,i,r,!1)}catch(h){l=null,this.verbose&&console.log(h)}return new Ht(a,l,i,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s;n>=0?s=n:this.isEmptyPair(t)?s=0:s=t[t.length-1].getFinderPattern().getStartEnd()[1];let o=t.length%2!=0;this.startFromEven&&(o=!o);let a=!1;for(;s<i&&(a=!e.get(s),!!a);)s++;let l=0,h=s;for(let g=s;g<i;g++)if(e.get(g)!=a)r[l]++;else{if(l==3){if(o&&P.reverseCounters(r),P.isFinderPattern(r)){this.startEnd[0]=h,this.startEnd[1]=g;return}o&&P.reverseCounters(r),h+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,l--}else l++;r[l]=1,a=!a}throw new M}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,i,s;if(n){let l=this.startEnd[0]-1;for(;l>=0&&!e.get(l);)l--;l++,r=this.startEnd[0]-l,i=l,s=this.startEnd[1]}else i=this.startEnd[0],s=e.getNextUnset(this.startEnd[1]+1),r=s-this.startEnd[1];let o=this.getDecodeFinderCounters();ie.arraycopy(o,0,o,1,o.length-1),o[0]=r;let a;try{a=this.parseFinderValue(o,P.FINDER_PATTERNS)}catch{return null}return new kn(a,[i,s],i,s,t)}decodeDataCharacter(e,t,n,r){let i=this.getDataCharacterCounters();for(let Ne=0;Ne<i.length;Ne++)i[Ne]=0;if(r)P.recordPatternInReverse(e,t.getStartEnd()[0],i);else{P.recordPattern(e,t.getStartEnd()[1],i);for(let Ne=0,et=i.length-1;Ne<et;Ne++,et--){let At=i[Ne];i[Ne]=i[et],i[et]=At}}let s=17,o=ge.sum(new Int32Array(i))/s,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(o-a)/a>.3)throw new M;let l=this.getOddCounts(),h=this.getEvenCounts(),g=this.getOddRoundingErrors(),w=this.getEvenRoundingErrors();for(let Ne=0;Ne<i.length;Ne++){let et=1*i[Ne]/o,At=et+.5;if(At<1){if(et<.3)throw new M;At=1}else if(At>8){if(et>8.7)throw new M;At=8}let fn=Ne/2;(Ne&1)==0?(l[fn]=At,g[fn]=et-At):(h[fn]=At,w[fn]=et-At)}this.adjustOddEvenCounts(s);let p=4*t.getValue()+(n?0:2)+(r?0:1)-1,_=0,b=0;for(let Ne=l.length-1;Ne>=0;Ne--){if(P.isNotA1left(t,n,r)){let et=P.WEIGHTS[p][2*Ne];b+=l[Ne]*et}_+=l[Ne]}let S=0;for(let Ne=h.length-1;Ne>=0;Ne--)if(P.isNotA1left(t,n,r)){let et=P.WEIGHTS[p][2*Ne+1];S+=h[Ne]*et}let D=b+S;if((_&1)!=0||_>13||_<4)throw new M;let k=(13-_)/2,U=P.SYMBOL_WIDEST[k],F=9-U,he=Rt.getRSSvalue(l,U,!0),ae=Rt.getRSSvalue(h,F,!1),xt=P.EVEN_TOTAL_SUBSET[k],Tt=P.GSUM[k],wt=he*xt+ae+Tt;return new sn(wt,D)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=ge.sum(new Int32Array(this.getOddCounts())),n=ge.sum(new Int32Array(this.getEvenCounts())),r=!1,i=!1;t>13?i=!0:t<4&&(r=!0);let s=!1,o=!1;n>13?o=!0:n<4&&(s=!0);let a=t+n-e,l=(t&1)==1,h=(n&1)==0;if(a==1)if(l){if(h)throw new M;i=!0}else{if(!h)throw new M;o=!0}else if(a==-1)if(l){if(h)throw new M;r=!0}else{if(!h)throw new M;s=!0}else if(a==0){if(l){if(!h)throw new M;t<n?(r=!0,o=!0):(i=!0,s=!0)}else if(h)throw new M}else throw new M;if(r){if(i)throw new M;P.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&P.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(o)throw new M;P.increment(this.getEvenCounts(),this.getOddRoundingErrors())}o&&P.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}P.SYMBOL_WIDEST=[7,5,4,3,1],P.EVEN_TOTAL_SUBSET=[4,20,52,104,204],P.GSUM=[0,348,1388,2948,3988],P.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],P.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,9
71],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],P.FINDER_PAT_A=0,P.FINDER_PAT_B=1,P.FINDER_PAT_C=2,P.FINDER_PAT_D=3,P.FINDER_PAT_E=4,P.FINDER_PAT_F=5,P.FINDER_PATTERN_SEQUENCES=[[P.FINDER_PAT_A,P.FINDER_PAT_A],[P.FINDER_PAT_A,P.FINDER_PAT_B,P.FINDER_PAT_B],[P.FINDER_PAT_A,P.FINDER_PAT_C,P.FINDER_PAT_B,P.FINDER_PAT_D],[P.FINDER_PAT_A,P.FINDER_PAT_E,P.FINDER_PAT_B,P.FINDER_PAT_D,P.FINDER_PAT_C],[P.FINDER_PAT_A,P.FINDER_PAT_E,P.FINDER_PAT_B,P.FINDER_PAT_D,P.FINDER_PAT_D,P.FINDER_PAT_F],[P.FINDER_PAT_A,P.FINDER_PAT_E,P.FINDER_PAT_B,P.FINDER_PAT_D,P.FINDER_PAT_E,P.FINDER_PAT_F,P.FINDER_PAT_F],[P.FINDER_PAT_A,P.FINDER_PAT_A,P.FINDER_PAT_B,P.FINDER_PAT_B,P.FINDER_PAT_C,P.FINDER_PAT_C,P.FINDER_PAT_D,P.FINDER_PAT_D],[P.FINDER_PAT_A,P.FINDER_PAT_A,P.FINDER_PAT_B,P.FINDER_PAT_B,P.FINDER_PAT_C,P.FINDER_PAT_C,P.FINDER_PAT_D,P.FINDER_PAT_E,P.FINDER_PAT_E],[P.FINDER_PAT_A,P.FINDER_PAT_A,P.FINDER_PAT_B,P.FINDER_PAT_B,P.FINDER_PAT_C,P.FINDER_PAT_C,P.FINDER_PAT_D,P.FINDER_PAT_E,P.FINDER_PAT_F,P.FINDER_PAT_F],[P.FINDER_PAT_A,P.FINDER_PAT_A,P.FINDER_PAT_B,P.FINDER_PAT_B,P.FINDER_PAT_C,P.FINDER_PAT_D,P.FINDER_PAT_D,P.FINDER_PAT_E,P.FINDER_PAT_E,P.FINDER_PAT_F,P.FINDER_PAT_F]],P.MAX_PAIRS=11;class yi extends sn{constructor(e,t,n){super(e,t),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class Fe extends nt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);Fe.addOrTally(this.possibleLeftPairs,r),t.reverse();let i=this.decodePair(t,!0,e,n);Fe.addOrTally(this.possibleRightPairs,i),t.reverse();for(let s of this.possibleLeftPairs)if(s.getCount()>1){for(let o of this.possibleRightPairs)if(o.getCount()>1&&Fe.checkChecksum(s,o))return Fe.constructResult(s,o)}throw new M}static addOrTally(e,t){if(t==null)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),r=new String(n).toString(),i=new Ie;for(let l=13-r.length;l>0;l--)i.append("0");i.append(r);let s=0;for(let l=0;l<13;l++){let h=i.charAt(l).charCodeAt(0)-"0".charCodeAt(0);s+=(l&1)===0?3*h:h}s=10-s%10,s===10&&(s=0),i.append(s.toString());let o=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new at(i.toString(),null,0,[o[0],o[1],a[0],a[1]],$.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let i=this.findFinderPattern(e,t),s=this.parseFoundFinderPattern(e,n,t,i),o=r==null?null:r.get(be.NEED_RESULT_POINT_CALLBACK);if(o!=null){let h=(i[0]+i[1])/2;t&&(h=e.getSize()-1-h),o.foundPossibleResultPoint(new j(h,n))}let a=this.decodeDataCharacter(e,s,!0),l=this.decodeDataCharacter(e,s,!1);return new yi(1597*a.getValue()+l.getValue(),a.getChecksumPortion()+4*l.getChecksumPortion(),s)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let S=0;S<r.length;S++)r[S]=0;if(n)He.recordPatternInReverse(e,t.getStartEnd()[0],r);else{He.recordPattern(e,t.getStartEnd()[1]+1,r);for(let S=0,D=r.length-1;S<D;S++,D--){let k=r[S];r[S]=r[D],r[D]=k}}let i=n?16:15,s=ge.sum(new Int32Array(r))/i,o=this.getOddCounts(),a=this.getEvenCounts(),l=this.getOddRoundingErrors(),h=this.getEvenRoundingErrors();for(let S=0;S<r.length;S++){let D=r[S]/s,k=Math.floor(D+.5);k<1?k=1:k>8&&(k=8);let U=Math.floor(S/2);(S&1)===0?(o[U]=k,l[U]=D-k):(a[U]=k,h[U]=D-k)}this.adjustOddEvenCounts(n,i);let g=0,w=0;for(let S=o.length-1;S>=0;S--)w*=9,w+=o[S],g+=o[S];let p=0,_=0;for(let S=a.length-1;S>=0;S--)p*=9,p+=a[S],_+=a[S];let b=w+3*p;if(n){if((g&1)!==0||g>12||g<4)throw new M;let S=(12-g)/2,D=Fe.OUTSIDE_ODD_WIDEST[S],k=9-D,U=Rt.getRSSvalue(o,D,!1),F=Rt.getRSSvalue(
7a,k,!0),he=Fe.OUTSIDE_EVEN_TOTAL_SUBSET[S],ae=Fe.OUTSIDE_GSUM[S];return new sn(U*he+F+ae,b)}else{if((_&1)!==0||_>10||_<4)throw new M;let S=(10-_)/2,D=Fe.INSIDE_ODD_WIDEST[S],k=9-D,U=Rt.getRSSvalue(o,D,!0),F=Rt.getRSSvalue(a,k,!1),he=Fe.INSIDE_ODD_TOTAL_SUBSET[S],ae=Fe.INSIDE_GSUM[S];return new sn(F*he+U+ae,b)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),i=!1,s=0;for(;s<r&&(i=!e.get(s),t!==i);)s++;let o=0,a=s;for(let l=s;l<r;l++)if(e.get(l)!==i)n[o]++;else{if(o===3){if(nt.isFinderPattern(n))return[a,l];a+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,o--}else o++;n[o]=1,i=!i}throw new M}parseFoundFinderPattern(e,t,n,r){let i=e.get(r[0]),s=r[0]-1;for(;s>=0&&i!==e.get(s);)s--;s++;const o=r[0]-s,a=this.getDecodeFinderCounters(),l=new Int32Array(a.length);ie.arraycopy(a,0,l,1,a.length-1),l[0]=o;const h=this.parseFinderValue(l,Fe.FINDER_PATTERNS);let g=s,w=r[1];return n&&(g=e.getSize()-1-g,w=e.getSize()-1-w),new kn(h,[s,r[1]],g,w,t)}adjustOddEvenCounts(e,t){let n=ge.sum(new Int32Array(this.getOddCounts())),r=ge.sum(new Int32Array(this.getEvenCounts())),i=!1,s=!1,o=!1,a=!1;e?(n>12?s=!0:n<4&&(i=!0),r>12?a=!0:r<4&&(o=!0)):(n>11?s=!0:n<5&&(i=!0),r>10?a=!0:r<4&&(o=!0));let l=n+r-t,h=(n&1)===(e?1:0),g=(r&1)===1;if(l===1)if(h){if(g)throw new M;s=!0}else{if(!g)throw new M;a=!0}else if(l===-1)if(h){if(g)throw new M;i=!0}else{if(!g)throw new M;o=!0}else if(l===0){if(h){if(!g)throw new M;n<r?(i=!0,a=!0):(s=!0,o=!0)}else if(g)throw new M}else throw new M;if(i){if(s)throw new M;nt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&&nt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(a)throw new M;nt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&nt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Fe.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Fe.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Fe.OUTSIDE_GSUM=[0,161,961,2015,2715],Fe.INSIDE_GSUM=[0,336,1036,1516],Fe.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Fe.INSIDE_ODD_WIDEST=[2,4,6,8],Fe.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ln extends He{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(be.POSSIBLE_FORMATS):null,r=e&&e.get(be.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes($.EAN_13)||n.includes($.UPC_A)||n.includes($.EAN_8)||n.includes($.UPC_E))&&this.readers.push(new sr(e)),n.includes($.CODE_39)&&this.readers.push(new We(r)),n.includes($.CODE_128)&&this.readers.push(new H),n.includes($.ITF)&&this.readers.push(new Se),n.includes($.RSS_14)&&this.readers.push(new Fe),n.includes($.RSS_EXPANDED)&&this.readers.push(new P(this.verbose))):(this.readers.push(new sr(e)),this.readers.push(new We),this.readers.push(new sr(e)),this.readers.push(new H),this.readers.push(new Se),this.readers.push(new Fe),this.readers.push(new P(this.verbose)))}decodeRow(e,t,n){for(let r=0;r<this.readers.length;r++)try{return this.readers[r].decodeRow(e,t,n)}catch{}throw new M}reset(){this.readers.forEach(e=>e.reset())}}class Si extends jt{constructor(e=500,t){super(new ln(t),e,t)}}class Ee{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class me{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class de{constructor(e,t,n,r,i,s){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=i,this.ecBlocks=s;let o=0;const a=s.getECCodewords(),l=s.getECBlocks();for(let h of l)o+=h.getCount()*(h.getDataCodewords()+a);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}
7static getVersionForDimensions(e,t){if((e&1)!==0||(t&1)!==0)throw new G;for(let n of de.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new G}toString(){return""+this.versionNumber}static buildVersions(){return[new de(1,10,10,8,8,new Ee(5,new me(1,3))),new de(2,12,12,10,10,new Ee(7,new me(1,5))),new de(3,14,14,12,12,new Ee(10,new me(1,8))),new de(4,16,16,14,14,new Ee(12,new me(1,12))),new de(5,18,18,16,16,new Ee(14,new me(1,18))),new de(6,20,20,18,18,new Ee(18,new me(1,22))),new de(7,22,22,20,20,new Ee(20,new me(1,30))),new de(8,24,24,22,22,new Ee(24,new me(1,36))),new de(9,26,26,24,24,new Ee(28,new me(1,44))),new de(10,32,32,14,14,new Ee(36,new me(1,62))),new de(11,36,36,16,16,new Ee(42,new me(1,86))),new de(12,40,40,18,18,new Ee(48,new me(1,114))),new de(13,44,44,20,20,new Ee(56,new me(1,144))),new de(14,48,48,22,22,new Ee(68,new me(1,174))),new de(15,52,52,24,24,new Ee(42,new me(2,102))),new de(16,64,64,14,14,new Ee(56,new me(2,140))),new de(17,72,72,16,16,new Ee(36,new me(4,92))),new de(18,80,80,18,18,new Ee(48,new me(4,114))),new de(19,88,88,20,20,new Ee(56,new me(4,144))),new de(20,96,96,22,22,new Ee(68,new me(4,174))),new de(21,104,104,24,24,new Ee(56,new me(6,136))),new de(22,120,120,18,18,new Ee(68,new me(6,175))),new de(23,132,132,20,20,new Ee(62,new me(8,163))),new de(24,144,144,22,22,new Ee(62,new me(8,156),new me(2,155))),new de(25,8,18,6,16,new Ee(7,new me(1,5))),new de(26,8,32,6,14,new Ee(11,new me(1,10))),new de(27,12,26,10,24,new Ee(14,new me(1,16))),new de(28,12,36,10,16,new Ee(18,new me(1,22))),new de(29,16,36,14,16,new Ee(24,new me(1,32))),new de(30,16,48,14,22,new Ee(28,new me(1,49)))]}}de.VERSIONS=de.buildVersions();class cr{constructor(e){const t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new G;this.version=cr.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new ze(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return de.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const i=this.mappingBitMatrix.getHeight(),s=this.mappingBitMatrix.getWidth();let o=!1,a=!1,l=!1,h=!1;do if(n===i&&r===0&&!o)e[t++]=this.readCorner1(i,s)&255,n-=2,r+=2,o=!0;else if(n===i-2&&r===0&&(s&3)!==0&&!a)e[t++]=this.readCorner2(i,s)&255,n-=2,r+=2,a=!0;else if(n===i+4&&r===2&&(s&7)===0&&!l)e[t++]=this.readCorner3(i,s)&255,n-=2,r+=2,l=!0;else if(n===i-2&&r===0&&(s&7)===4&&!h)e[t++]=this.readCorner4(i,s)&255,n-=2,r+=2,h=!0;else{do n<i&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,i,s)&255),n-=2,r+=2;while(n>=0&&r<s);n+=1,r+=3;do n>=0&&r<s&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,i,s)&255),n+=2,r-=2;while(n<i&&r>=0);n+=3,r+=1}while(n<i||r<s);if(t!==this.version.getTotalCodewords())throw new G;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let i=0;return this.readModule(e-2,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-2,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t,n,r)&&(i|=1),i<<=1,this.readModule(e,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e,t,n,r)&&(i|=1),i}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new N("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),s=t/r|0,o=n/i|0,a=s*r,l=o*i,h=new ze(l,a);for(let g=0;g<s;++g){const w=g*r;for(let p=0;p<o;++p){const _=p*i;for(let b=0;b<r;++b){const S=g*(r+2)+1+b,D=w+b;for(let k=0;k<i;++k){const U=p*(i+2)+1+k;if(e.get(U,S)){const F=_+k;h.set(F,D)}}}}}return h}}
7class ur{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const i=n.getECBlocks();for(let b of i)r+=b.getCount();const s=new Array(r);let o=0;for(let b of i)for(let S=0;S<b.getCount();S++){const D=b.getDataCodewords(),k=n.getECCodewords()+D;s[o++]=new ur(D,new Uint8Array(k))}const l=s[0].codewords.length-n.getECCodewords(),h=l-1;let g=0;for(let b=0;b<h;b++)for(let S=0;S<o;S++)s[S].codewords[b]=e[g++];const w=t.getVersionNumber()===24,p=w?8:o;for(let b=0;b<p;b++)s[b].codewords[l-1]=e[g++];const _=s[0].codewords.length;for(let b=l;b<_;b++)for(let S=0;S<o;S++){const D=w?(S+8)%o:S,k=w&&D>7?b-1:b;s[D].codewords[k]=e[g++]}if(g!==e.length)throw new N;return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class hr{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new N(""+e);let t=0,n=this.bitOffset,r=this.byteOffset;const i=this.bytes;if(n>0){const s=8-n,o=e<s?e:s,a=s-o,l=255>>8-o<<a;t=(i[r]&l)>>a,e-=o,n+=o,n===8&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|i[r]&255,r++,e-=8;if(e>0){const s=8-e,o=255>>s<<s;t=t<<e|(i[r]&o)>>s,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Xe;(function(d){d[d.PAD_ENCODE=0]="PAD_ENCODE",d[d.ASCII_ENCODE=1]="ASCII_ENCODE",d[d.C40_ENCODE=2]="C40_ENCODE",d[d.TEXT_ENCODE=3]="TEXT_ENCODE",d[d.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",d[d.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",d[d.BASE256_ENCODE=6]="BASE256_ENCODE"})(Xe||(Xe={}));class Wt{static decode(e){const t=new hr(e),n=new Ie,r=new Ie,i=new Array;let s=Xe.ASCII_ENCODE;do if(s===Xe.ASCII_ENCODE)s=this.decodeAsciiSegment(t,n,r);else{switch(s){case Xe.C40_ENCODE:this.decodeC40Segment(t,n);break;case Xe.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Xe.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Xe.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Xe.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new G}s=Xe.ASCII_ENCODE}while(s!==Xe.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Cn(e,n.toString(),i.length===0?null:i,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let i=e.readBits(8);if(i===0)throw new G;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),Xe.ASCII_ENCODE;if(i===129)return Xe.PAD_ENCODE;if(i<=229){const s=i-130;s<10&&t.append("0"),t.append(""+s)}else switch(i){case 230:return Xe.C40_ENCODE;case 231:return Xe.BASE256_ENCODE;case 232:t.append(String.fromCharCode(29));break;case 233:case 234:break;case 235:r=!0;break;case 236:t.append("[)>�05�"),n.insert(0,"��");break;case 237:t.append("[)>�06�"),n.insert(0,"��");break;case 238:return Xe.ANSIX12_ENCODE;case 239:return Xe.TEXT_ENCODE;case 240:return Xe.EDIFACT_ENCODE;case 241:break;default:if(i!==254||e.available()!==0)throw new G;break}}while(e.available()>0);return Xe.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let i=0;do{if(e.available()===8)return;const s=e.readBits(8);if(s===254)return;this.parseTwoBytes(s,e.readBits(8),r);for(let o=0;o<3;o++){const a=r[o];switch(i){case 0:if(a<3)i=a+1;else if(a<this.C40_BASIC_SET_CHARS.length){const l=this.C40_BASIC_SET_CHARS[a];n?(t.append(String.fromCharCode(l.charCodeAt(0)+128)),n=!1):t.append(l)}else throw new G;break;case 1:n?(t.append(String.fromCharCode(a+128)),n=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.C40_SHIFT2_SET_CHARS.length){const l=this.C40_SHIFT2_SET_CHARS[a];n?(t.append(String.fromCharCode(l.charCodeAt(0)+128)),n=!1):t.append(l)}else switch(a){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new G}i=0;break;case 3:n?(t.append(String.fromCharCode(a+224)),n=!1):t.append(String.fromCharCode(a+96)),i=0;break;default:throw new G}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],i=0;do{if(e.available()===8)return;const s=e.readBits(8);if(s===254)return;this.parseTwoBytes(s,e.readBits(8),r);for(let o=0;o<3;o++){const a=r[o];switch(i){case 0:if(a<3)i=a+1;else if(a<this.TEXT_BASIC_SET_CHARS.length){const l=this.TEXT_BASIC_SET_CHARS[a];n?(t.append(String.fromCharCode(l.charCodeAt(0)+128)),n=!1):t.append(l)}else throw new G;break;case 1:n?(t.append(String.fromCharCode(a+128)),n=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.TEXT_SHIFT2_SET_CHARS.length){const l=this.TEXT_SHIFT2_SET_CHARS[a];n?(t.append(String.fromCharCode(l.charCodeAt(0)+128)),n=!1):t.append(l)}
7else switch(a){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new G}i=0;break;case 3:if(a<this.TEXT_SHIFT3_SET_CHARS.length){const l=this.TEXT_SHIFT3_SET_CHARS[a];n?(t.append(String.fromCharCode(l.charCodeAt(0)+128)),n=!1):t.append(l),i=0}else throw new G;break;default:throw new G}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const r=e.readBits(8);if(r===254)return;this.parseTwoBytes(r,e.readBits(8),n);for(let i=0;i<3;i++){const s=n[i];switch(s){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(s<14)t.append(String.fromCharCode(s+44));else if(s<40)t.append(String.fromCharCode(s+51));else throw new G;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,i=Math.floor(r/1600);n[0]=i,r-=i*1600,i=Math.floor(r/40),n[1]=i,n[2]=r-i*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let r=e.readBits(6);if(r===31){const i=8-e.getBitOffset();i!==8&&e.readBits(i);return}(r&32)===0&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const i=this.unrandomize255State(e.readBits(8),r++);let s;if(i===0?s=e.available()/8|0:i<250?s=i:s=250*(i-249)+this.unrandomize255State(e.readBits(8),r++),s<0)throw new G;const o=new Uint8Array(s);for(let a=0;a<s;a++){if(e.available()<8)throw new G;o[a]=this.unrandomize255State(e.readBits(8),r++)}n.push(o);try{t.append(ut.decode(o,se.ISO88591))}catch(a){throw new Nt("Platform does not support required encoding: "+a.message)}}static unrandomize255State(e,t){const n=149*t%255+1,r=e-n;return r>=0?r:r+256}}Wt.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Wt.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Wt.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Wt.TEXT_SHIFT2_SET_CHARS=Wt.C40_SHIFT2_SET_CHARS,Wt.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class Ti{constructor(){this.rsDecoder=new mn(Ce.DATA_MATRIX_FIELD_256)}decode(e){const t=new cr(e),n=t.getVersion(),r=t.readCodewords(),i=ur.getDataBlocks(r,n);let s=0;for(let l of i)s+=l.getNumDataCodewords();const o=new Uint8Array(s),a=i.length;for(let l=0;l<a;l++){const h=i[l],g=h.getCodewords(),w=h.getNumDataCodewords();this.correctErrors(g,w);for(let p=0;p<w;p++)o[p*a+l]=g[p]}return Wt.decode(o)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new W}for(let r=0;r<t;r++)e[r]=n[r]}}class Ge{constructor(e){this.image=e,this.rectangleDetector=new Lt(this.image)}detect(){const e=this.rectangleDetector.detect();let t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new M;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],i=t[2],s=t[3];let o=this.transitionsBetween(n,s)+1,a=this.transitionsBetween(i,s)+1;(o&1)===1&&(o+=1),(a&1)===1&&(a+=1),4*o<7*a&&4*a<7*o&&(o=a=Math.max(o,a));let l=Ge.sampleGrid(this.image,n,r,i,s,o,a);return new Ln(l,[n,r,i,s])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),i=(t.getY()-e.getY())/(n+1);return new j(e.getX()+r,e.getY()+i)}static moveAway(e,t,n){let r=e.getX(),i=e.getY();return r<t?r-=1:r+=1,i<n?i-=1:i+=1,new j(r,i)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],i=e[2],s=this.transitionsBetween(t,n),o=this.transitionsBetween(n,r),a=this.transitionsBetween(r,i),l=this.transitionsBetween(i,t),h=s,g=[i,t,n,r];return h>o&&(h=o,g[0]=t,g[1]=n,g[2]=r,g[3]=i),h>a&&(h=a,g[0]=n,g[1]=r,g[2]=i,g[3]=t),h>l&&(g[0]=r,g[1]=i,g[2]=t,g[3]=n),g}detectSolid2(e){let t=e[0],n=e[1],r=e[2],i=e[3],s=this.transitionsBetween(t,i),o=Ge.shiftPoint(n,r,(s+1)*4),a=Ge.shiftPoint(r,n,(s+1)*4),l=this.transitionsBetween(o,t),h=this.transitionsBetween(a,i);return l<h?(e[0]=t,e[1]=n,e[2]=r,e[3]=i):(e[0]=n,e[1]=r,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],i=e[3],s=this.transitionsBetween(t,i),o=this.transitionsBetween(n,i),a=Ge.shiftPoint(t,n,(o+1)*4),l=Ge.shiftPoint(r,n,(s+1)*4);s=this.transitionsBetween(a,i),o=this.transitionsBetween(l,i);let h=new j(i.getX()+(r.getX()-n.getX())/(s+1),i.getY()+(r.getY()-n.getY())/(s+1)),g=new j(i.getX()+(t.getX()-n.getX())/(o+1),i.getY()+(t.getY()-n.getY())/(o+1));if(!this.isValid(h))return this.isValid(g)?g:null;if(!this.isValid(g))return h;let w=this.transitionsBetween(a,h)+this.transitionsBetween(l,h),p=this.transitionsBetween(a,g)+this.transitionsBetween(l,g);return w>p?h:g}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],i=e[3],s=this.transitionsBetween(t,i)+1,o=this.transitionsBetween(r,i)+1,a=Ge.shiftPoint(t,n,o*4),l=Ge.shiftPoint(r,n,s*4);s=this.transitionsBetween(a,i)+1,o=this.transitionsBetween(l,i)+1,(s&1)===1&&(s+=1),(o&1)===1&&(o+=1);let h=(t.getX()+n.getX()+r.getX()+i.getX())/4,g=(t.getY()+n.getY()+r.getY()+i.getY())/4;t=Ge.moveAway(t,h,g),n=Ge.moveAway(n,h,g),r=Ge.moveAway(r,h,g),i=Ge.moveAway(i,h,g);let w,p;return a=Ge.shiftPoint(t,n,o*4),a=Ge.shiftPoint(a,i,s*4),w=Ge.shiftPoint(n,t,o*4),w=Ge.shiftPoint(w,r,s*4),l=Ge.shiftPoint(r,i,o*4),l=Ge.shiftPoint(l,n,s*4),p=Ge.shiftPoint(i,r,o*4),p=Ge.shiftPoint(p,t,s*4),[a,w,l,p]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,i,s,o){return Gt.getInstance().sampleGrid(e,s,o,.5,.5,s-.5,.5,s-.5,o-.5,.5,o-.5,t.getX(),t.getY(),i.getX(),i.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),i=Math.trunc(t.getX()),s=Math.trunc(t.getY()),o=Math.abs(s-r)>Math.abs(i-n);if(o){let b=n;n=r,r=b,b=i,i=s,s=b}let a=Math.abs(i-n),l=Math.abs(s-r),h=-a/2,g=r<s?1:-1,w=n<i?1:-1,p=0,_=this.image.get(o?r:n,o?n:r);for(let b=n,S=r;b!==i;b+=w){let D=this.image.get(o?S:b,o?b:S);if(D!==_&&(p++,_=D),h+=l,h>
vendor: 6,391 bytes, line 7
70){if(S===s)break;S+=g,h-=a}}return p}}class Xt{constructor(){this.decoder=new Ti}decode(e,t=null){let n,r;if(t!=null&&t.has(be.PURE_BARCODE)){const l=Xt.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(l),r=Xt.NO_POINTS}else{const l=new Ge(e.getBlackMatrix()).detect();n=this.decoder.decode(l.getBits()),r=l.getPoints()}const i=n.getRawBytes(),s=new at(n.getText(),i,8*i.length,r,$.DATA_MATRIX,ie.currentTimeMillis()),o=n.getByteSegments();o!=null&&s.putMetadata(je.BYTE_SEGMENTS,o);const a=n.getECLevel();return a!=null&&s.putMetadata(je.ERROR_CORRECTION_LEVEL,a),s}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new M;const r=this.moduleSize(t,e);let i=t[1];const s=n[1];let o=t[0];const l=(n[0]-o+1)/r,h=(s-i+1)/r;if(l<=0||h<=0)throw new M;const g=r/2;i+=g,o+=g;const w=new ze(l,h);for(let p=0;p<h;p++){const _=i+p*r;for(let b=0;b<l;b++)e.get(o+b*r,_)&&w.set(b,p)}return w}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const i=e[1];for(;r<n&&t.get(r,i);)r++;if(r===n)throw new M;const s=r-e[0];if(s===0)throw new M;return s}}Xt.NO_POINTS=[];class Ni extends jt{constructor(e=500){super(new Xt,e)}}var cn;(function(d){d[d.L=0]="L",d[d.M=1]="M",d[d.Q=2]="Q",d[d.H=3]="H"})(cn||(cn={}));class ve{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ve.FOR_BITS.set(n,this),ve.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ve.L;case"M":return ve.M;case"Q":return ve.Q;case"H":return ve.H;default:throw new y(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ve))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ve.FOR_BITS.size)throw new N;return ve.FOR_BITS.get(e)}}ve.FOR_BITS=new Map,ve.FOR_VALUE=new Map,ve.L=new ve(cn.L,"L",1),ve.M=new ve(cn.M,"M",0),ve.Q=new ve(cn.Q,"Q",3),ve.H=new ve(cn.H,"H",2);class rt{constructor(e){this.errorCorrectionLevel=ve.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return Q.bitCount(e^t)}static decodeFormatInformation(e,t){const n=rt.doDecodeFormatInformation(e,t);return n!==null?n:rt.doDecodeFormatInformation(e^rt.FORMAT_INFO_MASK_QR,t^rt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const i of rt.FORMAT_INFO_DECODE_LOOKUP){const s=i[0];if(s===e||s===t)return new rt(i[1]);let o=rt.numBitsDiffering(e,s);o<n&&(r=i[1],n=o),e!==t&&(o=rt.numBitsDiffering(t,s),o<n&&(r=i[1],n=o))}return n<=3?new rt(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof rt))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}rt.FORMAT_INFO_MASK_QR=21522,rt.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class T{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class E{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class q{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const i=n[0].getECCodewordsPerBlock(),s=n[0].getECBlocks();for(const o of s)r+=o.getCount()*(o.getDataCodewords()+i);this.totalCodewords=r}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!==1)throw new G;try{return this.getVersionForNumber((e-17)/4)}catch{throw new G}}static getVersionForNumber(e){if(e<1||e>40)throw new N;return q.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<q.VERSION_DECODE_INFO.length;r++){const i=q.VERSION_DECODE_INFO[r];if(i===e)return q.getVersionForNumber(r+7);const s=rt.numBitsDiffering(e,i);s<t&&(n=r+7,t=s)}return t<=3?q.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new ze(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);const n=this.alignmentPatternCenters.length;for(let r=0;r<n;r++){const i=this.alignmentPatternCenters[r]-2;for(let s=0;s<n;s++)r===0&&(s===0||s===n-1)||r===n-1&&s===0||t.setRegion(this.alignmentPatternCenters[s]-2,i,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}q.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),q.VERSIONS=[new q(1,new Int32Array(0),new T(7,new E(1,19)),new T(10,new E(1,16)),new T(13,new E(1,13)),new T(17,new E(1,9))),new q(2,Int32Array.from([6,18]),new T(10,new E(1,34)),new T(16,new E(1,28)),new T(22,new E(1,22)),new T(28,new E(1,16))),new q(3,Int32Array.from([6,22]),new T(15,new E(1,55)),new T(26,new E(1,44)),new T(18,new E(2,17)
7),new T(22,new E(2,13))),new q(4,Int32Array.from([6,26]),new T(20,new E(1,80)),new T(18,new E(2,32)),new T(26,new E(2,24)),new T(16,new E(4,9))),new q(5,Int32Array.from([6,30]),new T(26,new E(1,108)),new T(24,new E(2,43)),new T(18,new E(2,15),new E(2,16)),new T(22,new E(2,11),new E(2,12))),new q(6,Int32Array.from([6,34]),new T(18,new E(2,68)),new T(16,new E(4,27)),new T(24,new E(4,19)),new T(28,new E(4,15))),new q(7,Int32Array.from([6,22,38]),new T(20,new E(2,78)),new T(18,new E(4,31)),new T(18,new E(2,14),new E(4,15)),new T(26,new E(4,13),new E(1,14))),new q(8,Int32Array.from([6,24,42]),new T(24,new E(2,97)),new T(22,new E(2,38),new E(2,39)),new T(22,new E(4,18),new E(2,19)),new T(26,new E(4,14),new E(2,15))),new q(9,Int32Array.from([6,26,46]),new T(30,new E(2,116)),new T(22,new E(3,36),new E(2,37)),new T(20,new E(4,16),new E(4,17)),new T(24,new E(4,12),new E(4,13))),new q(10,Int32Array.from([6,28,50]),new T(18,new E(2,68),new E(2,69)),new T(26,new E(4,43),new E(1,44)),new T(24,new E(6,19),new E(2,20)),new T(28,new E(6,15),new E(2,16))),new q(11,Int32Array.from([6,30,54]),new T(20,new E(4,81)),new T(30,new E(1,50),new E(4,51)),new T(28,new E(4,22),new E(4,23)),new T(24,new E(3,12),new E(8,13))),new q(12,Int32Array.from([6,32,58]),new T(24,new E(2,92),new E(2,93)),new T(22,new E(6,36),new E(2,37)),new T(26,new E(4,20),new E(6,21)),new T(28,new E(7,14),new E(4,15))),new q(13,Int32Array.from([6,34,62]),new T(26,new E(4,107)),new T(22,new E(8,37),new E(1,38)),new T(24,new E(8,20),new E(4,21)),new T(22,new E(12,11),new E(4,12))),new q(14,Int32Array.from([6,26,46,66]),new T(30,new E(3,115),new E(1,116)),new T(24,new E(4,40),new E(5,41)),new T(20,new E(11,16),new E(5,17)),new T(24,new E(11,12),new E(5,13))),new q(15,Int32Array.from([6,26,48,70]),new T(22,new E(5,87),new E(1,88)),new T(24,new E(5,41),new E(5,42)),new T(30,new E(5,24),new E(7,25)),new T(24,new E(11,12),new E(7,13))),new q(16,Int32Array.from([6,26,50,74]),new T(24,new E(5,98),new E(1,99)),new T(28,new E(7,45),new E(3,46)),new T(24,new E(15,19),new E(2,20)),new T(30,new E(3,15),new E(13,16))),new q(17,Int32Array.from([6,30,54,78]),new T(28,new E(1,107),new E(5,108)),new T(28,new E(10,46),new E(1,47)),new T(28,new E(1,22),new E(15,23)),new T(28,new E(2,14),new E(17,15))),new q(18,Int32Array.from([6,30,56,82]),new T(30,new E(5,120),new E(1,121)),new T(26,new E(9,43),new E(4,44)),new T(28,new E(17,22),new E(1,23)),new T(28,new E(2,14),new E(19,15))),new q(19,Int32Array.from([6,30,58,86]),new T(28,new E(3,113),new E(4,114)),new T(26,new E(3,44),new E(11,45)),new T(26,new E(17,21),new E(4,22)),new T(26,new E(9,13),new E(16,14))),new q(20,Int32Array.from([6,34,62,90]),new T(28,new E(3,107),new E(5,108)),new T(26,new E(3,41),new E(13,42)),new T(30,new E(15,24),new E(5,25)),new T(28,new E(15,15),new E(10,16))),new q(21,Int32Array.from([6,28,50,72,94]),new T(28,new E(4,116),new E(4,117)),new T(26,new E(17,42)),new T(28,new E(17,22),new E(6,23)),new T(30,new E(19,16),new E(6,17))),new q(22,Int32Array.from([6,26,50,74,98]),new T(28,new E(2,111),new E(7,112)),new T(28,new E(17,46)),new T(30,new E(7,24),new E(16,25)),new T(24,new E(34,13))),new q(23,Int32Array.from([6,30,54,78,102]),new T(30,new E(4,121),new E(5,122)),new T(28,new E(4,47),new E(14,48)),new T(30,new E(11,24),new E(14,25)),new T(30,new E(16,15),new E(14,16))),new q(24,Int32Array.from([6,28,54,80,106]),new T(30,new E(6,117),new E(4,118)),new T(28,new E(6,45),new E(14,46)),new T(30,new E(11,24),new E(16,25)),new T(30,new E(30,16),new E(2,17))),new q(25,Int32Array.from([6,32,58,84,110]),new T(26,new E(8,106),new E(4,107)),new T(28,new E(8,47),new E(13,48)),new T(30,new E(7,24),new E(22,25)),new T(30,new E(22,15),new E(13,16))),new q(26,Int32Array.from([6,30,58,86,114]),new T(28,new E(10,114),new E(2,115)),new T(28,new E(19,46),new E(4,47)),new T(28,new E(28,22),new E(6,23)),new T(30,new E(33,16),new E(4,17))),new q(27,Int32Array.from([6,34,62,90,118]),new T(30,new E(8,122),new E(4,123)),new T(28,new E(22,45),new E(3,46)),new T(30,new E(8,23),new E(26,24)),new T(30,new E(12,15),new E(28,16))),new q(28,Int32Array.from([6,26,50,74,98,122]),new T(30,new E(3,117),new E(10,118)),new T(28,new E(3,45),new E(23,46)),new T(30,new E(4,24),new E(31,25)),new T(30,new E(11,15),new E(31,16))),new q(29,Int32Array.from([6,30,54,78,102,126]),new T(30,new E(7,116),new E(7,117)),new T(28,new E(21,45),new E(7,46)),new T(30,new E(1,23),new E(37,24)),new T(30,new E(19,15),new E(26,16))),new q(30,Int32Array.from([6,26,52,78,104,130]),new T(30,new E(5,115),new E(10,116)),new T(28,new E(19,47),new E(10,48)),new T(30,new E(15,24),new E(25,25)),new T(30,new E(23,15),new E(25,16))),new q(31,Int32Array.from([6,30,56,82,108,134]),new T(30,new E(13,115),new E(3,116)),new T(28,new E(2,46),new E(29,47)),new T(30,new E(42,24),new E(1,25)),new T(30,new E(23,15),new E(28,16))),new q(32,Int32Array.from([6,34,60,86,112,138]),new T(30,new E(17,115)),new T(28,new E(10,46),new E(23,47)),new T(30,new E(10,24),new E(35,25)),new T(30,new E(19,15),new E(35,16))),new q(33,Int32Array.from([6,30,58,86,114,142]),new T(30,new E(17,115),new E(1,116)),new T(28,new E(14,46),new E(21,47)),new T(30,new E(29,24),new E(19,25)),new T(30,new E(11,15),new E(46,16))),new q(34,Int32Array.from([6,34,62,90,118,146]),new T(30,new E(13,115),new E(6,116)),new T(28,new E(14,46),new E(23,47)),new T(30,new E(44,24),new E(7,25)),new T(30,new E(59,16),new E(1,17))),new q(35,Int32Array.from([6,30,54,78,102,126,150]),new T(30,new E(12,121),new E(7,122)),new T(28,new E(12,47),new E(26,48)),new T(30,new E(39,24),new E(14,25)),new T(30,new E(22,15),new E(41,16))),new q(36,Int32Array.from([6,24,50,76,102,128,154]),new T(30,new E(6,121),new E(14,122)),new T(28,new E(6,47),new E(34,48)),new T(30,new E(46,24),new E(10,25)),new T(30,new E(2,15),new E(64,16))),new q(37,Int32Array.from([6,28,54,80,106,132,158]),new T(30,new E(17,122),new E(4,123)),new T(28,new E(29,46),new E(14,47)),new T(30,new E(49,24),new E(10,25)),new T(30,new E(24,15),new E(46,16))),new q(38,Int32Array.from([6,32,58,84,110,136,162]),new T(30,new E(4,122),new E(18,123)),new T(28,new E(13,46),new E(32,47)),new T(30,new E(48,24),new E(14,25)),new T(30,new E(42,15),new E(32,16))),new q(39,Int32Array.from([6,26,54,82,110,138,166]),new T(30,new E(20,117),new E(4,118)),new T(28,new E(40,47),new E(7,48)),new T(30,new E(43,24),new E(22,25)),new T(30,new E(10,15),new E(67,16))),new q(40,Int32Array.from([6,30,58,86,114,142,170]),new T(30,new E(19,118),new E(6,119)),new T(28,new E(18,47),new E(31,48)),new T(30,new E(34,24),new E(34,25)),new T(30,new E(20,15),new E(61,16)))];var Ke;(function(d){d[d.DATA_MASK_000=0]="DATA_MASK_000",d[d.DATA_MASK_001=1]="DATA_MASK_001",d[d.DATA_MASK_010=2]="DATA_MASK_010",d[d.DATA_MASK_011=3]="DATA_MASK_011",d[d.DATA_MASK_100=4]="DATA_MASK_100",d[d.DATA_MASK_101=5]="DATA_MASK_101",d[d.DATA_MASK_110=6]="DATA_MASK_110",d[d.DATA_MASK_111=7]="DATA_MASK_111"})(Ke||(Ke={}));class pt{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)this.isMasked(n,r)&&e.flip(r,n)}}pt.values=new Map([[Ke.DATA_MASK_000,new pt(Ke.DATA_MASK_000,(d,e)=>(d+e&1)===0)],[Ke.DATA_MASK_001,new pt(Ke.DATA_MASK_001,(d,e)=>
7(d&1)===0)],[Ke.DATA_MASK_010,new pt(Ke.DATA_MASK_010,(d,e)=>e%3===0)],[Ke.DATA_MASK_011,new pt(Ke.DATA_MASK_011,(d,e)=>(d+e)%3===0)],[Ke.DATA_MASK_100,new pt(Ke.DATA_MASK_100,(d,e)=>(Math.floor(d/2)+Math.floor(e/3)&1)===0)],[Ke.DATA_MASK_101,new pt(Ke.DATA_MASK_101,(d,e)=>d*e%6===0)],[Ke.DATA_MASK_110,new pt(Ke.DATA_MASK_110,(d,e)=>d*e%6<3)],[Ke.DATA_MASK_111,new pt(Ke.DATA_MASK_111,(d,e)=>(d+e+d*e%3&1)===0)]]);class Ri{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new G;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let i=0;i<6;i++)e=this.copyBit(i,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let i=5;i>=0;i--)e=this.copyBit(8,i,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let i=t-1;i>=r;i--)n=this.copyBit(8,i,n);for(let i=t-8;i<t;i++)n=this.copyBit(i,8,n);if(this.parsedFormatInfo=rt.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new G}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return q.getVersionForNumber(t);let n=0;const r=e-11;for(let s=5;s>=0;s--)for(let o=e-9;o>=r;o--)n=this.copyBit(o,s,n);let i=q.decodeVersionInformation(n);if(i!==null&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;n=0;for(let s=5;s>=0;s--)for(let o=e-9;o>=r;o--)n=this.copyBit(s,o,n);if(i=q.decodeVersionInformation(n),i!==null&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new G}copyBit(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}readCodewords(){const e=this.readFormatInformation(),t=this.readVersion(),n=pt.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const i=t.buildFunctionPattern();let s=!0;const o=new Uint8Array(t.getTotalCodewords());let a=0,l=0,h=0;for(let g=r-1;g>0;g-=2){g===6&&g--;for(let w=0;w<r;w++){const p=s?r-1-w:w;for(let _=0;_<2;_++)i.get(g-_,p)||(h++,l<<=1,this.bitMatrix.get(g-_,p)&&(l|=1),h===8&&(o[a++]=l,h=0,l=0))}s=!s}if(a!==t.getTotalCodewords())throw new G;return o}remask(){if(this.parsedFormatInfo===null)return;const e=pt.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){const e=this.bitMatrix;for(let t=0,n=e.getWidth();t<n;t++)for(let r=t+1,i=e.getHeight();r<i;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class fr{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new N;const r=t.getECBlocksForLevel(n);let i=0;const s=r.getECBlocks();for(const _ of s)i+=_.getCount();const o=new Array(i);let a=0;for(const _ of s)for(let b=0;b<_.getCount();b++){const S=_.getDataCodewords(),D=r.getECCodewordsPerBlock()+S;o[a++]=new fr(S,new Uint8Array(D))}const l=o[0].codewords.length;let h=o.length-1;for(;h>=0&&o[h].codewords.length!==l;)h--;h++;const g=l-r.getECCodewordsPerBlock();let w=0;for(let _=0;_<g;_++)for(let b=0;b<a;b++)o[b].codewords[_]=e[w++];for(let _=h;_<a;_++)o[_].codewords[g]=e[w++];const p=o[0].codewords.length;for(let _=g;_<p;_++)for(let b=0;b<a;b++){const S=b<h?_:_+1;o[b].codewords[S]=e[w++]}return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var _t;(function(d){d[d.TERMINATOR=0]="TERMINATOR",d[d.NUMERIC=1]="NUMERIC",d[d.ALPHANUMERIC=2]="ALPHANUMERIC",d[d.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",d[d.BYTE=4]="BYTE",d[d.ECI=5]="ECI",d[d.KANJI=6]="KANJI",d[d.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",d[d.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",d[d.HANZI=9]="HANZI"})(_t||(_t={}));class J{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,J.FOR_BITS.set(r,this),J.FOR_VALUE.set(e,this)}static forBits(e){const t=J.FOR_BITS.get(e);if(t===void 0)throw new N;return t}getCharacterCountBits(e){const t=e.getVersionNumber();let n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(e){if(!(e instanceof J))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}J.FOR_BITS=new Map,J.FOR_VALUE=new Map,J.TERMINATOR=new J(_t.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),J.NUMERIC=new J(_t.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),J.ALPHANUMERIC=new J(_t.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),J.STRUCTURED_APPEND=new J(_t.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),J.BYTE=new J(_t.BYTE,"BYTE",Int32Array.from([8,16,16]),4),J.ECI=new J(_t.ECI,"ECI",Int32Array.from([0,0,0]),7),J.KANJI=new J(_t.KANJI,"KANJI",Int32Array.from([8,10,12]),8),J.FNC1_FIRST_POSITION=new J(_t.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),J.FNC1_SECOND_POSITION=new J(_t.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),J.HANZI=new J(_t.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Pe{static decode(e,t,n,r){const i=new hr(e);let s=new Ie;const o=new Array;let a=-1,l=-1;try{let h=null,g=!1,w;do{if(i.available()<4)w=J.TERMINATOR;else{const p=i.readBits(4);w=J.forBits(p)}switch(w){case J.TERMINATOR:break;case J.FNC1_FIRST_POSITION:case J.FNC1_SECOND_POSITION:g=!0;break;case J.STRUCTURED_APPEND:if(i.available()<16)throw new G;a=i.readBits(8),l=i.readBits(8);break;case J.ECI:const p=Pe.parseECIValue(i);if(h=V.getCharacterSetECIByValue(p),h===null)throw new G;break;case J.HANZI:const _=i.readBits(4),b=i.readBits(w.getCharacterCountBits(t));_===Pe.GB2312_SUBSET&&Pe.decodeHanziSegment(i,s,b);break;default:const S=i.readBits(w.getCharacterCountBits(t));switch(w){case J.NUMERIC:Pe.decodeNumericSegment(i,s,S);break;case J.ALPHANUMERIC:Pe.decodeAlphanumericSegment(i,s,S,g);break;case J.BYTE:Pe.decodeByteSegment(i,s,S,h,o,r);break;case J.KANJI:Pe.decodeKanjiSegment(i,s,S);break;default:throw new G}break}}while(w!==J.TERMINATOR)}catch{throw new G}return new Cn(e,s.toString(),o.length===0?null:o,n===null?null:n.toString(),a,l)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new G;
7const r=new Uint8Array(2*n);let i=0;for(;n>0;){const s=e.readBits(13);let o=s/96<<8&4294967295|s%96;o<959?o+=41377:o+=42657,r[i]=o>>8&255,r[i+1]=o&255,i+=2,n--}try{t.append(ut.decode(r,se.GB2312))}catch(s){throw new G(s)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new G;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const s=e.readBits(13);let o=s/192<<8&4294967295|s%192;o<7936?o+=33088:o+=49472,r[i]=o>>8,r[i+1]=o,i+=2,n--}try{t.append(ut.decode(r,se.SHIFT_JIS))}catch(s){throw new G(s)}}static decodeByteSegment(e,t,n,r,i,s){if(8*n>e.available())throw new G;const o=new Uint8Array(n);for(let l=0;l<n;l++)o[l]=e.readBits(8);let a;r===null?a=se.guessEncoding(o,s):a=r.getName();try{t.append(ut.decode(o,a))}catch(l){throw new G(l)}i.push(o)}static toAlphaNumericChar(e){if(e>=Pe.ALPHANUMERIC_CHARS.length)throw new G;return Pe.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const i=t.length();for(;n>1;){if(e.available()<11)throw new G;const s=e.readBits(11);t.append(Pe.toAlphaNumericChar(Math.floor(s/45))),t.append(Pe.toAlphaNumericChar(s%45)),n-=2}if(n===1){if(e.available()<6)throw new G;t.append(Pe.toAlphaNumericChar(e.readBits(6)))}if(r)for(let s=i;s<t.length();s++)t.charAt(s)==="%"&&(s<t.length()-1&&t.charAt(s+1)==="%"?t.deleteCharAt(s+1):t.setCharAt(s,String.fromCharCode(29)))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new G;const r=e.readBits(10);if(r>=1e3)throw new G;t.append(Pe.toAlphaNumericChar(Math.floor(r/100))),t.append(Pe.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(Pe.toAlphaNumericChar(r%10)),n-=3}if(n===2){if(e.available()<7)throw new G;const r=e.readBits(7);if(r>=100)throw new G;t.append(Pe.toAlphaNumericChar(Math.floor(r/10))),t.append(Pe.toAlphaNumericChar(r%10))}else if(n===1){if(e.available()<4)throw new G;const r=e.readBits(4);if(r>=10)throw new G;t.append(Pe.toAlphaNumericChar(r))}}static parseECIValue(e){const t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){const n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){const n=e.readBits(16);return(t&31)<<16&4294967295|n}throw new G}}Pe.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Pe.GB2312_SUBSET=1;class Fr{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||e===null||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class Oi{constructor(){this.rsDecoder=new mn(Ce.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(ze.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new Ri(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(i){r=i}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const i=this.decodeBitMatrixParser(n,t);return i.setOther(new Fr(!0)),i}catch(i){throw r!==null?r:i}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),s=fr.getDataBlocks(i,n,r);let o=0;for(const h of s)o+=h.getNumDataCodewords();const a=new Uint8Array(o);let l=0;for(const h of s){const g=h.getCodewords(),w=h.getNumDataCodewords();this.correctErrors(g,w);for(let p=0;p<w;p++)a[l++]=g[p]}return Pe.decode(a,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new W}for(let r=0;r<t;r++)e[r]=n[r]}}class dr extends j{constructor(e,t,n){super(e,t),this.estimatedModuleSize=n}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=(this.getX()+t)/2,i=(this.getY()+e)/2,s=(this.estimatedModuleSize+n)/2;return new dr(r,i,s)}}class Gn{constructor(e,t,n,r,i,s,o){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=i,this.moduleSize=s,this.resultPointCallback=o,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,r=e+n,i=this.startY+t/2,s=new Int32Array(3),o=this.image;for(let a=0;a<t;a++){const l=i+((a&1)===0?Math.floor((a+1)/2):-Math.floor((a+1)/2));s[0]=0,s[1]=0,s[2]=0;let h=e;for(;h<r&&!o.get(h,l);)h++;let g=0;for(;h<r;){if(o.get(h,l))if(g===1)s[1]++;else if(g===2){if(this.foundPatternCross(s)){const w=this.handlePossibleCenter(s,l,h);if(w!==null)return w}s[0]=s[2],s[1]=1,s[2]=0,g=1}else s[++g]++;else g===1&&g++,s[g]++;h++}if(this.foundPatternCross(s)){const w=this.handlePossibleCenter(s,l,r);if(w!==null)return w}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new M}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;
7for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const i=this.image,s=i.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let a=e;for(;a>=0&&i.get(t,a)&&o[1]<=n;)o[1]++,a--;if(a<0||o[1]>n)return NaN;for(;a>=0&&!i.get(t,a)&&o[0]<=n;)o[0]++,a--;if(o[0]>n)return NaN;for(a=e+1;a<s&&i.get(t,a)&&o[1]<=n;)o[1]++,a++;if(a===s||o[1]>n)return NaN;for(;a<s&&!i.get(t,a)&&o[2]<=n;)o[2]++,a++;if(o[2]>n)return NaN;const l=o[0]+o[1]+o[2];return 5*Math.abs(l-r)>=2*r?NaN:this.foundPatternCross(o)?Gn.centerFromEnd(o,a):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],i=Gn.centerFromEnd(e,n),s=this.crossCheckVertical(t,i,2*e[1],r);if(!isNaN(s)){const o=(e[0]+e[1]+e[2])/3;for(const l of this.possibleCenters)if(l.aboutEquals(o,s,i))return l.combineEstimate(s,i,o);const a=new dr(i,s,o);this.possibleCenters.push(a),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(a)}return null}}class gr extends j{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,r===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=this.count+1,i=(this.count*this.getX()+t)/r,s=(this.count*this.getY()+e)/r,o=(this.count*this.estimatedModuleSize+n)/r;return new gr(i,s,o,r)}}class vi{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class qe{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=e!=null&&e.get(be.TRY_HARDER)!==void 0,n=e!=null&&e.get(be.PURE_BARCODE)!==void 0,r=this.image,i=r.getHeight(),s=r.getWidth();let o=Math.floor(3*i/(4*qe.MAX_MODULES));(o<qe.MIN_SKIP||t)&&(o=qe.MIN_SKIP);let a=!1;const l=new Int32Array(5);for(let g=o-1;g<i&&!a;g+=o){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let w=0;for(let p=0;p<s;p++)if(r.get(p,g))(w&1)===1&&w++,l[w]++;else if((w&1)===0)if(w===4)if(qe.foundPatternCross(l)){if(this.handlePossibleCenter(l,g,p,n)===!0)if(o=2,this.hasSkipped===!0)a=this.haveMultiplyConfirmedCenters();else{const b=this.findRowSkip();b>l[2]&&(g+=b-l[2]-o,p=s-1)}else{l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,w=3;continue}w=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,w=3;else l[++w]++;else l[w]++;qe.foundPatternCross(l)&&this.handlePossibleCenter(l,g,s,n)===!0&&(o=l[0],this.hasSkipped&&(a=this.haveMultiplyConfirmedCenters()))}const h=this.selectBestPatterns();return j.orderBestPatterns(h),new vi(h)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let i=0;i<5;i++){const s=e[i];if(s===0)return!1;t+=s}if(t<7)return!1;const n=t/7,r=n/2;return Math.abs(n-e[0])<r&&Math.abs(n-e[1])<r&&Math.abs(3*n-e[2])<3*r&&Math.abs(n-e[3])<r&&Math.abs(n-e[4])<r}getCrossCheckStateCount(){const e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,r){const i=this.getCrossCheckStateCount();let s=0;const o=this.image;for(;e>=s&&t>=s&&o.get(t-s,e-s);)i[2]++,s++;if(e<s||t<s)return!1;for(;e>=s&&t>=s&&!o.get(t-s,e-s)&&i[1]<=n;)i[1]++,s++;if(e<s||t<s||i[1]>n)return!1;for(;e>=s&&t>=s&&o.get(t-s,e-s)&&i[0]<=n;)i[0]++,s++;if(i[0]>n)return!1;const a=o.getHeight(),l=o.getWidth();for(s=1;e+s<a&&t+s<l&&o.get(t+s,e+s);)i[2]++,s++;if(e+s>=a||t+s>=l)return!1;for(;e+s<a&&t+s<l&&!o.get(t+s,e+s)&&i[3]<n;)i[3]++,s++;if(e+s>=a||t+s>=l||i[3]>=n)return!1;for(;e+s<a&&t+s<l&&o.get(t+s,e+s)&&i[4]<n;)i[4]++,s++;if(i[4]>=n)return!1;const h=i[0]+i[1]+i[2]+i[3]+i[4];return Math.abs(h-r)<2*r&&qe.foundPatternCross(i)}crossCheckVertical(e,t,n,r){const i=this.image,s=i.getHeight(),o=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(t,a);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(t,a)&&o[1]<=n;)o[1]++,a--;if(a<0||o[1]>n)return NaN;for(;a>=0&&i.get(t,a)&&o[0]<=n;)o[0]++,a--;
vendor: 5,695 bytes, line 7
7if(o[0]>n)return NaN;for(a=e+1;a<s&&i.get(t,a);)o[2]++,a++;if(a===s)return NaN;for(;a<s&&!i.get(t,a)&&o[3]<n;)o[3]++,a++;if(a===s||o[3]>=n)return NaN;for(;a<s&&i.get(t,a)&&o[4]<n;)o[4]++,a++;if(o[4]>=n)return NaN;const l=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(l-r)>=2*r?NaN:qe.foundPatternCross(o)?qe.centerFromEnd(o,a):NaN}crossCheckHorizontal(e,t,n,r){const i=this.image,s=i.getWidth(),o=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(a,t);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(a,t)&&o[1]<=n;)o[1]++,a--;if(a<0||o[1]>n)return NaN;for(;a>=0&&i.get(a,t)&&o[0]<=n;)o[0]++,a--;if(o[0]>n)return NaN;for(a=e+1;a<s&&i.get(a,t);)o[2]++,a++;if(a===s)return NaN;for(;a<s&&!i.get(a,t)&&o[3]<n;)o[3]++,a++;if(a===s||o[3]>=n)return NaN;for(;a<s&&i.get(a,t)&&o[4]<n;)o[4]++,a++;if(o[4]>=n)return NaN;const l=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(l-r)>=r?NaN:qe.foundPatternCross(o)?qe.centerFromEnd(o,a):NaN}handlePossibleCenter(e,t,n,r){const i=e[0]+e[1]+e[2]+e[3]+e[4];let s=qe.centerFromEnd(e,n),o=this.crossCheckVertical(t,Math.floor(s),e[2],i);if(!isNaN(o)&&(s=this.crossCheckHorizontal(Math.floor(s),Math.floor(o),e[2],i),!isNaN(s)&&(!r||this.crossCheckDiagonal(Math.floor(o),Math.floor(s),e[2],i)))){const a=i/7;let l=!1;const h=this.possibleCenters;for(let g=0,w=h.length;g<w;g++){const p=h[g];if(p.aboutEquals(a,o,s)){h[g]=p.combineEstimate(o,s,a),l=!0;break}}if(!l){const g=new gr(s,o,a);h.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const n of this.possibleCenters)if(n.getCount()>=qe.CENTER_QUORUM)if(t==null)t=n;else return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-n.getX())-Math.abs(t.getY()-n.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const s of this.possibleCenters)s.getCount()>=qe.CENTER_QUORUM&&(e++,t+=s.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let i=0;for(const s of this.possibleCenters)i+=Math.abs(s.getEstimatedModuleSize()-r);return i<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new M;const t=this.possibleCenters;let n;if(e>3){let r=0,i=0;for(const a of this.possibleCenters){const l=a.getEstimatedModuleSize();r+=l,i+=l*l}n=r/e;let s=Math.sqrt(i/e-n*n);t.sort((a,l)=>{const h=Math.abs(l.getEstimatedModuleSize()-n),g=Math.abs(a.getEstimatedModuleSize()-n);return h<g?-1:h>g?1:0});const o=Math.max(.2*n,s);for(let a=0;a<t.length&&t.length>3;a++){const l=t[a];Math.abs(l.getEstimatedModuleSize()-n)>o&&(t.splice(a,1),a--)}}if(t.length>3){let r=0;for(const i of t)r+=i.getEstimatedModuleSize();n=r/t.length,t.sort((i,s)=>{if(s.getCount()===i.getCount()){const o=Math.abs(s.getEstimatedModuleSize()-n),a=Math.abs(i.getEstimatedModuleSize()-n);return o<a?1:o>a?-1:0}else return s.getCount()-i.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}qe.CENTER_QUORUM=2,qe.MIN_SKIP=3,qe.MAX_MODULES=57;class pn{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(be.NEED_RESULT_POINT_CALLBACK);const n=new qe(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),i=this.calculateModuleSize(t,n,r);if(i<1)throw new M("No pattern found in proccess finder.");const s=pn.computeDimension(t,n,r,i),o=q.getProvisionalVersionForDimension(s),a=o.getDimensionForVersion()-7;let l=null;if(o.getAlignmentPatternCenters().length>0){const p=n.getX()-t.getX()+r.getX(),_=n.getY()-t.getY()+r.getY(),b=1-3/a,S=Math.floor(t.getX()+b*(p-t.getX())),D=Math.floor(t.getY()+b*(_-t.getY()));for(let k=4;k<=16;k<<=1)try{l=this.findAlignmentInRegion(i,S,D,k);break}catch(U){if(!(U instanceof M))throw U}}const h=pn.createTransform(t,n,r,l,s),g=pn.sampleGrid(this.image,h,s);let w;return l===null?w=[r,t,n]:w=[r,t,n,l],new Ln(g,w)}static createTransform(e,t,n,r,i){const s=i-3.5;let o,a,l,h;return r!==null?(o=r.getX(),a=r.getY(),l=s-3,h=l):(o=t.getX()-e.getX()+n.getX(),a=t.getY()-e.getY()+n.getY(),l=s,h=s),yt.quadrilateralToQuadrilateral(3.5,3.5,s,3.5,l,h,3.5,s,e.getX(),e.getY(),t.getX(),t.getY(),o,a,n.getX(),n.getY())}static sampleGrid(e,t,n){return Gt.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const i=ge.round(j.distance(e,t)/r),s=ge.round(j.distance(e,n)/r);let o=Math.floor((i+s)/2)+7;switch(o&3){case 0:o++;break;case 2:o--;break;case 3:throw new M("Dimensions could be not found.")}return o}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let i=this.sizeOfBlackWhiteBlackRun(e,t,n,r),s=1,o=e-(n-e);o<0?(s=e/(e-o),o=0):o>=this.image.getWidth()&&(s=(this.image.getWidth()-1-e)/(o-e),o=this.image.getWidth()-1);let a=Math.floor(t-(r-t)*s);return s=1,a<0?(s=t/(t-a),a=0):a>=this.image.getHeight()&&(s=(this.image.getHeight()-1-t)/(a-t),a=this.image.getHeight()-1),o=Math.floor(e+(o-e)*s),i+=this.sizeOfBlackWhiteBlackRun(e,t,o,a),i-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const i=Math.abs(r-t)>Math.abs(n-e);if(i){let p=e;e=t,t=p,p=n,n=r,r=p}const s=Math.abs(n-e),o=Math.abs(r-t);let a=-s/2;
7const l=e<n?1:-1,h=t<r?1:-1;let g=0;const w=n+l;for(let p=e,_=t;p!==w;p+=l){const b=i?_:p,S=i?p:_;if(g===1===this.image.get(b,S)){if(g===2)return ge.distance(p,_,e,t);g++}if(a+=o,a>0){if(_===r)break;_+=h,a-=s}}return g===2?ge.distance(n+l,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const i=Math.floor(r*e),s=Math.max(0,t-i),o=Math.min(this.image.getWidth()-1,t+i);if(o-s<e*3)throw new M("Alignment top exceeds estimated module size.");const a=Math.max(0,n-i),l=Math.min(this.image.getHeight()-1,n+i);if(l-a<e*3)throw new M("Alignment bottom exceeds estimated module size.");return new Gn(this.image,s,a,o-s,l-a,e,this.resultPointCallback).find()}}class Yt{constructor(){this.decoder=new Oi}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(be.PURE_BARCODE)!==void 0){const a=Yt.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(a,t),r=Yt.NO_POINTS}else{const a=new pn(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(a.getBits(),t),r=a.getPoints()}n.getOther()instanceof Fr&&n.getOther().applyMirroredCorrection(r);const i=new at(n.getText(),n.getRawBytes(),void 0,r,$.QR_CODE,void 0),s=n.getByteSegments();s!==null&&i.putMetadata(je.BYTE_SEGMENTS,s);const o=n.getECLevel();return o!==null&&i.putMetadata(je.ERROR_CORRECTION_LEVEL,o),n.hasStructuredAppend()&&(i.putMetadata(je.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),i.putMetadata(je.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new M;const r=this.moduleSize(t,e);let i=t[1],s=n[1],o=t[0],a=n[0];if(o>=a||i>=s)throw new M;if(s-i!==a-o&&(a=o+(s-i),a>=e.getWidth()))throw new M;const l=Math.round((a-o+1)/r),h=Math.round((s-i+1)/r);if(l<=0||h<=0)throw new M;if(h!==l)throw new M;const g=Math.floor(r/2);i+=g,o+=g;const w=o+Math.floor((l-1)*r)-a;if(w>0){if(w>g)throw new M;o-=w}const p=i+Math.floor((h-1)*r)-s;if(p>0){if(p>g)throw new M;i-=p}const _=new ze(l,h);for(let b=0;b<h;b++){const S=i+Math.floor(b*r);for(let D=0;D<l;D++)e.get(o+Math.floor(D*r),S)&&_.set(D,b)}return _}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let i=e[0],s=e[1],o=!0,a=0;for(;i<r&&s<n;){if(o!==t.get(i,s)){if(++a===5)break;o=!o}i++,s++}if(i===r||s===n)throw new M;return(i-e[0])/7}}Yt.NO_POINTS=new Array;class te{PDF417Common(){}static getBitCountSum(e){return ge.sum(e)}static toIntArray(e){if(e==null||!e.length)return te.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const r of e)t[n++]=r;return t}static getCodeword(e){const t=we.binarySearch(te.SYMBOL_TABLE,e&262143);return t<0?-1:(te.CODEWORD_TABLE[t]-1)%te.NUMBER_OF_CODEWORDS}}te.NUMBER_OF_CODEWORDS=929,te.MAX_CODEWORDS_IN_BARCODE=te.NUMBER_OF_CODEWORDS-1,te.MIN_ROWS_IN_BARCODE=3,te.MAX_ROWS_IN_BARCODE=90,te.MODULES_IN_CODEWORD=17,te.MODULES_IN_STOP_PATTERN=18,te.BARS_IN_MODULE=8,te.EMPTY_INT_ARRAY=new Int32Array([]),t
vendor: 18,273 bytes, line 7
7e.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),
7t
vendor: 12,868 bytes, line 7
7e.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class 
7Di{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ce{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),i=ce.detect(n,r);return i.length||(r=r.clone(),r.rotate180(),i=ce.detect(n,r)),new Di(r,i)}static detect(e,t){const n=new Array;let r=0,i=0,s=!1;for(;r<t.getHeight();){const o=ce.findVertices(t,r,i);if(o[0]==null&&o[3]==null){if(!s)break;s=!1,i=0;for(const a of n)a[1]!=null&&(r=Math.trunc(Math.max(r,a[1].getY()))),a[3]!=null&&(r=Math.max(r,Math.trunc(a[3].getY())));r+=ce.ROW_STEP;continue}if(s=!0,n.push(o),!e)break;o[2]!=null?(i=Math.trunc(o[2].getX()),r=Math.trunc(o[2].getY())):(i=Math.trunc(o[4].getX()),r=Math.trunc(o[4].getY()))}return n}static findVertices(e,t,n){const r=e.getHeight(),i=e.getWidth(),s=new Array(8);return ce.copyToResult(s,ce.findRowsWithPattern(e,r,i,t,n,ce.START_PATTERN),ce.INDEXES_START_PATTERN),s[4]!=null&&(n=Math.trunc(s[4].getX()),t=Math.trunc(s[4].getY())),ce.copyToResult(s,ce.findRowsWithPattern(e,r,i,t,n,ce.STOP_PATTERN),ce.INDEXES_STOP_PATTERN),s}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,i,s){const o=new Array(4);let a=!1;const l=new Int32Array(s.length);for(;r<t;r+=ce.ROW_STEP){let g=ce.findGuardPattern(e,i,r,n,!1,s,l);if(g!=null){for(;r>0;){const w=ce.findGuardPattern(e,i,--r,n,!1,s,l);if(w!=null)g=w;else{r++;break}}o[0]=new j(g[0],r),o[1]=new j(g[1],r),a=!0;break}}let h=r+1;if(a){let g=0,w=Int32Array.from([Math.trunc(o[0].getX()),Math.trunc(o[1].getX())]);for(;h<t;h++){const p=ce.findGuardPattern(e,w[0],h,n,!1,s,l);if(p!=null&&Math.abs(w[0]-p[0])<ce.MAX_PATTERN_DRIFT&&Math.abs(w[1]-p[1])<ce.MAX_PATTERN_DRIFT)w=p,g=0;else{if(g>ce.SKIPPED_ROW_COUNT_MAX)break;g++}}h-=g+1,o[2]=new j(w[0],h),o[3]=new j(w[1],h)}return h-r<ce.BARCODE_MIN_HEIGHT&&we.fill(o,null),o}static findGuardPattern(e,t,n,r,i,s,o){we.fillWithin(o,0,o.length,0);let a=t,l=0;for(;e.get(a,n)&&a>0&&l++<ce.MAX_PIXEL_DRIFT;)a--;let h=a,g=0,w=s.length;for(let p=i;h<r;h++)if(e.get(h,n)!==p)o[g]++;else{if(g===w-1){if(ce.patternMatchVariance(o,s,ce.MAX_INDIVIDUAL_VARIANCE)<ce.MAX_AVG_VARIANCE)return new Int32Array([a,h]);a+=o[0]+o[1],ie.arraycopy(o,2,o,0,g-1),o[g-1]=0,o[g]=0,g--}else g++;o[g]=1,p=!p}return g===w-1&&ce.patternMatchVariance(o,s,ce.MAX_INDIVIDUAL_VARIANCE)<ce.MAX_AVG_VARIANCE?new Int32Array([a,h-1]):null}static patternMatchVariance(e,t,n){let r=e.length,i=0,s=0;for(let l=0;l<r;l++)i+=e[l],s+=t[l];if(i<s)return 1/0;let o=i/s;n*=o;let a=0;for(let l=0;l<r;l++){let h=e[l],g=t[l]*o,w=h>g?h-g:g-h;if(w>n)return 1/0;a+=w}return a/i}}ce.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ce.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ce.MAX_AVG_VARIANCE=.42,ce.MAX_INDIVIDUAL_VARIANCE=.8,ce.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ce.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ce.MAX_PIXEL_DRIFT=3,ce.MAX_PATTERN_DRIFT=5,ce.SKIPPED_ROW_COUNT_MAX=25,ce.ROW_STEP=5,ce.BARCODE_MIN_HEIGHT=10;class Je{constructor(e,t){if(t.length===0)throw new N;this.field=e;let n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-r),ie.arraycopy(t,r,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);if(e===1){let r=0;for(let i of this.coefficients)r=this.field.add(r,i);return r}let t=this.coefficients[0],n=this.coefficients.length;for(let r=1;r<n;r++)t=this.field.add(this.field.multiply(e,t),this.coefficients[r]);return t}add(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){let s=t;t=n,n=s}let r=new Int32Array(n.length),i=n.length-t.length;ie.arraycopy(n,0,r,0,i);for(let s=i;s<n.length;s++)r[s]=this.field.add(t[s-i],n[s]);return new Je(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do n
7ot have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Je?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Je(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,s=new Int32Array(n+i-1);for(let o=0;o<n;o++){let a=t[o];for(let l=0;l<i;l++)s[o+l]=this.field.add(s[o+l],this.field.multiply(a,r[l]))}return new Je(this.field,s)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new Je(this.field,t)}multiplyScalar(e){if(e===0)return new Je(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=this.field.multiply(this.coefficients[r],e);return new Je(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new N;if(t===0)return new Je(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let i=0;i<n;i++)r[i]=this.field.multiply(this.coefficients[i],t);return new Je(this.field,r)}toString(){let e=new Ie;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class Mi{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(e===0)throw new N;return this.logTable[e]}inverse(e){if(e===0)throw new Bn;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class xr extends Mi{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let r=0;r<e;r++)this.expTable[r]=n,n=n*t%e;for(let r=0;r<e-1;r++)this.logTable[this.expTable[r]]=r;this.zero=new Je(this,new Int32Array([0])),this.one=new Je(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Je(this,n)}}xr.PDF417_GF=new xr(te.NUMBER_OF_CODEWORDS,3);class kr{constructor(){this.field=xr.PDF417_GF}decode(e,t,n){let r=new Je(this.field,e),i=new Int32Array(t),s=!1;for(let _=t;_>0;_--){let b=r.evaluateAt(this.field.exp(_));i[t-_]=b,b!==0&&(s=!0)}if(!s)return 0;let o=this.field.getOne();if(n!=null)for(const _ of n){let b=this.field.exp(e.length-1-_),S=new Je(this.field,new Int32Array([this.field.subtract(0,b),1]));o=o.multiply(S)}let a=new Je(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),h=l[0],g=l[1],w=this.findErrorLocations(h),p=this.findErrorMagnitudes(g,h,w);for(let _=0;_<w.length;_++){let b=e.length-1-this.field.log(w[_]);if(b<0)throw W.getChecksumInstance();e[b]=this.field.subtract(e[b],p[_])}return w.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let w=e;e=t,t=w}let r=e,i=t,s=this.field.getZero(),o=this.field.getOne();for(;i.getDegree()>=Math.round(n/2);){let w=r,p=s;if(r=i,s=o,r.isZero())throw W.getChecksumInstance();i=w;let _=this.field.getZero(),b=r.getCoefficient(r.getDegree()),S=this.field.inverse(b);for(;i.getDegree()>=r.getDegree()&&!i.isZero();){let D=i.getDegree()-r.getDegree(),k=this.field.multiply(i.getCoefficient(i.getDegree()),S);_=_.add(this.field.buildMonomial(D,k)),i=i.subtract(r.multiplyByMonomial(D,k))}o=_.multiply(s).subtract(p).negative()}let a=o.getCoefficient(0);if(a===0)throw W.getChecksumInstance();let l=this.field.inverse(a),h=o.multiply(l),g=i.multiply(l);return[h,g]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let i=1;i<this.field.getSize()&&r<t;i++)e.evaluateAt(i)===0&&(n[r]=this.field.inverse(i),r++);if(r!==t)throw W.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),i=new Int32Array(r);for(let l=1;l<=r;l++)i[r-l]=this.field.multiply(l,t.getCoefficient(l));let s=new Je(this.field,i),o=n.length,a=new Int32Array(o);for(let l=0;l<o;l++){let h=this.field.inverse(n[l]),g=this.field.subtract(0,e.evaluateAt(h)),w=this.field.inverse(s.evaluateAt(h));a[l]=this.field.multiply(g,w)}return a}}class Jt{constructor(e,t,n,r,i){e instanceof Jt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){const s=t==null||n==null,o=r==null||i==null;if(s&&o)throw new M;s?(t=new j(0,r.getY()),n=new j(0,i.getY())):o&&(r=new j(e.getWidth()-1,t.getY()),i=new j(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return e==null?t:t==null?e:new Jt(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,i=this.bottomLeft,s=this.topRight,o=this.bottomRight;if(e>0){let a=n?this.topLeft:this.topRight,l=Math.trunc(a.getY()-e);l<0&&(l=0);let h=new j(a.getX(),l);n?r=h:s=h}if(t>0){let a=n?this.bottomLeft:this.bottomRight,l=Math.trunc(a.getY()+t);l>=this.image.getHeight()&&(l=this.image.getHeight()-1);let h=new j(a.getX(),l);n?i=h:o=h}return new Jt(this.image,r,i,s,o)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Bi{constructor(e,t,n,r){this.columnCount=e,this.errorCorrectionLevel=r,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class _n{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(s,o,a,l,h,g){if(s==="%%")return"%";if(t[++n]===void 0)return;s=l?parseInt(l.substr(1)):void 0;let w=h?parseInt(h.substr(1)):void 0,p;switch(g){case"s":p=t[n];break;case"c":p=t[n][0];break;case"f":p=parseFloat(t[n]).toFixed(s);break;case"p":p=parseFloat(t[n]).toPrecision(s);break;case"e":p=parseFloat(t[n]).toExponential(s);break;case"x":p=parseInt(t[n]).toString(w||16);break;case"d":p=parseFloat(parseInt(t[n],w||10).toPrecision(s)).toFixed(0);break}p=typeof p=="object"?JSON.stringify(p):(+p).toString(w);let _=parseInt(a),b=a&&a[0]+""=="0"?"0":" ";for(;p.length<_;)p=o!==void 0?p+b:b+p;return p}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}format(e,...t){this.buffer+=_n.form(e,t)}toString(){return this.buffer}}class bn{constructor(e){this.boundingBox=new Jt(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(t!=null)return t;for(let n=1;n<bn.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(e)-n;if(r>=0&&(t=this.codewords[r],t!=null)||(r=this.imageRowToCodewordIndex(e)+n,r<this.codewords.length&&(t=this.codewords[r],t!=null)))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}
7setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const e=new _n;let t=0;for(const n of this.codewords){if(n==null){e.format("%3d:    |   %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue())}return e.toString()}}bn.MAX_NEARBY_DISTANCE=5;class In{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,r]of this.values.entries()){const i={getKey:()=>n,getValue:()=>r};i.getValue()>e?(e=i.getValue(),t=[],t.push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return te.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Ur extends bn{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())e!=null&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),r=this._isLeft?n.getTopLeft():n.getTopRight(),i=this._isLeft?n.getBottomLeft():n.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,l=1,h=0;for(let g=s;g<o;g++){if(t[g]==null)continue;let w=t[g],p=w.getRowNumber()-a;if(p===0)h++;else if(p===1)l=Math.max(l,h),h=1,a=w.getRowNumber();else if(p<0||w.getRowNumber()>=e.getRowCount()||p>g)t[g]=null;else{let _;l>2?_=(l-2)*p:_=p;let b=_>=g;for(let S=1;S<=_&&!b;S++)b=t[g-S]!=null;b?t[g]=null:(a=w.getRowNumber(),h=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(e==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let n of this.getCodewords())if(n!=null){let r=n.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),s=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.getCodewords(),a=-1;for(let l=i;l<s;l++){if(o[l]==null)continue;let h=o[l];h.setRowNumberAsRowIndicatorColumn();let g=h.getRowNumber()-a;g===0||(g===1?a=h.getRowNumber():h.getRowNumber()>=e.getRowCount()?o[l]=null:a=h.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new In,n=new In,r=new In,i=new In;for(let o of e){if(o==null)continue;o.setRowNumberAsRowIndicatorColumn();let a=o.getValue()%30,l=o.getRowNumber();switch(this._isLeft||(l+=2),l%3){case 0:n.setValue(a*3+1);break;case 1:i.setValue(a/3),r.setValue(a%3);break;case 2:t.setValue(a+1);break}}if(t.getValue().length===0||n.getValue().length===0||r.getValue().length===0||i.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<te.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>te.MAX_ROWS_IN_BARCODE)return null;let s=new Bi(t.getValue()[0],n.getValue()[0],r.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,s),s}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(e[n]==null)continue;let i=r.getValue()%30,s=r.getRowNumber();if(s>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(s+=2),s%3){case 0:i*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(i/3)!==t.getErrorCorrectionLevel()||i%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:i+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
8`+super.toString()}}class yn{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let e=te.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(e===0)return 0;for(let t=1;t<this.barcodeColumnCount+1;t++){let n=this.detectionResultColumns[t].getCodewords();for(let r=0;r<n.length;r++)n[r]!=null&&(n[r].hasValidRowNumber()||this.adjustRowNumbers(t,r,n))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}
8adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(let r=1;r<=this.barcodeColumnCount;r++){let i=this.detectionResultColumns[r].getCodewords()[n];i!=null&&(i.setRowNumber(e[n].getRowNumber()),i.hasValidRowNumber()||(this.detectionResultColumns[r].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let r=t[n].getRowNumber(),i=0;for(let s=this.barcodeColumnCount+1;s>0&&i<this.ADJUST_ROW_NUMBER_SKIP;s--){let o=this.detectionResultColumns[s].getCodewords()[n];o!=null&&(i=yn.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let r=t[n].getRowNumber(),i=0;for(let s=1;s<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;s++){let o=this.detectionResultColumns[s].getCodewords()[n];o!=null&&(i=yn.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let r=n[t],i=this.detectionResultColumns[e-1].getCodewords(),s=i;this.detectionResultColumns[e+1]!=null&&(s=this.detectionResultColumns[e+1].getCodewords());let o=new Array(14);o[2]=i[t],o[3]=s[t],t>0&&(o[0]=n[t-1],o[4]=i[t-1],o[5]=s[t-1]),t>1&&(o[8]=n[t-2],o[10]=i[t-2],o[11]=s[t-2]),t<n.length-1&&(o[1]=n[t+1],o[6]=i[t+1],o[7]=s[t+1]),t<n.length-2&&(o[9]=n[t+2],o[12]=i[t+2],o[13]=s[t+2]);for(let a of o)if(yn.adjustRowNumber(r,a))return}static adjustRowNumber(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new _n;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let r=0;r<this.barcodeColumnCount+2;r++){if(this.detectionResultColumns[r]==null){t.format("    |   ");continue}let i=this.detectionResultColumns[r].getCodewords()[n];if(i==null){t.format("    |   ");continue}t.format(" %3d|%3d",i.getRowNumber(),i.getValue())}t.format("%n")}return t.toString()}}class Sn{constructor(e,t,n,r){this.rowNumber=Sn.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(r)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Sn.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}Sn.BARCODE_ROW_UNKNOWN=-1;class gt{static initialize(){for(let e=0;e<te.SYMBOL_TABLE.length;e++){let t=te.SYMBOL_TABLE[e],n=t&1;for(let r=0;r<te.BARS_IN_MODULE;r++){let i=0;for(;(t&1)===n;)i+=1,t>>=1;n=t&1,gt.RATIOS_TABLE[e]||(gt.RATIOS_TABLE[e]=new Array(te.BARS_IN_MODULE)),gt.RATIOS_TABLE[e][te.BARS_IN_MODULE-r-1]=Math.fround(i/te.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=gt.getDecodedCodewordValue(gt.sampleBitCounts(e));return t!==-1?t:gt.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ge.sum(e),n=new Int32Array(te.BARS_IN_MODULE),r=0,i=0;for(let s=0;s<te.MODULES_IN_CODEWORD;s++){let o=t/(2*te.MODULES_IN_CODEWORD)+s*t/te.MODULES_IN_CODEWORD;i+e[r]<=o&&(i+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=gt.getBitValue(e);return te.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let r=0;r<e[n];r++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ge.sum(e),n=new Array(te.BARS_IN_MODULE);if(t>1)for(let s=0;s<n.length;s++)n[s]=Math.fround(e[s]/t);let r=Pn.MAX_VALUE,i=-1;this.bSymbolTableReady||gt.initialize();for(let s=0;s<gt.RATIOS_TABLE.length;s++){let o=0,a=gt.RATIOS_TABLE[s];for(let l=0;l<te.BARS_IN_MODULE;l++){let h=Math.fround(a[l]-n[l]);if(o+=Math.fround(h*h),o>=r)break}o<r&&(r=o,i=te.SYMBOL_TABLE[s])}return i}}gt.bSymbolTableReady=!1,gt.RATIOS_TABLE=new Array(te.SYMBOL_TABLE.length).map(d=>new Array(te.BARS_IN_MODULE));class Vr{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class Gr{static parseLong(e,t=void 0){return parseInt(e,t)}}class Hr extends C{}Hr.kind="NullPointerException";class Pi{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Hr;
8if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new De;if(n===0)return;for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class Li extends C{}class Fi extends Pi{constructor(e=32){if(super(),this.count=0,e<0)throw new N("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let n=this.buf.length<<1;if(n-e<0&&(n=e),n<0){if(e<0)throw new Li;n=Q.MAX_VALUE}this.buf=we.copyOfUint8Array(this.buf,n)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,n){if(t<0||t>e.length||n<0||t+n-e.length>0)throw new De;this.ensureCapacity(this.count+n),ie.arraycopy(e,t,this.buf,this.count,n),this.count+=n}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return we.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?typeof e=="string"?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}var ye;(function(d){d[d.ALPHA=0]="ALPHA",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.PUNCT=3]="PUNCT",d[d.ALPHA_SHIFT=4]="ALPHA_SHIFT",d[d.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(ye||(ye={}));function Wr(){if(typeof window<"u")return window.BigInt||null;if(typeof Rn<"u")return Rn.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let Hn;function zt(d){if(typeof Hn>"u"&&(Hn=Wr()),Hn===null)throw new Error("BigInt is not supported!");return Hn(d)}function ki(){let d=[];d[0]=zt(1);let e=zt(900);d[1]=e;for(let t=2;t<16;t++)d[t]=d[t-1]*e;return d}class O{static decode(e,t){let n=new Ie(""),r=V.ISO8859_1;n.enableDecoding(r);let i=1,s=e[i++],o=new Vr;for(;i<e[0];){switch(s){case O.TEXT_COMPACTION_MODE_LATCH:i=O.textCompaction(e,i,n);break;case O.BYTE_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH_6:i=O.byteCompaction(s,e,r,i,n);break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case O.NUMERIC_COMPACTION_MODE_LATCH:i=O.numericCompaction(e,i,n);break;case O.ECI_CHARSET:V.getCharacterSetECIByValue(e[i++]);break;case O.ECI_GENERAL_PURPOSE:i+=2;break;case O.ECI_USER_DEFINED:i++;break;case O.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=O.decodeMacroBlock(e,i,o);break;case O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case O.MACRO_PDF417_TERMINATOR:throw new G;default:i--,i=O.textCompaction(e,i,n);break}if(i<e.length)s=e[i++];else throw G.getFormatInstance()}if(n.length()===0)throw G.getFormatInstance();let a=new Cn(null,n.toString(),null,t);return a.setOther(o),a}static decodeMacroBlock(e,t,n){if(t+O.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw G.getFormatInstance();let r=new Int32Array(O.NUMBER_OF_SEQUENCE_CODEWORDS);for(let o=0;o<O.NUMBER_OF_SEQUENCE_CODEWORDS;o++,t++)r[o]=e[t];n.setSegmentIndex(Q.parseInt(O.decodeBase900toBase10(r,O.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new Ie;t=O.textCompaction(e,t,i),n.setFileId(i.toString());let s=-1;for(e[t]===O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(s=t+1);t<e[0];)switch(e[t]){case O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case O.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let o=new Ie;t=O.textCompaction(e,t+1,o),n.setFileName(o.toString());break;case O.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let a=new Ie;t=O.textCompaction(e,t+1,a),n.setSender(a.toString());break;case O.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let l=new Ie;t=O.textCompaction(e,t+1,l),n.setAddressee(l.toString());break;case O.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let h=new Ie;t=O.numericCompaction(e,t+1,h),n.setSegmentCount(Q.parseInt(h.toString()));break;case O.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let g=new Ie;t=O.numericCompaction(e,t+1,g),n.setTimestamp(Gr.parseLong(g.toString()));break;case O.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let w=new Ie;t=O.numericCompaction(e,t+1,w),n.setChecksum(Q.parseInt(w.toString()));break;case O.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let p=new Ie;t=O.numericCompaction(e,t+1,p),n.setFileSize(Gr.parseLong(p.toString()));break;default:throw G.getFormatInstance()}break;case O.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw G.getFormatInstance()}if(s!==-1){let o=t-s;n.isLastSegment()&&o--,n.setOptionalData(we.copyOfRange(e,s,s+o))}return t}static textCompaction(e,t,n){let r=new Int32Array((e[0]-t)*2),i=new Int32Array((e[0]-t)*2),s=0,o=!1;for(;t<e[0]&&!o;){let a=e[t++];if(a<O.TEXT_COMPACTION_MODE_LATCH)r[s]=a/30,r[s+1]=a%30,s+=2;else switch(a){case O.TEXT_COMPACTION_MODE_LATCH:r[s++]=O.TEXT_COMPACTION_MODE_LATCH;break;case O.BYTE_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH_6:case O.NUMERIC_COMPACTION_MODE_LATCH:case O.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case O.MACRO_PDF417_TERMINATOR:t--,o=!0;break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[s]=O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,a=e[t++],i[s]=a,s++;break}}return O.decodeTextCompaction(r,i,s,n),t}static decodeTextCompaction(e,t,n,r){let i=ye.ALPHA,s=ye.ALPHA,o=0;for(;o<n;){let a=e[o],l="";switch(i){case ye.ALPHA:if(a<26)l=String.fromCharCode(65+a);else switch(a){case 26:l=" ";break;case O.LL:i=ye.LOWER;break;case O.ML:i=ye.MIXED;break;case O.PS:s=i,i=ye.PUNCT_SHIFT;break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case O.TEXT_COMPACTION_MODE_LATCH:i=ye.ALPHA;break}break;case ye.LOWER:if(a<26)l=String.fromCharCode(97+a);else switch(a){case 26:l=" ";break;case O.AS:s=i,i=ye.ALPHA_SHIFT;break;case O.ML:i=ye.MIXED;break;case O.PS:s=i,i=ye.PUNCT_SHIFT;break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case O.TEXT_COMPACTION_MODE_LATCH:i=ye.ALPHA;break}break;case ye.MIXED:if(a<O.PL)l=O.MIXED_CHARS[a];else switch(a){case O.PL:i=ye.PUNCT;break;case 26:l=" ";break;case O.LL:i=ye.LOWER;break;case O.AL:i=ye.ALPHA;break;case O.PS:s=i,i=ye.PUNCT_SHIFT;break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case O.TEXT_COMPACTION_MODE_LATCH:i=ye.ALPHA;break}break;case ye.PUNCT:if(a<O.PAL)l=O.PUNCT_CHARS[a];else switch(a){case O.PAL:i=ye.ALPHA;break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case O.TEXT_COMPACTION_MODE_LATCH:i=ye.ALPHA;break}break;case ye.ALPHA_SHIFT:if(i=s,a<26)l=String.fromCharCode(65+a);else switch(a){case 26:l=" ";break;case O.TEXT_COMPACTION_MODE_LATCH:i=ye.ALPHA;break}break;case ye.PUNCT_SHIFT:if(i=s,a<O.PAL)l=O.PUNCT_CHARS[a];else switch(a){case O.PAL:i=ye.ALPHA;break;case O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case O.TEXT_COMPACTION_MODE_LATCH:i=ye.ALPHA;break}break}l!==""&&r.append(l),o++}}static byteCompaction(e,t,n,r,i){let s=new Fi,o=0,a=0,l=!1;switch(e){case O.BYTE_COMPACTION_MODE_LATCH:let h=new Int32Array(6),g=t[r++];for(;r<t[0]&&!l;)switch(h[o++]=g,a=900*a+g,g=t[r++],g){case O.TEXT_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH:case O.NUMERIC_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH_6:case O.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case O.MACRO_PDF417_TERMINATOR:r--,l=!0;break;default:if(o%5===0&&o>0){for(let w=0;w<6;++w)s.write(Number(zt(a)>>zt(8*(5-w))));a=0,o=0}break}r===t[0]&&g<O.TEXT_COMPACTION_MODE_LATCH&&(h[o++]=g);for(let w=0;w<o;w++)s.write(h[w]);break;case O.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!l;){let w=t[r++];if(w<O.TEXT_COMPACTION_MODE_LATCH)o++,a=900*a+w;else switch(w){case O.TEXT_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH:case O.NUMERIC_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH_6:case O.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case O.MACRO_PDF417_TERMINATOR:r--,l=!0;break}if(o%5===0&&o>0){for(let p=0;p<6;++p)s.write(Number(zt(a)>>zt(8*(5-p))));a=0,o=0}}break}return i.append(ut.decode(s.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,i=!1,s=new Int32Array(O.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let o=e[t++];if(t===e[0]&&(i=!0),o<O.TEXT_COMPACTION_MODE_LATCH)s[r]=o,r++;else switch(o){case O.TEXT_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH:case O.BYTE_COMPACTION_MODE_LATCH_6:case O.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case O.MACRO_PDF417_TERMINATOR:t--,i=!0;break}(r%O.MAX_NUMERIC_CODEWORDS===0||o===O.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(O.decodeBase900toBase10(s,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=zt(0);for(let i=0;i<t;i++)n+=O.EXP900[t-i-1]*zt(e[i]);let r=n.toString();if(r.charAt(0)!=="1")throw new G;return r.substring(1)}}O.TEXT_COMPACTION_MODE_LATCH=900,O.BYTE_COMPACTION_MODE_LATCH=901,O.NUMERIC_COMPACTION_MODE_LATCH=902,O.BYTE_COMPACTION_MODE_LATCH_6=924,O.ECI_USER_DEFINED=925,O.ECI_GENERAL_PURPOSE=926,O.ECI_CHARSET=927,O.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,O.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,O.MACRO_PDF417_TERMINATOR=922,O.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,O.MAX_NUMERIC_CODEWORDS=15,O.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,O.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,O.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,O.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,O.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,O.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,O.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,O.PL=25,O.LL=27,O.AS=27,O.ML=28,O.AL=28,O.PS=29,O.PAL=29,O.PUNCT_CHARS=`;<>@[\\]_\`~!\r	,:
9-.$/"|*()?{}'`,O.MIXED_CHARS="0123456789&\r	,:#-.$/+%*=^",O.EXP900=Wr()?ki():[],O.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ue{constructor(){}static decode(e,t,n,r,i,s,o){let a=new Jt(e,t,n,r,i),l=null,h=null,g;for(let _=!0;;_=!1){if(t!=null&&(l=ue.getRowIndicatorColumn(e,a,t,!0,s,o)),r!=null&&(h=ue.getRowIndicatorColumn(e,a,r,!1,s,o)),g=ue.merge(l,h),g==null)throw M.getNotFoundInstance();let b=g.getBoundingBox();if(_&&b!=null&&(b.getMinY()<a.getMinY()||b.getMaxY()>a.getMaxY()))a=b;else break}g.setBoundingBox(a);let w=g.getBarcodeColumnCount()+1;g.setDetectionResultColumn(0,l),g.setDetectionResultColumn(w,h);let p=l!=null;for(let _=1;_<=w;_++){let b=p?_:w-_;if(g.getDetectionResultColumn(b)!==void 0)continue;let S;b===0||b===w?S=new Ur(a,b===0):S=new bn(a),g.setDetectionResultColumn(b,S);let D=-1,k=D;for(let U=a.getMinY();U<=a.getMaxY();U++){if(D=ue.getStartColumn(g,b,U,p),D<0||D>a.getMaxX()){if(k===-1)continue;D=k}let F=ue.detectCodeword(e,a.getMinX(),a.getMaxX(),p,D,U,s,o);F!=null&&(S.setCodeword(U,F),k=D,s=Math.min(s,F.getWidth()),o=Math.max(o,F.getWidth()))}}return ue.createDecoderResult(g)}static merge(e,t){if(e==null&&t==null)return null;let n=ue.getBarcodeMetadata(e,t);if(n==null)return null;let r=Jt.merge(ue.adjustBoundingBox(e),ue.adjustBoundingBox(t));return new yn(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=ue.getMax(t),r=0;for(let o of t)if(r+=n-o,o>0)break;let i=e.getCodewords();for(let o=0;r>0&&i[o]==null;o++)r--;let s=0;for(let o=t.length-1;o>=0&&(s+=n-t[o],!(t[o]>0));o--);for(let o=i.length-1;s>0&&i[o]==null;o--)s--;return e.getBoundingBox().addMissingRows(r,s,e.isLeft())}static getMax(e){let t=-1;for(let n of e)t=Math.max(t,n);return t}static getBarcodeMetadata(e,t){let n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();let r;return t==null||(r=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,i,s){let o=new Ur(t,r);for(let a=0;a<2;a++){let l=a===0?1:-1,h=Math.trunc(Math.trunc(n.getX()));for(let g=Math.trunc(Math.trunc(n.getY()));g<=t.getMaxY()&&g>=t.getMinY();g+=l){let w=ue.detectCodeword(e,0,e.getWidth(),r,h,g,i,s);
9w!=null&&(o.setCodeword(g,w),r?h=w.getStartX():h=w.getEndX())}}return o}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-ue.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(i<1||i>te.MAX_CODEWORDS_IN_BARCODE)throw M.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=ue.createBarcodeMatrix(e);ue.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],s=new Array;for(let a=0;a<e.getBarcodeRowCount();a++)for(let l=0;l<e.getBarcodeColumnCount();l++){let h=t[a][l+1].getValue(),g=a*e.getBarcodeColumnCount()+l;h.length===0?n.push(g):h.length===1?r[g]=h[0]:(s.push(g),i.push(h))}let o=new Array(i.length);for(let a=0;a<o.length;a++)o[a]=i[a];return ue.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,te.toIntArray(n),te.toIntArray(s),o)}static createDecoderResultFromAmbiguousValues(e,t,n,r,i){let s=new Int32Array(r.length),o=100;for(;o-- >0;){for(let a=0;a<s.length;a++)t[r[a]]=i[a][s[a]];try{return ue.decodeCodewords(t,e,n)}catch(a){if(!(a instanceof W))throw a}if(s.length===0)throw W.getChecksumInstance();for(let a=0;a<s.length;a++)if(s[a]<i[a].length-1){s[a]++;break}else if(s[a]=0,a===s.length-1)throw W.getChecksumInstance()}throw W.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let r=0;r<t.length;r++)for(let i=0;i<t[r].length;i++)t[r][i]=new In;let n=0;for(let r of e.getDetectionResultColumns()){if(r!=null){for(let i of r.getCodewords())if(i!=null){let s=i.getRowNumber();if(s>=0){if(s>=t.length)continue;t[s][n].setValue(i.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let i=r?1:-1,s=null;if(ue.isValidBarcodeColumn(e,t-i)&&(s=e.getDetectionResultColumn(t-i).getCodeword(n)),s!=null)return r?s.getEndX():s.getStartX();if(s=e.getDetectionResultColumn(t).getCodewordNearby(n),s!=null)return r?s.getStartX():s.getEndX();if(ue.isValidBarcodeColumn(e,t-i)&&(s=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),s!=null)return r?s.getEndX():s.getStartX();let o=0;for(;ue.isValidBarcodeColumn(e,t-i);){t-=i;for(let a of e.getDetectionResultColumn(t).getCodewords())if(a!=null)return(r?a.getEndX():a.getStartX())+i*o*(a.getEndX()-a.getStartX());o++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,i,s,o,a){i=ue.adjustCodewordStartColumn(e,t,n,r,i,s);let l=ue.getModuleBitCount(e,t,n,r,i,s);if(l==null)return null;let h,g=ge.sum(l);if(r)h=i+g;else{for(let _=0;_<l.length/2;_++){let b=l[_];l[_]=l[l.length-1-_],l[l.length-1-_]=b}h=i,i=h-g}if(!ue.checkCodewordSkew(g,o,a))return null;let w=gt.getDecodedValue(l),p=te.getCodeword(w);return p===-1?null:new Sn(i,h,ue.getCodewordBucketNumber(w),p)}static getModuleBitCount(e,t,n,r,i,s){let o=i,a=new Int32Array(8),l=0,h=r?1:-1,g=r;for(;(r?o<n:o>=t)&&l<a.length;)e.get(o,s)===g?(a[l]++,o+=h):(l++,g=!g);return l===a.length||o===(r?n:t)&&l===a.length-1?a:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,i,s){let o=i,a=r?-1:1;for(let l=0;l<2;l++){for(;(r?o>=t:o<n)&&r===e.get(o,s);){if(Math.abs(i-o)>ue.CODEWORD_SKEW_SIZE)return i;o+=a}a=-a,r=!r}return o}static checkCodewordSkew(e,t,n){return t-ue.CODEWORD_SKEW_SIZE<=e&&e<=n+ue.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw G.getFormatInstance();let r=1<<t+1,i=ue.correctErrors(e,n,r);ue.verifyCodewordCount(e,r);let s=O.decode(e,""+t);return s.setErrorsCorrected(i),s.setErasures(n.length),s}
9static correctErrors(e,t,n){if(t!=null&&t.length>n/2+ue.MAX_ERRORS||n<0||n>ue.MAX_EC_CODEWORDS)throw W.getChecksumInstance();return ue.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw G.getFormatInstance();let n=e[0];if(n>e.length)throw G.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw G.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((e&1)!==n&&(n=e&1,r--,r<0));)t[r]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return ue.getCodewordBucketNumber(ue.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new _n;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let i=e[n][r];i.getValue().length===0?t.format("        ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}ue.CODEWORD_SKEW_SIZE=2,ue.MAX_ERRORS=3,ue.MAX_EC_CODEWORDS=512,ue.errorCorrection=new kr;class $e{decode(e,t=null){let n=$e.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw M.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return $e.decode(e,t,!0)}catch(n){throw n instanceof G||n instanceof W?M.getNotFoundInstance():n}}static decode(e,t,n){const r=new Array,i=ce.detectMultiple(e,t,n);for(const s of i.getPoints()){const o=ue.decode(i.getBits(),s[4],s[5],s[6],s[7],$e.getMinCodewordWidth(s),$e.getMaxCodewordWidth(s)),a=new at(o.getText(),o.getRawBytes(),void 0,s,$.PDF_417);a.putMetadata(je.ERROR_CORRECTION_LEVEL,o.getECLevel());const l=o.getOther();l!=null&&a.putMetadata(je.PDF417_EXTRA_METADATA,l),r.push(a)}return r.map(s=>s)}static getMaxWidth(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return e==null||t==null?Q.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max($e.getMaxWidth(e[0],e[4]),$e.getMaxWidth(e[6],e[2])*te.MODULES_IN_CODEWORD/te.MODULES_IN_STOP_PATTERN),Math.max($e.getMaxWidth(e[1],e[5]),$e.getMaxWidth(e[7],e[3])*te.MODULES_IN_CODEWORD/te.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min($e.getMinWidth(e[0],e[4]),$e.getMinWidth(e[6],e[2])*te.MODULES_IN_CODEWORD/te.MODULES_IN_STOP_PATTERN),Math.min($e.getMinWidth(e[1],e[5]),$e.getMinWidth(e[7],e[3])*te.MODULES_IN_CODEWORD/te.MODULES_IN_STOP_PATTERN)))}reset(){}}class Wn extends C{}Wn.kind="ReaderException";class Xr{constructor(e,t){this.verbose=e===!0,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;const t=!A(e)&&e.get(be.TRY_HARDER)===!0,n=A(e)?null:e.get(be.POSSIBLE_FORMATS),r=new Array;if(!A(n)){const i=n.some(s=>s===$.UPC_A||s===$.UPC_E||s===$.EAN_13||s===$.EAN_8||s===$.CODABAR||s===$.CODE_39||s===$.CODE_93||s===$.CODE_128||s===$.ITF||s===$.RSS_14||s===$.RSS_EXPANDED);i&&!t&&r.push(new ln(e,this.verbose)),n.includes($.QR_CODE)&&r.push(new Yt),n.includes($.DATA_MATRIX)&&r.push(new Xt),n.includes($.AZTEC)&&r.push(new Fn),n.includes($.PDF_417)&&r.push(new $e),i&&t&&r.push(new ln(e,this.verbose))}r.length===0&&(t||r.push(new ln(e,this.verbose)),r.push(new Yt),r.push(new Xt),r.push(new Fn),r.push(new $e),t&&r.push(new ln(e,this.verbose))),this.readers=r}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Wn("No readers where selected, nothing can be read.");for(const t of this.readers)try{return t.decode(e,this.hints)}catch(n){if(n instanceof Wn)continue}throw new M("No MultiFormat Readers were able to detect the code.")}}class Ui extends jt{constructor(e=null,t=500){const n=new Xr;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Vi extends jt{constructor(e=500){super(new $e,e)}}class Gi extends jt{constructor(e=500){super(new Yt,e)}}var wr;(function(d){d[d.ERROR_CORRECTION=0]="ERROR_CORRECTION",d[d.CHARACTER_SET=1]="CHARACTER_SET",d[d.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",d[d.MIN_SIZE=3]="MIN_SIZE",d[d.MAX_SIZE=4]="MAX_SIZE",d[d.MARGIN=5]="MARGIN",d[d.PDF417_COMPACT=6]="PDF417_COMPACT",d[d.PDF417_COMPACTION=7]="PDF417_COMPACTION",d[d.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",d[d.AZTEC_LAYERS=9]="AZTEC_LAYERS",d[d.QR_VERSION=10]="QR_VERSION"})(wr||(wr={}));var Ye=wr;class Cr{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new ht(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const r=this.field;for(let i=t.length;i<=e;i++){const s=n.multiply(new ht(r,Int32Array.from([1,r.exp(i-1+r.getGeneratorBase())])));t.push(s),n=s}}return t[e]}encode(e,t){if(t===0)throw new N("No error correction bytes");const n=e.length-t;if(n<=0)throw new N("No data bytes provided");const r=this.buildGenerator(t),i=new Int32Array(n);ie.arraycopy(e,0,i,0,n);let s=new ht(this.field,i);s=s.multiplyByMonomial(t,1);const a=s.divide(r)[1].getCoefficients(),l=t-a.length;for(let h=0;h<l;h++)e[n+h]=0;ie.arraycopy(a,0,e,n+l,a.length)}}class ke{constructor(){}
9static applyMaskPenaltyRule1(e){return ke.applyMaskPenaltyRule1Internal(e,!0)+ke.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let s=0;s<i-1;s++){const o=n[s];for(let a=0;a<r-1;a++){const l=o[a];l===o[a+1]&&l===n[s+1][a]&&l===n[s+1][a+1]&&t++}}return ke.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let s=0;s<i;s++)for(let o=0;o<r;o++){const a=n[s];o+6<r&&a[o]===1&&a[o+1]===0&&a[o+2]===1&&a[o+3]===1&&a[o+4]===1&&a[o+5]===0&&a[o+6]===1&&(ke.isWhiteHorizontal(a,o-4,o)||ke.isWhiteHorizontal(a,o+7,o+11))&&t++,s+6<i&&n[s][o]===1&&n[s+1][o]===0&&n[s+2][o]===1&&n[s+3][o]===1&&n[s+4][o]===1&&n[s+5][o]===0&&n[s+6][o]===1&&(ke.isWhiteVertical(n,o,s-4,s)||ke.isWhiteVertical(n,o,s+7,s+11))&&t++}return t*ke.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let r=t;r<n;r++)if(e[r]===1)return!1;return!0}static isWhiteVertical(e,t,n,r){n=Math.max(n,0),r=Math.min(r,e.length);for(let i=n;i<r;i++)if(e[i][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let a=0;a<i;a++){const l=n[a];for(let h=0;h<r;h++)l[h]===1&&t++}const s=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-s)*10/s)*ke.N4}static getDataMaskBit(e,t,n){let r,i;switch(e){case 0:r=n+t&1;break;case 1:r=n&1;break;case 2:r=t%3;break;case 3:r=(n+t)%3;break;case 4:r=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:i=n*t,r=(i&1)+i%3;break;case 6:i=n*t,r=(i&1)+i%3&1;break;case 7:i=n*t,r=i%3+(n+t&1)&1;break;default:throw new N("Invalid mask pattern: "+e)}return r===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),s=e.getArray();for(let o=0;o<r;o++){let a=0,l=-1;for(let h=0;h<i;h++){const g=t?s[o][h]:s[h][o];g===l?a++:(a>=5&&(n+=ke.N1+(a-5)),a=1,l=g)}a>=5&&(n+=ke.N1+(a-5))}return n}}ke.N1=3,ke.N2=3,ke.N3=40,ke.N4=10;class Xn{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let r=0;r!==t;r++)n[r]=new Uint8Array(e);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,n){this.bytes[t][e]=n}setBoolean(e,t,n){this.bytes[t][e]=n?1:0}clear(e){for(const t of this.bytes)we.fill(t,e)}equals(e){if(!(e instanceof Xn))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,r=this.height;n<r;++n){const i=this.bytes[n],s=t.bytes[n];for(let o=0,a=this.width;o<a;++o)if(i[o]!==s[o])return!1}return!0}toString(){const e=new Ie;for(let t=0,n=this.height;t<n;++t){const r=this.bytes[t];for(let i=0,s=this.width;i<s;++i)switch(r[i]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append("  ");break}e.append(`
10`)}return e.toString()}}class $t{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const e=new Ie;return e.append(`<<
11`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
12 ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
13 version: `),e.append(this.version?this.version.toString():"null"),e.append(`
14 maskPattern: `),e.append(this.maskPattern.toString()),this.matrix?(e.append(`
15 matrix:
16`),e.append(this.matrix.toString())):e.append(`
17 matrix: null
18`),e.append(`>>
19`),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<$t.NUM_MASK_PATTERNS}}$t.NUM_MASK_PATTERNS=8;class Te extends C{}Te.kind="WriterException";class ee{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){ee.clearMatrix(i),ee.embedBasicPatterns(n,i),ee.embedTypeInfo(t,r,i),ee.maybeEmbedVersionInfo(n,i),ee.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){ee.embedPositionDetectionPatternsAndSeparators(t),ee.embedDarkD
19otAtLeftBottomCorner(t),ee.maybeEmbedPositionAdjustmentPatterns(e,t),ee.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new fe;ee.makeTypeInfoBits(e,t,r);for(let i=0,s=r.getSize();i<s;++i){const o=r.get(r.getSize()-1-i),a=ee.TYPE_INFO_COORDINATES[i],l=a[0],h=a[1];if(n.setBoolean(l,h,o),i<8){const g=n.getWidth()-i-1,w=8;n.setBoolean(g,w,o)}else{const w=n.getHeight()-7+(i-8);n.setBoolean(8,w,o)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new fe;ee.makeVersionInfoBits(e,n);let r=6*3-1;for(let i=0;i<6;++i)for(let s=0;s<3;++s){const o=n.get(r);r--,t.setBoolean(i,t.getHeight()-11+s,o),t.setBoolean(t.getHeight()-11+s,i,o)}}static embedDataBits(e,t,n){let r=0,i=-1,s=n.getWidth()-1,o=n.getHeight()-1;for(;s>0;){for(s===6&&(s-=1);o>=0&&o<n.getHeight();){for(let a=0;a<2;++a){const l=s-a;if(!ee.isEmpty(n.get(l,o)))continue;let h;r<e.getSize()?(h=e.get(r),++r):h=!1,t!==255&&ke.getDataMaskBit(t,l,o)&&(h=!h),n.setBoolean(l,o,h)}o+=i}i=-i,o+=i,s-=2}if(r!==e.getSize())throw new Te("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-Q.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new N("0 polynomial");const n=ee.findMSBSet(t);for(e<<=n-1;ee.findMSBSet(e)>=n;)e^=t<<ee.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!$t.isValidMaskPattern(t))throw new Te("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const i=ee.calculateBCHCode(r,ee.TYPE_INFO_POLY);n.appendBits(i,10);const s=new fe;if(s.appendBits(ee.TYPE_INFO_MASK_PATTERN,15),n.xor(s),n.getSize()!==15)throw new Te("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=ee.calculateBCHCode(e.getVersionNumber(),ee.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new Te("should not happen but we got: "+t.getSize())}static isEmpty(e){return e===255}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;ee.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),ee.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new Te;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!ee.isEmpty(n.get(e+r,t)))throw new Te;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!ee.isEmpty(n.get(e,t+r)))throw new Te;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const i=ee.POSITION_ADJUSTMENT_PATTERN[r];for(let s=0;s<5;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const i=ee.POSITION_DETECTION_PATTERN[r];for(let s=0;s<7;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPatternsAndSeparators(e){const t=ee.POSITION_DETECTION_PATTERN[0].length;ee.embedPositionDetectionPattern(0,0,e),ee.embedPositionDetectionPattern(e.getWidth()-t,0,e),ee.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;ee.embedHorizontalSeparationPattern(0,n-1,e),ee.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),ee.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;ee.embedVerticalSeparationPattern(r,0,e),ee.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),ee.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=ee.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let i=0,s=r.length;i!==s;i++){const o=r[i];if(o>=0)for(let a=0;a!==s;a++){const l=r[a];l>=0&&ee.isEmpty(t.get(l,o))&&ee.embedPositionAdjustmentPattern(l-2,o-2,t)}}}}ee.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),ee.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),ee.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),ee.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),ee.VERSION_INFO_POLY=7973,ee.TYPE_INFO_POLY=1335,ee.TYPE_INFO_MASK_PATTERN=21522;class Hi{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Me{constructor(){}
19static calculateMaskPenalty(e){return ke.applyMaskPenaltyRule1(e)+ke.applyMaskPenaltyRule2(e)+ke.applyMaskPenaltyRule3(e)+ke.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Me.DEFAULT_BYTE_MODE_ENCODING;const i=n!==null&&n.get(Ye.CHARACTER_SET)!==void 0;i&&(r=n.get(Ye.CHARACTER_SET).toString());const s=this.chooseMode(e,r),o=new fe;if(s===J.BYTE&&(i||Me.DEFAULT_BYTE_MODE_ENCODING!==r)){const U=V.getCharacterSetECIByName(r);U!==void 0&&this.appendECI(U,o)}this.appendModeInfo(s,o);const a=new fe;this.appendBytes(e,s,a,r);let l;if(n!==null&&n.get(Ye.QR_VERSION)!==void 0){const U=Number.parseInt(n.get(Ye.QR_VERSION).toString(),10);l=q.getVersionForNumber(U);const F=this.calculateBitsNeeded(s,o,a,l);if(!this.willFit(F,l,t))throw new Te("Data too big for requested version")}else l=this.recommendVersion(t,s,o,a);const h=new fe;h.appendBitArray(o);const g=s===J.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(g,l,s,h),h.appendBitArray(a);const w=l.getECBlocksForLevel(t),p=l.getTotalCodewords()-w.getTotalECCodewords();this.terminateBits(p,h);const _=this.interleaveWithECBytes(h,l.getTotalCodewords(),p,w.getNumBlocks()),b=new $t;b.setECLevel(t),b.setMode(s),b.setVersion(l);const S=l.getDimensionForVersion(),D=new Xn(S,S),k=this.chooseMaskPattern(_,t,l,D);
19return b.setMaskPattern(k),ee.buildMatrix(_,t,l,k,D),b.setMatrix(D),b}static recommendVersion(e,t,n,r){const i=this.calculateBitsNeeded(t,n,r,q.getVersionForNumber(1)),s=this.chooseVersion(i,e),o=this.calculateBitsNeeded(t,n,r,s);return this.chooseVersion(o,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<Me.ALPHANUMERIC_TABLE.length?Me.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(V.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return J.KANJI;let n=!1,r=!1;for(let i=0,s=e.length;i<s;++i){const o=e.charAt(i);if(Me.isDigit(o))n=!0;else if(this.getAlphanumericCode(o.charCodeAt(0))!==-1)r=!0;else return J.BYTE}return r?J.ALPHANUMERIC:n?J.NUMERIC:J.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=ut.encode(e,V.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let r=0;r<n;r+=2){const i=t[r]&255;if((i<129||i>159)&&(i<224||i>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,s=-1;for(let o=0;o<$t.NUM_MASK_PATTERNS;o++){ee.buildMatrix(e,t,n,o,r);let a=this.calculateMaskPenalty(r);a<i&&(i=a,s=o)}return s}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=q.getVersionForNumber(n);if(Me.willFit(e,r,t))return r}throw new Te("Data too big")}static willFit(e,t,n){const r=t.getTotalCodewords(),s=t.getECBlocksForLevel(n).getTotalECCodewords(),o=r-s,a=(e+7)/8;return o>=a}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new Te("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let s=0;s<4&&t.getSize()<n;++s)t.appendBit(!1);const r=t.getSize()&7;if(r>0)for(let s=r;s<8;s++)t.appendBit(!1);const i=e-t.getSizeInBytes();for(let s=0;s<i;++s)t.appendBits((s&1)===0?236:17,8);if(t.getSize()!==n)throw new Te("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,i,s){if(r>=n)throw new Te("Block ID too large");const o=e%n,a=n-o,l=Math.floor(e/n),h=l+1,g=Math.floor(t/n),w=g+1,p=l-g,_=h-w;if(p!==_)throw new Te("EC bytes mismatch");if(n!==a+o)throw new Te("RS blocks mismatch");if(e!==(g+p)*a+(w+_)*o)throw new Te("Total bytes mismatch");r<a?(i[0]=g,s[0]=p):(i[0]=w,s[0]=_)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new Te("Number of bits and data bytes does not match");let i=0,s=0,o=0;const a=new Array;for(let h=0;h<r;++h){const g=new Int32Array(1),w=new Int32Array(1);Me.getNumDataBytesAndNumECBytesForBlockID(t,n,r,h,g,w);const p=g[0],_=new Uint8Array(p);e.toBytes(8*i,_,0,p);const b=Me.generateECBytes(_,w[0]);a.push(new Hi(_,b)),s=Math.max(s,p),o=Math.max(o,b.length),i+=g[0]}if(n!==i)throw new Te("Data bytes does not match offset");const l=new fe;for(let h=0;h<s;++h)for(const g of a){const w=g.getDataBytes();h<w.length&&l.appendBits(w[h],8)}for(let h=0;h<o;++h)for(const g of a){const w=g.getErrorCorrectionBytes();h<w.length&&l.appendBits(w[h],8)}if(t!==l.getSizeInBytes())throw new Te("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let s=0;s<n;s++)r[s]=e[s]&255;new Cr(Ce.QR_CODE_FIELD_256).encode(r,t);const i=new Uint8Array(t);for(let s=0;s<t;s++)i[s]=r[n+s];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const i=n.getCharacterCountBits(t);if(e>=1<<i)throw new Te(e+" is bigger than "+((1<<i)-1));r.appendBits(e,i)}static appendBytes(e,t,n,r){switch(t){case J.NUMERIC:Me.appendNumericBytes(e,n);break;case J.ALPHANUMERIC:Me.appendAlphanumericBytes(e,n);break;case J.BYTE:Me.append8BitBytes(e,n,r);break;case J.KANJI:Me.appendKanjiBytes(e,n);break;default:throw new Te("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Me.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Me.getDigit(e.charAt(r));if(r+2<n){const s=Me.getDigit(e.charAt(r+1)),o=Me.getDigit(e.charAt(r+2));t.appendBits(i*100+s*10+o,10),r+=3}else if(r+1<n){const s=Me.getDigit(e.charAt(r+1));t.appendBits(i*10+s,7),r+=2}else t.appendBits(i,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Me.getAlphanumericCode(e.charCodeAt(r));if(i===-1)throw new Te;if(r+1<n){const s=Me.getAlphanumericCode(e.charCodeAt(r+1));if(s===-1)throw new Te;t.appendBits(i*45+s,11),r+=2}else t.appendBits(i,6),r++}}
19static append8BitBytes(e,t,n){let r;try{r=ut.encode(e,n)}catch(i){throw new Te(i)}for(let i=0,s=r.length;i!==s;i++){const o=r[i];t.appendBits(o,8)}}static appendKanjiBytes(e,t){let n;try{n=ut.encode(e,V.SJIS)}catch(i){throw new Te(i)}const r=n.length;for(let i=0;i<r;i+=2){const s=n[i]&255,o=n[i+1]&255,a=s<<8&4294967295|o;let l=-1;if(a>=33088&&a<=40956?l=a-33088:a>=57408&&a<=60351&&(l=a-49472),l===-1)throw new Te("Invalid byte sequence");const h=(l>>8)*192+(l&255);t.appendBits(h,13)}}static appendECI(e,t){t.appendBits(J.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Me.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Me.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class en{write(e,t,n,r=null){if(e.length===0)throw new N("Found empty contents");if(t<0||n<0)throw new N("Requested dimensions are too small: "+t+"x"+n);let i=ve.L,s=en.QUIET_ZONE_SIZE;r!==null&&(r.get(Ye.ERROR_CORRECTION)!==void 0&&(i=ve.fromString(r.get(Ye.ERROR_CORRECTION).toString())),r.get(Ye.MARGIN)!==void 0&&(s=Number.parseInt(r.get(Ye.MARGIN).toString(),10)));const o=Me.encode(e,i,r);return this.renderResult(o,t,n,s)}writeToDom(e,t,n,r,i=null){typeof e=="string"&&(e=document.querySelector(e));const s=this.write(t,n,r,i);e&&e.appendChild(s)}renderResult(e,t,n,r){const i=e.getMatrix();if(i===null)throw new Nt;const s=i.getWidth(),o=i.getHeight(),a=s+r*2,l=o+r*2,h=Math.max(t,a),g=Math.max(n,l),w=Math.min(Math.floor(h/a),Math.floor(g/l)),p=Math.floor((h-s*w)/2),_=Math.floor((g-o*w)/2),b=this.createSVGElement(h,g);for(let S=0,D=_;S<o;S++,D+=w)for(let k=0,U=p;k<s;k++,U+=w)if(i.get(k,S)===1){const F=this.createSvgRectElement(U,D,w,w);b.appendChild(F)}return b}createSVGElement(e,t){const n=document.createElementNS(en.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const i=document.createElementNS(en.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",n.toString()),i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"fill","#000000"),i}}en.QUIET_ZONE_SIZE=4,en.SVG_NS="http://www.w3.org/2000/svg";class un{encode(e,t,n,r,i){if(e.length===0)throw new N("Found empty contents");if(t!==$.QR_CODE)throw new N("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new N(`Requested dimensions are too small: ${n}x${r}`);let s=ve.L,o=un.QUIET_ZONE_SIZE;i!==null&&(i.get(Ye.ERROR_CORRECTION)!==void 0&&(s=ve.fromString(i.get(Ye.ERROR_CORRECTION).toString())),i.get(Ye.MARGIN)!==void 0&&(o=Number.parseInt(i.get(Ye.MARGIN).toString(),10)));const a=Me.encode(e,s,i);return un.renderResult(a,n,r,o)}static renderResult(e,t,n,r){const i=e.getMatrix();if(i===null)throw new Nt;const s=i.getWidth(),o=i.getHeight(),a=s+r*2,l=o+r*2,h=Math.max(t,a),g=Math.max(n,l),w=Math.min(Math.floor(h/a),Math.floor(g/l)),p=Math.floor((h-s*w)/2),_=Math.floor((g-o*w)/2),b=new ze(h,g);for(let S=0,D=_;S<o;S++,D+=w)for(let k=0,U=p;k<s;k++,U+=w)i.get(k,S)===1&&b.setRegion(U,D,w,w);return b}}un.QUIET_ZONE_SIZE=4;class Wi{encode(e,t,n,r,i){let s;switch(t){case $.QR_CODE:s=new un;break;default:throw new N("No encoder available for format "+t)}return s.encode(e,t,n,r,i)}}class Dt extends wn{constructor(e,t,n,r,i,s,o,a){if(super(s,o),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=i,r+s>t||i+o>n)throw new N("Crop rectangle does not fit within image data.");a&&this.reverseHorizontal(s,o)}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return ie.arraycopy(this.yuvData,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return ie.arraycopy(this.yuvData,i,r,0,n),r;for(let s=0;s<t;s++){const o=s*e;ie.arraycopy(this.yuvData,i,r,o,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Dt(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/Dt.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Dt.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let i=this.top*this.dataWidth+this.left;for(let s=0;s<t;s++){const o=s*e;for(let a=0;a<e;a++){const l=r[i+a*Dt.THUMBNAIL_SCALE_FACTOR]&255;n[o+a]=4278190080|l*65793}i+=this.dataWidth*Dt.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Dt.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Dt.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,i=this.top*this.dataWidth+this.left;r<t;r++,i+=this.dataWidth){const s=i+e/2;for(let o=i,a=i+e-1;o<s;o++,a--){const l=n[o];n[o]=n[a],n[a]=l}}}invert(){return new Ut(this)}}Dt.THUMBNAIL_SCALE_FACTOR=2;class Ar extends wn{constructor(e,t,n,r,i,s,o){if(super(t,n),this.dataWidth=r,this.dataHeight=i,this.left=s,this.top=o,e.BYTES_PER_ELEMENT===4){const a=t*n,l=new Uint8ClampedArray(a);for(let h=0;h<a;h++){const g=e[h],w=g>>16&255,p=g>>7&510,_=g&255;l[h]=(w+p+_)/4&255}this.luminances=l}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),i===void 0&&(this.dataHeight=n),s===void 0&&(this.left=0),o===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new N("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return ie.arraycopy(this.luminances,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return ie.arraycopy(this.luminances,i,r,0,n),r;for(let s=0;s<t;s++){const o=s*e;ie.arraycopy(this.luminances,i,r,o,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Ar(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new Ut(this)}}class Yr extends V{static forName(e){return this.getCharacterSetECIByName(e)}}class mr{}mr.ISO_8859_1=V.ISO8859_1;class zr{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}
19getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class Zr{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Xi{constructor(e){this.previous=e}getPrevious(){return this.previous}}class hn extends Xi{constructor(e,t,n){super(e),this.value=t,this.bitCount=n}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new hn(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new hn(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+Q.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Er extends hn{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(n===0||n===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new Er(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Yi(d,e,t){return new Er(d,e,t)}function Tn(d,e,t){return new hn(d,e,t)}const zi=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Zt=0,Yn=1,bt=2,jr=3,Mt=4,Zi=new hn(null,0,0),pr=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,(10<<16)+(29<<5)+30]),Int32Array.from([(9<<16)+(30<<4)+14,0,(5<<16)+30,(5<<16)+29,(10<<16)+(29<<5)+30]),Int32Array.from([(4<<16)+14,(9<<16)+(14<<5)+28,0,(9<<16)+(14<<5)+29,(14<<16)+(14<<10)+(29<<5)+30]),Int32Array.from([(5<<16)+29,(5<<16)+28,(10<<16)+(29<<5)+30,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,(10<<16)+(31<<5)+28,(10<<16)+(31<<5)+30,(10<<16)+(31<<5)+29,0])];function ji(d){for(let e of d)we.fill(e,-1);return d[Zt][Mt]=0,d[Yn][Mt]=0,d[Yn][Zt]=28,d[jr][Mt]=0,d[bt][Mt]=0,d[bt][Zt]=15,d}const Kr=ji(we.createInt32Array(6,6));class Bt{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let s=pr[this.mode][e];r=Tn(r,s&65535,s>>16),n+=s>>16}let i=e===bt?4:5;return r=Tn(r,t,i),new Bt(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===bt?4:5;return n=Tn(n,Kr[this.mode][e],r),n=Tn(n,t,5),new Bt(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Mt||this.mode===bt){let o=pr[n][Zt];t=Tn(t,o&65535,o>>16),r+=o>>16,n=Zt}let i=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new Bt(t,n,this.binaryShiftByteCount+1,r+i);return s.binaryShiftByteCount===2047+31&&(s=s.endBinaryShift(e+1)),s}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=Yi(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Bt(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(pr[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Bt.calculateBinaryShiftCost(e)-Bt.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;r!==null;r=r.getPrevious())t.unshift(r);let n=new fe;for(const r of t)r.appendTo(n,e);return n}toString(){return se.format("%s bits=%d bytes=%d",zi[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Bt.INITIAL_STATE=new Bt(Zi,Zt,0,0);function Ki(d){const e=se.getCharCode(" "),t=se.getCharCode("."),n=se.getCharCode(",");d[Zt][e]=1;const r=se.getCharCode("Z"),i=se.getCharCode("A");for(let w=i;w<=r;w++)d[Zt][w]=w-i+2;d[Yn][e]=1;const s=se.getCharCode("z"),o=se.getCharCode("a");for(let w=o;w<=s;w++)d[Yn][w]=w-o+2;d[bt][e]=1;const a=se.getCharCode("9"),l=se.getCharCode("0");for(let w=l;w<=a;w++)d[bt][w]=w-l+2;d[bt][n]=12,d[bt][t]=13;const h=["\0"," ","�","�","�","�","�","�","\x07","\b","	",`
20`,"\v","\f","\r","\x1B","�","�","�","�","@","\\","^","_","`","|","~","\x7F"];for(let w=0;w<h.length;w++)d[jr][se.getCharCode(h[w])]=w;const g=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let w=0;w<g.length;w++)se.getCharCode(g[w])>0&&(d[Mt][se.getCharCode(g[w])]=w);return d}const _r=Ki(we.createInt32Array(5,256));class Nn{constructor(e){this.text=e}encode(){const e=se.getCharCode(" "),t=se.getCharCode(`
21`);let n=Zr.singletonList(Bt.INITIAL_STATE);for(let i=0;i<this.text.length;i++){let s,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case se.getCharCode("\r"):s=o===t?2:0;break;case se.getCharCode("."):s=o===e?3:0;break;case se.getCharCode(","):s=o===e?4:0;break;case se.getCharCode(":"):s=o===e?5:0;break;default:s=0}s>0?(n=Nn.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}return Zr.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Nn.simplifyStates(n)}
21updateStateForChar(e,t,n){let r=this.text[t]&255,i=_r[e.getMode()][r]>0,s=null;for(let o=0;o<=Mt;o++){let a=_r[o][r];if(a>0){if(s==null&&(s=e.endBinaryShift(t)),!i||o===e.getMode()||o===bt){const l=s.latchAndAppend(o,a);n.push(l)}if(!i&&Kr[e.getMode()][o]>=0){const l=s.shiftAndAppend(o,a);n.push(l)}}}if(e.getBinaryShiftByteCount()>0||_r[e.getMode()][r]===0){let o=e.addBinaryShiftChar(t);n.push(o)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(Mt,n)),e.getMode()!==Mt&&r.push(i.shiftAndAppend(Mt,n)),n===3||n===4){let s=i.latchAndAppend(bt,16-n).latchAndAppend(bt,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class xe{constructor(){}static encodeBytes(e){return xe.encode(e,xe.DEFAULT_EC_PERCENT,xe.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Nn(e).encode(),i=Q.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,o,a,l,h,g;if(n!==xe.DEFAULT_AZTEC_LAYERS){if(o=n<0,a=Math.abs(n),a>(o?xe.MAX_NB_BITS_COMPACT:xe.MAX_NB_BITS))throw new N(se.format("Illegal value %s for layers",n));l=xe.totalBitsInLayer(a,o),h=xe.WORD_SIZE[a];let F=l-l%h;if(g=xe.stuffBits(r,h),g.getSize()+i>F)throw new N("Data to large for user specified layer");if(o&&g.getSize()>h*64)throw new N("Data to large for user specified layer")}else{h=0,g=null;for(let F=0;;F++){if(F>xe.MAX_NB_BITS)throw new N("Data too large for an Aztec code");if(o=F<=3,a=o?F+1:F,l=xe.totalBitsInLayer(a,o),s>l)continue;(g==null||h!==xe.WORD_SIZE[a])&&(h=xe.WORD_SIZE[a],g=xe.stuffBits(r,h));let he=l-l%h;if(!(o&&g.getSize()>h*64)&&g.getSize()+i<=he)break}}let w=xe.generateCheckWords(g,l,h),p=g.getSize()/h,_=xe.generateModeMessage(o,a,p),b=(o?11:14)+a*4,S=new Int32Array(b),D;if(o){D=b;for(let F=0;F<S.length;F++)S[F]=F}else{D=b+1+2*Q.truncDivision(Q.truncDivision(b,2)-1,15);let F=Q.truncDivision(b,2),he=Q.truncDivision(D,2);for(let ae=0;ae<F;ae++){let xt=ae+Q.truncDivision(ae,15);S[F-ae-1]=he-xt-1,S[F+ae]=he+xt+1}}let k=new ze(D);for(let F=0,he=0;F<a;F++){let ae=(a-F)*4+(o?9:12);for(let xt=0;xt<ae;xt++){let Tt=xt*2;for(let wt=0;wt<2;wt++)w.get(he+Tt+wt)&&k.set(S[F*2+wt],S[F*2+xt]),w.get(he+ae*2+Tt+wt)&&k.set(S[F*2+xt],S[b-1-F*2-wt]),w.get(he+ae*4+Tt+wt)&&k.set(S[b-1-F*2-wt],S[b-1-F*2-xt]),w.get(he+ae*6+Tt+wt)&&k.set(S[b-1-F*2-xt],S[F*2+wt])}he+=ae*8}if(xe.drawModeMessage(k,o,D,_),o)xe.drawBullsEye(k,Q.truncDivision(D,2),5);else{xe.drawBullsEye(k,Q.truncDivision(D,2),7);for(let F=0,he=0;F<Q.truncDivision(b,2)-1;F+=15,he+=16)for(let ae=Q.truncDivision(D,2)&1;ae<D;ae+=2)k.set(Q.truncDivision(D,2)-he,ae),k.set(Q.truncDivision(D,2)+he,ae),k.set(ae,Q.truncDivision(D,2)-he),k.set(ae,Q.truncDivision(D,2)+he)}let U=new zr;return U.setCompact(o),U.setSize(D),U.setLayers(a),U.setCodeWords(p),U.setMatrix(k),U}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let i=t-r;i<=t+r;i++)e.set(i,t-r),e.set(i,t+r),e.set(t-r,i),e.set(t+r,i);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let r=new fe;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=xe.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=xe.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=Q.truncDivision(n,2);if(t)for(let s=0;s<7;s++){let o=i-3+s;r.get(s)&&e.set(o,i-5),r.get(s+7)&&e.set(i+5,o),r.get(20-s)&&e.set(o,i+5),r.get(27-s)&&e.set(i-5,o)}else for(let s=0;s<10;s++){let o=i-5+s+Q.truncDivision(s,5);r.get(s)&&e.set(o,i-7),r.get(s+10)&&e.set(i+7,o),r.get(29-s)&&e.set(o,i+7),r.get(39-s)&&e.set(i-7,o)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new Cr(xe.getGF(n)),s=Q.truncDivision(t,n),o=xe.bitsToWords(e,n,s);i.encode(o,s-r);let a=t%n,l=new fe;l.appendBits(0,a);for(const h of Array.from(o))l.appendBits(h,n);return l}static bitsToWords(e,t,n){let r=new Int32Array(n),i,s;for(i=0,s=e.getSize()/t;i<s;i++){let o=0;for(let a=0;a<t;a++)o|=e.get(i*t+a)?1<<t-a-1:0;r[i]=o}return r}static getGF(e){switch(e){case 4:return Ce.AZTEC_PARAM;case 6:return Ce.AZTEC_DATA_6;case 8:return Ce.AZTEC_DATA_8;case 10:return Ce.AZTEC_DATA_10;case 12:return Ce.AZTEC_DATA_12;default:throw new N("Unsupported word size "+e)}}static stuffBits(e,t){let n=new fe,r=e.getSize(),i=(1<<t)-2;for(let s=0;s<r;s+=t){let o=0;for(let a=0;a<t;a++)(s+a>=r||e.get(s+a))&&(o|=1<<t-1-a);(o&i)===i?(n.appendBits(o&i,t),s--):(o&i)===0?(n.appendBits(o|1,t),s--):n.appendBits(o,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}xe.DEFAULT_EC_PERCENT=33,xe.DEFAULT_AZTEC_LAYERS=0,xe.MAX_NB_BITS=32,xe.MAX_NB_BITS_COMPACT=4,xe.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class zn{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let s=mr.ISO_8859_1,o=xe.DEFAULT_EC_PERCENT,a=xe.DEFAULT_AZTEC_LAYERS;return i!=null&&(i.has(Ye.CHARACTER_SET)&&(s=Yr.forName(i.get(Ye.CHARACTER_SET).toString())),i.has(Ye.ERROR_CORRECTION)&&(o=Q.parseInt(i.get(Ye.ERROR_CORRECTION).toString())),i.has(Ye.AZTEC_LAYERS)&&(a=Q.parseInt(i.get(Ye.AZTEC_LAYERS).toString()))),zn.encodeLayers(e,t,n,r,s,o,a)}static encodeLayers(e,t,n,r,i,s,o){if(t!==$.AZTEC)throw new N("Can only encode AZTEC, but got "+t);let a=xe.encode(se.getBytes(e,i),s,o);return zn.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new Nt;
21let i=r.getWidth(),s=r.getHeight(),o=Math.max(t,i),a=Math.max(n,s),l=Math.min(o/i,a/s),h=(o-i*l)/2,g=(a-s*l)/2,w=new ze(o,a);for(let p=0,_=g;p<s;p++,_+=l)for(let b=0,S=h;b<i;b++,S+=l)r.get(b,p)&&w.setRegion(S,_,l,l);return w}}c.AbstractExpandedDecoder=ar,c.ArgumentException=y,c.ArithmeticException=Bn,c.AztecCode=zr,c.AztecCodeReader=Fn,c.AztecCodeWriter=zn,c.AztecDecoder=Oe,c.AztecDetector=Dr,c.AztecDetectorResult=Or,c.AztecEncoder=xe,c.AztecHighLevelEncoder=Nn,c.AztecPoint=lt,c.BarcodeFormat=$,c.Binarizer=re,c.BinaryBitmap=X,c.BitArray=fe,c.BitMatrix=ze,c.BitSource=hr,c.BrowserAztecCodeReader=pi,c.BrowserBarcodeReader=Si,c.BrowserCodeReader=jt,c.BrowserDatamatrixCodeReader=Ni,c.BrowserMultiFormatReader=Ui,c.BrowserPDF417Reader=Vi,c.BrowserQRCodeReader=Gi,c.BrowserQRCodeSvgWriter=en,c.CharacterSetECI=V,c.ChecksumException=W,c.Code128Reader=H,c.Code39Reader=We,c.DataMatrixDecodedBitStreamParser=Wt,c.DataMatrixReader=Xt,c.DecodeHintType=be,c.DecoderResult=Cn,c.DefaultGridSampler=vr,c.DetectorResult=Ln,c.EAN13Reader=Kt,c.EncodeHintType=Ye,c.Exception=C,c.FormatException=G,c.GenericGF=Ce,c.GenericGFPoly=ht,c.GlobalHistogramBinarizer=Ze,c.GridSampler=rr,c.GridSamplerInstance=Gt,c.HTMLCanvasElementLuminanceSource=Vt,c.HybridBinarizer=le,c.ITFReader=Se,c.IllegalArgumentException=N,c.IllegalStateException=Nt,c.InvertedLuminanceSource=Ut,c.LuminanceSource=wn,c.MathUtils=ge,c.MultiFormatOneDReader=ln,c.MultiFormatReader=Xr,c.MultiFormatWriter=Wi,c.NotFoundException=M,c.OneDReader=He,c.PDF417DecodedBitStreamParser=O,c.PDF417DecoderErrorCorrection=kr,c.PDF417Reader=$e,c.PDF417ResultMetadata=Vr,c.PerspectiveTransform=yt,c.PlanarYUVLuminanceSource=Dt,c.QRCodeByteMatrix=Xn,c.QRCodeDataMask=pt,c.QRCodeDecodedBitStreamParser=Pe,c.QRCodeDecoderErrorCorrectionLevel=ve,c.QRCodeDecoderFormatInformation=rt,c.QRCodeEncoder=Me,c.QRCodeEncoderQRCode=$t,c.QRCodeMaskUtil=ke,c.QRCodeMatrixUtil=ee,c.QRCodeMode=J,c.QRCodeReader=Yt,c.QRCodeVersion=q,c.QRCodeWriter=un,c.RGBLuminanceSource=Ar,c.RSS14Reader=Fe,c.RSSExpandedReader=P,c.ReaderException=Wn,c.ReedSolomonDecoder=mn,c.ReedSolomonEncoder=Cr,c.ReedSolomonException=rn,c.Result=at,c.ResultMetadataType=je,c.ResultPoint=j,c.StringUtils=se,c.UnsupportedOperationException=nn,c.VideoInputDevice=Rr,c.WhiteRectangleDetector=Lt,c.WriterException=Te,c.ZXingArrays=we,c.ZXingCharset=Yr,c.ZXingInteger=Q,c.ZXingStandardCharsets=mr,c.ZXingStringBuilder=Ie,c.ZXingStringEncoding=ut,c.ZXingSystem=ie,c.createAbstractExpandedDecoder=Lr,Object.defineProperty(c,"__esModule",{value:!0})})})(Re,Re.exports);const Ha=cs(Re.exports),Wa=fs({__proto__:null,default:Ha},[Re.exports]);var ii=function(){function x(u,c,A){if(this.formatMap=new Map([[Y.QR_CODE,Re.exports.BarcodeFormat.QR_CODE],[Y.AZTEC,Re.exports.BarcodeFormat.AZTEC],[Y.CODABAR,Re.exports.BarcodeFormat.CODABAR],[Y.CODE_39,Re.exports.BarcodeFormat.CODE_39],[Y.CODE_93,Re.exports.BarcodeFormat.CODE_93],[Y.CODE_128,Re.exports.BarcodeFormat.CODE_128],[Y.DATA_MATRIX,Re.exports.BarcodeFormat.DATA_MATRIX],[Y.MAXICODE,Re.exports.BarcodeFormat.MAXICODE],[Y.ITF,Re.exports.BarcodeFormat.ITF],[Y.EAN_13,Re.exports.BarcodeFormat.EAN_13],[Y.EAN_8,Re.exports.BarcodeFormat.EAN_8],[Y.PDF_417,Re.exports.BarcodeFormat.PDF_417],[Y.RSS_14,Re.exports.BarcodeFormat.RSS_14],[Y.RSS_EXPANDED,Re.exports.BarcodeFormat.RSS_EXPANDED],[Y.UPC_A,Re.exports.BarcodeFormat.UPC_A],[Y.UPC_E,Re.exports.BarcodeFormat.UPC_E],[Y.UPC_EAN_EXTENSION,Re.exports.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Wa)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=c,this.logger=A;var m=this.createZXingFormats(u),f=new Map;f.set(Re.exports.DecodeHintType.POSSIBLE_FORMATS,m),f.set(Re.exports.DecodeHintType.TRY_HARDER,!1),this.hints=f}return x.prototype.decodeAsync=function(u){var c=this;return new Promise(function(A,m){try{A(c.decode(u))}catch(f){m(f)}})},x.prototype.decode=function(u){var c=new Re.exports.MultiFormatReader(this.verbose,this.hints),A=new Re.exports.HTMLCanvasElementLuminanceSource(u),m=new Re.exports.BinaryBitmap(new Re.exports.HybridBinarizer(A)),f=c.decode(m);return{text:f.text,format:Ai.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},x.prototype.createReverseFormatMap=function(){var u=new Map;
21return this.formatMap.forEach(function(c,A,m){u.set(c,A)}),u},x.prototype.toHtml5QrcodeSupportedFormats=function(u){if(!this.reverseFormatMap.has(u))throw"reverseFormatMap doesn't have ".concat(u);return this.reverseFormatMap.get(u)},x.prototype.createZXingFormats=function(u){for(var c=[],A=0,m=u;A<m.length;A++){var f=m[A];this.formatMap.has(f)?c.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return c},x.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},x}(),Xa=globalThis&&globalThis.__awaiter||function(x,u,c,A){function m(f){return f instanceof c?f:new c(function(I){I(f)})}return new(c||(c=Promise))(function(f,I){function v(y){try{C(A.next(y))}catch(N){I(N)}}function R(y){try{C(A.throw(y))}catch(N){I(N)}}function C(y){y.done?f(y.value):m(y.value).then(v,R)}C((A=A.apply(x,u||[])).next())})},Ya=globalThis&&globalThis.__generator||function(x,u){var c={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},A,m,f,I;return I={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function v(C){return function(y){return R([C,y])}}function R(C){if(A)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(c=0)),c;)try{if(A=1,m&&(f=C[0]&2?m.return:C[0]?m.throw||((f=m.return)&&f.call(m),0):m.next)&&!(f=f.call(m,C[1])).done)return f;switch(m=0,f&&(C=[C[0]&2,f.value]),C[0]){case 0:case 1:f=C;break;case 4:return c.label++,{value:C[1],done:!1};case 5:c.label++,m=C[1],C=[0];continue;case 7:C=c.ops.pop(),c.trys.pop();continue;default:if(f=c.trys,!(f=f.length>0&&f[f.length-1])&&(C[0]===6||C[0]===2)){c=0;continue}if(C[0]===3&&(!f||C[1]>f[0]&&C[1]<f[3])){c.label=C[1];break}if(C[0]===6&&c.label<f[1]){c.label=f[1],f=C;break}if(f&&c.label<f[2]){c.label=f[2],c.ops.push(C);break}f[2]&&c.ops.pop(),c.trys.pop();continue}C=u.call(x,c)}catch(y){C=[6,y],m=0}finally{A=f=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},si=function(){function x(u,c,A){if(this.formatMap=new Map([[Y.QR_CODE,"qr_code"],[Y.AZTEC,"aztec"],[Y.CODABAR,"codabar"],[Y.CODE_39,"code_39"],[Y.CODE_93,"code_93"],[Y.CODE_128,"code_128"],[Y.DATA_MATRIX,"data_matrix"],[Y.ITF,"itf"],[Y.EAN_13,"ean_13"],[Y.EAN_8,"ean_8"],[Y.PDF_417,"pdf417"],[Y.UPC_A,"upc_a"],[Y.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!x.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=c,this.logger=A;var m=this.createBarcodeDetectorFormats(u);if(this.detector=new BarcodeDetector(m),!this.detector)throw"BarcodeDetector detector not supported"}return x.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var u=new BarcodeDetector({formats:["qr_code"]});return typeof u<"u"},x.prototype.decodeAsync=function(u){return Xa(this,void 0,void 0,function(){var c,A;return Ya(this,function(m){switch(m.label){case 0:return[4,this.detector.detect(u)];case 1:if(c=m.sent(),!c||c.length===0)throw"No barcode or QR code detected.";return A=this.selectLargestBarcode(c),[2,{text:A.rawValue,format:Ai.create(this.toHtml5QrcodeSupportedFormats(A.format)),debugData:this.createDebugData()}]}})})},x.prototype.selectLargestBarcode=function(u){for(var c=null,A=0,m=0,f=u;m<f.length;m++){var I=f[m],v=I.boundingBox.width*I.boundingBox.height;v>A&&(A=v,c=I)}if(!c)throw"No largest barcode found";return c},x.prototype.createBarcodeDetectorFormats=function(u){for(var c=[],A=0,m=u;A<m.length;A++){var f=m[A];this.formatMap.has(f)?c.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:c}},x.prototype.toHtml5QrcodeSupportedFormats=function(u){if(!this.reverseFormatMap.has(u))throw"reverseFormatMap doesn't have ".concat(u);return this.reverseFormatMap.get(u)},x.prototype.createReverseFormatMap=function(){var u=new Map;return this.formatMap.forEach(function(c,A,m){u.set(c,A)}),u},x.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},x}(),oi=globalThis&&globalThis.__awaiter||function(x,u,c,A){function m(f){return f instanceof c?f:new c(function(I){I(f)})}return new(c||(c=Promise))(function(f,I){function v(y){try{C(A.next(y))}catch(N){I(N)}}function R(y){try{C(A.throw(y))}catch(N){I(N)}}function C(y){y.done?f(y.value):m(y.value).then(v,R)}C((A=A.apply(x,u||[])).next())})},ai=globalThis&&globalThis.__generator||function(x,u){var c={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]}
21,trys:[],ops:[]},A,m,f,I;return I={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function v(C){return function(y){return R([C,y])}}function R(C){if(A)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(c=0)),c;)try{if(A=1,m&&(f=C[0]&2?m.return:C[0]?m.throw||((f=m.return)&&f.call(m),0):m.next)&&!(f=f.call(m,C[1])).done)return f;switch(m=0,f&&(C=[C[0]&2,f.value]),C[0]){case 0:case 1:f=C;break;case 4:return c.label++,{value:C[1],done:!1};case 5:c.label++,m=C[1],C=[0];continue;case 7:C=c.ops.pop(),c.trys.pop();continue;default:if(f=c.trys,!(f=f.length>0&&f[f.length-1])&&(C[0]===6||C[0]===2)){c=0;continue}if(C[0]===3&&(!f||C[1]>f[0]&&C[1]<f[3])){c.label=C[1];break}if(C[0]===6&&c.label<f[1]){c.label=f[1],f=C;break}if(f&&c.label<f[2]){c.label=f[2],c.ops.push(C);break}f[2]&&c.ops.pop(),c.trys.pop();continue}C=u.call(x,c)}catch(y){C=[6,y],m=0}finally{A=f=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},za=function(){function x(u,c,A,m){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=A,c&&si.isSupported()?(this.primaryDecoder=new si(u,A,m),this.secondaryDecoder=new ii(u,A,m)):this.primaryDecoder=new ii(u,A,m)}return x.prototype.decodeAsync=function(u){return oi(this,void 0,void 0,function(){var c;return ai(this,function(A){switch(A.label){case 0:c=performance.now(),A.label=1;case 1:return A.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(u)];case 2:return[2,A.sent()];case 3:return this.possiblyLogPerformance(c),[7];case 4:return[2]}})})},x.prototype.decodeRobustlyAsync=function(u){return oi(this,void 0,void 0,function(){var c,A;return ai(this,function(m){switch(m.label){case 0:c=performance.now(),m.label=1;case 1:return m.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(u)];case 2:return[2,m.sent()];case 3:if(A=m.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(u)];throw A;case 4:return this.possiblyLogPerformance(c),[7];case 5:return[2]}})})},x.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},x.prototype.possiblyLogPerformance=function(u){if(!!this.verbose){var c=performance.now()-u;this.executionResults.push(c),this.executions++,this.possiblyFlushPerformanceReport()}},x.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var u=0,c=0,A=this.executionResults;c<A.length;c++){var m=A[c];u+=m}var f=u/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},x}(),Nr=globalThis&&globalThis.__extends||function(){var x=function(u,c){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,m){A.__proto__=m}||function(A,m){for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(A[f]=m[f])},x(u,c)};return function(u,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");x(u,c);function A(){this.constructor=u}u.prototype=c===null?Object.create(c):(A.prototype=c.prototype,new A)}}(),jn=globalThis&&globalThis.__awaiter||function(x,u,c,A){function m(f){return f instanceof c?f:new c(function(I){I(f)})}return new(c||(c=Promise))(function(f,I){function v(y){try{C(A.next(y))}catch(N){I(N)}}function R(y){try{C(A.throw(y))}catch(N){I(N)}}function C(y){y.done?f(y.value):m(y.value).then(v,R)}C((A=A.apply(x,u||[])).next())})},Kn=globalThis&&globalThis.__generator||function(x,u){var c={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},A,m,f,I;return I={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function v(C){return function(y){return R([C,y])}}function R(C){if(A)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(c=0)),c;)try{if(A=1,m&&(f=C[0]&2?m.return:C[0]?m.throw||((f=m.return)&&f.call(m),0):m.next)&&!(f=f.call(m,C[1])).done)return f;switch(m=0,f&&(C=[C[0]&2,f.value]),C[0]){case 0:case 1:f=C;break;case 4:return c.label++,{value:C[1],done:!1};case 5:c.label++,m=C[1],C=[0];continue;case 7:C=c.ops.pop(),c.trys.pop();continue;default:if(f=c.trys,!(f=f.length>0&&f[f.length-1])&&(C[0]===6||C[0]===2)){c=0;continue}if(C[0]===3&&(!f||C[1]>f[0]&&C[1]<f[3])){c.label=C[1];break}if(C[0]===6&&c.label<f[1]){c.label=f[1],f=C;break}if(f&&c.label<f[2]){c.label=f[2],c.ops.push(C);break}f[2]&&c.ops.pop(),c.trys.pop();continue}C=u.call(x,c)}catch(y){C=[6,y],m=0}finally{A=f=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},Ei=function(){function x(u,c){this.name=u,this.track=c}return x.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},x.prototype.apply=function(u){var c={};c[this.name]=u;var A={advanced:[c]};return this.track.applyConstraints(A)},x.prototype.value=function(){var u=this.track.getSettings();if(this.name in u){var c=u[this.name];return c}return null},x}(),Za=function(x){Nr(u,x);function u(c,A){return x.call(this,c,A)||this}return u.prototype.min=function(){return this.getCapabilities().min},u.prototype.max=function(){return this.getCapabilities().max},u.prototype.step=function(){return this.getCapabilities().step},u.prototype.apply=function(c){var A={};A[this.name]=c;var m={advanced:[A]};return this.track.applyConstraints(m)},u.prototype.getCapabilities=function(){this.failIfNotSupported();var c=this.track.getCapabilities(),A=c[this.name];return{min:A.min,max:A.max,step:A.step}},u.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},u}(Ei),ja=function(x){Nr(u,x);function u(c){return x.call(this,"zoom",c)||this}return u}(Za),Ka=function(x){Nr(u,x);function u(c){return x.call(this,"torch",c)||this}return u}(Ei),qa=function(){function x(u){this.track=u}return x.prototype.zoomFeature=function(){return new ja(this.track)},x.prototype.torchFeature=function(){return new Ka(this.track)},x}(),Qa=function(){function x(u,c,A){this.isClosed=!1,this.parentElement=u,this.mediaStream=c,this.callbacks=A,this.surface=this.createVideoElement(this.parentElement.clientWidth),u.append(this.surface)}return x.prototype.createVideoElement=function(u){var c=document.createElement("video");return c.style.width="".concat(u,"px"),c.style.display="block",c.muted=!0,c.setAttribute("muted","true"),c.playsInl
21ine=!0,c},x.prototype.setupSurface=function(){var u=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var c=function(){var A=u.surface.clientWidth,m=u.surface.clientHeight;u.callbacks.onRenderSurfaceReady(A,m),u.surface.removeEventListener("playing",c)};this.surface.addEventListener("playing",c),this.surface.srcObject=this.mediaStream,this.surface.play()},x.create=function(u,c,A,m){return jn(this,void 0,void 0,function(){var f,I;return Kn(this,function(v){switch(v.label){case 0:return f=new x(u,c,m),A.aspectRatio?(I={aspectRatio:A.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(I)]):[3,2];case 1:v.sent(),v.label=2;case 2:return f.setupSurface(),[2,f]}})})},x.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},x.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},x.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},x.prototype.resume=function(u){this.failIfClosed();var c=this,A=function(){setTimeout(u,200),c.surface.removeEventListener("playing",A)};this.surface.addEventListener("playing",A),this.surface.play()},x.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},x.prototype.getSurface=function(){return this.failIfClosed(),this.surface},x.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},x.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},x.prototype.applyVideoConstraints=function(u){return jn(this,void 0,void 0,function(){return Kn(this,function(c){if("aspectRatio"in u)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(u)]})})},x.prototype.close=function(){if(this.isClosed)return Promise.resolve();var u=this;return new Promise(function(c,A){var m=u.mediaStream.getVideoTracks(),f=m.length,I=0;u.mediaStream.getVideoTracks().forEach(function(v){u.mediaStream.removeTrack(v),v.stop(),++I,I>=f&&(u.isClosed=!0,u.parentElement.removeChild(u.surface),c())})})},x.prototype.getCapabilities=function(){return new qa(this.getFirstTrackOrFail())},x}(),Ja=function(){function x(u){this.mediaStream=u}return x.prototype.render=function(u,c,A){return jn(this,void 0,void 0,function(){return Kn(this,function(m){return[2,Qa.create(u,this.mediaStream,c,A)]})})},x.create=function(u){return jn(this,void 0,void 0,function(){var c,A;return Kn(this,function(m){switch(m.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return c={audio:!1,video:u},[4,navigator.mediaDevices.getUserMedia(c)];case 1:return A=m.sent(),[2,new x(A)]}})})},x}(),li=globalThis&&globalThis.__awaiter||function(x,u,c,A){function m(f){return f instanceof c?f:new c(function(I){I(f)})}return new(c||(c=Promise))(function(f,I){function v(y){try{C(A.next(y))}catch(N){I(N)}}function R(y){try{C(A.throw(y))}catch(N){I(N)}}function C(y){y.done?f(y.value):m(y.value).then(v,R)}C((A=A.apply(x,u||[])).next())})},ci=globalThis&&globalThis.__generator||function(x,u){var c={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},A,m,f,I;return I={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function v(C){return function(y){return R([C,y])}}function R(C){if(A)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(c=0)),c;)try{if(A=1,m&&(f=C[0]&2?m.return:C[0]?m.throw||((f=m.return)&&f.call(m),0):m.next)&&!(f=f.call(m,C[1])).done)return f;switch(m=0,f&&(C=[C[0]&2,f.value]),C[0]){case 0:case 1:f=C;break;case 4:return c.label++,{value:C[1],done:!1};case 5:c.label++,m=C[1],C=[0];continue;case 7:C=c.ops.pop(),c.trys.pop();continue;default:if(f=c.trys,!(f=f.length>0&&f[f.length-1])&&(C[0]===6||C[0]===2)){c=0;continue}if(C[0]===3&&(!f||C[1]>f[0]&&C[1]<f[3])){c.label=C[1];break}if(C[0]===6&&c.label<f[1]){c.label=f[1],f=C;break}if(f&&c.label<f[2]){c.label=f[2],c.ops.push(C);break}f[2]&&c.ops.pop(),c.trys.pop();continue}C=u.call(x,c)}catch(y){C=[6,y],m=0}finally{A=f=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},$a=function(){function x(){}return x.failIfNotSupported=function(){return li(this,void 0,void 0,function(){return ci(this,function(u){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new x]})})},x.prototype.create=function(u){return li(this,void 0,void 0,function(){return ci(this,function(c){return[2,Ja.create(u)]})})},x}(),e1=globalThis&&globalThis.__awaiter||function(x,u,c,A){function m(f){return f instanceof c?f:new c(function(I){I(f)})}return new(c||(c=Promise))(function(f,I){function v(y){try{C(A.next(y))}catch(N){I(N)}}function R(y){try{C(A.throw(y))}catch(N){I(N)}}function C(y){y.done?f(y.value):m(y.value).then(v,R)}C((A=A.apply(x,u||[])).next())})},t1=globalThis&&globalThis.__generator||function(x,u){var c={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]}
21,trys:[],ops:[]},A,m,f,I;return I={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function v(C){return function(y){return R([C,y])}}function R(C){if(A)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(c=0)),c;)try{if(A=1,m&&(f=C[0]&2?m.return:C[0]?m.throw||((f=m.return)&&f.call(m),0):m.next)&&!(f=f.call(m,C[1])).done)return f;switch(m=0,f&&(C=[C[0]&2,f.value]),C[0]){case 0:case 1:f=C;break;case 4:return c.label++,{value:C[1],done:!1};case 5:c.label++,m=C[1],C=[0];continue;case 7:C=c.ops.pop(),c.trys.pop();continue;default:if(f=c.trys,!(f=f.length>0&&f[f.length-1])&&(C[0]===6||C[0]===2)){c=0;continue}if(C[0]===3&&(!f||C[1]>f[0]&&C[1]<f[3])){c.label=C[1];break}if(C[0]===6&&c.label<f[1]){c.label=f[1],f=C;break}if(f&&c.label<f[2]){c.label=f[2],c.ops.push(C);break}f[2]&&c.ops.pop(),c.trys.pop();continue}C=u.call(x,c)}catch(y){C=[6,y],m=0}finally{A=f=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},n1=function(){function x(){}return x.retrieve=function(){if(navigator.mediaDevices)return x.getCamerasFromMediaDevices();var u=MediaStreamTrack;return MediaStreamTrack&&u.getSources?x.getCamerasFromMediaStreamTrack():x.rejectWithError()},x.rejectWithError=function(){var u=gn.unableToQuerySupportedDevices();return x.isHttpsOrLocalhost()||(u=gn.insecureContextCameraQueryError()),Promise.reject(u)},x.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var u=location.host.split(":")[0];return u==="127.0.0.1"||u==="localhost"},x.getCamerasFromMediaDevices=function(){return e1(this,void 0,void 0,function(){var u,c,A,m,f,I,v;return t1(this,function(R){switch(R.label){case 0:return u=function(C){for(var y=C.getVideoTracks(),N=0,X=y;N<X.length;N++){var W=X[N];W.enabled=!1,W.stop(),C.removeTrack(W)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return c=R.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(A=R.sent(),m=[],f=0,I=A;f<I.length;f++)v=I[f],v.kind==="videoinput"&&m.push({id:v.deviceId,label:v.label});return u(c),[2,m]}})})},x.getCamerasFromMediaStreamTrack=function(){return new Promise(function(u,c){var A=function(f){for(var I=[],v=0,R=f;v<R.length;v++){var C=R[v];C.kind==="video"&&I.push({id:C.id,label:C.label})}u(I)},m=MediaStreamTrack;m.getSources(A)})},x}(),Ue;(function(x){x[x.UNKNOWN=0]="UNKNOWN",x[x.NOT_STARTED=1]="NOT_STARTED",x[x.SCANNING=2]="SCANNING",x[x.PAUSED=3]="PAUSED"})(Ue||(Ue={}));var r1=function(){function x(){this.state=Ue.NOT_STARTED,this.onGoingTransactionNewState=Ue.UNKNOWN}return x.prototype.directTransition=function(u){this.failIfTransitionOngoing(),this.validateTransition(u),this.state=u},x.prototype.startTransition=function(u){return this.failIfTransitionOngoing(),this.validateTransition(u),this.onGoingTransactionNewState=u,this},x.prototype.execute=function(){if(this.onGoingTransactionNewState===Ue.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var u=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Ue.UNKNOWN,this.directTransition(u)},x.prototype.cancel=function(){if(this.onGoingTransactionNewState===Ue.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Ue.UNKNOWN},x.prototype.getState=function(){return this.state},x.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Ue.UNKNOWN)throw"Cannot transition to a new state, already under transition"},x.prototype.validateTransition=function(u){switch(this.state){case Ue.UNKNOWN:throw"Transition from unknown is not allowed";case Ue.NOT_STARTED:this.failIfNewStateIs(u,[Ue.PAUSED]);break;case Ue.SCANNING:break;case Ue.PAUSED:break}},x.prototype.failIfNewStateIs=function(u,c){for(var A=0,m=c;A<m.length;A++){var f=m[A];if(u===f)throw"Cannot transition from ".concat(this.state," to ").concat(u)}},x}(),i1=function(){function x(u){this.stateManager=u}return x.prototype.startTransition=function(u){return this.stateManager.startTransition(u)},x.prototype.directTransition=function(u){this.stateManager.directTransition(u)},x.prototype.getState=function(){return this.stateManager.getState()},x.prototype.canScanFile=function(){return this.stateManager.getState()===Ue.NOT_STARTED},x.prototype.isScanning=function(){return this.stateManager.getState()!==Ue.NOT_STARTED},x.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Ue.SCANNING},x.prototype.isPaused=function(){return this.stateManager.getState()===Ue.PAUSED},x}(),s1=function(){function x(){}return x.create=function(){return new i1(new r1)},x}
21(),o1=globalThis&&globalThis.__extends||function(){var x=function(u,c){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,m){A.__proto__=m}||function(A,m){for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(A[f]=m[f])},x(u,c)};return function(u,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");x(u,c);function A(){this.constructor=u}u.prototype=c===null?Object.create(c):(A.prototype=c.prototype,new A)}}(),mt=function(x){o1(u,x);function u(){return x!==null&&x.apply(this,arguments)||this}return u.DEFAULT_WIDTH=300,u.DEFAULT_WIDTH_OFFSET=2,u.FILE_SCAN_MIN_HEIGHT=300,u.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,u.MIN_QR_BOX_SIZE=50,u.SHADED_LEFT=1,u.SHADED_RIGHT=2,u.SHADED_TOP=3,u.SHADED_BOTTOM=4,u.SHADED_REGION_ELEMENT_ID="qr-shaded-region",u.VERBOSE=!1,u.BORDER_SHADER_DEFAULT_COLOR="#ffffff",u.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",u}(Ua),a1=function(){function x(u,c){this.logger=c,this.fps=mt.SCAN_DEFAULT_FPS,u?(u.fps&&(this.fps=u.fps),this.disableFlip=u.disableFlip===!0,this.qrbox=u.qrbox,this.aspectRatio=u.aspectRatio,this.videoConstraints=u.videoConstraints):this.disableFlip=mt.DEFAULT_DISABLE_FLIP}return x.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?mi.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},x.prototype.isShadedBoxEnabled=function(){return!Ft(this.qrbox)},x.create=function(u,c){return new x(u,c)},x}(),l1=function(){function x(u,c){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(u))throw"HTML Element with id=".concat(u," not found");this.elementId=u,this.verbose=!1;var A;typeof c=="boolean"?this.verbose=c===!0:c&&(A=c,this.verbose=A.verbose===!0,A.experimentalFeatures),this.logger=new Ga(this.verbose),this.qrcode=new za(this.getSupportedFormats(c),this.getUseBarCodeDetectorIfSupported(A),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=s1.create()}return x.prototype.start=function(u,c,A,m){var f=this;if(!u)throw"cameraIdOrConfig is required";if(!A||typeof A!="function")throw"qrCodeSuccessCallback is required and should be a function.";var I;m?I=m:I=this.verbose?this.logger.log:function(){};var v=a1.create(c,this.logger);this.clearElement();var R=!1;v.videoConstraints&&(v.isMediaStreamConstraintsValid()?R=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var C=R,y=document.getElementById(this.elementId);y.clientWidth?y.clientWidth:mt.DEFAULT_WIDTH,y.style.position="relative",this.shouldScan=!0,this.element=y;var N=this,X=this.stateManagerProxy.startTransition(Ue.SCANNING);return new Promise(function(W,re){var ie=C?v.videoConstraints:N.createVideoConstraints(u);if(!ie){X.cancel(),re("videoConstraints should be defined");return}var De={};(!C||v.aspectRatio)&&(De.aspectRatio=v.aspectRatio);var Ve={onRenderSurfaceReady:function(we,Q){N.setupUi(we,Q,v),N.isScanning=!0,N.foreverScan(v,A,I)}};$a.failIfNotSupported().then(function(we){we.create(ie).then(function(Q){return Q.render(f.element,De,Ve).then(function(fe){N.renderedCamera=fe,X.execute(),W(null)}).catch(function(fe){X.cancel(),re(fe)})}).catch(function(Q){X.cancel(),re(gn.errorGettingUserMedia(Q))})}).catch(function(we){X.cancel(),re(gn.cameraStreamingNotSupported())})})},x.prototype.pause=function(u){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Ue.PAUSED),this.showPausedState(),(Ft(u)||u!==!0)&&(u=!1),u&&this.renderedCamera&&this.renderedCamera.pause()},x.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var u=this,c=function(){u.stateManagerProxy.directTransition(Ue.SCANNING),u.hidePausedState()};if(!this.renderedCamera.isPaused()){c();return}this.renderedCamera.resume(function(){c()})},x.prototype.getState=function(){return this.stateManagerProxy.getState()},x.prototype.stop=function(){var u=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var c=this.stateManagerProxy.startTransition(Ue.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var A=function(){if(!!u.element){var f=document.getElementById(mt.SHADED_REGION_ELEMENT_ID);f&&u.element.removeChild(f)}},m=this;return this.renderedCamera.close().then(function(){return m.renderedCamera=null,m.element&&(m.element.removeChild(m.canvasElement),m.canvasElement=null),A(),m.qrRegion&&(m.qrRegion=null),m.context&&(m.context=null),c.execute(),m.hidePausedState(),m.isScanning=!1,Promise.resolve()})},x.prototype.scanFile=function(u,c){return this.scanFileV2(u,c).then(function(A){return A.decodedText})},x.prototype.scanFileV2=function(u,c){var A=this;if(!u||!(u instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Ft(c)&&(c=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(m,f){A.possiblyCloseLastScanImageFile(),A.clearElement(),A.lastScanImageFile=URL.createObjectURL(u);var I=new Image;I.onload=function(){var v=I.width,R=I.height,C=document.getElementById(A.elementId),y=C.clientWidth?C.clientWidth:mt.DEFAULT_WIDTH,N=Math.max(C.clientHeight?C.clientHeight:R,mt.FILE_SCAN_MIN_HEIGHT),X=A.computeCanvasDrawConfig(v,R,y,N);if(c){var W=A.createCanvasElement(y,N,"qr-canvas-visible");W.style.display="inline-block",C.appendChild(W);var re=W.getContext("2d");if(!re)throw"Unable to get 2d context from canvas";re.canvas.width=y,re.canvas.height=N,re.drawImage(I,0,0,v,R,X.x,X.y,X.width,X.height)}var ie=mt.FILE_SCAN_HIDDEN_CANVAS_PADDING,De=Math.max(I.width,X.width),Ve=Math.max(I.height,X.height),we=De+2*ie,Q=Ve+2*ie,fe=A.createCanvasElement(we,Q);C.appendChild(fe);var kt=fe.getContext("2d");if(!kt)throw"Unable to get 2d context from canvas";kt.canvas.width=we,kt.canvas.height=Q,kt.drawImage(I,0,0,v,R,ie,ie,De,Ve);try{A.qrcode.decodeRobustlyAsync(fe).then(function(be){m(ri.createFromQrcodeResult(be))}).catch(f)}catch(be){f("QR code parse error, error = ".concat(be))}},I.onerror=f,I.onabort=f,I.onstalled=f,I.onsuspend=f,I.src=URL.createObjectURL(u)})},x.prototype.clear=function(){this.clearElement()},x.getCameras=function(){return n1.retrieve()},x.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},x.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},x.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},x.prototype.applyVideoConstraints=function(u){if(u){if(!mi.isMediaStreamConstraintsValid(u,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(u)},x.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera}
21,x.prototype.getSupportedFormats=function(u){var c=[Y.QR_CODE,Y.AZTEC,Y.CODABAR,Y.CODE_39,Y.CODE_93,Y.CODE_128,Y.DATA_MATRIX,Y.MAXICODE,Y.ITF,Y.EAN_13,Y.EAN_8,Y.PDF_417,Y.RSS_14,Y.RSS_EXPANDED,Y.UPC_A,Y.UPC_E,Y.UPC_EAN_EXTENSION];if(!u||typeof u=="boolean"||!u.formatsToSupport)return c;if(!Array.isArray(u.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(u.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var A=[],m=0,f=u.formatsToSupport;m<f.length;m++){var I=f[m];ka(I)?A.push(I):this.logger.warn("Invalid format: ".concat(I," passed in config, ignoring."))}if(A.length===0)throw"None of formatsToSupport match supported values.";return A},x.prototype.getUseBarCodeDetectorIfSupported=function(u){if(Ft(u))return!0;if(!Ft(u.useBarCodeDetectorIfSupported))return u.useBarCodeDetectorIfSupported!==!1;if(Ft(u.experimentalFeatures))return!0;var c=u.experimentalFeatures;return Ft(c.useBarCodeDetectorIfSupported)?!0:c.useBarCodeDetectorIfSupported!==!1},x.prototype.validateQrboxSize=function(u,c,A){var m=this,f=A.qrbox;this.validateQrboxConfig(f);var I=this.toQrdimensions(u,c,f),v=function(C){if(C<mt.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(mt.MIN_QR_BOX_SIZE,"px.")},R=function(C){return C>u&&(m.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),C=u),C};v(I.width),v(I.height),I.width=R(I.width)},x.prototype.validateQrboxConfig=function(u){if(typeof u!="number"&&typeof u!="function"&&(u.width===void 0||u.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},x.prototype.toQrdimensions=function(u,c,A){if(typeof A=="number")return{width:A,height:A};if(typeof A=="function")try{return A(u,c)}catch(m){throw new Error("qrbox config was passed as a function but it failed with unknown error"+m)}return A},x.prototype.setupUi=function(u,c,A){A.isShadedBoxEnabled()&&this.validateQrboxSize(u,c,A);var m=Ft(A.qrbox)?{width:u,height:c}:A.qrbox;this.validateQrboxConfig(m);var f=this.toQrdimensions(u,c,m);f.height>c&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var I=A.isShadedBoxEnabled()&&f.height<=c,v={x:0,y:0,width:u,height:c},R=I?this.getShadedRegionBounds(u,c,f):v,C=this.createCanvasElement(R.width,R.height),y={willReadFrequently:!0},N=C.getContext("2d",y);N.canvas.width=R.width,N.canvas.height=R.height,this.element.append(C),I&&this.possiblyInsertShadingElement(this.element,u,c,f),this.createScannerPausedUiElement(this.element),this.qrRegion=R,this.context=N,this.canvasElement=C},x.prototype.createScannerPausedUiElement=function(u){var c=document.createElement("div");c.innerText=gn.scannerPaused(),c.style.display="none",c.style.position="absolute",c.style.top="0px",c.style.zIndex="1",c.style.background="rgba(9, 9, 9, 0.46)",c.style.color="#FFECEC",c.style.textAlign="center",c.style.width="100%",u.appendChild(c),this.scannerPausedUiElement=c},x.prototype.scanContext=function(u,c){var A=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(m){return u(m.text,ri.createFromQrcodeResult(m)),A.possiblyUpdateShaders(!0),!0}).catch(function(m){A.possiblyUpdateShaders(!1);var f=gn.codeParseError(m);return c(f,Va.createFrom(f)),!1})},x.prototype.foreverScan=function(u,c,A){var m=this;if(!!this.shouldScan&&!!this.renderedCamera){var f=this.renderedCamera.getSurface(),I=f.videoWidth/f.clientWidth,v=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var R=this.qrRegion.width*I,C=this.qrRegion.height*v,y=this.qrRegion.x*I,N=this.qrRegion.y*v;this.context.drawImage(f,y,N,R,C,0,0,this.qrRegion.width,this.qrRegion.height);var X=function(){m.foreverScanTimeout=setTimeout(function(){m.foreverScan(u,c,A)},m.getTimeoutFps(u.fps))};this.scanContext(c,A).then(function(W){!W&&u.disableFlip!==!0?(m.context.translate(m.context.canvas.width,0),m.context.scale(-1,1),m.scanContext(c,A).finally(function(){X()})):X()}).catch(function(W){m.logger.logError("Error happend while scanning context",W),X()})}},x.prototype.createVideoConstraints=function(u){if(typeof u=="string")return{deviceId:{exact:u}};if(typeof u=="object"){var c="facingMode",A="deviceId",m={user:!0,environment:!0},f="exact",I=function(re){if(re in m)return!0;
21throw"config has invalid 'facingMode' value = "+"'".concat(re,"'")},v=Object.keys(u);if(v.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(v.length," keys");var R=Object.keys(u)[0];if(R!==c&&R!==A)throw"Only '".concat(c,"' and '").concat(A,"' ")+" are supported for 'cameraIdOrConfig'";if(R===c){var C=u.facingMode;if(typeof C=="string"){if(I(C))return{facingMode:C}}else if(typeof C=="object")if(f in C){if(I(C["".concat(f)]))return{facingMode:{exact:C["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var y=typeof C;throw"Invalid type of 'facingMode' = ".concat(y)}}else{var N=u.deviceId;if(typeof N=="string")return{deviceId:N};if(typeof N=="object"){if(f in N)return{deviceId:{exact:N["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var X=typeof N;throw"Invalid type of 'deviceId' = ".concat(X)}}}var W=typeof u;throw"Invalid type of 'cameraIdOrConfig' = ".concat(W)},x.prototype.computeCanvasDrawConfig=function(u,c,A,m){if(u<=A&&c<=m){var f=(A-u)/2,I=(m-c)/2;return{x:f,y:I,width:u,height:c}}else{var v=u,R=c;return u>A&&(c=A/u*c,u=A),c>m&&(u=m/c*u,c=m),this.logger.log("Image downsampled from "+"".concat(v,"X").concat(R)+" to ".concat(u,"X").concat(c,".")),this.computeCanvasDrawConfig(u,c,A,m)}},x.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var u=document.getElementById(this.elementId);u&&(u.innerHTML="")},x.prototype.possiblyUpdateShaders=function(u){this.qrMatch!==u&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(c){c.style.backgroundColor=u?mt.BORDER_SHADER_MATCH_COLOR:mt.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=u)},x.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},x.prototype.createCanvasElement=function(u,c,A){var m=u,f=c,I=document.createElement("canvas");return I.style.width="".concat(m,"px"),I.style.height="".concat(f,"px"),I.style.display="none",I.id=Ft(A)?"qr-canvas":A,I},x.prototype.getShadedRegionBounds=function(u,c,A){if(A.width>u||A.height>c)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(u-A.width)/2,y:(c-A.height)/2,width:A.width,height:A.height}},x.prototype.possiblyInsertShadingElement=function(u,c,A,m){if(!(c-m.width<1||A-m.height<1)){var f=document.createElement("div");f.style.position="absolute";var I=(c-m.width)/2,v=(A-m.height)/2;if(f.style.borderLeft="".concat(I,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(I,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(v,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(v,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(mt.SHADED_REGION_ELEMENT_ID),c-m.width<11||A-m.height<11)this.hasBorderShaders=!1;else{var R=5,C=40;this.insertShaderBorders(f,C,R,-R,null,0,!0),this.insertShaderBorders(f,C,R,-R,null,0,!1),this.insertShaderBorders(f,C,R,null,-R,0,!0),this.insertShaderBorders(f,C,R,null,-R,0,!1),this.insertShaderBorders(f,R,C+R,-R,null,-R,!0),this.insertShaderBorders(f,R,C+R,null,-R,-R,!0),this.insertShaderBorders(f,R,C+R,-R,null,-R,!1),this.insertShaderBorders(f,R,C+R,null,-R,-R,!1),this.hasBorderShaders=!0}u.append(f)}},x.prototype.insertShaderBorders=function(u,c,A,m,f,I,v){var R=document.createElement("div");R.style.position="absolute",R.style.backgroundColor=mt.BORDER_SHADER_DEFAULT_COLOR,R.style.width="".concat(c,"px"),R.style.height="".concat(A,"px"),m!==null&&(R.style.top="".concat(m,"px")),f!==null&&(R.style.bottom="".concat(f,"px")),v?R.style.left="".concat(I,"px"):R.style.right="".concat(I,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(R),u.appendChild(R)},x.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},x.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},x.prototype.getTimeoutFps=function(u){return 1e3/u},x}();globalThis&&globalThis.__awaiter;globalThis&&globalThis.__generator;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__generator;var ui;(function(x){x[x.STATUS_DEFAULT=0]="STATUS_DEFAULT",x[x.STATUS_SUCCESS=1]="STATUS_SUCCESS",x[x.STATUS_WARNING=2]="STATUS_WARNING",x[x.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(ui||(ui={}));var qn;(function(x){x[x.BACK=1]="BACK",x[x.FRONT=2]="FRONT"})(qn||(qn={}));var Qn;(function(x){x[x.PORTRAIT=1]="PORTRAIT",x[x.LANDSCAPE=2]="LANDSCAPE",x[x.ADAPTIVE=3]="ADAPTIVE"})(Qn||(Qn={}));var yr;(function(x){x[x.ALL=17]="ALL"})(yr||(yr={}));const c1=Object.assign(Object.assign({},Y),yr);var hi;(function(x){x.ZXING="zxing",x.MLKIT="mlkit"})(hi||(hi={}));const u1=[{selector:".scanner-container-display",css:"display: block;"},{selector:".scanner-dialog",css:"display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"},{selector:".scanner-dialog-inner",css:"background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;"},{selector:".close-button",css:"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;"},{selector:".close-button:hover",css:"color: #222;"},{selector:".scanner-container-full-width",css:"width: 100%;"}];function h1(x){const u="custom-style-os-cap-barcode";let c=document.getElementById(u);if(c||(c=document.createElement("style"),c.type="text/css",c.id=u,document.head.appendChild(c)),c.sheet){for(;c.sheet.cssRules.length;)c.sheet.deleteRule(0);for(const{selector:A,css:m}of x)c.sheet.insertRule(`${A} { ${m} }`)}else{c.textContent="";for(const{selector:A,css:m}of x)c.textContent+=`${A} { ${m} }`}}const f1=Jn("CapacitorBarcodeScanner",{web:()=>(h1(u1),Tr(()=>import("./web.23db95cb.js"),["assets/web.23db95cb.js","assets/group-base.c3e2796d.js","assets/group-surveyjs.86bba1b9.js","assets/pages-error.1aae2637.js","assets/group-surveyjs.75bf9ea9.css","assets/group-base.2652d482.css"]).then(x=>new x.CapacitorBarcodeScannerWeb))});class d1{static async scanBarcode(u){return u.scanInstructions=u.scanInstructions||" ",u.scanButton=u.scanButton||!1,u.scanText=u.scanText||" ",u.cameraDirection=u.cameraDirection||qn.BACK,u.scanOrientation=u.scanOrientation||Qn.ADAPTIVE,f1.scanBarcode(u)}}const g1=[{selector:".scanner-container-display",css:"display: block;"},{selector:".scanner-dialog",css:"display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"},{selector:".scanner-dialog-inner",css:"background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;"},{selector:".close-button",css:"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;"},{selector:".close-button:hover",css:"color: #222;"},{selector:".scanner-container-full-width",css:"width: 100%;"}];function x1(x){const u="custom-style-os-cap-barcode";let c=document.getElementById(u);if(c||(c=document.createElement("style"),c.type="text/css",c.id=u,document.head.appendChild(c)),c.sheet){for(;c.sheet.cssRules.length;)c.sheet.deleteRule(0);for(const{selector:A,css:m}of x)c.sheet.insertRule(`${A} { ${m} }`)}else{c.textContent="";for(const{selector:A,css:m}of x)c.textContent+=`${A} { ${m} }`}}const w1=Jn("CapacitorBarcodeScannerPatchWeb",{web:()=>(x1(g1),Tr(()=>import("./web.f76b72d5.js"),["assets/web.f76b72d5.js","assets/group-base.c3e2796d.js","assets/group-surveyjs.86bba1b9.js","assets/pages-error.1aae2637.js","assets/group-surveyjs.75bf9ea9.css","assets/group-base.2652d482.css"]).then(x=>new x.CapacitorBarcodeScannerWeb))});class C1{static async scanBarcode(u){return u.scanInstructions=u.scanInstructions||" ",u.scanButton=u.scanButton||!1,u.scanText=u.scanText||" ",u.cameraDirection=u.cameraDirection||qn.BACK,u.scanOrientation=u.scanOrientation||Qn.ADAPTIVE,w1.scanBarcode(u)}}class A1 extends rs{constructor(){super(...arguments),this.ERROR_PICK_FILE_CANCELED="pickFiles canceled."}async checkPermissions(){throw this.unimplemented("Not implemented on web.")}async convertHeicToJpeg(u){throw this.unimplemented("Not implemented on web.")}async pickFiles(u){const c=await this.openFilePicker(u);if(!c)throw new Error(this.ERROR_PICK_FILE_CANCELED);const A={files:[]};for(const m of c){const f={blob:m,modifiedAt:m.lastModified,mimeType:this.getMimeTypeFromUrl(m),name:this.getNameFromUrl(m),path:void 0,size:this.getSizeFromUrl(m)};u!=null&&u.readData&&(f.data=await this.getDataFromFile(m)),A.files.push(f)}return A}async pickImages(u){return this.pickFiles(Object.assign({types:["image/*"]},u))}async pickMedia(u){return this.pickFiles(Object.assign({types:["image/*","video/*"]},u))}async pickVideos(u){return this.pickFiles(Object.assign({types:["video/*"]},u))}async requestPermissions(u){throw this.unimplemented("Not implemented on web.")}async openFilePicker(u){var c;const A=((c=u==null?void 0:u.types)===null||c===void 0?void 0:c.join(","))||"",m=(u==null?void 0:u.limit)===void 0?0:u.limit;return new Promise(f=>{let I=!1;const v=document.createElement("input");v.type="file",v.accept=A,v.multiple=m===0,v.addEventListener("change",()=>{I=!0;const R=Array.from(v.files||[]);f(R)},{once:!0}),window.addEventListener("focus",async()=>{await this.wait(1e3),!I&&f(void 0)},{once:!0}),v.click()})}async getDataFromFile(u){return new Promise((c,A)=>{const m=new FileReader;
21m.readAsDataURL(u),m.onload=()=>{const v=(typeof m.result=="string"?m.result:"").split("base64,")[1]||"";c(v)},m.onerror=f=>{A(f)}})}getNameFromUrl(u){return u.name}getMimeTypeFromUrl(u){return u.type}getSizeFromUrl(u){return u.size}async wait(u){return new Promise(c=>setTimeout(c,u))}}const m1=Jn("FilePicker",{web:()=>new A1});const E1={class:"c-scanQRCode"},p1={key:0,class:"c-scanQRCode_text"},_1={class:"c-scanQRCode_error"},b1={key:0,class:"sd-question--error"},I1={class:"sd-question__erbox"},y1=B("div",{class:"sr-only",id:"reader"},null,-1),S1={class:"g-buttonGroup"},T1=st({__name:"ScanQRCode",emits:["loginSuccessful"],setup(x,{emit:u}){const c=Ct(),A=u,m=pe(!0),f=pe(),I=async y=>{const N=y.split("?")[1];if(!N){f.value=c.componentScanQRCodeErrorNoCredentials;return}const X=new URLSearchParams(N);try{await $n.login(X.get("username")||"",X.get("password")||""),A("loginSuccessful")}catch{f.value=c.componentScanQRCodeErrorWrongCredentials}},v=async()=>{f.value=void 0;let y=d1;m.value&&(y=C1);let N;try{N=await y.scanBarcode({hint:c1.ALL})}catch(X){console.debug(X),f.value=c.componentScanQRCodeErrorWrongQRCode}if(!N){f.value=c.componentScanQRCodeErrorWrongQRCode;return}await I(N==null?void 0:N.ScanResult)},R=(y,N)=>{const X=y.replace(/^data:.+;base64,/,""),W=atob(X),re=new Array(W.length);for(let De=0;De<W.length;De++)re[De]=W.charCodeAt(De);const ie=new Uint8Array(re);return new Blob([ie],{type:N})},C=async()=>{f.value=void 0;let y;try{const De=await m1.pickImages({limit:1,readData:!0});De.files.length>=0&&(y=De.files[0])}catch{return}if(!y)return;const N=y==null?void 0:y.data;if(!N){f.value=c.componentScanQRCodeErrorWrongQRCode;return}const X=R(N,y.mimeType);if(!X){f.value=c.componentScanQRCodeErrorWrongQRCode;return}const W=new File([X],y.name,{type:y.mimeType});if(!W){f.value=c.componentScanQRCodeErrorWrongQRCode;return}const re=new l1("reader");let ie;try{ie=await re.scanFile(W,!1)}catch(De){f.value=c.componentScanQRCodeErrorWrongQRCode,console.debug(De)}if(!ie){f.value=c.componentScanQRCodeErrorWrongQRCode;return}await I(ie)};return xn(async()=>{m.value=await is.isPlatformWeb()}),(y,N)=>(Z(),ne("div",E1,[L(c).componentScanQRCodeText?(Z(),ne("p",p1,K(L(c).componentScanQRCodeText),1)):oe("",!0),B("div",_1,[f.value?(Z(),ne("div",b1,[B("div",I1,K(f.value),1)])):oe("",!0)]),y1,B("div",S1,[B("button",{class:"g-button -primary -md",onClick:v},K(L(c).componentScanQRCodeButtonScan),1),B("button",{class:"g-button -secondary -md",onClick:C},K(L(c).componentScanQRCodeButtonFile),1)])]))}});const N1={class:"v-login"},R1={class:"v-login_header"},O1={class:"v-login_title"},v1={key:0,class:"v-login_intro"},D1={class:"v-login_qrCode"},M1={class:"v-login_grid"},B1={class:"v-login_manual"},P1={class:"v-login_register"},L1=st({__name:"LoginView",setup(x){const u=Ct(),c=ts(),A=()=>{c.push({name:"diaryDashboard"}).catch(m=>console.debug(m))};return(m,f)=>
21(Z(),ne("div",N1,[B("div",R1,[B("h1",O1,K(L(u).viewLoginTitle),1),L(u).viewLoginIntro?(Z(),ne("p",v1,K(L(u).viewLoginIntro),1)):oe("",!0)]),B("div",D1,[it(T1,{onLoginSuccessful:A})]),B("div",M1,[B("div",B1,[it(Da,{onLoginSuccessful:A})]),B("div",P1,[it(Fa)])])]))}}),F1=tn(L1,[["__scopeId","data-v-cabbd416"]]),j1=Object.freeze(Object.defineProperty({__proto__:null,default:F1},Symbol.toStringTag,{value:"Module"}));class k1{static async getPage(u){return(await It.get(`pages/${u}/`)).data}}class U1{static async getPage(u){try{return await k1.getPage(u)}catch(c){console.debug(c)}}}const V1={class:"c-content"},G1=["innerHTML"],H1=st({__name:"FAQPage",setup(x){const{renderMD:u,renderInlineMD:c}=hs(),A=Ct(),m=us(),f=pe(""),I=pe(""),v=pe(""),R=pe(!1);return xn(async()=>{R.value=!0;const C=await U1.getPage("faq");C&&(f.value=C.title||"",I.value=C.intro||"",v.value=C.text||"");const y=ws(A.navigationDocumentTitleDiaryFaq);m.value=ss(y),R.value=!1}),(C,y)=>(Z(),ne("div",V1,[R.value?oe("",!0):(Z(),ne(br,{key:0},[it(os,{icon:"lightbulb",headline:L(c)(f.value),text:L(c)(I.value)},null,8,["headline","text"]),v.value?(Z(),ne("div",{key:0,class:"c-content_body",innerHTML:L(u)(v.value)},null,8,G1)):oe("",!0)],64)),R.value?(Z(),tt(Dn,{key:1})):oe("",!0)]))}}),W1=tn(H1,[["__scopeId","data-v-62cf23a7"]]),K1=Object.freeze(Object.defineProperty({__proto__:null,default:W1},Symbol.toStringTag,{value:"Module"}));export{Qn as C,wi as F,l1 as H,j1 as L,Z1 as S,$r as _,ei as a,K1 as b,ws as r};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.